aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-sml.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-10-05 16:33:54 -0400
committerMichael Mann <mmann78@netscape.net>2016-10-13 02:51:18 +0000
commit2eb7b05b8c9c6408268f0d1e81f0a18a02610f1c (patch)
treebd0a909e3d506ea2e61c446aa8a809b6f728af3b /epan/dissectors/packet-sml.c
parent4d8581d7e15fe4a80a53496b83a853271fc674b6 (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-sml.c')
-rw-r--r--epan/dissectors/packet-sml.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/epan/dissectors/packet-sml.c b/epan/dissectors/packet-sml.c
index 75b66f4e38..30001024af 100644
--- a/epan/dissectors/packet-sml.c
+++ b/epan/dissectors/packet-sml.c
@@ -37,8 +37,6 @@ Short description of the SML protocol on the SML Wireshark Wiki page: https://w
#include <wsutil/str_util.h>
-#define UDP_PORT_SML 0
-
#define ESC_SEQ_END G_GUINT64_CONSTANT(0x1b1b1b1b1a)
#define ESC_SEQ 0x1b1b1b1b
@@ -73,8 +71,6 @@ Short description of the SML protocol on the SML Wireshark Wiki page: https://w
#define LIST_6_ELEMENTS 0x76
#define MSB 0x80
-static guint udp_port_pref = UDP_PORT_SML;
-
/* Forward declaration we need below (if using proto_reg_handoff as a prefs callback)*/
void proto_register_sml(void);
void proto_reg_handoff_sml(void);
@@ -2790,11 +2786,10 @@ void proto_register_sml (void) {
};
proto_sml = proto_register_protocol("Smart Message Language","SML", "sml");
- sml_module = prefs_register_protocol(proto_sml, proto_reg_handoff_sml);
+ sml_module = prefs_register_protocol(proto_sml, NULL);
prefs_register_bool_preference (sml_module, "reassemble", "Enable reassemble", "Enable reassembling (default is enabled)", &sml_reassemble);
prefs_register_bool_preference (sml_module, "crc", "Enable crc calculation", "Enable crc (default is disabled)", &sml_crc_enabled);
- prefs_register_uint_preference(sml_module, "udp.port", "SML UDP Port", "Set the UDP port for SML (Default is 0), recommended port is 7259", 10, &udp_port_pref);
proto_register_field_array(proto_sml, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
@@ -2803,20 +2798,11 @@ void proto_register_sml (void) {
}
void proto_reg_handoff_sml(void) {
- static gboolean initialized = FALSE;
- static int old_udp_port;
- static dissector_handle_t sml_handle;
-
- if (!initialized) {
- sml_handle = create_dissector_handle(dissect_sml, proto_sml);
- dissector_add_for_decode_as_with_preference("tcp.port", sml_handle);
- initialized = TRUE;
- } else {
- dissector_delete_uint("udp.port", old_udp_port, sml_handle);
- }
- old_udp_port = udp_port_pref;
+ dissector_handle_t sml_handle;
- dissector_add_uint("udp.port", udp_port_pref, sml_handle);
+ sml_handle = create_dissector_handle(dissect_sml, proto_sml);
+ dissector_add_for_decode_as_with_preference("tcp.port", sml_handle);
+ dissector_add_for_decode_as_with_preference("udp.port", sml_handle);
}
/*