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-coap.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-coap.c')
-rw-r--r-- | epan/dissectors/packet-coap.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/epan/dissectors/packet-coap.c b/epan/dissectors/packet-coap.c index 639f06c5e1..0246de8214 100644 --- a/epan/dissectors/packet-coap.c +++ b/epan/dissectors/packet-coap.c @@ -33,7 +33,6 @@ #include <epan/conversation.h> #include <epan/packet.h> -#include <epan/prefs.h> #include <epan/expert.h> #include <epan/wmem/wmem.h> @@ -97,8 +96,6 @@ static expert_field ei_coap_option_length_bad = EI_INIT; #define DEFAULT_COAP_CTYPE_VALUE ~0U #define DEFAULT_COAP_BLOCK_NUMBER ~0U -static guint global_coap_port_number = DEFAULT_COAP_PORT; - static const gchar *coap_ctype_str = NULL; static guint coap_ctype_value = DEFAULT_COAP_CTYPE_VALUE; static guint coap_block_number = DEFAULT_COAP_BLOCK_NUMBER; @@ -1244,7 +1241,6 @@ proto_register_coap(void) { "coap.option_length_bad", PI_MALFORMED, PI_WARN, "Option length bad", EXPFILL }}, }; - module_t *coap_module; expert_module_t *expert_coap; proto_coap = proto_register_protocol("Constrained Application Protocol", "CoAP", "coap"); @@ -1254,34 +1250,17 @@ proto_register_coap(void) expert_register_field_array(expert_coap, ei, array_length(ei)); register_dissector("coap", dissect_coap, proto_coap); - - /* Register our configuration options */ - coap_module = prefs_register_protocol (proto_coap, proto_reg_handoff_coap); - - prefs_register_uint_preference (coap_module, "udp_port", - "CoAP port number", - "Port number used for CoAP traffic", - 10, &global_coap_port_number); } void proto_reg_handoff_coap(void) { - static gboolean coap_prefs_initialized = FALSE; - static dissector_handle_t coap_handle; - static guint coap_port_number; - - if (!coap_prefs_initialized) { - coap_handle = find_dissector("coap"); - media_type_dissector_table = find_dissector_table("media_type"); - dissector_add_uint_with_preference("tcp.port", DEFAULT_COAP_PORT, coap_handle); - coap_prefs_initialized = TRUE; - } else { - dissector_delete_uint("udp.port", coap_port_number, coap_handle); - } + dissector_handle_t coap_handle; - coap_port_number = global_coap_port_number; - dissector_add_uint("udp.port", coap_port_number, coap_handle); + coap_handle = find_dissector("coap"); + media_type_dissector_table = find_dissector_table("media_type"); + dissector_add_uint_with_preference("tcp.port", DEFAULT_COAP_PORT, coap_handle); + dissector_add_uint_with_preference("udp.port", DEFAULT_COAP_PORT, coap_handle); } /* |