Ethereal-dev: Re: [Ethereal-dev] plugins

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

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Sun, 5 Nov 2000 01:16:28 -0800
On Sat, Nov 04, 2000 at 06:05:03PM -0500, Ed Warnicke wrote:
> but how do I indicate in protocol[] that I'm using both tcp and udp.

Unfortunately, you can't.

However, I've just checked in changes that allow you to create, in
addition to plugins like that, plugins that more closely resemble
non-plugin dissectors.

The "new-style" plugins don't have "desc", "protocol" or "filter_string"
variables, and don't have to have the main dissector routine exported
with the name "dissector"; instead, they have a routine named
"plugin_reg_handoff", which will be called after all dissectors' "init"
routines are called, and that routine should register the dissector with
the appropriate dissector tables.

In the case of MGCP, it'd do

	dissector_add("tcp.port", 2427, &dissect_mgcp);
	dissector_add("tcp.port", 2727, &dissect_mgcp);
	dissector_add("udp.port", 2427, &dissect_mgcp);
	dissector_add("udp.port", 2727, &dissect_mgcp);

(I'm assuming here that it's a new-style dissector that uses tvbuffs; if
not, it'd use "old_dissector_add()").

I've also made the Gryphon plugin be a new-style plugin; see it for an
example of a new-style plugin.

New-style plugins don't show up in the list of plugins that the
"Tools->Plugins" menu item pops up.  They have no display filter
associated with them, so they have no filter to edit - instead, if the
port they use is to be user-configurable, they should register
preferences, as non-plugin dissectors do.  They also can't be enabled or
disabled from there - instead, they should use the
"CHECK_DISPLAY_AS_DATA()" macro (or, if they're not tvbuffified,
"OLD_CHECK_DISPLAY_AS_DATA()"), so that they can be enabled and disabled
from the "Edit->Protocols" menu item, just as non-plugin dissectors can
be.