Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Adding a dissector to wireshark does not show in Edit->Preferenc

From: Mark Ryden <markryde@xxxxxxxxx>
Date: Fri, 30 Oct 2009 20:34:13 +0200
Hello,
  I am trying to add a dissector to Wireshark in Linux. I work with
wireshark 1.2.3.

  I do not have previous experience and my trial is based upon the
wiki and from reading wireshark source code

What I tried is a very basic code, (somthing which can be though of as
HelloWorldDissector) , when my goal is to add a dissector which in
fact does almost nothing, so that first I will be only able to see it
in preferences of wireshark, in the list of protocols, as "SEQ".

Here is the short code I created (in a file called packet-seq.c):

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <gmodule.h>
#include <epan/prefs.h>
#include <epan/packet.h>


void proto_reg_handoff_seq(void)
{
}

void dissect_seq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	col_set_str(pinfo->cinfo, COL_PROTOCOL, "FOO");
	col_clear(pinfo->cinfo, COL_INFO);
}


static int proto_seq = -1;
static dissector_handle_t seq_handle;

void proto_register_seq(void)
{
	module_t *module;
	if (proto_seq == -1)
		{
		proto_seq = proto_register_protocol("SEQ protocol", "SEQ", "seq");
		};
		
		module = prefs_register_protocol(proto_seq, proto_reg_handoff_seq);
}


Now, I added this line in register.c:

{extern void proto_register_seq (void); if(cb) (*cb)(RA_REGISTER,
"proto_register_seq", client_data); proto_register_seq ();}

And I added entries in the Makefile according to other dissectors.

I build it, and a binary called  libdissectors_la-packet-seq.o
is created under:
/work/src/wireshark-1.2.3/epan/dissectors/.libs

However, when I start wireshark I do not see it in the
Edit->preferences , in the protocol list.

Any idea what am I missing here?

Regards,
Mark