Wireshark mailing list archives
Re: Correct and efficient way of displaying bit fields?
From: Helge Kruse <Helge.Kruse-nospam () gmx net>
Date: Sat, 08 Oct 2011 18:36:50 +0200
Am 07.10.2011 23:22, schrieb Kaul:
I'm struggling for some time now with displaying bitfields, I'm sure there must be something I'm overlooking, or it's just a bit difficult to do in Wireshark. I have a 32bit, little endian field, which I'd like to parse the bits (as set/not set): Example: 05 00 00 00 1 0 0 0 .... Feature A - set 0 0 0 0 ... Feature B - not set 0 0 1 0 ... Feature C - Set 1. Do I really have to create a hf_xxx for each? And use something like proto_tree_add_bits_item() ? I was hoping to do it in a single proto_tree_add_xxx() and pass it a single HF that would hold a VALS(...) which will describe all the attributes.
When you add all these hf_info records you provide information that will be displayed quite well. Additionally all these fields can be used in a display filter expression. That's worth to add all the info.
When I have such one-bit fields I put them in an array and use a loop over this field and call proto_tree_add_boolean for each iteration. This saves code lines. But when the field size varies, you will need individual code lines.
Helge ___________________________________________________________________________ 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:
- Correct and efficient way of displaying bit fields? Kaul (Oct 07)
- Re: Correct and efficient way of displaying bit fields? Helge Kruse (Oct 08)
- Re: Correct and efficient way of displaying bit fields? Guy Harris (Oct 08)
- Re: Correct and efficient way of displaying bit fields? Glenn Matthews (Oct 10)