Wireshark mailing list archives

Re: dissection question


From: Guy Harris <guy () alum mit edu>
Date: Tue, 16 Feb 2010 16:11:34 -0800


On Feb 16, 2010, at 12:22 PM, Brian Oleksa wrote:

                       //status
                       proto_tree_add_uint(helen_sub_tree, hf_helen_routerstatus, tvb, offset, 1, FALSE);
                       offset += 1;

                ...

                       //cpu % used
                       proto_tree_add_uint(helen_sub_tree, hf_helen_cpuusage, tvb, offset, 1, FALSE);
                       offset += 1;

                       *//interface count*
                       interfacecount = tvb_get_guint8(tvb, offset);
                       proto_tree_add_uint(helen_sub_tree, hf_helen_interface_count, tvb, offset, 1, FALSE);

The last argument to proto_tree_add_uint() is not a Boolean specifying the byte order, it's the actual integral value 
to put into the tree.  The last argument to proto_tree_add_item() is a Boolean specifying the byte order.

For the interface count, you want

                       proto_tree_add_uint(helen_sub_tree, hf_helen_interface_count, tvb, offset, 1, interfacecount);

For status and cpu % used, you probably want to use proto_tree_add_item().

                           *//interface active*
                           proto_tree_add_uint(helen_sub_tree, hf_helen_interfaceActivity, tvb, offset, 1, FALSE);

You want proto_tree_add_item() there, too.

___________________________________________________________________________
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: