Ethereal-dev: Re: [Ethereal-dev] Create a new tvbuf when decrypting?

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: Mon, 13 Nov 2000 22:35:49 -0600
On 13 Nov 2000 12:57:56 -0800
Mark Atwood <mra@xxxxxxxxx> wrote:

> Gilbert Ramirez <gram@xxxxxxxxxx> writes:
> > What you need is a way for any arbitrary tvbuff to have a "child"
> > TVBUFF_REAL_DATA. The child is freed when the parent is freed. Automatic
> > descruction of the object would then take place. This ability does not
> > yet exist in the tvbuff routines, but I could add it if it sounds
> > useful.
> > Let me know if that will work for you, and if so, I'll add the
> > ability to chain TVBUFF_REAL_DATA's under other tvbuffs.
> 
> That would work for me, and be very useful. Mine isn't the only
> protocol with encryption,
>

Here's a patch against the latest CVS... it should apply to 0.8.13
with no problem.

tvb_set_child_real_data_tvbuff() is the new function. From the header:

/* Attach a TVBUFF_REAL_DATA tvbuff to a parent tvbuff. This connection
 * is used during a tvb_free_chain()... the "child" TVBUFF_REAL_DATA acts
 * as if is part of the chain-of-creation of the parent tvbuff, although it
 * isn't. This is useful if you need to take the data from some tvbuff,
 * run some operation on it, like decryption or decompression, and make a new
 * tvbuff from it, yet want the new tvbuff to be part of the chain. The reality
 * is that the new tvbuff *is* part of the "chain of creation", but in a way
 * that these tvbuff routines is ignorant of. Use this function to make
 * the tvbuff routines knowledgable of this fact. */
void tvb_set_child_real_data_tvbuff(tvbuff_t* parent, tvbuff_t* child);
 
--gilbert

Attachment: tvbuff.diff
Description: Binary data