Wireshark mailing list archives

Re: buffer to tvb


From: Bill Meier <wmeier () newsguy com>
Date: Wed, 14 Dec 2011 00:06:07 -0500

On 12/13/2011 11:37 PM, Andrew Kampjes wrote:
I've got a buffer of guint8s in a dissector that I'd like to turn
into  a tvb that I can then use as a parameter to "add_new_data_source()".
>  Is that possible/how?

Andrew.



Basically:
   [allocate and fill buffer: data_p = ....]
   my_tvb = tvb_new_real_data(data_p, data_length, data_length)
   add_new_data_source(pinfo, my_tvb, "Title");
   ....
   tvb_free(my_tvb);
   [free buffer: ]


It's possible to set a callback to free storage when the tvb is free'd.

See tvbuff.h


___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: