Ethereal-dev: [Ethereal-dev] Problems registering a new protocol

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

From: Ed Warnicke <hagbard@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 22 Oct 2000 14:43:01 -0400 (EDT)
I am attempting to write a dissector for mgcp (which should also cover
the various xgcp).  I am having some difficulty.  

So as to minimize the time I spent writing code I could not verify
I first tried copying the packet-http.{h,c} and modifying them to 
my purpose.  (This seems to be a time honored way of beginning as
revealed by 

hagbard@hagbard:~/build/src/ethereal-0.8.12$ grep packet-http *.c
packet-http.c:/* packet-http.c
packet-http.c: * $Id: packet-http.c,v 1.22 2000/09/11 16:16:02 gram Exp $
packet-ipp.c:#include "packet-http.h"
packet-mgcp-new.c: * Evolved from the packet-http.c file.
packet-rsh.c: * Liberally copied from packet-http.c, by Guy Harris
<guy@xxxxxxxxxxxx>
packet-rtsp.c: * Liberally copied from packet-http.c, by Guy Harris
<guy@xxxxxxxxxxxx>
packet-sdp.c: * Liberally copied from packet-http.c, by Guy Harris
<guy@xxxxxxxxxxxx>

I then modified the DISSECTOR_SOURCES list in Makefile.am
to include packet-mgcp.c and the noinst_HEADERS in Makefile.am
to include packet-mgcp.h.  (Yes I modified the Makefile.nmake also, 
but its irrelavent to me as I don't run Windows).

Upon running ./configure successfully I can check the register.c 
file and see in the register_all_protocols function a block

  {extern void proto_register_mgcp (void); proto_register_mgcp ();}

and in the register_all_protocol_handoffs function in the register.c 
file I see a block 

 {extern void proto_reg_handoff_mgcp (void); proto_reg_handoff_mgcp ();}

I am slightly concerned that at the end of the
register_all_protocol_handoffs function there are duplicate entries for 

  {extern void proto_reg_handoff_bxxp (void); proto_reg_handoff_bxxp ();}
  {extern void proto_reg_handoff_diameter (void);
proto_reg_handoff_diameter ();}
  {extern void proto_reg_handoff_mgcp (void); proto_reg_handoff_mgcp ();}
  {extern void proto_reg_handoff_smtp (void); proto_reg_handoff_smtp ();}

but I'll come back to why this is merely concerning and not alarming.

So now I make.  Everything compiles fine and links fine and make 
terminates with no complaints over the warning level from the compiler.

I run the newly compiled ethereal.  Everything launches fine, no problems.

I bring click on Edit->Protocols and the Protocols dialog comes 
up.  It doesn't show mgcp (but it does show bxxp, diameter, and smtp,
which is why I think the duplication mentioned above is benign).

I close the proto_dlg.  I try to enter the string "mgcp" in the 
filter textbox at the button of the window.  I get a response
'Unable to parse filter string "mgcp"'.  Clearly something has gone 
wrong.  

So I proceeded to go through this process again with the skeleton code 
provided in the doc/README.developer file and with skeleton code 
generated by the build-dissector.pl script (running make dist-clean
between attempts). Both yielded the same response.  

I'm stuck.  What am I doing wrong?

Ed

****BEGIN MINDLESS DUMP OF TEDIOUS INFO THAT MAY OR MAY NOT HELP*******
Starting source code:	ethereal-0.8.12.orig.tar.gz 
			from the ethereal-0.8.12.dsc package.

System distro:		debian woody
Processor arch:		i386
******************************************************************************