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-lsc.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-lsc.c')
-rw-r--r-- | epan/dissectors/packet-lsc.c | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/epan/dissectors/packet-lsc.c b/epan/dissectors/packet-lsc.c index 969118aead..c0780dfbed 100644 --- a/epan/dissectors/packet-lsc.c +++ b/epan/dissectors/packet-lsc.c @@ -24,7 +24,6 @@ #include "config.h" #include <epan/packet.h> -#include <epan/prefs.h> #include "packet-tcp.h" @@ -123,9 +122,6 @@ static int hf_lsc_scale_num = -1; static int hf_lsc_scale_denom = -1; static int hf_lsc_mode = -1; -/* Preferences */ -static guint global_lsc_port = 0; - /* Initialize the subtree pointers */ static gint ett_lsc = -1; @@ -340,8 +336,6 @@ dissect_lsc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) void proto_register_lsc(void) { - module_t *lsc_module; - /* Setup list of header fields */ static hf_register_info hf[] = { { &hf_lsc_version, @@ -412,42 +406,18 @@ proto_register_lsc(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_lsc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - - /* Register preferences module */ - lsc_module = prefs_register_protocol(proto_lsc, proto_reg_handoff_lsc); - - /* Register preferences */ - prefs_register_uint_preference(lsc_module, "port", - "LSC Port", - "Set the TCP or UDP port for Pegasus LSC messages", - 10, &global_lsc_port); } void proto_reg_handoff_lsc(void) { - static gboolean initialized = FALSE; - static dissector_handle_t lsc_udp_handle; - static dissector_handle_t lsc_tcp_handle; - static guint saved_lsc_port; - - if (!initialized) { - lsc_udp_handle = create_dissector_handle(dissect_lsc_udp, proto_lsc); - lsc_tcp_handle = create_dissector_handle(dissect_lsc_tcp, proto_lsc); - dissector_add_for_decode_as("udp.port", lsc_udp_handle); - dissector_add_for_decode_as_with_preference("tcp.port", lsc_tcp_handle); - initialized = TRUE; - } else { - if (saved_lsc_port != 0) { - dissector_delete_uint("udp.port", saved_lsc_port, lsc_udp_handle); - } - } + dissector_handle_t lsc_udp_handle; + dissector_handle_t lsc_tcp_handle; - /* Set the port number */ - if (global_lsc_port != 0) { - dissector_add_uint("udp.port", global_lsc_port, lsc_udp_handle); - } - saved_lsc_port = global_lsc_port; + lsc_udp_handle = create_dissector_handle(dissect_lsc_udp, proto_lsc); + lsc_tcp_handle = create_dissector_handle(dissect_lsc_tcp, proto_lsc); + dissector_add_for_decode_as_with_preference("udp.port", lsc_udp_handle); + dissector_add_for_decode_as_with_preference("tcp.port", lsc_tcp_handle); } /* |