Ethereal-dev: Re: [Ethereal-dev] getting data from subdissectors

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Sat, 15 Dec 2001 13:48:43 -0800
On Sat, Dec 15, 2001 at 03:43:31PM -0500, Ed Warnicke wrote:
> I'm trying to augment the MGCP dissector to create appropriate
> conversations for the RTP streams created and destroyed by MGCP 
> signalling.  
> 
> My problem is that MGCP uses SDP to encode the actual descriptions of 
> the rtp sessions to be created or destroyed, but the information
> about whether we are creating, destroying, or just redundantly
> mentioning an rtp session is coded in the MGCP message.  
> 
> As a result the conversation must be set up in the MGCP dissector 
> based on the results of running the SDP dissector.  

Or, if the MGCP dissector has the information necessary to indicate
whether the SDP dissector should create the conversation by the time it
calls the SDP dissector, the SDP dissector could get that information
from the dissector that calls it.

> My initial instinct is to query the proto_tree from the mgcp dissector
> after having run the SDP dissector to make any decisions about setting 
> up the RTP conversations.  Is this really the correct way to go about
> it?

No, because there's no guarantee that, on the first pass through the
packets, when the capture file is being read in, there *is* a protocol
tree.  (Generating a protocol tree takes work, so we do *not* do it on
the first pass unless we need to.)

An alternative is to use "pinfo->private_data" to communicate
information out-of-band between the MGCP and SDP dissectors.

As the SDP dissector has many callers, I'd be inclined to make
"pinfo->private_data" point to a data structure defined by the SDP
dissector, and:

	have the MGCP dissector declare such a structure, and set
	"pinfo->private_data" to point to it;

	have other dissectors that call the SDP dissector either do so
	as well, or just set "pinfo->private_data" to NULL;

	have the SDP dissector fill in that structure if
	"pinfo->private_data" is non-null.