aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bvlc.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-bvlc.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-bvlc.c')
-rw-r--r--epan/dissectors/packet-bvlc.c45
1 files changed, 5 insertions, 40 deletions
diff --git a/epan/dissectors/packet-bvlc.c b/epan/dissectors/packet-bvlc.c
index a3bf4e409d..68fe08248e 100644
--- a/epan/dissectors/packet-bvlc.c
+++ b/epan/dissectors/packet-bvlc.c
@@ -26,21 +26,11 @@
#include "config.h"
#include <epan/packet.h>
-#include <epan/prefs.h>
void proto_register_bvlc(void);
void proto_reg_handoff_bvlc(void);
-/* Taken from add-135a (BACnet-IP-standard paper):
- *
- * The default UDP port for both directed messages and broadcasts shall
- * be X'BAC0' and all B/IP devices shall support it. In some cases,
- * e.g., a situation where it is desirable for two groups of BACnet devices
- * to coexist independently on the same IP subnet, the UDP port may be
- * configured locally to a different value without it being considered
- * a violation of this protocol.
- */
-static guint global_additional_bvlc_udp_port = 0;
+#define BVLC_UDP_PORT 0xBAC0
static int proto_bvlc = -1;
static int hf_bvlc_type = -1;
@@ -389,20 +379,12 @@ proto_register_bvlc(void)
&ett_fdt,
};
- module_t *bvlc_module;
- proto_bvlc = proto_register_protocol("BACnet Virtual Link Control",
- "BVLC", "bvlc");
+ proto_bvlc = proto_register_protocol("BACnet Virtual Link Control", "BVLC", "bvlc");
proto_register_field_array(proto_bvlc, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- bvlc_module = prefs_register_protocol(proto_bvlc, proto_reg_handoff_bvlc);
- prefs_register_uint_preference(bvlc_module, "additional_udp_port",
- "Additional UDP port", "Set an additional UDP port, "
- "besides the standard X'BAC0' (47808) port.",
- 10, &global_additional_bvlc_udp_port);
-
register_dissector("bvlc", dissect_bvlc, proto_bvlc);
bvlc_dissector_table = register_dissector_table("bvlc.function",
@@ -412,27 +394,10 @@ proto_register_bvlc(void)
void
proto_reg_handoff_bvlc(void)
{
- static gboolean bvlc_initialized = FALSE;
- static dissector_handle_t bvlc_handle;
- static guint additional_bvlc_udp_port;
-
- if (!bvlc_initialized)
- {
- bvlc_handle = find_dissector("bvlc");
- dissector_add_uint("udp.port", 0xBAC0, bvlc_handle);
- bvlc_initialized = TRUE;
- }
- else
- {
- if (additional_bvlc_udp_port != 0) {
- dissector_delete_uint("udp.port", additional_bvlc_udp_port, bvlc_handle);
- }
- }
+ dissector_handle_t bvlc_handle;
- if (global_additional_bvlc_udp_port != 0) {
- dissector_add_uint("udp.port", global_additional_bvlc_udp_port, bvlc_handle);
- }
- additional_bvlc_udp_port = global_additional_bvlc_udp_port;
+ bvlc_handle = find_dissector("bvlc");
+ dissector_add_uint_with_preference("udp.port", BVLC_UDP_PORT, bvlc_handle);
}
/*