ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Converting to new proto tree too complex/errorprone

From: Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx>
Date: Sat, 21 Dec 2013 13:09:28 +0100
Hello,

On Sat, Dec 21, 2013 at 11:27:27AM +0100, Joerg Mayer wrote:
> converting a dissector to the new proto tree api is still unnecessarily
> complex (and I managed to break all buildbots in the course).
> I've attached a diff between the result of the conversion script output
> and the currently committed source. Can you please take a look whether
> at least some of this can be improved (if the script had been in perl
> I'd probably would have tried to fix some of these things myself).

It might be possible to replace proto_peekremote / add NEW_PROTO_TREE_API define before config.h include.

Still if we're no longer forced to have header_field_info in register routine, I was thinking we could put hfi just before use.
You can check sample in packet-netlink-sock_diag.c, which I base on packet-mpeg-descriptor.c

Also Peter suggested some modification to create HFI_REG_VAR macro[1].


btw. recently I have been doing some research if it's possible to do this kind of optimization using clang/ gcc plugins.
Right now I have no code.


[1] https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9498#c16