aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-a21.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-a21.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-a21.c')
-rw-r--r--epan/dissectors/packet-a21.c36
1 files changed, 4 insertions, 32 deletions
diff --git a/epan/dissectors/packet-a21.c b/epan/dissectors/packet-a21.c
index bcb8e8ff1d..4ca1fc4ab4 100644
--- a/epan/dissectors/packet-a21.c
+++ b/epan/dissectors/packet-a21.c
@@ -27,7 +27,6 @@
#include "config.h"
#include <epan/packet.h>
-#include <epan/prefs.h>
#include <epan/expert.h>
#include "packet-e212.h"
@@ -36,11 +35,7 @@
void proto_register_a21(void);
void proto_reg_handoff_a21(void);
-/* Preferences */
#define A21_PORT 23272
-/* Default the port to zero */
-static guint a21_udp_port = 0;
-
static dissector_handle_t gcsna_handle = NULL;
static int proto_a21 = -1;
@@ -931,7 +926,6 @@ void proto_register_a21(void)
&ett_a21_record_content
};
- module_t *a21_module;
expert_module_t *expert_a21;
static ei_register_info ei[] = {
@@ -945,37 +939,15 @@ void proto_register_a21(void)
proto_register_subtree_array(ett_a21_array, array_length(ett_a21_array));
expert_a21 = expert_register_protocol(proto_a21);
expert_register_field_array(expert_a21, ei, array_length(ei));
-
- a21_module = prefs_register_protocol(proto_a21, proto_reg_handoff_a21);
-
- prefs_register_uint_preference(a21_module, "udp.port",
- "A21 UDP Port",
- "UDP port used by A21, usually 23272",
- 10, &a21_udp_port);
-
}
void proto_reg_handoff_a21(void)
{
- static dissector_handle_t a21_handle;
- static gboolean a21_prefs_initialized = FALSE;
- static guint saved_a21_udp_port;
-
-
- if (!a21_prefs_initialized) {
- a21_handle = create_dissector_handle(dissect_a21, proto_a21);
- gcsna_handle = find_dissector_add_dependency("gcsna", proto_a21);
- dissector_add_uint("udp.port", a21_udp_port, a21_handle);
- a21_prefs_initialized = TRUE;
- } else {
- dissector_delete_uint("udp.port", saved_a21_udp_port, a21_handle);
- }
-
- saved_a21_udp_port = a21_udp_port;
- if (a21_udp_port != 0) {
- dissector_add_uint("udp.port", a21_udp_port, a21_handle);
- }
+ dissector_handle_t a21_handle;
+ a21_handle = create_dissector_handle(dissect_a21, proto_a21);
+ gcsna_handle = find_dissector_add_dependency("gcsna", proto_a21);
+ dissector_add_uint_with_preference("udp.port", A21_PORT, a21_handle);
}
/*