LUA: dissector wide global table
asked Nov 22 '17
updated Jan 30 '19
Hi,
I need to implement latency and concurrency analysis via Lua, similar to what is available in many other (builtin) dissectors. Typically the entry in the tree is called "Time from request", and the C dissectors simply allocate a global table of the requests to track, match the responses and display the result eventually.
However, I'm having a hard time trying to figure out how wireshark-lua lets me create a proto object, where I can add an object-wide table for reference across individual packet dissections (or even really global variables).
Also, there seems to be not a single sample of wireshark Lua where this is demonstrated.
For example, "self" seems to be missing in all object methods (?), and global variables stay "nil" (even if initialized) between packets...
Any help in figuring out how to implement a global table would be really appreciated.
thanks!

The normal term for "synthetic" fields is "generated" as in generated by the dissector.
Thank you for reminding me, @User 98587, I've edited the Answer accordingly.
Thanks! I defined the base reference in the .init of the dissector, this seems to have done the trick. I keep my data in a rbtree for quickly checking if the entry already exists, seems to work so far.
One follow up question: In packet-rpc.c, this fragment adds a "hyperlink" to another frame, but there is nothing in the source code that is obvious how to make this happen:
In the wireshark view, these entries get a blue hyperlink, and a double-click will set the focus to the referred frame.
How is this achieved in the c dissector, and can LUA do the same?
Because the hf fieldtype is set to "FT_FRAMENUM":