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
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include <epan/packet.h>
33 #include <epan/addr_resolv.h>
35 #include "packet-zbee.h"
36 #include "packet-zbee-zdp.h"
39 /**************************************
41 **************************************
43 /*FUNCTION:------------------------------------------------------
45 * zdp_parse_bind_table_entry
47 * Parses and displays a single binding table entry.
49 * tvbuff_t *tvb - pointer to buffer containing raw packet.
50 * packet_into *pinfo - pointer to packet information fields
51 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
54 *---------------------------------------------------------------
57 zdp_parse_bind_table_entry(proto_tree
*tree
, tvbuff_t
*tvb
, guint
*offset
, guint8 version
)
59 proto_item
*ti
= NULL
;
70 /* Add the source address. */
71 src64
= tvb_get_letoh64(tvb
, *offset
+ len
);
72 if (tree
) ti
= proto_tree_add_text(tree
, tvb
, *offset
, 0, "Bind {Src: %s", get_eui64_name(src64
));
73 len
+= (int)sizeof(guint64
);
75 /* Add the source endpoint. */
76 src_ep
= tvb_get_guint8(tvb
, *offset
+ len
);
77 if (tree
) proto_item_append_text(ti
, ", Src Endpoint: %d", src_ep
);
78 len
+= (int)sizeof(guint8
);
80 /* Add the cluster ID. */
81 if (version
>= ZBEE_VERSION_2007
) {
82 cluster
= tvb_get_letohs(tvb
, *offset
+ len
);
83 len
+= (int)sizeof(guint16
);
86 cluster
= tvb_get_guint8(tvb
, *offset
+ len
);
87 len
+= (int)sizeof(guint8
);
89 if (tree
) proto_item_append_text(ti
, ", Cluster: %d", cluster
);
91 /* Get the destination address mode. */
92 if (version
>= ZBEE_VERSION_2007
) {
93 mode
= tvb_get_guint8(tvb
, *offset
+ len
);
94 len
+= (int)sizeof(guint8
);
97 /* Mode field doesn't exist and always uses unicast in 2003 & earlier. */
98 mode
= ZBEE_ZDP_ADDR_MODE_UNICAST
;
101 /* Add the destination address. */
102 if (mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
103 dst
= tvb_get_letohs(tvb
, *offset
+ len
);
104 if (tree
) proto_item_append_text(ti
, ", Dst: 0x%04x}", dst
);
105 len
+= (int)sizeof(guint16
);
107 else if (mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) {
108 dst64
= tvb_get_letoh64(tvb
, *offset
+ len
);
109 if (tree
) proto_item_append_text(ti
, ", Dst: %s", get_eui64_name(dst64
));
110 len
+= (int)sizeof(guint64
);
112 dst_ep
= tvb_get_guint8(tvb
, *offset
+ len
);
113 if (tree
) proto_item_append_text(ti
, ", Dst Endpoint: %d}", dst_ep
);
114 len
+= (int)sizeof(guint8
);
117 if (tree
) proto_item_append_text(ti
, "}");
121 proto_item_set_len(ti
, len
);
124 } /* zdp_parse_bind_table_entry */
126 /**************************************
128 **************************************
130 /*FUNCTION:------------------------------------------------------
132 * dissect_zbee_zdp_req_end_device_bind
134 * ZigBee Device Profile dissector for the end device bind
135 * request. Cluster ID = 0x0020.
137 * tvbuff_t *tvb - pointer to buffer containing raw packet.
138 * packet_into *pinfo - pointer to packet information fields
139 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
142 *---------------------------------------------------------------
145 dissect_zbee_zdp_req_end_device_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
147 guint sizeof_cluster
= (version
>= ZBEE_VERSION_2007
)?(int)sizeof(guint16
):(int)sizeof(guint8
);
150 proto_tree
*field_tree
= NULL
;
154 guint64 ext_addr
= 0;
160 target
= zbee_parse_uint(tree
, hf_zbee_zdp_target
, tvb
, &offset
, (guint
)sizeof(guint16
), NULL
);
161 if (version
>= ZBEE_VERSION_2007
) {
162 /* Extended address present on ZigBee 2006 & later. */
163 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (guint
)sizeof(guint64
), NULL
);
165 /*src_ep =*/ zbee_parse_uint(tree
, hf_zbee_zdp_endpoint
, tvb
, &offset
, (guint
)sizeof(guint8
), NULL
);
166 /*profile =*/ zbee_parse_uint(tree
, hf_zbee_zdp_profile
, tvb
, &offset
, (guint
)sizeof(guint16
), NULL
);
168 in_count
= zbee_parse_uint(tree
, hf_zbee_zdp_in_count
, tvb
, &offset
, (guint
)sizeof(guint8
), NULL
);
169 if ((tree
) && (in_count
)){
170 ti
= proto_tree_add_text(tree
, tvb
, offset
, (int)(in_count
*sizeof_cluster
), "Input Cluster List");
171 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_bind_end_in
);
173 for (i
=0; i
<in_count
; i
++) zbee_parse_uint(field_tree
, hf_zbee_zdp_in_cluster
, tvb
, &offset
, (guint
)sizeof_cluster
, NULL
);
175 out_count
= zbee_parse_uint(tree
, hf_zbee_zdp_out_count
, tvb
, &offset
, (guint
)sizeof(guint8
), NULL
);
176 if ((tree
) && (out_count
)) {
177 ti
= proto_tree_add_text(tree
, tvb
, offset
, (int)(out_count
*sizeof_cluster
), "Output Cluster List");
178 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_bind_end_out
);
180 for (i
=0; i
<out_count
; i
++) zbee_parse_uint(field_tree
, hf_zbee_zdp_out_cluster
, tvb
, &offset
, sizeof_cluster
, NULL
);
182 if (version
>= ZBEE_VERSION_2007
) {
183 zbee_append_info(tree
, pinfo
, " Src: %s", get_eui64_name(ext_addr
));
185 zbee_append_info(tree
, pinfo
, ", Target: 0x%04x", target
);
187 /* Dump any leftover bytes. */
188 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
189 } /* dissect_zbee_zdp_req_end_device_bind */
191 /*FUNCTION:------------------------------------------------------
193 * dissect_zbee_zdp_req_bind
195 * ZigBee Device Profile dissector for the bind request.
196 * Cluster ID = 0x0021.
198 * tvbuff_t *tvb - pointer to buffer containing raw packet.
199 * packet_into *pinfo - pointer to packet information fields
200 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
203 *---------------------------------------------------------------
206 dissect_zbee_zdp_req_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
219 src64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
220 /*src_ep =*/ zbee_parse_uint(tree
, hf_zbee_zdp_bind_src_ep
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
221 /*cluster =*/ zbee_parse_uint(tree
, hf_zbee_zdp_cluster
, tvb
, &offset
, ZBEE_HAS_2006(version
)?(int)sizeof(guint16
):(int)sizeof(guint8
), NULL
);
222 if (version
>= ZBEE_VERSION_2007
) {
223 dst_mode
= zbee_parse_uint(tree
, hf_zbee_zdp_addr_mode
, tvb
, &offset
, (int)sizeof(guint8
), &ti
);
225 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) proto_item_append_text(ti
, " (Group)");
226 else if (dst_mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) proto_item_append_text(ti
, " (Unicast)");
227 else proto_item_append_text(ti
, " (Reserved)");
231 /* ZigBee 2003 & earlier does not have a address mode, and is unicast only. */
232 dst_mode
= ZBEE_ZDP_ADDR_MODE_UNICAST
;
235 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
236 dst
= zbee_parse_uint(tree
, hf_zbee_zdp_bind_dst
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
238 else if (dst_mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) {
239 dst64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_dst64
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
240 /*dst_ep =*/ zbee_parse_uint(tree
, hf_zbee_zdp_bind_dst_ep
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
243 if (version
>= ZBEE_VERSION_2007
) {
244 zbee_append_info(tree
, pinfo
, " Src: %s", get_eui64_name(src64
));
246 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
247 zbee_append_info(tree
, pinfo
, ", Dst: 0x%04x", dst
);
250 zbee_append_info(tree
, pinfo
, ", Dst: %s", eui64_to_str(dst64
));
253 /* Dump any leftover bytes. */
254 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
255 } /* dissect_zbee_zdp_req_bind */
257 /*FUNCTION:------------------------------------------------------
259 * dissect_zbee_zdp_req_unbind
261 * ZigBee Device Profile dissector for the unbind request.
262 * Cluster ID = 0x0022.
264 * tvbuff_t *tvb - pointer to buffer containing raw packet.
265 * packet_into *pinfo - pointer to packet information fields
266 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
269 *---------------------------------------------------------------
272 dissect_zbee_zdp_req_unbind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
285 src64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
286 /*src_ep =*/ zbee_parse_uint(tree
, hf_zbee_zdp_bind_src_ep
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
287 /*cluster =*/ zbee_parse_uint(tree
, hf_zbee_zdp_cluster
, tvb
, &offset
, (version
>= ZBEE_VERSION_2007
)?(int)sizeof(guint16
):(int)sizeof(guint8
), NULL
);
288 if (version
>= ZBEE_VERSION_2007
) {
289 dst_mode
= zbee_parse_uint(tree
, hf_zbee_zdp_addr_mode
, tvb
, &offset
, (int)sizeof(guint8
), &ti
);
291 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) proto_item_append_text(ti
, " (Group)");
292 else if (dst_mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) proto_item_append_text(ti
, " (Unicast)");
293 else proto_item_append_text(ti
, " (Reserved)");
297 /* ZigBee 2003 & earlier does not have a address mode, and is unicast only. */
298 dst_mode
= ZBEE_ZDP_ADDR_MODE_UNICAST
;
301 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
302 dst
= zbee_parse_uint(tree
, hf_zbee_zdp_bind_dst
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
304 else if (dst_mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) {
305 dst64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_dst64
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
306 /*dst_ep =*/ zbee_parse_uint(tree
, hf_zbee_zdp_bind_dst_ep
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
309 if (version
>= ZBEE_VERSION_2007
) {
310 zbee_append_info(tree
, pinfo
, " Src: %s", get_eui64_name(src64
));
312 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
313 zbee_append_info(tree
, pinfo
, ", Dst: 0x%04x", dst
);
316 zbee_append_info(tree
, pinfo
, ", Dst: %s", eui64_to_str(dst64
));
319 /* Dump any leftover bytes. */
320 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
321 } /* dissect_zbee_zdp_req_unbind */
323 /*FUNCTION:------------------------------------------------------
325 * dissect_zbee_zdp_req_bind_register
327 * ZigBee Device Profile dissector for the bind register
328 * request. Cluster ID = 0x0023.
330 * tvbuff_t *tvb - pointer to buffer containing raw packet.
331 * packet_into *pinfo - pointer to packet information fields
332 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
335 *---------------------------------------------------------------
338 dissect_zbee_zdp_req_bind_register(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
343 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
345 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
347 /* Dump any leftover bytes. */
348 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
349 } /* dissect_zbee_zdp_req_bind_register */
351 /*FUNCTION:------------------------------------------------------
353 * dissect_zbee_zdp_req_replace_device
355 * ZigBee Device Profile dissector for the replace device
356 * request. Cluster ID = 0x0024.
358 * tvbuff_t *tvb - pointer to buffer containing raw packet.
359 * packet_into *pinfo - pointer to packet information fields
360 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
363 *---------------------------------------------------------------
366 dissect_zbee_zdp_req_replace_device(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
374 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
375 /*endpoint =*/ zbee_parse_uint(tree
, hf_zbee_zdp_endpoint
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
376 new_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_replacement
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
377 /*new_ep =*/ zbee_parse_uint(tree
, hf_zbee_zdp_replacement_ep
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
379 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
380 zbee_append_info(tree
, pinfo
, ", Replacement: %s", get_eui64_name(new_addr
));
382 /* Dump any leftover bytes. */
383 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
384 } /* dissect_zbee_zdp_req_replace_device */
386 /*FUNCTION:------------------------------------------------------
388 * dissect_zbee_zdp_req_store_bak_bind_entry
390 * ZigBee Device Profile dissector for the store backup binding
391 * entry request. Cluster ID = 0x0025.
393 * tvbuff_t *tvb - pointer to buffer containing raw packet.
394 * packet_into *pinfo - pointer to packet information fields
395 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
398 *---------------------------------------------------------------
401 dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
411 src64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
412 src_ep
= zbee_parse_uint(tree
, hf_zbee_zdp_bind_src_ep
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
413 cluster
= zbee_parse_uint(tree
, hf_zbee_zdp_cluster
, tvb
, &offset
, (version
>= ZBEE_VERSION_2007
)?(int)sizeof(guint16
):(int)sizeof(guint8
), NULL
);
414 dst_mode
= zbee_parse_uint(tree
, hf_zbee_zdp_addr_mode
, tvb
, &offset
, (int)sizeof(guint8
), &ti
);
416 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
418 if (tree
) proto_item_append_text(ti
, " (Group)");
419 /*dst =*/ zbee_parse_uint(tree
, hf_zbee_zdp_bind_dst
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
421 else if (dst_mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) {
424 if (tree
) proto_item_append_text(ti
, " (Unicast)");
425 /*dst64 =*/ zbee_parse_eui64(tree
, hf_zbee_zdp_bind_dst64
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
426 /*dst_ep =*/ zbee_parse_uint(tree
, hf_zbee_zdp_bind_dst_ep
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
428 else if (tree
) proto_item_append_text(ti
, " (Reserved)");
430 zbee_append_info(tree
, pinfo
, ", Src: %s", get_eui64_name(src64
));
431 zbee_append_info(tree
, pinfo
, ", Src Endpoint: %d", src_ep
);
432 zbee_append_info(tree
, pinfo
, ", Cluster: %d", cluster
);
434 /* Dump any leftover bytes. */
435 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
436 } /* dissect_zbee_zdp_req_store_bak_bind_entry */
438 /*FUNCTION:------------------------------------------------------
440 * dissect_zbee_zdp_req_remove_bak_bind_entry
442 * ZigBee Device Profile dissector for the remove backup binding
443 * entry request. Cluster ID = 0x0026.
445 * tvbuff_t *tvb - pointer to buffer containing raw packet.
446 * packet_into *pinfo - pointer to packet information fields
447 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
450 *---------------------------------------------------------------
453 dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
463 src64
= zbee_parse_eui64(tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
464 src_ep
= zbee_parse_uint(tree
, hf_zbee_zdp_bind_src_ep
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
465 cluster
= zbee_parse_uint(tree
, hf_zbee_zdp_cluster
, tvb
, &offset
, (version
>= ZBEE_VERSION_2007
)?(int)sizeof(guint16
):(int)sizeof(guint8
), NULL
);
466 dst_mode
= zbee_parse_uint(tree
, hf_zbee_zdp_addr_mode
, tvb
, &offset
, (int)sizeof(guint8
), &ti
);
468 if (dst_mode
== ZBEE_ZDP_ADDR_MODE_GROUP
) {
470 if (tree
) proto_item_append_text(ti
, " (Group)");
471 /*dst =*/ zbee_parse_uint(tree
, hf_zbee_zdp_bind_dst
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
473 else if (dst_mode
== ZBEE_ZDP_ADDR_MODE_UNICAST
) {
476 if (tree
) proto_item_append_text(ti
, " (Unicast)");
477 /*dst64 =*/ zbee_parse_eui64(tree
, hf_zbee_zdp_bind_dst64
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
478 /*dst_ep =*/ zbee_parse_uint(tree
, hf_zbee_zdp_bind_dst_ep
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
480 else if (tree
) proto_item_append_text(ti
, " (Reserved)");
482 zbee_append_info(tree
, pinfo
, ", Src: %s", get_eui64_name(src64
));
483 zbee_append_info(tree
, pinfo
, ", Src Endpoint: %d", src_ep
);
484 zbee_append_info(tree
, pinfo
, ", Cluster: %d", cluster
);
486 /* Dump any leftover bytes. */
487 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
488 } /* dissect_zbee_zdp_req_remove_bak_bind_entry */
490 /*FUNCTION:------------------------------------------------------
492 * dissect_zbee_zdp_req_backup_bind_table
494 * ZigBee Device Profile dissector for the backup binding
495 * table request. Cluster ID = 0x0027.
497 * tvbuff_t *tvb - pointer to buffer containing raw packet.
498 * packet_into *pinfo - pointer to packet information fields
499 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
502 *---------------------------------------------------------------
505 dissect_zbee_zdp_req_backup_bind_table(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
508 proto_tree
*field_tree
= NULL
;
512 /*guint16 table_size;*/
516 /*table_size =*/ zbee_parse_uint(tree
, hf_zbee_zdp_table_size
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
517 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
518 table_count
= zbee_parse_uint(tree
, hf_zbee_zdp_table_count
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
521 ti
= proto_tree_add_text(tree
, tvb
, offset
, tvb_length_remaining(tvb
, offset
), "Binding Table");
522 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_bind
);
524 for (i
=0; i
<table_count
; i
++) {
525 zdp_parse_bind_table_entry(field_tree
, tvb
, &offset
, version
);
528 /* Dump any leftover bytes. */
529 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
530 } /* dissect_zbee_zdp_req_backup_bind_table */
532 /*FUNCTION:------------------------------------------------------
534 * dissect_zbee_zdp_req_recover_bind_table
536 * ZigBee Device Profile dissector for the recover binding
537 * table request. Cluster ID = 0x0028.
539 * tvbuff_t *tvb - pointer to buffer containing raw packet.
540 * packet_into *pinfo - pointer to packet information fields
541 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
544 *---------------------------------------------------------------
547 dissect_zbee_zdp_req_recover_bind_table(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
552 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
554 /* Dump any leftover bytes. */
555 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
556 } /* dissect_zbee_zdp_req_recover_bind_table */
558 /*FUNCTION:------------------------------------------------------
560 * dissect_zbee_zdp_req_backup_source_bind
562 * ZigBee Device Profile dissector for the backup source binding
563 * request. Cluster ID = 0x0029.
565 * tvbuff_t *tvb - pointer to buffer containing raw packet.
566 * packet_into *pinfo - pointer to packet information fields
567 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
570 *---------------------------------------------------------------
573 dissect_zbee_zdp_req_backup_source_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
576 proto_tree
*field_tree
= NULL
;
584 /*entries =*/ zbee_parse_uint(tree
, hf_zbee_zdp_table_size
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
585 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
586 count
= zbee_parse_uint(tree
, hf_zbee_zdp_table_count
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
589 ti
= proto_tree_add_text(tree
, tvb
, offset
, count
*(int)sizeof(guint64
), "Source Table");
590 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_bind_source
);
592 for (i
=0; i
<count
; i
++) zbee_parse_eui64(field_tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
594 /* Dump any leftover bytes. */
595 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
596 } /* dissect_zbee_zdp_req_backup_source_bind */
598 /*FUNCTION:------------------------------------------------------
600 * dissect_zbee_zdp_req_recover_source_bind
602 * ZigBee Device Profile dissector for the recover source
603 * binding request. Cluster ID = 0x002a.
605 * tvbuff_t *tvb - pointer to buffer containing raw packet.
606 * packet_into *pinfo - pointer to packet information fields
607 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
610 *---------------------------------------------------------------
613 dissect_zbee_zdp_req_recover_source_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
618 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
620 /* Dump any leftover bytes. */
621 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
622 } /* dissect_zbee_zdp_req_recover_source_bind */
624 /**************************************
626 **************************************
628 /*FUNCTION:------------------------------------------------------
630 * dissect_zbee_zdp_rsp_end_device_bind
632 * ZigBee Device Profile dissector for the end device bind
633 * response. Cluster ID = 0x8020.
635 * tvbuff_t *tvb - pointer to buffer containing raw packet.
636 * packet_into *pinfo - pointer to packet information fields
637 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
640 *---------------------------------------------------------------
643 dissect_zbee_zdp_rsp_end_device_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
648 status
= zdp_parse_status(tree
, tvb
, &offset
);
650 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
652 /* Dump any leftover bytes. */
653 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
654 } /* dissect_zbee_zdp_rsp_end_device_bind */
656 /*FUNCTION:------------------------------------------------------
658 * dissect_zbee_zdp_rsp_bind
660 * ZigBee Device Profile dissector for the bind response.
661 * Cluster ID = 0x8021.
663 * tvbuff_t *tvb - pointer to buffer containing raw packet.
664 * packet_into *pinfo - pointer to packet information fields
665 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
668 *---------------------------------------------------------------
671 dissect_zbee_zdp_rsp_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
676 status
= zdp_parse_status(tree
, tvb
, &offset
);
678 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
680 /* Dump any leftover bytes. */
681 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
682 } /* dissect_zbee_zdp_rsp_bind */
684 /*FUNCTION:------------------------------------------------------
686 * dissect_zbee_zdp_rsp_unbind
688 * ZigBee Device Profile dissector for the unbind response.
689 * Cluster ID = 0x8022.
691 * tvbuff_t *tvb - pointer to buffer containing raw packet.
692 * packet_into *pinfo - pointer to packet information fields
693 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
696 *---------------------------------------------------------------
699 dissect_zbee_zdp_rsp_unbind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
704 status
= zdp_parse_status(tree
, tvb
, &offset
);
706 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
708 /* Dump any leftover bytes. */
709 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
710 } /* dissect_zbee_zdp_rsp_unbind */
712 /*FUNCTION:------------------------------------------------------
714 * dissect_zbee_zdp_rsp_bind_register
716 * ZigBee Device Profile dissector for the bind registration
717 * response. Cluster ID = 0x8023.
719 * tvbuff_t *tvb - pointer to buffer containing raw packet.
720 * packet_into *pinfo - pointer to packet information fields
721 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
724 *---------------------------------------------------------------
727 dissect_zbee_zdp_rsp_bind_register(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
730 proto_tree
*field_tree
= NULL
;
735 /*guint16 table_size;*/
738 status
= zdp_parse_status(tree
, tvb
, &offset
);
739 /*table_size =*/ zbee_parse_uint(tree
, hf_zbee_zdp_table_size
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
740 table_count
= zbee_parse_uint(tree
, hf_zbee_zdp_table_count
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
742 if (tree
&& table_count
) {
743 ti
= proto_tree_add_text(tree
, tvb
, offset
, tvb_length_remaining(tvb
, offset
), "Binding List");
744 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_bind
);
746 for (i
=0; i
<table_count
; i
++) {
747 zdp_parse_bind_table_entry(field_tree
, tvb
, &offset
, version
);
750 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
752 /* Dump any leftover bytes. */
753 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
754 } /* dissect_zbee_zdp_rsp_bind_register */
756 /*FUNCTION:------------------------------------------------------
758 * dissect_zbee_zdp_rsp_replace_device
760 * ZigBee Device Profile dissector for the device replacement
761 * response. Cluster ID = 0x8024.
763 * tvbuff_t *tvb - pointer to buffer containing raw packet.
764 * packet_into *pinfo - pointer to packet information fields
765 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
768 *---------------------------------------------------------------
771 dissect_zbee_zdp_rsp_replace_device(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
776 status
= zdp_parse_status(tree
, tvb
, &offset
);
778 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
780 /* Dump any leftover bytes. */
781 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
782 } /* dissect_zbee_zdp_rsp_replace_device */
784 /*FUNCTION:------------------------------------------------------
786 * dissect_zbee_zdp_rsp_store_bak_bind_entry
788 * ZigBee Device Profile dissector for the store backup binding
789 * table entry response. Cluster ID = 0x8025.
791 * tvbuff_t *tvb - pointer to buffer containing raw packet.
792 * packet_into *pinfo - pointer to packet information fields
793 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
796 *---------------------------------------------------------------
799 dissect_zbee_zdp_rsp_store_bak_bind_entry(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
804 status
= zdp_parse_status(tree
, tvb
, &offset
);
806 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
808 /* Dump any leftover bytes. */
809 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
810 } /* dissect_zbee_zdp_rsp_store_bak_bind_entry */
812 /*FUNCTION:------------------------------------------------------
814 * dissect_zbee_zdp_rsp_remove_bak_bind_entry
816 * ZigBee Device Profile dissector for the remove backup binding
817 * table entry response. Cluster ID = 0x8026.
819 * tvbuff_t *tvb - pointer to buffer containing raw packet.
820 * packet_into *pinfo - pointer to packet information fields
821 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
824 *---------------------------------------------------------------
827 dissect_zbee_zdp_rsp_remove_bak_bind_entry(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
832 status
= zdp_parse_status(tree
, tvb
, &offset
);
834 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
836 /* Dump any leftover bytes. */
837 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
838 } /* dissect_zbee_zdp_rsp_remove_bak_bind_entry */
840 /*FUNCTION:------------------------------------------------------
842 * dissect_zbee_zdp_rsp_backup_bind_table
844 * ZigBee Device Profile dissector for the backup binding
845 * table response. Cluster ID = 0x8027.
847 * tvbuff_t *tvb - pointer to buffer containing raw packet.
848 * packet_into *pinfo - pointer to packet information fields
849 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
852 *---------------------------------------------------------------
855 dissect_zbee_zdp_rsp_backup_bind_table(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
861 status
= zdp_parse_status(tree
, tvb
, &offset
);
862 /*count =*/ zbee_parse_uint(tree
, hf_zbee_zdp_table_size
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
864 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
866 /* Dump any leftover bytes. */
867 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
868 } /* dissect_zbee_zdp_rsp_backup_bind_table */
870 /*FUNCTION:------------------------------------------------------
872 * dissect_zbee_zdp_rsp_recover_bind_table
874 * ZigBee Device Profile dissector for the recover binding
875 * table response. Cluster ID = 0x8028.
877 * tvbuff_t *tvb - pointer to buffer containing raw packet.
878 * packet_into *pinfo - pointer to packet information fields
879 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
882 *---------------------------------------------------------------
885 dissect_zbee_zdp_rsp_recover_bind_table(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
888 proto_tree
*field_tree
= NULL
;
893 /*guint16 table_size;*/
897 status
= zdp_parse_status(tree
, tvb
, &offset
);
898 /*table_size =*/ zbee_parse_uint(tree
, hf_zbee_zdp_table_size
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
899 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
900 table_count
= zbee_parse_uint(tree
, hf_zbee_zdp_table_count
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
902 if (tree
&& table_count
) {
903 ti
= proto_tree_add_text(tree
, tvb
, offset
, tvb_length_remaining(tvb
, offset
), "Binding Table");
904 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_bind
);
906 for (i
=0; i
<table_count
; i
++) {
907 zdp_parse_bind_table_entry(field_tree
, tvb
, &offset
, version
);
910 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
912 /* Dump any leftover bytes. */
913 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
914 } /* dissect_zbee_zdp_rsp_recover_bind_table */
916 /*FUNCTION:------------------------------------------------------
918 * dissect_zbee_zdp_rsp_backup_source_bind
920 * ZigBee Device Profile dissector for the backup source binding
921 * response. Cluster ID = 0x8029.
923 * tvbuff_t *tvb - pointer to buffer containing raw packet.
924 * packet_into *pinfo - pointer to packet information fields
925 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
928 *---------------------------------------------------------------
931 dissect_zbee_zdp_rsp_backup_source_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
936 status
= zdp_parse_status(tree
, tvb
, &offset
);
938 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
940 /* Dump any leftover bytes. */
941 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
942 } /* dissect_zbee_zdp_rsp_backup_source_bind */
944 /*FUNCTION:------------------------------------------------------
946 * dissect_zbee_zdp_rsp_recover_source_bind
948 * ZigBee Device Profile dissector for the recover source binding
949 * response. Cluster ID = 0x8029.
951 * tvbuff_t *tvb - pointer to buffer containing raw packet.
952 * packet_into *pinfo - pointer to packet information fields
953 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
956 *---------------------------------------------------------------
959 dissect_zbee_zdp_rsp_recover_source_bind(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
962 proto_tree
*field_tree
= NULL
;
967 /*guint16 table_size;*/
971 status
= zdp_parse_status(tree
, tvb
, &offset
);
972 /*table_size = */ zbee_parse_uint(tree
, hf_zbee_zdp_table_size
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
973 /*idx = */ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
974 table_count
= zbee_parse_uint(tree
, hf_zbee_zdp_table_count
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
976 if (tree
&& table_count
) {
977 ti
= proto_tree_add_text(tree
, tvb
, offset
, table_count
* (int)sizeof(guint64
), "Source Table");
978 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_bind_source
);
980 for (i
=0; i
<table_count
; i
++) {
981 (void)zbee_parse_eui64(field_tree
, hf_zbee_zdp_bind_src64
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
984 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
986 /* Dump any leftover bytes. */
987 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
988 } /* dissect_zbee_zdp_rsp_recover_source_bind */