aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mausb.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-mausb.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-mausb.c')
-rw-r--r--epan/dissectors/packet-mausb.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/epan/dissectors/packet-mausb.c b/epan/dissectors/packet-mausb.c
index 4bb0869e8a..00a450f173 100644
--- a/epan/dissectors/packet-mausb.c
+++ b/epan/dissectors/packet-mausb.c
@@ -674,7 +674,6 @@ static guint mausb_get_pkt_len(packet_info *pinfo _U_, tvbuff_t *tvb,
}
/* Global Port Preference */
-static unsigned int mausb_tcp_port_pref = 0;
static unsigned int mausb_udp_port_pref = 0;
/* Initialize the subtree pointers */
@@ -2271,11 +2270,6 @@ proto_register_mausb(void)
/* Register Protocol preferences */
mausb_module = prefs_register_protocol(proto_mausb, proto_reg_handoff_mausb);
- /* Register TCP port preference */
- prefs_register_uint_preference(mausb_module, "tcp.port", "MAUSB TCP Port",
- "Set the port for Media Agnostic Packets",
- 10, &mausb_tcp_port_pref);
-
/* Register UDP port preference */
prefs_register_uint_preference(mausb_module, "udp.port", "MAUSB UDP Port",
"Set the port for Media Agnostic Packets",
@@ -2290,7 +2284,6 @@ proto_reg_handoff_mausb(void)
static gboolean initialized = FALSE;
static dissector_handle_t mausb_tcp_handle;
static dissector_handle_t mausb_pkt_handle;
- static guint saved_mausb_tcp_port_pref;
static guint saved_mausb_udp_port_pref;
if (!initialized) {
@@ -2304,16 +2297,14 @@ proto_reg_handoff_mausb(void)
dissector_add_uint("llc.wfa_pid", PID_MAUSB, mausb_pkt_handle);
initialized = TRUE;
+ dissector_add_uint_range_with_preference("tcp.port", "", mausb_tcp_handle);
} else {
/* if we have already been initialized */
- dissector_delete_uint("tcp.port", saved_mausb_tcp_port_pref, mausb_tcp_handle);
dissector_delete_uint("udp.port", saved_mausb_udp_port_pref, mausb_pkt_handle);
}
- saved_mausb_tcp_port_pref = mausb_tcp_port_pref;
saved_mausb_udp_port_pref = mausb_udp_port_pref;
- dissector_add_uint("tcp.port", mausb_tcp_port_pref, mausb_tcp_handle);
dissector_add_uint("udp.port", mausb_udp_port_pref, mausb_pkt_handle);
}