On Thu, 2002-02-28 at 17:18, Guy Harris wrote:
> On Thu, Feb 28, 2002 at 09:59:40AM -0500, packet steve wrote:
> > doc/README.developer mentions proto_tree_set_text and
> > proto_tree_append_text. Should these be marked obsolete
>
> No, they shouldn't.
>
> As you can no longer create a protocol tree item with no text - because
> if you do, and fill in the text as you dissect stuff, if you throw an
> exception you can end up with a protocol tree item with no text, which
> looks bogus - "proto_tree_set_text()" might not be useful (although it's
> still being used).
But, you can create a proto_item that uses its default
representation. It contains no "overriding representation",
by which I mean a representation different than what was
registered for that header_field_info*. This default
representation might be adequate even if an exception is
thrown. But if further dissection happens, a *better*
representation can bet set via proto_item_set_text().
In work that I'm currently doing on the NCP dissector,
I might even take this approach. I'm using the ptvcursor
routines to add proto_item's to the proto_tree, but
I need to retrieve the value of a proto_item that
was added and format the value into a date or timestamp
and then re-set the representation of the proto_item.
--gilbert