Ethereal-dev: Re: [ethereal-dev] Dissector question: variable length structures

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: Fri, 14 Jul 2000 09:42:41 -0500
On Fri, Jul 14, 2000 at 09:14:38AM -0500, Craig Rodrigues wrote:
> 
> 
> Hi,
> 
> I would like to give a shot at enhancing the packet-giop.c
> dissector for CORBA IIOP.  I was wondering, what technique
> do people use in the other dissectors for dealing with
> variable length data structures?  For example, IIOP
> defines a string which is represented by it's length n, followed
> by n + 1 bytes which contain the actual string (with other encoding
> schemes for wide characters).  Is there a glib structure that I can
> use?  I'm a bit lazy to do all the memory management by myself. :)

Funny you should ask... I just mentioned the necessity for an FT_NSTRING
field type, for a string with a prefixed byte representing the length.

Do you have to actually manipulate the string (that is, put it into
a C variable and do something with it), or do you only have to put
it into the protocol tree? (in which case, the existence of
FT_NSTRING would solve your problem, w/o the need of anything in glib).

--gilbert