aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bvlc.c
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2007-05-11 06:31:22 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2007-05-11 06:31:22 +0000
commitcaa79282d8e03ed813e9db92c8592c4933eec570 (patch)
treec13f2e2198a4fd80899589ceeae223b5ea79d261 /epan/dissectors/packet-bvlc.c
parent2427e6390d4919fc8fea25161508950f33527d41 (diff)
Fix for bug 1545.
Add a preference to support BVLC on non standard UDP port. svn path=/trunk/; revision=21747
Diffstat (limited to 'epan/dissectors/packet-bvlc.c')
-rw-r--r--epan/dissectors/packet-bvlc.c54
1 files changed, 38 insertions, 16 deletions
diff --git a/epan/dissectors/packet-bvlc.c b/epan/dissectors/packet-bvlc.c
index 19d5fb8fb2..b4caf9052e 100644
--- a/epan/dissectors/packet-bvlc.c
+++ b/epan/dissectors/packet-bvlc.c
@@ -39,6 +39,17 @@
#include <epan/packet.h>
+/* 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 int additional_bvlc_udp_port = 0;
+
static int proto_bvlc = -1;
static int hf_bvlc_type = -1;
static int hf_bvlc_function = -1;
@@ -306,6 +317,8 @@ dissect_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
return tvb_length(tvb);
}
+void proto_reg_handoff_bvlc(void);
+
void
proto_register_bvlc(void)
{
@@ -390,12 +403,20 @@ proto_register_bvlc(void)
&ett_fdt,
};
+ module_t *bvlc_module;
+
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, &additional_bvlc_udp_port);
+
new_register_dissector("bvlc", dissect_bvlc, proto_bvlc);
bvlc_dissector_table = register_dissector_table("bvlc.function",
@@ -405,22 +426,23 @@ proto_register_bvlc(void)
void
proto_reg_handoff_bvlc(void)
{
- dissector_handle_t bvlc_handle;
+ static int bvlc_initialized = FALSE;
+ static dissector_handle_t bvlc_handle;
+ static int bvlc_udp_port;
+
+ if (!bvlc_initialized)
+ {
+ bvlc_handle = find_dissector("bvlc");
+ dissector_add("udp.port", 0xBAC0, bvlc_handle);
+ bvlc_initialized = TRUE;
+ }
+ else
+ {
+ dissector_delete("udp.port", bvlc_udp_port, bvlc_handle);
+ }
+
+ bvlc_udp_port = additional_bvlc_udp_port;
+ dissector_add("udp.port", bvlc_udp_port, bvlc_handle);
- bvlc_handle = find_dissector("bvlc");
- dissector_add("udp.port", 0xBAC0, bvlc_handle);
data_handle = find_dissector("data");
}
-/* 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.
- *
- * This dissector does not analyse UDP packets other than on port 0xBAC0.
- * If you changed your BACnet port locally, use the wireshark feature
- * "Decode As".
- */