/src/wireshark/epan/dissectors/packet-zbee-zdp-binding.c
Line | Count | Source |
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 |
5 | | * |
6 | | * Wireshark - Network traffic analyzer |
7 | | * By Gerald Combs <gerald@wireshark.org> |
8 | | * Copyright 1998 Gerald Combs |
9 | | * |
10 | | * SPDX-License-Identifier: GPL-2.0-or-later |
11 | | */ |
12 | | |
13 | | /* Include Files */ |
14 | | #include "config.h" |
15 | | |
16 | | #include <epan/packet.h> |
17 | | #include <epan/addr_resolv.h> |
18 | | |
19 | | #include "packet-zbee.h" |
20 | | #include "packet-zbee-zdp.h" |
21 | | #include "packet-zbee-aps.h" |
22 | | #include "packet-zbee-tlv.h" |
23 | | |
24 | | /************************************** |
25 | | * HELPER FUNCTIONS |
26 | | ************************************** |
27 | | */ |
28 | | /** |
29 | | *Parses and displays a single binding table entry. |
30 | | * |
31 | | *@param tvb pointer to buffer containing raw packet. |
32 | | *@param tree pointer to data tree Wireshark uses to display packet. |
33 | | */ |
34 | | void |
35 | | zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint8_t version) |
36 | 752 | { |
37 | 752 | proto_tree *bind_tree; |
38 | 752 | proto_item *ti; |
39 | 752 | unsigned len = 0; |
40 | | |
41 | 752 | uint8_t mode; |
42 | | |
43 | | /* Add the source address. */ |
44 | 752 | bind_tree = proto_tree_add_subtree(tree, tvb, *offset, 0, ett_zbee_zdp_bind_entry, &ti, "Bind"); |
45 | 752 | proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_src64, tvb, *offset, 8, ENC_LITTLE_ENDIAN); |
46 | 752 | len += 8; |
47 | | |
48 | | /* Add the source endpoint. */ |
49 | 752 | proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_src_ep, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN); |
50 | 752 | len += 1; |
51 | | |
52 | | /* Add the cluster ID. */ |
53 | 752 | if (version >= ZBEE_VERSION_2007) { |
54 | 342 | proto_tree_add_item(bind_tree, hf_zbee_zdp_cluster, tvb, *offset + len, 2, ENC_LITTLE_ENDIAN); |
55 | 342 | len += 2; |
56 | 342 | } |
57 | 410 | else { |
58 | 410 | proto_tree_add_item(bind_tree, hf_zbee_zdp_cluster, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN); |
59 | 410 | len += 1; |
60 | 410 | } |
61 | | |
62 | | /* Get the destination address mode. */ |
63 | 752 | if (version >= ZBEE_VERSION_2007) { |
64 | 337 | mode = tvb_get_uint8(tvb, *offset + len); |
65 | 337 | proto_tree_add_item(bind_tree, hf_zbee_zdp_addr_mode, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN); |
66 | 337 | len += 1; |
67 | 337 | } |
68 | 415 | else { |
69 | | /* Mode field doesn't exist and always uses unicast in 2003 & earlier. */ |
70 | 415 | mode = ZBEE_ZDP_ADDR_MODE_UNICAST; |
71 | 415 | } |
72 | | |
73 | | /* Add the destination address. */ |
74 | 752 | if (mode == ZBEE_ZDP_ADDR_MODE_GROUP) { |
75 | 31 | proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_dst, tvb, *offset + len, 2, ENC_LITTLE_ENDIAN); |
76 | 31 | len += 2; |
77 | 31 | } |
78 | 721 | else if (mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { |
79 | 362 | proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_dst64, tvb, *offset + len, 8, ENC_LITTLE_ENDIAN); |
80 | 362 | len += 8; |
81 | 362 | proto_tree_add_item(bind_tree, hf_zbee_zdp_bind_dst_ep, tvb, *offset + len, 1, ENC_LITTLE_ENDIAN); |
82 | 362 | len += 1; |
83 | 362 | } |
84 | | |
85 | 752 | proto_item_set_len(ti, len); |
86 | 752 | *offset += len; |
87 | 752 | } /* zdp_parse_bind_table_entry */ |
88 | | |
89 | | /************************************** |
90 | | * BINDING REQUESTS |
91 | | ************************************** |
92 | | */ |
93 | | /** |
94 | | *ZigBee Device Profile dissector for the end device bind |
95 | | * |
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. |
99 | | */ |
100 | | void |
101 | | dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version) |
102 | 114 | { |
103 | 114 | unsigned sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(uint16_t):(int)sizeof(uint8_t); |
104 | 114 | unsigned i; |
105 | 114 | proto_tree *field_tree = NULL; |
106 | | |
107 | 114 | unsigned offset = 0; |
108 | 114 | uint32_t target, in_count, out_count; |
109 | 114 | uint64_t ext_addr = 0; |
110 | | |
111 | 114 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_target, tvb, offset, 2, ENC_LITTLE_ENDIAN, &target); |
112 | 114 | offset += 2; |
113 | 114 | if (version >= ZBEE_VERSION_2007) { |
114 | | /* Extended address present on ZigBee 2006 & later. */ |
115 | 13 | ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (unsigned)sizeof(uint64_t), NULL); |
116 | 13 | } |
117 | 114 | proto_tree_add_item(tree, hf_zbee_zdp_endpoint, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
118 | 114 | offset += 1; |
119 | 114 | proto_tree_add_item(tree, hf_zbee_zdp_profile, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
120 | 114 | offset += 2; |
121 | | |
122 | 114 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_in_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &in_count); |
123 | 114 | offset += 1; |
124 | 114 | if ((tree) && (in_count)) { |
125 | 64 | field_tree = proto_tree_add_subtree(tree, tvb, offset, (int)(in_count*sizeof_cluster), |
126 | 64 | ett_zbee_zdp_bind_end_in, NULL, "Input Cluster List"); |
127 | 64 | } |
128 | 3.03k | for (i=0; i<in_count; i++) { |
129 | 2.92k | proto_tree_add_item(field_tree, hf_zbee_zdp_in_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN); |
130 | 2.92k | offset += sizeof_cluster; |
131 | 2.92k | } |
132 | 114 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_out_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &out_count); |
133 | 114 | offset += 1; |
134 | 114 | if ((tree) && (out_count)) { |
135 | 24 | field_tree = proto_tree_add_subtree(tree, tvb, offset, (int)(out_count*sizeof_cluster), |
136 | 24 | ett_zbee_zdp_bind_end_out, NULL, "Output Cluster List"); |
137 | 24 | } |
138 | 1.21k | for (i=0; i<out_count; i++) { |
139 | 1.09k | proto_tree_add_item(field_tree, hf_zbee_zdp_out_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN); |
140 | 1.09k | offset += sizeof_cluster; |
141 | 1.09k | } |
142 | 114 | if (version >= ZBEE_VERSION_2007) { |
143 | 2 | zbee_append_info(tree, pinfo, " Src: %s", eui64_to_display(pinfo->pool, ext_addr)); |
144 | 2 | } |
145 | 114 | zbee_append_info(tree, pinfo, ", Target: 0x%04x", target); |
146 | | |
147 | | /* Dump any leftover bytes. */ |
148 | 114 | zdp_dump_excess(tvb, offset, pinfo, tree); |
149 | 114 | } /* dissect_zbee_zdp_req_end_device_bind */ |
150 | | |
151 | | /** |
152 | | *ZigBee Device Profile dissector for the bind request. |
153 | | * |
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. |
157 | | */ |
158 | | void |
159 | | dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version) |
160 | 26 | { |
161 | 26 | proto_item *ti; |
162 | 26 | unsigned sizeof_cluster = ZBEE_HAS_2006(version)?(int)sizeof(uint16_t):(int)sizeof(uint8_t); |
163 | 26 | unsigned offset = 0; |
164 | 26 | uint64_t src64; |
165 | 26 | uint32_t cluster, dst_mode, dst; |
166 | 26 | uint64_t dst64 = 0; |
167 | | /*uint8_t dst_ep;*/ |
168 | | |
169 | 26 | src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL); |
170 | 26 | proto_tree_add_item(tree, hf_zbee_zdp_bind_src_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
171 | 26 | offset += 1; |
172 | 26 | ti = proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN, &cluster); |
173 | 26 | offset += sizeof_cluster; |
174 | 26 | proto_item_append_text(ti, " (%s)", rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster")); |
175 | | |
176 | 26 | if (version >= ZBEE_VERSION_2007) { |
177 | 2 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_addr_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN, &dst_mode); |
178 | 2 | offset += 1; |
179 | 2 | } |
180 | 24 | else { |
181 | | /* ZigBee 2003 & earlier does not have a address mode, and is unicast only. */ |
182 | 24 | dst_mode = ZBEE_ZDP_ADDR_MODE_UNICAST; |
183 | 24 | } |
184 | | |
185 | 26 | if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { |
186 | 0 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_bind_dst, tvb, offset, 2, ENC_LITTLE_ENDIAN, &dst); |
187 | 0 | offset += 2; |
188 | 0 | } |
189 | 26 | else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { |
190 | 12 | dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(uint64_t), NULL); |
191 | 12 | proto_tree_add_item(tree, hf_zbee_zdp_bind_dst_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
192 | 12 | offset += 1; |
193 | 12 | } |
194 | | |
195 | 26 | zbee_append_info(tree, pinfo, ", %s (Cluster ID: 0x%04x)", |
196 | 26 | rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster"), |
197 | 26 | cluster); |
198 | | |
199 | 26 | if (version >= ZBEE_VERSION_2007) { |
200 | 2 | zbee_append_info(tree, pinfo, " Src: %s", eui64_to_display(pinfo->pool, src64)); |
201 | 2 | } |
202 | 26 | if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { |
203 | 0 | zbee_append_info(tree, pinfo, ", Dst: 0x%04x", dst); |
204 | 0 | } |
205 | 26 | else { |
206 | 26 | zbee_append_info(tree, pinfo, ", Dst: %s", eui64_to_display(pinfo->pool, dst64)); |
207 | 26 | } |
208 | | |
209 | | /* Dump any leftover bytes. */ |
210 | 26 | zdp_dump_excess(tvb, offset, pinfo, tree); |
211 | 26 | } /* dissect_zbee_zdp_req_bind */ |
212 | | |
213 | | /** |
214 | | *ZigBee Device Profile dissector for the unbind request. |
215 | | * |
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. |
219 | | */ |
220 | | void |
221 | | dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version) |
222 | 29 | { |
223 | 29 | proto_item *ti; |
224 | 29 | unsigned sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(uint16_t):(int)sizeof(uint8_t); |
225 | 29 | unsigned offset = 0; |
226 | 29 | uint64_t src64; |
227 | | /*uint8_t src_ep;*/ |
228 | 29 | uint32_t cluster, dst_mode, dst = 0; |
229 | 29 | uint64_t dst64 = 0; |
230 | | /*uint8_t dst_ep;*/ |
231 | | |
232 | 29 | src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL); |
233 | 29 | proto_tree_add_item(tree, hf_zbee_zdp_bind_src_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
234 | 29 | offset += 1; |
235 | 29 | ti = proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN, &cluster); |
236 | 29 | offset += sizeof_cluster; |
237 | 29 | proto_item_append_text(ti, " (%s)", rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster")); |
238 | | |
239 | 29 | if (version >= ZBEE_VERSION_2007) { |
240 | 1 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_addr_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN, &dst_mode); |
241 | 1 | offset += 1; |
242 | 1 | } |
243 | 28 | else { |
244 | | /* ZigBee 2003 & earlier does not have a address mode, and is unicast only. */ |
245 | 28 | dst_mode = ZBEE_ZDP_ADDR_MODE_UNICAST; |
246 | 28 | } |
247 | | |
248 | 29 | if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { |
249 | 0 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_bind_dst, tvb, offset, 2, ENC_LITTLE_ENDIAN, &dst); |
250 | 0 | offset += 2; |
251 | 0 | } |
252 | 29 | else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { |
253 | 13 | dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(uint64_t), NULL); |
254 | 13 | proto_tree_add_item(tree, hf_zbee_zdp_bind_dst_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
255 | 13 | offset += 1; |
256 | 13 | } |
257 | | |
258 | 29 | zbee_append_info(tree, pinfo, ", %s (Cluster ID: 0x%04x)", |
259 | 29 | rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster"), |
260 | 29 | cluster); |
261 | | |
262 | 29 | if (version >= ZBEE_VERSION_2007) { |
263 | 1 | zbee_append_info(tree, pinfo, " Src: %s", eui64_to_display(pinfo->pool, src64)); |
264 | 1 | } |
265 | 29 | if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { |
266 | 0 | zbee_append_info(tree, pinfo, ", Dst: 0x%04x", dst); |
267 | 0 | } |
268 | 29 | else { |
269 | 29 | zbee_append_info(tree, pinfo, ", Dst: %s", eui64_to_display(pinfo->pool, dst64)); |
270 | 29 | } |
271 | | |
272 | | /* Dump any leftover bytes. */ |
273 | 29 | zdp_dump_excess(tvb, offset, pinfo, tree); |
274 | 29 | } /* dissect_zbee_zdp_req_unbind */ |
275 | | |
276 | | /** |
277 | | *ZigBee Device Profile dissector for the bind register |
278 | | * |
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. |
282 | | */ |
283 | | void |
284 | | dissect_zbee_zdp_req_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
285 | 1 | { |
286 | 1 | unsigned offset = 0; |
287 | 1 | uint64_t ext_addr; |
288 | | |
289 | 1 | ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(uint64_t), NULL); |
290 | | |
291 | 1 | zbee_append_info(tree, pinfo, ", Device: %s", eui64_to_display(pinfo->pool, ext_addr)); |
292 | | |
293 | | /* Dump any leftover bytes. */ |
294 | 1 | zdp_dump_excess(tvb, offset, pinfo, tree); |
295 | 1 | } /* dissect_zbee_zdp_req_bind_register */ |
296 | | |
297 | | /** |
298 | | *ZigBee Device Profile dissector for the replace device |
299 | | * |
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. |
303 | | */ |
304 | | void |
305 | | dissect_zbee_zdp_req_replace_device(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
306 | 19 | { |
307 | 19 | unsigned offset = 0; |
308 | 19 | uint64_t ext_addr; |
309 | 19 | uint64_t new_addr; |
310 | | |
311 | 19 | ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(uint64_t), NULL); |
312 | 19 | proto_tree_add_item(tree, hf_zbee_zdp_endpoint, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
313 | 19 | offset += 1; |
314 | 19 | new_addr = zbee_parse_eui64(tree, hf_zbee_zdp_replacement, tvb, &offset, (int)sizeof(uint64_t), NULL); |
315 | 19 | proto_tree_add_item(tree, hf_zbee_zdp_replacement_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
316 | 19 | offset += 1; |
317 | | |
318 | 19 | zbee_append_info(tree, pinfo, ", Device: %s", eui64_to_display(pinfo->pool, ext_addr)); |
319 | 19 | zbee_append_info(tree, pinfo, ", Replacement: %s", eui64_to_display(pinfo->pool, new_addr)); |
320 | | |
321 | | /* Dump any leftover bytes. */ |
322 | 19 | zdp_dump_excess(tvb, offset, pinfo, tree); |
323 | 19 | } /* dissect_zbee_zdp_req_replace_device */ |
324 | | |
325 | | /** |
326 | | *ZigBee Device Profile dissector for the store backup binding |
327 | | * |
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. |
331 | | */ |
332 | | void |
333 | | dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version) |
334 | 31 | { |
335 | 31 | proto_item *ti; |
336 | | |
337 | 31 | unsigned sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(uint16_t):(int)sizeof(uint8_t); |
338 | 31 | unsigned offset = 0; |
339 | 31 | uint64_t src64; |
340 | 31 | uint32_t src_ep, cluster, dst_mode; |
341 | | |
342 | 31 | src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL); |
343 | 31 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN, &src_ep); |
344 | 31 | offset += 1; |
345 | 31 | ti = proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN, &cluster); |
346 | 31 | offset += sizeof_cluster; |
347 | 31 | proto_item_append_text(ti, " (%s)", rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster")); |
348 | 31 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_addr_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN, &dst_mode); |
349 | 31 | offset += 1; |
350 | | |
351 | 31 | if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { |
352 | 1 | proto_tree_add_item(tree, hf_zbee_zdp_bind_dst, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
353 | 1 | offset += 2; |
354 | 1 | } |
355 | 30 | else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { |
356 | | /*uint64_t dst64;*/ |
357 | | /*uint8_t dst_ep;*/ |
358 | 1 | /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(uint64_t), NULL); |
359 | 1 | proto_tree_add_item(tree, hf_zbee_zdp_bind_dst_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
360 | 1 | offset += 1; |
361 | 1 | } |
362 | | |
363 | 31 | zbee_append_info(tree, pinfo, ", %s (Cluster ID: 0x%04x)", rval_to_str_const(cluster, zbee_aps_cid_names, "Unknown Cluster"), cluster); |
364 | 31 | zbee_append_info(tree, pinfo, ", Src: %s", eui64_to_display(pinfo->pool, src64)); |
365 | 31 | zbee_append_info(tree, pinfo, ", Src Endpoint: %d", src_ep); |
366 | | |
367 | | /* Dump any leftover bytes. */ |
368 | 31 | zdp_dump_excess(tvb, offset, pinfo, tree); |
369 | 31 | } /* dissect_zbee_zdp_req_store_bak_bind_entry */ |
370 | | |
371 | | /** |
372 | | *ZigBee Device Profile dissector for the remove backup binding |
373 | | * |
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. |
377 | | */ |
378 | | void |
379 | | dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version) |
380 | 30 | { |
381 | 30 | proto_item *ti; |
382 | | |
383 | 30 | unsigned sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(uint16_t):(int)sizeof(uint8_t); |
384 | 30 | unsigned offset = 0; |
385 | 30 | uint64_t src64; |
386 | 30 | uint32_t src_ep, cluster, dst_mode; |
387 | | |
388 | 30 | src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL); |
389 | 30 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN, &src_ep); |
390 | 30 | offset += 1; |
391 | 30 | ti = proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN, &cluster); |
392 | 30 | offset += sizeof_cluster; |
393 | 30 | proto_item_append_text(ti, " (%s)", val_to_str_const(cluster, zbee_zdp_cluster_names, "Unknown Device Profile Cluster")); |
394 | 30 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_addr_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN, &dst_mode); |
395 | 30 | offset += 1; |
396 | | |
397 | 30 | if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { |
398 | 0 | proto_tree_add_item(tree, hf_zbee_zdp_bind_dst, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
399 | 0 | offset += 2; |
400 | 0 | } |
401 | 30 | else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { |
402 | | /*uint64_t dst64;*/ |
403 | | /*uint8_t dst_ep;*/ |
404 | 1 | /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(uint64_t), NULL); |
405 | 1 | proto_tree_add_item(tree, hf_zbee_zdp_bind_dst_ep, tvb, offset, 1, ENC_LITTLE_ENDIAN); |
406 | 1 | offset += 1; |
407 | 1 | } |
408 | | |
409 | 30 | 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 | 30 | zbee_append_info(tree, pinfo, ", Src: %s", eui64_to_display(pinfo->pool, src64)); |
411 | 30 | zbee_append_info(tree, pinfo, ", Src Endpoint: %d", src_ep); |
412 | | |
413 | | /* Dump any leftover bytes. */ |
414 | 30 | zdp_dump_excess(tvb, offset, pinfo, tree); |
415 | 30 | } /* dissect_zbee_zdp_req_remove_bak_bind_entry */ |
416 | | |
417 | | /** |
418 | | *ZigBee Device Profile dissector for the backup binding |
419 | | * |
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. |
423 | | */ |
424 | | void |
425 | | dissect_zbee_zdp_req_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version) |
426 | 7 | { |
427 | 7 | proto_tree *field_tree; |
428 | | |
429 | 7 | unsigned offset = 0; |
430 | 7 | uint32_t i, table_count; |
431 | | |
432 | 7 | proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
433 | 7 | offset += 2; |
434 | 7 | proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
435 | 7 | offset += 2; |
436 | 7 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count); |
437 | 7 | offset += 2; |
438 | | |
439 | 7 | field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_bind, NULL, "Binding Table"); |
440 | | |
441 | 96 | for (i=0; i<table_count; i++) { |
442 | 89 | zdp_parse_bind_table_entry(field_tree, tvb, &offset, version); |
443 | 89 | } /* for */ |
444 | | |
445 | | /* Dump any leftover bytes. */ |
446 | 7 | zdp_dump_excess(tvb, offset, pinfo, tree); |
447 | 7 | } /* dissect_zbee_zdp_req_backup_bind_table */ |
448 | | |
449 | | /** |
450 | | *ZigBee Device Profile dissector for the recover binding |
451 | | * |
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. |
455 | | */ |
456 | | void |
457 | | dissect_zbee_zdp_req_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
458 | 15 | { |
459 | 15 | unsigned offset = 0; |
460 | | |
461 | 15 | proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
462 | 15 | offset += 2; |
463 | | |
464 | | /* Dump any leftover bytes. */ |
465 | 15 | zdp_dump_excess(tvb, offset, pinfo, tree); |
466 | 15 | } /* dissect_zbee_zdp_req_recover_bind_table */ |
467 | | |
468 | | /** |
469 | | *ZigBee Device Profile dissector for the backup source binding |
470 | | * |
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. |
474 | | */ |
475 | | void |
476 | | dissect_zbee_zdp_req_backup_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
477 | 32 | { |
478 | 32 | proto_tree *field_tree; |
479 | | |
480 | 32 | unsigned offset = 0; |
481 | 32 | uint32_t i, table_count; |
482 | | |
483 | 32 | proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
484 | 32 | offset += 2; |
485 | 32 | proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
486 | 32 | offset += 2; |
487 | 32 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count); |
488 | 32 | offset += 2; |
489 | | |
490 | 32 | field_tree = proto_tree_add_subtree(tree, tvb, offset, table_count*(int)sizeof(uint64_t), |
491 | 32 | ett_zbee_zdp_bind_source, NULL, "Source Table"); |
492 | | |
493 | 304 | for (i=0; i<table_count; i++) zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL); |
494 | | |
495 | | /* Dump any leftover bytes. */ |
496 | 32 | zdp_dump_excess(tvb, offset, pinfo, tree); |
497 | 32 | } /* dissect_zbee_zdp_req_backup_source_bind */ |
498 | | |
499 | | /** |
500 | | *ZigBee Device Profile dissector for the recover source |
501 | | * |
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. |
505 | | */ |
506 | | void |
507 | | dissect_zbee_zdp_req_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
508 | 23 | { |
509 | 23 | unsigned offset = 0; |
510 | | |
511 | 23 | proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
512 | 23 | offset += 2; |
513 | | |
514 | | /* Dump any leftover bytes. */ |
515 | 23 | zdp_dump_excess(tvb, offset, pinfo, tree); |
516 | 23 | } /* dissect_zbee_zdp_req_recover_source_bind */ |
517 | | |
518 | | /** |
519 | | *ZigBee Device Profile dissector for the clear all bindings request. |
520 | | * |
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. |
524 | | */ |
525 | | void |
526 | | dissect_zbee_zdp_req_clear_all_bindings(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
527 | 90 | { |
528 | 90 | unsigned offset = 0; |
529 | | |
530 | 90 | offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, NULL, ZBEE_TLV_SRC_TYPE_ZBEE_ZDP, ZBEE_ZDP_REQ_CLEAR_ALL_BINDINGS); |
531 | | |
532 | | /* Dump any leftover bytes. */ |
533 | 90 | zdp_dump_excess(tvb, offset, pinfo, tree); |
534 | 90 | } |
535 | | |
536 | | /** |
537 | | *ZigBee Device Profile dissector for the clear all bindings response. |
538 | | * |
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. |
542 | | */ |
543 | | void |
544 | | dissect_zbee_zdp_rsp_clear_all_bindings(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
545 | 19 | { |
546 | 19 | unsigned offset = 0; |
547 | 19 | uint8_t status; |
548 | | |
549 | 19 | status = zdp_parse_status(tree, tvb, &offset); |
550 | 19 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
551 | | |
552 | | /* Dump any leftover bytes. */ |
553 | 19 | zdp_dump_excess(tvb, offset, pinfo, tree); |
554 | 19 | } /* dissect_zbee_zdp_rsp_clear_all_bindings */ |
555 | | |
556 | | /************************************** |
557 | | * BINDING RESPONSES |
558 | | ************************************** |
559 | | */ |
560 | | /** |
561 | | *ZigBee Device Profile dissector for the end device bind |
562 | | * |
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. |
566 | | */ |
567 | | void |
568 | | dissect_zbee_zdp_rsp_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
569 | 14 | { |
570 | 14 | unsigned offset = 0; |
571 | 14 | uint8_t status; |
572 | | |
573 | 14 | status = zdp_parse_status(tree, tvb, &offset); |
574 | | |
575 | 14 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
576 | | |
577 | | /* Dump any leftover bytes. */ |
578 | 14 | zdp_dump_excess(tvb, offset, pinfo, tree); |
579 | 14 | } /* dissect_zbee_zdp_rsp_end_device_bind */ |
580 | | |
581 | | /** |
582 | | *ZigBee Device Profile dissector for the bind response. |
583 | | * |
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. |
587 | | */ |
588 | | void |
589 | | dissect_zbee_zdp_rsp_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
590 | 23 | { |
591 | 23 | unsigned offset = 0; |
592 | 23 | uint8_t status; |
593 | | |
594 | 23 | status = zdp_parse_status(tree, tvb, &offset); |
595 | | |
596 | 23 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
597 | | |
598 | | /* Dump any leftover bytes. */ |
599 | 23 | zdp_dump_excess(tvb, offset, pinfo, tree); |
600 | 23 | } /* dissect_zbee_zdp_rsp_bind */ |
601 | | |
602 | | /** |
603 | | *ZigBee Device Profile dissector for the unbind response. |
604 | | * |
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. |
608 | | */ |
609 | | void |
610 | | dissect_zbee_zdp_rsp_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
611 | 0 | { |
612 | 0 | unsigned offset = 0; |
613 | 0 | uint8_t status; |
614 | |
|
615 | 0 | status = zdp_parse_status(tree, tvb, &offset); |
616 | |
|
617 | 0 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
618 | | |
619 | | /* Dump any leftover bytes. */ |
620 | 0 | zdp_dump_excess(tvb, offset, pinfo, tree); |
621 | 0 | } /* dissect_zbee_zdp_rsp_unbind */ |
622 | | |
623 | | /** |
624 | | *ZigBee Device Profile dissector for the bind registration |
625 | | * |
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. |
629 | | */ |
630 | | void |
631 | | dissect_zbee_zdp_rsp_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version) |
632 | 93 | { |
633 | 93 | proto_tree *field_tree = NULL; |
634 | 93 | unsigned offset = 0; |
635 | | |
636 | 93 | uint8_t status; |
637 | 93 | uint32_t i, table_count; |
638 | | |
639 | 93 | status = zdp_parse_status(tree, tvb, &offset); |
640 | | |
641 | 93 | if ((status == ZBEE_ZDP_STATUS_SUCCESS) || (tvb_bytes_exist(tvb, offset, 2))) { |
642 | 82 | proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
643 | 82 | offset += 2; |
644 | 82 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count); |
645 | 82 | offset += 2; |
646 | | |
647 | 82 | if (tree && table_count) { |
648 | 39 | field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_bind, NULL, "Binding List"); |
649 | 39 | } |
650 | 268 | for (i=0; i<table_count; i++) { |
651 | 186 | zdp_parse_bind_table_entry(field_tree, tvb, &offset, version); |
652 | 186 | } /* for */ |
653 | 82 | } |
654 | | |
655 | 93 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
656 | | |
657 | | /* Dump any leftover bytes. */ |
658 | 93 | zdp_dump_excess(tvb, offset, pinfo, tree); |
659 | 93 | } /* dissect_zbee_zdp_rsp_bind_register */ |
660 | | |
661 | | /** |
662 | | *ZigBee Device Profile dissector for the device replacement |
663 | | * |
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. |
667 | | */ |
668 | | void |
669 | | dissect_zbee_zdp_rsp_replace_device(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
670 | 4 | { |
671 | 4 | unsigned offset = 0; |
672 | 4 | uint8_t status; |
673 | | |
674 | 4 | status = zdp_parse_status(tree, tvb, &offset); |
675 | | |
676 | 4 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
677 | | |
678 | | /* Dump any leftover bytes. */ |
679 | 4 | zdp_dump_excess(tvb, offset, pinfo, tree); |
680 | 4 | } /* dissect_zbee_zdp_rsp_replace_device */ |
681 | | |
682 | | /** |
683 | | *ZigBee Device Profile dissector for the store backup binding |
684 | | * |
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. |
688 | | */ |
689 | | void |
690 | | dissect_zbee_zdp_rsp_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
691 | 0 | { |
692 | 0 | unsigned offset = 0; |
693 | 0 | uint8_t status; |
694 | |
|
695 | 0 | status = zdp_parse_status(tree, tvb, &offset); |
696 | |
|
697 | 0 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
698 | | |
699 | | /* Dump any leftover bytes. */ |
700 | 0 | zdp_dump_excess(tvb, offset, pinfo, tree); |
701 | 0 | } /* dissect_zbee_zdp_rsp_store_bak_bind_entry */ |
702 | | |
703 | | /** |
704 | | *ZigBee Device Profile dissector for the remove backup binding |
705 | | * |
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. |
709 | | */ |
710 | | void |
711 | | dissect_zbee_zdp_rsp_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
712 | 0 | { |
713 | 0 | unsigned offset = 0; |
714 | 0 | uint8_t status; |
715 | |
|
716 | 0 | status = zdp_parse_status(tree, tvb, &offset); |
717 | |
|
718 | 0 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
719 | | |
720 | | /* Dump any leftover bytes. */ |
721 | 0 | zdp_dump_excess(tvb, offset, pinfo, tree); |
722 | 0 | } /* dissect_zbee_zdp_rsp_remove_bak_bind_entry */ |
723 | | |
724 | | /** |
725 | | *ZigBee Device Profile dissector for the backup binding |
726 | | * |
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. |
730 | | */ |
731 | | void |
732 | | dissect_zbee_zdp_rsp_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
733 | 0 | { |
734 | 0 | unsigned offset = 0; |
735 | 0 | uint8_t status; |
736 | |
|
737 | 0 | status = zdp_parse_status(tree, tvb, &offset); |
738 | 0 | if ((status == ZBEE_ZDP_STATUS_SUCCESS) || (tvb_bytes_exist(tvb, offset, 2))) { |
739 | 0 | proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
740 | 0 | offset += 2; |
741 | 0 | } |
742 | |
|
743 | 0 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
744 | | |
745 | | /* Dump any leftover bytes. */ |
746 | 0 | zdp_dump_excess(tvb, offset, pinfo, tree); |
747 | 0 | } /* dissect_zbee_zdp_rsp_backup_bind_table */ |
748 | | |
749 | | /** |
750 | | *ZigBee Device Profile dissector for the recover binding |
751 | | * |
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. |
755 | | */ |
756 | | void |
757 | | dissect_zbee_zdp_rsp_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t version) |
758 | 10 | { |
759 | 10 | proto_tree *field_tree = NULL; |
760 | 10 | unsigned offset = 0; |
761 | 10 | uint8_t status; |
762 | 10 | uint32_t i, table_count; |
763 | | |
764 | 10 | status = zdp_parse_status(tree, tvb, &offset); |
765 | 10 | if ((status == ZBEE_ZDP_STATUS_SUCCESS) || (tvb_bytes_exist(tvb, offset, 2))) { |
766 | 10 | proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
767 | 10 | offset += 2; |
768 | 10 | proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
769 | 10 | offset += 2; |
770 | 10 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count); |
771 | 10 | offset += 2; |
772 | | |
773 | 10 | if (tree && table_count) { |
774 | 9 | field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_bind, NULL, "Binding Table"); |
775 | 9 | } |
776 | 192 | for (i=0; i<table_count; i++) { |
777 | 182 | zdp_parse_bind_table_entry(field_tree, tvb, &offset, version); |
778 | 182 | } /* for */ |
779 | 10 | } |
780 | | |
781 | 10 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
782 | | |
783 | | /* Dump any leftover bytes. */ |
784 | 10 | zdp_dump_excess(tvb, offset, pinfo, tree); |
785 | 10 | } /* dissect_zbee_zdp_rsp_recover_bind_table */ |
786 | | |
787 | | /** |
788 | | *ZigBee Device Profile dissector for the backup source binding |
789 | | * |
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. |
793 | | */ |
794 | | void |
795 | | dissect_zbee_zdp_rsp_backup_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
796 | 0 | { |
797 | 0 | unsigned offset = 0; |
798 | 0 | uint8_t status; |
799 | |
|
800 | 0 | status = zdp_parse_status(tree, tvb, &offset); |
801 | |
|
802 | 0 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
803 | | |
804 | | /* Dump any leftover bytes. */ |
805 | 0 | zdp_dump_excess(tvb, offset, pinfo, tree); |
806 | 0 | } /* dissect_zbee_zdp_rsp_backup_source_bind */ |
807 | | |
808 | | /** |
809 | | *ZigBee Device Profile dissector for the recover source binding |
810 | | * |
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. |
814 | | */ |
815 | | void |
816 | | dissect_zbee_zdp_rsp_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
817 | 109 | { |
818 | 109 | proto_tree *field_tree = NULL; |
819 | 109 | unsigned offset = 0; |
820 | | |
821 | 109 | uint8_t status; |
822 | 109 | uint32_t i, table_count; |
823 | | |
824 | 109 | status = zdp_parse_status(tree, tvb, &offset); |
825 | | |
826 | 109 | if ((status == ZBEE_ZDP_STATUS_SUCCESS) || (tvb_bytes_exist(tvb, offset, 2))) { |
827 | 104 | proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
828 | 104 | offset += 2; |
829 | 104 | proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
830 | 104 | offset += 2; |
831 | 104 | proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count); |
832 | 104 | offset += 2; |
833 | | |
834 | 104 | if (tree && table_count) { |
835 | 52 | field_tree = proto_tree_add_subtree(tree, tvb, offset, table_count * (int)sizeof(uint64_t), |
836 | 52 | ett_zbee_zdp_bind_source, NULL, "Source Table"); |
837 | 52 | } |
838 | | |
839 | 519 | for (i=0; i<table_count; i++) { |
840 | 415 | (void)zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(uint64_t), NULL); |
841 | 415 | } /* for */ |
842 | 104 | } |
843 | | |
844 | 109 | zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); |
845 | | |
846 | | /* Dump any leftover bytes. */ |
847 | 109 | zdp_dump_excess(tvb, offset, pinfo, tree); |
848 | 109 | } /* dissect_zbee_zdp_rsp_recover_source_bind */ |
849 | | |
850 | | /* |
851 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
852 | | * |
853 | | * Local variables: |
854 | | * c-basic-offset: 4 |
855 | | * tab-width: 8 |
856 | | * indent-tabs-mode: nil |
857 | | * End: |
858 | | * |
859 | | * vi: set shiftwidth=4 tabstop=8 expandtab: |
860 | | * :indentSize=4:tabSize=8:noTabs=true: |
861 | | */ |