Snippet of my dissector:
local proto = Proto("myproto", "my proto")
local n_visited = 0
function proto.dissector(tvbuf, pinfo, tree)
-- ...
-- ...
if not pinfo.visited then
n_visited = n_visited + 1
end
-- ...
-- ...
end
DissectorTable.get("tcp.port"):add(12345, proto)
Based on my testing, Wireshark loads the dissector module only once so the module's private global var n_visited is shared between packet files. Is there a way I can define packetfile specific global vars?
Quoting the answer from ask.wireshark.org: