Ethereal-dev: Re: [ethereal-dev] Dissector exceptions

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

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Wed, 10 May 2000 02:35:46 -0500
On Wed, May 10, 2000 at 09:06:07AM +0200, andreas.sikkema@xxxxxxxxxxx wrote:
> > Given a sequential accessor for tvbuffs, how would you like
> > to add the data to the proto_tree? The current proto_tree_add_*()
> > routines take an offset and a byte length.
> 
> That's the big problem here ;-)

BTW, are you actually using the values that you retreive as collections
of bits for anything, or are you just adding them to the proto_tree?
If only adding them to the proto_tree, be sure too look at packet-tr.c
and packet-sna.c. They have examples of reading in a guint8 or guint16
value and passing the entire integer to the proto_tree routines. The
proto_tree routines do the bit-extraction via the information that
was registered for each field. That approach might make your work easier.

For a sequential accessor to work, you'd really want to combine
the proto_tree and tvbuff routines (Guy, this is your cue...)
so that the proto_tree routines do the data extraction from the tvbuff for
you. That keeps the dissector from having to pass information about
offsets and lengths between the two sets of routines.

--gilbert