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] dissector_add_uint() usage

From: Raghavan R <raghavanr68@xxxxxxxxx>
Date: Sun, 27 Mar 2011 19:42:02 -0700
Hi all,

I am writing a dissector for a Fibre Channel related protocol and want
my dissector to get called based on value of fcct.gstype. So here my
handoff function-

void
proto_reg_handoff_fdmi(void)
{
    dissector_handle_t fdmi_handle;
	
    fdmi_handle = create_dissector_handle (dissect_fdmi, proto_fdmi);
    dissector_add_uint("fcct.gstype", FCCT_GSTYPE_MGMTSVC, fdmi_handle);

    data_handle = find_dissector("data");
}

Wireshark fails to load with a call to dissector_add_uint() like
above. However it works if like another existing FC dissector (for a
different FC protocol) I use-
dissector_add_uint("fcct.server", FCCT_GSTYPE_MGMTSVC, fdmi_handle);.
So I know that my usage of dissector_add_uint() is wrong.

Looking at the usage from other dissectors I could not understand what
I'm missing. So can someone please tell me what the expected usage for
dissector_add_uint() ?

I also noticed that in fcct.c, fcct.gstype comes from
proto_tree_add_item() and  fcct.server comes from
proto_tree_add_uint(). So I changed fcct.gstype to be extracted like
fcct.server using proto_tree_add_uint(). But I still couldn't get my
dissector to get called based on value of fcct.gstype. So clearly I'm
missing something.

I also googled around and the only useful information I could extract
was that this API was renamed recently.

Any pointers would be very much appreciated.

Many thanks,
Raghavan