aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-moldudp.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-moldudp.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-moldudp.c')
-rw-r--r--epan/dissectors/packet-moldudp.c37
1 files changed, 4 insertions, 33 deletions
diff --git a/epan/dissectors/packet-moldudp.c b/epan/dissectors/packet-moldudp.c
index b121633a2b..7d697ed8f1 100644
--- a/epan/dissectors/packet-moldudp.c
+++ b/epan/dissectors/packet-moldudp.c
@@ -26,7 +26,6 @@
#include "config.h"
#include <epan/packet.h>
-#include <epan/prefs.h>
#include <epan/expert.h>
void proto_register_moldudp(void);
@@ -49,9 +48,6 @@ static int hf_moldudp_msgdata = -1;
#define MOLDUDP_HEARTBEAT 0x0000
-/* Global port pref */
-static guint pf_moldudp_port = 0;
-
/* Initialize the subtree pointers */
static gint ett_moldudp = -1;
static gint ett_moldudp_msgblk = -1;
@@ -187,8 +183,6 @@ dissect_moldudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
void
proto_register_moldudp(void)
{
- module_t *moldudp_module;
-
/* Setup list of header fields */
static hf_register_info hf[] = {
@@ -235,46 +229,23 @@ proto_register_moldudp(void)
expert_module_t* expert_moldudp;
/* Register the protocol name and description */
- proto_moldudp = proto_register_protocol("MoldUDP",
- "MoldUDP", "moldudp");
+ proto_moldudp = proto_register_protocol("MoldUDP", "MoldUDP", "moldudp");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_moldudp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_moldudp = expert_register_protocol(proto_moldudp);
expert_register_field_array(expert_moldudp, ei, array_length(ei));
-
- /* Register preferences module */
- moldudp_module = prefs_register_protocol(proto_moldudp,
- proto_reg_handoff_moldudp);
-
- /* Register a port preference */
- prefs_register_uint_preference(moldudp_module, "udp.port", "MoldUDP UDP Port",
- "MoldUDP UDP port to capture on.",
- 10, &pf_moldudp_port);
}
void
proto_reg_handoff_moldudp(void)
{
- static gboolean initialized = FALSE;
- static dissector_handle_t moldudp_handle;
- static int currentPort;
-
- if (!initialized) {
- moldudp_handle = create_dissector_handle(dissect_moldudp,
- proto_moldudp);
- initialized = TRUE;
- } else {
-
- dissector_delete_uint("udp.port", currentPort, moldudp_handle);
- }
-
- currentPort = pf_moldudp_port;
-
- dissector_add_uint("udp.port", currentPort, moldudp_handle);
+ dissector_handle_t moldudp_handle;
+ moldudp_handle = create_dissector_handle(dissect_moldudp, proto_moldudp);
+ dissector_add_for_decode_as_with_preference("udp.port", moldudp_handle);
}
/*