Ethereal-dev: [Ethereal-dev] unaligned bit fields

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

Date: Fri, 21 Oct 2005 22:37:35 +0200
Hi,

I'm working on a bitwise protocol (IuUP) and I found a problem I'm
just stuck in...

The data packets of IuUP have records made of a certain number of bits
(not aligned to the byte boundary).

Let's say I have a field that starts at offset 13 bytes + 4 bits whose
length is 87 bits (10bytes + 7bits).

In order to have the hex data pane  propperly highligth the field it's
len should be 87 + 4 bits =  11bytes + 3 bits.

(I believe) The correct thing in this case should be to highlight 12
bytes (from the  byte it starts to the byte it ends).

now if I do
   proto_tree_add_bytes(tree, hf, tvb, 13, 12 , shifted_buffer);

I get a field which is 12 bytes long field while the real lenght of
the data in the shifetd buffer is 87 bits (11 bytes once rounded to
ceiling).

As I'm simply stuck thinking how to deal with this. I like if others
tell me how they believe the dissector should behave in this case.

Thanks,

Luis

--
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan