ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] variable TCP port in plugin

From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Date: Tue, 10 Jul 2007 21:34:27 -0700
On Wed, Jul 11, 2007 at 09:52:34AM +0530, Rahul Ruikar wrote:

> I am working on plugin which will decode TCP based protocol. my
> problem is port of that protocol is variable one.. I want it to
> configure it before decoding ..How can i do that in plugin..?

There are various dissectors that have port number preferences.  VNC is
one that comes to mind.  Look in epan/dissectors/packet-vnc.c for the
prefs_register_uint_preference() function that sets the
vnc_preference_alternate_port variable.  The registration of the port
from the preferences is then done in proto_reg_handoff_vnc() in the case
of this dissector.  Note that VNC also has default ports that are
hard-coded and there is code to prevent the user from entering one of
the default ports in the alternate port preference and then removing it
(that would remove the default port).


Steve