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: Tue, 9 May 2000 13:02:00 -0500
To follow my own post with more questions...

On Tue, May 09, 2000 at 08:57:03AM -0500, Gilbert Ramirez wrote:
> 
> 
> tvbuff_cursor_t tvbc    = tvbuff_create_cursor(tvbf)
> int type                = tvbc_get_bits( tvbc, 6 );
> int subtype             = tvbc_get_bits( tvbc, 3 );
> char pad_char           = tvbc_get_bits( tvbc, 7 );
> int plength             = tvbc_get_bits( tvbc, 8 );
> int dlen                = tvbc_get_bits( tvbc, 32 );
> char* pdata             = tvbc_get_bits( tvbc, dlen * 8);
> 
> --gilbert

I made a mistake on the last line. It should be like you had it:

guint8* pdata             = tvbc_get_bytes_ptr( tvbc, dlen );

But anyway...

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.

One way would be to provide proto_tree_add_*() routines that
take a tvbuff_cursor_t* as an argument, and the routine directly
queries the cursor about the offset and length of its previous
access. You'd have to call the proto_tree_add*() function 
before using the cursor again, though.

--gilbert