ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] proto_tree_add_uint() taking the value from the packet, not from

From: Kaul <mykaul@xxxxxxxxx>
Date: Mon, 16 Mar 2009 13:01:06 +0200
From readme.developer, it appears the value to be displayed by proto_tree_add_uint should be the 'value' param:
proto_tree_add_uint(tree, id, tvb, start, length, value)

However, I'm trying something like:
proto_tree_add_uint(subrect_tree, hf_vnc_hextile_subrect_width, tvb, *offset, 1, 3);
And I'm getting the value that hf_vnc_hextile_subrect_width is 'calculating' from the packet, instead of '3' as expected.

Am I doing something wrong?
hf_vnc_hextile_subrect_width is defined:
{ &hf_vnc_hextile_subrect_width,
          { "Width", "vnc.hextile_subrect_width",
            FT_UINT8, BASE_DEC, NULL, 0xF0, /* Top 4 bits */
            "Subrectangle width minus one", HFILL }
        },

and was initially displayed by:
proto_tree_add_item(subrect_tree, hf_vnc_hextile_subrect_width, tvb, *offset, 1, FALSE);

FWIW, I'm wanted to take the value 'manually' from the packet, by using:
tile_width = (tvb_get_guint8(tvb, *offset) & 0xF0);
and using 'tile_width_ in proto_tree_add_uint (with conversion to uint32 perhaps?)

TIA,
Y.