Wireshark-dev: Re: [Wireshark-dev] Is there a good way of handling bitfields with different bit
From: "ronnie sahlberg" <[email protected]>
Date: Wed, 14 Nov 2007 13:10:01 +1100
Not tested!
grab the hfinfo structure and modify the fields at runtime :

header_field_info *hfinfo;

hfinfo = proto_registrar_get_nth(hf_index);
hfinfo->bitmask = new bitmask
hfinfo->bitshift = new bit shift

very ugly.   it could work.

please do not contribute any code to wireshark that does anything like this  :-)

On Nov 13, 2007 5:01 AM, Neil Piercy <[email protected]> wrote:
> If the protocol has bitfields they can be defined in the hf structs, but
> what is the best way to cope if these fields can be at different bit
> offsets within the byte ? E.g. a 4 bit field which can occur as the
> lower 4 bits or the upper 4 bits of a byte.
> The more I think about it, the general way would be to add a bit offset
> to _every_ existing proto_tree_add_*() to go with the existing byte
> offset, but is there a simpler way which
> A) maintains the bitmask display in the main packet field view which the
> hf bitmasks provide.
> B) isnt just a text decode - is based on hf entries.
> Neil
> _______________________________________________
> Wireshark-dev mailing list
> [email protected]
> http://www.wireshark.org/mailman/listinfo/wireshark-dev