Ethereal-dev: Re: [Ethereal-dev] README.developer - if (tree)

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

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 17 Dec 2003 01:08:47 -0800
On Wed, Dec 17, 2003 at 10:04:31AM +0100, Biot Olivier wrote:
> Maybe we should separate display functionality from dissect functionality. I
> mean that we would call a "study" method for
> conversation/session/subdissection work, and then call one or more display
> methods for the actual protocol tree costruction if required.
> 
> And maybe we can still provide the situation "as is" for complex protocols
> and/or to have all dissector code still functional.
> 
> The simplest solution is to define a process_XXX() method for the work which
> always needs to be done, and then call one or more display_XXX() method for
> displaying the packet internals (or applying display filters). One would
> call both methods from within the existing dissect_XXX() method registered
> within the protocol:
> 
> static void
> dissect_PROTO(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
> {
> 	study_PROTO(tvb, pinfo, tree);
> 	if (tree)
> 		display_PROTO(tvb, pinfo, tree);
> }

That would build the protocol tree for subprotocols of PROTO before it
builds the protocol tree for PROTO.  I don't know whether there are any
cases where that'd cause a problem - it might not cause any.