aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-nasdaq-soup.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-nasdaq-soup.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-nasdaq-soup.c')
-rw-r--r--epan/dissectors/packet-nasdaq-soup.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/epan/dissectors/packet-nasdaq-soup.c b/epan/dissectors/packet-nasdaq-soup.c
index 84b8260a29..67bce1f137 100644
--- a/epan/dissectors/packet-nasdaq-soup.c
+++ b/epan/dissectors/packet-nasdaq-soup.c
@@ -61,9 +61,6 @@ static dissector_handle_t nasdaq_itch_handle;
/* desegmentation of Nasdaq Soup */
static gboolean nasdaq_soup_desegment = TRUE;
-static range_t *global_nasdaq_soup_tcp_range = NULL;
-static range_t *nasdaq_soup_tcp_range = NULL;
-
/* Initialize the subtree pointers */
static gint ett_nasdaq_soup = -1;
@@ -196,15 +193,6 @@ dissect_nasdaq_soup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
return tvb_captured_length(tvb);
}
-/* Register the protocol with Wireshark */
-static void nasdaq_soup_prefs(void)
-{
- dissector_delete_uint_range("tcp.port", nasdaq_soup_tcp_range, nasdaq_soup_handle);
- g_free(nasdaq_soup_tcp_range);
- nasdaq_soup_tcp_range = range_copy(global_nasdaq_soup_tcp_range);
- dissector_add_uint_range("tcp.port", nasdaq_soup_tcp_range, nasdaq_soup_handle);
-}
-
void
proto_register_nasdaq_soup(void)
{
@@ -272,15 +260,11 @@ proto_register_nasdaq_soup(void)
proto_register_field_array(proto_nasdaq_soup, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- nasdaq_soup_module = prefs_register_protocol(proto_nasdaq_soup, nasdaq_soup_prefs);
+ nasdaq_soup_module = prefs_register_protocol(proto_nasdaq_soup, NULL);
prefs_register_bool_preference(nasdaq_soup_module, "desegment",
"Reassemble Nasdaq-SoupTCP messages spanning multiple TCP segments",
"Whether the Nasdaq-SoupTCP dissector should reassemble messages spanning multiple TCP segments.",
&nasdaq_soup_desegment);
-
- prefs_register_range_preference(nasdaq_soup_module, "tcp.port", "TCP Ports", "TCP Ports range", &global_nasdaq_soup_tcp_range, 65535);
-
- nasdaq_soup_tcp_range = range_empty();
}
/* If this dissector uses sub-dissector registration add a registration routine.
@@ -292,7 +276,7 @@ proto_reg_handoff_nasdaq_soup(void)
{
nasdaq_soup_handle = create_dissector_handle(dissect_nasdaq_soup, proto_nasdaq_soup);
nasdaq_itch_handle = find_dissector_add_dependency("nasdaq-itch", proto_nasdaq_soup);
- dissector_add_for_decode_as("tcp.port", nasdaq_soup_handle);
+ dissector_add_uint_range_with_preference("tcp.port", "", nasdaq_soup_handle);
}
/*