HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-zbee-zdp-discovery.c
blob57a76bfd739020e52ef0d75196178a0922cafda3
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 * $Id$
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.
27 /* Include Files */
28 #include "config.h"
30 #include <glib.h>
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 /**************************************
39 * DISCOVERY REQUESTS
40 **************************************
42 /*FUNCTION:------------------------------------------------------
43 * NAME
44 * dissect_zbee_zdp_req_nwk_addr
45 * DESCRIPTION
46 * ZigBee Device Profile dissector for the network address
47 * request. Cluster ID = 0x0000.
48 * PARAMETERS
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.
52 * RETURNS
53 * void
54 *---------------------------------------------------------------
56 void
57 dissect_zbee_zdp_req_nwk_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
59 guint offset = 0;
61 guint64 ext_addr;
62 /*guint8 req_type;*/
63 /*guint8 idx;*/
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:------------------------------------------------------
76 * NAME
77 * dissect_zbee_zdp_req_ext_addr
78 * DESCRIPTION
79 * ZigBee Device Profile dissector for the extended address
80 * request. Cluster ID = 0x0001.
81 * PARAMETERS
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.
85 * RETURNS
86 * void
87 *---------------------------------------------------------------
89 void
90 dissect_zbee_zdp_req_ext_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
92 guint offset = 0;
94 guint16 device;
95 /*guint8 req_type;*/
96 /*guint8 idx;*/
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:------------------------------------------------------
109 * NAME
110 * dissect_zbee_zdp_req_desc
111 * DESCRIPTION
112 * ZigBee Device Profile dissector for the descriptor
113 * requests. Cluster ID = 0x0002.
114 * PARAMETERS
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.
118 * RETURNS
119 * void
120 *---------------------------------------------------------------
122 void
123 dissect_zbee_zdp_req_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
125 guint offset = 0;
126 guint16 device;
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:------------------------------------------------------
137 * NAME
138 * dissect_zbee_zdp_req_power_desc
139 * DESCRIPTION
140 * ZigBee Device Profile dissector for the node descriptor
141 * request. Cluster ID = 0x0003.
142 * PARAMETERS
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.
146 * RETURNS
147 * void
148 *---------------------------------------------------------------
150 void
151 dissect_zbee_zdp_req_power_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
153 guint offset = 0;
154 guint16 device;
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:------------------------------------------------------
165 * NAME
166 * dissect_zbee_zdp_req_simple_desc
167 * DESCRIPTION
168 * ZigBee Device Profile dissector for the simple descriptor
169 * request. Cluster ID = 0x0004.
170 * PARAMETERS
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.
174 * RETURNS
175 * void
176 *---------------------------------------------------------------
178 void
179 dissect_zbee_zdp_req_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
181 guint offset = 0;
182 guint16 device;
183 guint8 endpt;
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:------------------------------------------------------
195 * NAME
196 * dissect_zbee_zdp_req_active_ep
197 * DESCRIPTION
198 * ZigBee Device Profile dissector for the active endpoint list
199 * request. Cluster ID = 0x0005.
200 * PARAMETERS
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.
204 * RETURNS
205 * void
206 *---------------------------------------------------------------
208 void
209 dissect_zbee_zdp_req_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
211 guint offset = 0;
212 guint16 device;
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:------------------------------------------------------
223 * NAME
224 * dissect_zbee_zdp_req_match_desc
225 * DESCRIPTION
226 * ZigBee Device Profile dissector for the matching descriptor
227 * request. Cluster ID = 0x0006.
228 * PARAMETERS
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.
232 * RETURNS
233 * void
234 *---------------------------------------------------------------
236 void
237 dissect_zbee_zdp_req_match_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
239 proto_item *ti;
240 proto_tree *field_tree = NULL;
241 guint offset = 0, i;
242 guint sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8);
244 guint16 device;
245 guint16 profile;
246 guint8 in_count;
247 guint8 out_count;
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:------------------------------------------------------
275 * NAME
276 * dissect_zbee_zdp_req_complex_desc
277 * DESCRIPTION
278 * ZigBee Device Profile dissector for the complex descriptor
279 * request. Cluster ID = 0x0010.
280 * PARAMETERS
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.
284 * RETURNS
285 * void
286 *---------------------------------------------------------------
288 void
289 dissect_zbee_zdp_req_complex_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
291 guint offset = 0;
292 guint16 device;
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:------------------------------------------------------
303 * NAME
304 * dissect_zbee_zdp_req_user_desc
305 * DESCRIPTION
306 * ZigBee Device Profile dissector for the user descriptor
307 * request. Cluster ID = 0x0011.
308 * PARAMETERS
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.
312 * RETURNS
313 * void
314 *---------------------------------------------------------------
316 void
317 dissect_zbee_zdp_req_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
319 guint offset = 0;
320 guint16 device;
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:------------------------------------------------------
331 * NAME
332 * dissect_zbee_zdp_req_discovery_cache
333 * DESCRIPTION
334 * ZigBee Device Profile dissector for the discovery cache
335 * request. Cluster ID = 0x0012.
336 * PARAMETERS
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.
340 * RETURNS
341 * void
342 *---------------------------------------------------------------
344 void
345 dissect_zbee_zdp_req_discovery_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
347 guint offset = 0;
348 /*guint16 device;*/
349 guint64 ext_addr;
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:------------------------------------------------------
361 * NAME
362 * dissect_zbee_zdp_device_annce
363 * DESCRIPTION
364 * ZigBee Device Profile dissector for the device announcement.
365 * Cluster ID = 0x0013.
366 * PARAMETERS
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.
370 * RETURNS
371 * void
372 *---------------------------------------------------------------
374 void
375 dissect_zbee_zdp_device_annce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
377 guint offset = 0;
378 /*guint16 device;*/
379 guint64 ext_addr;
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:------------------------------------------------------
393 * NAME
394 * dissect_zbee_zdp_req_set_user_desc
395 * DESCRIPTION
396 * ZigBee Device Profile dissector for the end set user
397 * descriptor request. Cluster ID = 0x0014.
398 * PARAMETERS
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.
402 * RETURNS
403 * void
404 *---------------------------------------------------------------
406 void
407 dissect_zbee_zdp_req_set_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
409 guint offset = 0;
410 guint16 device;
411 guint8 user_length;
412 gchar *user;
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);
418 else {
419 /* No Length field in ZigBee 2003 & earlier, uses a fixed length of 16. */
420 user_length = 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';
425 if (tree) {
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:------------------------------------------------------
437 * NAME
438 * dissect_zbee_zdp_req_system_server_disc
439 * DESCRIPTION
440 * ZigBee Device Profile dissector for the system server
441 * discovery request. Cluster ID = 0x0015.
442 * PARAMETERS
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.
446 * RETURNS
447 * void
448 *---------------------------------------------------------------
450 void
451 dissect_zbee_zdp_req_system_server_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
453 guint offset = 0;
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:------------------------------------------------------
463 * NAME
464 * dissect_zbee_zdp_req_store_discovery
465 * DESCRIPTION
466 * ZigBee Device Profile dissector for the store node cache
467 * request. Cluster ID = 0x0016.
468 * PARAMETERS
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.
472 * RETURNS
473 * void
474 *---------------------------------------------------------------
476 void
477 dissect_zbee_zdp_req_store_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
479 proto_item *ti;
480 proto_tree *field_tree = NULL;
481 guint offset = 0;
482 guint i;
484 /*guint16 device;*/
485 guint64 ext_addr;
486 /*guint8 node_size;*/
487 /*guint8 power_size;*/
488 /*guint8 ep_count;*/
489 guint8 simple_count;
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);
498 if (tree) {
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:------------------------------------------------------
513 * NAME
514 * dissect_zbee_zdp_req_store_node_desc
515 * DESCRIPTION
516 * ZigBee Device Profile dissector for the store node descriptor
517 * request. Cluster ID = 0x0017.
518 * PARAMETERS
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.
522 * RETURNS
523 * void
524 *---------------------------------------------------------------
526 void
527 dissect_zbee_zdp_req_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
529 guint offset = 0;
530 /*guint16 device;*/
531 guint64 ext_addr;
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:------------------------------------------------------
544 * NAME
545 * dissect_zbee_zdp_req_store_power_desc
546 * DESCRIPTION
547 * ZigBee Device Profile dissector for the store power descriptor
548 * request. Cluster ID = 0x0018.
549 * PARAMETERS
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.
553 * RETURNS
554 * void
555 *---------------------------------------------------------------
557 void
558 dissect_zbee_zdp_req_store_power_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
560 guint offset = 0;
561 /*guint16 device;*/
562 guint64 ext_addr;
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:------------------------------------------------------
575 * NAME
576 * dissect_zbee_zdp_req_store_active_ep
577 * DESCRIPTION
578 * ZigBee Device Profile dissector for the store active endpoint
579 * request. Cluster ID = 0x0019.
580 * PARAMETERS
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.
584 * RETURNS
585 * void
586 *---------------------------------------------------------------
588 void
589 dissect_zbee_zdp_req_store_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
591 proto_item *ti;
592 proto_tree *field_tree = NULL;
593 guint offset = 0;
594 guint i;
596 /*guint16 device;*/
597 guint64 ext_addr;
598 guint8 ep_count;
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);
604 if (tree) {
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:------------------------------------------------------
619 * NAME
620 * dissect_zbee_zdp_req_store_simple_desc
621 * DESCRIPTION
622 * ZigBee Device Profile dissector for the store simple descriptor
623 * request. Cluster ID = 0x001a.
624 * PARAMETERS
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.
628 * RETURNS
629 * void
630 *---------------------------------------------------------------
632 void
633 dissect_zbee_zdp_req_store_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
635 guint offset = 0;
636 /*guint16 device;*/
637 guint64 ext_addr;
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:------------------------------------------------------
652 * NAME
653 * dissect_zbee_zdp_req_remove_node_cache
654 * DESCRIPTION
655 * ZigBee Device Profile dissector for the remove node cache
656 * request. Cluster ID = 0x001b.
657 * PARAMETERS
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.
661 * RETURNS
662 * void
663 *---------------------------------------------------------------
665 void
666 dissect_zbee_zdp_req_remove_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
668 guint offset = 0;
669 /*guint16 device;*/
670 guint64 ext_addr;
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:------------------------------------------------------
682 * NAME
683 * dissect_zbee_zdp_req_find_node_cache
684 * DESCRIPTION
685 * ZigBee Device Profile dissector for the find node cache
686 * request. Cluster ID = 0x001c.
687 * PARAMETERS
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.
691 * RETURNS
692 * void
693 *---------------------------------------------------------------
695 void
696 dissect_zbee_zdp_req_find_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
698 guint offset = 0;
699 /*guint16 device;*/
700 guint64 ext_addr;
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:------------------------------------------------------
712 * NAME
713 * dissect_zbee_zdp_req_ext_simple_desc
714 * DESCRIPTION
715 * ZigBee Device Profile dissector for the extended simple
716 * descriptor request. Cluster ID = 0x001d.
717 * PARAMETERS
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.
721 * RETURNS
722 * void
723 *---------------------------------------------------------------
725 void
726 dissect_zbee_zdp_req_ext_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
728 guint offset = 0;
729 guint16 device;
730 guint8 endpt;
731 /*guint8 idx;*/
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:------------------------------------------------------
744 * NAME
745 * dissect_zbee_zdp_req_ext_active_ep
746 * DESCRIPTION
747 * ZigBee Device Profile dissector for the extended active
748 * endpoint list request. Cluster ID = 0x001e.
749 * PARAMETERS
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.
753 * RETURNS
754 * void
755 *---------------------------------------------------------------
757 void
758 dissect_zbee_zdp_req_ext_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
760 guint offset = 0;
761 guint16 device;
762 /*guint8 idx;*/
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:------------------------------------------------------
778 * NAME
779 * dissect_zbee_zdp_rsp_nwk_addr
780 * DESCRIPTION
781 * ZigBee Device Profile dissector for the network address
782 * response. Cluster ID = 0x8000.
783 * PARAMETERS
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.
787 * RETURNS
788 * void
789 *---------------------------------------------------------------
791 void
792 dissect_zbee_zdp_rsp_nwk_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
794 proto_item *ti;
795 proto_tree *field_tree = NULL;
796 guint offset = 0;
797 guint i;
799 guint8 status;
800 guint64 ext_addr;
801 guint16 device;
802 guint8 assoc;
803 /*guint8 idx;*/
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:------------------------------------------------------
833 * NAME
834 * dissect_zbee_zdp_rsp_ext_addr
835 * DESCRIPTION
836 * ZigBee Device Profile dissector for the extended address
837 * response. Cluster ID = 0x8001.
838 * PARAMETERS
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.
842 * RETURNS
843 * void
844 *---------------------------------------------------------------
846 void
847 dissect_zbee_zdp_rsp_ext_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
849 proto_item *ti;
850 proto_tree *field_tree = NULL;
851 guint offset = 0;
852 guint i;
854 guint8 status;
855 guint64 ext_addr;
856 guint16 device;
857 guint8 assoc;
858 /*guint8 idx;*/
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:------------------------------------------------------
888 * NAME
889 * dissect_zbee_zdp_rsp_node_desc
890 * DESCRIPTION
891 * ZigBee Device Profile dissector for the node descriptor
892 * response. Cluster ID = 0x8002.
893 * PARAMETERS
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.
897 * RETURNS
898 * void
899 *---------------------------------------------------------------
901 void
902 dissect_zbee_zdp_rsp_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
904 guint offset = 0;
906 guint8 status;
907 guint16 device;
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:------------------------------------------------------
923 * NAME
924 * dissect_zbee_zdp_rsp_power_desc
925 * DESCRIPTION
926 * ZigBee Device Profile dissector for the power descriptor
927 * response. Cluster ID = 0x8003.
928 * PARAMETERS
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.
932 * RETURNS
933 * void
934 *---------------------------------------------------------------
936 void
937 dissect_zbee_zdp_rsp_power_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
939 guint offset = 0;
941 guint8 status;
942 guint16 device;
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:------------------------------------------------------
958 * NAME
959 * dissect_zbee_zdp_rsp_simple_desc
960 * DESCRIPTION
961 * ZigBee Device Profile dissector for the simple descriptor
962 * response. Cluster ID = 0x8004.
963 * PARAMETERS
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.
967 * RETURNS
968 * void
969 *---------------------------------------------------------------
971 void
972 dissect_zbee_zdp_rsp_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
974 guint offset = 0;
976 guint8 status;
977 /*guint8 length;*/
978 guint16 device;
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:------------------------------------------------------
995 * NAME
996 * dissect_zbee_zdp_rsp_active_ep
997 * DESCRIPTION
998 * ZigBee Device Profile dissector for the active endpoint
999 * response. Cluster ID = 0x8005.
1000 * PARAMETERS
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.
1004 * RETURNS
1005 * void
1006 *---------------------------------------------------------------
1008 void
1009 dissect_zbee_zdp_rsp_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1011 proto_item *ti;
1012 proto_tree *field_tree = NULL;
1013 guint offset = 0;
1014 guint i;
1016 guint8 status;
1017 guint16 device;
1018 guint8 ep_count;
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:------------------------------------------------------
1040 * NAME
1041 * dissect_zbee_zdp_rsp_match_desc
1042 * DESCRIPTION
1043 * ZigBee Device Profile dissector for the simple descriptor
1044 * response. Cluster ID = 0x8003.
1045 * PARAMETERS
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.
1049 * RETURNS
1050 * void
1051 *---------------------------------------------------------------
1053 void
1054 dissect_zbee_zdp_rsp_match_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1056 proto_item *ti;
1057 proto_tree *field_tree = NULL;
1058 guint offset = 0;
1059 guint i;
1061 guint8 status;
1062 guint16 device;
1063 guint8 ep_count;
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:------------------------------------------------------
1085 * NAME
1086 * dissect_zbee_zdp_rsp_complex_desc
1087 * DESCRIPTION
1088 * ZigBee Device Profile dissector for the complex descriptor
1089 * response. Cluster ID = 0x8010.
1090 * PARAMETERS
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.
1094 * RETURNS
1095 * void
1096 *---------------------------------------------------------------
1098 void
1099 dissect_zbee_zdp_rsp_complex_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1101 guint offset = 0;
1103 guint8 status;
1104 guint8 length;
1105 guint16 device;
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);
1110 if (length) {
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:------------------------------------------------------
1122 * NAME
1123 * dissect_zbee_zdp_rsp_user_desc
1124 * DESCRIPTION
1125 * ZigBee Device Profile dissector for the user descriptor
1126 * response. Cluster ID = 0x8011.
1127 * PARAMETERS
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.
1131 * RETURNS
1132 * void
1133 *---------------------------------------------------------------
1135 void
1136 dissect_zbee_zdp_rsp_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
1138 guint offset = 0;
1139 guint8 status;
1140 guint16 device;
1141 guint8 user_length;
1142 gchar *user;
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);
1153 if (tree) {
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:------------------------------------------------------
1169 * NAME
1170 * dissect_zbee_zdp_rsp_user_desc_conf
1171 * DESCRIPTION
1172 * ZigBee Device Profile dissector for the set user descriptor
1173 * confirmation. Cluster ID = 0x8014.
1174 * PARAMETERS
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.
1178 * RETURNS
1179 * void
1180 *---------------------------------------------------------------
1182 void
1183 dissect_zbee_zdp_rsp_user_desc_conf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
1185 guint offset = 0;
1186 guint8 status;
1187 guint16 device = 0;
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:------------------------------------------------------
1203 * NAME
1204 * dissect_zbee_zdp_rsp_discovery_cache
1205 * DESCRIPTION
1206 * ZigBee Device Profile dissector for the discovery cache
1207 * response. Cluster ID = 0x8012.
1208 * PARAMETERS
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.
1212 * RETURNS
1213 * void
1214 *---------------------------------------------------------------
1216 void
1217 dissect_zbee_zdp_rsp_discovery_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1219 guint offset = 0;
1221 guint8 status;
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:------------------------------------------------------
1232 * NAME
1233 * dissect_zbee_zdp_rsp_system_server_disc
1234 * DESCRIPTION
1235 * ZigBee Device Profile dissector for the system server discovery
1236 * response. Cluster ID = 0x8015.
1237 * PARAMETERS
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.
1241 * RETURNS
1242 * void
1243 *---------------------------------------------------------------
1245 void
1246 dissect_zbee_zdp_rsp_system_server_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1248 guint offset = 0;
1250 guint8 status;
1251 /*guint16 server;*/
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:------------------------------------------------------
1263 * NAME
1264 * dissect_zbee_zdp_rsp_discovery_store
1265 * DESCRIPTION
1266 * ZigBee Device Profile dissector for the discovery store
1267 * response. Cluster ID = 0x8016.
1268 * PARAMETERS
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.
1272 * RETURNS
1273 * void
1274 *---------------------------------------------------------------
1276 void
1277 dissect_zbee_zdp_rsp_discovery_store(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1279 guint offset = 0;
1281 guint8 status;
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:------------------------------------------------------
1292 * NAME
1293 * dissect_zbee_zdp_rsp_store_node_desc
1294 * DESCRIPTION
1295 * ZigBee Device Profile dissector for the store node descriptor
1296 * response. Cluster ID = 0x8017.
1297 * PARAMETERS
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.
1301 * RETURNS
1302 * void
1303 *---------------------------------------------------------------
1305 void
1306 dissect_zbee_zdp_rsp_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1308 guint offset = 0;
1310 guint8 status;
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:------------------------------------------------------
1321 * NAME
1322 * dissect_zbee_zdp_rsp_store_power_desc
1323 * DESCRIPTION
1324 * ZigBee Device Profile dissector for the store power descriptor
1325 * response. Cluster ID = 0x8018.
1326 * PARAMETERS
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.
1330 * RETURNS
1331 * void
1332 *---------------------------------------------------------------
1334 void
1335 dissect_zbee_zdp_rsp_store_power_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1337 guint offset = 0;
1339 guint8 status;
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:------------------------------------------------------
1350 * NAME
1351 * dissect_zbee_zdp_rsp_store_active_ep
1352 * DESCRIPTION
1353 * ZigBee Device Profile dissector for the store active endpoints
1354 * response. Cluster ID = 0x8019.
1355 * PARAMETERS
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.
1359 * RETURNS
1360 * void
1361 *---------------------------------------------------------------
1363 void
1364 dissect_zbee_zdp_rsp_store_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1366 guint offset = 0;
1368 guint8 status;
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:------------------------------------------------------
1379 * NAME
1380 * dissect_zbee_zdp_rsp_store_simple_desc
1381 * DESCRIPTION
1382 * ZigBee Device Profile dissector for the store power descriptor
1383 * response. Cluster ID = 0x801a.
1384 * PARAMETERS
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.
1388 * RETURNS
1389 * void
1390 *---------------------------------------------------------------
1392 void
1393 dissect_zbee_zdp_rsp_store_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1395 guint offset = 0;
1397 guint8 status;
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:------------------------------------------------------
1408 * NAME
1409 * dissect_zbee_zdp_rsp_remove_node_cache
1410 * DESCRIPTION
1411 * ZigBee Device Profile dissector for the remove node cache
1412 * response. Cluster ID = 0x801b.
1413 * PARAMETERS
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.
1417 * RETURNS
1418 * void
1419 *---------------------------------------------------------------
1421 void
1422 dissect_zbee_zdp_rsp_remove_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1424 guint offset = 0;
1426 guint8 status;
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:------------------------------------------------------
1437 * NAME
1438 * dissect_zbee_zdp_rsp_find_node_cache
1439 * DESCRIPTION
1440 * ZigBee Device Profile dissector for the find node cache
1441 * response. Cluster ID = 0x801c.
1442 * PARAMETERS
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.
1446 * RETURNS
1447 * void
1448 *---------------------------------------------------------------
1450 void
1451 dissect_zbee_zdp_rsp_find_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1453 guint offset = 0;
1455 guint16 cache;
1456 guint16 device;
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:------------------------------------------------------
1471 * NAME
1472 * dissect_zbee_zdp_rsp_ext_simple_desc
1473 * DESCRIPTION
1474 * ZigBee Device Profile dissector for the extended simple
1475 * descriptor response. Cluster ID = 0x801d.
1476 * PARAMETERS
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.
1480 * RETURNS
1481 * void
1482 *---------------------------------------------------------------
1484 void
1485 dissect_zbee_zdp_rsp_ext_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1487 guint offset = 0;
1488 guint i;
1489 guint sizeof_cluster = (int)sizeof(guint16);
1491 guint8 status;
1492 guint16 device;
1493 /*guint8 endpt;*/
1494 guint8 in_count;
1495 guint8 out_count;
1496 guint8 idx;
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);
1508 } /* for */
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);
1511 } /* for */
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:------------------------------------------------------
1521 * NAME
1522 * dissect_zbee_zdp_rsp_ext_active_ep
1523 * DESCRIPTION
1524 * ZigBee Device Profile dissector for the extended active
1525 * endpoint response. Cluster ID = 0x801e.
1526 * PARAMETERS
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.
1530 * RETURNS
1531 * void
1532 *---------------------------------------------------------------
1534 void
1535 dissect_zbee_zdp_rsp_ext_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1537 proto_item *ti;
1538 proto_tree *field_tree = NULL;
1539 guint offset = 0;
1540 guint i;
1542 guint8 status;
1543 guint16 device;
1544 guint8 ep_count;
1545 guint8 idx;
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 */