Wireshark-dev: Re: [Wireshark-dev] Unable to add my dissector for tcp.dstport

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Fri, 11 Jan 2008 16:33:29 -0800

On Jan 11, 2008, at 12:02 AM, Vikas Jain wrote:

I am developing a dissector for my protocol that uses TCP as the underlying layer and dissects messages that are destined for TCP destination port of 50505.

What about messages sent *from* TCP source port 50505?

/* The following statement seems to cause an assertion when I run the Wireshark executable. I get an assertion on line 697 packet.c file saying assertion failed on sub-dissectors */
    dissector_add("tcp.dstport", 50505, foo_handle);

The assertion that fails is the assertion that there *exists* a dissector table named "tcp.dstport". No such dissector table exists; there is no mechanism to request that your dissector be called for a particular destination port.

(It is not, and never will be, the case that there will exist a dissector table for every single named field in a protocol.)

I presume that if keep tcp.port in my dissector_add invocation, my dissector is going to be invoked even when tcp.srcport is 50505.

Yes.

I want my dissector to be invoked only when a tcp destination port is 50505.

Again, why only the destination port?