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
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>
18 #include "packet-zbee.h"
19 #include "packet-zbee-zdp.h"
20 #include "packet-zbee-aps.h"
21 #include "packet-zbee-tlv.h"
23 /**************************************
25 **************************************
28 *ZigBee Device Profile dissector for the network address
30 *@param tvb pointer to buffer containing raw packet.
31 *@param pinfo pointer to packet information fields
32 *@param tree pointer to data tree Wireshark uses to display packet.
35 dissect_zbee_zdp_req_nwk_addr(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
41 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, sizeof(uint64_t), NULL
);
42 proto_tree_add_item(tree
, hf_zbee_zdp_req_type
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
44 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
47 zbee_append_info(tree
, pinfo
, ", Address: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
49 /* Dump any leftover bytes. */
50 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
51 } /* dissect_zbee_zdp_req_nwk_addr */
54 *ZigBee Device Profile dissector for the extended address
56 *@param tvb pointer to buffer containing raw packet.
57 *@param pinfo pointer to packet information fields
58 *@param tree pointer to data tree Wireshark uses to display packet.
61 dissect_zbee_zdp_req_ext_addr(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
67 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
69 proto_tree_add_item(tree
, hf_zbee_zdp_req_type
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
71 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
74 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
76 /* Dump any leftover bytes. */
77 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
78 } /* dissect_zbee_zdp_req_ext_addr */
81 *ZigBee Device Profile dissector for the descriptor
83 *@param tvb pointer to buffer containing raw packet.
84 *@param pinfo pointer to packet information fields
85 *@param tree pointer to data tree Wireshark uses to display packet.
88 dissect_zbee_zdp_req_node_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
93 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
96 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
98 offset
= dissect_zbee_tlvs(tvb
, pinfo
, tree
, offset
, NULL
, ZBEE_TLV_SRC_TYPE_ZBEE_ZDP
, ZBEE_ZDP_REQ_NODE_DESC
);
100 /* Dump any leftover bytes. */
101 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
102 } /* dissect_zbee_zdp_req_node_desc */
105 *ZigBee Device Profile dissector for the node descriptor
107 *@param tvb pointer to buffer containing raw packet.
108 *@param pinfo pointer to packet information fields
109 *@param tree pointer to data tree Wireshark uses to display packet.
112 dissect_zbee_zdp_req_power_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
117 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
120 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
122 /* Dump any leftover bytes. */
123 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
124 } /* dissect_zbee_zdp_req_power_desc */
127 *ZigBee Device Profile dissector for the simple descriptor
129 *@param tvb pointer to buffer containing raw packet.
130 *@param pinfo pointer to packet information fields
131 *@param tree pointer to data tree Wireshark uses to display packet.
134 dissect_zbee_zdp_req_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
137 uint32_t device
, endpt
;
139 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
141 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_endpoint
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &endpt
);
144 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x, Endpoint: %d", device
, endpt
);
146 /* Dump any leftover bytes. */
147 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
148 } /* dissect_zbee_zdp_req_simple_desc */
151 *ZigBee Device Profile dissector for the active endpoint list
153 *@param tvb pointer to buffer containing raw packet.
154 *@param pinfo pointer to packet information fields
155 *@param tree pointer to data tree Wireshark uses to display packet.
158 dissect_zbee_zdp_req_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
163 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
166 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
168 /* Dump any leftover bytes. */
169 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
170 } /* dissect_zbee_zdp_req_active_ep */
173 *ZigBee Device Profile dissector for the matching descriptor
175 *@param tvb pointer to buffer containing raw packet.
176 *@param pinfo pointer to packet information fields
177 *@param tree pointer to data tree Wireshark uses to display packet.
180 dissect_zbee_zdp_req_match_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
183 proto_tree
*field_tree
= NULL
;
184 unsigned offset
= 0, i
;
185 unsigned sizeof_cluster
= (version
>= ZBEE_VERSION_2007
)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
187 uint32_t device
, profile
, cluster
, in_count
, out_count
;
189 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
191 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_profile
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &profile
);
194 /* Add the input cluster list. */
195 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_in_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &in_count
);
197 if (tree
&& in_count
) {
198 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, in_count
*sizeof_cluster
,
199 ett_zbee_zdp_match_in
, NULL
, "Input Cluster List");
201 for (i
=0; i
<in_count
; i
++) {
202 ti
= proto_tree_add_item_ret_uint(field_tree
, hf_zbee_zdp_in_cluster
, tvb
, offset
, sizeof_cluster
, ENC_LITTLE_ENDIAN
, &cluster
);
203 offset
+= sizeof_cluster
;
204 proto_item_append_text(ti
, " (%s)", rval_to_str_const(cluster
, zbee_aps_cid_names
, "Unknown Cluster"));
207 /* Add the output cluster list. */
208 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_out_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &out_count
);
210 if (tree
&& out_count
) {
211 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, out_count
*sizeof_cluster
, ett_zbee_zdp_match_out
, NULL
, "Output Cluster List");
213 for (i
=0; i
<out_count
; i
++) {
214 ti
= proto_tree_add_item_ret_uint(field_tree
, hf_zbee_zdp_out_cluster
, tvb
, offset
, sizeof_cluster
, ENC_LITTLE_ENDIAN
, &cluster
);
215 offset
+= sizeof_cluster
;
216 proto_item_append_text(ti
, " (%s)", rval_to_str_const(cluster
, zbee_aps_cid_names
, "Unknown Cluster"));
219 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x, Profile: 0x%04x", device
, profile
);
221 /* Dump any leftover bytes. */
222 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
223 } /* dissect_zbee_zdp_req_simple_desc */
226 *ZigBee Device Profile dissector for the complex descriptor
228 *@param tvb pointer to buffer containing raw packet.
229 *@param pinfo pointer to packet information fields
230 *@param tree pointer to data tree Wireshark uses to display packet.
233 dissect_zbee_zdp_req_complex_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
238 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
241 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
243 /* Dump any leftover bytes. */
244 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
245 } /* dissect_zbee_zdp_req_complex_desc */
248 *ZigBee Device Profile dissector for the user descriptor
250 *@param tvb pointer to buffer containing raw packet.
251 *@param pinfo pointer to packet information fields
252 *@param tree pointer to data tree Wireshark uses to display packet.
255 dissect_zbee_zdp_req_user_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
260 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
263 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
265 /* Dump any leftover bytes. */
266 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
267 } /* dissect_zbee_zdp_req_user_desc */
270 *ZigBee Device Profile dissector for the discovery cache
272 *@param tvb pointer to buffer containing raw packet.
273 *@param pinfo pointer to packet information fields
274 *@param tree pointer to data tree Wireshark uses to display packet.
277 dissect_zbee_zdp_req_discovery_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
282 proto_tree_add_item(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
284 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
286 zbee_append_info(tree
, pinfo
, ", Ext Addr: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
288 /* Dump any leftover bytes. */
289 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
290 } /* dissect_zbee_zdp_req_discovery_cache */
293 *ZigBee Device Profile dissector for the device announcement.
295 *@param tvb pointer to buffer containing raw packet.
296 *@param pinfo pointer to packet information fields
297 *@param tree pointer to data tree Wireshark uses to display packet.
300 dissect_zbee_zdp_device_annce(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
305 /*uint8_t capability;*/
307 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &short_addr
);
309 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
310 /*capability =*/ zdp_parse_cinfo(tree
, ett_zbee_zdp_cinfo
, tvb
, &offset
);
312 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x, Ext Addr: %s", short_addr
, eui64_to_display(pinfo
->pool
, ext_addr
));
314 /* Dump any leftover bytes. */
315 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
316 } /* dissect_zbee_zdp_device_annce */
319 *ZigBee Device Profile dissector for the parent announce
321 *@param tvb pointer to buffer containing raw packet.
322 *@param pinfo pointer to packet information fields
323 *@param tree pointer to data tree Wireshark uses to display packet.
326 dissect_zbee_zdp_parent_annce(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
333 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_number_of_children
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &n_children
);
336 zbee_append_info(tree
, pinfo
, ", # children %d :", n_children
);
337 for (i
= 0 ; i
< n_children
; ++i
)
339 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
342 zbee_append_info(tree
, pinfo
, n_children
== 1 ? " %s" : " %s ...", eui64_to_display(pinfo
->pool
, ext_addr
));
346 /* Dump any leftover bytes. */
347 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
348 } /* dissect_zbee_zdp_parent_annce */
352 *ZigBee Device Profile dissector for the parent announce rsp
354 *@param tvb pointer to buffer containing raw packet.
355 *@param pinfo pointer to packet information fields
356 *@param tree pointer to data tree Wireshark uses to display packet.
359 dissect_zbee_zdp_rsp_parent_annce(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
367 status
= zdp_parse_status(tree
, tvb
, &offset
);
368 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_number_of_children
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &n_children
);
370 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
371 zbee_append_info(tree
, pinfo
, ", # children %d :", n_children
);
372 for (i
= 0 ; i
< n_children
; ++i
)
374 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
377 zbee_append_info(tree
, pinfo
, n_children
== 1 ? " %s" : " %s ...", eui64_to_display(pinfo
->pool
, ext_addr
));
381 /* Dump any leftover bytes. */
382 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
383 } /* dissect_zbee_zdp_rsp_parent_annce */
386 *ZigBee Device Profile dissector for the end set user
388 *@param tvb pointer to buffer containing raw packet.
389 *@param pinfo pointer to packet information fields
390 *@param tree pointer to data tree Wireshark uses to display packet.
393 dissect_zbee_zdp_req_set_user_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
396 uint32_t device
, user_length
;
399 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
401 if (version
>= ZBEE_VERSION_2007
) {
402 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_user_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &user_length
);
406 /* No Length field in ZigBee 2003 & earlier, uses a fixed length of 16. */
409 proto_tree_add_item_ret_string(tree
, hf_zbee_zdp_user
, tvb
, offset
, user_length
, ENC_ASCII
, pinfo
->pool
, &user
);
410 offset
+= user_length
;
412 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x, Desc: \'%s\'", device
, user
);
414 /* Dump any leftover bytes. */
415 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
416 } /* dissect_zbee_zdp_req_set_user_desc */
419 *ZigBee Device Profile dissector for the system server
421 *@param tvb pointer to buffer containing raw packet.
422 *@param pinfo pointer to packet information fields
423 *@param tree pointer to data tree Wireshark uses to display packet.
426 dissect_zbee_zdp_req_system_server_disc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
429 /*uint16_t server_flags;*/
431 /*server_flags =*/ zdp_parse_server_flags(tree
, ett_zbee_zdp_server
, tvb
, &offset
);
433 /* Dump any leftover bytes. */
434 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
435 } /* dissect_zbee_zdp_req_system_server_disc */
438 *ZigBee Device Profile dissector for the store node cache
440 *@param tvb pointer to buffer containing raw packet.
441 *@param pinfo pointer to packet information fields
442 *@param tree pointer to data tree Wireshark uses to display packet.
445 dissect_zbee_zdp_req_store_discovery(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
447 proto_tree
*field_tree
;
452 uint32_t simple_count
;
454 proto_tree_add_item(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
456 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
457 proto_tree_add_item(tree
, hf_zbee_zdp_disc_node_size
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
459 proto_tree_add_item(tree
, hf_zbee_zdp_disc_power_size
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
461 proto_tree_add_item(tree
, hf_zbee_zdp_disc_ep_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
463 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_disc_simple_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &simple_count
);
466 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, simple_count
, ett_zbee_zdp_simple_sizes
, NULL
, "Simple Descriptor Sizes");
468 for (i
=0; i
<simple_count
; i
++) {
469 proto_tree_add_item(field_tree
, hf_zbee_zdp_disc_simple_size
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
473 zbee_append_info(tree
, pinfo
, ", Ext Addr: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
475 /* Dump any leftover bytes. */
476 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
477 } /* dissect_zbee_zdp_req_store_discovery */
480 *ZigBee Device Profile dissector for the store node descriptor
482 *@param tvb pointer to buffer containing raw packet.
483 *@param pinfo pointer to packet information fields
484 *@param tree pointer to data tree Wireshark uses to display packet.
487 dissect_zbee_zdp_req_store_node_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
492 proto_tree_add_item(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
494 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
495 zdp_parse_node_desc(tree
, pinfo
, false, ett_zbee_zdp_node
, tvb
, &offset
, version
);
497 zbee_append_info(tree
, pinfo
, ", Address: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
499 /* Dump any leftover bytes. */
500 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
501 } /* dissect_zbee_zdp_req_store_node_desc */
504 *ZigBee Device Profile dissector for the store power descriptor
506 *@param tvb pointer to buffer containing raw packet.
507 *@param pinfo pointer to packet information fields
508 *@param tree pointer to data tree Wireshark uses to display packet.
511 dissect_zbee_zdp_req_store_power_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
516 proto_tree_add_item(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
518 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
519 zdp_parse_power_desc(tree
, ett_zbee_zdp_power
, tvb
, &offset
);
521 zbee_append_info(tree
, pinfo
, ", Address: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
523 /* Dump any leftover bytes. */
524 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
525 } /* dissect_zbee_zdp_req_store_power_desc */
528 *ZigBee Device Profile dissector for the store active endpoint
530 *@param tvb pointer to buffer containing raw packet.
531 *@param pinfo pointer to packet information fields
532 *@param tree pointer to data tree Wireshark uses to display packet.
535 dissect_zbee_zdp_req_store_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
537 proto_tree
*field_tree
;
544 proto_tree_add_item(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
546 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
547 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_disc_simple_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &ep_count
);
550 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, ep_count
, ett_zbee_zdp_endpoint
, NULL
, "Active Endpoints");
552 for (i
=0; i
<ep_count
; i
++) {
553 proto_tree_add_item(field_tree
, hf_zbee_zdp_endpoint
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
557 zbee_append_info(tree
, pinfo
, ", Device: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
559 /* Dump any leftover bytes. */
560 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
561 } /* dissect_zbee_zdp_req_store_active_ep */
564 *ZigBee Device Profile dissector for the store simple descriptor
566 *@param tvb pointer to buffer containing raw packet.
567 *@param pinfo pointer to packet information fields
568 *@param tree pointer to data tree Wireshark uses to display packet.
571 dissect_zbee_zdp_req_store_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
576 proto_tree_add_item(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
578 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
579 proto_tree_add_item(tree
, hf_zbee_zdp_simple_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
581 zdp_parse_simple_desc(tree
, ett_zbee_zdp_simple
, tvb
, &offset
, version
);
583 zbee_append_info(tree
, pinfo
, ", Address: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
585 /* Dump any leftover bytes. */
586 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
587 } /* dissect_zbee_zdp_req_store_simple_desc */
590 *ZigBee Device Profile dissector for the remove node cache
592 *@param tvb pointer to buffer containing raw packet.
593 *@param pinfo pointer to packet information fields
594 *@param tree pointer to data tree Wireshark uses to display packet.
597 dissect_zbee_zdp_req_remove_node_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
602 proto_tree_add_item(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
604 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
606 zbee_append_info(tree
, pinfo
, ", Device: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
608 /* Dump any leftover bytes. */
609 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
610 } /* dissect_zbee_zdp_req_remove_node_cache */
613 *ZigBee Device Profile dissector for the find node cache
615 *@param tvb pointer to buffer containing raw packet.
616 *@param pinfo pointer to packet information fields
617 *@param tree pointer to data tree Wireshark uses to display packet.
620 dissect_zbee_zdp_req_find_node_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
625 proto_tree_add_item(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
627 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
629 zbee_append_info(tree
, pinfo
, ", Address: %s", eui64_to_display(pinfo
->pool
, ext_addr
));
631 /* Dump any leftover bytes. */
632 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
633 } /* dissect_zbee_zdp_req_find_node_cache */
636 *ZigBee Device Profile dissector for the extended simple
638 *@param tvb pointer to buffer containing raw packet.
639 *@param pinfo pointer to packet information fields
640 *@param tree pointer to data tree Wireshark uses to display packet.
643 dissect_zbee_zdp_req_ext_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
646 uint32_t device
, endpt
;
648 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
650 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_endpoint
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &endpt
);
652 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
655 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x, Endpoint: %d", device
, endpt
);
657 /* Dump any leftover bytes. */
658 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
659 } /* dissect_zbee_zdp_req_ext_simple_desc */
662 *ZigBee Device Profile dissector for the extended active
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_req_ext_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
675 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
677 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
680 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
682 /* Dump any leftover bytes. */
683 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
684 } /* dissect_zbee_zdp_req_ext_active_ep */
686 /**************************************
687 * DISCOVERY RESPONSES
688 **************************************
691 *ZigBee Device Profile dissector for the network address
693 *@param tvb pointer to buffer containing raw packet.
694 *@param pinfo pointer to packet information fields
695 *@param tree pointer to data tree Wireshark uses to display packet.
698 dissect_zbee_zdp_rsp_nwk_addr(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
700 proto_tree
*field_tree
= NULL
;
706 uint32_t device
, assoc
;
708 status
= zdp_parse_status(tree
, tvb
, &offset
);
709 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
710 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
713 if (tvb_bytes_exist(tvb
, offset
, 1)) {
714 /* The presence of these fields depends on the request message. Include them if they exist. */
715 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_assoc_device_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &assoc
);
718 if ((tree
) && (assoc
)) {
719 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
722 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, assoc
*(int)sizeof(uint16_t),
723 ett_zbee_zdp_assoc_device
, NULL
, "Associated Device List");
725 for (i
=0; i
<assoc
; i
++) {
726 proto_tree_add_item(field_tree
, hf_zbee_zdp_assoc_device
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
732 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
733 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
734 zbee_append_info(tree
, pinfo
, ", Address: %s = 0x%04x", eui64_to_display(pinfo
->pool
, ext_addr
), device
);
737 /* Dump any leftover bytes. */
738 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
739 } /* dissect_zbee_zdp_rsp_nwk_addr */
742 *ZigBee Device Profile dissector for the extended address
744 *@param tvb pointer to buffer containing raw packet.
745 *@param pinfo pointer to packet information fields
746 *@param tree pointer to data tree Wireshark uses to display packet.
749 dissect_zbee_zdp_rsp_ext_addr(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
751 proto_tree
*field_tree
= NULL
;
757 uint32_t device
, assoc
;
759 status
= zdp_parse_status(tree
, tvb
, &offset
);
760 ext_addr
= zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
761 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
764 if (tvb_bytes_exist(tvb
, offset
, 1)) {
765 /* The presence of these fields depends on the request message. Include them if they exist. */
766 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_assoc_device_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &assoc
);
769 if ((tree
) && (assoc
)) {
770 proto_tree_add_item(tree
, hf_zbee_zdp_index
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
773 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, assoc
*(int)sizeof(uint16_t),
774 ett_zbee_zdp_assoc_device
, NULL
, "Associated Device List");
776 for (i
=0; i
<assoc
; i
++) {
777 proto_tree_add_item(field_tree
, hf_zbee_zdp_assoc_device
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
);
782 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
783 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
784 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x = %s", device
, eui64_to_display(pinfo
->pool
, ext_addr
));
787 /* Dump any leftover bytes. */
788 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
789 } /* dissect_zbee_zdp_rsp_ext_addr */
792 *ZigBee Device Profile dissector for the node descriptor
794 *@param tvb pointer to buffer containing raw packet.
795 *@param pinfo pointer to packet information fields
796 *@param tree pointer to data tree Wireshark uses to display packet.
799 dissect_zbee_zdp_rsp_node_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
806 status
= zdp_parse_status(tree
, tvb
, &offset
);
807 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
809 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
810 zdp_parse_node_desc(tree
, pinfo
, true, ett_zbee_zdp_node
, tvb
, &offset
, version
);
813 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
814 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
816 offset
= dissect_zbee_tlvs(tvb
, pinfo
, tree
, offset
, NULL
, ZBEE_TLV_SRC_TYPE_ZBEE_ZDP
, ZBEE_ZDP_RSP_NODE_DESC
);
818 /* Dump any leftover bytes. */
819 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
820 } /* dissect_zbee_zdp_rsp_node_desc */
823 *ZigBee Device Profile dissector for the power descriptor
825 *@param tvb pointer to buffer containing raw packet.
826 *@param pinfo pointer to packet information fields
827 *@param tree pointer to data tree Wireshark uses to display packet.
830 dissect_zbee_zdp_rsp_power_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
837 status
= zdp_parse_status(tree
, tvb
, &offset
);
838 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
840 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
841 zdp_parse_power_desc(tree
, ett_zbee_zdp_power
, tvb
, &offset
);
844 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
845 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
847 /* Dump any leftover bytes. */
848 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
849 } /* dissect_zbee_zdp_rsp_power_desc */
852 *ZigBee Device Profile dissector for the simple descriptor
854 *@param tvb pointer to buffer containing raw packet.
855 *@param pinfo pointer to packet information fields
856 *@param tree pointer to data tree Wireshark uses to display packet.
859 dissect_zbee_zdp_rsp_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
867 status
= zdp_parse_status(tree
, tvb
, &offset
);
868 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
870 proto_tree_add_item(tree
, hf_zbee_zdp_simple_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
872 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
873 zdp_parse_simple_desc(tree
, ett_zbee_zdp_simple
, tvb
, &offset
, version
);
876 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
877 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
879 /* Dump any leftover bytes. */
880 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
881 } /* dissect_zbee_zdp_rsp_simple_desc */
884 *ZigBee Device Profile dissector for the active endpoint
886 *@param tvb pointer to buffer containing raw packet.
887 *@param pinfo pointer to packet information fields
888 *@param tree pointer to data tree Wireshark uses to display packet.
891 dissect_zbee_zdp_rsp_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
893 proto_tree
*field_tree
= NULL
;
898 uint32_t device
, ep_count
;
900 status
= zdp_parse_status(tree
, tvb
, &offset
);
901 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
903 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_ep_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &ep_count
);
907 if (tree
&& ep_count
) {
908 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, ep_count
*(int)sizeof(uint8_t),
909 ett_zbee_zdp_endpoint
, NULL
, "Active Endpoint List");
911 for (i
=0; i
<ep_count
; i
++) {
912 proto_tree_add_item(field_tree
, hf_zbee_zdp_endpoint
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
916 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
917 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
919 /* Dump any leftover bytes. */
920 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
921 } /* dissect_zbee_zdp_rsp_active_ep */
924 *ZigBee Device Profile dissector for the simple descriptor
926 *@param tvb pointer to buffer containing raw packet.
927 *@param pinfo pointer to packet information fields
928 *@param tree pointer to data tree Wireshark uses to display packet.
931 dissect_zbee_zdp_rsp_match_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
933 proto_tree
*field_tree
= NULL
;
938 uint32_t device
, ep_count
;
940 status
= zdp_parse_status(tree
, tvb
, &offset
);
941 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
943 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_ep_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &ep_count
);
946 if (tree
&& ep_count
) {
947 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, ep_count
*(int)sizeof(uint8_t),
948 ett_zbee_zdp_endpoint
, NULL
, "Matching Endpoint List");
950 for (i
=0; i
<ep_count
; i
++) {
951 proto_tree_add_item(field_tree
, hf_zbee_zdp_endpoint
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
955 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
956 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
958 /* Dump any leftover bytes. */
959 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
960 } /* dissect_zbee_zdp_rsp_match_desc */
963 *ZigBee Device Profile dissector for the complex descriptor
965 *@param tvb pointer to buffer containing raw packet.
966 *@param pinfo pointer to packet information fields
967 *@param tree pointer to data tree Wireshark uses to display packet.
970 dissect_zbee_zdp_rsp_complex_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
975 uint32_t device
, length
;
977 status
= zdp_parse_status(tree
, tvb
, &offset
);
979 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 2))) {
980 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
981 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
984 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 1))) {
985 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_complex_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &length
);
989 zdp_parse_complex_desc(pinfo
, tree
, -1, tvb
, &offset
, length
);
993 /* Dump any leftover bytes. */
994 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
997 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
999 } /* dissect_zbee_zdp_rsp_complex_desc */
1002 *ZigBee Device Profile dissector for the user descriptor
1004 *@param tvb pointer to buffer containing raw packet.
1005 *@param pinfo pointer to packet information fields
1006 *@param tree pointer to data tree Wireshark uses to display packet.
1009 dissect_zbee_zdp_rsp_user_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
1011 unsigned offset
= 0;
1013 uint32_t device
, user_length
;
1016 status
= zdp_parse_status(tree
, tvb
, &offset
);
1017 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 2))) {
1018 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
1019 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
1022 if ((version
>= ZBEE_VERSION_2007
) || (status
== ZBEE_ZDP_STATUS_SUCCESS
)) {
1023 /* In ZigBee 2003 & earlier, the length field is omitted if not successful. */
1024 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_user_length
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &user_length
);
1027 else user_length
= 0;
1029 user
= tvb_get_string_enc(pinfo
->pool
, tvb
, offset
, user_length
, ENC_ASCII
);
1031 proto_tree_add_string(tree
, hf_zbee_zdp_user
, tvb
, offset
, user_length
, user
);
1033 offset
+= user_length
;
1035 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
1036 zbee_append_info(tree
, pinfo
, ", Desc: \'%s\'", user
);
1038 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1040 /* Dump any leftover bytes. */
1041 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1042 } /* dissect_zbee_zdp_rsp_user_desc */
1045 *ZigBee Device Profile dissector for the set user descriptor
1047 *@param tvb pointer to buffer containing raw packet.
1048 *@param pinfo pointer to packet information fields
1049 *@param tree pointer to data tree Wireshark uses to display packet.
1052 dissect_zbee_zdp_rsp_user_desc_conf(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, uint8_t version
)
1054 unsigned offset
= 0;
1056 uint32_t device
= 0;
1058 status
= zdp_parse_status(tree
, tvb
, &offset
);
1059 if (version
>= ZBEE_VERSION_2007
) {
1060 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 2))) {
1061 /* Device address present only on ZigBee 2006 & later. */
1062 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
1063 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
1068 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1070 /* Dump any leftover bytes. */
1071 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1072 } /* dissect_zbee_zdp_rsp_user_desc_conf */
1075 *ZigBee Device Profile dissector for the discovery cache
1077 *@param tvb pointer to buffer containing raw packet.
1078 *@param pinfo pointer to packet information fields
1079 *@param tree pointer to data tree Wireshark uses to display packet.
1082 dissect_zbee_zdp_rsp_discovery_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1084 unsigned offset
= 0;
1087 status
= zdp_parse_status(tree
, tvb
, &offset
);
1088 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1090 /* Dump any leftover bytes. */
1091 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1092 } /* dissect_zbee_zdp_rsp_discovery_cache */
1095 *ZigBee Device Profile dissector for the system server discovery
1097 *@param tvb pointer to buffer containing raw packet.
1098 *@param pinfo pointer to packet information fields
1099 *@param tree pointer to data tree Wireshark uses to display packet.
1102 dissect_zbee_zdp_rsp_system_server_disc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1104 unsigned offset
= 0;
1107 status
= zdp_parse_status(tree
, tvb
, &offset
);
1109 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 2))) {
1110 zdp_parse_server_flags(tree
, ett_zbee_zdp_server
, tvb
, &offset
);
1113 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1115 /* Dump any leftover bytes. */
1116 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1117 } /* dissect_zbee_zdp_rsp_system_server_disc */
1120 *ZigBee Device Profile dissector for the discovery store
1122 *@param tvb pointer to buffer containing raw packet.
1123 *@param pinfo pointer to packet information fields
1124 *@param tree pointer to data tree Wireshark uses to display packet.
1127 dissect_zbee_zdp_rsp_discovery_store(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1129 unsigned offset
= 0;
1132 status
= zdp_parse_status(tree
, tvb
, &offset
);
1133 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1135 /* Dump any leftover bytes. */
1136 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1137 } /* dissect_zbee_zdp_rsp_discovery_store */
1140 *ZigBee Device Profile dissector for the store node descriptor
1142 *@param tvb pointer to buffer containing raw packet.
1143 *@param pinfo pointer to packet information fields
1144 *@param tree pointer to data tree Wireshark uses to display packet.
1147 dissect_zbee_zdp_rsp_store_node_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1149 unsigned offset
= 0;
1152 status
= zdp_parse_status(tree
, tvb
, &offset
);
1153 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1155 /* Dump any leftover bytes. */
1156 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1157 } /* dissect_zbee_zdp_rsp_store_node_desc */
1160 *ZigBee Device Profile dissector for the store power descriptor
1162 *@param tvb pointer to buffer containing raw packet.
1163 *@param pinfo pointer to packet information fields
1164 *@param tree pointer to data tree Wireshark uses to display packet.
1167 dissect_zbee_zdp_rsp_store_power_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1169 unsigned offset
= 0;
1172 status
= zdp_parse_status(tree
, tvb
, &offset
);
1173 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1175 /* Dump any leftover bytes. */
1176 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1177 } /* dissect_zbee_zdp_rsp_store_power_desc */
1180 *ZigBee Device Profile dissector for the store active endpoints
1182 *@param tvb pointer to buffer containing raw packet.
1183 *@param pinfo pointer to packet information fields
1184 *@param tree pointer to data tree Wireshark uses to display packet.
1187 dissect_zbee_zdp_rsp_store_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1189 unsigned offset
= 0;
1192 status
= zdp_parse_status(tree
, tvb
, &offset
);
1193 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1195 /* Dump any leftover bytes. */
1196 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1197 } /* dissect_zbee_zdp_rsp_store_active_ep */
1200 *ZigBee Device Profile dissector for the store power descriptor
1202 *@param tvb pointer to buffer containing raw packet.
1203 *@param pinfo pointer to packet information fields
1204 *@param tree pointer to data tree Wireshark uses to display packet.
1207 dissect_zbee_zdp_rsp_store_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1209 unsigned offset
= 0;
1212 status
= zdp_parse_status(tree
, tvb
, &offset
);
1213 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1215 /* Dump any leftover bytes. */
1216 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1217 } /* dissect_zbee_zdp_rsp_store_simple_desc */
1220 *ZigBee Device Profile dissector for the remove node cache
1222 *@param tvb pointer to buffer containing raw packet.
1223 *@param pinfo pointer to packet information fields
1224 *@param tree pointer to data tree Wireshark uses to display packet.
1227 dissect_zbee_zdp_rsp_remove_node_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1229 unsigned offset
= 0;
1232 status
= zdp_parse_status(tree
, tvb
, &offset
);
1233 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1235 /* Dump any leftover bytes. */
1236 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1237 } /* dissect_zbee_zdp_rsp_remove_node_cache */
1240 *ZigBee Device Profile dissector for the find node cache
1242 *@param tvb pointer to buffer containing raw packet.
1243 *@param pinfo pointer to packet information fields
1244 *@param tree pointer to data tree Wireshark uses to display packet.
1247 dissect_zbee_zdp_rsp_find_node_cache(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1249 unsigned offset
= 0;
1250 uint32_t device
, cache
;
1252 /* Find Node Cache does NOT start with status */
1253 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_cache
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &cache
);
1255 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
1257 /*ext_addr =*/ zbee_parse_eui64(tree
, hf_zbee_zdp_ext_addr
, tvb
, &offset
, (int)sizeof(uint64_t), NULL
);
1259 zbee_append_info(tree
, pinfo
, ", Cache: 0x%04x", cache
);
1260 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
1262 /* Dump any leftover bytes. */
1263 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1264 } /* dissect_zbee_zdp_rsp_find_node_cache */
1267 *ZigBee Device Profile dissector for the extended simple
1269 *@param tvb pointer to buffer containing raw packet.
1270 *@param pinfo pointer to packet information fields
1271 *@param tree pointer to data tree Wireshark uses to display packet.
1274 dissect_zbee_zdp_rsp_ext_simple_desc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1277 unsigned offset
= 0;
1279 unsigned sizeof_cluster
= (int)sizeof(uint16_t);
1281 uint32_t device
, cluster
, in_count
, out_count
, idx
;
1283 status
= zdp_parse_status(tree
, tvb
, &offset
);
1284 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 2))) {
1285 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
1286 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
1290 if (status
== ZBEE_ZDP_STATUS_SUCCESS
) {
1291 proto_tree_add_item(tree
, hf_zbee_zdp_endpoint
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
1293 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_in_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &in_count
);
1295 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_out_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &out_count
);
1297 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_index
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &idx
);
1300 /* Display the input cluster list. */
1301 for (i
=idx
; (i
<in_count
) && tvb_bytes_exist(tvb
, offset
, sizeof_cluster
); i
++) {
1302 ti
= proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_in_cluster
, tvb
, offset
, sizeof_cluster
, ENC_LITTLE_ENDIAN
, &cluster
);
1303 offset
+= sizeof_cluster
;
1304 proto_item_append_text(ti
, " (%s)", rval_to_str_const(cluster
, zbee_aps_cid_names
, "Unknown Cluster"));
1306 for (i
-=in_count
; (i
<out_count
) && tvb_bytes_exist(tvb
, offset
, sizeof_cluster
); i
++) {
1307 ti
= proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_out_cluster
, tvb
, offset
, sizeof_cluster
, ENC_LITTLE_ENDIAN
, &cluster
);
1308 offset
+= sizeof_cluster
;
1309 proto_item_append_text(ti
, " (%s)", rval_to_str_const(cluster
, zbee_aps_cid_names
, "Unknown Cluster"));
1312 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1314 /* Dump any leftover bytes. */
1315 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1316 } /* dissect_zbee_zdp_rsp_ext_simple_desc */
1319 *ZigBee Device Profile dissector for the extended active
1321 *@param tvb pointer to buffer containing raw packet.
1322 *@param pinfo pointer to packet information fields
1323 *@param tree pointer to data tree Wireshark uses to display packet.
1326 dissect_zbee_zdp_rsp_ext_active_ep(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1328 proto_tree
*field_tree
= NULL
;
1329 unsigned offset
= 0;
1333 uint32_t device
, ep_count
, idx
;
1335 status
= zdp_parse_status(tree
, tvb
, &offset
);
1336 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 2))) {
1337 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_nwk_addr
, tvb
, offset
, 2, ENC_LITTLE_ENDIAN
, &device
);
1338 zbee_append_info(tree
, pinfo
, ", Nwk Addr: 0x%04x", device
);
1342 /* on success require both, when unsuccessful okay to skip both but not just one */
1343 if ((status
== ZBEE_ZDP_STATUS_SUCCESS
) || (tvb_bytes_exist(tvb
, offset
, 1))) {
1344 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_ep_count
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &ep_count
);
1346 proto_tree_add_item_ret_uint(tree
, hf_zbee_zdp_index
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
, &idx
);
1349 if (tree
&& ep_count
) {
1350 field_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, ep_count
*(int)sizeof(uint8_t),
1351 ett_zbee_zdp_endpoint
, NULL
, "Active Endpoint List");
1352 for (i
=idx
; (i
<ep_count
) && tvb_bytes_exist(tvb
, offset
, (int)sizeof(uint8_t)); i
++) {
1353 proto_tree_add_item(field_tree
, hf_zbee_zdp_endpoint
, tvb
, offset
, 1, ENC_LITTLE_ENDIAN
);
1359 zbee_append_info(tree
, pinfo
, ", Status: %s", zdp_status_name(status
));
1361 /* Dump any leftover bytes. */
1362 zdp_dump_excess(tvb
, offset
, pinfo
, tree
);
1363 } /* dissect_zbee_zdp_rsp_ext_active_ep */
1366 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1371 * indent-tabs-mode: nil
1374 * vi: set shiftwidth=4 tabstop=8 expandtab:
1375 * :indentSize=4:tabSize=8:noTabs=true: