Enable Search by Subtree in LUA Script
Hi there,
I have a LUA script for a dissector and I want the subtrees to be searchable from the search bar like: MyProtocol.subtreename.fieldname or another similar method.
Currently I can search like: MyProtocol.fieldname, but it is not that useful as same field can appear on multiple subtree types.
Context: I have many types of messages coming and I parse them into a subtree depending on their type on the run. For example, if 3rd byte of the incoming message is 3, it is parsed to message fields corresponding to type 3.
Example for message type 3:
My Protocol
-Message Type 3 Subtree
--Message Type 3 field 1
--Message Type 3 field 2
--Message Type 3 field 3
For message type 4:
My Protocol
-Message Type 4 Subtree
--Message Type 4 field 1
--Message Type 4 field 2
I want to search by MyProtocol.Message_Type_4_Subtree.
I am open to any advise or any other method to achieve something similar.
Many Thanks
Can you share code showing how you add your protocol and fields.
Or point to an example on the Lua section of the wiki.
Code excerpt:
This is a general idea of what is happening. I had to hide some information so if there are any syntax errors, ignore as it parses correctly both the ...(more)
Not that it's perfect (the bazillion protocols for BT GATT - ugh) but have you looked at how other protocols handle this. You could look at the Wireshark Display Filter Reference or in the gui - Table 3.5. Internals menu items
(more)Here's a POC. Close to what you're looking for?
I don't understand your question.
In the particular example you've given, can't you just filter for
myprotocol.type == 3
? Doesn't that always give exactly the same results as filtering for the existence of the Message Type 3 Subtree?