aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/h501
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/asn1/h501
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/asn1/h501')
-rw-r--r--epan/dissectors/asn1/h501/packet-h501-template.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/epan/dissectors/asn1/h501/packet-h501-template.c b/epan/dissectors/asn1/h501/packet-h501-template.c
index a995701c96..ab7538d1d5 100644
--- a/epan/dissectors/asn1/h501/packet-h501-template.c
+++ b/epan/dissectors/asn1/h501/packet-h501-template.c
@@ -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);
}