Ask Your Question

Revision history [back]

Calling proto_register_field_array outside of proto_register_MYPROTOCOL?

Hello! So I have written a dissector for a custom protocol and in several instances I have a payload that does will only have a certain number of 32 bit words contain valid data while others will contain a marker like 0xdeadbeef to indicate that they weren't used. This is highly variable. The way I currently understand dissection with C, you must register all header fields and the base/display types within the proto_register_MYPROTOCOL function by calling proto_register_field_array on an array of header fields. This leaves the base and field type rigid, with no ability to change it later. Is there any way to allocate header fields only when I need to depending on whether a payload subdissector is called or not, without having to declare all beforehand?