Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 21556: /trunk/epan//trunk/epan/: pro
From: "Anders Broman" <[email protected]>
Date: Tue, 24 Apr 2007 22:34:54 +0200
Hi,
The function I provided also allows for bit strings not aligned to
the octet boundary and the output will look like:
If the data at offset 0 is a5 and we want the two last bits of the first
Octet and the two first of the second:
Bit_offset = 3 no_of_bits = 4 hf_bits_value
The output will look like
..10 01..  Bits_value : 9

I suppose it's a matter of taste if the input should be
Offset in bytes and bit offset + number of bits or
Offset in bits and number of bitts. My thought was that if you
Are to dissect a number of bittfields in sequence its easier to
Keep track of the offset in bits rather than octets. 

I'm sure it can be made more efficient though.

If we can agree on the basic format I'm sure the function can be improved,
Which was the whole idea anyway.
Best regards
Anders

-----Ursprungligt meddelande-----
Från: [email protected]
[mailto:[email protected]] För Luis Ontanon
Skickat: den 24 april 2007 21:51
Till: Developer support list for Wireshark
Ämne: Re: [Wireshark-dev] [Wireshark-commits] rev 21556:
/trunk/epan//trunk/epan/: proto.c proto.h

There's a function in packet-iuup.c (by the same name) which has (what
i believe to be) a more consistent signature with the rest of
proto_tree_add_* functions should that be used instead?

Other than that the one for iuup allows for bit strings not aligned to
the octet boundary.


On 4/24/07, Joerg Mayer <[email protected]> wrote:
> On Tue, Apr 24, 2007 at 07:24:15PM +0000, [email protected] wrote:
> >  Add a new proto function proto_tree_add_bits() which adds bits to the
tree
> >  starting at the bit offset given for the number of bits indicated which
wll also return
> >  the value of the bits.
> >  Experimental and for review, documentation to be updated.
>
> OK, I didn't really understand the log message, but when I looked at
> proto.c patch, things got clearer.
> And here's the feedback:
> - what's your motivation behind that patch? (just curious)
> - In your patch you mixed to things: tvb_get_bits and a
>   proto_tree_add_bits. Pease don't do that. It makes this function
>   behave differently from all other proto_tree_add_ functions. Also, the
>   tvb_get_ function is missing. If you *really* think that mixing these
>   two functions makes sense, then all existing functions (and their
>   uses) should be modified to behave similarly, just to stay consistent.
>
>    ciao
>       Joerg
>
> --
> Joerg Mayer                                           <[email protected]>
> We are stuck with technology when what we really want is just stuff that
> works. Some say that should read Microsoft instead of technology.
> _______________________________________________
> Wireshark-dev mailing list
> [email protected]
> http://www.wireshark.org/mailman/listinfo/wireshark-dev
>


-- 
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan
_______________________________________________
Wireshark-dev mailing list
[email protected]
http://www.wireshark.org/mailman/listinfo/wireshark-dev