Ethereal-users: Re: [Ethereal-users] Creating a dissector

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Fri, 6 Dec 2002 12:40:33 -0800
On Fri, Dec 06, 2002 at 03:32:51PM -0500, Parks, Chauni wrote:
> The dissector is registering using:
> 
> dissector_add("tcp.port", {port number}, {handle});
> 
> I am not a developer,

You've written a dissector; therefore, you are now a developer. :-)

> so I am using the other protocol dissectors that run
> atop TCP as guides. However, I check the register.c file and noticed that my
> dissector was not listed in that file. Am I suppose to see it there?

Not if it's a plugin.  "register.c" is a list of register routines
(phase 1 routines, which are the "proto_register_" routines called by
"register_all_protocols()", and phase 2 routines, which are the
"proto_reg_handoff_" routines called by
"register_all_protocol_handoffs()") for *built-in* dissectors; that list
is compiled into Ethereal, so it can't be used for plugins, which are
loaded into Ethereal when it starts.

Plugin dissectors' register routines are a bit different - the phase 1
registration routine (which registers the protocol, etc.) should be
called "plugin_init()" (or called by "plugin_init()"), and the phase 2
routine should be called "plugin_reg_handoff()") (or called by
"plugin_reg_handoff()").

What happens if you select a TCP packet to or from the port number in
your "dissector_add()" call, and then use the right mouse button
(assuming you're not doing this on MacOS X :-)) and select the "Decode
As..." menu item?  If your dissector was properly registered with
"tcp.port", the list of protocols in the "Transport" tab in that dialog
box should include your protocol; if it does, what happens if you select
that protocol and click "OK"?