Ethereal-dev: [Ethereal-dev] Question about bitmask in hf_register_info

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Paul Ionescu <paul@xxxxxxxx>
Date: Sat, 16 Dec 2000 23:56:09 +0200
Hello,

I have the following problem:

Somefield in some protocol is spanned across 2 bytes like 6 bits in
first byte and 4 bits in the second byte like IIIIIIxxIIIIxxxx where 'I'
are the bits from the field and 'x' are bits from some other fields.

Now, I wanted to make a bitfield mask for registering it in a
hf_register_info hf[] structure, and I guess the right mask is 0xFCF0.
The mask is well, the dissector show only the bits I wanted to show, but
the computed value is wrong.
It seems that the computing function does not concatenate the two
bitfields.

Example:
	if the field is 0xc8 the dissector will display 0x308
(the same example in binary)
	the field is 0011001000 but the dissector will display 1100001000


This is because the field is miscalculated like IIIIII00IIII and not
like IIIIIIIIII

Is there any work around for this ?
Is this a bug, or a missing feature of bitmasks ?
Or maybe I am missing something...

Thank you.

-- 

Air conditioned. Do _NOT_ open Windows.