Ethereal-dev: Re: [Ethereal-dev] Creating a new Dissector

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Mon, 7 Oct 2002 17:24:05 -0700
On Wed, Oct 02, 2002 at 05:58:20PM +0800, pevee wrote:
> MessageAnybody knows what this function does:-
> 
> (1) tvb_get_ntohs(tvb, offset);
> 
> I couldn't find anything in the doc, please advice :)

Well, I found in "doc/README.developer":

	1.4.2 Extracting data from packets.

	NOTE: See the README.tvbuff for more details

	The "tvb" argument to a dissector points to a buffer containing the raw
	data to be analyzed by the dissector; for example, for a protocol
	running atop UDP, it contains the UDP payload (but not the UDP header,
	or any protocol headers above it).  A tvbuffer is a opaque data
	structure, the internal data structures are hidden and the data must be
	access via the tvbuffer accessors.

	The accessors are:

	Single-byte accessor:

	guint8  tvb_get_guint8(tvbuff_t*, gint offset);

	Network-to-host-order access for 16-bit integers (guint16), 32-bit
	integers (guint32), and 24-bit integers:

	guint16 tvb_get_ntohs(tvbuff_t*, gint offset);
	guint32 tvb_get_ntohl(tvbuff_t*, gint offset);
	guint32 tvb_get_ntoh24(tvbuff_t*, gint offset);