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] convert_proto_tree_add_text.pl

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sun, 14 Jul 2013 12:40:54 -0700
On Jul 13, 2013, at 7:40 PM, mmann78@xxxxxxxxxxxx wrote:

> I wrote a utlity to help convert proto_tree_add_text calls into proto_tree_add_item calls.  The script is convert_proto_tree_add_text.pl and it can be found in the tools directory.  I wanted to share the data (attached) of my first test run on packet-dlsw.c as a guide to those interested in using the script.
>  
> File info:
> packet-dlsw.c.original - dlsw dissector file in SVN before I ran convert_proto_tree_add_text.pl
> packet-dlsw.c.proto_tree_input.original - original "input" file created when running "generate"
> packet-dlsw.c.proto_tree_input - "input" file actually used when running "fix-all"
> packet-dlsw.c.proto_tree_add_text.original - output when running "fix-all"
> packet-dlsw.c.hf - hf variable declarations that needed to be copied into dissector
> packet-dlsw.c.hf_array - hf_register_info items that needed to be copied into dissector
> packet-dlsw.c.committed - actual file committed to SVN.  Note that I did some additional "cleanup" in addition to merging the hf files

I cleaned up some other issues that showed up.  At least one turned up when running "./tshark -G fields >/dev/null"; the others might as well (they were reported as multiple registrations of the same field name when running TShark and Wireshark - one was a duplicate, the other was a case where the script thought two different fields, in the same location in the packet and with the same length, were the same field).

Running "tshark -G fields" (the standard output can probably be discarded - errors *should* go to the standard error) should probably be done after converting a dissector.