1 /* packet-zbee-zdp-discovery.c
2 * Dissector helper routines for the discovery 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.
31 #include <epan/packet.h>
32 #include <epan/addr_resolv.h>
33 #include <epan/wmem/wmem.h>
35 #include "packet-zbee.h"
36 #include "packet-zbee-zdp.h"
38 /**************************************
40 **************************************
42 /*FUNCTION:------------------------------------------------------
44 * dissect_zbee_zdp_req_nwk_addr
46 * ZigBee Device Profile dissector for the network address
47 * request. Cluster ID = 0x0000.
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 dissect_zbee_zdp_req_nwk_addr(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
65 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, sizeof(guint64
), NULL
);
66 /*req_type =*/ zbee_parse_uint(tree
, hf_zbee_zdp_req_type
, tvb
, &offset
, sizeof(guint8
), NULL
);
67 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, sizeof(guint8
), NULL
);
69 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
71 /* Dump any leftover bytes. */
72 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
73 } /* dissect_zbee_zdp_req_nwk_addr */
75 /*FUNCTION:------------------------------------------------------
77 * dissect_zbee_zdp_req_ext_addr
79 * ZigBee Device Profile dissector for the extended address
80 * request. Cluster ID = 0x0001.
82 * tvbuff_t *tvb - pointer to buffer containing raw packet.
83 * packet_into *pinfo - pointer to packet information fields
84 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
87 *---------------------------------------------------------------
90 dissect_zbee_zdp_req_ext_addr(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
98 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, sizeof(guint16
), NULL
);
99 /*req_type =*/ zbee_parse_uint(tree
, hf_zbee_zdp_req_type
, tvb
, &offset
, sizeof(guint8
), NULL
);
100 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, sizeof(guint8
), NULL
);
102 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
104 /* Dump any leftover bytes. */
105 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
106 } /* dissect_zbee_zdp_req_ext_addr */
108 /*FUNCTION:------------------------------------------------------
110 * dissect_zbee_zdp_req_desc
112 * ZigBee Device Profile dissector for the descriptor
113 * requests. Cluster ID = 0x0002.
115 * tvbuff_t *tvb - pointer to buffer containing raw packet.
116 * packet_into *pinfo - pointer to packet information fields
117 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
120 *---------------------------------------------------------------
123 dissect_zbee_zdp_req_node_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
128 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, sizeof(guint16
), NULL
);
130 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
132 /* Dump any leftover bytes. */
133 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
134 } /* dissect_zbee_zdp_req_node_desc */
136 /*FUNCTION:------------------------------------------------------
138 * dissect_zbee_zdp_req_power_desc
140 * ZigBee Device Profile dissector for the node descriptor
141 * request. Cluster ID = 0x0003.
143 * tvbuff_t *tvb - pointer to buffer containing raw packet.
144 * packet_into *pinfo - pointer to packet information fields
145 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
148 *---------------------------------------------------------------
151 dissect_zbee_zdp_req_power_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
156 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, sizeof(guint16
), NULL
);
158 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
160 /* Dump any leftover bytes. */
161 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
162 } /* dissect_zbee_zdp_req_power_desc */
164 /*FUNCTION:------------------------------------------------------
166 * dissect_zbee_zdp_req_simple_desc
168 * ZigBee Device Profile dissector for the simple descriptor
169 * request. Cluster ID = 0x0004.
171 * tvbuff_t *tvb - pointer to buffer containing raw packet.
172 * packet_into *pinfo - pointer to packet information fields
173 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
176 *---------------------------------------------------------------
179 dissect_zbee_zdp_req_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
185 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, sizeof(guint16
), NULL
);
186 endpt
= zbee_parse_uint(tree
, hf_zbee_zdp_endpoint
, tvb
, &offset
, sizeof(guint8
), NULL
);
188 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x, Endpoint: %d", device
, endpt
);
190 /* Dump any leftover bytes. */
191 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
192 } /* dissect_zbee_zdp_req_simple_desc */
194 /*FUNCTION:------------------------------------------------------
196 * dissect_zbee_zdp_req_active_ep
198 * ZigBee Device Profile dissector for the active endpoint list
199 * request. Cluster ID = 0x0005.
201 * tvbuff_t *tvb - pointer to buffer containing raw packet.
202 * packet_into *pinfo - pointer to packet information fields
203 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
206 *---------------------------------------------------------------
209 dissect_zbee_zdp_req_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
214 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, sizeof(guint16
), NULL
);
216 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
218 /* Dump any leftover bytes. */
219 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
220 } /* dissect_zbee_zdp_req_active_ep */
222 /*FUNCTION:------------------------------------------------------
224 * dissect_zbee_zdp_req_match_desc
226 * ZigBee Device Profile dissector for the matching descriptor
227 * request. Cluster ID = 0x0006.
229 * tvbuff_t *tvb - pointer to buffer containing raw packet.
230 * packet_into *pinfo - pointer to packet information fields
231 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
234 *---------------------------------------------------------------
237 dissect_zbee_zdp_req_match_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
240 proto_tree
*field_tree
= NULL
;
242 guint sizeof_cluster
= (version
>= ZBEE_VERSION_2007
)?(int)sizeof(guint16
):(int)sizeof(guint8
);
249 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
250 profile
= zbee_parse_uint(tree
, hf_zbee_zdp_profile
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
252 /* Add the input cluster list. */
253 in_count
= zbee_parse_uint(tree
, hf_zbee_zdp_in_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
254 if (tree
&& in_count
) {
255 ti
= proto_tree_add_text(tree
, tvb
, offset
, in_count
*sizeof_cluster
, "Input Cluster List");
256 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_match_in
);
258 for (i
=0; i
<in_count
; i
++) zbee_parse_uint(field_tree
, hf_zbee_zdp_in_cluster
, tvb
, &offset
, sizeof_cluster
, NULL
);
260 /* Add the output cluster list. */
261 out_count
= zbee_parse_uint(tree
, hf_zbee_zdp_out_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
262 if (tree
&& out_count
) {
263 ti
= proto_tree_add_text(tree
, tvb
, offset
, out_count
*sizeof_cluster
, "Output Cluster List");
264 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_match_out
);
266 for (i
=0; i
<out_count
; i
++) zbee_parse_uint(field_tree
, hf_zbee_zdp_out_cluster
, tvb
, &offset
, sizeof_cluster
, NULL
);
268 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x, Profile: 0x%04x", device
, profile
);
270 /* Dump any leftover bytes. */
271 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
272 } /* dissect_zbee_zdp_req_simple_desc */
274 /*FUNCTION:------------------------------------------------------
276 * dissect_zbee_zdp_req_complex_desc
278 * ZigBee Device Profile dissector for the complex descriptor
279 * request. Cluster ID = 0x0010.
281 * tvbuff_t *tvb - pointer to buffer containing raw packet.
282 * packet_into *pinfo - pointer to packet information fields
283 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
286 *---------------------------------------------------------------
289 dissect_zbee_zdp_req_complex_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
294 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
296 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
298 /* Dump any leftover bytes. */
299 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
300 } /* dissect_zbee_zdp_req_complex_desc */
302 /*FUNCTION:------------------------------------------------------
304 * dissect_zbee_zdp_req_user_desc
306 * ZigBee Device Profile dissector for the user descriptor
307 * request. Cluster ID = 0x0011.
309 * tvbuff_t *tvb - pointer to buffer containing raw packet.
310 * packet_into *pinfo - pointer to packet information fields
311 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
314 *---------------------------------------------------------------
317 dissect_zbee_zdp_req_user_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
322 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
324 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
326 /* Dump any leftover bytes. */
327 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
328 } /* dissect_zbee_zdp_req_user_desc */
330 /*FUNCTION:------------------------------------------------------
332 * dissect_zbee_zdp_req_discovery_cache
334 * ZigBee Device Profile dissector for the discovery cache
335 * request. Cluster ID = 0x0012.
337 * tvbuff_t *tvb - pointer to buffer containing raw packet.
338 * packet_into *pinfo - pointer to packet information fields
339 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
342 *---------------------------------------------------------------
345 dissect_zbee_zdp_req_discovery_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
351 /*device =*/ zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
352 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
354 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
356 /* Dump any leftover bytes. */
357 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
358 } /* dissect_zbee_zdp_req_discovery_cache */
360 /*FUNCTION:------------------------------------------------------
362 * dissect_zbee_zdp_device_annce
364 * ZigBee Device Profile dissector for the device announcement.
365 * Cluster ID = 0x0013.
367 * tvbuff_t *tvb - pointer to buffer containing raw packet.
368 * packet_into *pinfo - pointer to packet information fields
369 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
372 *---------------------------------------------------------------
375 dissect_zbee_zdp_device_annce(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
380 /*guint8 capability;*/
382 /*device =*/ zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
383 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
384 /*capability =*/ zdp_parse_cinfo(tree
, ett_zbee_zdp_cinfo
, tvb
, &offset
);
386 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
388 /* Dump any leftover bytes. */
389 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
390 } /* dissect_zbee_zdp_device_annce */
392 /*FUNCTION:------------------------------------------------------
394 * dissect_zbee_zdp_req_set_user_desc
396 * ZigBee Device Profile dissector for the end set user
397 * descriptor request. Cluster ID = 0x0014.
399 * tvbuff_t *tvb - pointer to buffer containing raw packet.
400 * packet_into *pinfo - pointer to packet information fields
401 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
404 *---------------------------------------------------------------
407 dissect_zbee_zdp_req_set_user_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
414 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
415 if (version
>= ZBEE_VERSION_2007
) {
416 user_length
= zbee_parse_uint(tree
, hf_zbee_zdp_user_length
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
419 /* No Length field in ZigBee 2003 & earlier, uses a fixed length of 16. */
422 user
= (gchar
*)wmem_alloc(wmem_packet_scope(), user_length
+1);
423 user
= (gchar
*)tvb_memcpy(tvb
, user
, offset
, user_length
);
424 user
[user_length
] = '\0';
426 proto_tree_add_string(tree
, hf_zbee_zdp_user
, tvb
, offset
, user_length
, user
);
428 offset
+= user_length
;
430 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x, Desc: \'%s\'", device
, user
);
432 /* Dump any leftover bytes. */
433 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
434 } /* dissect_zbee_zdp_req_set_user_desc */
436 /*FUNCTION:------------------------------------------------------
438 * dissect_zbee_zdp_req_system_server_disc
440 * ZigBee Device Profile dissector for the system server
441 * discovery request. Cluster ID = 0x0015.
443 * tvbuff_t *tvb - pointer to buffer containing raw packet.
444 * packet_into *pinfo - pointer to packet information fields
445 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
448 *---------------------------------------------------------------
451 dissect_zbee_zdp_req_system_server_disc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
454 /*guint16 server_flags;*/
456 /*server_flags =*/ zdp_parse_server_flags(tree
, ett_zbee_zdp_server
, tvb
, &offset
);
458 /* Dump any leftover bytes. */
459 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
460 } /* dissect_zbee_zdp_req_system_server_disc */
462 /*FUNCTION:------------------------------------------------------
464 * dissect_zbee_zdp_req_store_discovery
466 * ZigBee Device Profile dissector for the store node cache
467 * request. Cluster ID = 0x0016.
469 * tvbuff_t *tvb - pointer to buffer containing raw packet.
470 * packet_into *pinfo - pointer to packet information fields
471 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
474 *---------------------------------------------------------------
477 dissect_zbee_zdp_req_store_discovery(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
480 proto_tree
*field_tree
= NULL
;
486 /*guint8 node_size;*/
487 /*guint8 power_size;*/
491 /*device =*/ zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
492 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
493 /*node_size =*/ zbee_parse_uint(tree
, hf_zbee_zdp_disc_node_size
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
494 /*power_size =*/ zbee_parse_uint(tree
, hf_zbee_zdp_disc_power_size
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
495 /*ep_count =*/ zbee_parse_uint(tree
, hf_zbee_zdp_disc_ep_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
496 simple_count
= zbee_parse_uint(tree
, hf_zbee_zdp_disc_simple_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
499 ti
= proto_tree_add_text(tree
, tvb
, offset
, simple_count
, "Simple Descriptor Sizes");
500 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_simple_sizes
);
502 for (i
=0; i
<simple_count
; i
++) {
503 zbee_parse_uint(field_tree
, hf_zbee_zdp_disc_simple_size
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
506 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
508 /* Dump any leftover bytes. */
509 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
510 } /* dissect_zbee_zdp_req_store_discovery */
512 /*FUNCTION:------------------------------------------------------
514 * dissect_zbee_zdp_req_store_node_desc
516 * ZigBee Device Profile dissector for the store node descriptor
517 * request. Cluster ID = 0x0017.
519 * tvbuff_t *tvb - pointer to buffer containing raw packet.
520 * packet_into *pinfo - pointer to packet information fields
521 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
524 *---------------------------------------------------------------
527 dissect_zbee_zdp_req_store_node_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
533 /*device =*/ zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
534 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
535 zdp_parse_node_desc(tree
, ett_zbee_zdp_node
, tvb
, &offset
, version
);
537 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
539 /* Dump any leftover bytes. */
540 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
541 } /* dissect_zbee_zdp_req_store_node_desc */
543 /*FUNCTION:------------------------------------------------------
545 * dissect_zbee_zdp_req_store_power_desc
547 * ZigBee Device Profile dissector for the store power descriptor
548 * request. Cluster ID = 0x0018.
550 * tvbuff_t *tvb - pointer to buffer containing raw packet.
551 * packet_into *pinfo - pointer to packet information fields
552 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
555 *---------------------------------------------------------------
558 dissect_zbee_zdp_req_store_power_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
564 /*device =*/ zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
565 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
566 zdp_parse_power_desc(tree
, ett_zbee_zdp_power
, tvb
, &offset
);
568 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
570 /* Dump any leftover bytes. */
571 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
572 } /* dissect_zbee_zdp_req_store_power_desc */
574 /*FUNCTION:------------------------------------------------------
576 * dissect_zbee_zdp_req_store_active_ep
578 * ZigBee Device Profile dissector for the store active endpoint
579 * request. Cluster ID = 0x0019.
581 * tvbuff_t *tvb - pointer to buffer containing raw packet.
582 * packet_into *pinfo - pointer to packet information fields
583 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
586 *---------------------------------------------------------------
589 dissect_zbee_zdp_req_store_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
592 proto_tree
*field_tree
= NULL
;
600 /*device =*/ zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
601 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
602 ep_count
= zbee_parse_uint(tree
, hf_zbee_zdp_ep_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
605 ti
= proto_tree_add_text(tree
, tvb
, offset
, ep_count
, "Active Endpoints");
606 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_endpoint
);
608 for (i
=0; i
<ep_count
; i
++) {
609 (void)zbee_parse_uint(field_tree
, hf_zbee_zdp_endpoint
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
612 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
614 /* Dump any leftover bytes. */
615 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
616 } /* dissect_zbee_zdp_req_store_active_ep */
618 /*FUNCTION:------------------------------------------------------
620 * dissect_zbee_zdp_req_store_simple_desc
622 * ZigBee Device Profile dissector for the store simple descriptor
623 * request. Cluster ID = 0x001a.
625 * tvbuff_t *tvb - pointer to buffer containing raw packet.
626 * packet_into *pinfo - pointer to packet information fields
627 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
630 *---------------------------------------------------------------
633 dissect_zbee_zdp_req_store_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
638 /*guint8 simple_len;*/
640 /*device =*/ zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
641 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
642 /*simple_len =*/ zbee_parse_uint(tree
, hf_zbee_zdp_simple_length
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
643 zdp_parse_simple_desc(tree
, ett_zbee_zdp_simple
, tvb
, &offset
, version
);
645 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
647 /* Dump any leftover bytes. */
648 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
649 } /* dissect_zbee_zdp_req_store_simple_desc */
651 /*FUNCTION:------------------------------------------------------
653 * dissect_zbee_zdp_req_remove_node_cache
655 * ZigBee Device Profile dissector for the remove node cache
656 * request. Cluster ID = 0x001b.
658 * tvbuff_t *tvb - pointer to buffer containing raw packet.
659 * packet_into *pinfo - pointer to packet information fields
660 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
663 *---------------------------------------------------------------
666 dissect_zbee_zdp_req_remove_node_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
672 /*device =*/ zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
673 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
675 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
677 /* Dump any leftover bytes. */
678 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
679 } /* dissect_zbee_zdp_req_remove_node_cache */
681 /*FUNCTION:------------------------------------------------------
683 * dissect_zbee_zdp_req_find_node_cache
685 * ZigBee Device Profile dissector for the find node cache
686 * request. Cluster ID = 0x001c.
688 * tvbuff_t *tvb - pointer to buffer containing raw packet.
689 * packet_into *pinfo - pointer to packet information fields
690 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
693 *---------------------------------------------------------------
696 dissect_zbee_zdp_req_find_node_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
702 /*device =*/ zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
703 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
705 zbee_append_info(tree
, pinfo
, ", Device: %s", get_eui64_name(ext_addr
));
707 /* Dump any leftover bytes. */
708 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
709 } /* dissect_zbee_zdp_req_find_node_cache */
711 /*FUNCTION:------------------------------------------------------
713 * dissect_zbee_zdp_req_ext_simple_desc
715 * ZigBee Device Profile dissector for the extended simple
716 * descriptor request. Cluster ID = 0x001d.
718 * tvbuff_t *tvb - pointer to buffer containing raw packet.
719 * packet_into *pinfo - pointer to packet information fields
720 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
723 *---------------------------------------------------------------
726 dissect_zbee_zdp_req_ext_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
733 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
734 endpt
= zbee_parse_uint(tree
, hf_zbee_zdp_endpoint
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
735 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
737 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x, Endpoint: %d", device
, endpt
);
739 /* Dump any leftover bytes. */
740 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
741 } /* dissect_zbee_zdp_req_ext_simple_desc */
743 /*FUNCTION:------------------------------------------------------
745 * dissect_zbee_zdp_req_ext_active_ep
747 * ZigBee Device Profile dissector for the extended active
748 * endpoint list request. Cluster ID = 0x001e.
750 * tvbuff_t *tvb - pointer to buffer containing raw packet.
751 * packet_into *pinfo - pointer to packet information fields
752 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
755 *---------------------------------------------------------------
758 dissect_zbee_zdp_req_ext_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
764 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
765 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
767 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
769 /* Dump any leftover bytes. */
770 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
771 } /* dissect_zbee_zdp_req_ext_active_ep */
773 /**************************************
774 * DISCOVERY RESPONSES
775 **************************************
777 /*FUNCTION:------------------------------------------------------
779 * dissect_zbee_zdp_rsp_nwk_addr
781 * ZigBee Device Profile dissector for the network address
782 * response. Cluster ID = 0x8000.
784 * tvbuff_t *tvb - pointer to buffer containing raw packet.
785 * packet_into *pinfo - pointer to packet information fields
786 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
789 *---------------------------------------------------------------
792 dissect_zbee_zdp_rsp_nwk_addr(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
795 proto_tree
*field_tree
= NULL
;
805 status
= zdp_parse_status(tree
, tvb
, &offset
);
806 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
807 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
809 if (tvb_bytes_exist(tvb
, offset
, 2*(int)sizeof(guint8
))) {
810 /* The presence of these fields depends on the request message. Include them if they exist. */
811 assoc
= zbee_parse_uint(tree
, hf_zbee_zdp_assoc_device_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
812 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
814 if ((tree
) && (assoc
)) {
815 ti
= proto_tree_add_text(tree
, tvb
, offset
, assoc
*(int)sizeof(guint16
), "Associated Device List");
816 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_assoc_device
);
818 for (i
=0; i
<assoc
; i
++) {
819 (void)zbee_parse_uint(field_tree
, hf_zbee_zdp_assoc_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
823 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
824 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
825 zbee_append_info(tree
, pinfo
, ", Device: %s = 0x%04x", get_eui64_name(ext_addr
), device
);
828 /* Dump any leftover bytes. */
829 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
830 } /* dissect_zbee_zdp_rsp_nwk_addr */
832 /*FUNCTION:------------------------------------------------------
834 * dissect_zbee_zdp_rsp_ext_addr
836 * ZigBee Device Profile dissector for the extended address
837 * response. Cluster ID = 0x8001.
839 * tvbuff_t *tvb - pointer to buffer containing raw packet.
840 * packet_into *pinfo - pointer to packet information fields
841 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
844 *---------------------------------------------------------------
847 dissect_zbee_zdp_rsp_ext_addr(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
850 proto_tree
*field_tree
= NULL
;
860 status
= zdp_parse_status(tree
, tvb
, &offset
);
861 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
862 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
864 if (tvb_bytes_exist(tvb
, offset
, 2*(int)sizeof(guint8
))) {
865 /* The presence of these fields depends on the request message. Include them if they exist. */
866 assoc
= zbee_parse_uint(tree
, hf_zbee_zdp_assoc_device_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
867 /*idx =*/ zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
869 if ((tree
) && (assoc
)) {
870 ti
= proto_tree_add_text(tree
, tvb
, offset
, assoc
*(int)sizeof(guint16
), "Associated Device List");
871 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_assoc_device
);
873 for (i
=0; i
<assoc
; i
++) {
874 (void)zbee_parse_uint(field_tree
, hf_zbee_zdp_assoc_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
878 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
879 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
880 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x = %s", device
, get_eui64_name(ext_addr
));
883 /* Dump any leftover bytes. */
884 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
885 } /* dissect_zbee_zdp_rsp_ext_addr */
887 /*FUNCTION:------------------------------------------------------
889 * dissect_zbee_zdp_rsp_node_desc
891 * ZigBee Device Profile dissector for the node descriptor
892 * response. Cluster ID = 0x8002.
894 * tvbuff_t *tvb - pointer to buffer containing raw packet.
895 * packet_into *pinfo - pointer to packet information fields
896 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
899 *---------------------------------------------------------------
902 dissect_zbee_zdp_rsp_node_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
909 status
= zdp_parse_status(tree
, tvb
, &offset
);
910 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
911 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
912 zdp_parse_node_desc(tree
, ett_zbee_zdp_node
, tvb
, &offset
, version
);
915 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
916 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
918 /* Dump any leftover bytes. */
919 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
920 } /* dissect_zbee_zdp_rsp_node_desc */
922 /*FUNCTION:------------------------------------------------------
924 * dissect_zbee_zdp_rsp_power_desc
926 * ZigBee Device Profile dissector for the power descriptor
927 * response. Cluster ID = 0x8003.
929 * tvbuff_t *tvb - pointer to buffer containing raw packet.
930 * packet_into *pinfo - pointer to packet information fields
931 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
934 *---------------------------------------------------------------
937 dissect_zbee_zdp_rsp_power_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
944 status
= zdp_parse_status(tree
, tvb
, &offset
);
945 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
946 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
947 zdp_parse_power_desc(tree
, ett_zbee_zdp_power
, tvb
, &offset
);
950 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
951 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
953 /* Dump any leftover bytes. */
954 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
955 } /* dissect_zbee_zdp_rsp_power_desc */
957 /*FUNCTION:------------------------------------------------------
959 * dissect_zbee_zdp_rsp_simple_desc
961 * ZigBee Device Profile dissector for the simple descriptor
962 * response. Cluster ID = 0x8004.
964 * tvbuff_t *tvb - pointer to buffer containing raw packet.
965 * packet_into *pinfo - pointer to packet information fields
966 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
969 *---------------------------------------------------------------
972 dissect_zbee_zdp_rsp_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
980 status
= zdp_parse_status(tree
, tvb
, &offset
);
981 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
982 /*length =*/ zbee_parse_uint(tree
, hf_zbee_zdp_simple_length
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
983 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
984 zdp_parse_simple_desc(tree
, ett_zbee_zdp_simple
, tvb
, &offset
, version
);
987 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
988 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
990 /* Dump any leftover bytes. */
991 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
992 } /* dissect_zbee_zdp_rsp_simple_desc */
994 /*FUNCTION:------------------------------------------------------
996 * dissect_zbee_zdp_rsp_active_ep
998 * ZigBee Device Profile dissector for the active endpoint
999 * response. Cluster ID = 0x8005.
1001 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1002 * packet_into *pinfo - pointer to packet information fields
1003 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1006 *---------------------------------------------------------------
1009 dissect_zbee_zdp_rsp_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1012 proto_tree
*field_tree
= NULL
;
1020 status
= zdp_parse_status(tree
, tvb
, &offset
);
1021 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
1022 ep_count
= zbee_parse_uint(tree
, hf_zbee_zdp_ep_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1024 if (tree
&& ep_count
) {
1025 ti
= proto_tree_add_text(tree
, tvb
, offset
, ep_count
*(int)sizeof(guint8
), "Active Endpoint List");
1026 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_endpoint
);
1028 for (i
=0; i
<ep_count
; i
++) {
1029 (void)zbee_parse_uint(field_tree
, hf_zbee_zdp_endpoint
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1032 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
1033 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1035 /* Dump any leftover bytes. */
1036 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1037 } /* dissect_zbee_zdp_rsp_active_ep */
1039 /*FUNCTION:------------------------------------------------------
1041 * dissect_zbee_zdp_rsp_match_desc
1043 * ZigBee Device Profile dissector for the simple descriptor
1044 * response. Cluster ID = 0x8003.
1046 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1047 * packet_into *pinfo - pointer to packet information fields
1048 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1051 *---------------------------------------------------------------
1054 dissect_zbee_zdp_rsp_match_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1057 proto_tree
*field_tree
= NULL
;
1065 status
= zdp_parse_status(tree
, tvb
, &offset
);
1066 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
1067 ep_count
= zbee_parse_uint(tree
, hf_zbee_zdp_ep_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1069 if (tree
&& ep_count
) {
1070 ti
= proto_tree_add_text(tree
, tvb
, offset
, ep_count
*(int)sizeof(guint8
), "Matching Endpoint List");
1071 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_endpoint
);
1073 for (i
=0; i
<ep_count
; i
++) {
1074 (void)zbee_parse_uint(field_tree
, hf_zbee_zdp_endpoint
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1077 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
1078 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1080 /* Dump any leftover bytes. */
1081 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1082 } /* dissect_zbee_zdp_rsp_match_desc */
1084 /*FUNCTION:------------------------------------------------------
1086 * dissect_zbee_zdp_rsp_complex_desc
1088 * ZigBee Device Profile dissector for the complex descriptor
1089 * response. Cluster ID = 0x8010.
1091 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1092 * packet_into *pinfo - pointer to packet information fields
1093 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1096 *---------------------------------------------------------------
1099 dissect_zbee_zdp_rsp_complex_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1107 status
= zdp_parse_status(tree
, tvb
, &offset
);
1108 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
1109 length
= zbee_parse_uint(tree
, hf_zbee_zdp_complex_length
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1111 zdp_parse_complex_desc(tree
, -1, tvb
, &offset
, length
);
1114 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
1115 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1117 /* Dump any leftover bytes. */
1118 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1119 } /* dissect_zbee_zdp_rsp_complex_desc */
1121 /*FUNCTION:------------------------------------------------------
1123 * dissect_zbee_zdp_rsp_user_desc
1125 * ZigBee Device Profile dissector for the user descriptor
1126 * response. Cluster ID = 0x8011.
1128 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1129 * packet_into *pinfo - pointer to packet information fields
1130 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1133 *---------------------------------------------------------------
1136 dissect_zbee_zdp_rsp_user_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
1144 status
= zdp_parse_status(tree
, tvb
, &offset
);
1145 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
1146 if ((version
>= ZBEE_VERSION_2007
) || (status
== ZBEE_ZDP_STATUS_SUCCESS
)) {
1147 /* In ZigBee 2003 & earlier, the length field is omitted if not successful. */
1148 user_length
= zbee_parse_uint(tree
, hf_zbee_zdp_user_length
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1150 else user_length
= 0;
1152 user
= tvb_get_string(wmem_packet_scope(), tvb
, offset
, user_length
);
1154 proto_tree_add_string(tree
, hf_zbee_zdp_user
, tvb
, offset
, user_length
, user
);
1156 offset
+= user_length
;
1158 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
1159 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
1160 zbee_append_info(tree
, pinfo
, ", Desc: \'%s\'", user
);
1162 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1164 /* Dump any leftover bytes. */
1165 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1166 } /* dissect_zbee_zdp_rsp_user_desc */
1168 /*FUNCTION:------------------------------------------------------
1170 * dissect_zbee_zdp_rsp_user_desc_conf
1172 * ZigBee Device Profile dissector for the set user descriptor
1173 * confirmation. Cluster ID = 0x8014.
1175 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1176 * packet_into *pinfo - pointer to packet information fields
1177 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1180 *---------------------------------------------------------------
1183 dissect_zbee_zdp_rsp_user_desc_conf(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, guint8 version
)
1189 status
= zdp_parse_status(tree
, tvb
, &offset
);
1190 if (version
>= ZBEE_VERSION_2007
) {
1191 /* Device address present only on ZigBee 2006 & later. */
1192 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
1195 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
1196 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1198 /* Dump any leftover bytes. */
1199 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1200 } /* dissect_zbee_zdp_rsp_user_desc_conf */
1202 /*FUNCTION:------------------------------------------------------
1204 * dissect_zbee_zdp_rsp_discovery_cache
1206 * ZigBee Device Profile dissector for the discovery cache
1207 * response. Cluster ID = 0x8012.
1209 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1210 * packet_into *pinfo - pointer to packet information fields
1211 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1214 *---------------------------------------------------------------
1217 dissect_zbee_zdp_rsp_discovery_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1223 status
= zdp_parse_status(tree
, tvb
, &offset
);
1225 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1227 /* Dump any leftover bytes. */
1228 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1229 } /* dissect_zbee_zdp_rsp_discovery_cache */
1231 /*FUNCTION:------------------------------------------------------
1233 * dissect_zbee_zdp_rsp_system_server_disc
1235 * ZigBee Device Profile dissector for the system server discovery
1236 * response. Cluster ID = 0x8015.
1238 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1239 * packet_into *pinfo - pointer to packet information fields
1240 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1243 *---------------------------------------------------------------
1246 dissect_zbee_zdp_rsp_system_server_disc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1253 status
= zdp_parse_status(tree
, tvb
, &offset
);
1254 /*server =*/ zdp_parse_server_flags(tree
, ett_zbee_zdp_server
, tvb
, &offset
);
1256 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1258 /* Dump any leftover bytes. */
1259 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1260 } /* dissect_zbee_zdp_rsp_system_server_disc */
1262 /*FUNCTION:------------------------------------------------------
1264 * dissect_zbee_zdp_rsp_discovery_store
1266 * ZigBee Device Profile dissector for the discovery store
1267 * response. Cluster ID = 0x8016.
1269 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1270 * packet_into *pinfo - pointer to packet information fields
1271 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1274 *---------------------------------------------------------------
1277 dissect_zbee_zdp_rsp_discovery_store(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1283 status
= zdp_parse_status(tree
, tvb
, &offset
);
1285 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1287 /* Dump any leftover bytes. */
1288 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1289 } /* dissect_zbee_zdp_rsp_discovery_store */
1291 /*FUNCTION:------------------------------------------------------
1293 * dissect_zbee_zdp_rsp_store_node_desc
1295 * ZigBee Device Profile dissector for the store node descriptor
1296 * response. Cluster ID = 0x8017.
1298 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1299 * packet_into *pinfo - pointer to packet information fields
1300 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1303 *---------------------------------------------------------------
1306 dissect_zbee_zdp_rsp_store_node_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1312 status
= zdp_parse_status(tree
, tvb
, &offset
);
1314 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1316 /* Dump any leftover bytes. */
1317 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1318 } /* dissect_zbee_zdp_rsp_store_node_desc */
1320 /*FUNCTION:------------------------------------------------------
1322 * dissect_zbee_zdp_rsp_store_power_desc
1324 * ZigBee Device Profile dissector for the store power descriptor
1325 * response. Cluster ID = 0x8018.
1327 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1328 * packet_into *pinfo - pointer to packet information fields
1329 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1332 *---------------------------------------------------------------
1335 dissect_zbee_zdp_rsp_store_power_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1341 status
= zdp_parse_status(tree
, tvb
, &offset
);
1343 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1345 /* Dump any leftover bytes. */
1346 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1347 } /* dissect_zbee_zdp_rsp_store_power_desc */
1349 /*FUNCTION:------------------------------------------------------
1351 * dissect_zbee_zdp_rsp_store_active_ep
1353 * ZigBee Device Profile dissector for the store active endpoints
1354 * response. Cluster ID = 0x8019.
1356 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1357 * packet_into *pinfo - pointer to packet information fields
1358 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1361 *---------------------------------------------------------------
1364 dissect_zbee_zdp_rsp_store_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1370 status
= zdp_parse_status(tree
, tvb
, &offset
);
1372 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1374 /* Dump any leftover bytes. */
1375 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1376 } /* dissect_zbee_zdp_rsp_store_active_ep */
1378 /*FUNCTION:------------------------------------------------------
1380 * dissect_zbee_zdp_rsp_store_simple_desc
1382 * ZigBee Device Profile dissector for the store power descriptor
1383 * response. Cluster ID = 0x801a.
1385 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1386 * packet_into *pinfo - pointer to packet information fields
1387 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1390 *---------------------------------------------------------------
1393 dissect_zbee_zdp_rsp_store_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1399 status
= zdp_parse_status(tree
, tvb
, &offset
);
1401 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1403 /* Dump any leftover bytes. */
1404 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1405 } /* dissect_zbee_zdp_rsp_store_simple_desc */
1407 /*FUNCTION:------------------------------------------------------
1409 * dissect_zbee_zdp_rsp_remove_node_cache
1411 * ZigBee Device Profile dissector for the remove node cache
1412 * response. Cluster ID = 0x801b.
1414 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1415 * packet_into *pinfo - pointer to packet information fields
1416 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1419 *---------------------------------------------------------------
1422 dissect_zbee_zdp_rsp_remove_node_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1428 status
= zdp_parse_status(tree
, tvb
, &offset
);
1430 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1432 /* Dump any leftover bytes. */
1433 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1434 } /* dissect_zbee_zdp_rsp_remove_node_cache */
1436 /*FUNCTION:------------------------------------------------------
1438 * dissect_zbee_zdp_rsp_find_node_cache
1440 * ZigBee Device Profile dissector for the find node cache
1441 * response. Cluster ID = 0x801c.
1443 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1444 * packet_into *pinfo - pointer to packet information fields
1445 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1448 *---------------------------------------------------------------
1451 dissect_zbee_zdp_rsp_find_node_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1457 /*guint64 ext_addr;*/
1459 cache
= zbee_parse_uint(tree
, hf_zbee_zdp_cache
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
1460 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
1461 /*ext_addr =*/ zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(guint64
), NULL
);
1463 zbee_append_info(tree
, pinfo
, ", Cache: 0x%04x", cache
);
1464 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
1466 /* Dump any leftover bytes. */
1467 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1468 } /* dissect_zbee_zdp_rsp_find_node_cache */
1470 /*FUNCTION:------------------------------------------------------
1472 * dissect_zbee_zdp_rsp_ext_simple_desc
1474 * ZigBee Device Profile dissector for the extended simple
1475 * descriptor response. Cluster ID = 0x801d.
1477 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1478 * packet_into *pinfo - pointer to packet information fields
1479 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1482 *---------------------------------------------------------------
1485 dissect_zbee_zdp_rsp_ext_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1489 guint sizeof_cluster
= (int)sizeof(guint16
);
1498 status
= zdp_parse_status(tree
, tvb
, &offset
);
1499 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
1500 /*endpt =*/ zbee_parse_uint(tree
, hf_zbee_zdp_endpoint
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1501 in_count
= zbee_parse_uint(tree
, hf_zbee_zdp_in_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1502 out_count
= zbee_parse_uint(tree
, hf_zbee_zdp_out_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1503 idx
= zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1505 /* Display the input cluster list. */
1506 for (i
=idx
; (i
<in_count
) && tvb_bytes_exist(tvb
, offset
, sizeof_cluster
); i
++) {
1507 zbee_parse_uint(tree
, hf_zbee_zdp_in_cluster
, tvb
, &offset
, sizeof_cluster
, NULL
);
1509 for (i
-=in_count
; (i
<out_count
) && tvb_bytes_exist(tvb
, offset
, sizeof_cluster
); i
++) {
1510 zbee_parse_uint(tree
, hf_zbee_zdp_out_cluster
, tvb
, &offset
, sizeof_cluster
, NULL
);
1513 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
1514 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1516 /* Dump any leftover bytes. */
1517 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1518 } /* dissect_zbee_zdp_rsp_ext_simple_desc */
1520 /*FUNCTION:------------------------------------------------------
1522 * dissect_zbee_zdp_rsp_ext_active_ep
1524 * ZigBee Device Profile dissector for the extended active
1525 * endpoint response. Cluster ID = 0x801e.
1527 * tvbuff_t *tvb - pointer to buffer containing raw packet.
1528 * packet_into *pinfo - pointer to packet information fields
1529 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
1532 *---------------------------------------------------------------
1535 dissect_zbee_zdp_rsp_ext_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1538 proto_tree
*field_tree
= NULL
;
1547 status
= zdp_parse_status(tree
, tvb
, &offset
);
1548 device
= zbee_parse_uint(tree
, hf_zbee_zdp_device
, tvb
, &offset
, (int)sizeof(guint16
), NULL
);
1549 ep_count
= zbee_parse_uint(tree
, hf_zbee_zdp_ep_count
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1550 idx
= zbee_parse_uint(tree
, hf_zbee_zdp_index
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1552 if (tree
&& ep_count
) {
1553 ti
= proto_tree_add_text(tree
, tvb
, offset
, ep_count
*(int)sizeof(guint8
), "Active Endpoint List");
1554 field_tree
= proto_item_add_subtree(ti
, ett_zbee_zdp_endpoint
);
1555 for (i
=idx
; (i
<ep_count
) && tvb_bytes_exist(tvb
, offset
, (int)sizeof(guint8
)); i
++) {
1556 (void)zbee_parse_uint(field_tree
, hf_zbee_zdp_endpoint
, tvb
, &offset
, (int)sizeof(guint8
), NULL
);
1560 zbee_append_info(tree
, pinfo
, ", Device: 0x%04x", device
);
1561 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1563 /* Dump any leftover bytes. */
1564 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1565 } /* dissect_zbee_zdp_rsp_ext_active_ep */