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-hp-erm.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-hp-erm.c')
-rw-r--r-- | epan/dissectors/packet-hp-erm.c | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/epan/dissectors/packet-hp-erm.c b/epan/dissectors/packet-hp-erm.c index 73255703b0..2bcba313ee 100644 --- a/epan/dissectors/packet-hp-erm.c +++ b/epan/dissectors/packet-hp-erm.c @@ -46,7 +46,6 @@ #include "config.h" #include <epan/packet.h> -#include <epan/prefs.h> void proto_register_hp_erm(void); void proto_reg_handoff_hp_erm(void); @@ -54,8 +53,6 @@ void proto_reg_handoff_hp_erm(void); #define PROTO_SHORT_NAME "HP_ERM" #define PROTO_LONG_NAME "HP encapsulated remote mirroring" -static guint global_hp_erm_udp_port = 0; - static int proto_hp_erm = -1; static gint ett_hp_erm = -1; static int hf_hp_erm_unknown1 = -1; @@ -149,17 +146,8 @@ proto_register_hp_erm(void) &ett_hp_erm, }; - module_t *hp_erm_module; - proto_hp_erm = proto_register_protocol(PROTO_LONG_NAME, PROTO_SHORT_NAME, "hp_erm"); - hp_erm_module = prefs_register_protocol(proto_hp_erm, proto_reg_handoff_hp_erm); - prefs_register_uint_preference(hp_erm_module, "udp.port", "HP_ERM UDP Port", - "Set the UDP port (source or destination) used for HP" - " encapsulated remote mirroring frames;\n" - "0 (default) means that the HP_ERM dissector is not active", - 10, &global_hp_erm_udp_port); - proto_register_field_array(proto_hp_erm, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } @@ -167,23 +155,11 @@ proto_register_hp_erm(void) void proto_reg_handoff_hp_erm(void) { - static dissector_handle_t hp_erm_handle; - static guint hp_erm_udp_port; - static gboolean initialized = FALSE; - - if (!initialized) { - eth_withoutfcs_handle = find_dissector_add_dependency("eth_withoutfcs", proto_hp_erm); - hp_erm_handle = create_dissector_handle(dissect_hp_erm, proto_hp_erm); - initialized = TRUE; - } else { - if (hp_erm_udp_port != 0) - dissector_delete_uint("udp.port", hp_erm_udp_port, hp_erm_handle); - } - - hp_erm_udp_port = global_hp_erm_udp_port; - - if (hp_erm_udp_port != 0) - dissector_add_uint("udp.port", hp_erm_udp_port, hp_erm_handle); + dissector_handle_t hp_erm_handle; + + eth_withoutfcs_handle = find_dissector_add_dependency("eth_withoutfcs", proto_hp_erm); + hp_erm_handle = create_dissector_handle(dissect_hp_erm, proto_hp_erm); + dissector_add_for_decode_as_with_preference("udp.port", hp_erm_handle); } /* * Editor modelines |