Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Simplifying (and fixing) tvbuff [Long]

From: Chris Maynard <Chris.Maynard@xxxxxxxxx>
Date: Wed, 14 Dec 2011 14:02:07 +0000 (UTC)
Bill Meier <wmeier@...> writes:

> I think the long description boils down to the following:
> 
> Consider the collection of tvbs (chain) as a stack of tvbs.
> 
> packet.c pushes the initial tvb onto the stack then calls next 
> dissector; After the dissection is complete, the stack is eventually 
> free'd via a call to tvb_free_chain in  epan_dissect_cleanup.
> 
> A dissector:
> - can add new tvbs (real, subset, composite) to the stack handed to it;
>    (Subset and Composite tvbs should reference only tvbs which are
>     towards the beginning of the same stack).
> - must not save a pointer to a tvb from that stack (handed to it)
>    for use when  dissecting another frame (since a
>    higher level function may very well free the stack);
> - can create its own tvb stack which the dissector is free to manage
>    as desired.

Bill, this information, plus the recent post entitled, "buffer to tvb", got me
wondering if there is perhaps enough useful information here worthy of a
separate doc/README.tvbuff?

- Chris