Wireshark mailing list archives

Re: Help with Bit Fields


From: Mike Morrin <morrinmike () gmail com>
Date: Sat, 03 Mar 2012 08:04:35 +0000

On 02/03/2012 23:14, Alex Lindberg wrote:
I have a bit oriented message defined:

<Base> <NumBits> <bits....>

Where Base defines a base value and NumBits determines the number of
bits following (in byte groups). Each bit defines the state of the item
# Base+Bit Number.

I want to create a display that will have the Item Number when the tree
is expanded like so, as an example, if the base is 11 then the 4th bit
is item 14 so the output should be:

...1 .... = Item 14 ON


I would use proto_tree_add_bits_ret_val() to get the values of Base and NumBits, then loop for numbits iterations with proto_tree_add_boolean_bits_format_value() for one bit at a time, defining the format to include the calculated item number.

regards,
Mike

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