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] query regarding gtp_handle funtionanddecoderfunction.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 06 Sep 2006 14:42:31 -0700
prashanth joshi wrote:

So length-2 bytes of data is added in to tree ,starting from the location number ofset + 5 of tvb.
My query is : is it absolutely necessary to have hf_gtp_ext_
as the second argument when ever we want to add an item?
Can not we do away with it by having a NULL as second argument instead?

No.

For one thing, the second argument is an integer value, not a pointer, so NULL doesn't make sense as the second argument.

Furthermore, proto_tree_add_item() adds an instance of a named field, so you *have* to supply an integer value that identifies a named field.

( I found it difficult to understand how the contents of the proto_register_gtp array are built) And what would be the limitations if we try to add an item using the proto_tree_add_text( ) instead ?

Well, one limitation is that you will not be able to do any display filtering on the value - it'll just be entered as text to be displayed. You won't be able to select packets with a particular value of that field by doing "gtp.ext_val == <value>".