Hello, I have a basic lua dissector where data from the packet is being displayed properly in a tree view. I am trying to display some calculated values based on the data in the protocol; however, none of the data is being displayed as documented. Question: Has anybody successfully used the treeitem:set_generated() function as documented in the lua API? Here's the basic construct that I am using: local ABCD = Proto("ABCD") local ABCDFields = ABCD.fields ABCDFields.f1 = ProtoField.uint32("ABCD.f1") -- data extracted from packet ABCDFields.f2 = ProtoField.uint32("ABCD.f2") -- data extracted from packet ABCDFields.f3 = ProtoField.double("ABCD.f3") -- calculated based on f1 and f2 function ABCD.dissector(buffer, pinfo, tree) local maxLen = buffer:len() local start = maxLen - 15 local f1 = tonumber('0x'..buffer:range(start, 4), 16) local f2 = tonumber('0x'..buffer:range(start+4, 4), 16) local f3 = <do some="" math="" on="" f1="" and="" f2=""> local subtree = tree:add(ABCD, buffer()) subtree:add(ABCDFields.f1, f1) -- displays properly subtree:add(ABCDFields.f2, f2) -- displays properly subtree:add(ABCDFields.f3, f3) -- displays f3 subtree:set_generated() -- if this is added, then I would expect f3 to be displayed in brackets; however, this has no impact end ... asked 07 Jun '11, 09:30 mrai |
One Answer:
The problem is you're calling Change the last two lines from:
to:
answered 07 Jun '11, 09:42 bstn |