aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-simulcrypt.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-simulcrypt.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-simulcrypt.c')
-rw-r--r--epan/dissectors/packet-simulcrypt.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/epan/dissectors/packet-simulcrypt.c b/epan/dissectors/packet-simulcrypt.c
index 9bd27d5f7c..7f16632044 100644
--- a/epan/dissectors/packet-simulcrypt.c
+++ b/epan/dissectors/packet-simulcrypt.c
@@ -73,7 +73,6 @@ static void dissect_simulcrypt_data(proto_tree *simulcrypt_tree, proto_item *sim
static guint proto_simulcrypt = -1;
/* Preferences (with default values) */
-static guint global_simulcrypt_tcp_port = 0; /* Simulcrypt registered only if pref set to non-zero value */
static guint global_simulcrypt_udp_port = 0; /* Simulcrypt registered only if pref set to non-zero value */
static int ca_system_id_mikey = CA_SYSTEM_ID_MIKEY; /* MIKEY ECM CA_system_ID */
@@ -1838,10 +1837,6 @@ proto_register_simulcrypt (void)
/* called when preferences are applied. */
simulcrypt_module = prefs_register_protocol(proto_simulcrypt, proto_reg_handoff_simulcrypt);
- prefs_register_uint_preference(simulcrypt_module, "tcp.port", "Simulcrypt TCP Port",
- "Set the TCP port for Simulcrypt messages ('0' means no port is assigned)",
- 10, &global_simulcrypt_tcp_port);
-
prefs_register_uint_preference(simulcrypt_module, "udp.port", "Simulcrypt UDP Port",
"Set the UDP port for Simulcrypt messages ('0' means no port is assigned)",
10, &global_simulcrypt_udp_port);
@@ -1856,7 +1851,7 @@ proto_reg_handoff_simulcrypt(void)
{
static gboolean initialized=FALSE;
static dissector_handle_t simulcrypt_handle;
- static guint tcp_port, udp_port;
+ static guint udp_port;
guint i;
if (!initialized) {
@@ -1865,21 +1860,17 @@ proto_reg_handoff_simulcrypt(void)
{
tab_ecm_inter[i].protocol_handle = find_dissector(tab_ecm_inter[i].protocol_name);
}
- dissector_add_for_decode_as("tcp.port", simulcrypt_handle);
dissector_add_for_decode_as("udp.port", simulcrypt_handle);
+ dissector_add_for_decode_as_with_preference("tcp.port", simulcrypt_handle);
initialized = TRUE;
}
else {
- dissector_delete_uint("tcp.port", tcp_port, simulcrypt_handle);
dissector_delete_uint("udp.port", udp_port, simulcrypt_handle);
}
- if (global_simulcrypt_tcp_port != 0) {
- dissector_add_uint("tcp.port", global_simulcrypt_tcp_port, simulcrypt_handle);
- }
+
if (global_simulcrypt_udp_port != 0) {
dissector_add_uint("udp.port", global_simulcrypt_udp_port, simulcrypt_handle);
}
- tcp_port = global_simulcrypt_tcp_port;
udp_port = global_simulcrypt_udp_port;
/* update tab_ecm_inter table (always do this) */