Ethereal-dev: Re: [Ethereal-dev] 802a dissector

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, 5 Jan 2005 19:44:03 -0800 (PST)
cnelson@xxxxxxxxxxxx said:

> First, I assume that my dissector will have to be called by the Ethernet
> protocol dissector

Yes, but...

> so where it says:
>
>    /* IF PROTO exposes code to other dissectors, then it must be exported
>       in a header file. If not, a header file is not needed at all. */
>    #include "packet-myproto.h"
>
> I have to provide a header.

...no.  "Exposes code" isn't very clearly written - it refers only to
exposing code other than a standard dissector, which is exposed using
calls to register your dissector, so if your dissector isn't providing,
for example, a "helper" routine that other dissectors can call to dissect
subfields, you don't need a header file.

> Second, how to I register for type 0x88b7 (or only for the OUI I support)?

The first dissector to write is one for Ethernet type 0x88b7, which works
similarly to the way the LLC dissector (packet-llc.c) handles SNAP frames
- it lets a table of protocol IDs be registered for a particular OUI, so
that other dissectors can register for a particular protocol ID in the
space for a particular OUI.

That dissector would register for Ethernet type 0x88b7 by calling
"dissector_add()":

    dissector_add("ethertype", 0x88b7, dissect_802a);

dissect_802a() would be a static routine.

Then you'd have a "skeleton" dissector for your OUI - see, for example,
"packet-nt-oui.c" and "packet-cisco-oui.c" - which would define a
dissector table for process IDs for that particular OUI.

Dissectors for protocols using a particular protocol ID for a particular
OUI would register in that OUI's dissector table using that particular
protocol ID.