Combine Decode As and port preferences for tcp.port dissector table.

This patch introduces new APIs to allow dissectors to have a preference for
a (TCP) port, but the underlying data is actually part of Decode As functionality.
For now the APIs are intentionally separate from the regular APIs that register a
dissector within a dissector table.  It may be possible to eventually combine the
two so that all dissectors that register with a dissector table have an opportunity
to "automatically" have a preference to adjust the "table value" through the
preferences dialog.

The tcp.port dissector table was used as the guinea pig.  This will eventually be
expanded to other dissector tables as well (most notably UDP ports).  Some
dissectors that "shared" a TCP/UDP port preference were also converted. It also
removed the need for some preference callback functions (mostly when the callback
function was the proto_reg_handoff function) so there is cleanup around that.

Dissectors that has a port preference whose default was 0 were switched to using
the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference

Also added comments for TCP ports used that aren't IANA registered.

Change-Id: I99604f95d426ad345f4b494598d94178b886eb67
Reviewed-on: https://code.wireshark.org/review/17724
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2016-10-07 16:25:01 -04:00
parent 11d3224142
commit 268841f3e0
309 changed files with 2178 additions and 3030 deletions

View File

@ -806,6 +806,7 @@ libwireshark.so.0 libwireshark0 #MINVER#
host_name_lookup_process@Base 1.9.1
hostlist_table_set_gui_info@Base 1.99.0
http_tcp_dissector_add@Base 2.1.0
http_tcp_dissector_delete@Base 2.3.0
http_tcp_port_add@Base 2.1.0
ieee80211_ht_Dbps@Base 2.1.0
ieee80211_supported_rates_vals_ext@Base 1.99.1

View File

@ -3028,31 +3028,29 @@ Where: module - Returned by the prefs_register_protocol routine
These functions are declared in <epan/prefs.h>.
An example from packet-beep.c -
An example from packet-rtpproxy.c -
proto_beep = proto_register_protocol("Blocks Extensible Exchange Protocol",
"BEEP", "beep");
proto_rtpproxy = proto_register_protocol ( "Sippy RTPproxy Protocol", "RTPproxy", "rtpproxy");
...
/* Register our configuration options for BEEP, particularly our port */
rtpproxy_module = prefs_register_protocol(proto_rtpproxy, proto_reg_handoff_rtpproxy);
beep_module = prefs_register_protocol(proto_beep, proto_reg_handoff_beep);
prefs_register_bool_preference(rtpproxy_module, "establish_conversation",
"Establish Media Conversation",
"Specifies that RTP/RTCP/T.38/MSRP/etc streams are decoded based "
"upon port numbers found in RTPproxy answers",
&rtpproxy_establish_conversation);
prefs_register_uint_preference(beep_module, "tcp.port", "BEEP TCP Port",
"Set the port for BEEP messages (if other"
" than the default of 10288)",
10, &global_beep_tcp_port);
prefs_register_uint_preference(rtpproxy_module, "reply.timeout",
"RTPproxy reply timeout", /* Title */
"Maximum timeout value in waiting for reply from RTPProxy (in milliseconds).", /* Descr */
10,
&rtpproxy_timeout);
prefs_register_bool_preference(beep_module, "strict_header_terminator",
"BEEP Header Requires CRLF",
"Specifies that BEEP requires CRLF as a "
"terminator, and not just CR or LF",
&global_beep_strict_term);
This will create preferences "beep.tcp.port" and
"beep.strict_header_terminator", the first of which is an unsigned
integer and the second of which is a Boolean.
This will create preferences "rtpproxy.establish_conversation" and
"rtpproxy.reply.timeout", the first of which is an Boolean and the
second of which is a unsigned integer.
Note that a warning will pop up if you've saved such preference to the
preference file and you subsequently take the code out. The way to make
@ -3086,36 +3084,32 @@ example, stolen from packet-dns.c:
#include "packet-tcp.h"
dissector_handle_t dns_udp_handle;
dissector_handle_t dns_tcp_handle;
dissector_handle_t mdns_udp_handle;
dissector_handle_t hartip_tcp_handle;
dissector_handle_t hartip_udp_handle;
dns_udp_handle = create_dissector_handle(dissect_dns_udp,
proto_dns);
dns_tcp_handle = create_dissector_handle(dissect_dns_tcp,
proto_dns);
mdns_udp_handle = create_dissector_handle(dissect_mdns_udp,
proto_dns);
hartip_tcp_handle = create_dissector_handle(dissect_hartip_tcp, proto_hartip);
hartip_udp_handle = create_dissector_handle(dissect_hartip_udp, proto_hartip);
dissector_add_uint("udp.port", UDP_PORT_DNS, dns_udp_handle);
dissector_add_uint("tcp.port", TCP_PORT_DNS, dns_tcp_handle);
dissector_add_uint("udp.port", UDP_PORT_MDNS, mdns_udp_handle);
dissector_add_uint("tcp.port", TCP_PORT_MDNS, dns_tcp_handle);
dissector_add_uint("udp.port", HARTIP_PORT, hartip_udp_handle);
dissector_add_uint_with_preference("tcp.port", HARTIP_PORT, hartip_tcp_handle);
The dissect_dns_udp function does very little work and calls
dissect_dns_common, while dissect_dns_tcp calls tcp_dissect_pdus with a
The dissect_hartip_udp function does very little work and calls
dissect_hartip_common, while dissect_hartip_tcp calls tcp_dissect_pdus with a
reference to a callback which will be called with reassembled data:
static int
dissect_dns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
void *data _U_)
dissect_hartip_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
void *data)
{
tcp_dissect_pdus(tvb, pinfo, tree, dns_desegment, 2,
get_dns_pdu_len, dissect_dns_tcp_pdu, data);
return tvb_captured_length(tvb);
if (!tvb_bytes_exist(tvb, 0, HARTIP_HEADER_LENGTH))
return 0;
tcp_dissect_pdus(tvb, pinfo, tree, hartip_desegment, HARTIP_HEADER_LENGTH,
get_dissect_hartip_len, dissect_hartip_pdu, data);
return tvb_reported_length(tvb);
}
(The dissect_dns_tcp_pdu function acts similarly to dissect_dns_udp.)
(The dissect_hartip_pdu function acts similarly to dissect_hartip_udp.)
The arguments to tcp_dissect_pdus are:
the tvbuff pointer, packet_info pointer, and proto_tree pointer

View File

@ -342,7 +342,7 @@ proto_reg_handoff_PROTOABBREV(void)
*/
PROTOABBREV_handle = create_dissector_handle(dissect_PROTOABBREV,
proto_PROTOABBREV);
dissector_add_uint("tcp.port", PROTOABBREV_TCP_PORT, PROTOABBREV_handle);
dissector_add_uint_with_preference("tcp.port", PROTOABBREV_TCP_PORT, PROTOABBREV_handle);
}
#endif

View File

@ -26,8 +26,14 @@
#include "decode_as.h"
#include "packet.h"
#include "prefs.h"
#include "prefs-int.h"
#include "wsutil/file_util.h"
#include "wsutil/filesystem.h"
#include "epan/dissectors/packet-dcerpc.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
GList *decode_as_list = NULL;
@ -134,6 +140,309 @@ gboolean decode_as_default_change(const gchar *name, gconstpointer pattern, gpoi
return TRUE;
}
/* Some useful utilities for Decode As */
/*
* A list of dissectors that need to be reset.
*/
static GSList *dissector_reset_list = NULL;
/*
* A callback function to parse each "decode as" entry in the file and apply the change
*/
static prefs_set_pref_e
read_set_decode_as_entries(gchar *key, const gchar *value,
void *user_data _U_,
gboolean return_range_errors _U_)
{
gchar *values[4] = {NULL, NULL, NULL, NULL};
gchar delimiter[4] = {',', ',', ',','\0'};
gchar *pch;
guint i, j;
dissector_table_t sub_dissectors;
prefs_set_pref_e retval = PREFS_SET_OK;
gboolean is_valid = FALSE;
if (strcmp(key, DECODE_AS_ENTRY) == 0) {
/* Parse csv into table, selector, initial, current */
for (i = 0; i < 4; i++) {
pch = strchr(value, delimiter[i]);
if (pch == NULL) {
for (j = 0; j < i; j++) {
g_free(values[j]);
}
return PREFS_SET_SYNTAX_ERR;
}
values[i] = g_strndup(value, pch - value);
value = pch + 1;
}
sub_dissectors = find_dissector_table(values[0]);
if (sub_dissectors != NULL) {
dissector_handle_t handle;
ftenum_t selector_type;
pref_t* pref_value;
selector_type = dissector_table_get_type(sub_dissectors);
handle = dissector_table_get_dissector_handle(sub_dissectors, values[3]);
if (handle != NULL || g_ascii_strcasecmp(values[3], DECODE_AS_NONE) == 0) {
is_valid = TRUE;
}
if (is_valid) {
if (IS_FT_STRING(selector_type)) {
dissector_change_string(values[0], values[1], handle);
} else {
char *p;
long long_value;
long_value = strtol(values[1], &p, 0);
if (p == values[0] || *p != '\0' || long_value < 0 ||
(unsigned long)long_value > UINT_MAX) {
retval = PREFS_SET_SYNTAX_ERR;
is_valid = FALSE;
} else {
dissector_change_uint(values[0], (guint)long_value, handle);
}
/* Now apply the value data back to dissector table preference */
pref_value = prefs_find_preference(prefs_find_module(proto_get_protocol_filter_name(dissector_handle_get_protocol_index(handle))), values[0]);
if (pref_value != NULL) {
switch(pref_value->type)
{
case PREF_DECODE_AS_UINT:
/* This doesn't support multiple values for a dissector in Decode As because the
preference only supports a single value. This leads to a "last port for
dissector in Decode As wins" */
*pref_value->varp.uint = (guint)long_value;
break;
case PREF_DECODE_AS_RANGE:
range_add_value(pref_value->varp.range, (guint)long_value);
break;
default:
/* XXX - Worth asserting over? */
break;
}
}
}
}
if (is_valid) {
decode_build_reset_list(values[0], selector_type, values[1], NULL, NULL);
}
} else {
retval = PREFS_SET_SYNTAX_ERR;
}
} else {
retval = PREFS_SET_NO_SUCH_PREF;
}
for (i = 0; i < 4; i++) {
g_free(values[i]);
}
return retval;
}
void
load_decode_as_entries(void)
{
char *daf_path;
FILE *daf;
if (dissector_reset_list) {
decode_clear_all();
}
daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE);
if ((daf = ws_fopen(daf_path, "r")) != NULL) {
read_prefs_file(daf_path, daf, read_set_decode_as_entries, NULL);
fclose(daf);
}
g_free(daf_path);
}
static void
decode_as_write_entry (const gchar *table_name, ftenum_t selector_type,
gpointer key, gpointer value, gpointer user_data)
{
FILE *da_file = (FILE *)user_data;
dissector_handle_t current, initial;
const gchar *current_proto_name, *initial_proto_name;
current = dtbl_entry_get_handle((dtbl_entry_t *)value);
if (current == NULL)
current_proto_name = DECODE_AS_NONE;
else
current_proto_name = dissector_handle_get_short_name(current);
initial = dtbl_entry_get_initial_handle((dtbl_entry_t *)value);
if (initial == NULL)
initial_proto_name = DECODE_AS_NONE;
else
initial_proto_name = dissector_handle_get_short_name(initial);
switch (selector_type) {
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
/*
* XXX - write these in decimal, regardless of the base of
* the dissector table's selector, as older versions of
* Wireshark used atoi() when reading this file, and
* failed to handle hex or octal numbers.
*
* That will be fixed in future 1.10 and 1.12 releases,
* but pre-1.10 releases are at end-of-life and won't
* be fixed.
*/
fprintf (da_file,
DECODE_AS_ENTRY ": %s,%u,%s,%s\n",
table_name, GPOINTER_TO_UINT(key), initial_proto_name,
current_proto_name);
break;
case FT_STRING:
case FT_STRINGZ:
case FT_UINT_STRING:
case FT_STRINGZPAD:
fprintf (da_file,
DECODE_AS_ENTRY ": %s,%s,%s,%s\n",
table_name, (gchar *)key, initial_proto_name,
current_proto_name);
break;
default:
g_assert_not_reached();
break;
}
}
int
save_decode_as_entries(gchar** err)
{
char *pf_dir_path;
char *daf_path;
FILE *da_file;
if (create_persconffile_dir(&pf_dir_path) == -1) {
*err = g_strdup_printf("Can't create directory\n\"%s\"\nfor recent file: %s.",
pf_dir_path, g_strerror(errno));
g_free(pf_dir_path);
return -1;
}
daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE);
if ((da_file = ws_fopen(daf_path, "w")) == NULL) {
*err = g_strdup_printf("Can't open decode_as_entries file\n\"%s\": %s.",
daf_path, g_strerror(errno));
g_free(daf_path);
return -1;
}
fputs("# \"Decode As\" entries file for Wireshark " VERSION ".\n"
"#\n"
"# This file is regenerated each time \"Decode As\" preferences\n"
"# are saved within Wireshark. Making manual changes should be safe,\n"
"# however.\n", da_file);
dissector_all_tables_foreach_changed(decode_as_write_entry, da_file);
fclose(da_file);
return 0;
}
/*
* Data structure for tracking which dissector need to be reset. This
* structure is necessary as a hash table entry cannot be removed
* while a g_hash_table_foreach walk is in progress.
*/
typedef struct dissector_delete_item {
/* The name of the dissector table */
gchar *ddi_table_name;
/* The type of the selector in that dissector table */
ftenum_t ddi_selector_type;
/* The selector in the dissector table */
union {
guint sel_uint;
char *sel_string;
} ddi_selector;
} dissector_delete_item_t;
void
decode_build_reset_list (const gchar *table_name, ftenum_t selector_type,
gpointer key, gpointer value _U_,
gpointer user_data _U_)
{
dissector_delete_item_t *item;
item = g_new(dissector_delete_item_t,1);
item->ddi_table_name = g_strdup(table_name);
item->ddi_selector_type = selector_type;
switch (selector_type) {
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
item->ddi_selector.sel_uint = GPOINTER_TO_UINT(key);
break;
case FT_STRING:
case FT_STRINGZ:
case FT_UINT_STRING:
case FT_STRINGZPAD:
item->ddi_selector.sel_string = g_strdup((char *)key);
break;
default:
g_assert_not_reached();
}
dissector_reset_list = g_slist_prepend(dissector_reset_list, item);
}
/* clear all settings */
void
decode_clear_all(void)
{
dissector_delete_item_t *item;
GSList *tmp;
dissector_all_tables_foreach_changed(decode_build_reset_list, NULL);
for (tmp = dissector_reset_list; tmp; tmp = g_slist_next(tmp)) {
item = (dissector_delete_item_t *)tmp->data;
switch (item->ddi_selector_type) {
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
dissector_reset_uint(item->ddi_table_name,
item->ddi_selector.sel_uint);
break;
case FT_STRING:
case FT_STRINGZ:
case FT_UINT_STRING:
case FT_STRINGZPAD:
dissector_reset_string(item->ddi_table_name,
item->ddi_selector.sel_string);
g_free(item->ddi_selector.sel_string);
break;
default:
g_assert_not_reached();
}
g_free(item->ddi_table_name);
g_free(item);
}
g_slist_free(dissector_reset_list);
dissector_reset_list = NULL;
decode_dcerpc_reset_all();
}
/*
* Editor modelines
*

View File

@ -97,6 +97,47 @@ WS_DLL_PUBLIC gboolean decode_as_default_change(const gchar *name, gconstpointer
*/
WS_DLL_PUBLIC GList *decode_as_list;
/* Some useful utilities for Decode As */
/** Reset the "decode as" entries and reload ones of the current profile.
*/
WS_DLL_PUBLIC void load_decode_as_entries(void);
/** Write out the "decode as" entries of the current profile.
*/
WS_DLL_PUBLIC int save_decode_as_entries(gchar** err);
/** Clear all "decode as" settings.
*/
WS_DLL_PUBLIC void decode_clear_all(void);
/** This routine creates one entry in the list of protocol dissector
* that need to be reset. It is called by the g_hash_table_foreach
* routine once for each changed entry in a dissector table.
* Unfortunately it cannot delete the entry immediately as this screws
* up the foreach function, so it builds a list of dissectors to be
* reset once the foreach routine finishes.
*
* @param table_name The table name in which this dissector is found.
*
* @param key A pointer to the key for this entry in the dissector
* hash table. This is generally the numeric selector of the
* protocol, i.e. the ethernet type code, IP port number, TCP port
* number, etc.
*
* @param selector_type The type of the selector in that dissector table
*
* @param value A pointer to the value for this entry in the dissector
* hash table. This is an opaque pointer that can only be handed back
* to routine in the file packet.c - but it's unused.
*
* @param user_data Unused.
*/
WS_DLL_PUBLIC void decode_build_reset_list (const gchar *table_name, ftenum_t selector_type,
gpointer key, gpointer value _U_,
gpointer user_data _U_);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -1418,7 +1418,7 @@ proto_reg_handoff_c1222(void)
if( !initialized ) {
c1222_handle = create_dissector_handle(dissect_c1222, proto_c1222);
c1222_udp_handle = create_dissector_handle(dissect_c1222_common, proto_c1222);
dissector_add_uint("tcp.port", global_c1222_port, c1222_handle);
dissector_add_uint_with_preference("tcp.port", C1222_PORT, c1222_handle);
dissector_add_uint("udp.port", global_c1222_port, c1222_udp_handle);
initialized = TRUE;
}

View File

@ -50,7 +50,6 @@ void proto_register_cmp(void);
/* desegmentation of CMP over TCP */
static gboolean cmp_desegment = TRUE;
static guint cmp_alternate_tcp_port = 0;
static guint cmp_alternate_http_port = 0;
static guint cmp_alternate_tcp_style_http_port = 0;
@ -345,12 +344,6 @@ void proto_register_cmp(void) {
"To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&cmp_desegment);
prefs_register_uint_preference(cmp_module, "tcp_alternate_port",
"Alternate TCP port",
"Decode this TCP port\'s traffic as CMP. Set to \"0\" to disable.",
10,
&cmp_alternate_tcp_port);
prefs_register_uint_preference(cmp_module, "http_alternate_port",
"Alternate HTTP port",
"Decode this TCP port\'s traffic as CMP-over-HTTP. Set to \"0\" to disable. "
@ -373,7 +366,6 @@ void proto_reg_handoff_cmp(void) {
static dissector_handle_t cmp_http_handle;
static dissector_handle_t cmp_tcp_style_http_handle;
static dissector_handle_t cmp_tcp_handle;
static guint cmp_alternate_tcp_port_prev = 0;
static guint cmp_alternate_http_port_prev = 0;
static guint cmp_alternate_tcp_style_http_port_prev = 0;
@ -387,7 +379,7 @@ void proto_reg_handoff_cmp(void) {
dissector_add_string("media_type", "application/x-pkixcmp-poll", cmp_tcp_style_http_handle);
cmp_tcp_handle = create_dissector_handle(dissect_cmp_tcp, proto_cmp);
dissector_add_uint("tcp.port", TCP_PORT_CMP, cmp_tcp_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_CMP, cmp_tcp_handle);
oid_add_from_string("Cryptlib-presence-check","1.3.6.1.4.1.3029.3.1.1");
oid_add_from_string("Cryptlib-PKIBoot","1.3.6.1.4.1.3029.3.1.2");
@ -401,20 +393,10 @@ void proto_reg_handoff_cmp(void) {
inited = TRUE;
}
/* change alternate TCP port if changed in the preferences */
if (cmp_alternate_tcp_port != cmp_alternate_tcp_port_prev) {
if (cmp_alternate_tcp_port_prev != 0)
dissector_delete_uint("tcp.port", cmp_alternate_tcp_port_prev, cmp_tcp_handle);
if (cmp_alternate_tcp_port != 0)
dissector_add_uint("tcp.port", cmp_alternate_tcp_port, cmp_tcp_handle);
cmp_alternate_tcp_port_prev = cmp_alternate_tcp_port;
}
/* change alternate HTTP port if changed in the preferences */
if (cmp_alternate_http_port != cmp_alternate_http_port_prev) {
if (cmp_alternate_http_port_prev != 0) {
dissector_delete_uint("tcp.port", cmp_alternate_http_port_prev, NULL);
dissector_delete_uint("http.port", cmp_alternate_http_port_prev, NULL);
http_tcp_dissector_delete(cmp_alternate_http_port_prev);
}
if (cmp_alternate_http_port != 0)
http_tcp_dissector_add( cmp_alternate_http_port, cmp_http_handle);
@ -424,8 +406,7 @@ void proto_reg_handoff_cmp(void) {
/* change alternate TCP-style-HTTP port if changed in the preferences */
if (cmp_alternate_tcp_style_http_port != cmp_alternate_tcp_style_http_port_prev) {
if (cmp_alternate_tcp_style_http_port_prev != 0) {
dissector_delete_uint("tcp.port", cmp_alternate_tcp_style_http_port_prev, NULL);
dissector_delete_uint("http.port", cmp_alternate_tcp_style_http_port_prev, NULL);
http_tcp_dissector_delete(cmp_alternate_tcp_style_http_port_prev);
}
if (cmp_alternate_tcp_style_http_port != 0)
http_tcp_dissector_add( cmp_alternate_tcp_style_http_port, cmp_tcp_style_http_handle);

View File

@ -610,7 +610,7 @@ void proto_reg_handoff_h245(void) {
amr_handle = find_dissector("amr_if2_nb");
dissector_add_for_decode_as("tcp.port", h245_handle);
dissector_add_for_decode_as_with_preference("tcp.port", h245_handle);
dissector_add_for_decode_as("udp.port", MultimediaSystemControlMessage_handle);
}

View File

@ -837,7 +837,7 @@ void gcp_analyze_msg(proto_tree* gcp_tree, packet_info* pinfo, tvbuff_t* gcp_tvb
static gboolean keep_persistent_data = FALSE;
static guint global_udp_port = 2945;
static guint global_tcp_port = 2945;
#define H248_TCP_PORT 2945
static gboolean h248_desegment = TRUE;
@ -2383,11 +2383,6 @@ void proto_register_h248(void) {
"Port to be decoded as h248",
10,
&global_udp_port);
prefs_register_uint_preference(h248_module, "tcp_port",
"TCP port",
"Port to be decoded as h248",
10,
&global_tcp_port);
prefs_register_bool_preference(h248_module, "desegment",
"Desegment H.248 over TCP",
"Desegment H.248 messages that span more TCP segments",
@ -2406,31 +2401,23 @@ void proto_reg_handoff_h248(void) {
static gboolean initialized = FALSE;
static guint32 udp_port;
static guint32 tcp_port;
if (!initialized) {
dissector_add_uint("mtp3.service_indicator", MTP_SI_GCP, h248_handle);
h248_term_handle = find_dissector_add_dependency("h248term", proto_h248);
dissector_add_uint_with_preference("tcp.port", H248_TCP_PORT, h248_tpkt_handle);
initialized = TRUE;
} else {
if (udp_port != 0)
dissector_delete_uint("udp.port", udp_port, h248_handle);
if (tcp_port != 0)
dissector_delete_uint("tcp.port", tcp_port, h248_tpkt_handle);
}
udp_port = global_udp_port;
tcp_port = global_tcp_port;
if (udp_port != 0) {
dissector_add_uint("udp.port", udp_port, h248_handle);
}
if (tcp_port != 0) {
dissector_add_uint("tcp.port", tcp_port, h248_tpkt_handle);
}
ss7pc_address_type = address_type_get_by_name("AT_SS7PC");
exported_pdu_tap = find_tap_id(EXPORT_PDU_TAP_NAME_LAYER_7);
}

View File

@ -51,8 +51,8 @@ static int ett_h501 = -1;
static dissector_handle_t h501_pdu_handle;
/* Preferences */
#define H501_TCP_PORT 2099
static guint h501_udp_port = 2099;
static guint h501_tcp_port = 2099;
static gboolean h501_desegment_tcp = TRUE;
void proto_reg_handoff_h501(void);
@ -116,10 +116,6 @@ void proto_register_h501(void) {
"UDP port",
"Port to be decoded as h501",
10, &h501_udp_port);
prefs_register_uint_preference(h501_module, "tcp.port",
"TCP port",
"Port to be decoded as h501",
10, &h501_tcp_port);
prefs_register_bool_preference(h501_module, "desegment",
"Desegment H.501 over TCP",
"Desegment H.501 messages that span more TCP segments",
@ -134,22 +130,19 @@ void proto_reg_handoff_h501(void)
static dissector_handle_t h501_udp_handle;
static dissector_handle_t h501_tcp_handle;
static guint saved_h501_udp_port;
static guint saved_h501_tcp_port;
if (!h501_prefs_initialized) {
h501_udp_handle = create_dissector_handle(dissect_h501_udp, proto_h501);
h501_tcp_handle = create_dissector_handle(dissect_h501_tcp, proto_h501);
dissector_add_uint_with_preference("tcp.port", H501_TCP_PORT, h501_tcp_handle);
h501_prefs_initialized = TRUE;
} else {
dissector_delete_uint("udp.port", saved_h501_udp_port, h501_udp_handle);
dissector_delete_uint("tcp.port", saved_h501_tcp_port, h501_tcp_handle);
}
/* Set our port number for future use */
saved_h501_udp_port = h501_udp_port;
dissector_add_uint("udp.port", saved_h501_udp_port, h501_udp_handle);
saved_h501_tcp_port = h501_tcp_port;
dissector_add_uint("tcp.port", saved_h501_tcp_port, h501_tcp_handle);
}

View File

@ -47,13 +47,11 @@
void proto_register_idmp(void);
void proto_reg_handoff_idm(void);
static void prefs_register_idmp(void); /* forward declaration for use in preferences registration */
void register_idmp_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name);
static gboolean idmp_desegment = TRUE;
static guint global_idmp_tcp_port = 1102; /* made up for now */
#define IDMP_TCP_PORT 1102 /* made up for now - not IANA registered */
static gboolean idmp_reassemble = TRUE;
static guint tcp_port = 0;
static dissector_handle_t idmp_handle = NULL;
static proto_tree *top_tree = NULL;
@ -343,7 +341,7 @@ void proto_register_idmp(void)
/* Register our configuration options for IDMP, particularly our port */
idmp_module = prefs_register_protocol_subtree("OSI/X.500", proto_idmp, prefs_register_idmp);
idmp_module = prefs_register_protocol_subtree("OSI/X.500", proto_idmp, NULL);
prefs_register_bool_preference(idmp_module, "desegment_idmp_messages",
"Reassemble IDMP messages spanning multiple TCP segments",
@ -357,33 +355,10 @@ void proto_register_idmp(void)
" To use this option, you must also enable"
" \"Allow subdissectors to reassemble TCP streams\""
" in the TCP protocol settings.", &idmp_reassemble);
prefs_register_uint_preference(idmp_module, "tcp.port", "IDMP TCP Port",
"Set the port for Internet Directly Mapped Protocol requests/responses",
10, &global_idmp_tcp_port);
}
/*--- proto_reg_handoff_idm --- */
void proto_reg_handoff_idm(void) {
}
static void
prefs_register_idmp(void)
{
/* de-register the old port */
/* port 102 is registered by TPKT - don't undo this! */
if(idmp_handle)
dissector_delete_uint("tcp.port", tcp_port, idmp_handle);
/* Set our port number for future use */
tcp_port = global_idmp_tcp_port;
if((tcp_port > 0) && idmp_handle)
dissector_add_uint("tcp.port", global_idmp_tcp_port, idmp_handle);
dissector_add_uint_with_preference("tcp.port", IDMP_TCP_PORT, idmp_handle);
}

View File

@ -50,7 +50,7 @@ static dissector_handle_t ilp_handle;
/* IANA Registered Ports
* oma-ilp 7276/tcp OMA Internal Location
*/
static guint gbl_ilp_port = 7276;
#define ILP_TCP_PORT 7276
/* Initialize the protocol and registered fields */
static int proto_ilp = -1;
@ -123,21 +123,13 @@ void proto_register_ilp(void) {
proto_register_field_array(proto_ilp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
ilp_module = prefs_register_protocol(proto_ilp,proto_reg_handoff_ilp);
ilp_module = prefs_register_protocol(proto_ilp, NULL);
prefs_register_bool_preference(ilp_module, "desegment_ilp_messages",
"Reassemble ILP messages spanning multiple TCP segments",
"Whether the ILP dissector should reassemble messages spanning multiple TCP segments."
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&ilp_desegment);
/* Register a configuration option for port */
prefs_register_uint_preference(ilp_module, "tcp.port",
"ILP TCP Port",
"Set the TCP port for ILP messages(IANA registered port is 7276)",
10,
&gbl_ilp_port);
}
@ -145,18 +137,9 @@ void proto_register_ilp(void) {
void
proto_reg_handoff_ilp(void)
{
static gboolean initialized = FALSE;
static guint local_ilp_port;
dissector_add_string("media_type","application/oma-supl-ilp", ilp_handle);
rrlp_handle = find_dissector_add_dependency("rrlp", proto_ilp);
lpp_handle = find_dissector_add_dependency("lpp", proto_ilp);
if (!initialized) {
dissector_add_string("media_type","application/oma-supl-ilp", ilp_handle);
rrlp_handle = find_dissector_add_dependency("rrlp", proto_ilp);
lpp_handle = find_dissector_add_dependency("lpp", proto_ilp);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", local_ilp_port, ilp_handle);
}
local_ilp_port = gbl_ilp_port;
dissector_add_uint("tcp.port", gbl_ilp_port, ilp_handle);
dissector_add_uint_with_preference("tcp.port", ILP_TCP_PORT, ilp_handle);
}

View File

@ -2339,7 +2339,7 @@ proto_reg_handoff_kerberos(void)
proto_kerberos);
dissector_add_uint("udp.port", UDP_PORT_KERBEROS, kerberos_handle_udp);
dissector_add_uint("tcp.port", TCP_PORT_KERBEROS, kerberos_handle_tcp);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_KERBEROS, kerberos_handle_tcp);
register_dcerpc_auth_subdissector(DCE_C_AUTHN_LEVEL_CONNECT,
DCE_C_RPC_AUTHN_PROTOCOL_GSS_KERBEROS,

View File

@ -216,16 +216,13 @@ static gchar *attr_type = NULL;
static gboolean is_binary_attr_type = FALSE;
static gboolean ldap_found_in_frame = FALSE;
#define TCP_PORT_LDAP 389
#define TCP_PORT_RANGE_LDAP "389,3268" /* 3268 is Windows 2000 Global Catalog */
#define TCP_PORT_LDAPS 636
#define UDP_PORT_CLDAP 389
#define TCP_PORT_GLOBALCAT_LDAP 3268 /* Windows 2000 Global Catalog */
/* desegmentation of LDAP */
static gboolean ldap_desegment = TRUE;
static guint global_ldap_tcp_port = TCP_PORT_LDAP;
static guint global_ldaps_tcp_port = TCP_PORT_LDAPS;
static guint tcp_port = 0;
static guint ssl_port = 0;
static dissector_handle_t gssapi_handle;
@ -2203,10 +2200,6 @@ void proto_register_ldap(void) {
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&ldap_desegment);
prefs_register_uint_preference(ldap_module, "tcp.port", "LDAP TCP Port",
"Set the port for LDAP operations",
10, &global_ldap_tcp_port);
prefs_register_uint_preference(ldap_module, "ssl.port", "LDAPS TCP Port",
"Set the port for LDAP operations over SSL",
10, &global_ldaps_tcp_port);
@ -2252,8 +2245,6 @@ proto_reg_handoff_ldap(void)
{
dissector_handle_t cldap_handle;
dissector_add_uint("tcp.port", TCP_PORT_GLOBALCAT_LDAP, ldap_handle);
cldap_handle = create_dissector_handle(dissect_mscldap, proto_cldap);
dissector_add_uint("udp.port", UDP_PORT_CLDAP, cldap_handle);
@ -2321,25 +2312,12 @@ proto_reg_handoff_ldap(void)
#include "packet-ldap-dis-tab.c"
dissector_add_uint_range_with_preference("tcp.port", TCP_PORT_RANGE_LDAP, ldap_handle);
}
static void
prefs_register_ldap(void)
{
if(tcp_port != global_ldap_tcp_port) {
if(tcp_port)
dissector_delete_uint("tcp.port", tcp_port, ldap_handle);
/* Set our port number for future use */
tcp_port = global_ldap_tcp_port;
if(tcp_port)
dissector_add_uint("tcp.port", tcp_port, ldap_handle);
}
if(ssl_port != global_ldaps_tcp_port) {
if(ssl_port)
ssl_dissector_delete(ssl_port, ldap_handle);

View File

@ -73,6 +73,8 @@ static guint32 ProtocolIE_ID;
static guint32 ProtocolExtensionID;
static guint8 sms_encoding;
#define SABP_PORT 3452
/* desegmentation of sabp over TCP */
static gboolean gbl_sabp_desegment = TRUE;
@ -286,8 +288,8 @@ void proto_register_sabp(void) {
void
proto_reg_handoff_sabp(void)
{
dissector_add_uint("udp.port", 3452, sabp_handle);
dissector_add_uint("tcp.port", 3452, sabp_tcp_handle);
dissector_add_uint("udp.port", SABP_PORT, sabp_handle);
dissector_add_uint_with_preference("tcp.port", SABP_PORT, sabp_tcp_handle);
dissector_add_uint("sctp.ppi", SABP_PAYLOAD_PROTOCOL_ID, sabp_handle);
#include "packet-sabp-dis-tab.c"

View File

@ -33,7 +33,7 @@
#define PSNAME "SMRSE"
#define PFNAME "smrse"
#define TCP_PORT_SMRSE 4321
#define TCP_PORT_SMRSE 4321 /* Not IANA registered */
void proto_register_smrse(void);
void proto_reg_handoff_smrse(void);
@ -178,6 +178,6 @@ void proto_reg_handoff_smrse(void) {
dissector_handle_t smrse_handle;
smrse_handle = create_dissector_handle(dissect_smrse, proto_smrse);
dissector_add_uint("tcp.port",TCP_PORT_SMRSE, smrse_handle);
dissector_add_uint_with_preference("tcp.port",TCP_PORT_SMRSE, smrse_handle);
}

View File

@ -2588,7 +2588,10 @@ void proto_reg_handoff_snmp(void) {
dissector_add_uint("hpext.dxsap", HPEXT_SNMP, snmp_handle);
snmp_tcp_handle = create_dissector_handle(dissect_snmp_tcp, proto_snmp);
dissector_add_uint("tcp.port", TCP_PORT_SNMP, snmp_tcp_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_SNMP, snmp_tcp_handle);
/* Since "regular" SNMP port and "trap" SNMP port use the same handler,
the "trap" port doesn't really need a separate preference. Just register
normally */
dissector_add_uint("tcp.port", TCP_PORT_SNMP_TRAP, snmp_tcp_handle);
data_handle = find_dissector("data");
@ -2631,7 +2634,7 @@ proto_reg_handoff_smux(void)
dissector_handle_t smux_handle;
smux_handle = create_dissector_handle(dissect_smux, proto_smux);
dissector_add_uint("tcp.port", TCP_PORT_SMUX, smux_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_SMUX, smux_handle);
}
/*

View File

@ -727,7 +727,7 @@ proto_register_t38(void)
t38_tap = register_tap("t38");
t38_module = prefs_register_protocol(proto_t38, proto_reg_handoff_t38);
t38_module = prefs_register_protocol(proto_t38, NULL);
prefs_register_bool_preference(t38_module, "use_pre_corrigendum_asn1_specification",
"Use the Pre-Corrigendum ASN.1 specification",
"Whether the T.38 dissector should decode using the Pre-Corrigendum T.38 "
@ -739,7 +739,6 @@ proto_register_t38(void)
"be dissected as RTP packet or T.38 packet. If enabled there is a risk that T.38 UDPTL "
"packets with sequence number higher than 32767 may be dissected as RTP.",
&dissect_possible_rtpv2_packets_as_rtp);
prefs_register_obsolete_preference(t38_module, "tcp.port");
prefs_register_obsolete_preference(t38_module, "udp.port");
prefs_register_bool_preference(t38_module, "reassembly",
"Reassemble T.38 PDUs over TPKT over TCP",
@ -764,16 +763,11 @@ proto_register_t38(void)
void
proto_reg_handoff_t38(void)
{
static gboolean t38_prefs_initialized = FALSE;
if (!t38_prefs_initialized) {
t38_udp_handle=create_dissector_handle(dissect_t38_udp, proto_t38);
t38_tcp_handle=create_dissector_handle(dissect_t38_tcp, proto_t38);
t38_tcp_pdu_handle=create_dissector_handle(dissect_t38_tcp_pdu, proto_t38);
rtp_handle = find_dissector_add_dependency("rtp", proto_t38);
t30_hdlc_handle = find_dissector_add_dependency("t30.hdlc""rtp", proto_t38);
data_handle = find_dissector("data");
t38_prefs_initialized = TRUE;
}
t38_udp_handle=create_dissector_handle(dissect_t38_udp, proto_t38);
t38_tcp_handle=create_dissector_handle(dissect_t38_tcp, proto_t38);
t38_tcp_pdu_handle=create_dissector_handle(dissect_t38_tcp_pdu, proto_t38);
rtp_handle = find_dissector_add_dependency("rtp", proto_t38);
t30_hdlc_handle = find_dissector_add_dependency("t30.hdlc""rtp", proto_t38);
data_handle = find_dissector("data");
}

View File

@ -51,8 +51,8 @@ static dissector_handle_t lpp_handle;
* oma-ulp 7275/tcp OMA UserPlane Location
* oma-ulp 7275/udp OMA UserPlane Location
*/
static guint gbl_ulp_tcp_port = 7275;
static guint gbl_ulp_udp_port = 7275;
#define ULP_PORT 7275
static guint gbl_ulp_udp_port = ULP_PORT;
/* Initialize the protocol and registered fields */
static int proto_ulp = -1;
@ -428,11 +428,6 @@ void proto_register_ulp(void) {
&ulp_desegment);
/* Register a configuration option for port */
prefs_register_uint_preference(ulp_module, "tcp.port",
"ULP TCP Port",
"Set the TCP port for ULP messages (IANA registered port is 7275)",
10,
&gbl_ulp_tcp_port);
prefs_register_uint_preference(ulp_module, "udp.port",
"ULP UDP Port",
"Set the UDP port for ULP messages (IANA registered port is 7275)",
@ -448,7 +443,7 @@ proto_reg_handoff_ulp(void)
{
static gboolean initialized = FALSE;
static dissector_handle_t ulp_udp_handle;
static guint local_ulp_tcp_port, local_ulp_udp_port;
static guint local_ulp_udp_port;
if (!initialized) {
dissector_add_string("media_type","application/oma-supl-ulp", ulp_tcp_handle);
@ -456,14 +451,12 @@ proto_reg_handoff_ulp(void)
ulp_udp_handle = create_dissector_handle(dissect_ULP_PDU_PDU, proto_ulp);
rrlp_handle = find_dissector_add_dependency("rrlp", proto_ulp);
lpp_handle = find_dissector_add_dependency("lpp", proto_ulp);
dissector_add_uint_with_preference("tcp.port", ULP_PORT, ulp_tcp_handle);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", local_ulp_tcp_port, ulp_tcp_handle);
dissector_delete_uint("udp.port", local_ulp_udp_port, ulp_udp_handle);
}
local_ulp_tcp_port = gbl_ulp_tcp_port;
dissector_add_uint("tcp.port", gbl_ulp_tcp_port, ulp_tcp_handle);
local_ulp_udp_port = gbl_ulp_udp_port;
dissector_add_uint("udp.port", gbl_ulp_udp_port, ulp_udp_handle);
}

View File

@ -785,9 +785,9 @@ proto_reg_handoff_njack(void)
njack_handle = create_dissector_handle(dissect_njack_static, proto_njack);
dissector_add_uint("udp.port", PORT_NJACK_PC, njack_handle);
/* dissector_add_uint("tcp.port", PORT_NJACK_PC, njack_handle); */
/* dissector_add_uint_with_preference("tcp.port", PORT_NJACK_PC, njack_handle); */
dissector_add_uint("udp.port", PORT_NJACK_SWITCH, njack_handle);
/* dissector_add_uint("tcp.port", PORT_NJACK_SWITCH, njack_handle); */
/* dissector_add_uint_with_preference("tcp.port", PORT_NJACK_SWITCH, njack_handle); */
heur_dissector_add("udp", dissect_njack_heur, "NJACK over UDP", "njack_udp", proto_njack, HEURISTIC_ENABLE);
heur_dissector_add("tcp", dissect_njack_heur, "NJACK over TCP", "njack_tcp", proto_njack, HEURISTIC_DISABLE);

View File

@ -2735,7 +2735,7 @@ void proto_reg_handoff_9P(void)
ninep_handle = create_dissector_handle(dissect_9P, proto_9P);
dissector_add_uint("tcp.port", NINEPORT, ninep_handle);
dissector_add_uint_with_preference("tcp.port", NINEPORT, ninep_handle);
}

View File

@ -228,7 +228,7 @@ proto_register_acap(void)
void
proto_reg_handoff_acap(void)
{
dissector_add_uint("tcp.port", TCP_PORT_ACAP, acap_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_ACAP, acap_handle);
}
/*

View File

@ -900,7 +900,7 @@ proto_reg_handoff_adb(void)
{
adb_service_handle = find_dissector_add_dependency("adb_service", proto_adb);
dissector_add_for_decode_as("tcp.port", adb_handle);
dissector_add_for_decode_as_with_preference("tcp.port", adb_handle);
dissector_add_for_decode_as("usb.device", adb_handle);
dissector_add_for_decode_as("usb.product", adb_handle);
dissector_add_for_decode_as("usb.protocol", adb_handle);

View File

@ -437,7 +437,7 @@ proto_reg_handoff_adb_cs(void)
{
adb_service_handle = find_dissector_add_dependency("adb_service", proto_adb_cs);
dissector_add_for_decode_as("tcp.port", adb_cs_handle);
dissector_add_for_decode_as_with_preference("tcp.port", adb_cs_handle);
}
/*

View File

@ -26,12 +26,11 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/to_str.h>
#include "packet-tcp.h"
static guint global_agentx_tcp_port = 705;
#define AGENTX_TCP_PORT 705
void proto_register_agentx(void);
void proto_reg_handoff_agentx(void);
@ -1111,42 +1110,21 @@ proto_register_agentx(void)
&ett_flags,
};
module_t *agentx_module;
proto_agentx = proto_register_protocol("AgentX",
"AgentX", "agentx");
proto_agentx = proto_register_protocol("AgentX", "AgentX", "agentx");
proto_register_field_array(proto_agentx, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
agentx_module = prefs_register_protocol(proto_agentx, proto_reg_handoff_agentx);
prefs_register_uint_preference(agentx_module, "tcp.agentx_port",
"AgentX listener TCP Port",
"Set the TCP port for AgentX"
"(if other than the default of 705)",
10, &global_agentx_tcp_port);
}
/* The registration hand-off routine */
void
proto_reg_handoff_agentx(void)
{
static gboolean agentx_prefs_initialized = FALSE;
static dissector_handle_t agentx_handle;
static guint agentx_tcp_port;
dissector_handle_t agentx_handle;
if(!agentx_prefs_initialized) {
agentx_handle = create_dissector_handle(dissect_agentx, proto_agentx);
agentx_prefs_initialized = TRUE;
}
else {
dissector_delete_uint("tcp.port", agentx_tcp_port, agentx_handle);
}
agentx_handle = create_dissector_handle(dissect_agentx, proto_agentx);
agentx_tcp_port = global_agentx_tcp_port;
dissector_add_uint("tcp.port", agentx_tcp_port, agentx_handle);
dissector_add_uint_with_preference("tcp.port", AGENTX_TCP_PORT, agentx_handle);
}
/*

View File

@ -98,7 +98,7 @@ proto_reg_handoff_aim_oft(void)
/* FIXME
aim_handle = create_dissector_handle(dissect_aim, proto_aim);
dissector_add_uint("tcp.port", TCP_PORT_AIM, aim_handle);*/
dissector_add_uint_with_preference("tcp.port", TCP_PORT_AIM, aim_handle);*/
}
/*

View File

@ -1736,7 +1736,7 @@ proto_register_aim(void)
void
proto_reg_handoff_aim(void)
{
dissector_add_uint("tcp.port", TCP_PORT_AIM, aim_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_AIM, aim_handle);
ssl_dissector_add(0, aim_handle);
/* Heuristics disabled by default, it is really weak... */
heur_dissector_add("ssl", dissect_aim_ssl_heur, "AIM over SSL", "aim_ssl", proto_aim, HEURISTIC_DISABLE);

View File

@ -32,6 +32,7 @@
void proto_register_ajp13(void);
void proto_reg_handoff_ajp13(void);
#define AJP13_TCP_PORT 8009 /* Not IANA registered */
/* IMPORTANT IMPLEMENTATION NOTES
*
@ -1118,7 +1119,7 @@ proto_reg_handoff_ajp13(void)
{
dissector_handle_t ajp13_handle;
ajp13_handle = create_dissector_handle(dissect_ajp13, proto_ajp13);
dissector_add_uint("tcp.port", 8009, ajp13_handle);
dissector_add_uint_with_preference("tcp.port", AJP13_TCP_PORT, ajp13_handle);
}
/*

View File

@ -28,8 +28,8 @@
void proto_register_AllJoyn(void);
void proto_reg_handoff_AllJoyn(void);
static const int name_server_port = 9956;
static const int message_port = 9955;
#define ALLJOYN_NAME_SERVER_PORT 9956 /* IANA lists only UDP as being registered (dissector also uses TCP port) */
#define ALLJOYN_MESSAGE_PORT 9955
/* DBus limits array length to 2^26. AllJoyn limits it to 2^17 */
#define MAX_ARRAY_LEN 131072
@ -3034,21 +3034,16 @@ proto_reg_handoff_AllJoyn(void)
if(!initialized) {
alljoyn_handle_ns = create_dissector_handle(dissect_AllJoyn_name_server, proto_AllJoyn_ns);
alljoyn_handle_ardp = create_dissector_handle(dissect_AllJoyn_ardp, proto_AllJoyn_ardp);
} else {
dissector_delete_uint("udp.port", name_server_port, alljoyn_handle_ns);
dissector_delete_uint("tcp.port", name_server_port, alljoyn_handle_ns);
dissector_delete_uint("udp.port", message_port, alljoyn_handle_ardp);
dissector_delete_uint("tcp.port", message_port, alljoyn_handle_ardp);
dissector_add_uint_with_preference("tcp.port", ALLJOYN_NAME_SERVER_PORT, alljoyn_handle_ns);
dissector_add_uint_with_preference("tcp.port", ALLJOYN_MESSAGE_PORT, alljoyn_handle_ardp);
initialized = TRUE;
}
dissector_add_uint("udp.port", name_server_port, alljoyn_handle_ns);
dissector_add_uint("tcp.port", name_server_port, alljoyn_handle_ns);
dissector_add_uint("udp.port", ALLJOYN_NAME_SERVER_PORT, alljoyn_handle_ns);
/* The ARDP dissector will directly call the AllJoyn message dissector if needed.
* This includes the case where there is no ARDP data. */
dissector_add_uint("udp.port", message_port, alljoyn_handle_ardp);
dissector_add_uint("tcp.port", message_port, alljoyn_handle_ardp);
dissector_add_uint("udp.port", ALLJOYN_MESSAGE_PORT, alljoyn_handle_ardp);
}
/*

View File

@ -53,7 +53,7 @@ void proto_register_amqp(void);
void proto_reg_handoff_amqp(void);
/* Generic data */
static guint amqp_port = 5672;
#define AMQP_PORT 5672
static guint amqps_port = 5671; /* AMQP over TLS/SSL */
/* Generic defines */
@ -13977,11 +13977,7 @@ proto_register_amqp(void)
expert_register_field_array(expert_amqp, ei, array_length(ei));
amqp_module = prefs_register_protocol(proto_amqp, proto_reg_handoff_amqp);
prefs_register_uint_preference(amqp_module, "tcp.port",
"AMQP listening TCP Port",
"Set the TCP port for AMQP"
"(if other than the default of 5672)",
10, &amqp_port);
prefs_register_uint_preference(amqp_module, "ssl.port",
"AMQPS listening TCP Port",
"Set the TCP port for AMQP over TLS/SSL"
@ -13993,30 +13989,21 @@ void
proto_reg_handoff_amqp(void)
{
static dissector_handle_t amqp_tcp_handle;
static guint old_amqp_port = 0;
static guint old_amqps_port = 0;
static gboolean initialize = FALSE;
amqp_tcp_handle = find_dissector("amqp");
/* Register TCP port for dissection */
if (old_amqp_port != 0 && old_amqp_port != amqp_port){
dissector_delete_uint("tcp.port", old_amqp_port, amqp_tcp_handle);
}
if (amqp_port != 0 && old_amqp_port != amqp_port) {
old_amqp_port = amqp_port;
dissector_add_uint("tcp.port", amqp_port, amqp_tcp_handle);
if (!initialize) {
/* Register TCP port for dissection */
dissector_add_uint_with_preference("tcp.port", AMQP_PORT, amqp_tcp_handle);
initialize = TRUE;
}
/* Register for TLS/SSL payload dissection */
if (old_amqps_port != 0 && old_amqps_port != amqps_port){
ssl_dissector_delete(old_amqps_port, amqp_tcp_handle);
}
if (amqps_port != 0 && old_amqps_port != amqps_port) {
old_amqps_port = amqps_port;
ssl_dissector_add(amqps_port, amqp_tcp_handle);
}
}
/*

View File

@ -929,7 +929,7 @@ proto_reg_handoff_ancp(void)
dissector_handle_t ancp_handle;
ancp_handle = create_dissector_handle(dissect_ancp, proto_ancp);
dissector_add_uint("tcp.port", ANCP_PORT, ancp_handle);
dissector_add_uint_with_preference("tcp.port", ANCP_PORT, ancp_handle);
stats_tree_register("ancp", "ancp", "ANCP", 0,
ancp_stats_tree_packet, ancp_stats_tree_init, NULL);
}

View File

@ -396,10 +396,10 @@ void proto_register_aol(void) {
* Initialize the dissector.
*/
void proto_reg_handoff_aol(void) {
static dissector_handle_t aol_handle;
dissector_handle_t aol_handle;
aol_handle = create_dissector_handle(dissect_aol,proto_aol);
dissector_add_uint("tcp.port",AOL_PORT,aol_handle);
dissector_add_uint_with_preference("tcp.port",AOL_PORT,aol_handle);
}
/* vi:set ts=4: */

View File

@ -924,7 +924,7 @@ proto_reg_handoff_asap(void)
asap_handle = create_dissector_handle(dissect_asap, proto_asap);
dissector_add_uint("sctp.ppi", ASAP_PAYLOAD_PROTOCOL_ID, asap_handle);
dissector_add_uint("udp.port", ASAP_UDP_PORT, asap_handle);
dissector_add_uint("tcp.port", ASAP_TCP_PORT, asap_handle);
dissector_add_uint_with_preference("tcp.port", ASAP_TCP_PORT, asap_handle);
dissector_add_uint("sctp.port", ASAP_SCTP_PORT, asap_handle);
}

View File

@ -28,6 +28,7 @@
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/range.h>
#include <epan/crc16-tvb.h>
#include "packet-tcp.h"
@ -1030,6 +1031,8 @@ typedef enum
userType_e;
#define ASSA_R3_PORT_RANGE "2571,8023" /* Neither are IANA registered */
/*
* Wireshark ID of the R3 protocol
*/
@ -10103,8 +10106,8 @@ void proto_register_r3 (void)
void proto_reg_handoff_r3 (void)
{
dissector_handle_t r3_handle = find_dissector ("r3");
dissector_add_uint ("tcp.port", 2571, r3_handle);
dissector_add_uint ("tcp.port", 8023, r3_handle);
dissector_add_uint_range_with_preference("tcp.port", ASSA_R3_PORT_RANGE, r3_handle);
}
/*

View File

@ -29,7 +29,6 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/prefs.h>
void proto_register_atmtcp(void);
void proto_reg_handoff_atmtcp(void);
@ -39,7 +38,7 @@ static int hf_atmtcp_vpi = -1;
static int hf_atmtcp_vci = -1;
static int hf_atmtcp_length = -1;
static guint global_atmtcp_tcp_port = 2812;
#define ATMTCP_TCP_PORT 2812
static gint ett_atmtcp = -1;
@ -104,9 +103,6 @@ dissect_atmtcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
void
proto_register_atmtcp(void)
{
module_t *atmtcp_module;
static hf_register_info hf[] = {
{ &hf_atmtcp_vpi,
{ "VPI", "atmtcp.vpi", FT_UINT16, BASE_DEC, NULL, 0x0,
@ -132,33 +128,17 @@ proto_register_atmtcp(void)
proto_register_field_array(proto_atmtcp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
atmtcp_module = prefs_register_protocol(proto_atmtcp, proto_reg_handoff_atmtcp);
prefs_register_uint_preference(atmtcp_module, "tcp.port", "ATMTCP TCP Port",
"ATMTCP TCP port if other than the default",
10, &global_atmtcp_tcp_port);
}
void
proto_reg_handoff_atmtcp(void)
{
static gboolean initialized = FALSE;
static dissector_handle_t atmtcp_handle;
static int current_port;
dissector_handle_t atmtcp_handle;
if (!initialized) {
atmtcp_handle = create_dissector_handle(dissect_atmtcp, proto_atmtcp);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", current_port, atmtcp_handle);
}
atmtcp_handle = create_dissector_handle(dissect_atmtcp, proto_atmtcp);
current_port = global_atmtcp_tcp_port;
dissector_add_uint("tcp.port", current_port, atmtcp_handle);
dissector_add_uint_with_preference("tcp.port", ATMTCP_TCP_PORT, atmtcp_handle);
}
/*

View File

@ -166,7 +166,7 @@ proto_reg_handoff_ax4000(void)
ax4000_handle = create_dissector_handle(dissect_ax4000,
proto_ax4000);
dissector_add_uint("ip.proto", IP_PROTO_AX4000, ax4000_handle);
dissector_add_uint("tcp.port", AX4000_TCP_PORT, ax4000_handle);
dissector_add_uint_with_preference("tcp.port", AX4000_TCP_PORT, ax4000_handle);
dissector_add_uint("udp.port", AX4000_UDP_PORT, ax4000_handle);
}

View File

@ -29,7 +29,6 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/expert.h>
void proto_register_banana(void);
@ -120,9 +119,6 @@ static const value_string pb_vals[] = {
#define MAX_ELEMENT_INT_LEN 4
#define MAX_ELEMENT_VAL_LEN 8
static range_t *global_banana_tcp_range = NULL;
static range_t *banana_tcp_range = NULL;
/* Dissect the packets */
static int
@ -256,14 +252,6 @@ dissect_banana(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
return tvb_reported_length(tvb);
}
static void
banana_prefs(void) {
dissector_delete_uint_range("tcp.port", banana_tcp_range, banana_handle);
g_free(banana_tcp_range);
banana_tcp_range = range_copy(global_banana_tcp_range);
dissector_add_uint_range("tcp.port", banana_tcp_range, banana_handle);
}
/* Register the protocol with Wireshark */
void
@ -312,7 +300,6 @@ proto_register_banana(void)
}
};
module_t *banana_module;
expert_module_t* expert_banana;
/* Setup protocol subtree array */
@ -337,17 +324,13 @@ proto_register_banana(void)
proto_register_subtree_array(ett, array_length(ett));
expert_banana = expert_register_protocol(proto_banana);
expert_register_field_array(expert_banana, ei, array_length(ei));
/* Initialize dissector preferences */
banana_module = prefs_register_protocol(proto_banana, banana_prefs);
banana_tcp_range = range_empty();
prefs_register_range_preference(banana_module, "tcp.port", "TCP Ports", "Banana TCP Port range", &global_banana_tcp_range, 65535);
}
void
proto_reg_handoff_banana(void)
{
banana_handle = create_dissector_handle(dissect_banana, proto_banana);
dissector_add_uint_range_with_preference("tcp.port", "", banana_handle);
}
/*

View File

@ -32,6 +32,7 @@
#include <stdlib.h>
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/prefs-int.h>
#include <epan/conversation.h>
#include <epan/expert.h>
#include <epan/proto_data.h>
@ -39,7 +40,7 @@
#include <wsutil/ws_printf.h> /* ws_debug_printf */
#endif
#define TCP_PORT_BEEP 10288
#define TCP_PORT_BEEP 10288 /* Don't think this is IANA registered */
void proto_register_beep(void);
void proto_reg_handoff_beep(void);
@ -889,6 +890,14 @@ dissect_beep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
return tvb_captured_length(tvb);
}
static void
apply_beep_prefs(void)
{
/* Beep uses the port preference to determine client/server */
pref_t *beep_port = prefs_find_preference(prefs_find_module("beep"), "tcp.port");
global_beep_tcp_port = *beep_port->varp.uint;
}
/* Register all the bits needed with the filtering engine */
void
@ -987,12 +996,7 @@ proto_register_beep(void)
/* Register our configuration options for BEEP, particularly our port */
beep_module = prefs_register_protocol(proto_beep, proto_reg_handoff_beep);
prefs_register_uint_preference(beep_module, "tcp.port", "BEEP TCP Port",
"Set the port for BEEP messages (if other"
" than the default of 10288)",
10, &global_beep_tcp_port);
beep_module = prefs_register_protocol(proto_beep, apply_beep_prefs);
prefs_register_bool_preference(beep_module, "strict_header_terminator",
"BEEP Header Requires CRLF",
@ -1005,28 +1009,11 @@ proto_register_beep(void)
void
proto_reg_handoff_beep(void)
{
static gboolean beep_prefs_initialized = FALSE;
static dissector_handle_t beep_handle;
static guint beep_tcp_port;
dissector_handle_t beep_handle;
if (!beep_prefs_initialized) {
beep_handle = create_dissector_handle(dissect_beep, proto_beep);
beep_handle = create_dissector_handle(dissect_beep, proto_beep);
beep_prefs_initialized = TRUE;
}
else {
dissector_delete_uint("tcp.port", beep_tcp_port, beep_handle);
}
/* Set our port number for future use */
beep_tcp_port = global_beep_tcp_port;
dissector_add_uint("tcp.port", global_beep_tcp_port, beep_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_BEEP, beep_handle);
}

View File

@ -4607,7 +4607,7 @@ proto_reg_handoff_ber(void)
/* allow the dissection of BER/DER carried over a TCP transport
by using "Decode As..." */
dissector_add_for_decode_as("tcp.port", ber_handle);
dissector_add_for_decode_as_with_preference("tcp.port", ber_handle);
ber_update_oids();
}

View File

@ -692,8 +692,7 @@ void proto_register_bfcp(void)
bfcp_handle = register_dissector("bfcp", dissect_bfcp, proto_bfcp);
bfcp_module = prefs_register_protocol(proto_bfcp,
proto_reg_handoff_bfcp);
bfcp_module = prefs_register_protocol(proto_bfcp, NULL);
prefs_register_obsolete_preference(bfcp_module, "enable");
@ -707,20 +706,14 @@ void proto_register_bfcp(void)
void proto_reg_handoff_bfcp(void)
{
static gboolean prefs_initialized = FALSE;
/* "Decode As" is always available;
* Heuristic dissection in disabled by default since
* the heuristic is quite weak.
*/
if (!prefs_initialized)
{
heur_dissector_add("tcp", dissect_bfcp_heur, "BFCP over TCP", "bfcp_tcp", proto_bfcp, HEURISTIC_DISABLE);
heur_dissector_add("udp", dissect_bfcp_heur, "BFCP over UDP", "bfcp_udp", proto_bfcp, HEURISTIC_DISABLE);
dissector_add_for_decode_as("tcp.port", bfcp_handle);
dissector_add_for_decode_as("udp.port", bfcp_handle);
prefs_initialized = TRUE;
}
heur_dissector_add("tcp", dissect_bfcp_heur, "BFCP over TCP", "bfcp_tcp", proto_bfcp, HEURISTIC_DISABLE);
heur_dissector_add("udp", dissect_bfcp_heur, "BFCP over UDP", "bfcp_udp", proto_bfcp, HEURISTIC_DISABLE);
dissector_add_for_decode_as_with_preference("tcp.port", bfcp_handle);
dissector_add_for_decode_as("udp.port", bfcp_handle);
}
/*

View File

@ -9537,7 +9537,7 @@ proto_register_bgp(void)
void
proto_reg_handoff_bgp(void)
{
dissector_add_uint("tcp.port", BGP_TCP_PORT, bgp_handle);
dissector_add_uint_with_preference("tcp.port", BGP_TCP_PORT, bgp_handle);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html

View File

@ -1878,7 +1878,7 @@ proto_reg_handoff_bitcoin(void)
{
dissector_handle_t command_handle;
dissector_add_for_decode_as("tcp.port", bitcoin_handle);
dissector_add_for_decode_as_with_preference("tcp.port", bitcoin_handle);
heur_dissector_add( "tcp", dissect_bitcoin_heur, "Bitcoin over TCP", "bitcoin_tcp", hfi_bitcoin->id, HEURISTIC_ENABLE);

View File

@ -42,6 +42,8 @@ void proto_reg_handoff_bittorrent(void);
* http://bitconjurer.org/BitTorrent/protocol.html
*/
#define DEFAULT_TCP_PORT_RANGE "6881-6889" /* Not IANA registered */
#define BITTORRENT_MESSAGE_CHOKE 0
#define BITTORRENT_MESSAGE_UNCHOKE 1
#define BITTORRENT_MESSAGE_INTERESTED 2
@ -697,17 +699,8 @@ proto_reg_handoff_bittorrent(void)
bencode_handle = find_dissector_add_dependency("bencode", proto_bittorrent);
dissector_handle = find_dissector("bittorrent.tcp");
#if 0
dissector_add_uint("tcp.port", 6881, dissector_handle);
dissector_add_uint("tcp.port", 6882, dissector_handle);
dissector_add_uint("tcp.port", 6883, dissector_handle);
dissector_add_uint("tcp.port", 6884, dissector_handle);
dissector_add_uint("tcp.port", 6885, dissector_handle);
dissector_add_uint("tcp.port", 6886, dissector_handle);
dissector_add_uint("tcp.port", 6887, dissector_handle);
dissector_add_uint("tcp.port", 6888, dissector_handle);
dissector_add_uint("tcp.port", 6889, dissector_handle);
#endif
dissector_add_uint_range_with_preference("tcp.port", DEFAULT_TCP_PORT_RANGE, dissector_handle);
heur_dissector_add("tcp", test_bittorrent_packet, "BitTorrent over TCP", "bittorrent_tcp", proto_bittorrent, HEURISTIC_ENABLE);
}

View File

@ -810,7 +810,7 @@ proto_reg_handoff_bmp(void)
static dissector_handle_t bmp_handle;
bmp_handle = create_dissector_handle(dissect_bmp, proto_bmp);
dissector_add_for_decode_as("tcp.port", bmp_handle);
dissector_add_for_decode_as_with_preference("tcp.port", bmp_handle);
dissector_bgp = find_dissector_add_dependency("bgp", proto_bmp);
}
/*

View File

@ -324,7 +324,7 @@ proto_reg_handoff_bzr(void)
bencode_handle = find_dissector_add_dependency("bencode", proto_bzr);
bzr_handle = find_dissector("bzr");
dissector_add_uint("tcp.port", TCP_PORT_BZR, bzr_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_BZR, bzr_handle);
}
/*

View File

@ -2058,7 +2058,7 @@ proto_reg_handoff_c1222(void)
if( !initialized ) {
c1222_handle = create_dissector_handle(dissect_c1222, proto_c1222);
c1222_udp_handle = create_dissector_handle(dissect_c1222_common, proto_c1222);
dissector_add_uint("tcp.port", global_c1222_port, c1222_handle);
dissector_add_uint_with_preference("tcp.port", C1222_PORT, c1222_handle);
dissector_add_uint("udp.port", global_c1222_port, c1222_udp_handle);
initialized = TRUE;
}

View File

@ -29,7 +29,7 @@
#include "packet-tcp.h"
#define TCP_PORT_CAST 4224
#define TCP_PORT_CAST 4224 /* Not IANA registered */
void proto_register_cast(void);
void proto_reg_handoff_cast(void);
@ -1709,7 +1709,7 @@ proto_reg_handoff_cast(void)
dissector_handle_t cast_handle;
cast_handle = create_dissector_handle(dissect_cast, proto_cast);
dissector_add_uint("tcp.port", TCP_PORT_CAST, cast_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_CAST, cast_handle);
}
/*

View File

@ -94,7 +94,7 @@ proto_reg_handoff_chargen(void)
chargen_handle = create_dissector_handle(dissect_chargen, proto_chargen);
dissector_add_uint("udp.port", CHARGEN_PORT_UDP, chargen_handle);
dissector_add_uint("tcp.port", CHARGEN_PORT_TCP, chargen_handle);
dissector_add_uint_with_preference("tcp.port", CHARGEN_PORT_TCP, chargen_handle);
}
/*

View File

@ -12041,7 +12041,7 @@ proto_reg_handoff_cigi(void)
cigi_handle = create_dissector_handle(dissect_cigi, proto_cigi);
dissector_add_for_decode_as("udp.port", cigi_handle);
dissector_add_for_decode_as("tcp.port", cigi_handle);
dissector_add_for_decode_as_with_preference("tcp.port", cigi_handle);
heur_dissector_add("udp", dissect_cigi_heur, "CIGI over UDP", "cigi_udp", proto_cigi, HEURISTIC_ENABLE);
inited = TRUE;

View File

@ -1168,7 +1168,7 @@ proto_reg_handoff_cimd(void)
* Also register as one that can be selected by a TCP port number.
*/
cimd_handle = create_dissector_handle(dissect_cimd, proto_cimd);
dissector_add_for_decode_as("tcp.port", cimd_handle);
dissector_add_for_decode_as_with_preference("tcp.port", cimd_handle);
}
/*

View File

@ -704,7 +704,7 @@ proto_reg_handoff_classicstun(void)
classicstun_handle = find_dissector("classicstun");
dissector_add_uint("tcp.port", TCP_PORT_STUN, classicstun_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_STUN, classicstun_handle);
dissector_add_uint("udp.port", UDP_PORT_STUN, classicstun_handle);
#endif
heur_dissector_add("udp", dissect_classicstun_heur, "Classic STUN over UDP", "classicstun_udp", proto_classicstun, HEURISTIC_ENABLE);

View File

@ -58,7 +58,6 @@ void proto_register_cmp(void);
/* desegmentation of CMP over TCP */
static gboolean cmp_desegment = TRUE;
static guint cmp_alternate_tcp_port = 0;
static guint cmp_alternate_http_port = 0;
static guint cmp_alternate_tcp_style_http_port = 0;
@ -235,7 +234,7 @@ static int hf_cmp_PKIFailureInfo_systemFailure = -1;
static int hf_cmp_PKIFailureInfo_duplicateCertReq = -1;
/*--- End of included file: packet-cmp-hf.c ---*/
#line 68 "./asn1/cmp/packet-cmp-template.c"
#line 67 "./asn1/cmp/packet-cmp-template.c"
/* Initialize the subtree pointers */
static gint ett_cmp = -1;
@ -291,7 +290,7 @@ static gint ett_cmp_PollRepContent = -1;
static gint ett_cmp_PollRepContent_item = -1;
/*--- End of included file: packet-cmp-ett.c ---*/
#line 72 "./asn1/cmp/packet-cmp-template.c"
#line 71 "./asn1/cmp/packet-cmp-template.c"
/*--- Included file: packet-cmp-fn.c ---*/
#line 1 "./asn1/cmp/packet-cmp-fn.c"
@ -1483,7 +1482,7 @@ static int dissect_SuppLangTagsValue_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _
/*--- End of included file: packet-cmp-fn.c ---*/
#line 73 "./asn1/cmp/packet-cmp-template.c"
#line 72 "./asn1/cmp/packet-cmp-template.c"
static int
dissect_cmp_pdu(tvbuff_t *tvb, proto_tree *tree, asn1_ctx_t *actx)
@ -2368,7 +2367,7 @@ void proto_register_cmp(void) {
NULL, HFILL }},
/*--- End of included file: packet-cmp-hfarr.c ---*/
#line 325 "./asn1/cmp/packet-cmp-template.c"
#line 324 "./asn1/cmp/packet-cmp-template.c"
};
/* List of subtrees */
@ -2426,7 +2425,7 @@ void proto_register_cmp(void) {
&ett_cmp_PollRepContent_item,
/*--- End of included file: packet-cmp-ettarr.c ---*/
#line 331 "./asn1/cmp/packet-cmp-template.c"
#line 330 "./asn1/cmp/packet-cmp-template.c"
};
module_t *cmp_module;
@ -2444,12 +2443,6 @@ void proto_register_cmp(void) {
"To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&cmp_desegment);
prefs_register_uint_preference(cmp_module, "tcp_alternate_port",
"Alternate TCP port",
"Decode this TCP port\'s traffic as CMP. Set to \"0\" to disable.",
10,
&cmp_alternate_tcp_port);
prefs_register_uint_preference(cmp_module, "http_alternate_port",
"Alternate HTTP port",
"Decode this TCP port\'s traffic as CMP-over-HTTP. Set to \"0\" to disable. "
@ -2472,7 +2465,6 @@ void proto_reg_handoff_cmp(void) {
static dissector_handle_t cmp_http_handle;
static dissector_handle_t cmp_tcp_style_http_handle;
static dissector_handle_t cmp_tcp_handle;
static guint cmp_alternate_tcp_port_prev = 0;
static guint cmp_alternate_http_port_prev = 0;
static guint cmp_alternate_tcp_style_http_port_prev = 0;
@ -2486,7 +2478,7 @@ void proto_reg_handoff_cmp(void) {
dissector_add_string("media_type", "application/x-pkixcmp-poll", cmp_tcp_style_http_handle);
cmp_tcp_handle = create_dissector_handle(dissect_cmp_tcp, proto_cmp);
dissector_add_uint("tcp.port", TCP_PORT_CMP, cmp_tcp_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_CMP, cmp_tcp_handle);
oid_add_from_string("Cryptlib-presence-check","1.3.6.1.4.1.3029.3.1.1");
oid_add_from_string("Cryptlib-PKIBoot","1.3.6.1.4.1.3029.3.1.2");
@ -2518,24 +2510,14 @@ void proto_reg_handoff_cmp(void) {
/*--- End of included file: packet-cmp-dis-tab.c ---*/
#line 401 "./asn1/cmp/packet-cmp-template.c"
#line 393 "./asn1/cmp/packet-cmp-template.c"
inited = TRUE;
}
/* change alternate TCP port if changed in the preferences */
if (cmp_alternate_tcp_port != cmp_alternate_tcp_port_prev) {
if (cmp_alternate_tcp_port_prev != 0)
dissector_delete_uint("tcp.port", cmp_alternate_tcp_port_prev, cmp_tcp_handle);
if (cmp_alternate_tcp_port != 0)
dissector_add_uint("tcp.port", cmp_alternate_tcp_port, cmp_tcp_handle);
cmp_alternate_tcp_port_prev = cmp_alternate_tcp_port;
}
/* change alternate HTTP port if changed in the preferences */
if (cmp_alternate_http_port != cmp_alternate_http_port_prev) {
if (cmp_alternate_http_port_prev != 0) {
dissector_delete_uint("tcp.port", cmp_alternate_http_port_prev, NULL);
dissector_delete_uint("http.port", cmp_alternate_http_port_prev, NULL);
http_tcp_dissector_delete(cmp_alternate_http_port_prev);
}
if (cmp_alternate_http_port != 0)
http_tcp_dissector_add( cmp_alternate_http_port, cmp_http_handle);
@ -2545,8 +2527,7 @@ void proto_reg_handoff_cmp(void) {
/* change alternate TCP-style-HTTP port if changed in the preferences */
if (cmp_alternate_tcp_style_http_port != cmp_alternate_tcp_style_http_port_prev) {
if (cmp_alternate_tcp_style_http_port_prev != 0) {
dissector_delete_uint("tcp.port", cmp_alternate_tcp_style_http_port_prev, NULL);
dissector_delete_uint("http.port", cmp_alternate_tcp_style_http_port_prev, NULL);
http_tcp_dissector_delete(cmp_alternate_tcp_style_http_port_prev);
}
if (cmp_alternate_tcp_style_http_port != 0)
http_tcp_dissector_add( cmp_alternate_tcp_style_http_port, cmp_tcp_style_http_handle);

View File

@ -30,10 +30,7 @@
#define CMPP_DELIVER_REPORT_LEN 71
/* These are not registered with IANA */
#define CMPP_SP_LONG_PORT 7890
#define CMPP_SP_SHORT_PORT 7900
#define CMPP_ISMG_LONG_PORT 7930
#define CMPP_ISMG_SHORT_PORT 9168
#define CMPP_PORT_RANGE "7890,7900,7930,9168"
void proto_register_cmpp(void);
void proto_reg_handoff_cmpp(void);
@ -977,10 +974,7 @@ proto_reg_handoff_cmpp(void)
dissector_handle_t cmpp_handle;
cmpp_handle = create_dissector_handle(dissect_cmpp, proto_cmpp);
dissector_add_uint("tcp.port", CMPP_SP_LONG_PORT, cmpp_handle);
dissector_add_uint("tcp.port", CMPP_SP_SHORT_PORT, cmpp_handle);
dissector_add_uint("tcp.port", CMPP_ISMG_LONG_PORT, cmpp_handle);
dissector_add_uint("tcp.port", CMPP_ISMG_SHORT_PORT, cmpp_handle);
dissector_add_uint_range_with_preference("tcp.port", CMPP_PORT_RANGE, cmpp_handle);
}
/*

View File

@ -90,7 +90,7 @@ static expert_field ei_coap_invalid_option_number = EI_INIT;
static expert_field ei_coap_invalid_option_range = EI_INIT;
static expert_field ei_coap_option_length_bad = EI_INIT;
/* CoAP's IANA-assigned port number */
/* CoAP's IANA-assigned port (UDP only) number */
#define DEFAULT_COAP_PORT 5683
/* indicators whether those are to be showed or not */
@ -1274,15 +1274,14 @@ proto_reg_handoff_coap(void)
if (!coap_prefs_initialized) {
coap_handle = find_dissector("coap");
media_type_dissector_table = find_dissector_table("media_type");
dissector_add_uint_with_preference("tcp.port", DEFAULT_COAP_PORT, coap_handle);
coap_prefs_initialized = TRUE;
} else {
dissector_delete_uint("udp.port", coap_port_number, coap_handle);
dissector_delete_uint("tcp.port", coap_port_number, coap_handle);
}
coap_port_number = global_coap_port_number;
dissector_add_uint("udp.port", coap_port_number, coap_handle);
dissector_add_uint("tcp.port", coap_port_number, coap_handle);
}
/*

View File

@ -72,9 +72,6 @@
void proto_register_cops(void);
/* Preference: Variable to hold the tcp port preference */
static guint global_cops_tcp_port = TCP_PORT_COPS;
/* Preference: desegmentation of COPS */
static gboolean cops_desegment = TRUE;
@ -2814,8 +2811,7 @@ void proto_register_cops(void)
expert_module_t* expert_cops;
/* Register the protocol name and description */
proto_cops = proto_register_protocol("Common Open Policy Service",
"COPS", "cops");
proto_cops = proto_register_protocol("Common Open Policy Service", "COPS", "cops");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_cops, hf, array_length(hf));
@ -2827,11 +2823,7 @@ void proto_register_cops(void)
register_dissector("cops", dissect_cops, proto_cops);
/* Register our configuration options for cops */
cops_module = prefs_register_protocol(proto_cops, proto_reg_handoff_cops);
prefs_register_uint_preference(cops_module,"tcp.cops_port",
"COPS TCP Port",
"Set the TCP port for COPS messages",
10,&global_cops_tcp_port);
cops_module = prefs_register_protocol(proto_cops, NULL);
prefs_register_bool_preference(cops_module, "desegment",
"Reassemble COPS messages spanning multiple TCP segments",
"Whether the COPS dissector should reassemble messages spanning multiple TCP segments."
@ -2853,21 +2845,15 @@ void proto_register_cops(void)
void proto_reg_handoff_cops(void)
{
static gboolean cops_prefs_initialized = FALSE;
static dissector_handle_t cops_handle;
static guint cops_tcp_port;
dissector_handle_t cops_handle;
if (!cops_prefs_initialized) {
cops_handle = find_dissector("cops");
dissector_add_uint("tcp.port", TCP_PORT_PKTCABLE_COPS, cops_handle);
dissector_add_uint("tcp.port", TCP_PORT_PKTCABLE_MM_COPS, cops_handle);
cops_prefs_initialized = TRUE;
} else {
dissector_delete_uint("tcp.port",cops_tcp_port,cops_handle);
}
cops_tcp_port = global_cops_tcp_port;
cops_handle = find_dissector("cops");
/* These could use a separate "preference name" (to avoid collision),
but they are IANA registered and users could still use Decode As */
dissector_add_uint("tcp.port", TCP_PORT_PKTCABLE_COPS, cops_handle);
dissector_add_uint("tcp.port", TCP_PORT_PKTCABLE_MM_COPS, cops_handle);
dissector_add_uint("tcp.port", cops_tcp_port, cops_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_COPS, cops_handle);
}

View File

@ -623,10 +623,6 @@ static const int * subdoc_flags[] = {
static dissector_handle_t couchbase_tcp_handle;
static dissector_handle_t json_handle;
/* couchbase ports */
static range_t *couchbase_tcp_port_range;
/* desegmentation of COUCHBASE payload */
static gboolean couchbase_desegment_body = TRUE;
@ -1883,9 +1879,6 @@ proto_register_couchbase(void)
expert_couchbase = expert_register_protocol(proto_couchbase);
expert_register_field_array(expert_couchbase, ei, array_length(ei));
/* Set default port range */
range_convert_str(&couchbase_tcp_port_range, COUCHBASE_DEFAULT_PORT, MAX_TCP_PORT);
/* Register our configuration options */
couchbase_module = prefs_register_protocol(proto_couchbase, NULL);
@ -1896,31 +1889,15 @@ proto_register_couchbase(void)
" To use this option, you must also enable \"Allow subdissectors"
" to reassemble TCP streams\" in the TCP protocol settings.",
&couchbase_desegment_body);
prefs_register_range_preference(couchbase_module, "tcp.ports", "Couchbase TCP ports",
"TCP ports to be decoded as Couchbase (default is "
COUCHBASE_DEFAULT_PORT ")",
&couchbase_tcp_port_range, MAX_TCP_PORT);
}
/* Register the tcp couchbase dissector. */
void
proto_reg_handoff_couchbase(void)
{
static range_t *tcp_port_range;
static gboolean initialized = FALSE;
couchbase_tcp_handle = create_dissector_handle(dissect_couchbase_tcp, proto_couchbase);
if (initialized == FALSE) {
couchbase_tcp_handle = create_dissector_handle(dissect_couchbase_tcp, proto_couchbase);
initialized = TRUE;
}
else {
dissector_delete_uint_range("tcp.port", tcp_port_range, couchbase_tcp_handle);
g_free(tcp_port_range);
}
tcp_port_range = range_copy(couchbase_tcp_port_range);
dissector_add_uint_range("tcp.port", tcp_port_range, couchbase_tcp_handle);
dissector_add_uint_range_with_preference("tcp.port", COUCHBASE_DEFAULT_PORT, couchbase_tcp_handle);
json_handle = find_dissector_add_dependency("json", proto_couchbase);
}

View File

@ -120,7 +120,6 @@ void proto_register_cp2179(void);
#define SBO_OPERATE_REPLY_LEN 9
#define SBO_SELECT_REPLY_LEN 10
#define PORT_CP2179 0
static gboolean cp2179_telnet_clean = TRUE;
@ -206,8 +205,6 @@ typedef struct {
static int proto_cp2179 = -1;
static guint global_cp2179_tcp_port = PORT_CP2179; /* Port 0 (by default), adjustable by user prefs */
/* Initialize the subtree pointers */
static gint ett_cp2179 = -1;
static gint ett_cp2179_header = -1;
@ -1362,13 +1359,7 @@ proto_register_cp2179(void)
proto_register_subtree_array(ett, array_length(ett));
/* Register required preferences for CP2179 Encapsulated-over-TCP decoding */
cp2179_module = prefs_register_protocol(proto_cp2179, proto_reg_handoff_cp2179);
/* Default TCP Port, allows for "user" port either than 0. */
prefs_register_uint_preference(cp2179_module, "tcp.port", "CP 2179 Protocol Port",
"Set the TCP port for CP 2179 Protocol packets (if other"
" than the default of 0)",
10, &global_cp2179_tcp_port);
cp2179_module = prefs_register_protocol(proto_cp2179, NULL);
/* Telnet protocol IAC (0xFF) processing; defaults to TRUE to allow Telnet Encapsulated Data */
prefs_register_bool_preference(cp2179_module, "telnetclean",
@ -1383,19 +1374,7 @@ proto_register_cp2179(void)
void
proto_reg_handoff_cp2179(void)
{
static int cp2179_prefs_initialized = FALSE;
static unsigned int cp2179_port;
if (!cp2179_prefs_initialized){
cp2179_prefs_initialized = TRUE;
}
else {
dissector_delete_uint("tcp.port", cp2179_port, cp2179_handle);
}
cp2179_port = global_cp2179_tcp_port;
dissector_add_uint("tcp.port", cp2179_port, cp2179_handle);
dissector_add_for_decode_as_with_preference("tcp.port", cp2179_handle);
dissector_add_for_decode_as("rtacser.data", cp2179_handle);
}

View File

@ -32,7 +32,7 @@
#include <epan/expert.h>
#define CQL_DEFAULT_PORT 9042
#define CQL_DEFAULT_PORT 9042 /* Not IANA registered */
void proto_reg_handoff_cql(void);
@ -931,7 +931,7 @@ proto_reg_handoff_cql(void)
static dissector_handle_t cql_handle;
cql_handle = create_dissector_handle(dissect_cql_tcp, proto_cql);
dissector_add_uint("tcp.port", CQL_DEFAULT_PORT, cql_handle);
dissector_add_uint_with_preference("tcp.port", CQL_DEFAULT_PORT, cql_handle);
}

View File

@ -1241,7 +1241,7 @@ proto_reg_handoff_ctdb(void)
dissector_handle_t ctdb_handle;
ctdb_handle = create_dissector_handle(dissect_ctdb, proto_ctdb);
dissector_add_for_decode_as("tcp.port", ctdb_handle);
dissector_add_for_decode_as_with_preference("tcp.port", ctdb_handle);
heur_dissector_add("tcp", dissect_ctdb, "Cluster TDB over TCP", "ctdb_tcp", proto_ctdb, HEURISTIC_ENABLE);
}

View File

@ -106,7 +106,7 @@ void
proto_reg_handoff_daytime(void)
{
dissector_add_uint("udp.port", DAYTIME_PORT, daytime_handle);
dissector_add_uint("tcp.port", DAYTIME_PORT, daytime_handle);
dissector_add_uint_with_preference("tcp.port", DAYTIME_PORT, daytime_handle);
}
/*

View File

@ -271,7 +271,7 @@ proto_reg_handoff_db_lsp (void)
db_lsp_tcp_handle = find_dissector ("db-lsp.tcp");
db_lsp_udp_handle = find_dissector ("db-lsp.udp");
dissector_add_uint ("tcp.port", DB_LSP_PORT, db_lsp_tcp_handle);
dissector_add_uint_with_preference("tcp.port", DB_LSP_PORT, db_lsp_tcp_handle);
dissector_add_uint ("udp.port", DB_LSP_PORT, db_lsp_udp_handle);
}

View File

@ -716,7 +716,7 @@ void
proto_reg_handoff_dbus(void)
{
dissector_add_uint("wtap_encap", WTAP_ENCAP_DBUS, dbus_handle);
dissector_add_for_decode_as("tcp.port", dbus_handle_tcp);
dissector_add_for_decode_as_with_preference("tcp.port", dbus_handle_tcp);
}
/*

View File

@ -239,9 +239,6 @@ void proto_reg_handoff_dcm(void);
#define MAX_BUF_LEN 1024 /* Used for string allocations */
static range_t *global_dcm_tcp_range = NULL;
static range_t *global_dcm_tcp_range_backup = NULL; /* needed to deregister */
static gboolean global_dcm_export_header = TRUE;
static guint global_dcm_export_minsize = 4096; /* Filter small objects in export */
@ -7071,25 +7068,6 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 off
return offset; /* return the number of processed bytes */
}
static void
dcm_apply_settings(void)
{
/* deregister first */
dissector_delete_uint_range("tcp.port", global_dcm_tcp_range_backup, dcm_handle);
g_free(global_dcm_tcp_range_backup);
/* Register 'static' tcp port range specified in properties
Statically defined ports take precedence over a heuristic one,
I.e., if an foreign protocol claims a port, where dicom is running on
We would never be called, by just having the heuristic registration
*/
dissector_add_uint_range("tcp.port", global_dcm_tcp_range, dcm_handle);
/* remember settings for next time */
global_dcm_tcp_range_backup = range_copy(global_dcm_tcp_range);
}
/* Register the protocol with Wireshark */
void
@ -7295,12 +7273,7 @@ proto_register_dcm(void)
/* Allow other dissectors to find this one by name. */
dcm_handle = register_dissector("dicom", dissect_dcm_static, proto_dcm);
dcm_module = prefs_register_protocol(proto_dcm, dcm_apply_settings);
range_convert_str(&global_dcm_tcp_range, DICOM_DEFAULT_RANGE, 65535);
global_dcm_tcp_range_backup = range_empty();
prefs_register_range_preference(dcm_module, "tcp.port",
"DICOM Ports", "DICOM Ports range", &global_dcm_tcp_range, 65535);
dcm_module = prefs_register_protocol(proto_dcm, NULL);
prefs_register_obsolete_preference(dcm_module, "heuristic");
@ -7352,8 +7325,12 @@ proto_register_dcm(void)
void
proto_reg_handoff_dcm(void)
{
dcm_apply_settings(); /* Register static ports */
/* Register 'static' tcp port range specified in properties
Statically defined ports take precedence over a heuristic one,
I.e., if an foreign protocol claims a port, where dicom is running on
We would never be called, by just having the heuristic registration
*/
dissector_add_uint_range_with_preference("tcp.port", DICOM_DEFAULT_RANGE, dcm_handle);
heur_dissector_add("tcp", dissect_dcm_heuristic, "DICOM over TCP", "dicom_tcp", proto_dcm, HEURISTIC_DISABLE);
}

View File

@ -44,13 +44,11 @@
#include "packet-arp.h"
#include "packet-tcp.h"
#define TCP_PORT_DHCPFO 519
#define TCP_PORT_DHCPFO 519 /* Not IANA registered */
void proto_register_dhcpfo(void);
void proto_reg_handoff_dhcpfo(void);
static guint tcp_port_pref = TCP_PORT_DHCPFO;
/* desegmentation of DHCP failover over TCP */
static gboolean dhcpfo_desegment = TRUE;
@ -1132,8 +1130,7 @@ proto_register_dhcpfo(void)
expert_module_t* expert_dhcpfo;
/* Register the protocol name and description */
proto_dhcpfo = proto_register_protocol("DHCP Failover", "DHCPFO",
"dhcpfo");
proto_dhcpfo = proto_register_protocol("DHCP Failover", "DHCPFO", "dhcpfo");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_dhcpfo, hf, array_length(hf));
@ -1141,10 +1138,8 @@ proto_register_dhcpfo(void)
expert_dhcpfo = expert_register_protocol(proto_dhcpfo);
expert_register_field_array(expert_dhcpfo, ei, array_length(ei));
dhcpfo_module = prefs_register_protocol(proto_dhcpfo, proto_reg_handoff_dhcpfo);
prefs_register_uint_preference(dhcpfo_module, "tcp_port",
"DHCP failover TCP Port", "Set the port for DHCP failover communications",
10, &tcp_port_pref);
dhcpfo_module = prefs_register_protocol(proto_dhcpfo, NULL);
prefs_register_bool_preference(dhcpfo_module, "desegment",
"Reassemble DHCP failover messages spanning multiple TCP segments",
"Whether the DHCP failover dissector should reassemble messages spanning multiple TCP segments."
@ -1155,18 +1150,10 @@ proto_register_dhcpfo(void)
void
proto_reg_handoff_dhcpfo(void)
{
static gboolean initialized = FALSE;
static dissector_handle_t dhcpfo_handle;
static guint saved_tcp_port;
dissector_handle_t dhcpfo_handle;
if (!initialized) {
dhcpfo_handle = create_dissector_handle(dissect_dhcpfo, proto_dhcpfo);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", saved_tcp_port, dhcpfo_handle);
}
dissector_add_uint("tcp.port", tcp_port_pref, dhcpfo_handle);
saved_tcp_port = tcp_port_pref;
dhcpfo_handle = create_dissector_handle(dissect_dhcpfo, proto_dhcpfo);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_DHCPFO, dhcpfo_handle);
}
/*

View File

@ -2464,7 +2464,7 @@ proto_reg_handoff_dhcpv6(void)
dhcpv6_bulkquery_handle = create_dissector_handle(dissect_dhcpv6_bulk_leasequery,
proto_dhcpv6_bulk_leasequery);
dissector_add_uint("tcp.port", UDP_PORT_DHCPV6_UPSTREAM, dhcpv6_bulkquery_handle);
dissector_add_uint_with_preference("tcp.port", UDP_PORT_DHCPV6_UPSTREAM, dhcpv6_bulkquery_handle);
}
/*

View File

@ -302,7 +302,6 @@ static int diameter_tap = -1;
static dissector_handle_t diameter_udp_handle;
static dissector_handle_t diameter_tcp_handle;
static dissector_handle_t diameter_sctp_handle;
static range_t *global_diameter_tcp_port_range;
static range_t *global_diameter_sctp_port_range;
static range_t *global_diameter_udp_port_range;
/* This is used for TCP and SCTP */
@ -2334,7 +2333,6 @@ proto_register_diameter(void)
diameter_expr_result_vnd_table = register_dissector_table("diameter.vnd_exp_res", "DIAMETER Experimental-Result-Code", proto_diameter, FT_UINT32, BASE_DEC);
/* Set default TCP ports */
range_convert_str(&global_diameter_tcp_port_range, DEFAULT_DIAMETER_PORT_RANGE, MAX_UDP_PORT);
range_convert_str(&global_diameter_sctp_port_range, DEFAULT_DIAMETER_PORT_RANGE, MAX_SCTP_PORT);
range_convert_str(&global_diameter_udp_port_range, "", MAX_UDP_PORT);
@ -2342,11 +2340,6 @@ proto_register_diameter(void)
diameter_module = prefs_register_protocol(proto_diameter,
proto_reg_handoff_diameter);
prefs_register_range_preference(diameter_module, "tcp.ports", "Diameter TCP ports",
"TCP ports to be decoded as Diameter (default: "
DEFAULT_DIAMETER_PORT_RANGE ")",
&global_diameter_tcp_port_range, MAX_UDP_PORT);
prefs_register_range_preference(diameter_module, "sctp.ports",
"Diameter SCTP Ports",
"SCTP ports to be decoded as Diameter (default: "
@ -2369,7 +2362,6 @@ proto_register_diameter(void)
* them as obsolete rather than just illegal.
*/
prefs_register_obsolete_preference(diameter_module, "version");
prefs_register_obsolete_preference(diameter_module, "tcp.port");
prefs_register_obsolete_preference(diameter_module, "sctp.port");
prefs_register_obsolete_preference(diameter_module, "command_in_header");
prefs_register_obsolete_preference(diameter_module, "dictionary.name");
@ -2388,7 +2380,6 @@ void
proto_reg_handoff_diameter(void)
{
static gboolean Initialized=FALSE;
static range_t *diameter_tcp_port_range;
static range_t *diameter_sctp_port_range;
static range_t *diameter_udp_port_range;
@ -2435,19 +2426,16 @@ proto_reg_handoff_diameter(void)
Initialized=TRUE;
} else {
dissector_delete_uint_range("tcp.port", diameter_tcp_port_range, diameter_tcp_handle);
dissector_delete_uint_range("sctp.port", diameter_sctp_port_range, diameter_sctp_handle);
dissector_delete_uint_range("udp.port", diameter_udp_port_range, diameter_udp_handle);
g_free(diameter_tcp_port_range);
g_free(diameter_sctp_port_range);
g_free(diameter_udp_port_range);
}
/* set port for future deletes */
diameter_tcp_port_range = range_copy(global_diameter_tcp_port_range);
diameter_sctp_port_range = range_copy(global_diameter_sctp_port_range);
diameter_udp_port_range = range_copy(global_diameter_udp_port_range);
dissector_add_uint_range("tcp.port", diameter_tcp_port_range, diameter_tcp_handle);
dissector_add_uint_range_with_preference("tcp.port", DEFAULT_DIAMETER_PORT_RANGE, diameter_tcp_handle);
dissector_add_uint_range("sctp.port", diameter_sctp_port_range, diameter_sctp_handle);
dissector_add_uint_range("udp.port", diameter_udp_port_range, diameter_udp_handle);

View File

@ -53,8 +53,6 @@ static gboolean distcc_desegment = TRUE;
#define TCP_PORT_DISTCC 3632
static guint glb_distcc_tcp_port = TCP_PORT_DISTCC;
void proto_register_distcc(void);
extern void proto_reg_handoff_distcc(void);
@ -366,13 +364,8 @@ proto_register_distcc(void)
expert_distcc = expert_register_protocol(proto_distcc);
expert_register_field_array(expert_distcc, ei, array_length(ei));
distcc_module = prefs_register_protocol(proto_distcc,
proto_reg_handoff_distcc);
prefs_register_uint_preference(distcc_module, "tcp.port",
"DISTCC TCP Port",
"Set the TCP port for DISTCC messages",
10,
&glb_distcc_tcp_port);
distcc_module = prefs_register_protocol(proto_distcc, NULL);
prefs_register_bool_preference(distcc_module, "desegment_distcc_over_tcp",
"Reassemble DISTCC-over-TCP messages\nspanning multiple TCP segments",
"Whether the DISTCC dissector should reassemble messages spanning multiple TCP segments."
@ -383,28 +376,10 @@ proto_register_distcc(void)
void
proto_reg_handoff_distcc(void)
{
static gboolean registered_dissector = FALSE;
static int distcc_tcp_port;
static dissector_handle_t distcc_handle;
dissector_handle_t distcc_handle;
if (!registered_dissector) {
/*
* We haven't registered the dissector yet; get a handle
* for it.
*/
distcc_handle = create_dissector_handle(dissect_distcc,
proto_distcc);
registered_dissector = TRUE;
} else {
/*
* We've registered the dissector with a TCP port number
* of "distcc_tcp_port"; we might be changing the TCP port
* number, so remove that registration.
*/
dissector_delete_uint("tcp.port", distcc_tcp_port, distcc_handle);
}
distcc_tcp_port = glb_distcc_tcp_port;
dissector_add_uint("tcp.port", distcc_tcp_port, distcc_handle);
distcc_handle = create_dissector_handle(dissect_distcc, proto_distcc);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_DISTCC, distcc_handle);
}
/*

View File

@ -90,7 +90,7 @@ static int hf_djiuav_response_time = -1;
#define PROTO_SHORT_NAME "DJIUAV"
#define PROTO_LONG_NAME "DJI UAV Drone Control Protocol"
#define PORT_DJIUAV 2001
#define PORT_DJIUAV 2001 /* Not IANA registered */
static const value_string djiuav_pdu_type[] = {
{ 0x20, "Set Time" },
@ -386,9 +386,8 @@ proto_reg_handoff_djiuav(void)
{
dissector_handle_t djiuav_handle;
djiuav_handle = create_dissector_handle(dissect_djiuav_static, proto_djiuav);
dissector_add_uint("tcp.port", PORT_DJIUAV, djiuav_handle);
dissector_add_uint_with_preference("tcp.port", PORT_DJIUAV, djiuav_handle);
}
/*

View File

@ -50,7 +50,7 @@
#define TCP_PORT_DLM3 21064
#define TCP_PORT_DLM3 21064 /* Not IANA registered */
#define SCTP_PORT_DLM3 TCP_PORT_DLM3
#define DLM3_MAJOR_VERSION 0x00030000
@ -351,7 +351,6 @@ static gint ett_dlm3_rl_name = -1;
/* configurable parameters */
static guint dlm3_tcp_port = TCP_PORT_DLM3;
static guint dlm3_sctp_port = SCTP_PORT_DLM3;
/*
@ -1552,11 +1551,6 @@ proto_register_dlm3(void)
dlm3_module = prefs_register_protocol(proto_dlm3,
proto_reg_handoff_dlm3);
prefs_register_uint_preference(dlm3_module, "tcp.port",
"DLM3 TCP Port",
"Set the TCP port for Distributed Lock Manager",
10,
&dlm3_tcp_port);
prefs_register_uint_preference(dlm3_module, "sctp.port",
"DLM3 SCTP Port",
"Set the SCTP port for Distributed Lock Manager",
@ -1570,7 +1564,6 @@ proto_reg_handoff_dlm3(void)
{
static gboolean dissector_registered = FALSE;
static guint tcp_port;
static guint sctp_port;
static dissector_handle_t dlm3_tcp_handle;
@ -1579,15 +1572,13 @@ proto_reg_handoff_dlm3(void)
if (!dissector_registered) {
dlm3_sctp_handle = create_dissector_handle(dissect_dlm3, proto_dlm3);
dlm3_tcp_handle = create_dissector_handle(dissect_dlm3, proto_dlm3);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_DLM3, dlm3_tcp_handle);
dissector_registered = TRUE;
} else {
dissector_delete_uint("tcp.port", tcp_port, dlm3_tcp_handle);
dissector_delete_uint("sctp.port", sctp_port, dlm3_sctp_handle);
}
tcp_port = dlm3_tcp_port;
sctp_port = dlm3_sctp_port;
dissector_add_uint("tcp.port", tcp_port, dlm3_tcp_handle);
dissector_add_uint("sctp.port", sctp_port, dlm3_sctp_handle);
}

View File

@ -689,7 +689,7 @@ proto_reg_handoff_dlsw(void)
dissector_add_uint("udp.port", UDP_PORT_DLSW, dlsw_udp_handle);
dlsw_tcp_handle = create_dissector_handle(dissect_dlsw_tcp, proto_dlsw);
dissector_add_uint("tcp.port", TCP_PORT_DLSW, dlsw_tcp_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_DLSW, dlsw_tcp_handle);
}
/*

View File

@ -4599,7 +4599,7 @@ proto_reg_handoff_dnp3(void)
dnp3_tcp_handle = create_dissector_handle(dissect_dnp3_tcp, proto_dnp3);
dnp3_udp_handle = create_dissector_handle(dissect_dnp3_udp, proto_dnp3);
dissector_add_uint("tcp.port", TCP_PORT_DNP, dnp3_tcp_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_DNP, dnp3_tcp_handle);
dissector_add_uint("udp.port", UDP_PORT_DNP, dnp3_udp_handle);
dissector_add_for_decode_as("rtacser.data", dnp3_udp_handle);
}

View File

@ -421,7 +421,6 @@ static dissector_table_t dns_tsig_dissector_table=NULL;
static dissector_handle_t dns_handle;
static range_t *global_dns_tcp_port_range;
static range_t *global_dns_udp_port_range;
/* desegmentation of DNS over TCP */
@ -448,9 +447,9 @@ typedef struct _dns_conv_info_t {
/* Ports used for DNS. */
#define DEFAULT_DNS_PORT_RANGE "53"
#define DEFAULT_DNS_TCP_PORT_RANGE "53,5353" /* Includes mDNS */
#define SCTP_PORT_DNS 53
#define UDP_PORT_MDNS 5353
#define TCP_PORT_MDNS 5353
#define UDP_PORT_LLMNR 5355
#define TCP_PORT_DNS_TLS 853
#define UDP_PORT_DNS_DTLS 853
@ -4079,7 +4078,6 @@ static int dns_stats_tree_packet(stats_tree* st, packet_info* pinfo _U_, epan_di
void
proto_reg_handoff_dns(void)
{
static range_t *dns_tcp_port_range;
static range_t *dns_udp_port_range;
static gboolean Initialized = FALSE;
@ -4091,7 +4089,6 @@ proto_reg_handoff_dns(void)
mdns_udp_handle = create_dissector_handle(dissect_mdns_udp, proto_mdns);
llmnr_udp_handle = create_dissector_handle(dissect_llmnr_udp, proto_llmnr);
dissector_add_uint("udp.port", UDP_PORT_MDNS, mdns_udp_handle);
dissector_add_uint("tcp.port", TCP_PORT_MDNS, dns_handle);
dissector_add_uint("udp.port", UDP_PORT_LLMNR, llmnr_udp_handle);
dissector_add_uint("sctp.port", SCTP_PORT_DNS, dns_handle);
#if 0
@ -4102,18 +4099,15 @@ proto_reg_handoff_dns(void)
ntlmssp_handle = find_dissector_add_dependency("ntlmssp", proto_dns);
ssl_dissector_add(TCP_PORT_DNS_TLS, dns_handle);
dtls_dissector_add(UDP_PORT_DNS_DTLS, dns_handle);
dissector_add_uint_range_with_preference("tcp.port", DEFAULT_DNS_TCP_PORT_RANGE, dns_handle);
Initialized = TRUE;
} else {
dissector_delete_uint_range("tcp.port", dns_tcp_port_range, dns_handle);
dissector_delete_uint_range("udp.port", dns_udp_port_range, dns_handle);
g_free(dns_tcp_port_range);
g_free(dns_udp_port_range);
}
dns_tcp_port_range = range_copy(global_dns_tcp_port_range);
dns_udp_port_range = range_copy(global_dns_udp_port_range);
dissector_add_uint_range("tcp.port", dns_tcp_port_range, dns_handle);
dissector_add_uint_range("udp.port", dns_udp_port_range, dns_handle);
}
@ -5578,16 +5572,10 @@ proto_register_dns(void)
expert_register_field_array(expert_dns, ei, array_length(ei));
/* Set default ports */
range_convert_str(&global_dns_tcp_port_range, DEFAULT_DNS_PORT_RANGE, MAX_TCP_PORT);
range_convert_str(&global_dns_udp_port_range, DEFAULT_DNS_PORT_RANGE, MAX_UDP_PORT);
dns_module = prefs_register_protocol(proto_dns, proto_reg_handoff_dns);
prefs_register_range_preference(dns_module, "tcp.ports", "DNS TCP ports",
"TCP ports to be decoded as DNS (default: "
DEFAULT_DNS_PORT_RANGE ")",
&global_dns_tcp_port_range, MAX_TCP_PORT);
prefs_register_range_preference(dns_module, "udp.ports", "DNS UDP ports",
"UDP ports to be decoded as DNS (default: "
DEFAULT_DNS_PORT_RANGE ")",

View File

@ -10594,7 +10594,7 @@ static void dof_tun_handoff(void)
tcp_handle = create_dissector_handle(dissect_tunnel_tcp, proto_2012_1_tunnel);
dissector_add_uint("tcp.port", DOF_TUN_NON_SEC_TCP_PORT, tcp_handle);
dissector_add_uint_with_preference("tcp.port", DOF_TUN_NON_SEC_TCP_PORT, tcp_handle);
}
/* Main DOF Registration Support */
@ -11050,7 +11050,7 @@ static void dof_handoff(void)
undissected_data_handle = find_dissector("data");
dissector_add_uint("tcp.port", DOF_P2P_NEG_SEC_TCP_PORT, tcp_handle);
dissector_add_uint_with_preference("tcp.port", DOF_P2P_NEG_SEC_TCP_PORT, tcp_handle);
dissector_add_uint("udp.port", DOF_P2P_NEG_SEC_UDP_PORT, dof_udp_handle);
dissector_add_uint("udp.port", DOF_MCAST_NEG_SEC_UDP_PORT, dof_udp_handle);
}

View File

@ -117,7 +117,7 @@ static gboolean dsi_desegment = TRUE;
static dissector_handle_t afp_handle;
static dissector_handle_t afp_server_status_handle;
#define TCP_PORT_DSI 548
#define TCP_PORT_DSI 548 /* Not IANA registered */
#define DSI_BLOCKSIZ 16
@ -478,7 +478,7 @@ proto_reg_handoff_dsi(void)
dissector_handle_t dsi_handle;
dsi_handle = create_dissector_handle(dissect_dsi, proto_dsi);
dissector_add_uint("tcp.port", TCP_PORT_DSI, dsi_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_DSI, dsi_handle);
afp_handle = find_dissector_add_dependency("afp", proto_dsi);
afp_server_status_handle = find_dissector_add_dependency("afp_server_status", proto_dsi);

View File

@ -41,12 +41,9 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/prefs.h>
static int proto_dtcp_ip = -1;
static guint pref_tcp_port = 0;
void proto_register_dtcp_ip(void);
void proto_reg_handoff_dtcp_ip(void);
@ -285,38 +282,21 @@ proto_register_dtcp_ip(void)
&ett_dtcp_ip_ake_procedure
};
module_t *dtcp_ip_module;
proto_dtcp_ip = proto_register_protocol(
"Digital Transmission Content Protection over IP",
"DTCP-IP", "dtcp-ip");
proto_register_field_array(proto_dtcp_ip, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
dtcp_ip_module = prefs_register_protocol(
proto_dtcp_ip, proto_reg_handoff_dtcp_ip);
prefs_register_uint_preference(dtcp_ip_module, "tcp.port",
"TCP port", "TCP port number for DTCP-IP", 10, &pref_tcp_port);
}
void
proto_reg_handoff_dtcp_ip(void)
{
static gboolean initialized = FALSE;
static dissector_handle_t dtcp_ip_handle = NULL;
static guint current_tcp_port = 0;
dissector_handle_t dtcp_ip_handle;
if (!initialized) {
dtcp_ip_handle =
create_dissector_handle(dissect_dtcp_ip, proto_dtcp_ip);
initialized = TRUE;
}
else
dissector_delete_uint("tcp.port", current_tcp_port, dtcp_ip_handle);
current_tcp_port = pref_tcp_port;
dissector_add_uint("tcp.port", current_tcp_port, dtcp_ip_handle);
dtcp_ip_handle = create_dissector_handle(dissect_dtcp_ip, proto_dtcp_ip);
dissector_add_for_decode_as_with_preference("tcp.port", dtcp_ip_handle);
}
/*

View File

@ -289,8 +289,8 @@ static expert_field ei_tcp_convergence_ack_length = EI_INIT;
static dissector_handle_t bundle_handle;
static guint bundle_tcp_port = 4556;
static guint bundle_udp_port = 4556;
#define BUNDLE_PORT 4556
static guint bundle_udp_port = BUNDLE_PORT;
typedef struct dictionary_data {
int bundle_header_dict_length;
@ -3058,12 +3058,6 @@ proto_register_bundle(void)
proto_tcp_conv = proto_register_protocol ("DTN TCP Convergence Layer Protocol", "TCPCL", "tcpcl");
prefs_register_uint_preference(bundle_module, "tcp.port",
"Bundle Protocol TCP Port",
"TCP Port to Accept Bundle Protocol Connections",
10,
&bundle_tcp_port);
prefs_register_uint_preference(bundle_module, "udp.port",
"Bundle Protocol UDP Port",
"UDP Port to Accept Bundle Protocol Connections",
@ -3088,22 +3082,19 @@ void
proto_reg_handoff_bundle(void)
{
static dissector_handle_t tcpcl_handle;
static guint tcp_port;
static guint udp_port;
static int Initialized = FALSE;
if (!Initialized) {
tcpcl_handle = create_dissector_handle(dissect_tcpcl, proto_bundle);
dissector_add_uint_with_preference("tcp.port", BUNDLE_PORT, tcpcl_handle);
Initialized = TRUE;
}
else {
dissector_delete_uint("tcp.port", tcp_port, tcpcl_handle);
dissector_delete_uint("udp.port", udp_port, bundle_handle);
}
tcp_port = bundle_tcp_port;
udp_port = bundle_udp_port;
dissector_add_uint("tcp.port", tcp_port, tcpcl_handle);
dissector_add_uint("udp.port", udp_port, bundle_handle);
}

View File

@ -136,7 +136,7 @@ static dissector_handle_t dtpt_conversation_handle;
/* Server port */
static unsigned int gbl_dtptServerPort=5721;
#define TCP_SERVER_PORT 5721
static const value_string names_message_type[] = {
#define LookupBeginRequest 9
@ -1166,7 +1166,6 @@ proto_register_dtpt(void)
&ett_dtpt_blobraw,
&ett_dtpt_blob,
};
module_t *dtpt_module;
e_guid_t guid_svcid_inet_hostaddrbyname = {0x0002A803, 0x0000, 0x0000, {0xC0,0,0,0,0,0,0,0x46}};
e_guid_t guid_svcid_inet_hostaddrbyinetstring = {0x0002A801, 0x0000, 0x0000, {0xC0,0,0,0,0,0,0,0x46}};
guids_add_guid(&guid_svcid_inet_hostaddrbyname, "SVCID_INET_HOSTADDRBYNAME");
@ -1176,38 +1175,19 @@ proto_register_dtpt(void)
"DTPT", "dtpt");
proto_register_field_array(proto_dtpt, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
/* Register a configuration option for port */
dtpt_module = prefs_register_protocol(proto_dtpt,
proto_reg_handoff_dtpt);
prefs_register_uint_preference(dtpt_module, "tcp.port",
"DTPT Server TCP Port",
"Set the TDP port for the DTPT Server",
10, &gbl_dtptServerPort);
}
void
proto_reg_handoff_dtpt(void)
{
static dissector_handle_t dtpt_handle;
static gboolean Initialized=FALSE;
static int ServerPort;
dissector_handle_t dtpt_handle;
if (!Initialized) {
dtpt_handle = create_dissector_handle(dissect_dtpt, proto_dtpt);
dtpt_conversation_handle = create_dissector_handle(dissect_dtpt_conversation, proto_dtpt);
/** dtpt_data_handle = create_dissector_handle(dissect_dtpt_data, proto_dtpt); **/
dtpt_handle = create_dissector_handle(dissect_dtpt, proto_dtpt);
dtpt_conversation_handle = create_dissector_handle(dissect_dtpt_conversation, proto_dtpt);
/** dtpt_data_handle = create_dissector_handle(dissect_dtpt_data, proto_dtpt); **/
Initialized=TRUE;
} else {
dissector_delete_uint("tcp.port", ServerPort, dtpt_handle);
}
/* set port for future deletes */
ServerPort=gbl_dtptServerPort;
dissector_add_uint("tcp.port", gbl_dtptServerPort, dtpt_handle);
dissector_add_uint_with_preference("tcp.port", TCP_SERVER_PORT, dtpt_handle);
}
/*

View File

@ -115,7 +115,7 @@ void proto_reg_handoff_echo(void)
echo_handle = create_dissector_handle(dissect_echo, proto_echo);
dissector_add_uint("udp.port", ECHO_PORT, echo_handle);
dissector_add_uint("tcp.port", ECHO_PORT, echo_handle);
dissector_add_uint_with_preference("tcp.port", ECHO_PORT, echo_handle);
}

View File

@ -37,6 +37,7 @@
#include "packet-mbtcp.h"
#define PROTO_TAG_ECMP "ECMP"
#define ECMP_TCP_PORT 6160
void proto_reg_handoff_ecmp(void);
void proto_register_ecmp (void);
@ -3573,7 +3574,7 @@ void proto_reg_handoff_ecmp(void)
/* Cyclic frames are over UDP and non-cyclic are over TCP */
dissector_add_uint("udp.port", global_ecmp_port, ecmp_udp_handle);
dissector_add_uint("tcp.port", global_ecmp_port, ecmp_tcp_handle);
dissector_add_uint_with_preference("tcp.port", ECMP_TCP_PORT, ecmp_tcp_handle);
initialized = TRUE;
}

View File

@ -182,6 +182,7 @@ static gint ett_emule_sourceOBFU = -1;
static expert_field ei_kademlia_tag_type = EI_INIT;
static expert_field ei_kademlia_search_expression_type = EI_INIT;
#define EDONKEY_TCP_PORT_RANGE "4661-4663" /* Not IANA registered */
/* desegmentation of eDonkey over TCP */
static gboolean edonkey_desegment = TRUE;
@ -3406,9 +3407,7 @@ void proto_reg_handoff_edonkey(void) {
edonkey_tcp_handle = create_dissector_handle(dissect_edonkey_tcp, proto_edonkey);
edonkey_udp_handle = create_dissector_handle(dissect_edonkey_udp, proto_edonkey);
dissector_add_uint("tcp.port", 4661, edonkey_tcp_handle);
dissector_add_uint("tcp.port", 4662, edonkey_tcp_handle);
dissector_add_uint("tcp.port", 4663, edonkey_tcp_handle);
dissector_add_uint_range_with_preference("tcp.port", EDONKEY_TCP_PORT_RANGE, edonkey_tcp_handle);
dissector_add_uint("udp.port", 4665, edonkey_udp_handle);
dissector_add_uint("udp.port", 4672, edonkey_udp_handle);

View File

@ -27,7 +27,7 @@
#include "packet-tcp.h"
#define ELASTICSEARCH_DISCOVERY_PORT 54328
#define ELASTICSEARCH_BINARY_PORT 9300
#define ELASTICSEARCH_BINARY_PORT 9300 /* Not IANA registered */
#define IPv4_ADDRESS_LENGTH 4
#define ELASTICSEARCH_STATUS_FLAG_RESPONSE 1 /* 001 */
@ -728,7 +728,7 @@ void proto_reg_handoff_elasticsearch(void) {
elasticsearch_zen_handle = create_dissector_handle(dissect_elasticsearch_zen_ping, proto_elasticsearch);
dissector_add_uint("udp.port", ELASTICSEARCH_DISCOVERY_PORT, elasticsearch_zen_handle);
dissector_add_uint("tcp.port", ELASTICSEARCH_BINARY_PORT, elasticsearch_handle_binary);
dissector_add_uint_with_preference("tcp.port", ELASTICSEARCH_BINARY_PORT, elasticsearch_handle_binary);
}

View File

@ -30,7 +30,7 @@
#include <epan/packet.h>
#define TCP_PORT_ELCOM 5997
#define TCP_PORT_ELCOM 5997 /* Not IANA registered */
/* Application level: */
#define A_CONRQ 0x04
@ -761,7 +761,7 @@ proto_reg_handoff_elcom(void)
dissector_handle_t elcom_handle;
elcom_handle = create_dissector_handle(dissect_elcom, proto_elcom);
dissector_add_uint("tcp.port", TCP_PORT_ELCOM, elcom_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_ELCOM, elcom_handle);
}
/*

View File

@ -4411,7 +4411,7 @@ proto_reg_handoff_enip(void)
/* Register for EtherNet/IP, using TCP */
enip_tcp_handle = find_dissector("enip");
dissector_add_uint("tcp.port", ENIP_ENCAP_PORT, enip_tcp_handle);
dissector_add_uint_with_preference("tcp.port", ENIP_ENCAP_PORT, enip_tcp_handle);
/* Register for EtherNet/IP, using UDP */
enip_udp_handle = create_dissector_handle(dissect_enip_udp, proto_enip);

View File

@ -37,7 +37,7 @@
/* Define UDP/TCP ports for ENTTEC */
#define UDP_PORT_ENTTEC 0x0D05
#define TCP_PORT_ENTTEC 0x0D05
#define TCP_PORT_ENTTEC 0x0D05 /* Not IANA registered */
#define ENTTEC_HEAD_ESPR 0x45535052
@ -108,7 +108,6 @@ static int ett_enttec = -1;
*/
static guint global_udp_port_enttec = UDP_PORT_ENTTEC;
static guint global_tcp_port_enttec = TCP_PORT_ENTTEC;
static gint global_disp_chan_val_type = 0;
static gint global_disp_col_count = 16;
@ -552,11 +551,6 @@ proto_register_enttec(void)
"The UDP port on which ENTTEC packets will be sent",
10,&global_udp_port_enttec);
prefs_register_uint_preference(enttec_module, "tcp_port",
"ENTTEC TCP Port",
"The TCP port on which ENTTEC packets will be sent",
10,&global_tcp_port_enttec);
prefs_register_enum_preference(enttec_module, "dmx_disp_chan_val_type",
"DMX Display channel value type",
"The way DMX values are displayed",
@ -582,22 +576,19 @@ proto_reg_handoff_enttec(void) {
static gboolean enttec_initialized = FALSE;
static dissector_handle_t enttec_udp_handle, enttec_tcp_handle;
static guint udp_port_enttec;
static guint tcp_port_enttec;
if(!enttec_initialized) {
enttec_udp_handle = create_dissector_handle(dissect_enttec_udp,proto_enttec);
enttec_tcp_handle = create_dissector_handle(dissect_enttec_tcp,proto_enttec);
dissector_add_uint_with_preference("tcp.port",TCP_PORT_ENTTEC,enttec_tcp_handle);
enttec_initialized = TRUE;
} else {
dissector_delete_uint("udp.port",udp_port_enttec,enttec_udp_handle);
dissector_delete_uint("tcp.port",tcp_port_enttec,enttec_tcp_handle);
}
udp_port_enttec = global_udp_port_enttec;
tcp_port_enttec = global_tcp_port_enttec;
dissector_add_uint("udp.port",global_udp_port_enttec,enttec_udp_handle);
dissector_add_uint("tcp.port",global_tcp_port_enttec,enttec_tcp_handle);
}
/*

View File

@ -418,7 +418,7 @@ proto_reg_handoff_epmd(void) {
epmd_handle = find_dissector("epmd");
edp_handle = find_dissector("erldp");
dissector_add_uint("tcp.port", EPMD_PORT, epmd_handle);
dissector_add_uint_with_preference("tcp.port", EPMD_PORT, epmd_handle);
}
/*

View File

@ -683,7 +683,7 @@ void proto_register_erldp(void) {
/*--- proto_reg_handoff_erldp -------------------------------------------*/
void proto_reg_handoff_erldp(void) {
dissector_add_for_decode_as("tcp.port", erldp_handle);
dissector_add_for_decode_as_with_preference("tcp.port", erldp_handle);
}
/*

View File

@ -136,7 +136,6 @@ static dissector_handle_t etch_handle;
*/
static const char *gbl_keytab_folder = "";
static guint gbl_etch_port = 0;
static char *gbl_current_keytab_folder = NULL;
static int gbl_pdu_counter;
@ -946,8 +945,7 @@ void proto_register_etch(void)
register_init_routine(&etch_dissector_init);
etch_module = prefs_register_protocol(proto_etch,
proto_reg_handoff_etch);
etch_module = prefs_register_protocol(proto_etch, proto_reg_handoff_etch);
prefs_register_directory_preference(etch_module, "file",
"Apache Etch symbol folder",
@ -955,34 +953,21 @@ void proto_register_etch(void)
"(generated by the Apache Etch compiler) "
"ending with .ewh here",
&gbl_keytab_folder);
prefs_register_uint_preference(etch_module, "tcp.port",
"Etch TCP Port",
"Etch TCP port",
10,
&gbl_etch_port);
}
void proto_reg_handoff_etch(void)
{
static gboolean etch_prefs_initialized = FALSE;
static guint old_etch_port = 0;
/* create dissector handle only once */
if(!etch_prefs_initialized) {
/* add heuristic dissector for tcp */
heur_dissector_add("tcp", dissect_etch, "Etch over TCP", "etch_tcp", proto_etch, HEURISTIC_ENABLE);
dissector_add_for_decode_as_with_preference("tcp.port", etch_handle);
etch_prefs_initialized = TRUE;
}
if(old_etch_port != 0 && old_etch_port != gbl_etch_port){
dissector_delete_uint("tcp.port", old_etch_port, etch_handle);
}
if(gbl_etch_port != 0 && old_etch_port != gbl_etch_port) {
dissector_add_uint("tcp.port", gbl_etch_port, etch_handle);
}
old_etch_port = gbl_etch_port;
/* read config folder files, if filename has changed
* (while protecting strcmp() from NULLs)

View File

@ -408,7 +408,7 @@ proto_reg_handoff_exec(void)
dissector_handle_t exec_handle;
exec_handle = create_dissector_handle(dissect_exec, proto_exec);
dissector_add_uint("tcp.port", EXEC_PORT, exec_handle);
dissector_add_uint_with_preference("tcp.port", EXEC_PORT, exec_handle);
}
/*

View File

@ -24,7 +24,6 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/prefs.h>
#include "packet-tcp.h"
void proto_register_fcgi(void);
@ -32,8 +31,6 @@ void proto_reg_handoff_fcgi(void);
static int proto_fcgi = -1;
static guint tcp_port = 0;
static int hf_fcgi_version = -1;
static int hf_fcgi_type = -1;
static int hf_fcgi_id = -1;
@ -382,43 +379,19 @@ proto_register_fcgi(void)
&ett_fcgi_end_request,
&ett_fcgi_params
};
module_t *fcgi_module;
proto_fcgi = proto_register_protocol("FastCGI", "FCGI", "fcgi");
proto_register_field_array(proto_fcgi, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
fcgi_module = prefs_register_protocol(proto_fcgi, proto_reg_handoff_fcgi);
prefs_register_uint_preference(fcgi_module,
"tcp.port",
"TCP port for FCGI",
"Set the TCP port for FastCGI traffic",
10,
&tcp_port);
fcgi_handle = register_dissector("fcgi", dissect_fcgi, proto_fcgi);
}
void
proto_reg_handoff_fcgi(void)
{
static gboolean initialized = FALSE;
static guint saved_tcp_port;
if (!initialized) {
dissector_add_for_decode_as("tcp.port", fcgi_handle);
initialized = TRUE;
} else if (saved_tcp_port != 0) {
dissector_delete_uint("tcp.port", saved_tcp_port, fcgi_handle);
}
if (tcp_port != 0) {
dissector_add_uint("tcp.port", tcp_port, fcgi_handle);
}
saved_tcp_port = tcp_port;
dissector_add_for_decode_as_with_preference("tcp.port", fcgi_handle);
}
/*

View File

@ -651,7 +651,7 @@ proto_reg_handoff_fcip (void)
heur_dissector_add("tcp", dissect_fcip_heur, "FCIP over TCP", "fcip_tcp", proto_fcip, HEURISTIC_ENABLE);
fcip_handle = create_dissector_handle(dissect_fcip_handle, proto_fcip);
dissector_add_for_decode_as("tcp.port", fcip_handle);
dissector_add_for_decode_as_with_preference("tcp.port", fcip_handle);
fc_handle = find_dissector_add_dependency("fc", proto_fcip);
}

View File

@ -15298,7 +15298,7 @@ proto_reg_handoff_ff(void)
* - Client / Server
*/
dissector_add_uint("udp.port", UDP_PORT_FF_FMS, ff_udp_handle);
dissector_add_uint("tcp.port", TCP_PORT_FF_FMS, ff_tcp_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_FF_FMS, ff_tcp_handle);
/*
* 4.8.4.2. Use

View File

@ -202,7 +202,7 @@ proto_reg_handoff_finger(void)
static dissector_handle_t finger_handle;
finger_handle = create_dissector_handle(dissect_finger, proto_finger);
dissector_add_uint("tcp.port", FINGER_PORT, finger_handle);
dissector_add_uint_with_preference("tcp.port", FINGER_PORT, finger_handle);
}
/*

View File

@ -70,9 +70,6 @@ static int hf_fix_field_tag = -1;
static dissector_handle_t fix_handle;
static range_t *global_fix_tcp_range = NULL;
static range_t *fix_tcp_range = NULL;
/* 8=FIX */
#define MARKER_TAG "8=FIX"
#define MARKER_LEN 5
@ -460,15 +457,6 @@ dissect_fix_heur_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
return TRUE;
}
/* Register the protocol with Wireshark */
static void fix_prefs(void)
{
dissector_delete_uint_range("tcp.port", fix_tcp_range, fix_handle);
g_free(fix_tcp_range);
fix_tcp_range = range_copy(global_fix_tcp_range);
dissector_add_uint_range("tcp.port", fix_tcp_range, fix_handle);
}
/* this format is require because a script is used to build the C function
that calls all the protocol registration.
*/
@ -519,8 +507,7 @@ proto_register_fix(void)
register_init_routine(&dissect_fix_init);
/* Register the protocol name and description */
proto_fix = proto_register_protocol("Financial Information eXchange Protocol",
"FIX", "fix");
proto_fix = proto_register_protocol("Financial Information eXchange Protocol", "FIX", "fix");
/* Allow dissector to find be found by name. */
fix_handle = register_dissector("fix", dissect_fix, proto_fix);
@ -531,17 +518,13 @@ proto_register_fix(void)
expert_fix = expert_register_protocol(proto_fix);
expert_register_field_array(expert_fix, ei, array_length(ei));
fix_module = prefs_register_protocol(proto_fix, fix_prefs);
fix_module = prefs_register_protocol(proto_fix, NULL);
prefs_register_bool_preference(fix_module, "desegment",
"Reassemble FIX messages spanning multiple TCP segments",
"Whether the FIX dissector should reassemble messages spanning multiple TCP segments."
" To use this option, you must also enable"
" \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&fix_desegment);
prefs_register_range_preference(fix_module, "tcp.port", "TCP Ports", "TCP Ports range", &global_fix_tcp_range, 65535);
fix_tcp_range = range_empty();
}
@ -551,8 +534,7 @@ proto_reg_handoff_fix(void)
/* Let the tcp dissector know that we're interested in traffic */
heur_dissector_add("tcp", dissect_fix_heur, "FIX over TCP", "fix_tcp", proto_fix, HEURISTIC_ENABLE);
heur_dissector_add("ssl", dissect_fix_heur_ssl, "FIX over SSL", "fix_ssl", proto_fix, HEURISTIC_ENABLE);
/* Register a fix handle to "tcp.port" to be able to do 'decode-as' */
dissector_add_for_decode_as("tcp.port", fix_handle);
dissector_add_uint_range_with_preference("tcp.port", "", fix_handle);
}
/*

View File

@ -145,7 +145,6 @@ static int hf_forces_unknown_tlv = -1;
#define TCP_UDP_TML_FOCES_MESSAGE_OFFSET_TCP 2
/*TCP+UDP TML*/
static guint forces_alternate_tcp_port = 0;
static guint forces_alternate_udp_port = 0;
/*SCTP TML*/
static guint forces_alternate_sctp_high_prio_channel_port = 0;
@ -833,11 +832,6 @@ proto_register_forces(void)
forces_module = prefs_register_protocol(proto_forces,proto_reg_handoff_forces);
prefs_register_uint_preference(forces_module, "tcp_alternate_port",
"TCP port",
"Decode packets on this TCP port as ForCES",
10, &forces_alternate_tcp_port);
prefs_register_uint_preference(forces_module, "udp_alternate_port",
"UDP port",
"Decode packets on this UDP port as ForCES",
@ -864,7 +858,6 @@ proto_reg_handoff_forces(void)
{
static gboolean inited = FALSE;
static guint alternate_tcp_port = 0; /* 3000 */
static guint alternate_udp_port = 0;
static guint alternate_sctp_high_prio_channel_port = 0; /* 6700 */
static guint alternate_sctp_med_prio_channel_port = 0;
@ -876,15 +869,12 @@ proto_reg_handoff_forces(void)
forces_handle_tcp = create_dissector_handle(dissect_forces_tcp, proto_forces);
forces_handle = create_dissector_handle(dissect_forces_not_tcp, proto_forces);
ip_handle = find_dissector_add_dependency("ip", proto_forces);
/* Register TCP port for dissection */
dissector_add_for_decode_as_with_preference("tcp.port", forces_handle_tcp);
inited = TRUE;
}
/* Register TCP port for dissection */
if ((alternate_tcp_port != 0) && (alternate_tcp_port != forces_alternate_tcp_port))
dissector_delete_uint("tcp.port", alternate_tcp_port, forces_handle_tcp);
if ((forces_alternate_tcp_port != 0) && (alternate_tcp_port != forces_alternate_tcp_port))
dissector_add_uint("tcp.port", forces_alternate_tcp_port, forces_handle_tcp);
alternate_tcp_port = forces_alternate_tcp_port;
/* Register UDP port for dissection */
if ((alternate_udp_port != 0) && (alternate_udp_port != forces_alternate_udp_port))

View File

@ -1047,9 +1047,9 @@ proto_reg_handoff_ftp(void)
dissector_handle_t ftp_handle;
ftpdata_handle = find_dissector("ftp-data");
dissector_add_uint("tcp.port", TCP_PORT_FTPDATA, ftpdata_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_FTPDATA, ftpdata_handle);
ftp_handle = find_dissector("ftp");
dissector_add_uint("tcp.port", TCP_PORT_FTP, ftp_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_FTP, ftp_handle);
}
/*

View File

@ -2112,7 +2112,7 @@ proto_register_gadu_gadu(void)
void
proto_reg_handoff_gadu_gadu(void)
{
dissector_add_uint("tcp.port", TCP_PORT_GADU_GADU, gadu_gadu_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_GADU_GADU, gadu_gadu_handle);
xml_handle = find_dissector_add_dependency("xml", hfi_gadu_gadu->id);
}

View File

@ -217,8 +217,7 @@ proto_register_gdb(void)
};
proto_gdb = proto_register_protocol(
"GDB Remote Serial Protocol", "GDB remote", "gdb");
proto_gdb = proto_register_protocol("GDB Remote Serial Protocol", "GDB remote", "gdb");
proto_register_field_array(proto_gdb, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
@ -230,15 +229,11 @@ proto_register_gdb(void)
void
proto_reg_handoff_gdb(void)
{
static gboolean initialized = FALSE;
static dissector_handle_t gdb_handle;
dissector_handle_t gdb_handle;
if (!initialized) {
gdb_handle = create_dissector_handle(dissect_gdb_tcp, proto_gdb);
initialized = TRUE;
}
gdb_handle = create_dissector_handle(dissect_gdb_tcp, proto_gdb);
dissector_add_for_decode_as("tcp.port", gdb_handle);
dissector_add_for_decode_as_with_preference("tcp.port", gdb_handle);
}
/*

View File

@ -2051,7 +2051,7 @@ proto_reg_handoff_gdsdb(void)
gdsdb_handle = create_dissector_handle(dissect_gdsdb,
proto_gdsdb);
dissector_add_uint("tcp.port", TCP_PORT, gdsdb_handle);
dissector_add_uint_with_preference("tcp.port", TCP_PORT, gdsdb_handle);
}
/*

View File

@ -551,7 +551,7 @@ proto_reg_handoff_gearman(void)
dissector_handle_t gearman_handle;
gearman_handle = create_dissector_handle(dissect_gearman, proto_gearman);
dissector_add_uint("tcp.port", GEARMAN_PORT, gearman_handle);
dissector_add_uint_with_preference("tcp.port", GEARMAN_PORT, gearman_handle);
}
/*

View File

@ -155,7 +155,6 @@ static expert_field ei_ged125_TrunkCount_invalid = EI_INIT;
static dissector_handle_t ged125_handle;
/* Preferences */
static guint global_tcp_port_ged125 = 0;
static gboolean ged125_desegment_body = TRUE;
#define GED125_FAILURE_CONF_VALUE 1
@ -1756,10 +1755,6 @@ proto_register_ged125 (void)
ged125_module = prefs_register_protocol(proto_ged125, NULL);
prefs_register_uint_preference(ged125_module, "tcp_port","GED125 TCP Port",
"Set up the TCP port for GED125",
10, &global_tcp_port_ged125);
prefs_register_bool_preference(ged125_module, "desegment_body",
"Reassemble GED125 bodies spanning multiple TCP segments",
"Whether the GED125 dissector should desegment all messages spanning multiple TCP segments",
@ -1769,17 +1764,8 @@ proto_register_ged125 (void)
void
proto_reg_handoff_ged125(void)
{
static guint old_ged125_tcp_port = 0;
/* Register TCP port for dissection */
if (old_ged125_tcp_port != 0 && old_ged125_tcp_port != global_tcp_port_ged125)
dissector_delete_uint("tcp.port", old_ged125_tcp_port, ged125_handle);
if (global_tcp_port_ged125 != 0 && old_ged125_tcp_port != global_tcp_port_ged125)
dissector_add_uint("tcp.port", global_tcp_port_ged125, ged125_handle);
old_ged125_tcp_port = global_tcp_port_ged125;
dissector_add_for_decode_as_with_preference("tcp.port", ged125_handle);
}
/*

Some files were not shown because too many files have changed in this diff Show More