Wireshark-dev: Re: [Wireshark-dev] Dissect a packet base header bits
From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Date: Tue, 6 Mar 2007 23:59:24 -0800
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