1 /* packet-zbee-zdp-binding.c
2 * Dissector helper routines for the binding services of the ZigBee Device Profile
3 * By Owen Kirby <osk@exegin.com>
4 * Copyright 2009 Exegin Technologies Limited
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include <epan/packet.h>
17 #include <epan/addr_resolv.h>
19 #include "packet-zbee.h"
20 #include "packet-zbee-zdp.h"
21 #include "packet-zbee-aps.h"
22 #include "packet-zbee-tlv.h"
24 /**************************************
26 **************************************
29 *Parses and displays a single binding table entry.
31 *@param tvb pointer to buffer containing raw packet.
32 *@param tree pointer to data tree Wireshark uses to display packet.
35 zdp_parse_bind_table_entry(proto_tree
*tree
, tvbuff_t
*tvb
, unsigned *offset
, uint8_t version
)
37 proto_tree
*bind_tree
;
43 /* Add the source address. */
44 bind_tree
= proto_tree_add_subtree(tree
, tvb
, *offset
, 0, ett_zbee_zdp_bind_entry
, &ti
, "Bind");
45 proto_tree_add_item(bind_tree
, hf_zbee_zdp_bind_src64
, tvb
, *offset
, 8, ENC_LITTLE_ENDIAN
);
48 /* Add the source endpoint. */
49 proto_tree_add_item(bind_tree
, hf_zbee_zdp_bind_src_ep
, tvb
, *offset
+ len
, 1, ENC_LITTLE_ENDIAN
);
52 /* Add the cluster ID. */
53 if (version
>= ZBEE_VERSION_2007
) {
54 proto_tree_add_item(bind_tree
, hf_zbee_zdp_cluster
, tvb
, *offset
+ len
, 2, ENC_LITTLE_ENDIAN
);
58 proto_tree_add_item(bind_tree
, hf_zbee_zdp_cluster
, tvb
, *offset
+ len
, 1, ENC_LITTLE_ENDIAN
);
62 /* Get the destination address mode. */
63 if (version
>= ZBEE_VERSION_2007
) {
64 mode
= tvb_get_uint8(tvb
, *offset
+ len
);
65 proto_tree_add_item(bind_tree
, hf_zbee_zdp_addr_mode
, tvb
, *offset
+ len
, 1, ENC_LITTLE_ENDIAN
);
69 /* Mode field doesn't exist and always uses unicast in 2003 & earlier. */
70 mode
= ZBEE_ZDP_ADDR_MODE_UNICAST
;
73 /* Add the destination address. */
74 if (mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
75 proto_tree_add_item(bind_tree
, hf_zbee_zdp_bind_dst
, tvb
, *offset
+ len
, 2, ENC_LITTLE_ENDIAN
);
78 else if (mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) {
79 proto_tree_add_item(bind_tree
, hf_zbee_zdp_bind_dst64
, tvb
, *offset
+ len
, 8, ENC_LITTLE_ENDIAN
);
81 proto_tree_add_item(bind_tree
, hf_zbee_zdp_bind_dst_ep
, tvb
, *offset
+ len
, 1, ENC_LITTLE_ENDIAN
);
85 proto_item_set_len(ti
, len
);
87 } /* zdp_parse_bind_table_entry */
89 /**************************************
91 **************************************
94 *ZigBee Device Profile dissector for the end device bind
96 *@param tvb pointer to buffer containing raw packet.
97 *@param pinfo pointer to packet information fields
98 *@param tree pointer to data tree Wireshark uses to display packet.
101 dissect_zbee_zdp_req_end_device_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
103 unsigned sizeof_cluster
= (version
>= ZBEE_VERSION_2007
)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
105 proto_tree
*field_tree
= NULL
;
108 uint32_t target
, in_count
, out_count
;
109 uint64_t ext_addr
= 0;
111 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_target
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &target
);
113 if (version
>= ZBEE_VERSION_2007
) {
114 /* Extended address present on ZigBee 2006 & later. */
115 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (unsigned)sizeof(uint64_t), NULL
);
117 proto_tree_add_item(tree
, hf_zbee_zdp_endpoint
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
119 proto_tree_add_item(tree
, hf_zbee_zdp_profile
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
122 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_in_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &in_count
);
124 if ((tree
) && (in_count
)) {
125 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, (int)(in_count
*sizeof_cluster
),
126 ett_zbee_zdp_bind_end_in
, NULL
, "Input Cluster List");
128 for (i
=0; i
<in_count
; i
++) {
129 proto_tree_add_item(field_tree
, hf_zbee_zdp_in_cluster
, tvb
, offset
, sizeof_cluster
, ENC_LITTLE_ENDIAN
);
130 offset
+= sizeof_cluster
;
132 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_out_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &out_count
);
134 if ((tree
) && (out_count
)) {
135 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, (int)(out_count
*sizeof_cluster
),
136 ett_zbee_zdp_bind_end_out
, NULL
, "Output Cluster List");
138 for (i
=0; i
<out_count
; i
++) {
139 proto_tree_add_item(field_tree
, hf_zbee_zdp_out_cluster
, tvb
, offset
, sizeof_cluster
, ENC_LITTLE_ENDIAN
);
140 offset
+= sizeof_cluster
;
142 if (version
>= ZBEE_VERSION_2007
) {
143 zbee_append_info(tree
, pinfo
, " Src: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
145 zbee_append_info(tree
, pinfo
, ", Target: 0x%04x", target
);
147 /* Dump any leftover bytes. */
148 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
149 } /* dissect_zbee_zdp_req_end_device_bind */
152 *ZigBee Device Profile dissector for the bind request.
154 *@param tvb pointer to buffer containing raw packet.
155 *@param pinfo pointer to packet information fields
156 *@param tree pointer to data tree Wireshark uses to display packet.
159 dissect_zbee_zdp_req_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
162 unsigned sizeof_cluster
= ZBEE_HAS_2006(version
)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
165 uint32_t cluster
, dst_mode
, dst
;
169 src64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
170 proto_tree_add_item(tree
, hf_zbee_zdp_bind_src_ep
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
172 ti
= proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_cluster
, tvb
, offset
, sizeof_cluster
, ENC_LITTLE_ENDIAN
, &cluster
);
173 offset
+= sizeof_cluster
;
174 proto_item_append_text(ti
, " (%s)", rval_to_str_const(cluster
, zbee_aps_cid_names
, "Unknown Cluster"));
176 if (version
>= ZBEE_VERSION_2007
) {
177 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_addr_mode
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &dst_mode
);
181 /* ZigBee 2003 & earlier does not have a address mode, and is unicast only. */
182 dst_mode
= ZBEE_ZDP_ADDR_MODE_UNICAST
;
185 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
186 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_bind_dst
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &dst
);
189 else if (dst_mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) {
190 dst64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_dst64
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
191 proto_tree_add_item(tree
, hf_zbee_zdp_bind_dst_ep
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
195 zbee_append_info(tree
, pinfo
, ", %s (Cluster ID: 0x%04x)",
196 rval_to_str_const(cluster
, zbee_aps_cid_names
, "Unknown Cluster"),
199 if (version
>= ZBEE_VERSION_2007
) {
200 zbee_append_info(tree
, pinfo
, " Src: %s", eui64_to_display(pinfo
->pool
, src64
));
202 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
203 zbee_append_info(tree
, pinfo
, ", Dst: 0x%04x", dst
);
206 zbee_append_info(tree
, pinfo
, ", Dst: %s", eui64_to_display(pinfo
->pool
, dst64
));
209 /* Dump any leftover bytes. */
210 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
211 } /* dissect_zbee_zdp_req_bind */
214 *ZigBee Device Profile dissector for the unbind request.
216 *@param tvb pointer to buffer containing raw packet.
217 *@param pinfo pointer to packet information fields
218 *@param tree pointer to data tree Wireshark uses to display packet.
221 dissect_zbee_zdp_req_unbind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
224 unsigned sizeof_cluster
= (version
>= ZBEE_VERSION_2007
)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
228 uint32_t cluster
, dst_mode
, dst
= 0;
232 src64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
233 proto_tree_add_item(tree
, hf_zbee_zdp_bind_src_ep
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
235 ti
= proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_cluster
, tvb
, offset
, sizeof_cluster
, ENC_LITTLE_ENDIAN
, &cluster
);
236 offset
+= sizeof_cluster
;
237 proto_item_append_text(ti
, " (%s)", rval_to_str_const(cluster
, zbee_aps_cid_names
, "Unknown Cluster"));
239 if (version
>= ZBEE_VERSION_2007
) {
240 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_addr_mode
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &dst_mode
);
244 /* ZigBee 2003 & earlier does not have a address mode, and is unicast only. */
245 dst_mode
= ZBEE_ZDP_ADDR_MODE_UNICAST
;
248 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
249 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_bind_dst
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &dst
);
252 else if (dst_mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) {
253 dst64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_dst64
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
254 proto_tree_add_item(tree
, hf_zbee_zdp_bind_dst_ep
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
258 zbee_append_info(tree
, pinfo
, ", %s (Cluster ID: 0x%04x)",
259 rval_to_str_const(cluster
, zbee_aps_cid_names
, "Unknown Cluster"),
262 if (version
>= ZBEE_VERSION_2007
) {
263 zbee_append_info(tree
, pinfo
, " Src: %s", eui64_to_display(pinfo
->pool
, src64
));
265 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
266 zbee_append_info(tree
, pinfo
, ", Dst: 0x%04x", dst
);
269 zbee_append_info(tree
, pinfo
, ", Dst: %s", eui64_to_display(pinfo
->pool
, dst64
));
272 /* Dump any leftover bytes. */
273 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
274 } /* dissect_zbee_zdp_req_unbind */
277 *ZigBee Device Profile dissector for the bind register
279 *@param tvb pointer to buffer containing raw packet.
280 *@param pinfo pointer to packet information fields
281 *@param tree pointer to data tree Wireshark uses to display packet.
284 dissect_zbee_zdp_req_bind_register(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
289 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
291 zbee_append_info(tree
, pinfo
, ", Device: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
293 /* Dump any leftover bytes. */
294 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
295 } /* dissect_zbee_zdp_req_bind_register */
298 *ZigBee Device Profile dissector for the replace device
300 *@param tvb pointer to buffer containing raw packet.
301 *@param pinfo pointer to packet information fields
302 *@param tree pointer to data tree Wireshark uses to display packet.
305 dissect_zbee_zdp_req_replace_device(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
311 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
312 proto_tree_add_item(tree
, hf_zbee_zdp_endpoint
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
314 new_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_replacement
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
315 proto_tree_add_item(tree
, hf_zbee_zdp_replacement_ep
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
318 zbee_append_info(tree
, pinfo
, ", Device: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
319 zbee_append_info(tree
, pinfo
, ", Replacement: %s", eui64_to_display(pinfo
->pool
, new_addr
));
321 /* Dump any leftover bytes. */
322 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
323 } /* dissect_zbee_zdp_req_replace_device */
326 *ZigBee Device Profile dissector for the store backup binding
328 *@param tvb pointer to buffer containing raw packet.
329 *@param pinfo pointer to packet information fields
330 *@param tree pointer to data tree Wireshark uses to display packet.
333 dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
337 unsigned sizeof_cluster
= (version
>= ZBEE_VERSION_2007
)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
340 uint32_t src_ep
, cluster
, dst_mode
;
342 src64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
343 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_bind_src_ep
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &src_ep
);
345 ti
= proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_cluster
, tvb
, offset
, sizeof_cluster
, ENC_LITTLE_ENDIAN
, &cluster
);
346 offset
+= sizeof_cluster
;
347 proto_item_append_text(ti
, " (%s)", rval_to_str_const(cluster
, zbee_aps_cid_names
, "Unknown Cluster"));
348 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_addr_mode
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &dst_mode
);
351 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
352 proto_tree_add_item(tree
, hf_zbee_zdp_bind_dst
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
355 else if (dst_mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) {
358 /*dst64 =*/ zbee_parse_eui64(tree
, hf_zbee_zdp_bind_dst64
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
359 proto_tree_add_item(tree
, hf_zbee_zdp_bind_dst_ep
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
363 zbee_append_info(tree
, pinfo
, ", %s (Cluster ID: 0x%04x)", rval_to_str_const(cluster
, zbee_aps_cid_names
, "Unknown Cluster"), cluster
);
364 zbee_append_info(tree
, pinfo
, ", Src: %s", eui64_to_display(pinfo
->pool
, src64
));
365 zbee_append_info(tree
, pinfo
, ", Src Endpoint: %d", src_ep
);
367 /* Dump any leftover bytes. */
368 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
369 } /* dissect_zbee_zdp_req_store_bak_bind_entry */
372 *ZigBee Device Profile dissector for the remove backup binding
374 *@param tvb pointer to buffer containing raw packet.
375 *@param pinfo pointer to packet information fields
376 *@param tree pointer to data tree Wireshark uses to display packet.
379 dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
383 unsigned sizeof_cluster
= (version
>= ZBEE_VERSION_2007
)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
386 uint32_t src_ep
, cluster
, dst_mode
;
388 src64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
389 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_bind_src_ep
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &src_ep
);
391 ti
= proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_cluster
, tvb
, offset
, sizeof_cluster
, ENC_LITTLE_ENDIAN
, &cluster
);
392 offset
+= sizeof_cluster
;
393 proto_item_append_text(ti
, " (%s)", val_to_str_const(cluster
, zbee_zdp_cluster_names
, "Unknown Device Profile Cluster"));
394 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_addr_mode
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &dst_mode
);
397 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
398 proto_tree_add_item(tree
, hf_zbee_zdp_bind_dst
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
401 else if (dst_mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) {
404 /*dst64 =*/ zbee_parse_eui64(tree
, hf_zbee_zdp_bind_dst64
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
405 proto_tree_add_item(tree
, hf_zbee_zdp_bind_dst_ep
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
409 zbee_append_info(tree
, pinfo
, ", %s (Cluster ID: 0x%04x)", val_to_str_const(cluster
, zbee_zdp_cluster_names
, "Unknown Device Profile Cluster"), cluster
);
410 zbee_append_info(tree
, pinfo
, ", Src: %s", eui64_to_display(pinfo
->pool
, src64
));
411 zbee_append_info(tree
, pinfo
, ", Src Endpoint: %d", src_ep
);
413 /* Dump any leftover bytes. */
414 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
415 } /* dissect_zbee_zdp_req_remove_bak_bind_entry */
418 *ZigBee Device Profile dissector for the backup binding
420 *@param tvb pointer to buffer containing raw packet.
421 *@param pinfo pointer to packet information fields
422 *@param tree pointer to data tree Wireshark uses to display packet.
425 dissect_zbee_zdp_req_backup_bind_table(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
427 proto_tree
*field_tree
;
430 uint32_t i
, table_count
;
432 proto_tree_add_item(tree
, hf_zbee_zdp_table_size
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
434 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
436 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_table_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &table_count
);
439 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, -1, ett_zbee_zdp_bind
, NULL
, "Binding Table");
441 for (i
=0; i
<table_count
; i
++) {
442 zdp_parse_bind_table_entry(field_tree
, tvb
, &offset
, version
);
445 /* Dump any leftover bytes. */
446 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
447 } /* dissect_zbee_zdp_req_backup_bind_table */
450 *ZigBee Device Profile dissector for the recover binding
452 *@param tvb pointer to buffer containing raw packet.
453 *@param pinfo pointer to packet information fields
454 *@param tree pointer to data tree Wireshark uses to display packet.
457 dissect_zbee_zdp_req_recover_bind_table(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
461 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
464 /* Dump any leftover bytes. */
465 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
466 } /* dissect_zbee_zdp_req_recover_bind_table */
469 *ZigBee Device Profile dissector for the backup source binding
471 *@param tvb pointer to buffer containing raw packet.
472 *@param pinfo pointer to packet information fields
473 *@param tree pointer to data tree Wireshark uses to display packet.
476 dissect_zbee_zdp_req_backup_source_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
478 proto_tree
*field_tree
;
481 uint32_t i
, table_count
;
483 proto_tree_add_item(tree
, hf_zbee_zdp_table_size
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
485 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
487 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_table_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &table_count
);
490 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, table_count
*(int)sizeof(uint64_t),
491 ett_zbee_zdp_bind_source
, NULL
, "Source Table");
493 for (i
=0; i
<table_count
; i
++) zbee_parse_eui64(field_tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
495 /* Dump any leftover bytes. */
496 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
497 } /* dissect_zbee_zdp_req_backup_source_bind */
500 *ZigBee Device Profile dissector for the recover source
502 *@param tvb pointer to buffer containing raw packet.
503 *@param pinfo pointer to packet information fields
504 *@param tree pointer to data tree Wireshark uses to display packet.
507 dissect_zbee_zdp_req_recover_source_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
511 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
514 /* Dump any leftover bytes. */
515 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
516 } /* dissect_zbee_zdp_req_recover_source_bind */
519 *ZigBee Device Profile dissector for the clear all bindings request.
521 *@param tvb pointer to buffer containing raw packet.
522 *@param pinfo pointer to packet information fields
523 *@param tree pointer to data tree Wireshark uses to display packet.
526 dissect_zbee_zdp_req_clear_all_bindings(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
530 offset
= dissect_zbee_tlvs(tvb
, pinfo
, tree
, offset
, NULL
, ZBEE_TLV_SRC_TYPE_ZBEE_ZDP
, ZBEE_ZDP_REQ_CLEAR_ALL_BINDINGS
);
532 /* Dump any leftover bytes. */
533 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
537 *ZigBee Device Profile dissector for the clear all bindings response.
539 *@param tvb pointer to buffer containing raw packet.
540 *@param pinfo pointer to packet information fields
541 *@param tree pointer to data tree Wireshark uses to display packet.
544 dissect_zbee_zdp_rsp_clear_all_bindings(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
549 status
= zdp_parse_status(tree
, tvb
, &offset
);
550 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
552 /* Dump any leftover bytes. */
553 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
554 } /* dissect_zbee_zdp_rsp_clear_all_bindings */
556 /**************************************
558 **************************************
561 *ZigBee Device Profile dissector for the end device bind
563 *@param tvb pointer to buffer containing raw packet.
564 *@param pinfo pointer to packet information fields
565 *@param tree pointer to data tree Wireshark uses to display packet.
568 dissect_zbee_zdp_rsp_end_device_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
573 status
= zdp_parse_status(tree
, tvb
, &offset
);
575 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
577 /* Dump any leftover bytes. */
578 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
579 } /* dissect_zbee_zdp_rsp_end_device_bind */
582 *ZigBee Device Profile dissector for the bind response.
584 *@param tvb pointer to buffer containing raw packet.
585 *@param pinfo pointer to packet information fields
586 *@param tree pointer to data tree Wireshark uses to display packet.
589 dissect_zbee_zdp_rsp_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
594 status
= zdp_parse_status(tree
, tvb
, &offset
);
596 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
598 /* Dump any leftover bytes. */
599 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
600 } /* dissect_zbee_zdp_rsp_bind */
603 *ZigBee Device Profile dissector for the unbind response.
605 *@param tvb pointer to buffer containing raw packet.
606 *@param pinfo pointer to packet information fields
607 *@param tree pointer to data tree Wireshark uses to display packet.
610 dissect_zbee_zdp_rsp_unbind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
615 status
= zdp_parse_status(tree
, tvb
, &offset
);
617 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
619 /* Dump any leftover bytes. */
620 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
621 } /* dissect_zbee_zdp_rsp_unbind */
624 *ZigBee Device Profile dissector for the bind registration
626 *@param tvb pointer to buffer containing raw packet.
627 *@param pinfo pointer to packet information fields
628 *@param tree pointer to data tree Wireshark uses to display packet.
631 dissect_zbee_zdp_rsp_bind_register(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
633 proto_tree
*field_tree
= NULL
;
637 uint32_t i
, table_count
;
639 status
= zdp_parse_status(tree
, tvb
, &offset
);
641 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 2))) {
642 proto_tree_add_item(tree
, hf_zbee_zdp_table_size
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
644 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_table_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &table_count
);
647 if (tree
&& table_count
) {
648 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, -1, ett_zbee_zdp_bind
, NULL
, "Binding List");
650 for (i
=0; i
<table_count
; i
++) {
651 zdp_parse_bind_table_entry(field_tree
, tvb
, &offset
, version
);
655 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
657 /* Dump any leftover bytes. */
658 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
659 } /* dissect_zbee_zdp_rsp_bind_register */
662 *ZigBee Device Profile dissector for the device replacement
664 *@param tvb pointer to buffer containing raw packet.
665 *@param pinfo pointer to packet information fields
666 *@param tree pointer to data tree Wireshark uses to display packet.
669 dissect_zbee_zdp_rsp_replace_device(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
674 status
= zdp_parse_status(tree
, tvb
, &offset
);
676 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
678 /* Dump any leftover bytes. */
679 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
680 } /* dissect_zbee_zdp_rsp_replace_device */
683 *ZigBee Device Profile dissector for the store backup binding
685 *@param tvb pointer to buffer containing raw packet.
686 *@param pinfo pointer to packet information fields
687 *@param tree pointer to data tree Wireshark uses to display packet.
690 dissect_zbee_zdp_rsp_store_bak_bind_entry(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
695 status
= zdp_parse_status(tree
, tvb
, &offset
);
697 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
699 /* Dump any leftover bytes. */
700 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
701 } /* dissect_zbee_zdp_rsp_store_bak_bind_entry */
704 *ZigBee Device Profile dissector for the remove backup binding
706 *@param tvb pointer to buffer containing raw packet.
707 *@param pinfo pointer to packet information fields
708 *@param tree pointer to data tree Wireshark uses to display packet.
711 dissect_zbee_zdp_rsp_remove_bak_bind_entry(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
716 status
= zdp_parse_status(tree
, tvb
, &offset
);
718 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
720 /* Dump any leftover bytes. */
721 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
722 } /* dissect_zbee_zdp_rsp_remove_bak_bind_entry */
725 *ZigBee Device Profile dissector for the backup binding
727 *@param tvb pointer to buffer containing raw packet.
728 *@param pinfo pointer to packet information fields
729 *@param tree pointer to data tree Wireshark uses to display packet.
732 dissect_zbee_zdp_rsp_backup_bind_table(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
737 status
= zdp_parse_status(tree
, tvb
, &offset
);
738 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 2))) {
739 proto_tree_add_item(tree
, hf_zbee_zdp_table_size
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
743 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
745 /* Dump any leftover bytes. */
746 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
747 } /* dissect_zbee_zdp_rsp_backup_bind_table */
750 *ZigBee Device Profile dissector for the recover binding
752 *@param tvb pointer to buffer containing raw packet.
753 *@param pinfo pointer to packet information fields
754 *@param tree pointer to data tree Wireshark uses to display packet.
757 dissect_zbee_zdp_rsp_recover_bind_table(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
759 proto_tree
*field_tree
= NULL
;
762 uint32_t i
, table_count
;
764 status
= zdp_parse_status(tree
, tvb
, &offset
);
765 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 2))) {
766 proto_tree_add_item(tree
, hf_zbee_zdp_table_size
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
768 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
770 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_table_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &table_count
);
773 if (tree
&& table_count
) {
774 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, -1, ett_zbee_zdp_bind
, NULL
, "Binding Table");
776 for (i
=0; i
<table_count
; i
++) {
777 zdp_parse_bind_table_entry(field_tree
, tvb
, &offset
, version
);
781 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
783 /* Dump any leftover bytes. */
784 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
785 } /* dissect_zbee_zdp_rsp_recover_bind_table */
788 *ZigBee Device Profile dissector for the backup source binding
790 *@param tvb pointer to buffer containing raw packet.
791 *@param pinfo pointer to packet information fields
792 *@param tree pointer to data tree Wireshark uses to display packet.
795 dissect_zbee_zdp_rsp_backup_source_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
800 status
= zdp_parse_status(tree
, tvb
, &offset
);
802 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
804 /* Dump any leftover bytes. */
805 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
806 } /* dissect_zbee_zdp_rsp_backup_source_bind */
809 *ZigBee Device Profile dissector for the recover source binding
811 *@param tvb pointer to buffer containing raw packet.
812 *@param pinfo pointer to packet information fields
813 *@param tree pointer to data tree Wireshark uses to display packet.
816 dissect_zbee_zdp_rsp_recover_source_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
818 proto_tree
*field_tree
= NULL
;
822 uint32_t i
, table_count
;
824 status
= zdp_parse_status(tree
, tvb
, &offset
);
826 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 2))) {
827 proto_tree_add_item(tree
, hf_zbee_zdp_table_size
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
829 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
831 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_table_count
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &table_count
);
834 if (tree
&& table_count
) {
835 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, table_count
* (int)sizeof(uint64_t),
836 ett_zbee_zdp_bind_source
, NULL
, "Source Table");
839 for (i
=0; i
<table_count
; i
++) {
840 (void)zbee_parse_eui64(field_tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
844 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
846 /* Dump any leftover bytes. */
847 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
848 } /* dissect_zbee_zdp_rsp_recover_source_bind */
851 * Editor modelines - https://www.wireshark.org/tools/modelines.html
856 * indent-tabs-mode: nil
859 * vi: set shiftwidth=4 tabstop=8 expandtab:
860 * :indentSize=4:tabSize=8:noTabs=true: