wireshark-dev October 2010 archive
Main Archive Page > Month Archives  > wireshark-dev archives
wireshark-dev: [Wireshark-dev] Problem with a flag in a 32 bit f

[Wireshark-dev] Problem with a flag in a 32 bit field

From: Graham Bloice <graham.bloice_at_nospam>
Date: Thu Oct 14 2010 - 13:39:16 GMT
To: Developer support list for Wireshark <wireshark-dev@wireshark.org>

 I'm having trouble picking out a bit flag from a 32 bit field. Can anyone
point out where I'm going wrong?

The field is transmitted on the wire in little endian order; b0 b1 b2 b3, bits
0 - 30 are a block number and the flag I'm interested is bit 31, the top bit
of b3.

I add the item to the tree with:

  proto_tree_add_item(point_tree, hf_item, tvb, offset, 4, ENC_LITTLE_ENDIAN);
and the hf def is:

  { &hf_item,
  { "A flag", "dissector.flag", FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x8000,
"A flag", HFILL }},
but when looking at the item I see the field displayed in the hex window as
"00 00 00 80", but the flag isn't set in the tree.

Similar code to the above works with 16 bit fields,

-- Regards, Graham Bloice

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