epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-zbee-zdp-binding.c
blobb6559b8c31420ebffab975f4bb0e1b60f0ce6d54
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 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 /* Include Files */
14 #include "config.h"
16 #include <epan/packet.h>
17 #include <epan/addr_resolv.h>
19 #include "packet-zbee.h"
20 #include "packet-zbee-zdp.h"
21 #include "packet-zbee-aps.h"
22 #include "packet-zbee-tlv.h"
24 /**************************************
25 * HELPER FUNCTIONS
26 **************************************
28 /**
29 *Parses and displays a single binding table entry.
31 *@param tvb pointer to buffer containing raw packet.
32 *@param tree pointer to data tree Wireshark uses to display packet.
34 void
35 zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint8_t version)
37 proto_tree *bind_tree;
38 proto_item *ti;
39 unsigned len = 0;
41 uint8_t mode;
43 /* Add the source address. */
44 bind_tree = proto_tree_add_subtree(tree, tvb, *offset, 0, ett_zbee_zdp_bind_entry, &ti, "Bind");
45 proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_src64, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
46 len += 8;
48 /* Add the source endpoint. */
49 proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_src_ep, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN);
50 len += 1;
52 /* Add the cluster ID. */
53 if (version >= ZBEE_VERSION_2007) {
54 proto_tree_add_item(bind_tree, hf_zbee_zdp_cluster, tvb, *offset + len, 2, ENC_LITTLE_ENDIAN);
55 len += 2;
57 else {
58 proto_tree_add_item(bind_tree, hf_zbee_zdp_cluster, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN);
59 len += 1;
62 /* Get the destination address mode. */
63 if (version >= ZBEE_VERSION_2007) {
64 mode = tvb_get_uint8(tvb, *offset + len);
65 proto_tree_add_item(bind_tree, hf_zbee_zdp_addr_mode, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN);
66 len += 1;
68 else {
69 /* Mode field doesn't exist and always uses unicast in 2003 & earlier. */
70 mode = ZBEE_ZDP_ADDR_MODE_UNICAST;
73 /* Add the destination address. */
74 if (mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
75 proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_dst, tvb, *offset + len, 2, ENC_LITTLE_ENDIAN);
76 len += 2;
78 else if (mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
79 proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_dst64, tvb, *offset + len, 8, ENC_LITTLE_ENDIAN);
80 len += 8;
81 proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_dst_ep, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN);
82 len += 1;
85 proto_item_set_len(ti, len);
86 *offset += len;
87 } /* zdp_parse_bind_table_entry */
89 /**************************************
90 * BINDING REQUESTS
91 **************************************
93 /**
94 *ZigBee Device Profile dissector for the end device bind
96 *@param tvb pointer to buffer containing raw packet.
97 *@param pinfo pointer to packet information fields
98 *@param tree pointer to data tree Wireshark uses to display packet.
100 void
101 dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version)
103 unsigned sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
104 unsigned i;
105 proto_tree *field_tree = NULL;
107 unsigned offset = 0;
108 uint32_t target, in_count, out_count;
109 uint64_t ext_addr = 0;
111 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_target, tvb, offset, 2, ENC_LITTLE_ENDIAN, &target);
112 offset += 2;
113 if (version >= ZBEE_VERSION_2007) {
114 /* Extended address present on ZigBee 2006 & later. */
115 ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (unsigned)sizeof(uint64_t), NULL);
117 proto_tree_add_item(tree, hf_zbee_zdp_endpoint, tvb, offset, 1, ENC_LITTLE_ENDIAN);
118 offset += 1;
119 proto_tree_add_item(tree, hf_zbee_zdp_profile, tvb, offset, 2, ENC_LITTLE_ENDIAN);
120 offset += 2;
122 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_in_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &in_count);
123 offset += 1;
124 if ((tree) && (in_count)) {
125 field_tree = proto_tree_add_subtree(tree, tvb, offset, (int)(in_count*sizeof_cluster),
126 ett_zbee_zdp_bind_end_in, NULL, "Input Cluster List");
128 for (i=0; i<in_count; i++) {
129 proto_tree_add_item(field_tree, hf_zbee_zdp_in_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN);
130 offset += sizeof_cluster;
132 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_out_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &out_count);
133 offset += 1;
134 if ((tree) && (out_count)) {
135 field_tree = proto_tree_add_subtree(tree, tvb, offset, (int)(out_count*sizeof_cluster),
136 ett_zbee_zdp_bind_end_out, NULL, "Output Cluster List");
138 for (i=0; i<out_count; i++) {
139 proto_tree_add_item(field_tree, hf_zbee_zdp_out_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN);
140 offset += sizeof_cluster;
142 if (version >= ZBEE_VERSION_2007) {
143 zbee_append_info(tree, pinfo, " Src: %s", eui64_to_display(pinfo->pool, ext_addr));
145 zbee_append_info(tree, pinfo, ", Target: 0x%04x", target);
147 /* Dump any leftover bytes. */
148 zdp_dump_excess(tvb, offset, pinfo, tree);
149 } /* dissect_zbee_zdp_req_end_device_bind */
152 *ZigBee Device Profile dissector for the bind request.
154 *@param tvb pointer to buffer containing raw packet.
155 *@param pinfo pointer to packet information fields
156 *@param tree pointer to data tree Wireshark uses to display packet.
158 void
159 dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version)
161 proto_item *ti;
162 unsigned sizeof_cluster = ZBEE_HAS_2006(version)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
163 unsigned offset = 0;
164 uint64_t src64;
165 uint32_t cluster, dst_mode, dst;
166 uint64_t dst64 = 0;
167 /*uint8_t dst_ep;*/
169 src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL);
170 proto_tree_add_item(tree, hf_zbee_zdp_bind_src_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN);
171 offset += 1;
172 ti = proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN, &cluster);
173 offset += sizeof_cluster;
174 proto_item_append_text(ti, " (%s)", rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster"));
176 if (version >= ZBEE_VERSION_2007) {
177 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_addr_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN, &dst_mode);
178 offset += 1;
180 else {
181 /* ZigBee 2003 & earlier does not have a address mode, and is unicast only. */
182 dst_mode = ZBEE_ZDP_ADDR_MODE_UNICAST;
185 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
186 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_bind_dst, tvb, offset, 2, ENC_LITTLE_ENDIAN, &dst);
187 offset += 2;
189 else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
190 dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(uint64_t), NULL);
191 proto_tree_add_item(tree, hf_zbee_zdp_bind_dst_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN);
192 offset += 1;
195 zbee_append_info(tree, pinfo, ", %s (Cluster ID: 0x%04x)",
196 rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster"),
197 cluster);
199 if (version >= ZBEE_VERSION_2007) {
200 zbee_append_info(tree, pinfo, " Src: %s", eui64_to_display(pinfo->pool, src64));
202 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
203 zbee_append_info(tree, pinfo, ", Dst: 0x%04x", dst);
205 else {
206 zbee_append_info(tree, pinfo, ", Dst: %s", eui64_to_display(pinfo->pool, dst64));
209 /* Dump any leftover bytes. */
210 zdp_dump_excess(tvb, offset, pinfo, tree);
211 } /* dissect_zbee_zdp_req_bind */
214 *ZigBee Device Profile dissector for the unbind request.
216 *@param tvb pointer to buffer containing raw packet.
217 *@param pinfo pointer to packet information fields
218 *@param tree pointer to data tree Wireshark uses to display packet.
220 void
221 dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version)
223 proto_item *ti;
224 unsigned sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
225 unsigned offset = 0;
226 uint64_t src64;
227 /*uint8_t src_ep;*/
228 uint32_t cluster, dst_mode, dst = 0;
229 uint64_t dst64 = 0;
230 /*uint8_t dst_ep;*/
232 src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL);
233 proto_tree_add_item(tree, hf_zbee_zdp_bind_src_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN);
234 offset += 1;
235 ti = proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN, &cluster);
236 offset += sizeof_cluster;
237 proto_item_append_text(ti, " (%s)", rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster"));
239 if (version >= ZBEE_VERSION_2007) {
240 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_addr_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN, &dst_mode);
241 offset += 1;
243 else {
244 /* ZigBee 2003 & earlier does not have a address mode, and is unicast only. */
245 dst_mode = ZBEE_ZDP_ADDR_MODE_UNICAST;
248 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
249 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_bind_dst, tvb, offset, 2, ENC_LITTLE_ENDIAN, &dst);
250 offset += 2;
252 else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
253 dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(uint64_t), NULL);
254 proto_tree_add_item(tree, hf_zbee_zdp_bind_dst_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN);
255 offset += 1;
258 zbee_append_info(tree, pinfo, ", %s (Cluster ID: 0x%04x)",
259 rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster"),
260 cluster);
262 if (version >= ZBEE_VERSION_2007) {
263 zbee_append_info(tree, pinfo, " Src: %s", eui64_to_display(pinfo->pool, src64));
265 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
266 zbee_append_info(tree, pinfo, ", Dst: 0x%04x", dst);
268 else {
269 zbee_append_info(tree, pinfo, ", Dst: %s", eui64_to_display(pinfo->pool, dst64));
272 /* Dump any leftover bytes. */
273 zdp_dump_excess(tvb, offset, pinfo, tree);
274 } /* dissect_zbee_zdp_req_unbind */
277 *ZigBee Device Profile dissector for the bind register
279 *@param tvb pointer to buffer containing raw packet.
280 *@param pinfo pointer to packet information fields
281 *@param tree pointer to data tree Wireshark uses to display packet.
283 void
284 dissect_zbee_zdp_req_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
286 unsigned offset = 0;
287 uint64_t ext_addr;
289 ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(uint64_t), NULL);
291 zbee_append_info(tree, pinfo, ", Device: %s", eui64_to_display(pinfo->pool, ext_addr));
293 /* Dump any leftover bytes. */
294 zdp_dump_excess(tvb, offset, pinfo, tree);
295 } /* dissect_zbee_zdp_req_bind_register */
298 *ZigBee Device Profile dissector for the replace device
300 *@param tvb pointer to buffer containing raw packet.
301 *@param pinfo pointer to packet information fields
302 *@param tree pointer to data tree Wireshark uses to display packet.
304 void
305 dissect_zbee_zdp_req_replace_device(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
307 unsigned offset = 0;
308 uint64_t ext_addr;
309 uint64_t new_addr;
311 ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(uint64_t), NULL);
312 proto_tree_add_item(tree, hf_zbee_zdp_endpoint, tvb, offset, 1, ENC_LITTLE_ENDIAN);
313 offset += 1;
314 new_addr = zbee_parse_eui64(tree, hf_zbee_zdp_replacement, tvb, &offset, (int)sizeof(uint64_t), NULL);
315 proto_tree_add_item(tree, hf_zbee_zdp_replacement_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN);
316 offset += 1;
318 zbee_append_info(tree, pinfo, ", Device: %s", eui64_to_display(pinfo->pool, ext_addr));
319 zbee_append_info(tree, pinfo, ", Replacement: %s", eui64_to_display(pinfo->pool, new_addr));
321 /* Dump any leftover bytes. */
322 zdp_dump_excess(tvb, offset, pinfo, tree);
323 } /* dissect_zbee_zdp_req_replace_device */
326 *ZigBee Device Profile dissector for the store backup binding
328 *@param tvb pointer to buffer containing raw packet.
329 *@param pinfo pointer to packet information fields
330 *@param tree pointer to data tree Wireshark uses to display packet.
332 void
333 dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version)
335 proto_item *ti;
337 unsigned sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
338 unsigned offset = 0;
339 uint64_t src64;
340 uint32_t src_ep, cluster, dst_mode;
342 src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL);
343 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN, &src_ep);
344 offset += 1;
345 ti = proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN, &cluster);
346 offset += sizeof_cluster;
347 proto_item_append_text(ti, " (%s)", rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster"));
348 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_addr_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN, &dst_mode);
349 offset += 1;
351 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
352 proto_tree_add_item(tree, hf_zbee_zdp_bind_dst, tvb, offset, 2, ENC_LITTLE_ENDIAN);
353 offset += 2;
355 else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
356 /*uint64_t dst64;*/
357 /*uint8_t dst_ep;*/
358 /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(uint64_t), NULL);
359 proto_tree_add_item(tree, hf_zbee_zdp_bind_dst_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN);
360 offset += 1;
363 zbee_append_info(tree, pinfo, ", %s (Cluster ID: 0x%04x)", rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster"), cluster);
364 zbee_append_info(tree, pinfo, ", Src: %s", eui64_to_display(pinfo->pool, src64));
365 zbee_append_info(tree, pinfo, ", Src Endpoint: %d", src_ep);
367 /* Dump any leftover bytes. */
368 zdp_dump_excess(tvb, offset, pinfo, tree);
369 } /* dissect_zbee_zdp_req_store_bak_bind_entry */
372 *ZigBee Device Profile dissector for the remove backup binding
374 *@param tvb pointer to buffer containing raw packet.
375 *@param pinfo pointer to packet information fields
376 *@param tree pointer to data tree Wireshark uses to display packet.
378 void
379 dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version)
381 proto_item *ti;
383 unsigned sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
384 unsigned offset = 0;
385 uint64_t src64;
386 uint32_t src_ep, cluster, dst_mode;
388 src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL);
389 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN, &src_ep);
390 offset += 1;
391 ti = proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN, &cluster);
392 offset += sizeof_cluster;
393 proto_item_append_text(ti, " (%s)", val_to_str_const(cluster, zbee_zdp_cluster_names, "Unknown Device Profile Cluster"));
394 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_addr_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN, &dst_mode);
395 offset += 1;
397 if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
398 proto_tree_add_item(tree, hf_zbee_zdp_bind_dst, tvb, offset, 2, ENC_LITTLE_ENDIAN);
399 offset += 2;
401 else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
402 /*uint64_t dst64;*/
403 /*uint8_t dst_ep;*/
404 /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(uint64_t), NULL);
405 proto_tree_add_item(tree, hf_zbee_zdp_bind_dst_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN);
406 offset += 1;
409 zbee_append_info(tree, pinfo, ", %s (Cluster ID: 0x%04x)", val_to_str_const(cluster, zbee_zdp_cluster_names, "Unknown Device Profile Cluster"), cluster);
410 zbee_append_info(tree, pinfo, ", Src: %s", eui64_to_display(pinfo->pool, src64));
411 zbee_append_info(tree, pinfo, ", Src Endpoint: %d", src_ep);
413 /* Dump any leftover bytes. */
414 zdp_dump_excess(tvb, offset, pinfo, tree);
415 } /* dissect_zbee_zdp_req_remove_bak_bind_entry */
418 *ZigBee Device Profile dissector for the backup binding
420 *@param tvb pointer to buffer containing raw packet.
421 *@param pinfo pointer to packet information fields
422 *@param tree pointer to data tree Wireshark uses to display packet.
424 void
425 dissect_zbee_zdp_req_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version)
427 proto_tree *field_tree;
429 unsigned offset = 0;
430 uint32_t i, table_count;
432 proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
433 offset += 2;
434 proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
435 offset += 2;
436 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count);
437 offset += 2;
439 field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_bind, NULL, "Binding Table");
441 for (i=0; i<table_count; i++) {
442 zdp_parse_bind_table_entry(field_tree, tvb, &offset, version);
443 } /* for */
445 /* Dump any leftover bytes. */
446 zdp_dump_excess(tvb, offset, pinfo, tree);
447 } /* dissect_zbee_zdp_req_backup_bind_table */
450 *ZigBee Device Profile dissector for the recover binding
452 *@param tvb pointer to buffer containing raw packet.
453 *@param pinfo pointer to packet information fields
454 *@param tree pointer to data tree Wireshark uses to display packet.
456 void
457 dissect_zbee_zdp_req_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
459 unsigned offset = 0;
461 proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
462 offset += 2;
464 /* Dump any leftover bytes. */
465 zdp_dump_excess(tvb, offset, pinfo, tree);
466 } /* dissect_zbee_zdp_req_recover_bind_table */
469 *ZigBee Device Profile dissector for the backup source binding
471 *@param tvb pointer to buffer containing raw packet.
472 *@param pinfo pointer to packet information fields
473 *@param tree pointer to data tree Wireshark uses to display packet.
475 void
476 dissect_zbee_zdp_req_backup_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
478 proto_tree *field_tree;
480 unsigned offset = 0;
481 uint32_t i, table_count;
483 proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
484 offset += 2;
485 proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
486 offset += 2;
487 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count);
488 offset += 2;
490 field_tree = proto_tree_add_subtree(tree, tvb, offset, table_count*(int)sizeof(uint64_t),
491 ett_zbee_zdp_bind_source, NULL, "Source Table");
493 for (i=0; i<table_count; i++) zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL);
495 /* Dump any leftover bytes. */
496 zdp_dump_excess(tvb, offset, pinfo, tree);
497 } /* dissect_zbee_zdp_req_backup_source_bind */
500 *ZigBee Device Profile dissector for the recover source
502 *@param tvb pointer to buffer containing raw packet.
503 *@param pinfo pointer to packet information fields
504 *@param tree pointer to data tree Wireshark uses to display packet.
506 void
507 dissect_zbee_zdp_req_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
509 unsigned offset = 0;
511 proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
512 offset += 2;
514 /* Dump any leftover bytes. */
515 zdp_dump_excess(tvb, offset, pinfo, tree);
516 } /* dissect_zbee_zdp_req_recover_source_bind */
519 *ZigBee Device Profile dissector for the clear all bindings request.
521 *@param tvb pointer to buffer containing raw packet.
522 *@param pinfo pointer to packet information fields
523 *@param tree pointer to data tree Wireshark uses to display packet.
525 void
526 dissect_zbee_zdp_req_clear_all_bindings(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
528 unsigned offset = 0;
530 offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, NULL, ZBEE_TLV_SRC_TYPE_ZBEE_ZDP, ZBEE_ZDP_REQ_CLEAR_ALL_BINDINGS);
532 /* Dump any leftover bytes. */
533 zdp_dump_excess(tvb, offset, pinfo, tree);
537 *ZigBee Device Profile dissector for the clear all bindings response.
539 *@param tvb pointer to buffer containing raw packet.
540 *@param pinfo pointer to packet information fields
541 *@param tree pointer to data tree Wireshark uses to display packet.
543 void
544 dissect_zbee_zdp_rsp_clear_all_bindings(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
546 unsigned offset = 0;
547 uint8_t status;
549 status = zdp_parse_status(tree, tvb, &offset);
550 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
552 /* Dump any leftover bytes. */
553 zdp_dump_excess(tvb, offset, pinfo, tree);
554 } /* dissect_zbee_zdp_rsp_clear_all_bindings */
556 /**************************************
557 * BINDING RESPONSES
558 **************************************
561 *ZigBee Device Profile dissector for the end device bind
563 *@param tvb pointer to buffer containing raw packet.
564 *@param pinfo pointer to packet information fields
565 *@param tree pointer to data tree Wireshark uses to display packet.
567 void
568 dissect_zbee_zdp_rsp_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
570 unsigned offset = 0;
571 uint8_t status;
573 status = zdp_parse_status(tree, tvb, &offset);
575 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
577 /* Dump any leftover bytes. */
578 zdp_dump_excess(tvb, offset, pinfo, tree);
579 } /* dissect_zbee_zdp_rsp_end_device_bind */
582 *ZigBee Device Profile dissector for the bind response.
584 *@param tvb pointer to buffer containing raw packet.
585 *@param pinfo pointer to packet information fields
586 *@param tree pointer to data tree Wireshark uses to display packet.
588 void
589 dissect_zbee_zdp_rsp_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
591 unsigned offset = 0;
592 uint8_t status;
594 status = zdp_parse_status(tree, tvb, &offset);
596 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
598 /* Dump any leftover bytes. */
599 zdp_dump_excess(tvb, offset, pinfo, tree);
600 } /* dissect_zbee_zdp_rsp_bind */
603 *ZigBee Device Profile dissector for the unbind response.
605 *@param tvb pointer to buffer containing raw packet.
606 *@param pinfo pointer to packet information fields
607 *@param tree pointer to data tree Wireshark uses to display packet.
609 void
610 dissect_zbee_zdp_rsp_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
612 unsigned offset = 0;
613 uint8_t status;
615 status = zdp_parse_status(tree, tvb, &offset);
617 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
619 /* Dump any leftover bytes. */
620 zdp_dump_excess(tvb, offset, pinfo, tree);
621 } /* dissect_zbee_zdp_rsp_unbind */
624 *ZigBee Device Profile dissector for the bind registration
626 *@param tvb pointer to buffer containing raw packet.
627 *@param pinfo pointer to packet information fields
628 *@param tree pointer to data tree Wireshark uses to display packet.
630 void
631 dissect_zbee_zdp_rsp_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version)
633 proto_tree *field_tree = NULL;
634 unsigned offset = 0;
636 uint8_t status;
637 uint32_t i, table_count;
639 status = zdp_parse_status(tree, tvb, &offset);
641 if ((status == ZBEE_ZDP_STATUS_SUCCESS) || (tvb_bytes_exist(tvb, offset, 2))) {
642 proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
643 offset += 2;
644 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count);
645 offset += 2;
647 if (tree && table_count) {
648 field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_bind, NULL, "Binding List");
650 for (i=0; i<table_count; i++) {
651 zdp_parse_bind_table_entry(field_tree, tvb, &offset, version);
652 } /* for */
655 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
657 /* Dump any leftover bytes. */
658 zdp_dump_excess(tvb, offset, pinfo, tree);
659 } /* dissect_zbee_zdp_rsp_bind_register */
662 *ZigBee Device Profile dissector for the device replacement
664 *@param tvb pointer to buffer containing raw packet.
665 *@param pinfo pointer to packet information fields
666 *@param tree pointer to data tree Wireshark uses to display packet.
668 void
669 dissect_zbee_zdp_rsp_replace_device(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
671 unsigned offset = 0;
672 uint8_t status;
674 status = zdp_parse_status(tree, tvb, &offset);
676 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
678 /* Dump any leftover bytes. */
679 zdp_dump_excess(tvb, offset, pinfo, tree);
680 } /* dissect_zbee_zdp_rsp_replace_device */
683 *ZigBee Device Profile dissector for the store backup binding
685 *@param tvb pointer to buffer containing raw packet.
686 *@param pinfo pointer to packet information fields
687 *@param tree pointer to data tree Wireshark uses to display packet.
689 void
690 dissect_zbee_zdp_rsp_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
692 unsigned offset = 0;
693 uint8_t status;
695 status = zdp_parse_status(tree, tvb, &offset);
697 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
699 /* Dump any leftover bytes. */
700 zdp_dump_excess(tvb, offset, pinfo, tree);
701 } /* dissect_zbee_zdp_rsp_store_bak_bind_entry */
704 *ZigBee Device Profile dissector for the remove backup binding
706 *@param tvb pointer to buffer containing raw packet.
707 *@param pinfo pointer to packet information fields
708 *@param tree pointer to data tree Wireshark uses to display packet.
710 void
711 dissect_zbee_zdp_rsp_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
713 unsigned offset = 0;
714 uint8_t status;
716 status = zdp_parse_status(tree, tvb, &offset);
718 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
720 /* Dump any leftover bytes. */
721 zdp_dump_excess(tvb, offset, pinfo, tree);
722 } /* dissect_zbee_zdp_rsp_remove_bak_bind_entry */
725 *ZigBee Device Profile dissector for the backup binding
727 *@param tvb pointer to buffer containing raw packet.
728 *@param pinfo pointer to packet information fields
729 *@param tree pointer to data tree Wireshark uses to display packet.
731 void
732 dissect_zbee_zdp_rsp_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
734 unsigned offset = 0;
735 uint8_t status;
737 status = zdp_parse_status(tree, tvb, &offset);
738 if ((status == ZBEE_ZDP_STATUS_SUCCESS) || (tvb_bytes_exist(tvb, offset, 2))) {
739 proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
740 offset += 2;
743 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
745 /* Dump any leftover bytes. */
746 zdp_dump_excess(tvb, offset, pinfo, tree);
747 } /* dissect_zbee_zdp_rsp_backup_bind_table */
750 *ZigBee Device Profile dissector for the recover binding
752 *@param tvb pointer to buffer containing raw packet.
753 *@param pinfo pointer to packet information fields
754 *@param tree pointer to data tree Wireshark uses to display packet.
756 void
757 dissect_zbee_zdp_rsp_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version)
759 proto_tree *field_tree = NULL;
760 unsigned offset = 0;
761 uint8_t status;
762 uint32_t i, table_count;
764 status = zdp_parse_status(tree, tvb, &offset);
765 if ((status == ZBEE_ZDP_STATUS_SUCCESS) || (tvb_bytes_exist(tvb, offset, 2))) {
766 proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
767 offset += 2;
768 proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
769 offset += 2;
770 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count);
771 offset += 2;
773 if (tree && table_count) {
774 field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_bind, NULL, "Binding Table");
776 for (i=0; i<table_count; i++) {
777 zdp_parse_bind_table_entry(field_tree, tvb, &offset, version);
778 } /* for */
781 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
783 /* Dump any leftover bytes. */
784 zdp_dump_excess(tvb, offset, pinfo, tree);
785 } /* dissect_zbee_zdp_rsp_recover_bind_table */
788 *ZigBee Device Profile dissector for the backup source binding
790 *@param tvb pointer to buffer containing raw packet.
791 *@param pinfo pointer to packet information fields
792 *@param tree pointer to data tree Wireshark uses to display packet.
794 void
795 dissect_zbee_zdp_rsp_backup_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
797 unsigned offset = 0;
798 uint8_t status;
800 status = zdp_parse_status(tree, tvb, &offset);
802 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
804 /* Dump any leftover bytes. */
805 zdp_dump_excess(tvb, offset, pinfo, tree);
806 } /* dissect_zbee_zdp_rsp_backup_source_bind */
809 *ZigBee Device Profile dissector for the recover source binding
811 *@param tvb pointer to buffer containing raw packet.
812 *@param pinfo pointer to packet information fields
813 *@param tree pointer to data tree Wireshark uses to display packet.
815 void
816 dissect_zbee_zdp_rsp_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
818 proto_tree *field_tree = NULL;
819 unsigned offset = 0;
821 uint8_t status;
822 uint32_t i, table_count;
824 status = zdp_parse_status(tree, tvb, &offset);
826 if ((status == ZBEE_ZDP_STATUS_SUCCESS) || (tvb_bytes_exist(tvb, offset, 2))) {
827 proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
828 offset += 2;
829 proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
830 offset += 2;
831 proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count);
832 offset += 2;
834 if (tree && table_count) {
835 field_tree = proto_tree_add_subtree(tree, tvb, offset, table_count * (int)sizeof(uint64_t),
836 ett_zbee_zdp_bind_source, NULL, "Source Table");
839 for (i=0; i<table_count; i++) {
840 (void)zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL);
841 } /* for */
844 zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
846 /* Dump any leftover bytes. */
847 zdp_dump_excess(tvb, offset, pinfo, tree);
848 } /* dissect_zbee_zdp_rsp_recover_source_bind */
851 * Editor modelines - https://www.wireshark.org/tools/modelines.html
853 * Local variables:
854 * c-basic-offset: 4
855 * tab-width: 8
856 * indent-tabs-mode: nil
857 * End:
859 * vi: set shiftwidth=4 tabstop=8 expandtab:
860 * :indentSize=4:tabSize=8:noTabs=true: