The Situation
I'm writing a custom lua dissector for a protocol. We capture the protocl with custom hardware which gives us PCAP files. The protocol consists of 64 bit packets.
The protocol has a "start transaction" bit, which indicates the start of an 8 packet transaction, and depending on where we are in that transaction parts of the packet has a different meaning, i.e. in the packet with the start transaction bit, the packet starts with a header, then the next packet contains the message code in that same spot. There are in total 8 different ways to interpret the same offset of the packet, depending on where we are in the transaction.
I want to dissect the protocol and have the field depend on where we are in the transaction.
What I've tried
I created a simple sequence counter variable outside the dissector function, which is reset if the transaction start bit is encountered. and it counts to 8. Depending on that counter I select which protofields I should add to the tree.
This kind of works, if I show all the different fields as columns, they have the correct values in the right places. However, when I click a packet the packet details show no or the wrong field names, depending on the order in which I click the packets. For example If I click a packet with the "transaction start" then the packet info correctly shows the data as "header". However, if I then click any other packet the field is shown as "message code".
It seems like the order for the disection in the packet info field is not fixed, it uses the order in which I click the packets, not the order in which they were captured.
Is wireshark even suited to base the way it dissects a certain packet solely on the order in which it was received?