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

Wireshark-dev: Re: [Wireshark-dev] Registering on multiple ports

From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Date: Thu, 21 Feb 2008 21:53:37 -0700
On Fri, Feb 22, 2008 at 02:24:38AM +0000, MKS {} wrote:

> I am writing a dissector for a protocol that sits on top of TCP. The 
> ports on which the messages maybe sent or recieved are several and 
> need to be configurable.
> 
> One way I of achieving this is to have a config file with all the port 
> numbers listed, and invoke the "dissector_add" fn for each of those 
> ports.

How about making a preference option to let the user configure the 
ports?  See the HTTP dissector (epan/dissectors/packet-http.c) for an 
example of how to do this.

> I wanted to know if there was a way I could achieve the same effect 
> using the pattern matching in the dissector_add function e.g if the 
> protocol has field called "bar" which is always set to 25, for 
> messages of this protocol could I do the following:
> 
> dissector_add("fooHeader.bar", 25, foo_handle)?
> 
> When I try this, it the function find_dissector_table fails to find 
> the table corresponding the name "fooHeader.bar" in packet.c

Right, because there is not a table for every field of a protocol.


Steve