Wireshark mailing list archives

Re: dissecting bit


From: Chris Maynard <chris.maynard () gtech com>
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().


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


Current thread: