diff options
Diffstat (limited to 'epan/dissectors/packet-sml.c')
-rw-r--r-- | epan/dissectors/packet-sml.c | 24 |
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); } /* |