I've been trying to get a comparison going on my code, but can't seem to manage the way to do it: I have this field:
I then eventually set it's value:
And the value shows up correctly on the dissector window (I've checked, and it works for every one of the 128 fields.. >_<) Now, onto parsing the rest of the data, I'm trying to conditionally execute my code based upon the boolean fields, but cannot seem to: These DO work on the GUI, but DO NOT work on the code(devel 1.7.0):
This too does not work (for some reason beyond my comprehension):
Neither does this:
(the offsets are correct on the code, I’m just simplifing them here) So, is there a way to actually do it? What am I doing wrong? asked 24 Feb ‘12, 23:14 gutoandreollo edited 25 Feb ‘12, 17:02 helloworld |
One Answer:
Display Filters != LuaBy "work on the GUI", are you referring to the Display Filter Textbox? As in: you enter In your Lua, this line:
is comparing whether the Maybe you meant to use the variable (with a similar name) you had declared earlier:
but that would be comparing a
does anything for you. That's comparing a boolean field (which presumably only accepts Use |
By
(data(correct_offset,1):uint() and 0x80)
do you mean to perform a bitwise-and? If so, this may be part of your problem. I don’t know if this has changed since I last implemented a Lua-based dissector, but Wireshark’s Lua interpreter does not have an extension for bitwise operators. See this article on the lua-users wiki.