Ethereal-users: Re: [Ethereal-users] Enquiry about dissectors

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: Fri, 6 Aug 2004 01:26:06 -0700
On Wed, Aug 04, 2004 at 04:43:27PM +0530, Deepa wrote:
> I am trying to incorporate portions of my code to packet-isdn.c to
> support only lapd and lapv frames..however, i was confused abt the wking
> of dissectors...does the dissector control travel frm the lower layers
> to the higher layers or vice versa...

Lower to higher.

> WRT my eg, will the ctrl go 2 the isdn dissector,followed by lapd
> dissector, followed by q931 dissector??

Yes.

> if yes, how exactly is the control transferred?

It depends.

In the case of the ISDN dissector, it looks for a "circuit" for the
particular channel (D channel or one of the B channels), which is a data
structure set up by the ISDN dissector.  If it doesn't find one, it sets
one up and makes that the circuit for the channel.  If the channel has
no dissector associated with it:

	if it's a D channel, it makes the dissector for that circuit the
	LAPD dissector;

	if it's a B channel, it checks whether the payload looks like a
	V.120 SABME packet and, if so, makes the dissector for that
	circuit the V.120 dissector, otherwise it makes it the PPP
	dissector.

The channel now has a circuit with a dissector associated with it, so it
calls that circuit's dissector.

In the case of the LAPD dissector, it chooses a dissector based on the
SAPI for the packet.  It creates a "dissector table" for the SAPI, and
various dissectors, including the Q.931 dissector, register themselves
in that table.