MSWSP: add ids for another unknown Property Set
[wireshark-wip.git] / epan / dissectors / packet-zbee-zdp-binding.c
blob3620c3fd1c0aea774f5430e55ee3fbf3b3ab1265
1 /* packet-zbee-zdp-binding.c
2 * Dissector helper routines for the binding services of the ZigBee Device Profile
3 * By Owen Kirby <osk@exegin.com>
4 * Copyright 2009 Exegin Technologies Limited
6 * $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>
32 #include <epan/packet.h>
33 #include <epan/addr_resolv.h>
35 #include "packet-zbee.h"
36 #include "packet-zbee-zdp.h"
39 /**************************************
40 * HELPER FUNCTIONS
41 **************************************
43 /*FUNCTION:------------------------------------------------------
44 * NAME
45 * zdp_parse_bind_table_entry
46 * DESCRIPTION
47 * Parses and displays a single binding table entry.
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 zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 version)
59 proto_item *ti = NULL;
60 guint len = 0;
62 guint64 src64;
63 guint8 src_ep;
64 guint16 cluster;
65 guint8 mode;
66 guint64 dst64;
67 guint16 dst;
68 guint8 dst_ep;
70 /* Add the source address. */
71 src64 = tvb_get_letoh64(tvb, *offset + len);
72 if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "Bind {Src: %s", get_eui64_name(src64));
73 len += (int)sizeof(guint64);
75 /* Add the source endpoint. */
76 src_ep = tvb_get_guint8(tvb, *offset + len);
77 if (tree) proto_item_append_text(ti, ", Src Endpoint: %d", src_ep);
78 len += (int)sizeof(guint8);
80 /* Add the cluster ID. */
81 if (version >= ZBEE_VERSION_2007) {
82 cluster = tvb_get_letohs(tvb, *offset + len);
83 len += (int)sizeof(guint16);
85 else {
86 cluster = tvb_get_guint8(tvb, *offset + len);
87 len += (int)sizeof(guint8);
89 if (tree) proto_item_append_text(ti, ", Cluster: %d", cluster);
91 /* Get the destination address mode. */
92 if (version >= ZBEE_VERSION_2007) {
93 mode = tvb_get_guint8(tvb, *offset + len);
94 len += (int)sizeof(guint8);
96 else {
97 /* Mode field doesn't exist and always uses unicast in 2003 & earlier. */
98 mode = ZBEE_ZDP_ADDR_MODE_UNICAST;
101 /* Add the destination address. */
102 if (mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
103 dst = tvb_get_letohs(tvb, *offset + len);
104 if (tree) proto_item_append_text(ti, ", Dst: 0x%04x}", dst);
105 len += (int)sizeof(guint16);
107 else if (mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
108 dst64 = tvb_get_letoh64(tvb, *offset + len);
109 if (tree) proto_item_append_text(ti, ", Dst: %s", get_eui64_name(dst64));
110 len += (int)sizeof(guint64);
112 dst_ep = tvb_get_guint8(tvb, *offset + len);
113 if (tree) proto_item_append_text(ti, ", Dst Endpoint: %d}", dst_ep);
114 len += (int)sizeof(guint8);
116 else {
117 if (tree) proto_item_append_text(ti, "}");
120 if (tree) {
121 proto_item_set_len(ti, len);
123 *offset += len;
124 } /* zdp_parse_bind_table_entry */
126 /**************************************
127 * BINDING REQUESTS
128 **************************************
130 /*FUNCTION:------------------------------------------------------
131 * NAME
132 * dissect_zbee_zdp_req_end_device_bind
133 * DESCRIPTION
134 * ZigBee Device Profile dissector for the end device bind
135 * request. Cluster ID = 0x0020.
136 * PARAMETERS
137 * tvbuff_t *tvb - pointer to buffer containing raw packet.
138 * packet_into *pinfo - pointer to packet information fields
139 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
140 * RETURNS
141 * void
142 *---------------------------------------------------------------
144 void
145 dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
147 guint sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8);
148 guint i;
149 proto_item *ti;
150 proto_tree *field_tree = NULL;
152 guint offset = 0;
153 guint16 target;
154 guint64 ext_addr = 0;
155 /*guint8 src_ep;*/
156 /*guint16 profile;*/
157 guint8 in_count;
158 guint8 out_count;
160 target = zbee_parse_uint(tree, hf_zbee_zdp_target, tvb, &offset, (guint)sizeof(guint16), NULL);
161 if (version >= ZBEE_VERSION_2007) {
162 /* Extended address present on ZigBee 2006 & later. */
163 ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (guint)sizeof(guint64), NULL);
165 /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, (guint)sizeof(guint8), NULL);
166 /*profile =*/ zbee_parse_uint(tree, hf_zbee_zdp_profile, tvb, &offset, (guint)sizeof(guint16), NULL);
168 in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, (guint)sizeof(guint8), NULL);
169 if ((tree) && (in_count)){
170 ti = proto_tree_add_text(tree, tvb, offset, (int)(in_count*sizeof_cluster), "Input Cluster List");
171 field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind_end_in);
173 for (i=0; i<in_count; i++) zbee_parse_uint(field_tree, hf_zbee_zdp_in_cluster, tvb, &offset, (guint)sizeof_cluster, NULL);
175 out_count = zbee_parse_uint(tree, hf_zbee_zdp_out_count, tvb, &offset, (guint)sizeof(guint8), NULL);
176 if ((tree) && (out_count)) {
177 ti = proto_tree_add_text(tree, tvb, offset, (int)(out_count*sizeof_cluster), "Output Cluster List");
178 field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind_end_out);
180 for (i=0; i<out_count; i++) zbee_parse_uint(field_tree, hf_zbee_zdp_out_cluster, tvb, &offset, sizeof_cluster, NULL);
182 if (version >= ZBEE_VERSION_2007) {
183 zbee_append_info(tree, pinfo, " Src: %s", get_eui64_name(ext_addr));
185 zbee_append_info(tree, pinfo, ", Target: 0x%04x", target);
187 /* Dump any leftover bytes. */
188 zdp_dump_excess(tvb, offset, pinfo, tree);
189 } /* dissect_zbee_zdp_req_end_device_bind */
191 /*FUNCTION:------------------------------------------------------
192 * NAME
193 * dissect_zbee_zdp_req_bind
194 * DESCRIPTION
195 * ZigBee Device Profile dissector for the bind request.
196 * Cluster ID = 0x0021.
197 * PARAMETERS
198 * tvbuff_t *tvb - pointer to buffer containing raw packet.
199 * packet_into *pinfo - pointer to packet information fields
200 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
201 * RETURNS
202 * void
203 *---------------------------------------------------------------
205 void
206 dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
208 proto_item *ti;
210 guint offset = 0;
211 guint64 src64;
212 /*guint8 src_ep;*/
213 /*guint16 cluster;*/
214 guint8 dst_mode;
215 guint16 dst = 0;
216 guint64 dst64 = 0;
217 /*guint8 dst_ep;*/
219 src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL);
220 /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL);
221 /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, ZBEE_HAS_2006(version)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
222 if (version >= ZBEE_VERSION_2007) {
223 dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti);
224 if (tree) {
225 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) proto_item_append_text(ti, " (Group)");
226 else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) proto_item_append_text(ti, " (Unicast)");
227 else proto_item_append_text(ti, " (Reserved)");
230 else {
231 /* ZigBee 2003 & earlier does not have a address mode, and is unicast only. */
232 dst_mode = ZBEE_ZDP_ADDR_MODE_UNICAST;
235 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
236 dst = zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL);
238 else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
239 dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL);
240 /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL);
243 if (version >= ZBEE_VERSION_2007) {
244 zbee_append_info(tree, pinfo, " Src: %s", get_eui64_name(src64));
246 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
247 zbee_append_info(tree, pinfo, ", Dst: 0x%04x", dst);
249 else {
250 zbee_append_info(tree, pinfo, ", Dst: %s", eui64_to_str(dst64));
253 /* Dump any leftover bytes. */
254 zdp_dump_excess(tvb, offset, pinfo, tree);
255 } /* dissect_zbee_zdp_req_bind */
257 /*FUNCTION:------------------------------------------------------
258 * NAME
259 * dissect_zbee_zdp_req_unbind
260 * DESCRIPTION
261 * ZigBee Device Profile dissector for the unbind request.
262 * Cluster ID = 0x0022.
263 * PARAMETERS
264 * tvbuff_t *tvb - pointer to buffer containing raw packet.
265 * packet_into *pinfo - pointer to packet information fields
266 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
267 * RETURNS
268 * void
269 *---------------------------------------------------------------
271 void
272 dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
274 proto_item *ti;
276 guint offset = 0;
277 guint64 src64;
278 /*guint8 src_ep;*/
279 /*guint16 cluster;*/
280 guint8 dst_mode;
281 guint16 dst = 0;
282 guint64 dst64 = 0;
283 /*guint8 dst_ep;*/
285 src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL);
286 /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL);
287 /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
288 if (version >= ZBEE_VERSION_2007) {
289 dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti);
290 if (tree) {
291 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) proto_item_append_text(ti, " (Group)");
292 else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) proto_item_append_text(ti, " (Unicast)");
293 else proto_item_append_text(ti, " (Reserved)");
296 else {
297 /* ZigBee 2003 & earlier does not have a address mode, and is unicast only. */
298 dst_mode = ZBEE_ZDP_ADDR_MODE_UNICAST;
301 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
302 dst = zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL);
304 else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
305 dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL);
306 /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL);
309 if (version >= ZBEE_VERSION_2007) {
310 zbee_append_info(tree, pinfo, " Src: %s", get_eui64_name(src64));
312 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
313 zbee_append_info(tree, pinfo, ", Dst: 0x%04x", dst);
315 else {
316 zbee_append_info(tree, pinfo, ", Dst: %s", eui64_to_str(dst64));
319 /* Dump any leftover bytes. */
320 zdp_dump_excess(tvb, offset, pinfo, tree);
321 } /* dissect_zbee_zdp_req_unbind */
323 /*FUNCTION:------------------------------------------------------
324 * NAME
325 * dissect_zbee_zdp_req_bind_register
326 * DESCRIPTION
327 * ZigBee Device Profile dissector for the bind register
328 * request. Cluster ID = 0x0023.
329 * PARAMETERS
330 * tvbuff_t *tvb - pointer to buffer containing raw packet.
331 * packet_into *pinfo - pointer to packet information fields
332 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
333 * RETURNS
334 * void
335 *---------------------------------------------------------------
337 void
338 dissect_zbee_zdp_req_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
340 guint offset = 0;
341 guint64 ext_addr;
343 ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL);
345 zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
347 /* Dump any leftover bytes. */
348 zdp_dump_excess(tvb, offset, pinfo, tree);
349 } /* dissect_zbee_zdp_req_bind_register */
351 /*FUNCTION:------------------------------------------------------
352 * NAME
353 * dissect_zbee_zdp_req_replace_device
354 * DESCRIPTION
355 * ZigBee Device Profile dissector for the replace device
356 * request. Cluster ID = 0x0024.
357 * PARAMETERS
358 * tvbuff_t *tvb - pointer to buffer containing raw packet.
359 * packet_into *pinfo - pointer to packet information fields
360 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
361 * RETURNS
362 * void
363 *---------------------------------------------------------------
365 void
366 dissect_zbee_zdp_req_replace_device(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
368 guint offset = 0;
369 guint64 ext_addr;
370 /*guint8 endpoint;*/
371 guint64 new_addr;
372 /*guint8 new_ep;*/
374 ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL);
375 /*endpoint =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, (int)sizeof(guint8), NULL);
376 new_addr = zbee_parse_eui64(tree, hf_zbee_zdp_replacement, tvb, &offset, (int)sizeof(guint64), NULL);
377 /*new_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_replacement_ep, tvb, &offset, (int)sizeof(guint8), NULL);
379 zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
380 zbee_append_info(tree, pinfo, ", Replacement: %s", get_eui64_name(new_addr));
382 /* Dump any leftover bytes. */
383 zdp_dump_excess(tvb, offset, pinfo, tree);
384 } /* dissect_zbee_zdp_req_replace_device */
386 /*FUNCTION:------------------------------------------------------
387 * NAME
388 * dissect_zbee_zdp_req_store_bak_bind_entry
389 * DESCRIPTION
390 * ZigBee Device Profile dissector for the store backup binding
391 * entry request. Cluster ID = 0x0025.
392 * PARAMETERS
393 * tvbuff_t *tvb - pointer to buffer containing raw packet.
394 * packet_into *pinfo - pointer to packet information fields
395 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
396 * RETURNS
397 * void
398 *---------------------------------------------------------------
400 void
401 dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
403 proto_item *ti;
405 guint offset = 0;
406 guint64 src64;
407 guint8 src_ep;
408 guint16 cluster;
409 guint8 dst_mode;
411 src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL);
412 src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL);
413 cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
414 dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti);
416 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
417 /*guint16 dst;*/
418 if (tree) proto_item_append_text(ti, " (Group)");
419 /*dst =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL);
421 else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
422 /*guint64 dst64;*/
423 /*guint8 dst_ep;*/
424 if (tree) proto_item_append_text(ti, " (Unicast)");
425 /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL);
426 /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL);
428 else if (tree) proto_item_append_text(ti, " (Reserved)");
430 zbee_append_info(tree, pinfo, ", Src: %s", get_eui64_name(src64));
431 zbee_append_info(tree, pinfo, ", Src Endpoint: %d", src_ep);
432 zbee_append_info(tree, pinfo, ", Cluster: %d", cluster);
434 /* Dump any leftover bytes. */
435 zdp_dump_excess(tvb, offset, pinfo, tree);
436 } /* dissect_zbee_zdp_req_store_bak_bind_entry */
438 /*FUNCTION:------------------------------------------------------
439 * NAME
440 * dissect_zbee_zdp_req_remove_bak_bind_entry
441 * DESCRIPTION
442 * ZigBee Device Profile dissector for the remove backup binding
443 * entry request. Cluster ID = 0x0026.
444 * PARAMETERS
445 * tvbuff_t *tvb - pointer to buffer containing raw packet.
446 * packet_into *pinfo - pointer to packet information fields
447 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
448 * RETURNS
449 * void
450 *---------------------------------------------------------------
452 void
453 dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
455 proto_item *ti;
457 guint offset = 0;
458 guint64 src64;
459 guint8 src_ep;
460 guint16 cluster;
461 guint8 dst_mode;
463 src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL);
464 src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL);
465 cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL);
466 dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti);
468 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
469 /*guint16 dst;*/
470 if (tree) proto_item_append_text(ti, " (Group)");
471 /*dst =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL);
473 else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
474 /*guint64 dst64;*/
475 /*guint8 dst_ep;*/
476 if (tree) proto_item_append_text(ti, " (Unicast)");
477 /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL);
478 /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL);
480 else if (tree) proto_item_append_text(ti, " (Reserved)");
482 zbee_append_info(tree, pinfo, ", Src: %s", get_eui64_name(src64));
483 zbee_append_info(tree, pinfo, ", Src Endpoint: %d", src_ep);
484 zbee_append_info(tree, pinfo, ", Cluster: %d", cluster);
486 /* Dump any leftover bytes. */
487 zdp_dump_excess(tvb, offset, pinfo, tree);
488 } /* dissect_zbee_zdp_req_remove_bak_bind_entry */
490 /*FUNCTION:------------------------------------------------------
491 * NAME
492 * dissect_zbee_zdp_req_backup_bind_table
493 * DESCRIPTION
494 * ZigBee Device Profile dissector for the backup binding
495 * table request. Cluster ID = 0x0027.
496 * PARAMETERS
497 * tvbuff_t *tvb - pointer to buffer containing raw packet.
498 * packet_into *pinfo - pointer to packet information fields
499 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
500 * RETURNS
501 * void
502 *---------------------------------------------------------------
504 void
505 dissect_zbee_zdp_req_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
507 proto_item *ti;
508 proto_tree *field_tree = NULL;
509 guint i;
511 guint offset = 0;
512 /*guint16 table_size;*/
513 /*guint16 idx;*/
514 guint16 table_count;
516 /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL);
517 /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL);
518 table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL);
520 if (tree) {
521 ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Binding Table");
522 field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind);
524 for (i=0; i<table_count; i++) {
525 zdp_parse_bind_table_entry(field_tree, tvb, &offset, version);
526 } /* for */
528 /* Dump any leftover bytes. */
529 zdp_dump_excess(tvb, offset, pinfo, tree);
530 } /* dissect_zbee_zdp_req_backup_bind_table */
532 /*FUNCTION:------------------------------------------------------
533 * NAME
534 * dissect_zbee_zdp_req_recover_bind_table
535 * DESCRIPTION
536 * ZigBee Device Profile dissector for the recover binding
537 * table request. Cluster ID = 0x0028.
538 * PARAMETERS
539 * tvbuff_t *tvb - pointer to buffer containing raw packet.
540 * packet_into *pinfo - pointer to packet information fields
541 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
542 * RETURNS
543 * void
544 *---------------------------------------------------------------
546 void
547 dissect_zbee_zdp_req_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
549 guint offset = 0;
550 /*guint16 idx;*/
552 /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL);
554 /* Dump any leftover bytes. */
555 zdp_dump_excess(tvb, offset, pinfo, tree);
556 } /* dissect_zbee_zdp_req_recover_bind_table */
558 /*FUNCTION:------------------------------------------------------
559 * NAME
560 * dissect_zbee_zdp_req_backup_source_bind
561 * DESCRIPTION
562 * ZigBee Device Profile dissector for the backup source binding
563 * request. Cluster ID = 0x0029.
564 * PARAMETERS
565 * tvbuff_t *tvb - pointer to buffer containing raw packet.
566 * packet_into *pinfo - pointer to packet information fields
567 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
568 * RETURNS
569 * void
570 *---------------------------------------------------------------
572 void
573 dissect_zbee_zdp_req_backup_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
575 proto_item *ti;
576 proto_tree *field_tree = NULL;
577 guint i;
579 guint offset = 0;
580 /*guint16 entries;*/
581 /*guint16 idx;*/
582 guint16 count;
584 /*entries =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL);
585 /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL);
586 count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL);
588 if (tree) {
589 ti = proto_tree_add_text(tree, tvb, offset, count*(int)sizeof(guint64), "Source Table");
590 field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind_source);
592 for (i=0; i<count; i++) zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL);
594 /* Dump any leftover bytes. */
595 zdp_dump_excess(tvb, offset, pinfo, tree);
596 } /* dissect_zbee_zdp_req_backup_source_bind */
598 /*FUNCTION:------------------------------------------------------
599 * NAME
600 * dissect_zbee_zdp_req_recover_source_bind
601 * DESCRIPTION
602 * ZigBee Device Profile dissector for the recover source
603 * binding request. Cluster ID = 0x002a.
604 * PARAMETERS
605 * tvbuff_t *tvb - pointer to buffer containing raw packet.
606 * packet_into *pinfo - pointer to packet information fields
607 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
608 * RETURNS
609 * void
610 *---------------------------------------------------------------
612 void
613 dissect_zbee_zdp_req_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
615 guint offset = 0;
616 /*guint16 idx;*/
618 /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL);
620 /* Dump any leftover bytes. */
621 zdp_dump_excess(tvb, offset, pinfo, tree);
622 } /* dissect_zbee_zdp_req_recover_source_bind */
624 /**************************************
625 * BINDING RESPONSES
626 **************************************
628 /*FUNCTION:------------------------------------------------------
629 * NAME
630 * dissect_zbee_zdp_rsp_end_device_bind
631 * DESCRIPTION
632 * ZigBee Device Profile dissector for the end device bind
633 * response. Cluster ID = 0x8020.
634 * PARAMETERS
635 * tvbuff_t *tvb - pointer to buffer containing raw packet.
636 * packet_into *pinfo - pointer to packet information fields
637 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
638 * RETURNS
639 * void
640 *---------------------------------------------------------------
642 void
643 dissect_zbee_zdp_rsp_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
645 guint offset = 0;
646 guint8 status;
648 status = zdp_parse_status(tree, tvb, &offset);
650 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
652 /* Dump any leftover bytes. */
653 zdp_dump_excess(tvb, offset, pinfo, tree);
654 } /* dissect_zbee_zdp_rsp_end_device_bind */
656 /*FUNCTION:------------------------------------------------------
657 * NAME
658 * dissect_zbee_zdp_rsp_bind
659 * DESCRIPTION
660 * ZigBee Device Profile dissector for the bind response.
661 * Cluster ID = 0x8021.
662 * PARAMETERS
663 * tvbuff_t *tvb - pointer to buffer containing raw packet.
664 * packet_into *pinfo - pointer to packet information fields
665 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
666 * RETURNS
667 * void
668 *---------------------------------------------------------------
670 void
671 dissect_zbee_zdp_rsp_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
673 guint offset = 0;
674 guint8 status;
676 status = zdp_parse_status(tree, tvb, &offset);
678 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
680 /* Dump any leftover bytes. */
681 zdp_dump_excess(tvb, offset, pinfo, tree);
682 } /* dissect_zbee_zdp_rsp_bind */
684 /*FUNCTION:------------------------------------------------------
685 * NAME
686 * dissect_zbee_zdp_rsp_unbind
687 * DESCRIPTION
688 * ZigBee Device Profile dissector for the unbind response.
689 * Cluster ID = 0x8022.
690 * PARAMETERS
691 * tvbuff_t *tvb - pointer to buffer containing raw packet.
692 * packet_into *pinfo - pointer to packet information fields
693 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
694 * RETURNS
695 * void
696 *---------------------------------------------------------------
698 void
699 dissect_zbee_zdp_rsp_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
701 guint offset = 0;
702 guint8 status;
704 status = zdp_parse_status(tree, tvb, &offset);
706 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
708 /* Dump any leftover bytes. */
709 zdp_dump_excess(tvb, offset, pinfo, tree);
710 } /* dissect_zbee_zdp_rsp_unbind */
712 /*FUNCTION:------------------------------------------------------
713 * NAME
714 * dissect_zbee_zdp_rsp_bind_register
715 * DESCRIPTION
716 * ZigBee Device Profile dissector for the bind registration
717 * response. Cluster ID = 0x8023.
718 * PARAMETERS
719 * tvbuff_t *tvb - pointer to buffer containing raw packet.
720 * packet_into *pinfo - pointer to packet information fields
721 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
722 * RETURNS
723 * void
724 *---------------------------------------------------------------
726 void
727 dissect_zbee_zdp_rsp_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
729 proto_item *ti;
730 proto_tree *field_tree = NULL;
731 guint offset = 0;
732 guint i;
734 guint8 status;
735 /*guint16 table_size;*/
736 guint16 table_count;
738 status = zdp_parse_status(tree, tvb, &offset);
739 /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL);
740 table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL);
742 if (tree && table_count) {
743 ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Binding List");
744 field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind);
746 for (i=0; i<table_count; i++) {
747 zdp_parse_bind_table_entry(field_tree, tvb, &offset, version);
748 } /* for */
750 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
752 /* Dump any leftover bytes. */
753 zdp_dump_excess(tvb, offset, pinfo, tree);
754 } /* dissect_zbee_zdp_rsp_bind_register */
756 /*FUNCTION:------------------------------------------------------
757 * NAME
758 * dissect_zbee_zdp_rsp_replace_device
759 * DESCRIPTION
760 * ZigBee Device Profile dissector for the device replacement
761 * response. Cluster ID = 0x8024.
762 * PARAMETERS
763 * tvbuff_t *tvb - pointer to buffer containing raw packet.
764 * packet_into *pinfo - pointer to packet information fields
765 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
766 * RETURNS
767 * void
768 *---------------------------------------------------------------
770 void
771 dissect_zbee_zdp_rsp_replace_device(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
773 guint offset = 0;
774 guint8 status;
776 status = zdp_parse_status(tree, tvb, &offset);
778 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
780 /* Dump any leftover bytes. */
781 zdp_dump_excess(tvb, offset, pinfo, tree);
782 } /* dissect_zbee_zdp_rsp_replace_device */
784 /*FUNCTION:------------------------------------------------------
785 * NAME
786 * dissect_zbee_zdp_rsp_store_bak_bind_entry
787 * DESCRIPTION
788 * ZigBee Device Profile dissector for the store backup binding
789 * table entry response. Cluster ID = 0x8025.
790 * PARAMETERS
791 * tvbuff_t *tvb - pointer to buffer containing raw packet.
792 * packet_into *pinfo - pointer to packet information fields
793 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
794 * RETURNS
795 * void
796 *---------------------------------------------------------------
798 void
799 dissect_zbee_zdp_rsp_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
801 guint offset = 0;
802 guint8 status;
804 status = zdp_parse_status(tree, tvb, &offset);
806 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
808 /* Dump any leftover bytes. */
809 zdp_dump_excess(tvb, offset, pinfo, tree);
810 } /* dissect_zbee_zdp_rsp_store_bak_bind_entry */
812 /*FUNCTION:------------------------------------------------------
813 * NAME
814 * dissect_zbee_zdp_rsp_remove_bak_bind_entry
815 * DESCRIPTION
816 * ZigBee Device Profile dissector for the remove backup binding
817 * table entry response. Cluster ID = 0x8026.
818 * PARAMETERS
819 * tvbuff_t *tvb - pointer to buffer containing raw packet.
820 * packet_into *pinfo - pointer to packet information fields
821 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
822 * RETURNS
823 * void
824 *---------------------------------------------------------------
826 void
827 dissect_zbee_zdp_rsp_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
829 guint offset = 0;
830 guint8 status;
832 status = zdp_parse_status(tree, tvb, &offset);
834 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
836 /* Dump any leftover bytes. */
837 zdp_dump_excess(tvb, offset, pinfo, tree);
838 } /* dissect_zbee_zdp_rsp_remove_bak_bind_entry */
840 /*FUNCTION:------------------------------------------------------
841 * NAME
842 * dissect_zbee_zdp_rsp_backup_bind_table
843 * DESCRIPTION
844 * ZigBee Device Profile dissector for the backup binding
845 * table response. Cluster ID = 0x8027.
846 * PARAMETERS
847 * tvbuff_t *tvb - pointer to buffer containing raw packet.
848 * packet_into *pinfo - pointer to packet information fields
849 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
850 * RETURNS
851 * void
852 *---------------------------------------------------------------
854 void
855 dissect_zbee_zdp_rsp_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
857 guint offset = 0;
858 guint8 status;
859 /*guint16 count;*/
861 status = zdp_parse_status(tree, tvb, &offset);
862 /*count =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL);
864 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
866 /* Dump any leftover bytes. */
867 zdp_dump_excess(tvb, offset, pinfo, tree);
868 } /* dissect_zbee_zdp_rsp_backup_bind_table */
870 /*FUNCTION:------------------------------------------------------
871 * NAME
872 * dissect_zbee_zdp_rsp_recover_bind_table
873 * DESCRIPTION
874 * ZigBee Device Profile dissector for the recover binding
875 * table response. Cluster ID = 0x8028.
876 * PARAMETERS
877 * tvbuff_t *tvb - pointer to buffer containing raw packet.
878 * packet_into *pinfo - pointer to packet information fields
879 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
880 * RETURNS
881 * void
882 *---------------------------------------------------------------
884 void
885 dissect_zbee_zdp_rsp_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
887 proto_item *ti;
888 proto_tree *field_tree = NULL;
889 guint offset = 0;
890 guint i;
892 guint8 status;
893 /*guint16 table_size;*/
894 /*guint16 idx;*/
895 guint16 table_count;
897 status = zdp_parse_status(tree, tvb, &offset);
898 /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL);
899 /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL);
900 table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL);
902 if (tree && table_count) {
903 ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Binding Table");
904 field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind);
906 for (i=0; i<table_count; i++) {
907 zdp_parse_bind_table_entry(field_tree, tvb, &offset, version);
908 } /* for */
910 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
912 /* Dump any leftover bytes. */
913 zdp_dump_excess(tvb, offset, pinfo, tree);
914 } /* dissect_zbee_zdp_rsp_recover_bind_table */
916 /*FUNCTION:------------------------------------------------------
917 * NAME
918 * dissect_zbee_zdp_rsp_backup_source_bind
919 * DESCRIPTION
920 * ZigBee Device Profile dissector for the backup source binding
921 * response. Cluster ID = 0x8029.
922 * PARAMETERS
923 * tvbuff_t *tvb - pointer to buffer containing raw packet.
924 * packet_into *pinfo - pointer to packet information fields
925 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
926 * RETURNS
927 * void
928 *---------------------------------------------------------------
930 void
931 dissect_zbee_zdp_rsp_backup_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
933 guint offset = 0;
934 guint8 status;
936 status = zdp_parse_status(tree, tvb, &offset);
938 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
940 /* Dump any leftover bytes. */
941 zdp_dump_excess(tvb, offset, pinfo, tree);
942 } /* dissect_zbee_zdp_rsp_backup_source_bind */
944 /*FUNCTION:------------------------------------------------------
945 * NAME
946 * dissect_zbee_zdp_rsp_recover_source_bind
947 * DESCRIPTION
948 * ZigBee Device Profile dissector for the recover source binding
949 * response. Cluster ID = 0x8029.
950 * PARAMETERS
951 * tvbuff_t *tvb - pointer to buffer containing raw packet.
952 * packet_into *pinfo - pointer to packet information fields
953 * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
954 * RETURNS
955 * void
956 *---------------------------------------------------------------
958 void
959 dissect_zbee_zdp_rsp_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
961 proto_item *ti;
962 proto_tree *field_tree = NULL;
963 guint offset = 0;
964 guint i;
966 guint8 status;
967 /*guint16 table_size;*/
968 /*guint16 idx;*/
969 guint16 table_count;
971 status = zdp_parse_status(tree, tvb, &offset);
972 /*table_size = */ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL);
973 /*idx = */ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL);
974 table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL);
976 if (tree && table_count) {
977 ti = proto_tree_add_text(tree, tvb, offset, table_count * (int)sizeof(guint64), "Source Table");
978 field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind_source);
980 for (i=0; i<table_count; i++) {
981 (void)zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL);
982 } /* for */
984 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
986 /* Dump any leftover bytes. */
987 zdp_dump_excess(tvb, offset, pinfo, tree);
988 } /* dissect_zbee_zdp_rsp_recover_source_bind */