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-zep.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-zep.c')
-rw-r--r-- | epan/dissectors/packet-zep.c | 50 |
1 files changed, 12 insertions, 38 deletions
diff --git a/epan/dissectors/packet-zep.c b/epan/dissectors/packet-zep.c index de6024d7e8..8f3618a3a9 100644 --- a/epan/dissectors/packet-zep.c +++ b/epan/dissectors/packet-zep.c @@ -45,7 +45,6 @@ #include <epan/packet.h> -#include <epan/prefs.h> #include "packet-ntp.h" #include "packet-zep.h" @@ -71,9 +70,6 @@ static int hf_zep_reserved_field = -1; /* Initialize protocol subtrees. */ static gint ett_zep = -1; -/* Initialize preferences. */ -static guint32 gPREF_zep_udp_port = ZEP_DEFAULT_PORT; - /* Dissector handle */ static dissector_handle_t zep_handle; @@ -252,8 +248,6 @@ static int dissect_zep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void */ void proto_register_zep(void) { - module_t *zep_module; - static hf_register_info hf[] = { { &hf_zep_version, { "Protocol Version", "zep.version", FT_UINT8, BASE_DEC, NULL, 0x0, @@ -311,15 +305,6 @@ void proto_register_zep(void) proto_register_field_array(proto_zep, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - /* Register preferences module */ - zep_module = prefs_register_protocol(proto_zep, proto_reg_handoff_zep); - - /* Register preferences */ - prefs_register_uint_preference(zep_module, "udp.port", "ZEP UDP port", - "Set the port for ZEP Protocol\n" - "Default port is 17754", - 10, &gPREF_zep_udp_port); - /* Register dissector with Wireshark. */ zep_handle = register_dissector("zep", dissect_zep, proto_zep); } /* proto_register_zep */ @@ -338,31 +323,20 @@ void proto_register_zep(void) */ void proto_reg_handoff_zep(void) { - static int lastPort; - static gboolean inited = FALSE; - - if ( !inited) { - dissector_handle_t h; - /* Get dissector handles. */ - if ( !(h = find_dissector("wpan")) ) { /* Try use built-in 802.15.4 dissector */ - h = find_dissector("ieee802154"); /* otherwise use older 802.15.4 plugin dissector */ - } - ieee802154_handle = h; - if ( !(h = find_dissector("wpan_cc24xx")) ) { /* Try use built-in 802.15.4 (Chipcon) dissector */ - h = find_dissector("ieee802154_ccfcs"); /* otherwise use older 802.15.4 (Chipcon) plugin dissector */ - } - ieee802154_ccfcs_handle = h; - data_handle = find_dissector("data"); - inited = TRUE; - } else { - /* If we were already registered, de-register our dissector - * to free the port. */ - dissector_delete_uint("udp.port", lastPort, zep_handle); + dissector_handle_t h; + + /* Get dissector handles. */ + if ( !(h = find_dissector("wpan")) ) { /* Try use built-in 802.15.4 dissector */ + h = find_dissector("ieee802154"); /* otherwise use older 802.15.4 plugin dissector */ + } + ieee802154_handle = h; + if ( !(h = find_dissector("wpan_cc24xx")) ) { /* Try use built-in 802.15.4 (Chipcon) dissector */ + h = find_dissector("ieee802154_ccfcs"); /* otherwise use older 802.15.4 (Chipcon) plugin dissector */ } + ieee802154_ccfcs_handle = h; - /* Register our dissector. */ - dissector_add_uint("udp.port", gPREF_zep_udp_port, zep_handle); - lastPort = gPREF_zep_udp_port; + data_handle = find_dissector("data"); + dissector_add_uint("udp.port", ZEP_DEFAULT_PORT, zep_handle); } /* proto_reg_handoff_zep */ /* |