Wireshark-dev: Re: [Wireshark-dev] dissecting bit

From: Chris Maynard <chris.maynard@xxxxxxxxx>
Date: Wed, 18 May 2011 15:12:57 +0000 (UTC)
Chris Maynard <chris.maynard@...> writes:

> 
> guint32 urn;
> 
> urn = (((guint32)tvb_get_guint8(tvb, offset) << 16) & 0x00800000) |
> ((tvb_get_guint24(tvb, offset + 1) >> 1) & 0x007FFFFF);
> 
> ... then add it to the tree using:
> proto_tree_add_item(vmf_sub_tree, hf_vmf_urn, tvb, offset, 4, FALSE);
> 
> ... where hf_vmf_urn is declared as something along the lines of:
> 
>     {&hf_vmf_urn,
>      {"URN", "vmf.urn",
>       FT_UINT32, BASE_DEC, NULL, 0x80FFFFFE, NULL, HFILL }},

oops, the whole point of grabbing urn above the way I did is because you will
probably want to use proto_tree_add_uint_format_value() in this case instead of
proto_tree_add_item().