Ethereal-dev: Re: [Ethereal-dev] get a protocol id from port number

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Mon, 8 Jan 2001 14:16:43 -0800 (PST)
> I have a dissector_table and a port number. I want
> to get the portocol id of the protocol dissector
> registered under port in the dissector_table. How
> do I get it?

Currently, there's no way to do that; dissectors don't have protocol IDs
associated with them.

Something to more closely tie protocols and dissectors will probably be
checked in at some point, as it's needed for other purposes.

> I need this id for proto_is_protocol_enabled.

Typically, "proto_is_protocol_enabled()" is used either in the
"CHECK_DISPLAY_AS_DATA()" macro or in an explicit call in a heuristic
dissector, and in those cases the dissector would use its own protocol
ID, which would presumably be set in the registration routine in the
same source file.

Ultimately, I'd like to get rid of as many calls to
"CHECK_DISPLAY_AS_DATA()" and "proto_is_protocol_enabled()" as possible,
and have the code that calls dissectors through dissector tables and
dissector handles do the checks instead (that being one place where
tying protocols and dissectors together would help).

Where are you using "proto_is_protocol_enabled()" in one dissector where
it needs to check whether some *other* protocol is enabled?