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] proto_tree -> proto_item

From: Sébastien Tandel <sebastien@xxxxxxxxx>
Date: Tue, 24 Mar 2009 09:59:54 -0300
Hi Luca,

I'm not sure it's really safe and cleaner since it's working only because proto_item = proto_tree = proto_node and the legend says that nothing guarantees it won't change. Then it is working now but be aware that one day it might not work anymore.


Regards,
Sebastien Tandel

On Mon, Mar 23, 2009 at 18:48, Luca Ceresoli <list@xxxxxxxxxxxxxxxx> wrote:
Sébastien Tandel ha scritto:

> Therefore you could then do what you want with something like the following :
> it = proto_tree_add_text(ptvcursor_tree(cursor), ptvcursor_tvbuff(cursor),
>       ptvcursor_current_offset(cursor), length, "foo");
> my_tree = ptvcursor_add_subtree_item(cursor, it, ...);
Thanks Sébastien,

that looks fine, except ptvcursor_add_subtree_item() is not (currently) declared in any header file, so that does not compile.
Apart from dumbly declaring it, I found this alternative:

 my_tree = ptvcursor_add_text_with_subtree(cursor, ..., "foo");
 my_item = proto_tree_get_parent(my_tree);
 /* ... */
 proto_item_set_text(my_item, "<%s>", my_string);

To me it looks safe and cleaner, am I missing anything?

Luca



___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe