Ask Your Question

Revision history [back]

A first observation is that using C++ for a dissector isn't supported, but, depending on what C++ constructs you use, you might get it to work. The normal target for dissectors is C99.

Many dissectors handle field presence. In general, you register all the fields, but you only add data to it (.e. with proto_tree_add_item) if the field is present in the packet.

If your protocol provides sufficient info in the packet to determine which header is in use (maybe a key value, or message length or something else distinctive), then you can simply program that in your dissector. If it doesn't, then you'll require user support with a preference to indicate which header type is in use.