Ethereal-dev: Re: [Ethereal-dev] checking fields

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: Wed, 31 Jul 2002 02:09:19 -0700
On Wed, Jul 31, 2002 at 10:59:24AM +0400, Alex V. Boreskoff wrote:
> But I want to check for  llc.dsap, llc.ssap and llc.control and I can
> specify only one value when adding a dissector. How can I either set a more
> complex way of registering a dissector or check thses values in my dissector

There's no mechanism to do that.  You'd have to, for example, have the
LLC dissector supply the SSAP and control values to subdissectors by:

	declaring in "packet-llc.h" a data structure with fields to hold
	those values;

	having "dissect_llc()":

		declare a local variable of that structure type;

		fill in the values in that structure;

		set "pinfo->private_data" to point to that structure
		before calling subdissectors;

and then have your dissector include "packet-llc.h" and assign the value
of "pinfo->private_data" to a pointer to that structure type, and use
the values.

You would then register your dissector to receive packets for the DSAP
in question - using "new_register_dissector()", and have your dissector
return 0, without dissecting anything and without fetching anything from
the tvbuff, if the SSAP and control fields didn't have the values it
wanted and return "tvb_length(tvb)" if they did.  That way, packets with
your DSAP but the wrong SSAP or control field values would just be
dissected as packets for an unknown protocol.

(I'm assuming here that your DSAP isn't one some other dissector already
handles.)