diff options
author | Michael Mann <mmann78@netscape.net> | 2016-10-05 16:33:54 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-10-13 02:51:18 +0000 |
commit | 2eb7b05b8c9c6408268f0d1e81f0a18a02610f1c (patch) | |
tree | bd0a909e3d506ea2e61c446aa8a809b6f728af3b /epan/dissectors/packet-riemann.c | |
parent | 4d8581d7e15fe4a80a53496b83a853271fc674b6 (diff) |
Convert most UDP dissectors to use "auto" preferences.
Similar to the "tcp.port" changes in I99604f95d426ad345f4b494598d94178b886eb67,
convert dissectors that use "udp.port".
More cleanup done on dissectors that use both TCP and UDP dissector
tables, so that less preference callbacks exist.
Change-Id: If07be9b9e850c244336a7069599cd554ce312dd3
Reviewed-on: https://code.wireshark.org/review/18120
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-riemann.c')
-rw-r--r-- | epan/dissectors/packet-riemann.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/epan/dissectors/packet-riemann.c b/epan/dissectors/packet-riemann.c index 5ee4093fd1..261c718ee4 100644 --- a/epan/dissectors/packet-riemann.c +++ b/epan/dissectors/packet-riemann.c @@ -75,7 +75,6 @@ #include "config.h" #include <epan/packet.h> -#include <epan/prefs.h> #include <epan/expert.h> #include "packet-tcp.h" @@ -111,8 +110,6 @@ static int hf_riemann_state_time = -1; static int hf_riemann_state_state = -1; static int hf_riemann_state_once = -1; -static guint udp_port_pref = 0; - static gint ett_riemann = -1; static gint ett_query = -1; static gint ett_event = -1; @@ -672,7 +669,6 @@ dissect_riemann_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d void proto_register_riemann(void) { - module_t *riemann_module; expert_module_t *riemann_expert_module; static hf_register_info hf[] = { @@ -812,31 +808,17 @@ proto_register_riemann(void) proto_register_field_array(proto_riemann, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - - riemann_module = prefs_register_protocol(proto_riemann, proto_reg_handoff_riemann); - - prefs_register_uint_preference(riemann_module, "udp.port", "Riemann UDP Port", - " riemann UDP port if other than the default", - 10, &udp_port_pref); } void proto_reg_handoff_riemann(void) { - static gboolean initialized = FALSE; - static dissector_handle_t riemann_udp_handle, riemann_tcp_handle; - static int current_udp_port; - - if (!initialized) { - riemann_udp_handle = create_dissector_handle(dissect_riemann_udp, proto_riemann); - riemann_tcp_handle = create_dissector_handle(dissect_riemann_tcp, proto_riemann); - dissector_add_for_decode_as_with_preference("tcp.port", riemann_tcp_handle); - initialized = TRUE; - } else { - dissector_delete_uint("udp.port", current_udp_port, riemann_udp_handle); - } - current_udp_port = udp_port_pref; - dissector_add_uint("udp.port", current_udp_port, riemann_udp_handle); + dissector_handle_t riemann_udp_handle, riemann_tcp_handle; + + riemann_udp_handle = create_dissector_handle(dissect_riemann_udp, proto_riemann); + riemann_tcp_handle = create_dissector_handle(dissect_riemann_tcp, proto_riemann); + dissector_add_for_decode_as_with_preference("tcp.port", riemann_tcp_handle); + dissector_add_for_decode_as_with_preference("udp.port", riemann_udp_handle); } /* |