Help needed with DissectorTable
Hi, I wrote a lua dissector about a year ago and have forgotten some of my understanding of how dissectors work. The Ethernet packet I need to dissect has the following structure (simplified):
- TransportHeader (which includes MessageType and PayloadLength fields)
- Message (of type: MessageType and of length: PayloadLength)
I have a top-level 'general.lua' file that parses the TransportHeader and which creates a DissectorTable. The next level dissector (for the specific message type) is invoked by calling:
xran_dissector_table:try(ecpriMessage, buffer(8):tvb(),pinfo,tree)
My problem is that the lower level dissector currently doesn't know the length of Message. (The buffer passed to it contains the message and some padding). I can see two possibilities:
- Pass PayloadLength to the lower level dissector
- Limit the buffer passed to the lower level dissector to length PayloadLength
I don't know how to do either of these. Which would be the best solution and how would I do it?