Ethereal-dev: Re: [ethereal-dev] Binding multiple ports to one dissector

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

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Fri, 25 Aug 2000 09:28:38 -0700
On Wed, Aug 23, 2000 at 06:28:45PM +0900, Richard Sharpe wrote:
> I am still not sure whether or not it is easy to bind multiple ports to a
> single dissector.

It is.  Take a look at "packet-http.c", for example, which binds 80,
8080, 3128, and 3132 to "dissect_http()", and "packet-ipp.c", which
binds port 631 to "dissect_http()" as well.

> It would be good if one could do it via $HOME/.ethereal/preferences via:
> 
> http.tcp.port: 80, 4444, 8888

That would be done in a fashion similar to the way it's done in
"packet-diameter.c", except that you'd have to

	define the preference as a string rather than as a number;

	use some routine to carve the port string up into tokens,
	convert each string to a number, and register that number;

	keep track of all the port numbers you registered, so you can
	unregister them all if that preference changes.