Ethereal-dev: Re: [Ethereal-dev] Re: Add element to a tree but no from tvb

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Guy Harris" <gharris@xxxxxxxxx>
Date: Thu, 8 Dec 2005 18:54:28 -0800 (PST)
ronnie sahlberg wrote:

> Dont use proto_tree_add_item()

If he defines the item as a bitfield, he *can* use proto_tree_add_item(),
and it'll do the shifting and masking.

> Use proto_tree_add_<type>() and specify offset and length to 0 to
> indicate that no part of the hexpane represents this item.

That's what you'd do if the field's value didn't come from any data in the
packet, for example if it's a request/reply packet, and the request
contains a request code specifying the type of the request but the reply
doesn't contain the request code (so that you'd have a hash table to match
up requests and replies) - the reply might have a request code to indicate
the type of request it's a reply to, but as that's not from the reply
packet, you'd do it that way.