Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Registering protocol details

From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
Date: Sun, 7 Aug 2016 21:51:36 +0200
Hi Paul,

2016-08-07 18:42 GMT+02:00 Paul Offord <Paul.Offord@xxxxxxxxxxxx>:

Hi Anders,

 

Ah – I understand.  I had asked Gerald about that at SF16 and he mentioned the ability to use other pcap-ng block types.  I’d like to do that in the future, but I don’t want to tackle it yet.  This wouldn’t overcome the problem I have anyway.

 

So going back to the original question, can I call function calls like proto_register_add_subtree and proto_register_add_item from with the dissect_foo function or do I have to make them from proto_register_foo?


As far as I know you need to register fields before dissection starts. It can be done dynamically based on some file selected in preferences, but I don't think it can be done on the fly during dissection.
That said when looking at the proto_register_field_array() code, I do not see any assertion related to this, but I would not be surprised if things like filtering do not work as expected if you add new fields as dissection goes. And as far as I can tell, no dissector is doing something as you suggest yet.
I will let another developer correct my assumptions if I'm wrong.

Regards,
Pascal.