ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] query proto tree within dissector

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Fri, 23 Oct 2009 11:11:56 -0400
Fruehwirth@xxxxxxxxx wrote:
Hi,

my custom dissector defines some subtrees.

I added custom names for packet types like described here:
http://www.wireshark.org/docs/wsdg_html_chunked/ChDissectAdd.html#id4724866
-> Example 9.9. Naming the packet types.

Now wireshark shows names for the type-field of packets as expected.

Question:
Is there a way to query the proto_tree after definition of subtries ??

<code>
proto_tree_add_item(myprot_header_tree, hf_myprot_type, tvb, offset, 2, FALSE);
</code>
where hf_myprot_type is the field which adds naming to type-byte of the protocol

Is there a way to do somethin like this:
<code>
get_curren_stringvalue(hf_myprot_type);
</code>

As far as I know, no. You probably have to retrieve the value (using tvb_get_*()) and store it somewhere.