I'm trying to get the first 4 bits and the last 4 bits of a byte.
proto_tree_add_bits_item(tree, hf_capability, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(tree, hf_capability, tvb, bit_offset+4, 4, ENC_BIG_ENDIAN);
{ &hf_capability,
{ "Capabilities", "status.capability",
FT_UINT8, BASE_DEC,
VALS(capabilitynames), 0x0,
NULL, HFILL }
},</code></pre><p>When I use this in wireshark, its clearly not happy.</p><pre><code>(lt-wireshark:18421): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()</code></pre><p>I think it's because its not a full 8 bits. Do I need to use a bitmask? How do I use a bitmask? I'm stumbling over syntax a lot, so please show me code examples of what I should do.</p><p>Here's where I'm mapping the integers to strings:</p><pre><code>static const value_string capabilitynames[] = {
{ 1, "Switchable" },
{ 2, "Human" },
{ 4, "Mobile" },
};
asked 31 Jul ‘13, 12:42
Arwen17
46●2●2●6
accept rate: 0%
Thank you! That fixed it! I removed the { 0, NULL} a long time ago and it didn't give me any errors or warnings when I did so I assumed it was unnecessary. I only started getting an error when I started trying to work with bits instead of bytes.
That would have been easily caught by running
tools/checkAPIs.pl epan/dissectors/packet-foo.c
. Incidentally, you've chosen quite a poor name for your display filter of "status.capability". Try runningtools/checkfiltername.pl
, and alsotools/checkhf.pl
. These handy scripts will help you find many common mistakes.