Ethereal-dev: Re: [Ethereal-dev] tvbuff questions and conclusions...

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

From: Diwakar Shetty <diwakar@xxxxxxxxxxxxxx>
Date: Tue, 13 Mar 2001 11:50:22 +0600
Guy Harris wrote:

> > void
> > dissect_vjc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
> > {
> >
> >         int new_len = 0, old_len = 0;
> >         int offset =0;
> >         char *pd = 0;
> >
> >                 pd =  tvb_get_ptr(tvb, offset, 4);
> >
> >                 old_len = tvb_length_remaining(tvb, offset);
> >
> >                 if ( (new_len = slhc_uncompress(slcomp, pd, old_len)) <= 0) {
>
> So where does "slhc_uncompress()" put the resulting data?
>

shlc_uncompress() modifies (and also expands) the data pointed to by it's second
arg ("pd" in this case)

>
>
>
> What you want to do here is to have "slhc_uncompress()" write to a
> *newly allocated* chunk of memory, and to create a new "real data"
> tvbuff, with 'tvb_new_real_data()", referring to that tvbuff;
> subdissectors would be handed *that* tvbuff.
>

I had tried this approach (i.e doing a "tvb_new_real_data()"...but it did not seem
to work.....i was finding it difficult to pass control to this new data
midway....and the biggest problem of all was that the third pane which shows the
hex data still showed the earlier data...so i thought the better way would be to
change the "real_data" of the original "tv_buff" itself.....

Of course, I know I am going against the ideas for which tvbuff was created..but
what else can i do ??

>

diwakar