aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dlm3.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-10-07 16:25:01 -0400
committerMichael Mann <mmann78@netscape.net>2016-10-08 02:44:53 +0000
commit268841f3e00b7cf0f16c81dd2b3b952172130b8b (patch)
tree359e01cf5eba83308760531888713fe0ff0bc10b /epan/dissectors/packet-dlm3.c
parent11d3224142c0531879fb8e415daf9639a4eace66 (diff)
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>
Diffstat (limited to 'epan/dissectors/packet-dlm3.c')
-rw-r--r--epan/dissectors/packet-dlm3.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/epan/dissectors/packet-dlm3.c b/epan/dissectors/packet-dlm3.c
index f6e52423a4..5cd633d67a 100644
--- a/epan/dissectors/packet-dlm3.c
+++ b/epan/dissectors/packet-dlm3.c
@@ -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);
}