http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1870
------- Comment #8 from jeff.morriss@xxxxxxxxxxx 2007-09-28 12:56 GMT -------
(In reply to comment #7)
> (In reply to comment #6)
> > (From update of attachment 959 [details] [details])
> > Why is virtually everything constructed with proto_tree_add_text? This makes
> > filtering a problem. proto_tree_add_item() and working with the hf items is
> > preferable.
> >
> I have to use proto_tree_add_item() every time I create a new item?
> For example, when I do:
>
> ti = proto_tree_add_text(pce_tree, tvb, offset, 4, "PCE %s Header.",
> val_to_str(message_type, message_type_vals, "Unknown Message (%u). "));
>
> it's better that I utilize proto_tree_add_item?
Yes. It makes the item being added to the tree filterable (so you could do,
for example, "pce.message_type == 42" to see only messages of type 42) and
it'll even save you some code (by replacing the above very long line + the
tvb_get_*() you used to get message_type with a simple _add_item()--OK you
might still need to tvb_get_*() the message_type to switch() on it, but for
most protocol fields you don't need the value in your code).
This isn't the first time we've seen confusion about this, I'll see if I can
update README.developer to clarify it.
--
Configure bugmail: http://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.