Start a Conversation

Unsolved

This post is more than 5 years old

1267

January 17th, 2012 14:00

Help wrapping my head around VARBIND parsing

I am trying to write an ASL hook script that will parse a particular varbind from NOTIF. The vendor has utlized a single varbind to pass most of their event information with the format of

Field1: Value\n

Field2: Value\n

Field3: Value\n
etc...

Not every trap will have every field in this VARBIND, but thankfully the field names are unique for their usage (different traps will have different combinations of field names, but in the same order). Field1 will always come before Field2 and so on, but all fields may or may not be present. The biggest conundrum for me is that the single VARBIND value contains newline characters, and I cannot find information in the documentation on how to handle this.

How should this work? I was thinking something like...

START {
input = V2;
..eol
FIELD1?
FIELD2?
FIELD3?
FIELD4?
ETC...
} do {
}

FIELD1 {
"Field1: " Field1:rep(word)
} do {
USERDEFINED1 = Field1;
}

FIELD2 {
"Field2: " Field2:rep(word)
} do {
USERDEFINED2 = Field2;
}

etc...

No Responses!
No Events found!

Top