ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Dissect a packet base header bits

From: "Steven Le" <programminglist@xxxxxxxxx>
Date: Wed, 7 Mar 2007 21:32:50 -0800
How can I display bit fields in the same byte in wireshark? Is it right to add item with same offset and register header with bitmasking? If yes, which ft type should I use in example below?  FT_UINT8??
For example, in first byte:
7   6   5   4   3   2   1  0
Value A: most 2 significant bits (bit 8, 7)
Value B: next 3 bits
Value C: the rest

-Steven




On 3/6/07, Stephen Fisher <stephentfisher@xxxxxxxxx> wrote:
On Tue, Mar 06, 2007 at 11:46:33PM -0800, Steven Le wrote:

> Thanks. How can I register hf_foo_data?

Take a look at the sample dissector code in doc/README.developer between
the "Cut here" lines and section 1.6.

> I want to print out binary data.

Use FT_BYTES in the registration above.

> On the other hand, the length of data is altered each time the message
> is sent . tvb_get_length will get the length of current offset to end
> of payload, wont it?

I think he meant tvb_length() instead of tvb_get_length().

The function tvb_length(tvb) returns the size of the entire tvb.
tvb_length_remaining(tvb, offset) will return the length remaining
starting at the offset.


Steve
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev