Ethereal-dev: Re: [Ethereal-dev] Create new tvbuff

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

From: Frank Singleton <frank.singleton@xxxxxxxxxxxx>
Date: Mon, 02 Apr 2001 06:41:41 -0500
Jeff Foster wrote:

<snip>

> If I read this right and you are decoding the data to create a
> new data set. You should check the code in packet-wcp.c.  In
> the wcp_uncompress routine, around line 858, it goes something
> like this -
> 
>         TRY {           /* create the new tvbuffer with your data */
>                 tvb = tvb_new_real_data( data, len, len, "DataName");
> 
>         }
>         CATCH(BoundsError) {
>                 g_assert_not_reached();
>                 g_free(buf);
>                 return NULL;
>         }
>         CATCH(ReportedBoundsError) {
>                 g_free(buf);
>                return NULL;
>         }
>         ENDTRY;
> 
>         /* Link the new tvbuffer to old tvbuffer, so cleanup works */
>         tvb_set_child_real_data_tvbuff( src_tvb, tvb);
> 
>         /* Add new data to the data source list */
>         pinfo->fd->data_src = g_slist_append( pinfo->fd->data_src, tvb);
> 
> This assumes that you do the real data buffer cleanup yourself.
> It you want the tvbuffer to handle cleanup of your data buffer, you
> should call the tvb_set_free_cb fucntion to add a cleanup callback
> routine.

Hi,


Ok, thanks. But I have no src_tvb yet. Remember I am reading data 
from a file BEFORE I ever receive/parse any packet data. In fact, 
I wish to decode the few IOR's in a file  in the giop_init() part.

This way, my data structures are poplulated with IOR info, BEFORE
I ever decode any packet (or tvbuff). This is a requirement,  if giop
is to handle stringified IOR's read from file.

How does one handle this case. Is there a  "dummy parent tvbuff" 
that poor orphan souls like I can attach to :) 


Cheers / Frank..

-- 
EUS/SV/Z Frank Singleton      ASO Americas BSS
Office : +1 972 583 3251      ECN 800 33251  
Pager  : +1 800 651 1184      Mobile : +1 214 228 0874
Amateur Radio: VK3FCS/KM5WS   Email : frank.singleton@xxxxxxxxxxxx

Hardware: HP Omnibook 4150 running Redhat Linux 6.2 (2.2.16 kernel).