Wireshark-dev: Re: [Wireshark-dev] fetching numbers < 8 bits
From: "Martin Corraine (mcorrain)" <mcorrain@xxxxxxxxx>
Date: Thu, 21 Aug 2008 09:03:08 -0400
ahh... I had an older version of the readme that didn't have it. sorry.
 
Thanks!


From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Anders Broman
Sent: Thursday, August 21, 2008 8:56 AM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] fetching numbers < 8 bits

From /doc/readme.developer

Bit accessors for a maximum of 8-bits, 16-bits 32-bits and 64-bits:

guint8 tvb_get_bits8(tvbuff_t *tvb, gint bit_offset, gint no_of_bits);

guint16 tvb_get_bits16(tvbuff_t *tvb, gint bit_offset, gint no_of_bits,gboolean little_endian);

guint32 tvb_get_bits32(tvbuff_t *tvb, gint bit_offset, gint no_of_bits,gboolean little_endian);

guint64 tvb_get_bits64(tvbuff_t *tvb, gint bit_offset, gint no_of_bits,gboolean little_endian);

:

proto_item*

proto_tree_add_bits_item(tree, id, tvb, bit_offset, no_of_bits, little_endian);

proto_item *

proto_tree_add_bits_ret_val(tree, id, tvb, bit_offset, no_of_bits, return_value, little_endian);

:

proto_tree_add_bits_item()

--------------------------

Adds a number of bits to the protocol tree which does not have to be byte aligned.

The offset and length is in bits.

Output format:

..10 1010 10.. .... "value" (formated as FT_ indicates).

proto_tree_add_bits_ret_val()

-----------------------------

Works in the same way but alo returns the value of the read bits.

/Regards

Anders



From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Martin Corraine (mcorrain)
Sent: den 21 augusti 2008 14:47
To: Developer support list for Wireshark
Subject: [Wireshark-dev] fetching numbers < 8 bits

Hello,
 
I need to read in a number that's 3 bits long. Is this possible?
 
Thanks!,
martin