Lua dissector: Field extractor to get the last matched userdata
I want to create a Lua Dissector for LLDP TLV.
Pseudocode:
local subtype_f = Field.new("lldp.ieee.802_1.subtype")
local myproto = Proto("myproto", "My Proto")
function myproto.dissector(buf, pinfo, treeitem)
local subtype = subtype_f()
if subtype.value == A_SUBTYPE then
do_something
end
end
register_postdissector(myproto)
In one packet, there are 3 TLVs containing "lldp.ieee.802_1.subtype" field,
but the code local subtype = subtype_f()
only get the first one FieldInfo
,
How can I get the last one or retrieve the return value of subtype_f()