Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-zbee-zdp.c
blob1057fb017164301bc6718ad3d2f661a32a91fbd8
1 /* packet-zbee-zdp.c
2 * Dissector routines for the ZigBee Device Profile (ZDP)
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/expert.h>
18 #include <wsutil/bits_ctz.h>
19 #include <wsutil/str_util.h>
21 #include "packet-zbee.h"
22 #include "packet-zbee-aps.h"
23 #include "packet-zbee-nwk.h"
24 #include "packet-zbee-zdp.h"
25 #include "packet-zbee-zdp.h"
27 void proto_reg_handoff_zbee_zdp(void);
28 void proto_register_zbee_zdp(void);
30 /*************************/
31 /* Function Declarations */
32 /*************************/
33 /* Local Helper routines. */
34 static uint16_t zdp_convert_2003cluster (uint8_t cluster);
37 /**************************************
38 * Field indices
39 **************************************
41 /* Global field indices. */
42 static int proto_zbee_zdp;
43 static int hf_zbee_zdp_seqno;
44 #if 0
45 static int hf_zbee_zdp_length; /* Deprecates since ZigBee 2006. */
46 #endif
48 /* General indices. */
49 int hf_zbee_zdp_ext_addr;
50 int hf_zbee_zdp_nwk_addr;
51 int hf_zbee_zdp_req_type;
52 int hf_zbee_zdp_index;
53 static int hf_zbee_zdp_status;
54 int hf_zbee_zdp_ep_count;
55 int hf_zbee_zdp_endpoint;
56 int hf_zbee_zdp_profile;
57 int hf_zbee_zdp_cluster;
58 int hf_zbee_zdp_addr_mode;
59 int hf_zbee_zdp_table_size;
60 int hf_zbee_zdp_table_count;
61 int hf_zbee_zdp_in_count;
62 int hf_zbee_zdp_out_count;
63 int hf_zbee_zdp_in_cluster;
64 int hf_zbee_zdp_out_cluster;
65 int hf_zbee_zdp_assoc_device_count;
66 int hf_zbee_zdp_assoc_device;
67 int hf_zbee_zdp_cache_address;
69 /* Capability information indices. */
70 static int hf_zbee_zdp_cinfo;
71 static int hf_zbee_zdp_cinfo_alloc;
72 static int hf_zbee_zdp_cinfo_security;
73 static int hf_zbee_zdp_cinfo_idle_rx;
74 static int hf_zbee_zdp_cinfo_power;
75 static int hf_zbee_zdp_cinfo_ffd;
76 static int hf_zbee_zdp_cinfo_alt_coord;
78 /* Server mode flag indices. */
79 static int hf_zbee_zdp_server;
80 static int hf_zbee_zdp_server_pri_trust;
81 static int hf_zbee_zdp_server_bak_trust;
82 static int hf_zbee_zdp_server_pri_bind;
83 static int hf_zbee_zdp_server_bak_bind;
84 static int hf_zbee_zdp_server_pri_disc;
85 static int hf_zbee_zdp_server_bak_disc;
86 static int hf_zbee_zdp_server_network_manager;
87 static int hf_zbee_zdp_server_stk_compl_rev;
89 /* Node descriptor indices. */
90 static int hf_zbee_zdp_node_type;
91 static int hf_zbee_zdp_node_complex;
92 static int hf_zbee_zdp_node_user;
93 static int hf_zbee_zdp_node_frag_support;
94 static int hf_zbee_zdp_node_freq_868;
95 static int hf_zbee_zdp_node_freq_900;
96 static int hf_zbee_zdp_node_freq_2400;
97 static int hf_zbee_zdp_node_freq_eu_sub_ghz;
98 static int hf_zbee_zdp_node_manufacturer;
99 static int hf_zbee_zdp_node_max_buffer;
100 static int hf_zbee_zdp_node_max_incoming_transfer;
101 static int hf_zbee_zdp_node_max_outgoing_transfer;
102 static int hf_zbee_zdp_dcf;
103 static int hf_zbee_zdp_dcf_eaela;
104 static int hf_zbee_zdp_dcf_esdla;
106 /* Power descriptor indices. */
107 static int hf_zbee_zdp_power;
108 static int hf_zbee_zdp_power_mode;
109 static int hf_zbee_zdp_power_avail_ac;
110 static int hf_zbee_zdp_power_avail_recharge;
111 static int hf_zbee_zdp_power_avail_dispose;
112 static int hf_zbee_zdp_power_source_ac;
113 static int hf_zbee_zdp_power_source_recharge;
114 static int hf_zbee_zdp_power_source_dispose;
115 static int hf_zbee_zdp_power_level;
117 /* Simple descriptor indices. */
118 static int hf_zbee_zdp_simple_app_device;
119 static int hf_zbee_zdp_simple_zll_app_device;
120 static int hf_zbee_zdp_simple_ha_app_device;
121 static int hf_zbee_zdp_simple_app_version;
122 int hf_zbee_zdp_simple_length;
124 /* Complex descriptor indices. */
125 int hf_zbee_zdp_complex_length;
126 static int hf_zbee_zdp_complex;
128 /* User descriptor indices. */
129 int hf_zbee_zdp_user;
130 int hf_zbee_zdp_user_length;
132 /* Discovery indices. */
133 int hf_zbee_zdp_cache;
134 int hf_zbee_zdp_disc_node_size;
135 int hf_zbee_zdp_disc_power_size;
136 int hf_zbee_zdp_disc_ep_count;
137 int hf_zbee_zdp_disc_simple_count;
138 int hf_zbee_zdp_disc_simple_size;
140 /* Binding indices. */
141 int hf_zbee_zdp_target;
142 int hf_zbee_zdp_replacement;
143 int hf_zbee_zdp_replacement_ep;
144 int hf_zbee_zdp_bind_src;
145 int hf_zbee_zdp_bind_src64;
146 int hf_zbee_zdp_bind_src_ep;
147 int hf_zbee_zdp_bind_dst;
148 int hf_zbee_zdp_bind_dst64;
149 int hf_zbee_zdp_bind_dst_ep;
151 /* Network Management indices. */
152 int hf_zbee_zdp_duration;
153 int hf_zbee_zdp_leave_children;
154 int hf_zbee_zdp_leave_rejoin;
155 int hf_zbee_zdp_significance;
156 int hf_zbee_zdp_scan_count;
157 int hf_zbee_zdp_update_id;
158 int hf_zbee_zdp_manager;
159 int hf_zbee_zdp_tx_total;
160 int hf_zbee_zdp_tx_fail;
161 int hf_zbee_zdp_tx_retries;
162 int hf_zbee_zdp_period_time_results;
163 int hf_zbee_zdp_channel_count;
164 int hf_zbee_zdp_channel_mask;
165 int hf_zbee_zdp_channel_page;
166 int hf_zbee_zdp_channel_page_count;
167 int hf_zbee_zdp_channel_energy;
168 int hf_zbee_zdp_pan_eui64;
169 int hf_zbee_zdp_pan_uint;
170 int hf_zbee_zdp_channel;
171 int hf_zbee_zdp_nwk_desc_profile;
172 int hf_zbee_zdp_profile_version;
173 int hf_zbee_zdp_beacon;
174 int hf_zbee_zdp_superframe;
175 int hf_zbee_zdp_permit_joining;
176 int hf_zbee_zdp_extended_pan;
177 int hf_zbee_zdp_addr;
178 int hf_zbee_zdp_table_entry_type;
179 int hf_zbee_zdp_table_entry_idle_rx_0c;
180 int hf_zbee_zdp_table_entry_relationship_70;
181 int hf_zbee_zdp_table_entry_idle_rx_04;
182 int hf_zbee_zdp_table_entry_relationship_18;
183 int hf_zbee_zdp_depth;
184 int hf_zbee_zdp_permit_joining_03;
185 int hf_zbee_zdp_lqi;
186 static int hf_zbee_zdp_scan_channel;
187 int hf_zbee_zdp_ieee_join_start_index;
188 int hf_zbee_zdp_ieee_join_update_id;
189 int hf_zbee_zdp_ieee_join_policy;
190 int hf_zbee_zdp_ieee_join_list_total;
191 int hf_zbee_zdp_ieee_join_list_start;
192 int hf_zbee_zdp_ieee_join_list_count;
193 int hf_zbee_zdp_ieee_join_list_ieee;
194 int hf_zbee_zdp_number_of_children;
195 int hf_zbee_zdp_beacon_survey_scan_mask;
196 int hf_zbee_zdp_beacon_survey_scan_mask_cnt;
197 int hf_zbee_zdp_beacon_survey_conf_mask;
198 int hf_zbee_zdp_beacon_survey_total;
199 int hf_zbee_zdp_beacon_survey_cur_zbn;
200 int hf_zbee_zdp_beacon_survey_cur_zbn_potent_parents;
201 int hf_zbee_zdp_beacon_survey_other_zbn;
202 int hf_zbee_zdp_beacon_survey_current_parent;
203 int hf_zbee_zdp_beacon_survey_cnt_parents;
204 int hf_zbee_zdp_beacon_survey_parent;
205 int hf_zbee_zdp_tlv_count;
206 int hf_zbee_zdp_tlv_id;
207 /* Routing Table */
208 int hf_zbee_zdp_rtg;
209 int hf_zbee_zdp_rtg_entry;
210 int hf_zbee_zdp_rtg_destination;
211 int hf_zbee_zdp_rtg_next_hop;
212 int hf_zbee_zdp_rtg_status;
215 /* Subtree indices. */
216 static int ett_zbee_zdp;
217 int ett_zbee_zdp_endpoint;
218 int ett_zbee_zdp_match_in;
219 int ett_zbee_zdp_match_out;
220 int ett_zbee_zdp_node;
221 static int ett_zbee_zdp_node_in;
222 static int ett_zbee_zdp_node_out;
223 int ett_zbee_zdp_power;
224 int ett_zbee_zdp_simple;
225 int ett_zbee_zdp_cinfo;
226 int ett_zbee_zdp_server;
227 int ett_zbee_zdp_simple_sizes;
228 int ett_zbee_zdp_bind;
229 int ett_zbee_zdp_bind_entry;
230 int ett_zbee_zdp_bind_end_in;
231 int ett_zbee_zdp_bind_end_out;
232 static int ett_zbee_zdp_bind_table;
233 int ett_zbee_zdp_bind_source;
234 int ett_zbee_zdp_assoc_device;
235 int ett_zbee_zdp_nwk;
236 int ett_zbee_zdp_perm_join_fc;
237 int ett_zbee_zdp_lqi;
238 int ett_zbee_zdp_rtg;
239 int ett_zbee_zdp_cache;
240 int ett_zbee_zdp_nwk_desc;
241 int ett_zbee_zdp_table_entry;
242 static int ett_zbee_zdp_descriptor_capability_field;
244 /* Expert Info */
245 static expert_field ei_deprecated_command;
247 /**************************************
248 * Value Strings
249 **************************************
251 static const value_string zbee_zdp_req_types[] = {
252 { ZBEE_ZDP_REQ_TYPE_SINGLE, "Single Device Response" },
253 { ZBEE_ZDP_REQ_TYPE_EXTENDED, "Extended Response" },
254 { 0, NULL }
257 const value_string zbee_zdp_cluster_names[] = {
258 { ZBEE_ZDP_REQ_NWK_ADDR, "Network Address Request" },
259 { ZBEE_ZDP_REQ_IEEE_ADDR, "Extended Address Request" },
260 { ZBEE_ZDP_REQ_NODE_DESC, "Node Descriptor Request" },
261 { ZBEE_ZDP_REQ_POWER_DESC, "Power Descriptor Request" },
262 { ZBEE_ZDP_REQ_SIMPLE_DESC, "Simple Descriptor Request" },
263 { ZBEE_ZDP_REQ_ACTIVE_EP, "Active Endpoint Request" },
264 { ZBEE_ZDP_REQ_MATCH_DESC, "Match Descriptor Request" },
265 { ZBEE_ZDP_REQ_COMPLEX_DESC, "Complex Descriptor Request" },
266 { ZBEE_ZDP_REQ_USER_DESC, "User Descriptor Request" },
267 { ZBEE_ZDP_REQ_DISCOVERY_CACHE, "Discovery Cache Request" },
268 { ZBEE_ZDP_REQ_DEVICE_ANNCE, "Device Announcement" },
269 { ZBEE_ZDP_REQ_PARENT_ANNCE, "Parent Announce" },
270 { ZBEE_ZDP_REQ_SET_USER_DESC, "Set User Descriptor Request" },
271 { ZBEE_ZDP_REQ_SYSTEM_SERVER_DISC, "Server Discovery Request" },
272 { ZBEE_ZDP_REQ_STORE_DISCOVERY, "Store Discovery Request" },
273 { ZBEE_ZDP_REQ_STORE_NODE_DESC, "Store Node Descriptor Request" },
274 { ZBEE_ZDP_REQ_STORE_POWER_DESC, "Store Power Descriptor Request" },
275 { ZBEE_ZDP_REQ_STORE_ACTIVE_EP, "Store Active Endpoints Request" },
276 { ZBEE_ZDP_REQ_STORE_SIMPLE_DESC, "Store Simple Descriptor Request" },
277 { ZBEE_ZDP_REQ_REMOVE_NODE_CACHE, "Remove Node Cache Request" },
278 { ZBEE_ZDP_REQ_FIND_NODE_CACHE, "Find Node Cache Request" },
279 { ZBEE_ZDP_REQ_EXT_SIMPLE_DESC, "Extended Simple Descriptor Request" },
280 { ZBEE_ZDP_REQ_EXT_ACTIVE_EP, "Extended Active Endpoint Request" },
281 { ZBEE_ZDP_REQ_END_DEVICE_BIND, "End Device Bind Request" },
282 { ZBEE_ZDP_REQ_BIND, "Bind Request" },
283 { ZBEE_ZDP_REQ_UNBIND, "Unbind Request" },
284 { ZBEE_ZDP_REQ_BIND_REGISTER, "Bind Register Request" },
285 { ZBEE_ZDP_REQ_REPLACE_DEVICE, "Replace Device Request" },
286 { ZBEE_ZDP_REQ_STORE_BAK_BIND_ENTRY, "Store Backup Binding Request" },
287 { ZBEE_ZDP_REQ_REMOVE_BAK_BIND_ENTRY, "Remove Backup Binding Request" },
288 { ZBEE_ZDP_REQ_BACKUP_BIND_TABLE, "Backup Binding Table Request" },
289 { ZBEE_ZDP_REQ_RECOVER_BIND_TABLE, "Recover Binding Table Request" },
290 { ZBEE_ZDP_REQ_BACKUP_SOURCE_BIND, "Backup Source Binding Request" },
291 { ZBEE_ZDP_REQ_RECOVER_SOURCE_BIND, "Recover Source Binding Request" },
292 { ZBEE_ZDP_REQ_CLEAR_ALL_BINDINGS, "Clear All Bindings Request" },
294 { ZBEE_ZDP_REQ_MGMT_NWK_DISC, "Network Discovery Request" },
295 { ZBEE_ZDP_REQ_MGMT_LQI, "Link Quality Request" },
296 { ZBEE_ZDP_REQ_MGMT_RTG, "Routing Table Request" },
297 { ZBEE_ZDP_REQ_MGMT_BIND, "Binding Table Request" },
298 { ZBEE_ZDP_REQ_MGMT_LEAVE, "Leave Request" },
299 { ZBEE_ZDP_REQ_MGMT_DIRECT_JOIN, "Direct Join Request" },
300 { ZBEE_ZDP_REQ_MGMT_PERMIT_JOIN, "Permit Join Request" },
301 { ZBEE_ZDP_REQ_MGMT_CACHE, "Cache Request" },
302 { ZBEE_ZDP_REQ_MGMT_NWKUPDATE, "Network Update Request" },
303 { ZBEE_ZDP_REQ_MGMT_NWKUPDATE_ENH, "Network Update Enhanced Request" },
304 { ZBEE_ZDP_REQ_MGMT_IEEE_JOIN_LIST, "IEEE Joining List Request" },
305 { ZBEE_ZDP_REQ_MGMT_NWK_BEACON_SURVEY, "Beacon Survey Request"},
306 { ZBEE_ZDP_REQ_SECURITY_START_KEY_NEGOTIATION,"Security Start Key Negotiation Request" },
307 { ZBEE_ZDP_REQ_SECURITY_GET_AUTH_TOKEN, "Security Get Authentication Token Request"},
308 { ZBEE_ZDP_REQ_SECURITY_GET_AUTH_LEVEL, "Security Get Authentication Level Request"},
309 { ZBEE_ZDP_REQ_SECURITY_SET_CONFIGURATION, "Security Set Configuration Request"},
310 { ZBEE_ZDP_REQ_SECURITY_GET_CONFIGURATION, "Security Get Configuration Request"},
311 { ZBEE_ZDP_REQ_SECURITY_START_KEY_UPDATE, "Security Start Key Update Request"},
312 { ZBEE_ZDP_REQ_SECURITY_DECOMMISSION, "Security Decommission Request"},
313 { ZBEE_ZDP_REQ_SECURITY_CHALLENGE, "Security Challenge Request"},
315 { ZBEE_ZDP_RSP_NWK_ADDR, "Network Address Response" },
316 { ZBEE_ZDP_RSP_IEEE_ADDR, "Extended Address Response" },
317 { ZBEE_ZDP_RSP_NODE_DESC, "Node Descriptor Response" },
318 { ZBEE_ZDP_RSP_POWER_DESC, "Power Descriptor Response" },
319 { ZBEE_ZDP_RSP_SIMPLE_DESC, "Simple Descriptor Response" },
320 { ZBEE_ZDP_RSP_ACTIVE_EP, "Active Endpoint Response" },
321 { ZBEE_ZDP_RSP_MATCH_DESC, "Match Descriptor Response" },
322 { ZBEE_ZDP_RSP_COMPLEX_DESC, "Complex Descriptor Response" },
323 { ZBEE_ZDP_RSP_USER_DESC, "User Descriptor Response" },
324 { ZBEE_ZDP_RSP_DISCOVERY_CACHE, "Discovery Cache Response" },
325 { ZBEE_ZDP_RSP_CONF_USER_DESC, "Set User Descriptor Confirm" },
326 { ZBEE_ZDP_RSP_SYSTEM_SERVER_DISC, "Server Discovery Response" },
327 { ZBEE_ZDP_RSP_STORE_DISCOVERY, "Store Discovery Response" },
328 { ZBEE_ZDP_RSP_STORE_NODE_DESC, "Store Node Descriptor Response" },
329 { ZBEE_ZDP_RSP_STORE_POWER_DESC, "Store Power Descriptor Response" },
330 { ZBEE_ZDP_RSP_STORE_ACTIVE_EP, "Store Active Endpoints Response" },
331 { ZBEE_ZDP_RSP_STORE_SIMPLE_DESC, "Store Simple Descriptor Response" },
332 { ZBEE_ZDP_RSP_REMOVE_NODE_CACHE, "Remove Node Cache Response" },
333 { ZBEE_ZDP_RSP_FIND_NODE_CACHE, "Find Node Cache Response" },
334 { ZBEE_ZDP_RSP_EXT_SIMPLE_DESC, "Extended Simple Descriptor Response" },
335 { ZBEE_ZDP_RSP_EXT_ACTIVE_EP, "Extended Active Endpoint Response" },
336 { ZBEE_ZDP_RSP_PARENT_ANNCE, "Parent Announce Response" },
337 { ZBEE_ZDP_RSP_END_DEVICE_BIND, "End Device Bind Response" },
338 { ZBEE_ZDP_RSP_BIND, "Bind Response" },
339 { ZBEE_ZDP_RSP_UNBIND, "Unbind Response" },
340 { ZBEE_ZDP_RSP_BIND_REGISTER, "Bind Register Response" },
341 { ZBEE_ZDP_RSP_REPLACE_DEVICE, "Replace Device Response" },
342 { ZBEE_ZDP_RSP_STORE_BAK_BIND_ENTRY, "Store Backup Binding Response" },
343 { ZBEE_ZDP_RSP_REMOVE_BAK_BIND_ENTRY, "Remove Backup Binding Response" },
344 { ZBEE_ZDP_RSP_BACKUP_BIND_TABLE, "Backup Binding Table Response" },
345 { ZBEE_ZDP_RSP_RECOVER_BIND_TABLE, "Recover Binding Table Response" },
346 { ZBEE_ZDP_RSP_BACKUP_SOURCE_BIND, "Backup Source Binding Response" },
347 { ZBEE_ZDP_RSP_RECOVER_SOURCE_BIND, "Recover Source Binding Response" },
348 { ZBEE_ZDP_RSP_CLEAR_ALL_BINDINGS, "Clear All Bindings Response" },
349 { ZBEE_ZDP_RSP_MGMT_NWK_DISC, "Network Discovery Response" },
350 { ZBEE_ZDP_RSP_MGMT_LQI, "Link Quality Response" },
351 { ZBEE_ZDP_RSP_MGMT_RTG, "Routing Table Response" },
352 { ZBEE_ZDP_RSP_MGMT_BIND, "Binding Table Response" },
353 { ZBEE_ZDP_RSP_MGMT_LEAVE, "Leave Response" },
354 { ZBEE_ZDP_RSP_MGMT_DIRECT_JOIN, "Direct Join Response" },
355 { ZBEE_ZDP_RSP_MGMT_PERMIT_JOIN, "Permit Join Response" },
356 { ZBEE_ZDP_RSP_MGMT_CACHE, "Cache Response" },
357 { ZBEE_ZDP_NOT_MGMT_NWKUPDATE, "Network Update Notify" },
358 { ZBEE_ZDP_NOT_MGMT_NWKUPDATE_ENH, "Network Enhanced Update Notify" },
359 { ZBEE_ZDP_RSP_MGMT_IEEE_JOIN_LIST, "IEEE Joining List Response" },
360 { ZBEE_ZDP_NOT_MGMT_UNSOLICITED_NWKUPDATE, "Unsolicited Enhanced Network Update Notify" },
361 { ZBEE_ZDP_RSP_MGMT_NWK_BEACON_SURVEY, "Beacon Survey Response"},
362 { ZBEE_ZDP_RSP_SECURITY_START_KEY_NEGOTIATION,"Security Start Key Negotiation Response" },
363 { ZBEE_ZDP_RSP_SECURITY_GET_AUTH_TOKEN, "Security Get Authentication Token Response"},
364 { ZBEE_ZDP_RSP_SECURITY_GET_AUTH_LEVEL, "Security Get Authentication Level Response"},
365 { ZBEE_ZDP_RSP_SECURITY_SET_CONFIGURATION, "Security Set Configuration Response"},
366 { ZBEE_ZDP_RSP_SECURITY_GET_CONFIGURATION, "Security Get Configuration Response"},
367 { ZBEE_ZDP_RSP_SECURITY_START_KEY_UPDATE, "Security Start Key Update Response"},
368 { ZBEE_ZDP_RSP_SECURITY_DECOMMISSION, "Security Decommission Response"},
369 { ZBEE_ZDP_RSP_SECURITY_CHALLENGE, "Security Challenge Response"},
370 { 0, NULL }
373 static const value_string zbee_zdp_status_names[] = {
374 { ZBEE_ZDP_STATUS_SUCCESS, "Success" },
375 { ZBEE_ZDP_STATUS_INV_REQUESTTYPE, "Invalid Request Type" },
376 { ZBEE_ZDP_STATUS_DEVICE_NOT_FOUND, "Device Not Found" },
377 { ZBEE_ZDP_STATUS_INVALID_EP, "Invalid Endpoint" },
378 { ZBEE_ZDP_STATUS_NOT_ACTIVE, "Not Active" },
379 { ZBEE_ZDP_STATUS_NOT_SUPPORTED, "Not Supported" },
380 { ZBEE_ZDP_STATUS_TIMEOUT, "Timeout" },
381 { ZBEE_ZDP_STATUS_NO_MATCH, "No Match" },
382 { ZBEE_ZDP_STATUS_NO_ENTRY, "No Entry" },
383 { ZBEE_ZDP_STATUS_NO_DESCRIPTOR, "No Descriptor" },
384 { ZBEE_ZDP_STATUS_INSUFFICIENT_SPACE, "Insufficient Space" },
385 { ZBEE_ZDP_STATUS_NOT_PERMITTED, "Not Permitted" },
386 { ZBEE_ZDP_STATUS_TABLE_FULL, "Table Full" },
387 { ZBEE_ZDP_STATUS_NOT_AUTHORIZED, "Not Authorized" },
388 { ZBEE_ZDP_STATUS_DEVICE_BINDING_TABLE_FULL, "Device Binding Table Full" },
389 { ZBEE_ZDP_STATUS_INVALID_INDEX, "Invalid Index" },
390 { ZBEE_ZDP_STATUS_RESPONSE_TOO_LARGE, "Response Too Large" },
391 { ZBEE_ZDP_STATUS_MISSING_TLV, "Missing TLV" },
392 { 0, NULL }
395 static const value_string zbee_zll_device_names[] = {
396 { ZBEE_ZLL_DEVICE_ON_OFF_LIGHT, "On/Off light" },
397 { ZBEE_ZLL_DEVICE_ON_OFF_PLUG_IN_UNIT, "On/Off plug-in unit" },
398 { ZBEE_ZLL_DEVICE_DIMMABLE_LIGHT, "Dimmable light" },
399 { ZBEE_ZLL_DEVICE_DIMMABLE_PLUG_IN_UNIT, "Dimmable plug-in unit" },
400 { ZBEE_ZLL_DEVICE_COLOR_LIGHT, "Color light" },
401 { ZBEE_ZLL_DEVICE_EXTENDED_COLOR_LIGHT, "Extended color light" },
402 { ZBEE_ZLL_DEVICE_COLOR_TEMPERATURE_LIGHT, "Color temperature light" },
403 { ZBEE_ZLL_DEVICE_COLOR_CONTROLLER, "Color controller" },
404 { ZBEE_ZLL_DEVICE_COLOR_SCENE_CONTROLLER, "Color scene controller" },
405 { ZBEE_ZLL_DEVICE_NON_COLOR_CONTROLLER, "Non-color controller" },
406 { ZBEE_ZLL_DEVICE_NON_COLOR_SCENE_CONTROLLER, "Non-color scene controller" },
407 { ZBEE_ZLL_DEVICE_CONTROL_BRIDGE, "Control Bridge" },
408 { ZBEE_ZLL_DEVICE_ON_OFF_SENSOR, "On/Off sensor" },
409 { 0, NULL }
412 static const value_string zbee_ha_device_names[] = {
413 { ZBEE_HA_DEVICE_ON_OFF_LIGHT, "On/Off light" },
414 { ZBEE_HA_DEVICE_DIMMABLE_LIGHT, "Dimmable light" },
415 { ZBEE_HA_DEVICE_COLOR_DIMMABLE_LIGHT, "Color dimmable light" },
416 { ZBEE_HA_DEVICE_ON_OFF_LIGHT_SWITCH, "On/Off light switch" },
417 { ZBEE_HA_DEVICE_DIMMER_SWITCH, "Dimmer switch" },
418 { ZBEE_HA_DEVICE_COLOR_DIMMER_SWITCH, "Color dimmer switch" },
419 { ZBEE_HA_DEVICE_LIGHT_SENSOR, "Light sensor" },
420 { ZBEE_HA_DEVICE_OCCUPANCY_SENSOR, "Occupancy sensor" },
421 { ZBEE_HA_DEVICE_ON_OFF_BALLAST, "On/Off ballast" },
422 { ZBEE_HA_DEVICE_DIMMABLE_BALLAST, "Dimmable ballast" },
423 { ZBEE_HA_DEVICE_ON_OFF_PLUG_IN_UNIT, "On/Off plug-in unit" },
424 { ZBEE_HA_DEVICE_DIMMABLE_PLUG_IN_UNIT, "Dimmable plug-in unit" },
425 { ZBEE_HA_DEVICE_COLOR_TEMPERATURE_LIGHT, "Color temperature light" },
426 { ZBEE_HA_DEVICE_EXTENDED_COLOR_LIGHT, "Extended color light" },
427 { ZBEE_HA_DEVICE_LIGHT_LEVEL_SENSOR, "Light level sensor" },
428 { ZBEE_HA_DEVICE_COLOR_CONTROLLER, "Color controller" },
429 { ZBEE_HA_DEVICE_COLOR_SCENE_CONTROLLER, "Color scene controller" },
430 { ZBEE_HA_DEVICE_NON_COLOR_CONTROLLER, "Non-color controller" },
431 { ZBEE_HA_DEVICE_NON_COLOR_SCENE_CONTROLLER, "Non-color scene controller" },
432 { ZBEE_HA_DEVICE_CONTROL_BRIDGE, "Control Bridge" },
433 { ZBEE_HA_DEVICE_ON_OFF_SENSOR, "On/Off sensor" },
434 { 0, NULL }
437 const value_string zbee_zdp_rtg_status_vals[] = {
438 { 0x00, "Active" },
439 { 0x01, "Discovery Underway" },
440 { 0x02, "Discovery Failed" },
441 { 0x03, "Inactive" },
442 { 0, NULL }
445 static const value_string zbee_zdp_ieee_join_policy_vals[] = {
446 { 0x00, "All Join" },
447 { 0x01, "IEEE Join" },
448 { 0x02, "No Join" },
449 { 0, NULL }
452 /* The reason this has it's own value_string and doesn't use
453 tfs_get_string(), is that some hf_ fields use bitmasks larger
454 than 0x01, and it's intentional that those other values be
455 "Unknown" (which is what value_string will give us)
457 static const value_string zbee_zdp_true_false_plus_vals[] = {
458 { 0x00, "False" },
459 { 0x01, "True" },
460 { 0, NULL }
463 static const value_string zbee_zdp_table_entry_type_vals[] = {
464 { 0x00, "Coordinator" },
465 { 0x01, "Router" },
466 { 0x02, "End Device" },
467 { 0, NULL }
470 static const value_string zbee_zdp_relationship_vals[] = {
471 { 0x00, "Parent" },
472 { 0x01, "Child" },
473 { 0x02, "Sibling" },
474 { 0x03, "None" },
475 { 0x04, "Previous Child" },
476 { 0, NULL }
479 static const range_string zbee_zcl_zdp_address_modes[] = {
480 { 0x0, 0x0, "Reserved" },
481 { ZBEE_ZDP_ADDR_MODE_GROUP, ZBEE_ZDP_ADDR_MODE_GROUP, "Group" },
482 { 0x02, 0x02, "Reserved" },
483 { ZBEE_ZDP_ADDR_MODE_UNICAST, ZBEE_ZDP_ADDR_MODE_UNICAST, "Unicast" },
484 { 0x03, 0xFF, "Reserved" },
485 { 0, 0, NULL }
489 if (tree) {
490 if (type == 0x00) proto_item_append_text(ti, ", Type: Coordinator");
491 else if (type == 0x01) proto_item_append_text(ti, ", Type: Router");
492 else if (type == 0x02) proto_item_append_text(ti, ", Type: End Device");
493 else proto_item_append_text(ti, ", Type: Unknown");
495 if (idle_rx == 0x00) proto_item_append_text(ti, ", Idle Rx: False");
496 else if (idle_rx==0x01) proto_item_append_text(ti, ", Idle Rx: True");
497 else proto_item_append_text(ti, ", Idle Rx: Unknown");
499 if (rel == 0x00) proto_item_append_text(ti, ", Relationship: Parent");
500 else if (rel == 0x01) proto_item_append_text(ti, ", Relationship: Child");
501 else if (rel == 0x02) proto_item_append_text(ti, ", Relationship: Sibling");
502 else if (rel == 0x03) proto_item_append_text(ti, ", Relationship: None");
503 else if (rel == 0x04) proto_item_append_text(ti, ", Relationship: Previous Child");
504 else proto_item_append_text(ti, ", Relationship: Unknown");
509 *Returns a status name for a given status value.
512 const char *
513 zdp_status_name(uint8_t status)
515 return val_to_str_const(status, zbee_zdp_status_names, "Reserved");
516 } /* zdp_status_name */
519 *Converts a ZigBee 2003 & earlier cluster ID to a 2006
522 static uint16_t
523 zdp_convert_2003cluster(uint8_t cluster)
525 uint16_t cluster16 = (uint16_t)cluster;
527 if (cluster16 & ZBEE_ZDP_MSG_RESPONSE_BIT_2003) {
528 /* Clear the 2003 request bit. */
529 cluster16 &= ~(ZBEE_ZDP_MSG_RESPONSE_BIT_2003);
530 /* Set the 2006 request bit. */
531 cluster16 |= (ZBEE_ZDP_MSG_RESPONSE_BIT);
533 return cluster16;
534 } /* zdp_convert_2003cluster */
537 *Helper functions dumps any excess data into the data dissector.
539 *@param tvb pointer to buffer containing raw packet.
540 *@param offset offset after parsing last item.
541 *@param pinfo packet information structure.
542 *@param tree pointer to data tree Wireshark uses to display packet.
544 void
545 zdp_dump_excess(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree)
547 proto_tree *root = proto_tree_get_root(tree);
548 unsigned length = tvb_captured_length_remaining(tvb, offset);
549 tvbuff_t *excess;
551 if (length > 0) {
552 excess = tvb_new_subset_remaining(tvb, offset);
553 call_data_dissector(excess, pinfo, root);
555 } /* zdp_dump_excess */
558 *ZigBee helper function. Appends the info to the info column
560 *@param item item to display info on.
561 *@param pinfo packet info struct.
562 *@param format format string.
564 void
565 zbee_append_info(proto_item *item, packet_info *pinfo, const char *format, ...)
567 static char buffer[512];
568 va_list ap;
570 va_start(ap, format);
571 vsnprintf(buffer, 512, format, ap);
572 va_end(ap);
574 proto_item_append_text(item, "%s", buffer);
576 col_append_str(pinfo->cinfo, COL_INFO, buffer);
577 } /* zbee_add_info */
580 *ZigBee helper function. extracts an EUI64 address and displays
582 *@param tree pointer to data tree Wireshark uses to display packet.
583 *@param hfindex index to field information.
584 *@param tvb pointer to buffer containing raw packet.
585 *@param offset pointer to value of offset.
586 *@param length length of the value to extract.
587 *@param ti optional pointer to get the created proto item.
588 *@return the value read out of the tvbuff and added to the tree.
590 uint64_t
591 zbee_parse_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, unsigned *offset, unsigned length, proto_item **ti)
593 proto_item *item = NULL;
594 uint64_t value;
596 /* Get the value. */
597 value = tvb_get_letoh64(tvb, *offset);
599 /* Display it. */
600 item = proto_tree_add_eui64(tree, hfindex, tvb, *offset, length, value);
602 /* Increment the offset. */
603 *offset += (int)sizeof(uint64_t);
605 /* return the item if requested. */
606 if (ti) *ti = item;
608 /* return the value. */
609 return value;
610 } /* zbee_parse_eui64 */
613 *Parses and displays the status value.
615 *@param tree pointer to data tree Wireshark uses to display packet.
616 *@param tvb pointer to buffer containing raw packet.
617 *@param offset offset into the tvb to find the status value.
619 uint8_t
620 zdp_parse_status(proto_tree *tree, tvbuff_t *tvb, unsigned *offset)
622 uint8_t status;
624 /* Get and display the flags. */
625 status = tvb_get_uint8(tvb, *offset);
626 proto_tree_add_uint(tree, hf_zbee_zdp_status, tvb, *offset, (int)sizeof(uint8_t), status);
628 *offset += (int)sizeof(uint8_t);
630 return status;
631 } /* zdp_parse_status */
635 *Parses and displays the a channel mask.
637 *@param tree pointer to data tree Wireshark uses to display packet.
638 *@param tvb pointer to buffer containing raw packet.
639 *@param offset offset into the tvb to find the status value.
641 uint32_t
642 zdp_parse_chanmask(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, int hf_page, int hf_channel)
644 int i;
645 uint32_t mask;
646 uint8_t page;
647 proto_item *ti;
649 /* Get and display the channel mask. */
650 mask = tvb_get_letohl(tvb, *offset);
652 page = (uint8_t)((mask & ZBEE_ZDP_NWKUPDATE_PAGE) >> 27);
653 mask &= ZBEE_ZDP_NWKUPDATE_CHANNEL;
655 proto_tree_add_uint(tree, hf_page, tvb, *offset, 4, page);
656 ti = proto_tree_add_uint_format(tree, hf_channel, tvb, *offset, 4, mask, "Channels: ");
658 /* Check if there are any channels to display. */
659 if (mask==0) {
660 proto_item_append_text(ti, "None");
662 /* Display the first channel #. */
663 for (i=0; i<32; i++) {
664 if ((1<<i) & mask) {
665 proto_item_append_text(ti, "%d", i++);
666 break;
668 } /* for */
669 /* Display the rest of the channels. */
670 for (;i<32; i++) {
671 if (!((1<<i) & mask)) {
672 /* This channel isn't selected. */
673 continue;
675 /* If the previous channel wasn't selected, then display the
676 * channel number.
678 if ( ! ((1<<(i-1)) & mask) ) {
679 proto_item_append_text(ti, ", %d", i);
682 * If the next channel is selected too, skip past it and display
683 * a range of values instead.
685 if ((2<<i) & mask) {
686 while ((2<<i) & mask) i++;
687 proto_item_append_text(ti, "-%d", i);
689 } /* for */
691 *offset += (int)sizeof(uint32_t);
693 return mask;
694 } /* zdp_parse_chanmask */
697 *Parses and displays MAC capability info flags.
699 *@param tree pointer to data tree Wireshark uses to display packet.
700 *@param ettindex subtree index to create the node descriptor in, or -1
701 *@param tvb pointer to buffer containing raw packet.
702 *@param offset offset into the tvb to find the node descriptor.
704 uint8_t
705 zdp_parse_cinfo(proto_tree *tree, int ettindex, tvbuff_t *tvb, unsigned *offset)
707 uint8_t flags;
708 static int * const cinfo[] = {
709 &hf_zbee_zdp_cinfo_alt_coord,
710 &hf_zbee_zdp_cinfo_ffd,
711 &hf_zbee_zdp_cinfo_power,
712 &hf_zbee_zdp_cinfo_idle_rx,
713 &hf_zbee_zdp_cinfo_security,
714 &hf_zbee_zdp_cinfo_alloc,
715 NULL
718 /* Get and display the flags. */
719 proto_tree_add_bitmask_with_flags(tree, tvb, *offset, hf_zbee_zdp_cinfo, ettindex, cinfo, ENC_NA, BMT_NO_APPEND);
720 flags = tvb_get_uint8(tvb, *offset);
721 *offset += 1;
723 return flags;
724 } /* zdp_parse_cinfo */
727 *Parses and displays server mode flags.
729 *@param tree pointer to data tree Wireshark uses to display packet.
730 *@param ettindex subtree index to create the node descriptor in, or -1
731 *@param tvb pointer to buffer containing raw packet.
732 *@param offset offset into the tvb to find the node descriptor.
734 uint16_t
735 zdp_parse_server_flags(proto_tree *tree, int ettindex, tvbuff_t *tvb, unsigned *offset)
737 uint16_t flags;
738 static int * const server_flags[] = {
739 &hf_zbee_zdp_server_pri_trust,
740 &hf_zbee_zdp_server_bak_trust,
741 &hf_zbee_zdp_server_pri_bind,
742 &hf_zbee_zdp_server_bak_bind,
743 &hf_zbee_zdp_server_pri_disc,
744 &hf_zbee_zdp_server_bak_disc,
745 &hf_zbee_zdp_server_network_manager,
746 &hf_zbee_zdp_server_stk_compl_rev,
747 NULL
750 /* Get and display the flags. */
751 flags = tvb_get_letohs(tvb, *offset);
752 proto_tree_add_bitmask_with_flags(tree, tvb, *offset, hf_zbee_zdp_server, ettindex, server_flags, ENC_LITTLE_ENDIAN, BMT_NO_APPEND);
753 *offset += 2;
755 return flags;
756 } /* zdp_parse_server_flags */
759 *Parses and displays a node descriptor to the specified
761 *@param tree pointer to data tree Wireshark uses to display packet.
762 *@param ettindex subtree index to create the node descriptor in, or -1
763 *@param tvb pointer to buffer containing raw packet.
764 *@param offset offset into the tvb to find the node descriptor.
766 void
767 zdp_parse_node_desc(proto_tree *tree, packet_info *pinfo, bool show_ver_flags, int ettindex, tvbuff_t *tvb, unsigned *offset, uint8_t version)
769 proto_item *ti;
770 proto_item *field_root = NULL;
771 proto_tree *field_tree = NULL;
773 uint16_t flags;
774 /*uint8_t capability;*/
775 /*uint16_t mfr_code;*/
776 /*uint8_t max_buff;*/
777 /*uint16_t max_transfer;*/
778 static int * const nodes[] = {
779 &hf_zbee_zdp_node_complex,
780 &hf_zbee_zdp_node_user,
781 &hf_zbee_zdp_node_frag_support,
782 &hf_zbee_zdp_node_freq_868,
783 &hf_zbee_zdp_node_freq_900,
784 &hf_zbee_zdp_node_freq_2400,
785 &hf_zbee_zdp_node_freq_eu_sub_ghz,
786 NULL
789 if ((tree) && (ettindex != -1)) {
790 field_tree = proto_tree_add_subtree(tree, tvb, *offset, -1, ettindex, &field_root, "Node Descriptor");
792 else
793 field_tree = tree;
795 /* Get and display the flags. */
796 flags = tvb_get_letohs(tvb, *offset);
797 if (tree) {
798 uint16_t type = flags & ZBEE_ZDP_NODE_TYPE;
799 ti = proto_tree_add_uint(field_tree, hf_zbee_zdp_node_type, tvb, *offset, 2, type);
800 /* XXX - should probably be converted to proto_tree_add_bitmask */
801 proto_tree_add_bitmask_list(field_tree, tvb, *offset, 2, nodes, ENC_LITTLE_ENDIAN);
803 /* Enumerate the type field. */
804 if (type == ZBEE_ZDP_NODE_TYPE_COORD) proto_item_append_text(ti, " (Coordinator)");
805 else if (type == ZBEE_ZDP_NODE_TYPE_FFD) proto_item_append_text(ti, " (Router)");
806 else if (type == ZBEE_ZDP_NODE_TYPE_RFD) proto_item_append_text(ti, " (End Device)");
807 else proto_item_append_text(ti, " (Reserved)");
809 *offset += 2;
811 /* Get and display the capability flags. */
812 /*capability =*/ zdp_parse_cinfo(field_tree, ett_zbee_zdp_cinfo, tvb, offset);
813 proto_tree_add_item(field_tree, hf_zbee_zdp_node_manufacturer, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
814 *offset += 2;
815 proto_tree_add_item(field_tree, hf_zbee_zdp_node_max_buffer, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
816 *offset += 1;
817 proto_tree_add_item(field_tree, hf_zbee_zdp_node_max_incoming_transfer, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
818 *offset += 2;
820 /* Get and display the server flags. */
821 if (version >= ZBEE_VERSION_2007) {
822 uint16_t ver_flags;
823 static int * const descriptors[] = {
824 &hf_zbee_zdp_dcf_eaela,
825 &hf_zbee_zdp_dcf_esdla,
826 NULL
829 ver_flags = zdp_parse_server_flags(field_tree, ett_zbee_zdp_server, tvb, offset) & ZBEE_ZDP_NODE_SERVER_STACK_COMPL_REV;
830 if (show_ver_flags && ver_flags) {
831 zbee_append_info(tree, pinfo, ", Rev: %d",
832 (ver_flags >> ws_ctz(ZBEE_ZDP_NODE_SERVER_STACK_COMPL_REV)));
834 proto_tree_add_item(field_tree, hf_zbee_zdp_node_max_outgoing_transfer, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
835 *offset += 2;
836 proto_tree_add_bitmask_with_flags(field_tree, tvb, *offset, hf_zbee_zdp_dcf, ett_zbee_zdp_descriptor_capability_field, descriptors, ENC_NA, BMT_NO_APPEND);
837 *offset += 1;
840 /* Correct the length of the subtree. */
841 if (tree && (ettindex != -1)) {
842 proto_item_set_len(field_root, *offset);
845 } /* zdp_parse_node_desc */
848 static const value_string zbee_zdp_power_mode_vals[] = {
849 { ZBEE_ZDP_POWER_MODE_RX_ON, "Receiver Always On" },
850 { ZBEE_ZDP_POWER_MODE_RX_PERIODIC, "Receiver Periodically On" },
851 { ZBEE_ZDP_POWER_MODE_RX_STIMULATE, "Receiver On When Stimulated" },
853 { 0, NULL }
856 static const value_string zbee_zdp_power_level_vals[] = {
857 { ZBEE_ZDP_POWER_LEVEL_FULL, "Full" },
858 { ZBEE_ZDP_POWER_LEVEL_OK, "OK" },
859 { ZBEE_ZDP_POWER_LEVEL_LOW, "Low" },
860 { ZBEE_ZDP_POWER_LEVEL_CRITICAL, "Critical" },
862 { 0, NULL }
865 *Parses and displays a node descriptor to the specified
867 *@param tree pointer to data tree Wireshark uses to display packet.
868 *@param ettindex subtree index to create the node descriptor in, or -1
869 *@param tvb pointer to buffer containing raw packet.
870 *@param offset offset into the tvb to find the node descriptor.
872 void
873 zdp_parse_power_desc(proto_tree *tree, int ettindex, tvbuff_t *tvb, unsigned *offset)
875 static int * const power_desc[] = {
876 &hf_zbee_zdp_power_mode,
877 &hf_zbee_zdp_power_avail_ac,
878 &hf_zbee_zdp_power_avail_recharge,
879 &hf_zbee_zdp_power_avail_dispose,
880 &hf_zbee_zdp_power_source_ac,
881 &hf_zbee_zdp_power_source_recharge,
882 &hf_zbee_zdp_power_source_dispose,
883 &hf_zbee_zdp_power_level,
884 NULL
887 proto_tree_add_bitmask_with_flags(tree, tvb, *offset, hf_zbee_zdp_power, ettindex, power_desc, ENC_LITTLE_ENDIAN, BMT_NO_APPEND);
888 *offset += 2;
889 } /* zdp_parse_power_desc */
892 *Parses and displays a simple descriptor to the specified
894 *@param tree pointer to data tree Wireshark uses to display packet.
895 *@param ettindex subtree index to create the node descriptor in, or -1
896 *@param tvb pointer to buffer containing raw packet.
897 *@param offset offset into the tvb to find the node descriptor.
899 void
900 zdp_parse_simple_desc(proto_tree *tree, int ettindex, tvbuff_t *tvb, unsigned *offset, uint8_t version)
902 proto_item *field_root = NULL;
903 proto_tree *field_tree = NULL, *cluster_tree = NULL;
904 unsigned i, sizeof_cluster;
906 int hf_app_device;
907 uint32_t profile;
908 uint32_t in_count, out_count;
910 if ((tree) && (ettindex != -1)) {
911 field_tree = proto_tree_add_subtree(tree, tvb, *offset, -1, ettindex, &field_root, "Simple Descriptor");
913 else field_tree = tree;
915 proto_tree_add_item(field_tree, hf_zbee_zdp_endpoint, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
916 *offset += 1;
918 proto_tree_add_item_ret_uint(field_tree, hf_zbee_zdp_profile, tvb, *offset, 2, ENC_LITTLE_ENDIAN, &profile);
919 *offset += 2;
921 switch (profile)
923 case ZBEE_PROFILE_ZLL: hf_app_device = hf_zbee_zdp_simple_zll_app_device; break;
924 case ZBEE_PROFILE_HA: hf_app_device = hf_zbee_zdp_simple_ha_app_device; break;
925 default: hf_app_device = hf_zbee_zdp_simple_app_device; break;
927 proto_tree_add_item(field_tree, hf_app_device, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
928 *offset += 2;
930 proto_tree_add_item(field_tree, hf_zbee_zdp_simple_app_version, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
931 *offset += 1;
933 sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(uint16_t):(int)sizeof(uint8_t);
935 proto_tree_add_item_ret_uint(field_tree, hf_zbee_zdp_in_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &in_count);
936 *offset += 1;
938 if ((tree) && (in_count)) {
939 cluster_tree = proto_tree_add_subtree(field_tree, tvb, *offset, in_count*sizeof_cluster,
940 ett_zbee_zdp_node_in, NULL, "Input Cluster List");
942 for (i=0; i<in_count && tvb_bytes_exist(tvb, *offset, sizeof_cluster); i++) {
943 proto_tree_add_item(cluster_tree, hf_zbee_zdp_in_cluster, tvb, *offset, sizeof_cluster, ENC_LITTLE_ENDIAN);
944 *offset += sizeof_cluster;
947 proto_tree_add_item_ret_uint(field_tree, hf_zbee_zdp_out_count, tvb, *offset, 1, ENC_LITTLE_ENDIAN, &out_count);
948 *offset += 1;
949 if ((tree) && (out_count)) {
950 cluster_tree = proto_tree_add_subtree(field_tree, tvb, *offset, out_count*sizeof_cluster,
951 ett_zbee_zdp_node_out, NULL, "Output Cluster List");
953 for (i=0; (i<out_count) && tvb_bytes_exist(tvb, *offset, sizeof_cluster); i++) {
954 proto_tree_add_item(cluster_tree, hf_zbee_zdp_out_cluster, tvb, *offset, sizeof_cluster, ENC_LITTLE_ENDIAN);
955 *offset += sizeof_cluster;
958 if (tree && (ettindex != -1)) {
959 proto_item_set_len(field_root, *offset);
961 } /* zdp_parse_simple_desc */
964 *Parses and displays a simple descriptor to the specified
966 *@param tree pointer to data tree Wireshark uses to display packet.
967 *@param ettindex subtree index to create the node descriptor in, or -1
968 *@param tvb pointer to buffer containing raw packet.
969 *@param offset offset into the tvb to find the node descriptor.
970 *@param length length of the complex descriptor.
972 void
973 zdp_parse_complex_desc(packet_info *pinfo, proto_tree *tree, int ettindex, tvbuff_t *tvb, unsigned *offset, unsigned length)
975 enum {
976 tag_charset = 1,
977 tag_mfr_name = 2,
978 tag_model_name = 3,
979 tag_serial_no = 4,
980 tag_url = 5,
981 tag_icon = 6,
982 tag_icon_url = 7
985 static const char *tag_name[] = {
986 "Reserved Tag",
987 "languageChar",
988 "manufacturerName",
989 "modelName",
990 "serialNumber",
991 "deviceURL",
992 "icon",
993 "outliner"
996 proto_tree *field_tree;
998 char *complex;
999 uint8_t tag;
1001 if ((tree) && (ettindex != -1)) {
1002 field_tree = proto_tree_add_subtree(tree, tvb, *offset, length, ettindex, NULL, "Complex Descriptor");
1004 else
1005 field_tree = tree;
1007 tag = tvb_get_uint8(tvb, *offset);
1008 if (tag == tag_charset) {
1009 char *lang_str[2];
1010 uint8_t ch;
1011 uint8_t charset = tvb_get_uint8(tvb, *offset + 3);
1012 const char *charset_str;
1014 if (charset == 0x00) charset_str = "ASCII";
1015 else charset_str = "Unknown Character Set";
1017 ch = tvb_get_uint8(tvb, *offset + 1);
1018 lang_str[0] = format_char(pinfo->pool, ch);
1019 ch = tvb_get_uint8(tvb, *offset + 2);
1020 lang_str[1] = format_char(pinfo->pool, ch);
1022 complex = wmem_strdup_printf(pinfo->pool, "<%s>%s%s, %s</%s>", tag_name[tag_charset], lang_str[0], lang_str[1], charset_str, tag_name[tag_charset]);
1024 else if (tag == tag_icon) {
1025 /* TODO: */
1026 complex = wmem_strdup_printf(pinfo->pool, "<%s>FixMe</%s>", tag_name[tag_icon], tag_name[tag_icon]);
1028 else {
1029 char *str;
1031 str = (char *) tvb_get_string_enc(pinfo->pool, tvb, *offset+1, length-1, ENC_ASCII);
1032 /* Handles all string type XML tags. */
1033 if (tag <= tag_icon_url) {
1034 complex = wmem_strdup_printf(pinfo->pool, "<%s>%s</%s>", tag_name[tag], str, tag_name[tag]);
1036 else {
1037 complex = wmem_strdup_printf(pinfo->pool, "<%s>%s</%s>", tag_name[0], str, tag_name[0]);
1040 proto_tree_add_string(field_tree, hf_zbee_zdp_complex, tvb, *offset, length, complex);
1041 *offset += (length);
1042 } /* zdp_parse_complex_desc */
1045 *ZigBee Device Profile dissector for wireshark.
1047 *@param tvb pointer to buffer containing raw packet.
1048 *@param pinfo pointer to packet information fields
1049 *@param tree pointer to data tree Wireshark uses to display packet.
1051 static int
1052 dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1054 proto_tree *zdp_tree;
1055 proto_item *proto_root;
1056 tvbuff_t *zdp_tvb;
1058 uint8_t seqno;
1059 uint16_t cluster;
1060 unsigned offset = 0;
1061 zbee_nwk_packet *nwk;
1063 /* Reject the packet if data is NULL */
1064 if (data == NULL)
1065 return 0;
1066 nwk = (zbee_nwk_packet *)data;
1068 /* Create the protocol tree. */
1069 proto_root = proto_tree_add_protocol_format(tree, proto_zbee_zdp, tvb, offset, tvb_captured_length(tvb), "ZigBee Device Profile");
1070 zdp_tree = proto_item_add_subtree(proto_root, ett_zbee_zdp);
1072 #if 0
1073 /* Overwrite the protocol column */
1074 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZigBee ZDP");
1075 #endif
1076 /* Get and display the sequence number. */
1077 seqno = tvb_get_uint8(tvb, offset);
1078 proto_tree_add_uint(zdp_tree, hf_zbee_zdp_seqno, tvb, offset, (int)sizeof(uint8_t), seqno);
1080 offset += (int)sizeof(uint8_t);
1082 if (nwk->version <= ZBEE_VERSION_2004) {
1083 /* ZigBee 2004 and earlier had different cluster identifiers, need to convert
1084 * them into the ZigBee 2006 & later values. */
1085 cluster = zdp_convert_2003cluster((uint8_t)nwk->cluster_id);
1087 else {
1088 cluster = nwk->cluster_id;
1091 /* Update info. */
1092 proto_item_append_text(zdp_tree, ", %s", val_to_str_const(cluster, zbee_zdp_cluster_names, "Unknown Cluster"));
1093 col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(cluster, zbee_zdp_cluster_names, "Unknown Cluster"));
1095 /* Create a new tvb for the zdp message. */
1096 zdp_tvb = tvb_new_subset_remaining(tvb, offset);
1098 switch (cluster) {
1099 case ZBEE_ZDP_REQ_NWK_ADDR:
1100 dissect_zbee_zdp_req_nwk_addr(zdp_tvb, pinfo, zdp_tree);
1101 break;
1102 case ZBEE_ZDP_REQ_IEEE_ADDR:
1103 dissect_zbee_zdp_req_ext_addr(zdp_tvb, pinfo, zdp_tree);
1104 break;
1105 case ZBEE_ZDP_REQ_NODE_DESC:
1106 dissect_zbee_zdp_req_node_desc(zdp_tvb, pinfo, zdp_tree);
1107 break;
1108 case ZBEE_ZDP_REQ_POWER_DESC:
1109 dissect_zbee_zdp_req_power_desc(zdp_tvb, pinfo, zdp_tree);
1110 break;
1111 case ZBEE_ZDP_REQ_SIMPLE_DESC:
1112 dissect_zbee_zdp_req_simple_desc(zdp_tvb, pinfo, zdp_tree);
1113 break;
1114 case ZBEE_ZDP_REQ_ACTIVE_EP:
1115 dissect_zbee_zdp_req_active_ep(zdp_tvb, pinfo, zdp_tree);
1116 break;
1117 case ZBEE_ZDP_REQ_MATCH_DESC:
1118 dissect_zbee_zdp_req_match_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
1119 break;
1120 case ZBEE_ZDP_REQ_COMPLEX_DESC:
1121 dissect_zbee_zdp_req_complex_desc(zdp_tvb, pinfo, zdp_tree);
1122 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1123 break;
1124 case ZBEE_ZDP_REQ_USER_DESC:
1125 dissect_zbee_zdp_req_user_desc(zdp_tvb, pinfo, zdp_tree);
1126 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1127 break;
1128 case ZBEE_ZDP_REQ_DISCOVERY_CACHE:
1129 dissect_zbee_zdp_req_discovery_cache(zdp_tvb, pinfo, zdp_tree);
1130 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1131 break;
1132 case ZBEE_ZDP_REQ_DEVICE_ANNCE:
1133 dissect_zbee_zdp_device_annce(zdp_tvb, pinfo, zdp_tree);
1134 break;
1135 case ZBEE_ZDP_REQ_SET_USER_DESC:
1136 dissect_zbee_zdp_req_set_user_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
1137 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1138 break;
1139 case ZBEE_ZDP_REQ_SYSTEM_SERVER_DISC:
1140 dissect_zbee_zdp_req_system_server_disc(zdp_tvb, pinfo, zdp_tree);
1141 break;
1142 case ZBEE_ZDP_REQ_STORE_DISCOVERY:
1143 dissect_zbee_zdp_req_store_discovery(zdp_tvb, pinfo, zdp_tree);
1144 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1145 break;
1146 case ZBEE_ZDP_REQ_STORE_NODE_DESC:
1147 dissect_zbee_zdp_req_store_node_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
1148 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1149 break;
1150 case ZBEE_ZDP_REQ_STORE_POWER_DESC:
1151 dissect_zbee_zdp_req_store_power_desc(zdp_tvb, pinfo, zdp_tree);
1152 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1153 break;
1154 case ZBEE_ZDP_REQ_STORE_ACTIVE_EP:
1155 dissect_zbee_zdp_req_store_active_ep(zdp_tvb, pinfo, zdp_tree);
1156 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1157 break;
1158 case ZBEE_ZDP_REQ_STORE_SIMPLE_DESC:
1159 dissect_zbee_zdp_req_store_simple_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
1160 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1161 break;
1162 case ZBEE_ZDP_REQ_REMOVE_NODE_CACHE:
1163 dissect_zbee_zdp_req_remove_node_cache(zdp_tvb, pinfo, zdp_tree);
1164 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1165 break;
1166 case ZBEE_ZDP_REQ_FIND_NODE_CACHE:
1167 dissect_zbee_zdp_req_find_node_cache(zdp_tvb, pinfo, zdp_tree);
1168 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1169 break;
1170 case ZBEE_ZDP_REQ_EXT_SIMPLE_DESC:
1171 dissect_zbee_zdp_req_ext_simple_desc(zdp_tvb, pinfo, zdp_tree);
1172 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1173 break;
1174 case ZBEE_ZDP_REQ_EXT_ACTIVE_EP:
1175 dissect_zbee_zdp_req_ext_active_ep(zdp_tvb, pinfo, zdp_tree);
1176 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1177 break;
1178 case ZBEE_ZDP_REQ_PARENT_ANNCE:
1179 dissect_zbee_zdp_parent_annce(zdp_tvb, pinfo, zdp_tree);
1180 break;
1181 case ZBEE_ZDP_REQ_END_DEVICE_BIND:
1182 dissect_zbee_zdp_req_end_device_bind(zdp_tvb, pinfo, zdp_tree, nwk->version);
1183 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1184 break;
1185 case ZBEE_ZDP_REQ_BIND:
1186 dissect_zbee_zdp_req_bind(zdp_tvb, pinfo, zdp_tree, nwk->version);
1187 break;
1188 case ZBEE_ZDP_REQ_UNBIND:
1189 dissect_zbee_zdp_req_unbind(zdp_tvb, pinfo, zdp_tree, nwk->version);
1190 break;
1191 case ZBEE_ZDP_REQ_BIND_REGISTER:
1192 dissect_zbee_zdp_req_bind_register(zdp_tvb, pinfo, zdp_tree);
1193 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1194 break;
1195 case ZBEE_ZDP_REQ_REPLACE_DEVICE:
1196 dissect_zbee_zdp_req_replace_device(zdp_tvb, pinfo, zdp_tree);
1197 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1198 break;
1199 case ZBEE_ZDP_REQ_STORE_BAK_BIND_ENTRY:
1200 dissect_zbee_zdp_req_store_bak_bind_entry(zdp_tvb, pinfo, zdp_tree, nwk->version);
1201 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1202 break;
1203 case ZBEE_ZDP_REQ_REMOVE_BAK_BIND_ENTRY:
1204 dissect_zbee_zdp_req_remove_bak_bind_entry(zdp_tvb, pinfo, zdp_tree, nwk->version);
1205 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1206 break;
1207 case ZBEE_ZDP_REQ_BACKUP_BIND_TABLE:
1208 dissect_zbee_zdp_req_backup_bind_table(zdp_tvb, pinfo, zdp_tree, nwk->version);
1209 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1210 break;
1211 case ZBEE_ZDP_REQ_RECOVER_BIND_TABLE:
1212 dissect_zbee_zdp_req_recover_bind_table(zdp_tvb, pinfo, zdp_tree);
1213 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1214 break;
1215 case ZBEE_ZDP_REQ_BACKUP_SOURCE_BIND:
1216 dissect_zbee_zdp_req_backup_source_bind(zdp_tvb, pinfo, zdp_tree);
1217 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1218 break;
1219 case ZBEE_ZDP_REQ_RECOVER_SOURCE_BIND:
1220 dissect_zbee_zdp_req_recover_source_bind(zdp_tvb, pinfo, zdp_tree);
1221 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1222 break;
1223 case ZBEE_ZDP_REQ_CLEAR_ALL_BINDINGS:
1224 dissect_zbee_zdp_req_clear_all_bindings(zdp_tvb, pinfo, zdp_tree);
1225 break;
1226 case ZBEE_ZDP_REQ_MGMT_NWK_DISC:
1227 dissect_zbee_zdp_req_mgmt_nwk_disc(zdp_tvb, pinfo, zdp_tree, hf_zbee_zdp_scan_channel);
1228 break;
1229 case ZBEE_ZDP_REQ_MGMT_LQI:
1230 dissect_zbee_zdp_req_mgmt_lqi(zdp_tvb, pinfo, zdp_tree);
1231 break;
1232 case ZBEE_ZDP_REQ_MGMT_RTG:
1233 dissect_zbee_zdp_req_mgmt_rtg(zdp_tvb, pinfo, zdp_tree);
1234 break;
1235 case ZBEE_ZDP_REQ_MGMT_BIND:
1236 dissect_zbee_zdp_req_mgmt_bind(zdp_tvb, pinfo, zdp_tree);
1237 break;
1238 case ZBEE_ZDP_REQ_MGMT_LEAVE:
1239 dissect_zbee_zdp_req_mgmt_leave(zdp_tvb, pinfo, zdp_tree, nwk->version);
1240 break;
1241 case ZBEE_ZDP_REQ_MGMT_DIRECT_JOIN:
1242 dissect_zbee_zdp_req_mgmt_direct_join(zdp_tvb, pinfo, zdp_tree);
1243 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1244 break;
1245 case ZBEE_ZDP_REQ_MGMT_PERMIT_JOIN:
1246 dissect_zbee_zdp_req_mgmt_permit_join(zdp_tvb, pinfo, zdp_tree);
1247 break;
1248 case ZBEE_ZDP_REQ_MGMT_CACHE:
1249 dissect_zbee_zdp_req_mgmt_cache(zdp_tvb, pinfo, zdp_tree);
1250 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1251 break;
1252 case ZBEE_ZDP_REQ_MGMT_NWKUPDATE:
1253 dissect_zbee_zdp_req_mgmt_nwkupdate(zdp_tvb, pinfo, zdp_tree);
1254 break;
1255 case ZBEE_ZDP_REQ_MGMT_NWKUPDATE_ENH:
1256 dissect_zbee_zdp_req_mgmt_nwkupdate_enh(zdp_tvb, pinfo, zdp_tree);
1257 break;
1258 case ZBEE_ZDP_REQ_MGMT_IEEE_JOIN_LIST:
1259 dissect_zbee_zdp_req_mgmt_ieee_join_list(zdp_tvb, pinfo, zdp_tree);
1260 break;
1261 case ZBEE_ZDP_REQ_MGMT_NWK_BEACON_SURVEY:
1262 dissect_zbee_zdp_req_mgmt_nwk_beacon_survey(zdp_tvb, pinfo, zdp_tree);
1263 break;
1264 case ZBEE_ZDP_REQ_SECURITY_START_KEY_NEGOTIATION:
1265 dissect_zbee_zdp_req_security_start_key_negotiation(zdp_tvb, pinfo, zdp_tree);
1266 break;
1267 case ZBEE_ZDP_REQ_SECURITY_GET_AUTH_TOKEN:
1268 dissect_zbee_zdp_req_security_get_auth_token(zdp_tvb, pinfo, zdp_tree);
1269 break;
1270 case ZBEE_ZDP_REQ_SECURITY_GET_AUTH_LEVEL:
1271 dissect_zbee_zdp_req_security_get_auth_level(zdp_tvb, pinfo, zdp_tree);
1272 break;
1273 case ZBEE_ZDP_REQ_SECURITY_SET_CONFIGURATION:
1274 dissect_zbee_zdp_req_security_set_configuration(zdp_tvb, pinfo, zdp_tree);
1275 break;
1276 case ZBEE_ZDP_REQ_SECURITY_GET_CONFIGURATION:
1277 dissect_zbee_zdp_req_security_get_configuration(zdp_tvb, pinfo, zdp_tree);
1278 break;
1279 case ZBEE_ZDP_REQ_SECURITY_START_KEY_UPDATE:
1280 dissect_zbee_zdp_req_security_start_key_update(zdp_tvb, pinfo, zdp_tree);
1281 break;
1282 case ZBEE_ZDP_REQ_SECURITY_DECOMMISSION:
1283 dissect_zbee_zdp_req_security_decommission(zdp_tvb, pinfo, zdp_tree);
1284 break;
1285 case ZBEE_ZDP_REQ_SECURITY_CHALLENGE:
1286 dissect_zbee_zdp_req_security_challenge(zdp_tvb, pinfo, zdp_tree);
1287 break;
1288 case ZBEE_ZDP_RSP_NWK_ADDR:
1289 dissect_zbee_zdp_rsp_nwk_addr(zdp_tvb, pinfo, zdp_tree);
1290 break;
1291 case ZBEE_ZDP_RSP_IEEE_ADDR:
1292 dissect_zbee_zdp_rsp_ext_addr(zdp_tvb, pinfo, zdp_tree);
1293 break;
1294 case ZBEE_ZDP_RSP_NODE_DESC:
1295 dissect_zbee_zdp_rsp_node_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
1296 break;
1297 case ZBEE_ZDP_RSP_POWER_DESC:
1298 dissect_zbee_zdp_rsp_power_desc(zdp_tvb, pinfo, zdp_tree);
1299 break;
1300 case ZBEE_ZDP_RSP_SIMPLE_DESC:
1301 dissect_zbee_zdp_rsp_simple_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
1302 break;
1303 case ZBEE_ZDP_RSP_ACTIVE_EP:
1304 dissect_zbee_zdp_rsp_active_ep(zdp_tvb, pinfo, zdp_tree);
1305 break;
1306 case ZBEE_ZDP_RSP_MATCH_DESC:
1307 dissect_zbee_zdp_rsp_match_desc(zdp_tvb, pinfo, zdp_tree);
1308 break;
1309 case ZBEE_ZDP_RSP_COMPLEX_DESC:
1310 dissect_zbee_zdp_rsp_complex_desc(zdp_tvb, pinfo, zdp_tree);
1311 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1312 break;
1313 case ZBEE_ZDP_RSP_USER_DESC:
1314 dissect_zbee_zdp_rsp_user_desc(zdp_tvb, pinfo, zdp_tree, nwk->version);
1315 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1316 break;
1317 case ZBEE_ZDP_RSP_DISCOVERY_CACHE:
1318 dissect_zbee_zdp_rsp_discovery_cache(zdp_tvb, pinfo, zdp_tree);
1319 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1320 break;
1321 case ZBEE_ZDP_RSP_CONF_USER_DESC:
1322 dissect_zbee_zdp_rsp_user_desc_conf(zdp_tvb, pinfo, zdp_tree, nwk->version);
1323 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1324 break;
1325 case ZBEE_ZDP_RSP_SYSTEM_SERVER_DISC:
1326 dissect_zbee_zdp_rsp_system_server_disc(zdp_tvb, pinfo, zdp_tree);
1327 break;
1328 case ZBEE_ZDP_RSP_STORE_DISCOVERY:
1329 dissect_zbee_zdp_rsp_discovery_store(zdp_tvb, pinfo, zdp_tree);
1330 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1331 break;
1332 case ZBEE_ZDP_RSP_STORE_NODE_DESC:
1333 dissect_zbee_zdp_rsp_store_node_desc(zdp_tvb, pinfo, zdp_tree);
1334 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1335 break;
1336 case ZBEE_ZDP_RSP_STORE_POWER_DESC:
1337 dissect_zbee_zdp_rsp_store_power_desc(zdp_tvb, pinfo, zdp_tree);
1338 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1339 break;
1340 case ZBEE_ZDP_RSP_STORE_ACTIVE_EP:
1341 dissect_zbee_zdp_rsp_store_active_ep(zdp_tvb, pinfo, zdp_tree);
1342 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1343 break;
1344 case ZBEE_ZDP_RSP_STORE_SIMPLE_DESC:
1345 dissect_zbee_zdp_rsp_store_simple_desc(zdp_tvb, pinfo, zdp_tree);
1346 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1347 break;
1348 case ZBEE_ZDP_RSP_REMOVE_NODE_CACHE:
1349 dissect_zbee_zdp_rsp_remove_node_cache(zdp_tvb, pinfo, zdp_tree);
1350 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1351 break;
1352 case ZBEE_ZDP_RSP_FIND_NODE_CACHE:
1353 dissect_zbee_zdp_rsp_find_node_cache(zdp_tvb, pinfo, zdp_tree);
1354 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1355 break;
1356 case ZBEE_ZDP_RSP_EXT_SIMPLE_DESC:
1357 dissect_zbee_zdp_rsp_ext_simple_desc(zdp_tvb, pinfo, zdp_tree);
1358 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1359 break;
1360 case ZBEE_ZDP_RSP_EXT_ACTIVE_EP:
1361 dissect_zbee_zdp_rsp_ext_active_ep(zdp_tvb, pinfo, zdp_tree);
1362 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1363 break;
1364 case ZBEE_ZDP_RSP_PARENT_ANNCE:
1365 dissect_zbee_zdp_rsp_parent_annce(zdp_tvb, pinfo, zdp_tree);
1366 break;
1367 case ZBEE_ZDP_RSP_END_DEVICE_BIND:
1368 dissect_zbee_zdp_rsp_end_device_bind(zdp_tvb, pinfo, zdp_tree);
1369 break;
1370 case ZBEE_ZDP_RSP_BIND:
1371 dissect_zbee_zdp_rsp_bind(zdp_tvb, pinfo, zdp_tree);
1372 break;
1373 case ZBEE_ZDP_RSP_UNBIND:
1374 dissect_zbee_zdp_rsp_unbind(zdp_tvb, pinfo, zdp_tree);
1375 break;
1376 case ZBEE_ZDP_RSP_BIND_REGISTER:
1377 dissect_zbee_zdp_rsp_bind_register(zdp_tvb, pinfo, zdp_tree, nwk->version);
1378 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1379 break;
1380 case ZBEE_ZDP_RSP_REPLACE_DEVICE:
1381 dissect_zbee_zdp_rsp_replace_device(zdp_tvb, pinfo, zdp_tree);
1382 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1383 break;
1384 case ZBEE_ZDP_RSP_STORE_BAK_BIND_ENTRY:
1385 dissect_zbee_zdp_rsp_store_bak_bind_entry(zdp_tvb, pinfo, zdp_tree);
1386 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1387 break;
1388 case ZBEE_ZDP_RSP_REMOVE_BAK_BIND_ENTRY:
1389 dissect_zbee_zdp_rsp_remove_bak_bind_entry(zdp_tvb, pinfo, zdp_tree);
1390 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1391 break;
1392 case ZBEE_ZDP_RSP_BACKUP_BIND_TABLE:
1393 dissect_zbee_zdp_rsp_backup_bind_table(zdp_tvb, pinfo, zdp_tree);
1394 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1395 break;
1396 case ZBEE_ZDP_RSP_RECOVER_BIND_TABLE:
1397 dissect_zbee_zdp_rsp_recover_bind_table(zdp_tvb, pinfo, zdp_tree, nwk->version);
1398 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1399 break;
1400 case ZBEE_ZDP_RSP_BACKUP_SOURCE_BIND:
1401 dissect_zbee_zdp_rsp_backup_source_bind(zdp_tvb, pinfo, zdp_tree);
1402 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1403 break;
1404 case ZBEE_ZDP_RSP_RECOVER_SOURCE_BIND:
1405 dissect_zbee_zdp_rsp_recover_source_bind(zdp_tvb, pinfo, zdp_tree);
1406 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1407 break;
1408 case ZBEE_ZDP_RSP_CLEAR_ALL_BINDINGS:
1409 dissect_zbee_zdp_rsp_clear_all_bindings(zdp_tvb, pinfo, zdp_tree);
1410 break;
1411 case ZBEE_ZDP_RSP_MGMT_NWK_DISC:
1412 dissect_zbee_zdp_rsp_mgmt_nwk_disc(zdp_tvb, pinfo, zdp_tree, nwk->version);
1413 break;
1414 case ZBEE_ZDP_RSP_MGMT_LQI:
1415 dissect_zbee_zdp_rsp_mgmt_lqi(zdp_tvb, pinfo, zdp_tree, nwk->version);
1416 break;
1417 case ZBEE_ZDP_RSP_MGMT_RTG:
1418 dissect_zbee_zdp_rsp_mgmt_rtg(zdp_tvb, pinfo, zdp_tree);
1419 break;
1420 case ZBEE_ZDP_RSP_MGMT_BIND:
1421 dissect_zbee_zdp_rsp_mgmt_bind(zdp_tvb, pinfo, zdp_tree, nwk->version);
1422 break;
1423 case ZBEE_ZDP_RSP_MGMT_LEAVE:
1424 dissect_zbee_zdp_rsp_mgmt_leave(zdp_tvb, pinfo, zdp_tree);
1425 break;
1426 case ZBEE_ZDP_RSP_MGMT_DIRECT_JOIN:
1427 dissect_zbee_zdp_rsp_mgmt_direct_join(zdp_tvb, pinfo, zdp_tree);
1428 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1429 break;
1430 case ZBEE_ZDP_RSP_MGMT_PERMIT_JOIN:
1431 dissect_zbee_zdp_rsp_mgmt_permit_join(zdp_tvb, pinfo, zdp_tree);
1432 break;
1433 case ZBEE_ZDP_RSP_MGMT_CACHE:
1434 dissect_zbee_zdp_rsp_mgmt_cache(zdp_tvb, pinfo, zdp_tree);
1435 expert_add_info(pinfo, zdp_tree, &ei_deprecated_command);
1436 break;
1437 case ZBEE_ZDP_NOT_MGMT_NWKUPDATE:
1438 case ZBEE_ZDP_NOT_MGMT_NWKUPDATE_ENH:
1439 dissect_zbee_zdp_not_mgmt_nwkupdate(zdp_tvb, pinfo, zdp_tree);
1440 break;
1441 case ZBEE_ZDP_RSP_MGMT_IEEE_JOIN_LIST:
1442 dissect_zbee_zdp_rsp_mgmt_ieee_join_list(zdp_tvb, pinfo, zdp_tree);
1443 break;
1444 case ZBEE_ZDP_NOT_MGMT_UNSOLICITED_NWKUPDATE:
1445 dissect_zbee_zdp_not_mgmt_unsolicited_nwkupdate(zdp_tvb, pinfo, zdp_tree);
1446 break;
1447 case ZBEE_ZDP_RSP_MGMT_NWK_BEACON_SURVEY:
1448 dissect_zbee_zdp_rsp_mgmt_nwk_beacon_survey(zdp_tvb, pinfo, zdp_tree);
1449 break;
1450 case ZBEE_ZDP_RSP_SECURITY_START_KEY_NEGOTIATION:
1451 dissect_zbee_zdp_rsp_security_start_key_negotiation(zdp_tvb, pinfo, zdp_tree);
1452 break;
1453 case ZBEE_ZDP_RSP_SECURITY_GET_AUTH_TOKEN:
1454 dissect_zbee_zdp_rsp_security_get_auth_token(zdp_tvb, pinfo, zdp_tree);
1455 break;
1456 case ZBEE_ZDP_RSP_SECURITY_GET_AUTH_LEVEL:
1457 dissect_zbee_zdp_rsp_security_get_auth_level(zdp_tvb, pinfo, zdp_tree);
1458 break;
1459 case ZBEE_ZDP_RSP_SECURITY_SET_CONFIGURATION:
1460 dissect_zbee_zdp_rsp_security_set_configuration(zdp_tvb, pinfo, zdp_tree);
1461 break;
1462 case ZBEE_ZDP_RSP_SECURITY_GET_CONFIGURATION:
1463 dissect_zbee_zdp_rsp_security_get_configuration(zdp_tvb, pinfo, zdp_tree);
1464 break;
1465 case ZBEE_ZDP_RSP_SECURITY_START_KEY_UPDATE:
1466 dissect_zbee_zdp_rsp_security_start_key_update(zdp_tvb, pinfo, zdp_tree);
1467 break;
1468 case ZBEE_ZDP_RSP_SECURITY_DECOMMISSION:
1469 dissect_zbee_zdp_rsp_security_decommission(zdp_tvb, pinfo, zdp_tree);
1470 break;
1471 case ZBEE_ZDP_RSP_SECURITY_CHALLENGE:
1472 dissect_zbee_zdp_rsp_security_challenge(zdp_tvb, pinfo, zdp_tree);
1473 break;
1474 default:
1475 /* Invalid Cluster Identifier. */
1476 call_data_dissector(zdp_tvb, pinfo, tree);
1477 break;
1478 } /* switch */
1480 return tvb_captured_length(tvb);
1481 } /* dissect_zbee_zdp */
1484 *ZigBee Device Profile protocol registration routine.
1487 void proto_register_zbee_zdp(void)
1489 static hf_register_info hf[] = {
1490 { &hf_zbee_zdp_seqno,
1491 { "Sequence Number", "zbee_zdp.seqno", FT_UINT8, BASE_DEC, NULL, 0x0,
1492 NULL, HFILL }},
1494 #if 0
1495 { &hf_zbee_zdp_length,
1496 { "Length", "zbee_zdp.length", FT_UINT8, BASE_DEC, NULL, 0x0,
1497 NULL, HFILL }},
1498 #endif
1500 { &hf_zbee_zdp_ext_addr,
1501 { "Extended Address", "zbee_zdp.ext_addr", FT_EUI64, BASE_NONE, NULL, 0x0,
1502 NULL, HFILL }},
1504 { &hf_zbee_zdp_nwk_addr,
1505 { "Nwk Addr of Interest", "zbee_zdp.nwk_addr", FT_UINT16, BASE_HEX, NULL, 0x0,
1506 NULL, HFILL }},
1508 { &hf_zbee_zdp_req_type,
1509 { "Request Type", "zbee_zdp.req_type", FT_UINT8, BASE_DEC, VALS(zbee_zdp_req_types), 0x0,
1510 NULL, HFILL }},
1512 { &hf_zbee_zdp_index,
1513 { "Index", "zbee_zdp.index", FT_UINT8, BASE_DEC, NULL, 0x0,
1514 NULL, HFILL }},
1516 { &hf_zbee_zdp_status,
1517 { "Status", "zbee_zdp.status", FT_UINT8, BASE_HEX, VALS(zbee_zdp_status_names), 0x0,
1518 NULL, HFILL }},
1520 { &hf_zbee_zdp_endpoint,
1521 { "Endpoint", "zbee_zdp.endpoint", FT_UINT8, BASE_DEC, NULL, 0x0,
1522 NULL, HFILL }},
1524 { &hf_zbee_zdp_ep_count,
1525 { "Endpoint Count", "zbee_zdp.ep_count", FT_UINT8, BASE_DEC, NULL, 0x0,
1526 NULL, HFILL }},
1528 { &hf_zbee_zdp_profile,
1529 { "Profile", "zbee_zdp.profile", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_apid_names), 0x0,
1530 NULL, HFILL }},
1532 { &hf_zbee_zdp_addr_mode,
1533 { "Address Mode", "zbee_zdp.addr_mode", FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(zbee_zcl_zdp_address_modes), 0x0,
1534 NULL, HFILL }},
1536 { &hf_zbee_zdp_cluster,
1537 { "Cluster", "zbee_zdp.cluster", FT_UINT16, BASE_HEX, NULL, 0x0,
1538 NULL, HFILL }},
1540 { &hf_zbee_zdp_table_size,
1541 { "Table Size", "zbee_zdp.table_size", FT_UINT16, BASE_DEC, NULL, 0x0,
1542 "Number of entries in the table.", HFILL }},
1544 { &hf_zbee_zdp_table_count,
1545 { "Table Count", "zbee_zdp.table_count", FT_UINT16, BASE_DEC, NULL, 0x0,
1546 "Number of table entries included in this message.", HFILL }},
1548 { &hf_zbee_zdp_cache_address,
1549 { "Cache Address", "zbee_zdp.cache_address", FT_EUI64, BASE_NONE, NULL, 0x0,
1550 NULL, HFILL }},
1552 { &hf_zbee_zdp_in_count,
1553 { "Input Cluster Count", "zbee_zdp.in_count", FT_UINT8, BASE_DEC, NULL, 0x0,
1554 NULL, HFILL }},
1556 { &hf_zbee_zdp_out_count,
1557 { "Output Cluster Count", "zbee_zdp.out_count", FT_UINT8, BASE_DEC, NULL, 0x0,
1558 NULL, HFILL }},
1560 { &hf_zbee_zdp_in_cluster,
1561 { "Input Cluster", "zbee_zdp.in_cluster", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_cid_names), 0x0,
1562 NULL, HFILL }},
1564 { &hf_zbee_zdp_out_cluster,
1565 { "Output Cluster", "zbee_zdp.out_cluster", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_aps_cid_names), 0x0,
1566 NULL, HFILL }},
1568 { &hf_zbee_zdp_assoc_device_count,
1569 { "Associated Device Count", "zbee_zdp.assoc_device_count", FT_UINT8, BASE_DEC, NULL, 0x0,
1570 NULL, HFILL }},
1572 { &hf_zbee_zdp_assoc_device,
1573 { "Associated Device", "zbee_zdp.assoc_device", FT_UINT16, BASE_HEX, NULL, 0x0,
1574 NULL, HFILL }},
1576 { &hf_zbee_zdp_cinfo,
1577 { "Capability Information", "zbee_zdp.cinfo", FT_UINT8, BASE_HEX, NULL, 0x0,
1578 NULL, HFILL }},
1580 { &hf_zbee_zdp_cinfo_alt_coord,
1581 { "Alternate Coordinator", "zbee_zdp.cinfo.alt_coord", FT_BOOLEAN, 8, NULL, ZBEE_CINFO_ALT_COORD,
1582 "Indicates that the device is able to operate as a PAN coordinator.", HFILL }},
1584 { &hf_zbee_zdp_cinfo_ffd,
1585 { "Full-Function Device", "zbee_zdp.cinfo.ffd", FT_BOOLEAN, 8, NULL, ZBEE_CINFO_FFD,
1586 NULL, HFILL }},
1588 { &hf_zbee_zdp_cinfo_power,
1589 { "AC Power", "zbee_zdp.cinfo.power", FT_BOOLEAN, 8, NULL, ZBEE_CINFO_POWER,
1590 "Indicates this device is using AC/Mains power.", HFILL }},
1592 { &hf_zbee_zdp_cinfo_idle_rx,
1593 { "Rx On When Idle", "zbee_zdp.cinfo.idle_rx", FT_BOOLEAN, 8, NULL, ZBEE_CINFO_IDLE_RX,
1594 "Indicates the receiver is active when the device is idle.", HFILL }},
1596 { &hf_zbee_zdp_cinfo_security,
1597 { "Security Capability", "zbee_zdp.cinfo.security", FT_BOOLEAN, 8, NULL, ZBEE_CINFO_SECURITY,
1598 "Indicates this device is capable of performing encryption/decryption.", HFILL }},
1600 { &hf_zbee_zdp_cinfo_alloc,
1601 { "Allocate Short Address", "zbee_zdp.cinfo.alloc", FT_BOOLEAN, 8, NULL, ZBEE_CINFO_ALLOC,
1602 "Flag requesting the parent to allocate a short address for this device.", HFILL }},
1604 { &hf_zbee_zdp_dcf,
1605 { "Descriptor Capability Field", "zbee_zdp.dcf", FT_UINT8, BASE_HEX, NULL, 0,
1606 NULL, HFILL }},
1608 { &hf_zbee_zdp_dcf_eaela,
1609 { "Extended Active Endpoint List Available", "zbee_zdp.dcf.eaela", FT_BOOLEAN, 8, NULL, ZBEE_ZDP_DCF_EAELA,
1610 NULL, HFILL }},
1612 { &hf_zbee_zdp_dcf_esdla,
1613 { "Extended Simple Descriptor List Available", "zbee_zdp.dcf.esdla", FT_BOOLEAN, 8, NULL, ZBEE_ZDP_DCF_ESDLA,
1614 NULL, HFILL }},
1616 { &hf_zbee_zdp_server,
1617 { "Server Flags", "zbee_zdp.server", FT_UINT16, BASE_HEX, NULL, 0x0,
1618 NULL, HFILL }},
1620 { &hf_zbee_zdp_server_pri_trust,
1621 { "Primary Trust Center", "zbee_zdp.server.pri_trust", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_SERVER_PRIMARY_TRUST,
1622 NULL, HFILL }},
1624 { &hf_zbee_zdp_server_bak_trust,
1625 { "Backup Trust Center", "zbee_zdp.server.bak_trust", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_SERVER_BACKUP_TRUST,
1626 NULL, HFILL }},
1628 { &hf_zbee_zdp_server_pri_bind,
1629 { "Primary Binding Table Cache","zbee_zdp.server.pri_bind", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_SERVER_PRIMARY_BIND,
1630 NULL, HFILL }},
1632 { &hf_zbee_zdp_server_bak_bind,
1633 { "Backup Binding Table Cache", "zbee_zdp.server.bak_bind", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_SERVER_BACKUP_BIND,
1634 NULL, HFILL }},
1636 { &hf_zbee_zdp_server_pri_disc,
1637 { "Primary Discovery Cache", "zbee_zdp.server.pri_disc", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_SERVER_PRIMARY_DISC,
1638 NULL, HFILL }},
1640 { &hf_zbee_zdp_server_bak_disc,
1641 { "Backup Discovery Cache", "zbee_zdp.server.bak_disc", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_SERVER_BACKUP_DISC,
1642 NULL, HFILL }},
1644 { &hf_zbee_zdp_server_network_manager,
1645 { "Network Manager", "zbee_zdp.server.nwk_mgr", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_SERVER_NETWORK_MANAGER,
1646 NULL, HFILL }},
1648 { &hf_zbee_zdp_server_stk_compl_rev,
1649 { "Stack Compliance Revision", "zbee_zdp.server.stack_compliance_revision", FT_UINT16, BASE_DEC, NULL, ZBEE_ZDP_NODE_SERVER_STACK_COMPL_REV,
1650 NULL, HFILL }},
1652 { &hf_zbee_zdp_node_type,
1653 { "Type", "zbee_zdp.node.type", FT_UINT16, BASE_DEC, NULL, ZBEE_ZDP_NODE_TYPE,
1654 NULL, HFILL }},
1656 { &hf_zbee_zdp_node_complex,
1657 { "Complex Descriptor", "zbee_zdp.node.complex", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_COMPLEX,
1658 NULL, HFILL }},
1660 { &hf_zbee_zdp_node_user,
1661 { "User Descriptor", "zbee_zdp.node.user", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_USER,
1662 NULL, HFILL }},
1664 { &hf_zbee_zdp_node_frag_support,
1665 { "Fragmentation Supported", "zbee_zdp.node.frag_support", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_FRAG_SUPPORT,
1666 NULL, HFILL }},
1668 { &hf_zbee_zdp_node_freq_868,
1669 { "868MHz BPSK Band", "zbee_zdp.node.freq.868mhz", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_FREQ_868MHZ,
1670 NULL, HFILL }},
1672 { &hf_zbee_zdp_node_freq_900,
1673 { "900MHz BPSK Band", "zbee_zdp.node.freq.900mhz", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_FREQ_900MHZ,
1674 NULL, HFILL }},
1676 { &hf_zbee_zdp_node_freq_2400,
1677 { "2.4GHz OQPSK Band", "zbee_zdp.node.freq.2400mhz", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_FREQ_2400MHZ,
1678 NULL, HFILL }},
1680 { &hf_zbee_zdp_node_freq_eu_sub_ghz,
1681 { "EU Sub-GHz FSK Band", "zbee_zdp.node.freq.eu_sub_ghz", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_NODE_FREQ_EU_SUB_GHZ,
1682 NULL, HFILL }},
1684 { &hf_zbee_zdp_node_manufacturer,
1685 { "Manufacturer Code", "zbee_zdp.node.manufacturer", FT_UINT16, BASE_HEX, NULL, 0x0,
1686 NULL, HFILL }},
1688 { &hf_zbee_zdp_node_max_buffer,
1689 { "Max Buffer Size", "zbee_zdp.node.max_buffer", FT_UINT8, BASE_DEC, NULL, 0x0,
1690 NULL, HFILL }},
1692 { &hf_zbee_zdp_node_max_incoming_transfer,
1693 { "Max Incoming Transfer Size", "zbee_zdp.node.max_incoming_transfer", FT_UINT16, BASE_DEC, NULL, 0x0,
1694 NULL, HFILL }},
1696 { &hf_zbee_zdp_node_max_outgoing_transfer,
1697 { "Max Outgoing Transfer Size", "zbee_zdp.node.max_outgoing_transfer", FT_UINT16, BASE_DEC, NULL, 0x0,
1698 NULL, HFILL }},
1700 { &hf_zbee_zdp_power,
1701 { "Power Descriptor", "zbee_zdp.power", FT_UINT16, BASE_HEX, NULL, 0x0,
1702 NULL, HFILL }},
1704 { &hf_zbee_zdp_power_mode,
1705 { "Mode", "zbee_zdp.power.mode", FT_UINT16, BASE_DEC, VALS(zbee_zdp_power_mode_vals), ZBEE_ZDP_POWER_MODE,
1706 NULL, HFILL }},
1708 { &hf_zbee_zdp_power_avail_ac,
1709 { "Available AC Power", "zbee_zdp.power.avail.ac", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_POWER_AVAIL_AC,
1710 NULL, HFILL }},
1712 { &hf_zbee_zdp_power_avail_recharge,
1713 { "Available Rechargeable Battery", "zbee_zdp.power.avail.rech", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_POWER_AVAIL_RECHARGEABLE,
1714 NULL, HFILL }},
1716 { &hf_zbee_zdp_power_avail_dispose,
1717 { "Available Disposable Battery", "zbee_zdp.power.avail.disp", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_POWER_AVAIL_DISPOSABLE,
1718 NULL, HFILL }},
1720 { &hf_zbee_zdp_power_source_ac,
1721 { "Using AC Power", "zbee_zdp.power.source.ac", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_POWER_SOURCE_AC,
1722 NULL, HFILL }},
1724 { &hf_zbee_zdp_power_source_recharge,
1725 { "Using Rechargeable Battery", "zbee_zdp.power.source.recharge", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_POWER_SOURCE_RECHARGEABLE,
1726 NULL, HFILL }},
1728 { &hf_zbee_zdp_power_source_dispose,
1729 { "Using Disposable Battery", "zbee_zdp.power.source.dispose", FT_BOOLEAN, 16, NULL, ZBEE_ZDP_POWER_SOURCE_DISPOSABLE,
1730 NULL, HFILL }},
1732 { &hf_zbee_zdp_power_level,
1733 { "Level", "zbee_zdp.power.level", FT_UINT16, BASE_DEC, VALS(zbee_zdp_power_level_vals), ZBEE_ZDP_POWER_LEVEL,
1734 NULL, HFILL }},
1736 { &hf_zbee_zdp_simple_app_device,
1737 { "Application Device", "zbee_zdp.app.device", FT_UINT16, BASE_HEX, NULL, 0x0,
1738 NULL, HFILL }},
1740 { &hf_zbee_zdp_simple_zll_app_device,
1741 { "Application Device", "zbee_zdp.app.device", FT_UINT16, BASE_HEX, VALS(zbee_zll_device_names), 0x0,
1742 NULL, HFILL }},
1744 { &hf_zbee_zdp_simple_ha_app_device,
1745 { "Application Device", "zbee_zdp.app.device", FT_UINT16, BASE_HEX, VALS(zbee_ha_device_names), 0x0,
1746 NULL, HFILL }},
1748 { &hf_zbee_zdp_simple_app_version,
1749 { "Application Version", "zbee_zdp.app.version", FT_UINT16, BASE_HEX, NULL, 0x0,
1750 NULL, HFILL }},
1752 { &hf_zbee_zdp_complex_length,
1753 { "Complex Descriptor Length", "zbee_zdp.complex_length", FT_UINT8, BASE_DEC, NULL, 0x0,
1754 NULL, HFILL }},
1756 { &hf_zbee_zdp_complex,
1757 { "Complex Descriptor", "zbee_zdp.complex", FT_STRING, BASE_NONE, NULL, 0x0,
1758 NULL, HFILL }},
1760 { &hf_zbee_zdp_user,
1761 { "User Descriptor", "zbee_zdp.user", FT_STRING, BASE_NONE, NULL, 0x0,
1762 NULL, HFILL }},
1764 { &hf_zbee_zdp_user_length,
1765 { "User Descriptor Length", "zbee_zdp.user_length", FT_UINT8, BASE_DEC, NULL, 0x0,
1766 NULL, HFILL }},
1768 { &hf_zbee_zdp_simple_length,
1769 { "Simple Descriptor Length", "zbee_zdp.simple_length", FT_UINT8, BASE_DEC, NULL, 0x0,
1770 NULL, HFILL }},
1772 { &hf_zbee_zdp_disc_node_size,
1773 { "Node Descriptor Size", "zbee_zdp.node_size", FT_UINT8, BASE_DEC, NULL, 0x0,
1774 NULL, HFILL }},
1776 { &hf_zbee_zdp_disc_power_size,
1777 { "Power Descriptor Size", "zbee_zdp.power_size", FT_UINT8, BASE_DEC, NULL, 0x0,
1778 NULL, HFILL }},
1780 { &hf_zbee_zdp_cache,
1781 { "Cache", "zbee_zdp.cache", FT_UINT16, BASE_HEX, NULL, 0x0,
1782 "Address of the device containing the discovery cache.", HFILL }},
1784 { &hf_zbee_zdp_disc_ep_count,
1785 { "Active Endpoint Count", "zbee_zdp.ep_count", FT_UINT8, BASE_DEC, NULL, 0x0,
1786 NULL, HFILL }},
1788 { &hf_zbee_zdp_disc_simple_count,
1789 { "Simple Descriptor Count", "zbee_zdp.simple_count", FT_UINT8, BASE_DEC, NULL, 0x0,
1790 NULL, HFILL }},
1792 { &hf_zbee_zdp_disc_simple_size,
1793 { "Simple Descriptor Size", "zbee_zdp.simple_size", FT_UINT8, BASE_DEC, NULL, 0x0,
1794 NULL, HFILL }},
1796 { &hf_zbee_zdp_target,
1797 { "Target", "zbee_zdp.target", FT_UINT16, BASE_HEX, NULL, 0x0,
1798 NULL, HFILL }},
1800 { &hf_zbee_zdp_replacement,
1801 { "Replacement", "zbee_zdp.replacement", FT_EUI64, BASE_NONE, NULL, 0x0,
1802 NULL, HFILL }},
1804 { &hf_zbee_zdp_replacement_ep,
1805 { "Replacement Endpoint", "zbee_zdp.replacement_ep", FT_UINT8, BASE_DEC, NULL, 0x0,
1806 NULL, HFILL }},
1808 { &hf_zbee_zdp_bind_src,
1809 { "Source", "zbee_zdp.bind.src", FT_UINT16, BASE_HEX, NULL, 0x0,
1810 NULL, HFILL }},
1812 { &hf_zbee_zdp_bind_src64,
1813 { "Source", "zbee_zdp.bind.src64", FT_EUI64, BASE_NONE, NULL, 0x0,
1814 NULL, HFILL }},
1816 { &hf_zbee_zdp_bind_src_ep,
1817 { "Source Endpoint", "zbee_zdp.bind.src_ep", FT_UINT8, BASE_DEC, NULL, 0x0,
1818 NULL, HFILL }},
1820 { &hf_zbee_zdp_bind_dst,
1821 { "Destination", "zbee_zdp.bind.dst", FT_UINT16, BASE_HEX, NULL, 0x0,
1822 NULL, HFILL }},
1824 { &hf_zbee_zdp_bind_dst64,
1825 { "Destination", "zbee_zdp.bind.dst64", FT_EUI64, BASE_NONE, NULL, 0x0,
1826 NULL, HFILL }},
1828 { &hf_zbee_zdp_bind_dst_ep,
1829 { "Destination Endpoint", "zbee_zdp.bind.dst_ep", FT_UINT8, BASE_DEC, NULL, 0x0,
1830 NULL, HFILL }},
1832 { &hf_zbee_zdp_duration,
1833 { "Duration", "zbee_zdp.duration", FT_UINT8, BASE_DEC, NULL, 0x0,
1834 NULL, HFILL }},
1836 { &hf_zbee_zdp_leave_children,
1837 { "Remove Children", "zbee_zdp.leave.children", FT_BOOLEAN, 8, NULL, ZBEE_ZDP_MGMT_LEAVE_CHILDREN,
1838 NULL, HFILL }},
1840 { &hf_zbee_zdp_leave_rejoin,
1841 { "Rejoin", "zbee_zdp.leave.rejoin", FT_BOOLEAN, 8, NULL, ZBEE_ZDP_MGMT_LEAVE_REJOIN,
1842 NULL, HFILL }},
1844 { &hf_zbee_zdp_significance,
1845 { "Significance", "zbee_zdp.significance", FT_UINT8, BASE_DEC, NULL, 0x0,
1846 NULL, HFILL }},
1848 { &hf_zbee_zdp_scan_count,
1849 { "Scan Count", "zbee_zdp.scan_count", FT_UINT8, BASE_DEC, NULL, 0x0,
1850 NULL, HFILL }},
1852 { &hf_zbee_zdp_update_id,
1853 { "Update ID", "zbee_zdp.update_id", FT_UINT8, BASE_DEC, NULL, 0x0,
1854 NULL, HFILL }},
1856 { &hf_zbee_zdp_manager,
1857 { "Network Manager", "zbee_zdp.manager", FT_UINT16, BASE_HEX, NULL, 0x0,
1858 NULL, HFILL }},
1860 { &hf_zbee_zdp_tx_total,
1861 { "Total Transmissions", "zbee_zdp.tx_total", FT_UINT16, BASE_DEC, NULL, 0x0,
1862 NULL, HFILL }},
1864 { &hf_zbee_zdp_tx_fail,
1865 { "Failed Transmissions", "zbee_zdp.tx_fail", FT_UINT16, BASE_DEC, NULL, 0x0,
1866 NULL, HFILL }},
1868 { &hf_zbee_zdp_tx_retries,
1869 { "Retried Transmissions", "zbee_zdp.tx_retries", FT_UINT16, BASE_DEC, NULL, 0x0,
1870 NULL, HFILL }},
1872 { &hf_zbee_zdp_period_time_results,
1873 { "Period of Time For Results", "zbee_zdp.period_time_results", FT_UINT8, BASE_DEC, NULL, 0x0,
1874 NULL, HFILL }},
1876 { &hf_zbee_zdp_channel_count,
1877 { "Channel List Count", "zbee_zdp.channel_count", FT_UINT8, BASE_DEC, NULL, 0x0,
1878 NULL, HFILL }},
1880 { &hf_zbee_zdp_channel_page_count,
1881 { "Channel Page Count", "zbee_zdp.channel_page_count", FT_UINT8, BASE_DEC, NULL, 0x0,
1882 NULL, HFILL }},
1884 { &hf_zbee_zdp_channel_page,
1885 { "Channel Page", "zbee_zdp.channel_page", FT_UINT8, BASE_DEC, NULL, 0x0,
1886 NULL, HFILL }},
1888 { &hf_zbee_zdp_channel_mask,
1889 { "Channels", "zbee_zdp.channel_mask", FT_UINT32, BASE_HEX, NULL, 0x0,
1890 NULL, HFILL }},
1892 { &hf_zbee_zdp_channel_energy,
1893 { "Channel Energy", "zbee_zdp.channel_energy", FT_UINT8, BASE_DEC, NULL, 0x0,
1894 NULL, HFILL }},
1896 { &hf_zbee_zdp_pan_eui64,
1897 { "Pan", "zbee_zdp.pan.eui64", FT_EUI64, BASE_NONE, NULL, 0x0,
1898 NULL, HFILL }},
1900 { &hf_zbee_zdp_pan_uint,
1901 { "Pan", "zbee_zdp.pan.uint", FT_UINT16, BASE_HEX, NULL, 0x0,
1902 NULL, HFILL }},
1904 { &hf_zbee_zdp_channel,
1905 { "Channel", "zbee_zdp.channel", FT_UINT8, BASE_DEC, NULL, 0x0,
1906 NULL, HFILL }},
1908 { &hf_zbee_zdp_nwk_desc_profile,
1909 { "Profile", "zbee_zdp.profile", FT_UINT16, BASE_HEX, NULL, 0x0F,
1910 NULL, HFILL }},
1912 { &hf_zbee_zdp_profile_version,
1913 { "Version", "zbee_zdp.profile_version", FT_UINT8, BASE_DEC, NULL, 0xF0,
1914 NULL, HFILL }},
1916 { &hf_zbee_zdp_beacon,
1917 { "Beacon Order", "zbee_zdp.beacon", FT_UINT8, BASE_DEC, NULL, 0x0F,
1918 NULL, HFILL }},
1920 { &hf_zbee_zdp_superframe,
1921 { "Superframe Order", "zbee_zdp.superframe", FT_UINT8, BASE_DEC, NULL, 0xF0,
1922 NULL, HFILL }},
1924 { &hf_zbee_zdp_permit_joining,
1925 { "Permit Joining", "zbee_zdp.permit_joining", FT_UINT8, BASE_DEC, VALS(zbee_zdp_true_false_plus_vals), 0x01,
1926 NULL, HFILL }},
1928 { &hf_zbee_zdp_permit_joining_03,
1929 { "Permit Joining", "zbee_zdp.permit_joining", FT_UINT8, BASE_DEC, VALS(zbee_zdp_true_false_plus_vals), 0x03,
1930 NULL, HFILL }},
1932 { &hf_zbee_zdp_extended_pan,
1933 { "Extended Pan", "zbee_zdp.extended_pan", FT_EUI64, BASE_NONE, NULL, 0x0,
1934 NULL, HFILL }},
1936 { &hf_zbee_zdp_addr,
1937 { "Addr", "zbee_zdp.addr", FT_UINT16, BASE_HEX, NULL, 0x0,
1938 NULL, HFILL }},
1940 { &hf_zbee_zdp_depth,
1941 { "Depth", "zbee_zdp.depth", FT_UINT8, BASE_DEC, NULL, 0x0,
1942 NULL, HFILL }},
1944 { &hf_zbee_zdp_lqi,
1945 { "LQI", "zbee_zdp.lqi", FT_UINT8, BASE_DEC, NULL, 0x0,
1946 NULL, HFILL }},
1948 { &hf_zbee_zdp_scan_channel,
1949 { "Scan Channels", "zbee_zdp.scan_channel", FT_UINT32, BASE_HEX, NULL, 0x0,
1950 NULL, HFILL }},
1952 { &hf_zbee_zdp_table_entry_type,
1953 { "Type", "zbee_zdp.table_entry_type", FT_UINT8, BASE_DEC, VALS(zbee_zdp_table_entry_type_vals), 0x03,
1954 NULL, HFILL }},
1956 { &hf_zbee_zdp_table_entry_idle_rx_0c,
1957 { "Idle Rx", "zbee_zdp.idle_rx", FT_UINT8, BASE_DEC, VALS(zbee_zdp_true_false_plus_vals), 0x0c,
1958 NULL, HFILL }},
1960 { &hf_zbee_zdp_table_entry_idle_rx_04,
1961 { "Idle Rx", "zbee_zdp.idle_rx", FT_UINT8, BASE_DEC, VALS(zbee_zdp_true_false_plus_vals), 0x04,
1962 NULL, HFILL }},
1964 { &hf_zbee_zdp_table_entry_relationship_18,
1965 { "Relationship", "zbee_zdp.relationship", FT_UINT8, BASE_DEC, VALS(zbee_zdp_relationship_vals), 0x18,
1966 NULL, HFILL }},
1968 { &hf_zbee_zdp_table_entry_relationship_70,
1969 { "Relationship", "zbee_zdp.relationship", FT_UINT8, BASE_DEC, VALS(zbee_zdp_relationship_vals), 0x70,
1970 NULL, HFILL }},
1972 { &hf_zbee_zdp_rtg,
1973 { "Routing Table", "zbee_zdp.routing", FT_NONE, BASE_NONE, NULL, 0x0,
1974 NULL, HFILL }},
1976 { &hf_zbee_zdp_rtg_entry,
1977 { "Routing Table Entry", "zbee_zdp.routing.entry", FT_NONE, BASE_NONE, NULL, 0x0,
1978 NULL, HFILL }},
1980 { &hf_zbee_zdp_rtg_destination,
1981 { "Destination", "zbee_zdp.routing.destination", FT_UINT16, BASE_HEX, NULL, 0x0,
1982 NULL, HFILL }},
1984 { &hf_zbee_zdp_rtg_status,
1985 { "Status", "zbee_zdp.routing.status", FT_UINT8, BASE_DEC, VALS(zbee_zdp_rtg_status_vals), 0x0,
1986 NULL, HFILL }},
1988 { &hf_zbee_zdp_rtg_next_hop,
1989 { "Next Hop", "zbee_zdp.routing.next_hop", FT_UINT16, BASE_HEX, NULL, 0x0,
1990 NULL, HFILL }},
1992 { &hf_zbee_zdp_ieee_join_start_index,
1993 { "Start Index", "zbee_zdp.ieee_joining_list.start_index", FT_UINT8, BASE_DEC, NULL, 0x0,
1994 NULL, HFILL }},
1996 { &hf_zbee_zdp_ieee_join_update_id,
1997 { "Update Id", "zbee_zdp.ieee_joining_list.update_id", FT_UINT8, BASE_DEC, NULL, 0x0,
1998 NULL, HFILL }},
2000 { &hf_zbee_zdp_ieee_join_policy,
2001 { "Policy", "zbee_zdp.ieee_joining_list.policy", FT_UINT8, BASE_DEC, VALS(zbee_zdp_ieee_join_policy_vals), 0x0,
2002 NULL, HFILL }},
2004 { &hf_zbee_zdp_ieee_join_list_total,
2005 { "List Total Count", "zbee_zdp.ieee_joining_list.total", FT_UINT8, BASE_DEC, NULL, 0x0,
2006 NULL, HFILL }},
2008 { &hf_zbee_zdp_ieee_join_list_start,
2009 { "List Start", "zbee_zdp.ieee_joining_list.start", FT_UINT8, BASE_DEC, NULL, 0x0,
2010 NULL, HFILL }},
2012 { &hf_zbee_zdp_ieee_join_list_count,
2013 { "List Count", "zbee_zdp.ieee_joining_list.count", FT_UINT8, BASE_DEC, NULL, 0x0,
2014 NULL, HFILL }},
2016 { &hf_zbee_zdp_ieee_join_list_ieee,
2017 { "IEEE", "zbee_zdp.ieee_joining_list.ieee", FT_EUI64, BASE_NONE, NULL, 0x0,
2018 NULL, HFILL }},
2020 { &hf_zbee_zdp_number_of_children,
2021 { "NumberOfChildren", "zbee_zdp.n_children", FT_UINT8, BASE_DEC, NULL, 0x0,
2022 NULL, HFILL }},
2024 { &hf_zbee_zdp_beacon_survey_scan_mask,
2025 { "ScanChannelItem", "zbee_zdp.scan_ch_list", FT_UINT32, BASE_HEX, NULL, 0x0,
2026 NULL, HFILL }},
2028 { &hf_zbee_zdp_beacon_survey_scan_mask_cnt,
2029 { "ScanChannelCount", "zbee_zdp.scan_ch_cnt", FT_UINT8, BASE_DEC, NULL, 0x0,
2030 NULL, HFILL }},
2032 { &hf_zbee_zdp_beacon_survey_conf_mask,
2033 { "Configuration Bitmask", "zbee_zdp.conf_mask", FT_UINT8, BASE_HEX, NULL, 0x0,
2034 NULL, HFILL }},
2036 { &hf_zbee_zdp_beacon_survey_total,
2037 { "Total beacons surveyed", "zbee_zdp.total_beacons", FT_UINT8, BASE_DEC, NULL, 0x0,
2038 NULL, HFILL }},
2040 { &hf_zbee_zdp_beacon_survey_cur_zbn,
2041 { "On-network beacons", "zbee_zdp.on_nwk_beacons", FT_UINT8, BASE_DEC, NULL, 0x0,
2042 NULL, HFILL }},
2044 { &hf_zbee_zdp_beacon_survey_cur_zbn_potent_parents,
2045 { "Potential Parent Beacons", "zbee_zdp.num_of_parents", FT_UINT8, BASE_DEC, NULL, 0x0,
2046 NULL, HFILL }},
2048 { &hf_zbee_zdp_beacon_survey_other_zbn,
2049 { "Other Network Beacons", "zbee_zdp.other_nwk_beacons", FT_UINT8, BASE_DEC, NULL, 0x0,
2050 NULL, HFILL }},
2052 { &hf_zbee_zdp_beacon_survey_current_parent,
2053 { "Current Parent", "zbee_zdp.cur_parent", FT_UINT16, BASE_HEX, NULL, 0x0,
2054 NULL, HFILL }},
2056 { &hf_zbee_zdp_beacon_survey_parent,
2057 { "Potential Parent", "zbee_zdp.p_parent", FT_UINT16, BASE_HEX, NULL, 0x0,
2058 NULL, HFILL }},
2060 { &hf_zbee_zdp_beacon_survey_cnt_parents,
2061 { "Count of potential parents", "zbee_zdp.cnt_parents", FT_UINT8, BASE_DEC, NULL, 0x0,
2062 NULL, HFILL }},
2064 { &hf_zbee_zdp_tlv_count,
2065 { "TLV Count", "zbee_zdp.tlv_count", FT_UINT8, BASE_DEC, NULL, 0x0,
2066 NULL, HFILL }},
2068 { &hf_zbee_zdp_tlv_id,
2069 { "TLV_ID", "zbee_zdp.tlv_id", FT_UINT8, BASE_DEC, NULL, 0x0,
2070 NULL, HFILL }},
2073 /* APS subtrees */
2074 static int *ett[] = {
2075 &ett_zbee_zdp,
2076 &ett_zbee_zdp_endpoint,
2077 &ett_zbee_zdp_match_in,
2078 &ett_zbee_zdp_match_out,
2079 &ett_zbee_zdp_node,
2080 &ett_zbee_zdp_node_in,
2081 &ett_zbee_zdp_node_out,
2082 &ett_zbee_zdp_power,
2083 &ett_zbee_zdp_simple,
2084 &ett_zbee_zdp_cinfo,
2085 &ett_zbee_zdp_server,
2086 &ett_zbee_zdp_simple_sizes,
2087 &ett_zbee_zdp_bind,
2088 &ett_zbee_zdp_bind_entry,
2089 &ett_zbee_zdp_bind_end_in,
2090 &ett_zbee_zdp_bind_end_out,
2091 &ett_zbee_zdp_bind_table,
2092 &ett_zbee_zdp_bind_source,
2093 &ett_zbee_zdp_assoc_device,
2094 &ett_zbee_zdp_nwk,
2095 &ett_zbee_zdp_lqi,
2096 &ett_zbee_zdp_rtg,
2097 &ett_zbee_zdp_cache,
2098 &ett_zbee_zdp_nwk_desc,
2099 &ett_zbee_zdp_table_entry,
2100 &ett_zbee_zdp_descriptor_capability_field,
2101 &ett_zbee_zdp_perm_join_fc,
2104 expert_module_t *expert_zbee_zdp;
2106 static ei_register_info ei[] = {
2108 &ei_deprecated_command,
2109 { "zbee_zdp.zdo_command_deprecated", PI_DEPRECATED, PI_WARN,
2110 "Deprecated ZDO Command", EXPFILL }
2114 /* Register ZigBee ZDP protocol with Wireshark. */
2115 proto_zbee_zdp = proto_register_protocol("ZigBee Device Profile", "ZigBee ZDP", "zbee_zdp");
2116 proto_register_field_array(proto_zbee_zdp, hf, array_length(hf));
2117 proto_register_subtree_array(ett, array_length(ett));
2118 expert_zbee_zdp = expert_register_protocol(proto_zbee_zdp);
2119 expert_register_field_array(expert_zbee_zdp, ei, array_length(ei));
2121 /* Register the ZDP dissector. */
2122 register_dissector("zbee_zdp", dissect_zbee_zdp, proto_zbee_zdp);
2123 } /* proto_register_zbee_zdp */
2126 *Registers the Zigbee Device Profile dissector with Wireshark.
2129 void proto_reg_handoff_zbee_zdp(void)
2131 dissector_handle_t zdp_handle;
2133 /* Register our dissector with the ZigBee application dissectors. */
2134 zdp_handle = find_dissector("zbee_zdp");
2135 dissector_add_uint("zbee.profile", ZBEE_ZDP_PROFILE, zdp_handle);
2136 } /* proto_reg_handoff_zbee_zdp */
2139 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2141 * Local variables:
2142 * c-basic-offset: 4
2143 * tab-width: 8
2144 * indent-tabs-mode: nil
2145 * End:
2147 * vi: set shiftwidth=4 tabstop=8 expandtab:
2148 * :indentSize=4:tabSize=8:noTabs=true: