Wireshark-dev: Re: [Wireshark-dev] Is there a good way of handling bitfields withdifferent bitm

From: "Neil Piercy" <Neil.Piercy@xxxxxxxxxxxx>
Date: Wed, 14 Nov 2007 18:22:42 -0000
 

> -----Original Message-----
> [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of 
> ronnie sahlberg

> 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.

I agree - but I'll try!

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

That's a shame, because this is needed in order to extend the current
gsm_a dissector to cope with half octet IE which can be in the upper or
lower half of the octet.  I did ask for an _good_ way ;-).

I still reckon the general way is to add bit_offset to all the proto
calls - but I guess that won't happen anytime soon ;-).  Even more ugly
hack: use the _top_ 3 bits of the current offset in those calls as a bit
offset......  maybe not!

Neil