diff options
author | Michael Mann <mmann78@netscape.net> | 2016-10-07 16:25:01 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-10-08 02:44:53 +0000 |
commit | 268841f3e00b7cf0f16c81dd2b3b952172130b8b (patch) | |
tree | 359e01cf5eba83308760531888713fe0ff0bc10b /epan/dissectors/packet-memcache.c | |
parent | 11d3224142c0531879fb8e415daf9639a4eace66 (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-memcache.c')
-rw-r--r-- | epan/dissectors/packet-memcache.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/epan/dissectors/packet-memcache.c b/epan/dissectors/packet-memcache.c index 3d1e12bb87..66c5e4559d 100644 --- a/epan/dissectors/packet-memcache.c +++ b/epan/dissectors/packet-memcache.c @@ -104,7 +104,6 @@ void proto_reg_handoff_memcache(void); static int proto_memcache = -1; -static range_t *memcache_tcp_port_range = NULL; static range_t *memcache_udp_port_range = NULL; static dissector_handle_t memcache_tcp_handle; static dissector_handle_t memcache_udp_handle; @@ -2140,14 +2139,8 @@ proto_register_memcache (void) " to reassemble TCP streams\" in the TCP protocol settings.", &memcache_desegment_body); - range_convert_str(&memcache_tcp_port_range, MEMCACHE_DEFAULT_RANGE, 65535); range_convert_str(&memcache_udp_port_range, MEMCACHE_DEFAULT_RANGE, 65535); - prefs_register_range_preference(memcache_module, "tcp.ports", \ - "MEMCACHE TCP Port range", \ - "MEMCACHE TCP Port range", \ - &memcache_tcp_port_range, \ - 65535); prefs_register_range_preference(memcache_module, "udp.ports", \ "MEMCACHE UDP Port range", \ "MEMCACHE UDP Port range", \ @@ -2159,17 +2152,12 @@ proto_register_memcache (void) void proto_reg_handoff_memcache (void) { - static range_t *orig_memcache_tcp_port_range = NULL; static range_t *orig_memcache_udp_port_range = NULL; - dissector_delete_uint_range("tcp.port", orig_memcache_tcp_port_range, memcache_tcp_handle); - dissector_delete_uint_range("udp.port", orig_memcache_udp_port_range, memcache_udp_handle); - g_free(orig_memcache_tcp_port_range); g_free(orig_memcache_udp_port_range); - orig_memcache_tcp_port_range = range_copy(memcache_tcp_port_range); orig_memcache_udp_port_range = range_copy(memcache_udp_port_range); - dissector_add_uint_range("tcp.port", orig_memcache_tcp_port_range, memcache_tcp_handle); + dissector_add_uint_range_with_preference("tcp.port", MEMCACHE_DEFAULT_RANGE, memcache_tcp_handle); dissector_add_uint_range("udp.port", orig_memcache_udp_port_range, memcache_udp_handle); } |