Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-zbee-tlv.c
blob9b6f18e42bee2015984f58773dcf30131b708ff8
1 /* packet-zbee-tlv.c
2 * Dissector routines for the Zbee TLV (R23+)
3 * Copyright 2021 DSR Corporation, http://dsr-wireless.com/
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include <config.h>
13 #include <epan/expert.h>
14 #include <epan/packet.h>
15 #include <epan/proto_data.h>
17 #include "packet-ieee802154.h"
18 #include "packet-ieee802154.h"
19 #include "packet-zbee-tlv.h"
20 #include "packet-zbee.h"
21 #include "packet-zbee-nwk.h"
22 #include "packet-zbee-zdp.h"
23 #include "packet-zbee-aps.h"
24 #include "packet-zbee-direct.h"
26 #include "conversation.h"
28 /*-------------------------------------
29 * Dissector Function Prototypes
30 *-------------------------------------
32 static int dissect_zbee_tlv_default(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_);
33 static unsigned dissect_zdp_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, unsigned cmd_id);
34 static unsigned dissect_aps_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void *data, unsigned cmd_id);
35 static unsigned dissect_zbd_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void* data _U_, unsigned cmd_id);
36 static unsigned dissect_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
38 //Global TLV Dissector Routines
39 static unsigned dissect_zbee_tlv_manufacturer_specific(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t length);
40 static unsigned dissect_zbee_tlv_supported_key_negotiation_methods(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
41 static unsigned dissect_zbee_tlv_configuration_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
42 static unsigned dissect_zbee_tlv_dev_cap_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
43 static unsigned dissect_zbee_tlv_panid_conflict_report(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
44 static unsigned dissect_zbee_tlv_next_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
45 static unsigned dissect_zbee_tlv_next_channel_change(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
46 static unsigned dissect_zbee_tlv_passphrase(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
47 static unsigned dissect_zbee_tlv_router_information(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
48 static unsigned dissect_zbee_tlv_fragmentation_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
49 static unsigned dissect_zbee_tlv_potential_parents(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
51 //Local TLV Dissector Routines
52 static unsigned dissect_zbee_tlv_selected_key_negotiation_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
53 static unsigned dissect_zbee_tlv_public_point(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t length);
54 static unsigned dissect_zbee_tlv_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
55 static unsigned dissect_zbee_tlv_clear_all_bindigs_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
56 static unsigned dissect_zbee_tlv_requested_auth_token_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
57 static unsigned dissect_zbee_tlv_target_ieee_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
58 static unsigned dissect_zbee_tlv_device_auth_level(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
59 static unsigned dissect_zbee_tlv_chanmask(proto_tree *tree, tvbuff_t *tvb, unsigned offset, int hf_page, int hf_channel);
60 static unsigned dissect_zbee_tlv_ext_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
61 static unsigned dissect_zbee_tlv_short_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
62 static unsigned dissect_zbee_tlv_nwk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
63 static unsigned dissect_zbee_tlv_dev_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
64 static unsigned dissect_zbee_tlv_nwk_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
65 static unsigned dissect_zbee_tlv_join_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
66 static unsigned dissect_zbee_tlv_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
67 static unsigned dissect_zbee_tlv_tc_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
68 static unsigned dissect_zbee_tlv_nwk_upd_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
69 static unsigned dissect_zbee_tlv_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
70 static unsigned dissect_zbee_tlv_adm_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
71 static unsigned dissect_zbee_tlv_mj_prov_lnk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
72 static unsigned dissect_zbee_tlv_mj_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
73 static unsigned dissect_zbee_tlv_mj_cmd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
74 static unsigned dissect_zbee_tlv_nwk_channel_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
75 static unsigned dissect_zbee_tlv_link_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
76 static unsigned dissect_zbee_tlv_nwk_status_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
77 static unsigned dissect_zbee_tlv_status_code(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
78 static unsigned dissect_zbee_tlv_tunneling_npdu_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset, uint8_t length);
79 static unsigned dissect_zbee_tlv_key_neg_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
80 static unsigned dissect_zbee_tlv_mac_tag(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t mac_tag_size);
81 static unsigned dissect_zbee_tlv_nwk_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
83 //Dissectors for ZB Direct
84 static unsigned dissect_zbd_msg_status_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
85 static unsigned dissect_zbd_msg_tunneling_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
86 static unsigned dissect_zbd_msg_manage_joiners_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
87 static unsigned dissect_zbd_msg_join_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
88 static unsigned dissect_zbd_msg_formation_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
89 static unsigned dissect_zbd_msg_secur_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
91 void proto_register_zbee_tlv(void);
93 /* Initialize Protocol and Registered fields */
94 static int proto_zbee_tlv;
95 static dissector_handle_t zigbee_aps_handle;
96 static dissector_handle_t zbee_nwk_handle;
98 static int hf_zbee_tlv_global_type;
99 static int hf_zbee_tlv_local_type_key_update_req_rsp;
100 static int hf_zbee_tlv_local_type_key_negotiation_req_rsp;
101 static int hf_zbee_tlv_local_type_get_auth_level_rsp;
102 static int hf_zbee_tlv_local_type_clear_all_bindings_req;
103 static int hf_zbee_tlv_local_type_req_security_get_auth_token;
104 static int hf_zbee_tlv_local_type_req_security_get_auth_level;
105 static int hf_zbee_tlv_local_type_req_security_decommission;
106 static int hf_zbee_tlv_local_type_req_beacon_survey;
107 static int hf_zbee_tlv_local_type_rsp_beacon_survey;
108 static int hf_zbee_tlv_local_type_req_challenge;
109 static int hf_zbee_tlv_local_type_rsp_challenge;
110 static int hf_zbee_tlv_local_type_rsp_set_configuration;
112 static int hf_zbee_tlv_length;
113 static int hf_zbee_tlv_type;
114 static int hf_zbee_tlv_value;
115 static int hf_zbee_tlv_count;
116 static int hf_zbee_tlv_manufacturer_specific;
118 static int hf_zbee_tlv_local_status_count;
119 static int hf_zbee_tlv_local_type_id;
120 static int hf_zbee_tlv_local_proc_status;
122 static int hf_zbee_tlv_local_comm_ext_pan_id;
123 static int hf_zbee_tlv_local_comm_short_pan_id;
124 static int hf_zbee_tlv_local_comm_channel_mask;
125 static int hf_zbee_tlv_local_comm_channel_page;
126 static int hf_zbee_tlv_local_comm_channel_page_count;
127 static int hf_zbee_tlv_local_comm_nwk_key;
128 static int hf_zbee_tlv_local_comm_link_key;
129 static int hf_zbee_tlv_local_comm_link_key_flags;
130 static int hf_zbee_tlv_local_comm_link_key_flags_unique;
131 static int hf_zbee_tlv_local_comm_link_key_flags_provisional;
132 static int hf_zbee_tlv_local_comm_dev_type;
133 static int hf_zbee_tlv_local_comm_nwk_addr;
134 static int hf_zbee_tlv_local_comm_join_method;
135 static int hf_zbee_tlv_local_comm_tc_addr;
136 static int hf_zbee_tlv_local_comm_network_status_map;
137 static int hf_zbee_tlv_local_comm_network_status_map_joined_status;
138 static int hf_zbee_tlv_local_comm_network_status_map_open_status;
139 static int hf_zbee_tlv_network_status_map_network_type;
140 static int hf_zbee_tlv_local_comm_nwk_upd_id;
141 static int hf_zbee_tlv_local_comm_key_seq_num;
142 static int hf_zbee_tlv_local_comm_adm_key;
143 static int hf_zbee_tlv_local_comm_status_code_domain;
144 static int hf_zbee_tlv_local_comm_status_code_value;
145 static int hf_zbee_tlv_local_comm_mj_prov_lnk_key;
146 static int hf_zbee_tlv_local_comm_mj_ieee_addr;
147 static int hf_zbee_tlv_local_comm_mj_cmd;
149 static int hf_zbee_tlv_local_tunneling_npdu;
150 static int hf_zbee_tlv_local_tunneling_npdu_flags;
151 static int hf_zbee_tlv_local_tunneling_npdu_flags_security;
152 static int hf_zbee_tlv_local_tunneling_npdu_flags_reserved;
153 static int hf_zbee_tlv_local_tunneling_npdu_length;
155 static int hf_zbee_tlv_local_selected_key_method;
156 static int hf_zbee_tlv_local_selected_psk_secret;
157 static int hf_zbee_tlv_local_nwk_key_seq_num;
158 static int hf_zbee_tlv_local_mac_tag;
160 static int hf_zbee_tlv_zbd_comm_tlv;
161 static int hf_zbee_tlv_zbd_comm_mj_cmd_tlv;
162 static int hf_zbee_tlv_zbd_secur_tlv;
163 static int hf_zbee_tlv_zbd_tunneling_npdu_msg_tlv;
165 static int hf_zbee_tlv_next_pan_id;
166 static int hf_zbee_tlv_next_channel_change;
167 static int hf_zbee_tlv_passphrase;
168 static int hf_zbee_tlv_configuration_param;
169 static int hf_zbee_tlv_configuration_param_restricted_mode;
170 static int hf_zbee_tlv_configuration_param_link_key_enc;
171 static int hf_zbee_tlv_configuration_param_leave_req_allowed;
173 static int hf_zbee_tlv_dev_cap_ext_capability_information;
174 static int hf_zbee_tlv_dev_cap_ext_zbdirect_virt_device;
176 static int hf_zbee_tlv_challenge_value;
177 static int hf_zbee_tlv_aps_frame_counter;
178 static int hf_zbee_tlv_challenge_counter;
179 static int hf_zbee_tlv_mic64;
181 static int hf_zbee_tlv_lqa;
183 static int hf_zbee_tlv_router_information;
184 static int hf_zbee_tlv_router_information_hub_connectivity;
185 static int hf_zbee_tlv_router_information_uptime;
186 static int hf_zbee_tlv_router_information_pref_parent;
187 static int hf_zbee_tlv_router_information_battery_backup;
188 static int hf_zbee_tlv_router_information_enhanced_beacon_request_support;
189 static int hf_zbee_tlv_router_information_mac_data_poll_keepalive_support;
190 static int hf_zbee_tlv_router_information_end_device_keepalive_support;
191 static int hf_zbee_tlv_router_information_power_negotiation_support;
193 static int hf_zbee_tlv_node_id;
194 static int hf_zbee_tlv_frag_opt;
195 static int hf_zbee_tlv_max_reassembled_buf_size;
197 static int hf_zbee_tlv_supported_key_negotiation_methods;
198 static int hf_zbee_tlv_supported_key_negotiation_methods_key_request;
199 static int hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_aes_mmo128;
200 static int hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_sha256;
201 static int hf_zbee_tlv_supported_secrets;
202 static int hf_zbee_tlv_supported_preshared_secrets_auth_token;
203 static int hf_zbee_tlv_supported_preshared_secrets_ic;
204 static int hf_zbee_tlv_supported_preshared_secrets_passcode_pake;
205 static int hf_zbee_tlv_supported_preshared_secrets_basic_access_key;
206 static int hf_zbee_tlv_supported_preshared_secrets_admin_access_key;
208 static int hf_zbee_tlv_panid_conflict_cnt;
210 static int hf_zbee_tlv_selected_key_negotiation_method;
211 static int hf_zbee_tlv_selected_pre_shared_secret;
212 static int hf_zbee_tlv_device_eui64;
213 static int hf_zbee_tlv_public_point;
214 static int hf_zbee_tlv_global_tlv_id;
215 static int hf_zbee_tlv_local_ieee_addr;
216 static int hf_zbee_tlv_local_initial_join_method;
217 static int hf_zbee_tlv_local_active_lk_type;
219 static int hf_zbee_tlv_relay_msg_type;
220 static int hf_zbee_tlv_relay_msg_length;
221 static int hf_zbee_tlv_relay_msg_joiner_ieee;
223 static int ett_zbee_aps_tlv;
224 static int ett_zbee_aps_relay;
225 static int ett_zbee_tlv;
226 static int ett_zbee_tlv_supported_key_negotiation_methods;
227 static int ett_zbee_tlv_supported_secrets;
228 static int ett_zbee_tlv_router_information;
229 static int ett_zbee_tlv_configuration_param;
230 static int ett_zbee_tlv_capability_information;
232 static int ett_zbee_tlv_zbd_tunneling_npdu;
233 static int ett_zbee_tlv_zbd_tunneling_npdu_flags;
235 static int ett_zbee_tlv_link_key_flags;
236 static int ett_zbee_tlv_network_status_map;
238 static expert_field ei_zbee_tlv_max_recursion_depth_reached;
240 static const value_string zbee_tlv_local_types_key_method_str[] =
242 { ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_25519_HASH_AESMMO128, "Curve 25519 / AESMMO-128" },
243 { ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_25519_HASH_SHA256, "Curve 25519 / SHA-256" },
244 { ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_P256_HASH_SHA256, "P-256 / SHA-256" },
245 { 0, NULL }
248 static const value_string zbee_tlv_local_types_psk_secret_str[] =
250 { ZBEE_TLV_TYPE_PSK_WELL_KNOWN_KEY, "Well known key" },
251 { ZBEE_TLV_TYPE_PSK_SECRET_AUTH_TOKEN, "Authorization token" },
252 { ZBEE_TLV_TYPE_PSK_SECRET_INSTALL_CODE, "Pre-configured link-ley derived from installation code" },
253 { ZBEE_TLV_TYPE_PSK_SECRET_PAKE_PASSCODE, "PAKE passcode" },
254 { ZBEE_TLV_TYPE_PSK_SECRET_BASIC_ACCESS_KEY, "Basic Access Key" },
255 { ZBEE_TLV_TYPE_PSK_SECRET_ADMINISTRATIVE_ACCESS_KEY, "Administrative Access Key" },
256 { 0, NULL }
259 static const value_string zbee_tlv_local_types_dev_type_str[] =
261 { ZBEE_TLV_TYPE_DEV_TYPE_ZC, "ZigBee Coordinator" },
262 { ZBEE_TLV_TYPE_DEV_TYPE_ZR, "ZigBee Router" },
263 { ZBEE_TLV_TYPE_DEV_TYPE_ED, "ZigBee End Device" },
264 { 0, NULL }
267 static const value_string zbee_tlv_local_types_join_method_str[] =
269 { ZBEE_TLV_TYPE_JOIN_METHOD_MAC_ASS, "MAC association" },
270 { ZBEE_TLV_TYPE_JOIN_METHOD_NWK_REJ, "NWK rejoin" },
271 { ZBEE_TLV_TYPE_JOIN_METHOD_OOB_WITH_CHECK, "Out-of-band commissioning (with check for nearby IEEE 802.15.4 beacons)" },
272 { ZBEE_TLV_TYPE_JOIN_METHOD_OOB_WITHOUT_CHECK, "Out-of-band commissioning (without check for nearby IEEE 802.15.4 beacons)" },
273 { 0, NULL }
276 static const value_string zbee_tlv_local_types_status_code_domain_str[] =
278 { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_GENERAL, "General domain or unspecific operation" },
279 { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_FORM, "Form Network Operation" },
280 { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_JOIN, "Join Network Operation" },
281 { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_PERMIT_JOIN, "Permit Joining Operation" },
282 { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_LEAVE, "Leave Network Operation" },
283 { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_MANAGE_JOINERS, "Manage Joiners Domain" },
284 { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_IDENTIFY, "Identify Operation" },
285 { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_FINDING_BINDING, "Finding & Binding Domain" },
286 { 0, NULL }
289 static const value_string zbee_tlv_local_types_joined_status_str[] =
291 { ZBEE_TLV_TYPE_JOINED_STATUS_NO_NWK, "No network" },
292 { ZBEE_TLV_TYPE_JOINED_STATUS_JOINING, "Joining" },
293 { ZBEE_TLV_TYPE_JOINED_STATUS_JOINED, "Joined" },
294 { ZBEE_TLV_TYPE_JOINED_STATUS_JOINED_NO_PARENT, "Joined (no parent)" },
295 { ZBEE_TLV_TYPE_JOINED_STATUS_LEAVING, "Leaving" },
296 { 0, NULL }
299 static const value_string zbee_tlv_local_types_nwk_type_str[] =
301 { ZBEE_TLV_NWK_TYPE_DISTRIBUTED, "Distributed" },
302 { ZBEE_TLV_NWK_TYPE_CENTRALIZED, "Centralized" },
303 { 0, NULL }
306 static const value_string zbee_tlv_local_types_nwk_state_str[] =
308 { ZBEE_TLV_TYPE_NWK_STATE_CLOSED, "Closed" },
309 { ZBEE_TLV_TYPE_NWK_STATE_OPENED, "Opened" },
310 { 0, NULL }
313 static const value_string zbee_tlv_local_types_mj_cmd_str[] =
315 { ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_DROP, "Drop all joiners' Provisional Link Keys" },
316 { ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_ADD, "Add a joiner's Provisional Link Key" },
317 { ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_REMOVE, "Remove a joiner's Provisional Link Key" },
318 { 0, NULL }
321 static const value_string zbee_tlv_local_types_lnk_key_unique_str[] =
323 { ZBEE_TLV_TYPE_LINK_KEY_FLAG_GLOBAL, "Global" },
324 { ZBEE_TLV_TYPE_LINK_KEY_FLAG_UNIQUE, "Unique" },
325 { 0, NULL }
328 static const value_string zbee_tlv_local_types_lnk_key_provisional_str[] =
330 { ZBEE_TLV_TYPE_LINK_KEY_FLAG_PERMANENT, "Permanent" },
331 { ZBEE_TLV_TYPE_LINK_KEY_FLAG_PROVISIONAL, "Provisional" },
332 { 0, NULL }
335 static const value_string zbee_tlv_zbd_comm_types[] = {
336 { ZBEE_TLV_TYPE_COMM_EXT_PAN_ID, "Extended PAN ID" },
337 { ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID, "Short PAN ID" },
338 { ZBEE_TLV_TYPE_COMM_NWK_CH, "Network Channel" },
339 { ZBEE_TLV_TYPE_COMM_NWK_KEY, "Network Key" },
340 { ZBEE_TLV_TYPE_COMM_LNK_KEY, "Link Key" },
341 { ZBEE_TLV_TYPE_COMM_DEV_TYPE, "Device Type" },
342 { ZBEE_TLV_TYPE_COMM_NWK_ADDR, "NWK Address" },
343 { ZBEE_TLV_TYPE_COMM_JOIN_METHOD, "Joining Method" },
344 { ZBEE_TLV_TYPE_COMM_IEEE_ADDR, "IEEE Address" },
345 { ZBEE_TLV_TYPE_COMM_TC_ADDR, "Trust Center Address" },
346 { ZBEE_TLV_TYPE_COMM_NWK_STATUS_MAP, "Network Status Map" },
347 { ZBEE_TLV_TYPE_COMM_NWK_UPD_ID, "NWK Update ID" },
348 { ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM, "NWK Active Key Seq Number" },
349 { ZBEE_TLV_TYPE_COMM_ADMIN_KEY, "Admin Key" },
350 { ZBEE_TLV_TYPE_COMM_STATUS_CODE, "Status Code" },
352 // TODO: Not implemented yet
353 // { 0x0f, "Extended Status Code" },
354 { 0, NULL }
357 static const value_string zbee_tlv_zbd_comm_mj_types[] = {
358 { ZBEE_TLV_TYPE_COMM_MJ_PROVISIONAL_LINK_KEY, "Provisional Link" },
359 { ZBEE_TLV_TYPE_COMM_MJ_IEEE_ADDR, "IEEE Address" },
360 { ZBEE_TLV_TYPE_COMM_MJ_CMD, "Manage Joiners Command" },
362 // 0x03-0xff - Reserved
363 { 0, NULL }
366 static const value_string zbee_tlv_zbd_secur_types[] = {
367 { ZBEE_TLV_TYPE_KEY_METHOD, "ZBD Key Negotiation Method TLV" },
368 { ZBEE_TLV_TYPE_PUB_POINT_P256, "ZBD Key Negotiation P-256 Public Point TLV" },
369 { ZBEE_TLV_TYPE_PUB_POINT_C25519, "ZBD Key Negotiation Curve25519 Public Point TLV" },
370 { ZBEE_TLV_TYPE_NWK_KEY_SEQ_NUM, "Network KeySequence Number TLV" },
371 { ZBEE_TLV_TYPE_MAC_TAG, "MacTag Tlv" },
372 { 0, NULL }
375 static const value_string zbee_aps_relay_tlvs[] = {
376 { 0, "Relay Message TLV" },
377 { 0, NULL }
380 static const value_string zbee_tlv_global_types[] = {
381 { ZBEE_TLV_TYPE_MANUFACTURER_SPECIFIC, "Manufacturer Specific Global TLV" },
382 { ZBEE_TLV_TYPE_SUPPORTED_KEY_NEGOTIATION_METHODS, "Supported Key Negotiation Methods Global TLV" },
383 { ZBEE_TLV_TYPE_PANID_CONFLICT_REPORT, "PAN ID Conflict Report Global TLV"},
384 { ZBEE_TLV_TYPE_NEXT_PAN_ID, "Next PAN ID Global TLV" },
385 { ZBEE_TLV_TYPE_NEXT_CHANNEL_CHANGE, "Next Channel Change Global TLV" },
386 { ZBEE_TLV_TYPE_PASSPHRASE, "Passphrase Global TLV" },
387 { ZBEE_TLV_TYPE_ROUTER_INFORMATION, "Router Information Global TLV" },
388 { ZBEE_TLV_TYPE_FRAGMENTATION_PARAMETERS, "Fragmentation Parameters Global TLV" },
389 { ZBEE_TLV_TYPE_JOINER_ENCAPSULATION_GLOBAL, "Joiner Encapsulation Global TLV" },
390 { ZBEE_TLV_TYPE_BEACON_APPENDIX_ENCAPSULATION_GLOBAL, "Beacon Appendix Encapsulation Global TLV" },
391 { ZBEE_TLV_TYPE_CONFIGURATION_MODE_PARAMETERS, "Configuration Mode Parameters Global TLV" },
392 { 0, NULL }
395 static const value_string zbee_tlv_local_types_key_update_req_rsp[] = {
396 { ZBEE_TLV_TYPE_KEY_UPD_REQ_SELECTED_KEY_NEGOTIATION_METHOD, "Selected Key Negotiations Method Local TLV" },
397 { 0, NULL }
400 static const value_string zbee_tlv_local_types_key_negotiation_req_rsp[] = {
401 { ZBEE_TLV_TYPE_KEY_NEG_REQ_CURVE25519_PUBLIC_POINT, "Curve25519 Public Point Local TLV" },
402 { 0, NULL }
405 static const value_string zbee_tlv_local_types_get_auth_level_rsp[] = {
406 { ZBEE_TLV_TYPE_GET_AUTH_LEVEL, "Device Authentication Level TLV" },
407 { 0, NULL }
410 static const value_string zbee_tlv_local_types_clear_all_bindings_req[] = {
411 { ZBEE_TLV_TYPE_CLEAR_ALL_BINDIGS_REQ_EUI64, "Clear All Bindings Req EUI64 TLV" },
412 { 0, NULL }
415 static const value_string zbee_tlv_local_types_req_security_get_auth_token[] = {
416 { ZBEE_TLV_TYPE_REQUESTED_AUTH_TOKEN_ID, "Requested Authentication Token ID TLV" },
417 { 0, NULL }
420 static const value_string zbee_tlv_local_types_req_security_get_auth_level[] = {
421 { ZBEE_TLV_TYPE_TARGET_IEEE_ADDRESS, "Target IEEE Address TLV" },
422 { 0, NULL }
425 static const value_string zbee_tlv_local_types_req_security_decommission[] = {
426 { ZBEE_TLV_TYPE_EUI64, "EUI64 TLV" },
427 { 0, NULL }
430 static const value_string zbee_tlv_local_types_req_beacon_survey[] = {
431 { ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION, "Beacon Survey Configuration TLV" },
432 { 0, NULL }
435 static const value_string zbee_tlv_local_types_req_challenge[] = {
436 { 0, "APS Frame Counter Challenge Request TLV" },
437 { 0, NULL }
440 static const value_string zbee_tlv_local_types_rsp_challenge[] = {
441 { 0, "APS Frame Counter Challenge Response TLV" },
442 { 0, NULL }
445 static const value_string zbee_tlv_local_types_rsp_set_configuration[] = {
446 { 0, "Processing status TLV" },
447 { 0, NULL }
450 static const value_string zbee_tlv_local_types_rsp_beacon_survey[] = {
451 { ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION, "Beacon Survey Configuration TLV" },
452 { ZBEE_TLV_TYPE_BEACON_SURVEY_RESULTS, "Beacon Survey Results TLV" },
453 { ZBEE_TLV_TYPE_BEACON_SURVEY_POTENTIAL_PARENTS, "Beacon Survey Potential Parents TLV"},
454 { 0, NULL }
457 static const value_string zbee_tlv_selected_key_negotiation_method[] = {
458 { ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ZB_30, "Zigbee 3.0" },
459 { ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ECDHE_USING_CURVE25519_AES_MMO128, "ECDHE using Curve25519 with Hash AES-MMO-128" },
460 { ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ECDHE_USING_CURVE25519_SHA256, "ECDHE using Curve25519 with Hash SHA-256" },
461 { 0, NULL }
464 static const value_string zbee_tlv_selected_pre_shared_secret[] = {
465 { ZBEE_TLV_SELECTED_PRE_SHARED_WELL_KNOWN_KEY, "Well Known Key" },
466 { ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_AUTH_TOKEN, "Symmetric Authentication Token" },
467 { ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_LINK_KEY_IC, "Pre-configured link-ley derived from installation code" },
468 { ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_VLEN_PASSCODE, "Variable-length pass code" },
469 { ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_BASIC_ACCESS_KEY, "Basic Access Key" },
470 { ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_ADMIN_ACCESS_KEY, "Administrative Access Key" },
471 { 0, NULL }
474 static const value_string zbee_initial_join_methods[] = {
475 { 0x00, "No authentication" },
476 { 0x01, "Install Code Key" },
477 { 0x02, "Anonymous key negotiation" },
478 { 0x03, "Authentication Key Negotiation" },
479 { 0, NULL }
482 static const value_string zbee_active_lk_types[] = {
483 { 0x00, "Not Updated" },
484 { 0x01, "Key Request Method" },
485 { 0x02, "Unauthentication Key Negotiation" },
486 { 0x03, "Authentication Key Negotiation" },
487 { 0x04, "Application Defined Certificate Based Mutual" },
488 { 0, NULL }
491 static unsigned
492 dissect_aps_relay_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void *data)
494 tvbuff_t *relay_tvb;
495 proto_item *relayed_frame_root;
496 proto_tree *relayed_frame_tree;
497 uint8_t length;
498 zbee_nwk_hints_t *nwk_hints;
500 zigbee_aps_handle = find_dissector("zbee_aps");
502 proto_tree_add_item(tree, hf_zbee_tlv_relay_msg_type, tvb, offset, 1, ENC_NA);
503 offset += 1;
505 length = tvb_get_uint8(tvb, offset) + 1;
506 proto_tree_add_item(tree, hf_zbee_tlv_relay_msg_length, tvb, offset, 1, ENC_NA);
507 offset += 1;
509 proto_tree_add_item(tree, hf_zbee_tlv_relay_msg_joiner_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN);
510 nwk_hints = (zbee_nwk_hints_t *)p_get_proto_data(wmem_file_scope(), pinfo,
511 proto_get_id_by_filter_name(ZBEE_PROTOABBREV_NWK), 0);
512 nwk_hints->joiner_addr64 = tvb_get_letoh64(tvb, offset);
513 offset += 8;
515 /* The remainder is a relayed APS frame. */
516 relay_tvb = tvb_new_subset_remaining(tvb, offset);
517 relayed_frame_tree = proto_tree_add_subtree_format(tree, tvb, offset, length - 8, ett_zbee_aps_relay, &relayed_frame_root,
518 "Relayed APS Frame");
519 call_dissector_with_data(zigbee_aps_handle, relay_tvb, pinfo, relayed_frame_tree, data);
521 /* Add column info */
522 col_append_str(pinfo->cinfo, COL_INFO, ", Relay");
524 return tvb_captured_length(tvb);
528 static unsigned
529 dissect_aps_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void *data, unsigned cmd_id)
531 switch (cmd_id) {
532 case ZBEE_APS_CMD_RELAY_MSG_UPSTREAM:
533 case ZBEE_APS_CMD_RELAY_MSG_DOWNSTREAM:
535 zbee_nwk_hints_t *nwk_hints = (zbee_nwk_hints_t *)p_get_proto_data(wmem_file_scope(), pinfo,
536 proto_get_id_by_filter_name(ZBEE_PROTOABBREV_NWK), 0);
537 nwk_hints->relay_type = (cmd_id == ZBEE_APS_CMD_RELAY_MSG_DOWNSTREAM ? ZBEE_APS_RELAY_DOWNSTREAM : ZBEE_APS_RELAY_UPSTREAM);
539 offset = dissect_aps_relay_local_tlv(tvb, pinfo, tree, offset, data);
540 break;
542 default:
544 offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
545 break;
549 return offset;
553 *Helper dissector for the Security Decommission Request.
555 *@param tvb pointer to buffer containing raw packet.
556 *@param pinfo pointer to packet information fields
557 *@param tree pointer to the command subtree.
558 *@param offset into the tvb to begin dissection.
559 *@return offset after command dissection.
561 static unsigned
562 dissect_zdp_req_security_decommission_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
564 uint8_t type;
565 uint8_t length;
567 type = tvb_get_uint8(tvb, offset);
568 proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_security_decommission, tvb, offset, 1, ENC_NA);
569 offset += 1;
571 length = tvb_get_uint8(tvb, offset);
572 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
573 offset += 1;
575 length += 1;
576 switch (type) {
577 case ZBEE_TLV_TYPE_EUI64:
578 offset = dissect_zbee_tlv_eui64(tvb, pinfo, tree, offset);
579 break;
581 default:
582 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
583 offset += length;
584 break;
587 return offset;
591 *Helper dissector for the Security Get Authentication Level Request.
593 *@param tvb pointer to buffer containing raw packet.
594 *@param pinfo pointer to packet information fields
595 *@param tree pointer to the command subtree.
596 *@param offset into the tvb to begin dissection.
597 *@return offset after command dissection.
599 static unsigned
600 dissect_zdp_req_security_get_auth_level_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
602 uint8_t type;
603 uint8_t length;
605 type = tvb_get_uint8(tvb, offset);
606 proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_security_get_auth_level, tvb, offset, 1, ENC_NA);
607 offset += 1;
609 length = tvb_get_uint8(tvb, offset);
610 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
611 offset += 1;
613 length += 1;
614 switch (type) {
615 case ZBEE_TLV_TYPE_TARGET_IEEE_ADDRESS:
616 offset = dissect_zbee_tlv_target_ieee_address(tvb, pinfo, tree, offset);
617 break;
619 default:
620 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
621 offset += length;
622 break;
625 return offset;
628 *Helper dissector for the Security Get Authentication Token Request.
630 *@param tvb pointer to buffer containing raw packet.
631 *@param pinfo pointer to packet information fields
632 *@param tree pointer to the command subtree.
633 *@param offset into the tvb to begin dissection.
634 *@return offset after command dissection.
636 static unsigned
637 dissect_zdp_req_security_get_auth_token_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
639 uint8_t type;
640 uint8_t length;
642 type = tvb_get_uint8(tvb, offset);
643 proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_security_get_auth_token, tvb, offset, 1, ENC_NA);
644 offset += 1;
646 length = tvb_get_uint8(tvb, offset);
647 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
648 offset += 1;
650 length += 1;
651 switch (type) {
652 case ZBEE_TLV_TYPE_REQUESTED_AUTH_TOKEN_ID:
653 offset = dissect_zbee_tlv_requested_auth_token_id(tvb, pinfo, tree, offset);
654 break;
656 default:
657 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
658 offset += length;
659 break;
662 return offset;
666 *Helper dissector for the Clear All Bindings Request.
668 *@param tvb pointer to buffer containing raw packet.
669 *@param pinfo pointer to packet information fields
670 *@param tree pointer to the command subtree.
671 *@param offset into the tvb to begin dissection.
672 *@return offset after command dissection.
674 static unsigned
675 dissect_zdp_req_clear_all_bindings_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
677 uint8_t type;
678 uint8_t length;
680 type = tvb_get_uint8(tvb, offset);
681 proto_tree_add_item(tree, hf_zbee_tlv_local_type_clear_all_bindings_req, tvb, offset, 1, ENC_NA);
682 offset += 1;
684 length = tvb_get_uint8(tvb, offset);
685 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
686 offset += 1;
688 length += 1;
689 switch (type) {
690 case ZBEE_TLV_TYPE_CLEAR_ALL_BINDIGS_REQ_EUI64:
691 offset = dissect_zbee_tlv_clear_all_bindigs_eui64(tvb, pinfo, tree, offset);
692 break;
694 default:
695 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
696 offset += length;
697 break;
700 return offset;
704 *Helper dissector for the Beacon Survey Request.
706 *@param tvb pointer to buffer containing raw packet.
707 *@param pinfo pointer to packet information fields
708 *@param tree pointer to the command subtree.
709 *@param offset into the tvb to begin dissection.
710 *@return offset after command dissection.
712 static unsigned
713 dissect_zdp_req_beacon_survey_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
715 uint8_t type;
716 uint8_t length;
718 type = tvb_get_uint8(tvb, offset);
719 proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_beacon_survey, tvb, offset, 1, ENC_NA);
720 offset += 1;
722 length = tvb_get_uint8(tvb, offset);
723 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
724 offset += 1;
726 length += 1;
727 switch (type) {
728 case ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION:
730 uint8_t cnt;
731 uint8_t i;
733 cnt = tvb_get_uint8(tvb, offset);
734 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask_cnt, tvb, offset, 1, ENC_LITTLE_ENDIAN);
735 offset += 1;
737 for (i = 0; i < cnt; i++)
739 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask, tvb, offset, 4, ENC_LITTLE_ENDIAN);
740 offset += 4;
743 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_conf_mask, tvb, offset, 1, ENC_LITTLE_ENDIAN);
744 offset += 1;
745 break;
747 default:
748 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
749 offset += length;
750 break;
753 return offset;
757 *Helper dissector for the Beacon Survey Response.
759 *@param tvb pointer to buffer containing raw packet.
760 *@param pinfo pointer to packet information fields
761 *@param tree pointer to the command subtree.
762 *@param offset into the tvb to begin dissection.
763 *@return offset after command dissection.
765 static unsigned
766 dissect_zdp_rsp_beacon_survey_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
768 uint8_t type;
769 uint8_t length;
771 type = tvb_get_uint8(tvb, offset);
772 proto_tree_add_item(tree, hf_zbee_tlv_local_type_rsp_beacon_survey, tvb, offset, 1, ENC_NA);
773 offset += 1;
775 length = tvb_get_uint8(tvb, offset);
776 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
777 offset += 1;
779 length += 1;
780 switch (type) {
781 case ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION:
783 uint8_t cnt;
784 uint8_t i;
786 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_conf_mask, tvb, offset, 1, ENC_LITTLE_ENDIAN);
787 offset += 1;
789 cnt = tvb_get_uint8(tvb, offset);
790 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask_cnt, tvb, offset, 1, ENC_LITTLE_ENDIAN);
791 offset += 1;
793 for (i = 0; i < cnt; i++)
795 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask, tvb, offset, 4, ENC_LITTLE_ENDIAN);
796 offset += 4;
799 break;
802 case ZBEE_TLV_TYPE_BEACON_SURVEY_RESULTS:
804 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_total, tvb, offset, 1, ENC_LITTLE_ENDIAN);
805 offset += 1;
807 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_cur_zbn, tvb, offset, 1, ENC_LITTLE_ENDIAN);
808 offset += 1;
810 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_cur_zbn_potent_parents, tvb, offset, 1, ENC_LITTLE_ENDIAN);
811 offset += 1;
813 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_other_zbn, tvb, offset, 1, ENC_LITTLE_ENDIAN);
814 offset += 1;
816 break;
819 case ZBEE_TLV_TYPE_BEACON_SURVEY_POTENTIAL_PARENTS:
820 offset = dissect_zbee_tlv_potential_parents(tvb, pinfo, tree, offset);
821 break;
823 default:
824 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
825 offset += length;
826 break;
829 return offset;
833 *Helper dissector for the Security Challenge Request.
835 *@param tvb pointer to buffer containing raw packet.
836 *@param pinfo pointer to packet information fields
837 *@param tree pointer to the command subtree.
838 *@param offset into the tvb to begin dissection.
839 *@return offset after command dissection.
841 static unsigned
842 dissect_zdp_req_security_challenge_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
844 uint8_t type;
845 uint8_t length;
847 type = tvb_get_uint8(tvb, offset);
848 proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_challenge, tvb, offset, 1, ENC_NA);
849 offset += 1;
851 length = tvb_get_uint8(tvb, offset);
852 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
853 offset += 1;
855 length += 1;
856 switch (type) {
857 case 0:
859 proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
860 offset += 8;
862 proto_tree_add_item(tree, hf_zbee_tlv_challenge_value, tvb, offset, 8, ENC_NA);
863 offset += 8;
864 break;
866 default:
867 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
868 offset += length;
869 break;
872 return offset;
876 *Helper dissector for the Security Challenge Response.
878 *@param tvb pointer to buffer containing raw packet.
879 *@param pinfo pointer to packet information fields
880 *@param tree pointer to the command subtree.
881 *@param offset into the tvb to begin dissection.
882 *@return offset after command dissection.
884 static unsigned
885 dissect_zdp_rsp_security_challenge_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
887 uint8_t type;
888 uint8_t length;
890 type = tvb_get_uint8(tvb, offset);
891 proto_tree_add_item(tree, hf_zbee_tlv_local_type_rsp_challenge, tvb, offset, 1, ENC_NA);
892 offset += 1;
894 length = tvb_get_uint8(tvb, offset);
895 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
896 offset += 1;
898 length += 1;
899 switch (type) {
900 case 0:
902 proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
903 offset += 8;
905 proto_tree_add_item(tree, hf_zbee_tlv_challenge_value, tvb, offset, 8, ENC_NA);
906 offset += 8;
908 proto_tree_add_item(tree, hf_zbee_tlv_aps_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
909 offset += 4;
911 proto_tree_add_item(tree, hf_zbee_tlv_challenge_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
912 offset += 4;
914 proto_tree_add_item(tree, hf_zbee_tlv_mic64, tvb, offset, 8, ENC_NA);
915 offset += 8;
916 break;
918 default:
919 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
920 offset += length;
921 break;
924 return offset;
929 *Helper dissector for the Security Challenge Response.
931 *@param tvb pointer to buffer containing raw packet.
932 *@param pinfo pointer to packet information fields
933 *@param tree pointer to the command subtree.
934 *@param offset into the tvb to begin dissection.
935 *@return offset after command dissection.
937 static unsigned
938 dissect_zdp_rsp_security_set_configuration_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
940 uint8_t type;
941 uint8_t length;
943 type = tvb_get_uint8(tvb, offset);
944 proto_tree_add_item(tree, hf_zbee_tlv_local_type_rsp_set_configuration, tvb, offset, 1, ENC_NA);
945 offset += 1;
947 length = tvb_get_uint8(tvb, offset);
948 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
949 offset += 1;
951 length += 1;
952 switch (type) {
953 case 0:
955 uint8_t count;
956 uint8_t i;
958 count = tvb_get_uint8(tvb, offset);
959 proto_tree_add_item(tree, hf_zbee_tlv_local_status_count, tvb, offset, 1, ENC_NA);
960 offset += 1;
962 for (i = 0; i < count; i++)
964 proto_tree_add_item(tree, hf_zbee_tlv_local_type_id, tvb, offset, 1, ENC_NA);
965 offset += 1;
966 proto_tree_add_item(tree, hf_zbee_tlv_local_proc_status, tvb, offset, 1, ENC_NA);
967 offset += 1;
969 break;
971 default:
972 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
973 offset += length;
974 break;
977 return offset;
982 *Helper dissector for the Security Start Key Negotiation req/rsp
984 *@param tvb pointer to buffer containing raw packet.
985 *@param pinfo pointer to packet information fields
986 *@param tree pointer to the command subtree.
987 *@param offset into the tvb to begin dissection.
988 *@return offset after command dissection.
990 static unsigned
991 dissect_zdp_security_start_key_neg_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
993 uint8_t type;
994 uint8_t length;
996 type = tvb_get_uint8(tvb, offset);
997 proto_tree_add_item(tree, hf_zbee_tlv_local_type_key_negotiation_req_rsp, tvb, offset, 1, ENC_NA);
998 offset += 1;
1000 length = tvb_get_uint8(tvb, offset);
1001 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1002 offset += 1;
1004 length += 1; /* actual length */
1006 switch (type) {
1008 case ZBEE_TLV_TYPE_KEY_NEG_REQ_CURVE25519_PUBLIC_POINT:
1009 offset = dissect_zbee_tlv_public_point(tvb, pinfo, tree, offset, length);
1010 break;
1012 default:
1013 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1014 offset += length;
1015 break;
1018 return offset;
1022 *Helper dissector for the Security Start Key Update req/rsp
1024 *@param tvb pointer to buffer containing raw packet.
1025 *@param pinfo pointer to packet information fields
1026 *@param tree pointer to the command subtree.
1027 *@param offset into the tvb to begin dissection.
1028 *@return offset after command dissection.
1030 static unsigned
1031 dissect_zdp_security_key_upd_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1033 uint8_t type;
1034 uint8_t length;
1036 type = tvb_get_uint8(tvb, offset);
1037 proto_tree_add_item(tree, hf_zbee_tlv_local_type_key_update_req_rsp, tvb, offset, 1, ENC_NA);
1038 offset += 1;
1040 length = tvb_get_uint8(tvb, offset);
1041 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1042 offset += 1;
1044 length += 1; /* actual length */
1046 switch (type) {
1048 case ZBEE_TLV_TYPE_KEY_UPD_REQ_SELECTED_KEY_NEGOTIATION_METHOD:
1049 offset = dissect_zbee_tlv_selected_key_negotiation_method(tvb, pinfo, tree, offset);
1050 break;
1052 default:
1053 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1054 offset += length;
1055 break;
1058 return offset;
1061 *Helper dissector for the Security Get Auth Level Response.
1063 *@param tvb pointer to buffer containing raw packet.
1064 *@param pinfo pointer to packet information fields
1065 *@param tree pointer to the command subtree.
1066 *@param offset into the tvb to begin dissection.
1067 *@return offset after command dissection.
1069 static unsigned
1070 dissect_zdp_rsp_security_get_auth_level_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1072 uint8_t type;
1073 uint8_t length;
1075 type = tvb_get_uint8(tvb, offset);
1076 proto_tree_add_item(tree, hf_zbee_tlv_local_type_get_auth_level_rsp, tvb, offset, 1, ENC_NA);
1077 offset += 1;
1079 length = tvb_get_uint8(tvb, offset);
1080 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1081 offset += 1;
1083 length += 1;
1084 switch (type) {
1085 case ZBEE_TLV_TYPE_GET_AUTH_LEVEL:
1086 offset = dissect_zbee_tlv_device_auth_level(tvb, pinfo, tree, offset);
1087 break;
1089 default:
1090 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1091 offset += length;
1092 break;
1095 return offset;
1100 *Helper dissector for the ZDP commands.
1102 *@param tvb pointer to buffer containing raw packet.
1103 *@param pinfo pointer to packet information fields
1104 *@param tree pointer to the command subtree.
1105 *@param offset into the tvb to begin dissection.
1106 *@param cmd_id - ZDP command id .
1107 *@return offset after command dissection.
1109 static unsigned
1110 dissect_zdp_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, unsigned cmd_id)
1112 uint8_t total_tlv_length = 2 /*type + len fields*/ + tvb_get_uint8(tvb, offset + 1) + 1;
1113 uint8_t tmp_offset = offset;
1115 switch (cmd_id) {
1116 case ZBEE_ZDP_REQ_CLEAR_ALL_BINDINGS:
1117 offset = dissect_zdp_req_clear_all_bindings_local_tlv(tvb, pinfo, tree, offset);
1118 break;
1120 case ZBEE_ZDP_REQ_SECURITY_START_KEY_UPDATE:
1121 case ZBEE_ZDP_RSP_SECURITY_START_KEY_UPDATE:
1122 case ZBEE_ZDP_RSP_NODE_DESC:
1123 offset = dissect_zdp_security_key_upd_local_tlv(tvb, pinfo, tree, offset);
1124 break;
1126 case ZBEE_ZDP_REQ_SECURITY_START_KEY_NEGOTIATION:
1127 case ZBEE_ZDP_RSP_SECURITY_START_KEY_NEGOTIATION:
1128 offset = dissect_zdp_security_start_key_neg_local_tlv(tvb, pinfo, tree, offset);
1129 break;
1131 case ZBEE_ZDP_REQ_SECURITY_GET_AUTH_TOKEN:
1132 offset = dissect_zdp_req_security_get_auth_token_local_tlv(tvb, pinfo, tree, offset);
1133 break;
1135 case ZBEE_ZDP_REQ_SECURITY_GET_AUTH_LEVEL:
1136 offset = dissect_zdp_req_security_get_auth_level_local_tlv(tvb, pinfo, tree, offset);
1137 break;
1139 case ZBEE_ZDP_REQ_SECURITY_DECOMMISSION:
1140 offset = dissect_zdp_req_security_decommission_local_tlv(tvb, pinfo, tree, offset);
1141 break;
1143 case ZBEE_ZDP_RSP_SECURITY_GET_AUTH_LEVEL:
1144 offset = dissect_zdp_rsp_security_get_auth_level_local_tlv(tvb, pinfo, tree, offset);
1145 break;
1147 case ZBEE_ZDP_REQ_MGMT_NWK_BEACON_SURVEY:
1148 offset = dissect_zdp_req_beacon_survey_local_tlv(tvb, pinfo, tree, offset);
1149 break;
1151 case ZBEE_ZDP_RSP_MGMT_NWK_BEACON_SURVEY:
1152 offset = dissect_zdp_rsp_beacon_survey_local_tlv(tvb, pinfo, tree, offset);
1153 break;
1155 case ZBEE_ZDP_REQ_SECURITY_CHALLENGE:
1156 offset = dissect_zdp_req_security_challenge_local_tlv(tvb, pinfo, tree, offset);
1157 break;
1159 case ZBEE_ZDP_RSP_SECURITY_CHALLENGE:
1160 offset = dissect_zdp_rsp_security_challenge_local_tlv(tvb, pinfo, tree, offset);
1161 break;
1163 case ZBEE_ZDP_RSP_SECURITY_SET_CONFIGURATION:
1164 offset = dissect_zdp_rsp_security_set_configuration_local_tlv(tvb, pinfo, tree, offset);
1165 break;
1166 default:
1168 offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
1169 break;
1173 /* check extra bytes */
1174 if ((offset - tmp_offset) < total_tlv_length)
1176 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, total_tlv_length - 2, ENC_NA);
1177 offset = tmp_offset + total_tlv_length;
1180 return offset;
1184 * Helper dissector for a channel mask.
1186 * @param tree pointer to data tree Wireshark uses to display packet.
1187 * @param tvb pointer to buffer containing raw packet.
1188 * @param offset offset into the tvb to find the status value.
1189 * @param hf_page page field index
1190 * @param hf_channel channel field index
1191 * @return mask
1193 static unsigned
1194 dissect_zbee_tlv_chanmask(proto_tree *tree, tvbuff_t *tvb, unsigned offset, int hf_page, int hf_channel)
1196 uint32_t i;
1197 uint32_t mask;
1198 uint8_t page;
1199 proto_item *ti;
1201 /* Get and display the channel mask. */
1202 mask = tvb_get_letohl(tvb, offset);
1204 page = (uint8_t)((mask >> 27) & 0x07);
1205 mask &= 0x07FFFFFFUL;
1207 proto_tree_add_uint(tree, hf_page, tvb, offset, 4, page);
1208 ti = proto_tree_add_uint_format(tree, hf_channel, tvb, offset, 4, mask, "Channels: ");
1210 /* Check if there are any channels to display. */
1211 if (mask == 0)
1213 proto_item_append_text(ti, "None");
1216 /* Display the first channel #. */
1217 for (i = 0; i < 32; i++)
1219 if ((1 << i) & mask)
1221 proto_item_append_text(ti, "%d", i++);
1222 break;
1226 /* Display the rest of the channels. */
1227 for (; i < 32; i++)
1229 if (!((1 << i) & mask))
1231 /* This channel isn't selected. */
1232 continue;
1235 /* If the previous channel wasn't selected,
1236 * then display the channel number.
1238 if (!((1 << (i - 1)) & mask))
1240 proto_item_append_text(ti, ", %d", i);
1243 /* If the next channel is selected too,
1244 * skip past it and display a range of values instead.
1246 if ((2 << i) & mask)
1248 while ((i<32) && ((2 << i) & mask)) i++;
1249 proto_item_append_text(ti, "-%d", i);
1253 offset += sizeof(uint32_t);
1255 return offset;
1259 * Dissector Extended PAN ID TLV.
1261 * @param tvb pointer to buffer containing raw packet
1262 * @param pinfo pointer to packet information fields
1263 * @param tree pointer to subtree
1264 * @param offset offset into the tvb to begin dissection
1265 * @return offset after dissection
1268 static unsigned
1269 dissect_zbee_tlv_ext_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1271 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_ext_pan_id, tvb, offset, 8, ENC_NA);
1272 offset += 8;
1274 return offset;
1278 * Dissector Short PAN ID TLV.
1280 * @param tvb pointer to buffer containing raw packet
1281 * @param pinfo pointer to packet information fields
1282 * @param tree pointer to subtree
1283 * @param offset offset into the tvb to begin dissection
1284 * @return offset after dissection
1287 static unsigned
1288 dissect_zbee_tlv_short_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1290 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_short_pan_id, tvb, offset, 2, ENC_NA);
1291 offset += 2;
1293 return offset;
1297 * Dissector NWK Key TLV.
1299 * @param tvb pointer to buffer containing raw packet
1300 * @param pinfo pointer to packet information fields
1301 * @param tree pointer to subtree
1302 * @param offset offset into the tvb to begin dissection
1303 * @return offset after dissection
1306 static unsigned dissect_zbee_tlv_nwk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1308 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_nwk_key, tvb, offset, 16, ENC_NA);
1309 offset += 16;
1311 return offset;
1315 * Dissector Device Type TLV.
1317 * @param tvb pointer to buffer containing raw packet
1318 * @param pinfo pointer to packet information fields
1319 * @param tree pointer to subtree
1320 * @param offset offset into the tvb to begin dissection
1321 * @return offset after dissection
1324 static unsigned dissect_zbee_tlv_dev_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1326 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_dev_type, tvb, offset, 1, ENC_NA);
1327 offset += 1;
1329 return offset;
1333 * Dissector NWK Address TLV.
1335 * @param tvb pointer to buffer containing raw packet
1336 * @param pinfo pointer to packet information fields
1337 * @param tree pointer to subtree
1338 * @param offset offset into the tvb to begin dissection
1339 * @return offset after dissection
1342 static unsigned dissect_zbee_tlv_nwk_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1344 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_nwk_addr, tvb, offset, 2, ENC_NA);
1345 offset += 2;
1347 return offset;
1351 * Dissector Joining Method TLV.
1353 * @param tvb pointer to buffer containing raw packet
1354 * @param pinfo pointer to packet information fields
1355 * @param tree pointer to subtree
1356 * @param offset offset into the tvb to begin dissection
1357 * @return offset after dissection
1360 static unsigned dissect_zbee_tlv_join_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1362 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_join_method, tvb, offset, 1, ENC_NA);
1363 offset += 1;
1365 return offset;
1369 * Dissector IEEE Address TLV.
1371 * @param tvb pointer to buffer containing raw packet
1372 * @param pinfo pointer to packet information fields
1373 * @param tree pointer to subtree
1374 * @param offset offset into the tvb to begin dissection
1375 * @return offset after dissection
1378 static unsigned dissect_zbee_tlv_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1380 proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_NA);
1381 offset += 8;
1383 return offset;
1387 * Dissector Trust Center Address TLV.
1389 * @param tvb pointer to buffer containing raw packet
1390 * @param pinfo pointer to packet information fields
1391 * @param tree pointer to subtree
1392 * @param offset offset into the tvb to begin dissection
1393 * @return offset after dissection
1396 static unsigned dissect_zbee_tlv_tc_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1398 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_tc_addr, tvb, offset, 8, ENC_NA);
1399 offset += 8;
1401 return offset;
1405 * Dissector NWK Update ID TLV.
1407 * @param tvb pointer to buffer containing raw packet
1408 * @param pinfo pointer to packet information fields
1409 * @param tree pointer to subtree
1410 * @param offset offset into the tvb to begin dissection
1411 * @return offset after dissection
1414 static unsigned dissect_zbee_tlv_nwk_upd_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1416 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_nwk_upd_id, tvb, offset, 1, ENC_NA);
1417 offset += 1;
1419 return offset;
1423 * Dissector NWK Active Key Seq Number TLV.
1425 * @param tvb pointer to buffer containing raw packet
1426 * @param pinfo pointer to packet information fields
1427 * @param tree pointer to subtree
1428 * @param offset offset into the tvb to begin dissection
1429 * @return offset after dissection
1432 static unsigned dissect_zbee_tlv_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1434 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_key_seq_num, tvb, offset, 1, ENC_NA);
1435 offset += 1;
1437 return offset;
1441 * Dissector Admin Key TLV.
1443 * @param tvb pointer to buffer containing raw packet
1444 * @param pinfo pointer to packet information fields
1445 * @param tree pointer to subtree
1446 * @param offset offset into the tvb to begin dissection
1447 * @return offset after dissection
1450 static unsigned dissect_zbee_tlv_adm_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1452 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_adm_key, tvb, offset, 16, ENC_NA);
1453 offset += 16;
1455 return offset;
1459 * Dissector (Manager Joiners) Provisional Link Key TLV.
1461 * @param tvb pointer to buffer containing raw packet
1462 * @param pinfo pointer to packet information fields
1463 * @param tree pointer to subtree
1464 * @param offset offset into the tvb to begin dissection
1465 * @return offset after dissection
1468 static unsigned dissect_zbee_tlv_mj_prov_lnk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1470 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_mj_prov_lnk_key, tvb, offset, 16, ENC_NA);
1471 offset += 16;
1473 return offset;
1477 * Dissector (Manager Joiners) IEEE Address TLV.
1479 * @param tvb pointer to buffer containing raw packet
1480 * @param pinfo pointer to packet information fields
1481 * @param tree pointer to subtree
1482 * @param offset offset into the tvb to begin dissection
1483 * @return offset after dissection
1486 static unsigned dissect_zbee_tlv_mj_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1488 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_mj_ieee_addr, tvb, offset, 8, ENC_NA);
1489 offset += 8;
1491 return offset;
1495 * Dissector (Manager Joiners) Command TLV.
1497 * @param tvb pointer to buffer containing raw packet
1498 * @param pinfo pointer to packet information fields
1499 * @param tree pointer to subtree
1500 * @param offset offset into the tvb to begin dissection
1501 * @return offset after dissection
1504 static unsigned dissect_zbee_tlv_mj_cmd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1506 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_mj_cmd, tvb, offset, 1, ENC_NA);
1507 offset += 1;
1509 return offset;
1513 * Dissector Channel List TLV.
1515 * @param tvb pointer to buffer containing raw packet
1516 * @param pinfo pointer to packet information fields
1517 * @param tree pointer to subtree
1518 * @param offset offset into the tvb to begin dissection
1519 * @return offset after dissection
1521 static unsigned
1522 dissect_zbee_tlv_nwk_channel_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1524 uint32_t count = 0;
1526 proto_tree_add_item_ret_uint(tree, hf_zbee_tlv_local_comm_channel_page_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &count);
1527 offset += 1;
1529 for (unsigned i = 0; i < count; i++)
1531 offset = dissect_zbee_tlv_chanmask(tree, tvb, offset, hf_zbee_tlv_local_comm_channel_page, hf_zbee_tlv_local_comm_channel_mask);
1534 return offset;
1538 * Dissector Link Key TLV.
1540 * @param tvb pointer to buffer containing raw packet
1541 * @param pinfo pointer to packet information fields
1542 * @param tree pointer to subtree
1543 * @param offset offset into the tvb to begin dissection
1544 * @return offset after dissection
1546 static unsigned
1547 dissect_zbee_tlv_link_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1549 static int * const link_key_flags[] = {
1550 &hf_zbee_tlv_local_comm_link_key_flags_unique,
1551 &hf_zbee_tlv_local_comm_link_key_flags_provisional,
1552 NULL
1555 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_local_comm_link_key_flags, ett_zbee_tlv_link_key_flags, link_key_flags, ENC_NA);
1556 offset += 1;
1558 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_link_key, tvb, offset, 16, ENC_NA);
1559 offset += 16;
1561 return offset;
1565 * Dissector NWK Status Map TLV.
1567 * @param tvb pointer to buffer containing raw packet
1568 * @param pinfo pointer to packet information fields
1569 * @param tree pointer to subtree
1570 * @param offset offset into the tvb to begin dissection
1571 * @return offset after dissection
1573 static unsigned
1574 dissect_zbee_tlv_nwk_status_map(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1576 uint8_t mask;
1577 unsigned joined, opened, centralized;
1579 static int * const network_status_map[] = {
1580 &hf_zbee_tlv_local_comm_network_status_map_joined_status,
1581 &hf_zbee_tlv_local_comm_network_status_map_open_status,
1582 &hf_zbee_tlv_network_status_map_network_type,
1583 NULL
1586 mask = tvb_get_uint8(tvb, offset);
1587 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_local_comm_network_status_map, ett_zbee_tlv_network_status_map, network_status_map, ENC_LITTLE_ENDIAN);
1589 offset += 1;
1591 joined = (mask & ZBEE_TLV_STATUS_MAP_JOINED_STATUS) >> 0;
1592 opened = (mask & ZBEE_TLV_STATUS_MAP_OPEN_STATUS) >> 3;
1593 centralized = (mask & ZBEE_TLV_STATUS_MAP_NETWORK_TYPE) >> 4;
1596 if (joined == ZB_DIRECT_JOINED_STATUS_JOINED || joined == ZB_DIRECT_JOINED_STATUS_JOINED_NO_PARENT)
1598 col_append_fstr(pinfo->cinfo,
1599 COL_INFO,
1600 " (%s, %s, %s)",
1601 zbee_tlv_local_types_joined_status_str[joined].strptr,
1602 opened ? "Opened" : "Closed",
1603 centralized ? "Centralized" : "Distributed");
1605 else
1607 col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", zbee_tlv_local_types_joined_status_str[joined].strptr);
1610 return offset;
1614 * Dissector Status Code TLV.
1616 * @param tvb pointer to buffer containing raw packet
1617 * @param pinfo pointer to packet information fields
1618 * @param tree pointer to subtree
1619 * @param offset offset into the tvb to begin dissection
1620 * @return offset after dissection
1622 static unsigned
1623 dissect_zbee_tlv_status_code(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1625 uint32_t code;
1626 proto_item *code_item;
1628 proto_tree_add_item(tree, hf_zbee_tlv_local_comm_status_code_domain, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1629 offset += 1;
1631 code_item = proto_tree_add_item_ret_uint(tree, hf_zbee_tlv_local_comm_status_code_value, tvb, offset, 1, ENC_LITTLE_ENDIAN, &code);
1632 offset += 1;
1634 proto_item_append_text(code_item, " (%s)", (code == 0) ? "Success" : "Failure");
1636 return offset;
1640 * Helper dissector for Tunneling.
1642 * @param tvb pointer to buffer containing raw packet
1643 * @param pinfo pointer to packet information fields
1644 * @param tree pointer to subtree
1645 * @return offset after dissection
1647 static unsigned
1648 dissect_zbee_tlv_tunneling_npdu_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset,
1649 uint8_t length)
1651 uint32_t npdu_len = 0;
1653 /* Parse NPDU Message TLV */
1655 proto_item *npdu_flags_item = proto_tree_add_item(tree, hf_zbee_tlv_local_tunneling_npdu_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1656 proto_tree *npdu_flags_tree = proto_item_add_subtree(npdu_flags_item, ett_zbee_tlv_zbd_tunneling_npdu_flags);
1657 bool secur;
1659 proto_tree_add_item_ret_boolean(npdu_flags_tree, hf_zbee_tlv_local_tunneling_npdu_flags_security, tvb, offset, 1, ENC_LITTLE_ENDIAN, &secur);
1660 proto_tree_add_item_ret_uint(tree, hf_zbee_tlv_local_tunneling_npdu_length, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN, &npdu_len);
1662 proto_item_append_text(npdu_flags_item, ", Security: %s", secur ? "True" : "False");
1663 proto_tree_add_item(npdu_flags_tree, hf_zbee_tlv_local_tunneling_npdu_flags_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1666 /* Proceed with NPDU that holds a Zigbee NWK frame */
1668 proto_item *npdu_item = proto_tree_add_item(tree, hf_zbee_tlv_local_tunneling_npdu, tvb, offset + 2, npdu_len, ENC_NA);
1669 proto_tree *npdu_tree = proto_item_add_subtree(npdu_item, ett_zbee_tlv_zbd_tunneling_npdu);
1671 ieee802154_packet packet;
1672 memset(&packet, 0, sizeof(packet));
1674 call_dissector_with_data(zbee_nwk_handle,
1675 tvb_new_subset_length(tvb, offset + 2, npdu_len),
1676 pinfo,
1677 npdu_tree,
1678 &packet);
1681 offset += length;
1683 return offset;
1687 * Checks a curve, that was selected in the method.
1689 * @param tvb pointer to buffer containing raw packet
1690 * @param pinfo pointer to packet information fields
1691 * @param tree pointer to the command subtree
1692 * @param offset offset into the tvb to begin dissection
1693 * @return offset after command dissection
1695 static unsigned
1696 dissect_zbee_tlv_key_neg_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1698 proto_tree_add_item(tree, hf_zbee_tlv_local_selected_key_method, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1699 offset += 1;
1701 proto_tree_add_item(tree, hf_zbee_tlv_local_selected_psk_secret, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1702 offset += 1;
1704 return offset;
1708 * Helper dissector for the MAC tag.
1710 * @param tvb pointer to buffer containing raw packet
1711 * @param pinfo pointer to packet information fields
1712 * @param tree pointer to the command subtree
1713 * @param offset offset into the tvb to begin dissection
1714 * @return offset after command dissection
1716 static unsigned
1717 dissect_zbee_tlv_mac_tag(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t mac_tag_size)
1719 proto_tree_add_item(tree, hf_zbee_tlv_local_mac_tag, tvb, offset, mac_tag_size, ENC_NA);
1720 offset += mac_tag_size;
1722 return offset;
1726 * Helper dissector for the NWK key sequence number.
1728 * @param tvb pointer to buffer containing raw packet
1729 * @param pinfo pointer to packet information fields
1730 * @param tree pointer to the command subtree
1731 * @param offset offset into the tvb to begin dissection
1732 * @return offset after command dissection
1734 static unsigned
1735 dissect_zbee_tlv_nwk_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1737 proto_tree_add_item(tree, hf_zbee_tlv_local_nwk_key_seq_num, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1738 offset += 1;
1740 return offset;
1744 *Helper dissector for the ZB Direct Status.
1746 *@param tvb pointer to buffer containing raw packet.
1747 *@param pinfo pointer to packet information fields
1748 *@param tree pointer to the command subtree.
1749 *@param offset into the tvb to begin dissection.
1750 *@return offset after command dissection.
1752 static unsigned
1753 dissect_zbd_msg_status_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1755 uint8_t type;
1756 uint8_t length;
1758 type = tvb_get_uint8(tvb, offset);
1759 proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_tlv, tvb, offset, 1, ENC_NA);
1760 offset += 1;
1762 length = tvb_get_uint8(tvb, offset);
1763 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1764 offset += 1;
1766 length += 1;
1768 switch (type)
1770 case ZBEE_TLV_TYPE_COMM_IEEE_ADDR:
1771 offset = dissect_zbee_tlv_ieee_addr(tvb, pinfo, tree, offset);
1772 break;
1774 case ZBEE_TLV_TYPE_COMM_NWK_STATUS_MAP:
1775 offset = dissect_zbee_tlv_nwk_status_map(tvb, pinfo, tree, offset);
1776 break;
1778 case ZBEE_TLV_TYPE_COMM_TC_ADDR:
1779 offset = dissect_zbee_tlv_tc_addr(tvb, pinfo, tree, offset);
1780 break;
1782 case ZBEE_TLV_TYPE_COMM_EXT_PAN_ID:
1783 offset = dissect_zbee_tlv_ext_pan_id(tvb, pinfo, tree, offset);
1784 break;
1786 case ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID:
1787 offset = dissect_zbee_tlv_short_pan_id(tvb, pinfo, tree, offset);
1788 break;
1790 case ZBEE_TLV_TYPE_COMM_NWK_CH:
1791 offset = dissect_zbee_tlv_nwk_channel_list(tvb, pinfo, tree, offset);
1792 break;
1794 case ZBEE_TLV_TYPE_COMM_NWK_KEY:
1795 offset = dissect_zbee_tlv_nwk_key(tvb, pinfo, tree, offset);
1796 break;
1798 case ZBEE_TLV_TYPE_COMM_NWK_ADDR:
1799 offset = dissect_zbee_tlv_nwk_addr(tvb, pinfo, tree, offset);
1800 break;
1802 case ZBEE_TLV_TYPE_COMM_NWK_UPD_ID:
1803 offset = dissect_zbee_tlv_nwk_upd_id(tvb, pinfo, tree, offset);
1804 break;
1806 case ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM:
1807 offset = dissect_zbee_tlv_key_seq_num(tvb, pinfo, tree, offset);
1808 break;
1810 case ZBEE_TLV_TYPE_COMM_DEV_TYPE:
1811 offset = dissect_zbee_tlv_dev_type(tvb, pinfo, tree, offset);
1812 break;
1814 case ZBEE_TLV_TYPE_COMM_STATUS_CODE:
1815 offset = dissect_zbee_tlv_status_code(tvb, pinfo, tree, offset);
1816 break;
1818 default:
1819 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1820 offset += length;
1821 break;
1824 return offset;
1828 *Helper dissector for the ZB Direct Tunneling.
1830 *@param tvb pointer to buffer containing raw packet.
1831 *@param pinfo pointer to packet information fields
1832 *@param tree pointer to the command subtree.
1833 *@param offset into the tvb to begin dissection.
1834 *@return offset after command dissection.
1836 static unsigned
1837 dissect_zbd_msg_tunneling_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1839 uint8_t opcode = tvb_get_uint8(tvb, offset);
1840 uint8_t length;
1842 proto_tree_add_item(tree, hf_zbee_tlv_zbd_tunneling_npdu_msg_tlv, tvb, offset, 1, ENC_NA);
1843 offset += 1;
1845 length = tvb_get_uint8(tvb, offset);
1846 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1847 offset += 1;
1849 length += 1;
1851 switch (opcode)
1853 case ZBEE_TLV_TYPE_TUNNELING_NPDU_MESSAGE:
1855 col_set_fence(pinfo->cinfo, COL_PROTOCOL);
1856 offset = dissect_zbee_tlv_tunneling_npdu_msg(tvb, pinfo, tree, offset, length);
1857 break;
1860 default:
1861 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1862 offset += length;
1863 break;
1866 return offset;
1870 *Helper dissector for the ZB Direct Manage Joiners.
1872 *@param tvb pointer to buffer containing raw packet.
1873 *@param pinfo pointer to packet information fields
1874 *@param tree pointer to the command subtree.
1875 *@param offset into the tvb to begin dissection.
1876 *@return offset after command dissection.
1878 static unsigned
1879 dissect_zbd_msg_manage_joiners_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1881 uint8_t type;
1882 uint8_t length;
1884 type = tvb_get_uint8(tvb, offset);
1886 proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_mj_cmd_tlv, tvb, offset, 1, ENC_NA);
1887 offset += 1;
1889 length = tvb_get_uint8(tvb, offset);
1890 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1891 offset += 1;
1893 length += 1;
1895 switch (type)
1897 case ZBEE_TLV_TYPE_COMM_MJ_CMD:
1898 offset = dissect_zbee_tlv_mj_cmd(tvb, pinfo, tree, offset);
1899 break;
1901 case ZBEE_TLV_TYPE_COMM_MJ_IEEE_ADDR:
1902 offset = dissect_zbee_tlv_mj_ieee_addr(tvb, pinfo, tree, offset);
1903 break;
1905 case ZBEE_TLV_TYPE_COMM_MJ_PROVISIONAL_LINK_KEY:
1906 offset = dissect_zbee_tlv_mj_prov_lnk_key(tvb, pinfo, tree, offset);
1907 break;
1909 default:
1910 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1911 offset += length;
1912 break;
1915 return offset;
1919 *Helper dissector for the ZB Direct Direct Join.
1921 *@param tvb pointer to buffer containing raw packet.
1922 *@param pinfo pointer to packet information fields
1923 *@param tree pointer to the command subtree.
1924 *@param offset into the tvb to begin dissection.
1925 *@return offset after command dissection.
1927 static unsigned
1928 dissect_zbd_msg_join_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1930 uint8_t type;
1931 uint8_t length;
1933 type = tvb_get_uint8(tvb, offset);
1934 proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_tlv, tvb, offset, 1, ENC_NA);
1935 offset += 1;
1937 length = tvb_get_uint8(tvb, offset);
1938 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1939 offset += 1;
1941 length += 1;
1943 switch (type)
1945 case ZBEE_TLV_TYPE_COMM_JOIN_METHOD:
1946 offset = dissect_zbee_tlv_join_method(tvb, pinfo, tree, offset);
1947 break;
1949 case ZBEE_TLV_TYPE_COMM_ADMIN_KEY:
1950 offset = dissect_zbee_tlv_adm_key(tvb, pinfo, tree, offset);
1951 break;
1953 case ZBEE_TLV_TYPE_COMM_TC_ADDR:
1954 offset = dissect_zbee_tlv_tc_addr(tvb, pinfo, tree, offset);
1955 break;
1957 case ZBEE_TLV_TYPE_COMM_EXT_PAN_ID:
1958 offset = dissect_zbee_tlv_ext_pan_id(tvb, pinfo, tree, offset);
1959 break;
1961 case ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID:
1962 offset = dissect_zbee_tlv_short_pan_id(tvb, pinfo, tree, offset);
1963 break;
1965 case ZBEE_TLV_TYPE_COMM_NWK_CH:
1966 offset = dissect_zbee_tlv_nwk_channel_list(tvb, pinfo, tree, offset);
1967 break;
1969 case ZBEE_TLV_TYPE_COMM_NWK_KEY:
1970 offset = dissect_zbee_tlv_nwk_key(tvb, pinfo, tree, offset);
1971 break;
1973 case ZBEE_TLV_TYPE_COMM_LNK_KEY:
1974 offset = dissect_zbee_tlv_link_key(tvb, pinfo, tree, offset);
1975 break;
1977 case ZBEE_TLV_TYPE_COMM_NWK_ADDR:
1978 offset = dissect_zbee_tlv_nwk_addr(tvb, pinfo, tree, offset);
1979 break;
1981 case ZBEE_TLV_TYPE_COMM_NWK_UPD_ID:
1982 offset = dissect_zbee_tlv_nwk_upd_id(tvb, pinfo, tree, offset);
1983 break;
1985 case ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM:
1986 offset = dissect_zbee_tlv_key_seq_num(tvb, pinfo, tree, offset);
1987 break;
1989 default:
1990 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1991 offset += length;
1992 break;
1995 return offset;
1999 *Helper dissector for the ZB Direct Formation.
2001 *@param tvb pointer to buffer containing raw packet.
2002 *@param pinfo pointer to packet information fields
2003 *@param tree pointer to the command subtree.
2004 *@param offset into the tvb to begin dissection.
2005 *@return offset after command dissection.
2007 static unsigned
2008 dissect_zbd_msg_formation_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2010 uint8_t type;
2011 uint8_t length;
2013 type = tvb_get_uint8(tvb, offset);
2014 proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_tlv, tvb, offset, 1, ENC_NA);
2015 offset += 1;
2017 length = tvb_get_uint8(tvb, offset);
2018 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2019 offset += 1;
2021 length += 1;
2023 switch (type)
2025 case ZBEE_TLV_TYPE_COMM_ADMIN_KEY:
2026 offset = dissect_zbee_tlv_adm_key(tvb, pinfo, tree, offset);
2027 break;
2029 case ZBEE_TLV_TYPE_COMM_TC_ADDR:
2030 offset = dissect_zbee_tlv_tc_addr(tvb, pinfo, tree, offset);
2031 break;
2033 case ZBEE_TLV_TYPE_COMM_EXT_PAN_ID:
2034 offset = dissect_zbee_tlv_ext_pan_id(tvb, pinfo, tree, offset);
2035 break;
2037 case ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID:
2038 offset = dissect_zbee_tlv_short_pan_id(tvb, pinfo, tree, offset);
2039 break;
2041 case ZBEE_TLV_TYPE_COMM_NWK_CH:
2042 offset = dissect_zbee_tlv_nwk_channel_list(tvb, pinfo, tree, offset);
2043 break;
2045 case ZBEE_TLV_TYPE_COMM_NWK_KEY:
2046 offset = dissect_zbee_tlv_nwk_key(tvb, pinfo, tree, offset);
2047 break;
2049 case ZBEE_TLV_TYPE_COMM_LNK_KEY:
2050 offset = dissect_zbee_tlv_link_key(tvb, pinfo, tree, offset);
2051 break;
2053 case ZBEE_TLV_TYPE_COMM_NWK_ADDR:
2054 offset = dissect_zbee_tlv_nwk_addr(tvb, pinfo, tree, offset);
2055 break;
2057 case ZBEE_TLV_TYPE_COMM_NWK_UPD_ID:
2058 offset = dissect_zbee_tlv_nwk_upd_id(tvb, pinfo, tree, offset);
2059 break;
2061 case ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM:
2062 offset = dissect_zbee_tlv_key_seq_num(tvb, pinfo, tree, offset);
2063 break;
2065 default:
2066 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2067 offset += length;
2068 break;
2071 return offset;
2075 *Helper dissector for the ZB Direct Security Messages.
2077 *@param tvb pointer to buffer containing raw packet.
2078 *@param pinfo pointer to packet information fields
2079 *@param tree pointer to the command subtree.
2080 *@param offset into the tvb to begin dissection.
2081 *@return offset after command dissection.
2083 static unsigned
2084 dissect_zbd_msg_secur_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2086 uint8_t type;
2087 uint8_t length;
2089 type = tvb_get_uint8(tvb, offset);
2090 proto_tree_add_item(tree, hf_zbee_tlv_zbd_secur_tlv, tvb, offset, 1, ENC_NA);
2091 offset += 1;
2093 length = tvb_get_uint8(tvb, offset);
2094 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2095 offset += 1;
2097 length += 1;
2099 switch (type)
2101 case ZBEE_TLV_TYPE_KEY_METHOD:
2102 offset = dissect_zbee_tlv_key_neg_method(tvb, pinfo, tree, offset);
2103 break;
2105 case ZBEE_TLV_TYPE_PUB_POINT_P256:
2106 case ZBEE_TLV_TYPE_PUB_POINT_C25519:
2107 offset = dissect_zbee_tlv_public_point(tvb, pinfo, tree, offset, length);
2108 break;
2110 case ZBEE_TLV_TYPE_NWK_KEY_SEQ_NUM:
2111 offset = dissect_zbee_tlv_nwk_key_seq_num(tvb, pinfo, tree, offset);
2112 break;
2114 case ZBEE_TLV_TYPE_MAC_TAG:
2115 offset = dissect_zbee_tlv_mac_tag(tvb, pinfo, tree, offset, length);
2116 break;
2118 default:
2119 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2120 offset += length;
2121 break;
2124 return offset;
2128 *Helper dissector for the ZD Direct messages.
2130 *@param tvb pointer to buffer containing raw packet
2131 *@param pinfo pointer to packet information fields
2132 *@param tree pointer to the command subtree
2133 *@param offset into the tvb to begin dissection
2134 *@param cmd_id - ZB Direct local Message ID
2135 *@return offset after command dissection
2137 static unsigned
2138 dissect_zbd_local_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset, void* data _U_, unsigned cmd_id)
2140 uint8_t total_tlv_length = 2 /*type + len fields*/ + tvb_get_uint8(tvb, offset + 1) + 1;
2141 uint8_t tmp_offset = offset;
2143 switch (cmd_id)
2145 case ZB_DIRECT_MSG_ID_STATUS:
2146 offset = dissect_zbd_msg_status_local_tlv(tvb, pinfo, tree, offset);
2147 break;
2149 case ZB_DIRECT_MSG_ID_TUNNELING:
2150 offset = dissect_zbd_msg_tunneling_local_tlv(tvb, pinfo, tree, offset);
2151 break;
2153 case ZB_DIRECT_MSG_ID_MANAGE_JOINERS:
2154 offset = dissect_zbd_msg_manage_joiners_local_tlv(tvb, pinfo, tree, offset);
2155 break;
2157 case ZB_DIRECT_MSG_ID_JOIN:
2158 offset = dissect_zbd_msg_join_local_tlv(tvb, pinfo, tree, offset);
2159 break;
2161 case ZB_DIRECT_MSG_ID_FORMATION:
2162 offset = dissect_zbd_msg_formation_local_tlv(tvb, pinfo, tree, offset);
2163 break;
2165 case ZB_DIRECT_MSG_ID_SECUR_C25519_AESMMO:
2166 case ZB_DIRECT_MSG_ID_SECUR_C25519_SHA256:
2167 case ZB_DIRECT_MSG_ID_SECUR_P256:
2168 offset = dissect_zbd_msg_secur_local_tlv(tvb, pinfo, tree, offset);
2169 break;
2171 default:
2172 offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
2173 break;
2176 /* check extra bytes */
2177 if ((offset - tmp_offset) < total_tlv_length)
2179 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, total_tlv_length - 2, ENC_NA);
2180 offset = tmp_offset + total_tlv_length;
2183 return offset;
2187 * *Dissector for Zigbee Manufacturer Specific Global TLV
2189 *@param tvb pointer to buffer containing raw packet.
2190 *@param pinfo pointer to packet information fields
2191 *@param tree pointer to data tree Wireshark uses to display packet.
2192 *@param offset into the tvb to begin dissection.
2193 *@param length of TLV data
2194 *@return offset after command dissection.
2196 static unsigned
2197 dissect_zbee_tlv_manufacturer_specific(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t length)
2199 proto_tree_add_item(tree, hf_zbee_tlv_manufacturer_specific, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2200 offset += 2;
2202 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length - 2, ENC_NA);
2203 offset += length - 2;
2205 return offset;
2206 } /* dissect_zbee_tlv_manufacturer_specific */
2209 *Dissector for Zigbee Supported Key Negotiation Methods Global TLV
2211 *@param tvb pointer to buffer containing raw packet.
2212 *@param pinfo pointer to packet information fields
2213 *@param tree pointer to data tree Wireshark uses to display packet.
2214 *@param offset into the tvb to begin dissection.
2215 *@return offset after command dissection.
2217 static unsigned
2218 dissect_zbee_tlv_supported_key_negotiation_methods(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2220 static int * const supported_key_negotiation_methods[] = {
2221 &hf_zbee_tlv_supported_key_negotiation_methods_key_request,
2222 &hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_aes_mmo128,
2223 &hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_sha256,
2224 NULL
2227 static int * const supported_secrets[] = {
2228 &hf_zbee_tlv_supported_preshared_secrets_auth_token,
2229 &hf_zbee_tlv_supported_preshared_secrets_ic,
2230 &hf_zbee_tlv_supported_preshared_secrets_passcode_pake,
2231 &hf_zbee_tlv_supported_preshared_secrets_basic_access_key,
2232 &hf_zbee_tlv_supported_preshared_secrets_admin_access_key,
2233 NULL
2236 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_supported_key_negotiation_methods, ett_zbee_tlv_supported_key_negotiation_methods, supported_key_negotiation_methods, ENC_NA);
2237 offset += 1;
2239 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_supported_secrets, ett_zbee_tlv_supported_secrets, supported_secrets, ENC_NA);
2240 offset += 1;
2242 proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2243 offset += 8;
2245 return offset;
2246 } /* dissect_zbee_tlv_supported_key_negotiation_methods */
2249 *Dissector for Zigbee PAN ID conflict report Global TLV
2251 *@param tvb pointer to buffer containing raw packet.
2252 *@param pinfo pointer to packet information fields
2253 *@param tree pointer to data tree Wireshark uses to display packet.
2254 *@param offset into the tvb to begin dissection.
2255 *@return offset after command dissection.
2257 static unsigned
2258 dissect_zbee_tlv_panid_conflict_report(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2260 proto_tree_add_item(tree, hf_zbee_tlv_panid_conflict_cnt, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2261 offset += 2;
2263 return offset;
2268 * *Dissector for Zigbee Configuration Parameters Global TLV
2270 *@param tvb pointer to buffer containing raw packet.
2271 *@param pinfo pointer to packet information fields
2272 *@param tree pointer to data tree Wireshark uses to display packet.
2273 *@param offset into the tvb to begin dissection.
2274 *@return offset after command dissection.
2276 static unsigned
2277 dissect_zbee_tlv_configuration_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2279 static int * const bitmask[] = {
2280 &hf_zbee_tlv_configuration_param_restricted_mode,
2281 &hf_zbee_tlv_configuration_param_link_key_enc,
2282 &hf_zbee_tlv_configuration_param_leave_req_allowed,
2283 NULL
2286 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_configuration_param, ett_zbee_tlv_configuration_param, bitmask, ENC_LITTLE_ENDIAN);
2287 offset += 2;
2289 return offset;
2290 } /* dissect_zbee_tlv_configuration_parameters */
2294 * *Dissector for Zigbee Configuration Parameters Global TLV
2296 *@param tvb pointer to buffer containing raw packet.
2297 *@param pinfo pointer to packet information fields
2298 *@param tree pointer to data tree Wireshark uses to display packet.
2299 *@param offset into the tvb to begin dissection.
2300 *@return offset after command dissection.
2302 static unsigned
2303 dissect_zbee_tlv_dev_cap_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2305 static int * const bitmask[] = {
2306 &hf_zbee_tlv_dev_cap_ext_zbdirect_virt_device,
2307 NULL
2310 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_dev_cap_ext_capability_information, ett_zbee_tlv_capability_information, bitmask, ENC_LITTLE_ENDIAN);
2311 offset += 2;
2313 return offset;
2314 } /* dissect_zbee_tlv_configuration_parameters */
2317 * *Dissector for Zigbee CPotential Parents Global TLV
2319 *@param tvb pointer to buffer containing raw packet.
2320 *@param pinfo pointer to packet information fields
2321 *@param tree pointer to data tree Wireshark uses to display packet.
2322 *@param offset into the tvb to begin dissection.
2323 *@return offset after command dissection.
2325 static unsigned
2326 dissect_zbee_tlv_potential_parents(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2328 uint8_t count, i;
2330 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_current_parent, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2331 offset += 2;
2333 proto_tree_add_item(tree, hf_zbee_tlv_lqa, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2334 offset += 1;
2336 count = tvb_get_uint8(tvb, offset);
2337 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_cnt_parents, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2338 offset += 1;
2340 for (i = 0; i < count; i++)
2342 proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_parent, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2343 offset += 2;
2345 proto_tree_add_item(tree, hf_zbee_tlv_lqa, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2346 offset += 1;
2349 return offset;
2353 * *Dissector for Zigbee Next PAN ID Change Global TLV
2355 *@param tvb pointer to buffer containing raw packet.
2356 *@param pinfo pointer to packet information fields
2357 *@param tree pointer to data tree Wireshark uses to display packet.
2358 *@param offset into the tvb to begin dissection.
2359 *@return offset after command dissection.
2361 static unsigned
2362 dissect_zbee_tlv_next_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2364 proto_tree_add_item(tree, hf_zbee_tlv_next_pan_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2365 offset += 2;
2367 return offset;
2368 } /* dissect_zbee_tlv_next_pan_id */
2371 * *Dissector for Zigbee Next Channel Change Global TLV
2373 *@param tvb pointer to buffer containing raw packet.
2374 *@param pinfo pointer to packet information fields
2375 *@param tree pointer to data tree Wireshark uses to display packet.
2376 *@param offset into the tvb to begin dissection.
2377 *@return offset after command dissection.
2379 static unsigned
2380 dissect_zbee_tlv_next_channel_change(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2382 /* todo: fix this (do channel mask) */
2383 proto_tree_add_item(tree, hf_zbee_tlv_next_channel_change, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2384 offset += 4;
2386 return offset;
2387 } /* dissect_zbee_tlv_next_channel_change */
2390 * *Dissector for Zigbee Passphrase Global TLV
2392 *@param tvb pointer to buffer containing raw packet.
2393 *@param pinfo pointer to packet information fields
2394 *@param tree pointer to data tree Wireshark uses to display packet.
2395 *@param offset into the tvb to begin dissection.
2396 *@return offset after command dissection.
2398 static unsigned
2399 dissect_zbee_tlv_passphrase(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2401 proto_tree_add_item(tree, hf_zbee_tlv_passphrase, tvb, offset, 16, ENC_NA);
2402 offset += 16;
2404 return offset;
2405 } /* dissect_zbee_tlv_passphrase */
2409 * *Dissector for Zigbee Router Information Global TLV
2411 *@param tvb pointer to buffer containing raw packet.
2412 *@param pinfo pointer to packet information fields
2413 *@param tree pointer to data tree Wireshark uses to display packet.
2414 *@param offset into the tvb to begin dissection.
2415 *@return offset after command dissection.
2417 static unsigned
2418 dissect_zbee_tlv_router_information(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2420 static int * const router_information[] = {
2421 &hf_zbee_tlv_router_information_hub_connectivity,
2422 &hf_zbee_tlv_router_information_uptime,
2423 &hf_zbee_tlv_router_information_pref_parent,
2424 &hf_zbee_tlv_router_information_battery_backup,
2425 &hf_zbee_tlv_router_information_enhanced_beacon_request_support,
2426 &hf_zbee_tlv_router_information_mac_data_poll_keepalive_support,
2427 &hf_zbee_tlv_router_information_end_device_keepalive_support,
2428 &hf_zbee_tlv_router_information_power_negotiation_support,
2429 NULL
2432 proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_router_information, ett_zbee_tlv_router_information, router_information, ENC_LITTLE_ENDIAN);
2433 offset += 2;
2435 return offset;
2436 } /* dissect_zbee_tlv_router_information */
2439 * *Dissector for Zigbee Fragmentation Parameters Global TLV
2441 *@param tvb pointer to buffer containing raw packet.
2442 *@param pinfo pointer to packet information fields
2443 *@param tree pointer to data tree Wireshark uses to display packet.
2444 *@param offset into the tvb to begin dissection.
2445 *@return offset after command dissection.
2447 static unsigned
2448 dissect_zbee_tlv_fragmentation_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2450 proto_tree_add_item(tree, hf_zbee_tlv_node_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2451 offset += 2;
2453 proto_tree_add_item(tree, hf_zbee_tlv_frag_opt, tvb, offset, 1, ENC_NA);
2454 offset += 1;
2456 proto_tree_add_item(tree, hf_zbee_tlv_max_reassembled_buf_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2457 offset += 2;
2459 return offset;
2460 } /* dissect_zbee_tlv_fragmentation_parameters */
2463 *Dissector for Zigbee Selected Key Negotiation Methods TLV
2465 *@param tvb pointer to buffer containing raw packet.
2466 *@param pinfo pointer to packet information fields
2467 *@param tree pointer to data tree Wireshark uses to display packet.
2468 *@param offset into the tvb to begin dissection.
2469 *@return offset after command dissection.
2471 static unsigned
2472 dissect_zbee_tlv_selected_key_negotiation_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2474 proto_tree_add_item(tree, hf_zbee_tlv_selected_key_negotiation_method, tvb, offset, 1, ENC_NA);
2475 offset += 1;
2477 proto_tree_add_item(tree, hf_zbee_tlv_selected_pre_shared_secret, tvb, offset, 1, ENC_NA);
2478 offset += 1;
2480 proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2481 offset += 8;
2483 return offset;
2484 } /* dissect_zbee_tlv_selected_key_negotiation_methods */
2488 *Dissector for Public Point TLVs
2490 *@param tvb pointer to buffer containing raw packet.
2491 *@param pinfo pointer to packet information fields
2492 *@param tree pointer to data tree Wireshark uses to display packet.
2493 *@param offset into the tvb to begin dissection.
2494 *@return offset after command dissection.
2496 static unsigned
2497 dissect_zbee_tlv_public_point(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t length)
2499 uint8_t public_point_length = length - 8;
2501 proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2502 offset += 8;
2504 proto_tree_add_item(tree, hf_zbee_tlv_public_point, tvb, offset, public_point_length, ENC_NA);
2505 offset += public_point_length;
2507 return offset;
2508 } /* dissect_zbee_tlv_curve25519_public_point */
2511 *Dissector for Security Decommission Req EUI64 TLV
2513 *@param tvb pointer to buffer containing raw packet.
2514 *@param pinfo pointer to packet information fields
2515 *@param tree pointer to data tree Wireshark uses to display packet.
2516 *@param offset into the tvb to begin dissection.
2517 *@return offset after command dissection.
2519 static unsigned
2520 dissect_zbee_tlv_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2522 uint8_t eui64_count;
2523 uint8_t i;
2525 eui64_count = tvb_get_uint8(tvb, offset);
2526 proto_tree_add_item(tree, hf_zbee_tlv_count, tvb, offset, 1, ENC_NA);
2527 offset += 1;
2529 for (i = 0; i < eui64_count; i++)
2531 proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2532 offset += 8;
2535 return offset;
2539 *Dissector for Clear All Bindings Req EUI64 TLV
2541 *@param tvb pointer to buffer containing raw packet.
2542 *@param pinfo pointer to packet information fields
2543 *@param tree pointer to data tree Wireshark uses to display packet.
2544 *@param offset into the tvb to begin dissection.
2545 *@return offset after command dissection.
2547 static unsigned
2548 dissect_zbee_tlv_clear_all_bindigs_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2550 return dissect_zbee_tlv_eui64(tvb, pinfo, tree, offset);
2554 *Dissector for Requested Authentication Token ID TLV
2556 *@param tvb pointer to buffer containing raw packet.
2557 *@param pinfo pointer to packet information fields
2558 *@param tree pointer to data tree Wireshark uses to display packet.
2559 *@param offset into the tvb to begin dissection.
2560 *@return offset after command dissection.
2562 static unsigned
2563 dissect_zbee_tlv_requested_auth_token_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2565 proto_tree_add_item(tree, hf_zbee_tlv_global_tlv_id, tvb, offset, 1, ENC_NA);
2566 offset += 1;
2568 return offset;
2572 *Dissector for Target IEEE Address TLV
2574 *@param tvb pointer to buffer containing raw packet.
2575 *@param pinfo pointer to packet information fields
2576 *@param tree pointer to data tree Wireshark uses to display packet.
2577 *@param offset into the tvb to begin dissection.
2578 *@return offset after command dissection.
2580 static unsigned
2581 dissect_zbee_tlv_target_ieee_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2583 proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2584 offset += 8;
2586 return offset;
2590 * *Dissector for Device Authentication Level TLV
2592 *@param tvb pointer to buffer containing raw packet.
2593 *@param pinfo pointer to packet information fields
2594 *@param tree pointer to data tree Wireshark uses to display packet.
2595 *@param offset into the tvb to begin dissection.
2596 *@return offset after command dissection.
2598 static unsigned
2599 dissect_zbee_tlv_device_auth_level(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2602 proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2603 offset += 8;
2605 proto_tree_add_item(tree, hf_zbee_tlv_local_initial_join_method, tvb, offset, 1, ENC_NA);
2606 offset += 1;
2608 proto_tree_add_item(tree, hf_zbee_tlv_local_active_lk_type, tvb, offset, 1, ENC_NA);
2609 offset += 1;
2611 return offset;
2612 } /* dissect_zbee_tlv_device_auth_level */
2615 * ToDo: descr
2617 static unsigned
2618 // NOLINTNEXTLINE(misc-no-recursion)
2619 dissect_global_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2621 uint8_t type;
2622 uint8_t length;
2623 unsigned tmp_offset;
2625 type = tvb_get_uint8(tvb, offset);
2626 proto_tree_add_item(tree, hf_zbee_tlv_global_type, tvb, offset, 1, ENC_NA);
2627 offset += 1;
2629 length = tvb_get_uint8(tvb, offset);
2630 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2631 offset += 1;
2633 length += 1;
2634 tmp_offset = offset;
2635 switch (type) {
2636 case ZBEE_TLV_TYPE_MANUFACTURER_SPECIFIC:
2637 offset = dissect_zbee_tlv_manufacturer_specific(tvb, pinfo, tree, offset, length);
2638 break;
2640 case ZBEE_TLV_TYPE_SUPPORTED_KEY_NEGOTIATION_METHODS:
2641 offset = dissect_zbee_tlv_supported_key_negotiation_methods(tvb, pinfo, tree, offset);
2642 break;
2644 case ZBEE_TLV_TYPE_PANID_CONFLICT_REPORT:
2645 offset = dissect_zbee_tlv_panid_conflict_report(tvb, pinfo, tree, offset);
2646 break;
2648 case ZBEE_TLV_TYPE_NEXT_PAN_ID:
2649 offset = dissect_zbee_tlv_next_pan_id(tvb, pinfo, tree, offset);
2650 break;
2652 case ZBEE_TLV_TYPE_NEXT_CHANNEL_CHANGE:
2653 offset = dissect_zbee_tlv_next_channel_change(tvb, pinfo, tree, offset);
2654 break;
2656 case ZBEE_TLV_TYPE_PASSPHRASE:
2657 offset = dissect_zbee_tlv_passphrase(tvb, pinfo, tree, offset);
2658 break;
2660 case ZBEE_TLV_TYPE_ROUTER_INFORMATION:
2661 offset = dissect_zbee_tlv_router_information(tvb, pinfo, tree, offset);
2662 break;
2664 case ZBEE_TLV_TYPE_FRAGMENTATION_PARAMETERS:
2665 offset = dissect_zbee_tlv_fragmentation_parameters(tvb, pinfo, tree, offset);
2666 break;
2668 case ZBEE_TLV_TYPE_JOINER_ENCAPSULATION_GLOBAL:
2669 offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, NULL, ZBEE_TLV_SRC_TYPE_DEFAULT, 0);
2670 break;
2672 case ZBEE_TLV_TYPE_BEACON_APPENDIX_ENCAPSULATION_GLOBAL:
2673 offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, NULL, ZBEE_TLV_SRC_TYPE_DEFAULT, 0);
2674 break;
2676 case ZBEE_TLV_TYPE_CONFIGURATION_MODE_PARAMETERS:
2677 offset = dissect_zbee_tlv_configuration_parameters(tvb, pinfo, tree, offset);
2678 break;
2680 case ZBEE_TLV_TYPE_DEVICE_CAPABILITY_EXTENSION:
2681 offset = dissect_zbee_tlv_dev_cap_ext(tvb, pinfo, tree, offset);
2682 break;
2684 default:
2685 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2686 offset += length;
2687 break;
2690 /* check extra bytes */
2691 if ((offset - tmp_offset) < length)
2693 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2694 offset = tmp_offset + length;
2697 return offset;
2701 *Dissector for Unknown Zigbee TLV
2703 *@param tvb pointer to buffer containing raw packet.
2704 *@param pinfo pointer to packet information fields
2705 *@param tree pointer to data tree Wireshark uses to display packet.
2706 *@param offset into the tvb to begin dissection.
2707 *@return offset after command dissection.
2709 static unsigned
2710 dissect_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2712 uint8_t length;
2714 proto_tree_add_item(tree, hf_zbee_tlv_type, tvb, offset, 1, ENC_NA);
2715 offset += 1;
2717 length = tvb_get_uint8(tvb, offset);
2718 proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2719 offset += 1;
2721 length += 1; /* length of tlv_val == tlv_len + 1 */
2722 proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2723 offset += length;
2725 return offset;
2729 *Dissector for Zigbee TLV
2731 *@param tvb pointer to buffer containing raw packet.
2732 *@param pinfo pointer to packet information fields
2733 *@param tree pointer to data tree Wireshark uses to display packet.
2734 *@param offset into the tvb to begin dissection.
2735 *@return offset after command dissection.
2737 static unsigned
2738 // NOLINTNEXTLINE(misc-no-recursion)
2739 dissect_zbee_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void *data, uint8_t source_type, unsigned cmd_id)
2741 uint8_t type;
2743 type = tvb_get_uint8(tvb, offset);
2745 if (type >= ZBEE_TLV_GLOBAL_START_NUMBER)
2747 offset = dissect_global_tlv (tvb, pinfo, tree, offset);
2749 else
2751 switch (source_type)
2753 case ZBEE_TLV_SRC_TYPE_ZBEE_ZDP:
2754 offset = dissect_zdp_local_tlv(tvb, pinfo, tree, offset, cmd_id);
2755 break;
2757 case ZBEE_TLV_SRC_TYPE_ZBEE_APS:
2758 offset = dissect_aps_local_tlv(tvb, pinfo, tree, offset, data, cmd_id);
2759 break;
2761 case ZBEE_TLV_SRC_TYPE_ZB_DIRECT:
2762 offset = dissect_zbd_local_tlv(tvb, pinfo, tree, offset, data, cmd_id);
2763 break;
2765 default:
2766 offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
2767 break;
2771 return offset;
2772 } /* dissect_zbee_tlv */
2775 *Dissector for Zigbee TLVs
2777 *@param tvb pointer to buffer containing raw packet.
2778 *@param pinfo pointer to packet information fields
2779 *@param tree pointer to data tree Wireshark uses to display packet.
2780 *@param offset into the tvb to begin dissection.
2781 *@param source_type ToDo:
2782 *@param cmd_id ToDo:
2783 *@return offset after command dissection.
2786 #define ZBEE_TLV_MAX_RECURSION_DEPTH 5 // Arbitrarily chosen
2788 unsigned
2789 // NOLINTNEXTLINE(misc-no-recursion)
2790 dissect_zbee_tlvs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void *data, uint8_t source_type, unsigned cmd_id)
2792 proto_tree *subtree;
2793 uint8_t length;
2794 unsigned recursion_depth = p_get_proto_depth(pinfo, proto_zbee_tlv);
2796 if (++recursion_depth >= ZBEE_TLV_MAX_RECURSION_DEPTH) {
2797 proto_tree_add_expert(tree, pinfo, &ei_zbee_tlv_max_recursion_depth_reached, tvb, 0, 0);
2798 return offset;
2801 p_set_proto_depth(pinfo, proto_zbee_tlv, recursion_depth);
2803 while (tvb_bytes_exist(tvb, offset, ZBEE_TLV_HEADER_LENGTH)) {
2804 length = tvb_get_uint8(tvb, offset + 1) + 1;
2805 subtree = proto_tree_add_subtree(tree, tvb, offset, ZBEE_TLV_HEADER_LENGTH + length, ett_zbee_tlv, NULL, "TLV");
2806 offset = dissect_zbee_tlv(tvb, pinfo, subtree, offset, data, source_type, cmd_id);
2809 recursion_depth = p_get_proto_depth(pinfo, proto_zbee_tlv);
2810 p_set_proto_depth(pinfo, proto_zbee_tlv, recursion_depth - 1);
2812 return offset;
2813 } /* dissect_zbee_tlvs */
2816 * Dissector for ZBEE TLV.
2818 * @param tvb pointer to buffer containing raw packet.
2819 * @param pinfo pointer to packet information fields.
2820 * @param tree pointer to data tree wireshark uses to display packet.
2822 static int
2823 dissect_zbee_tlv_default(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2825 unsigned offset = 0;
2827 offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, data, ZBEE_TLV_SRC_TYPE_DEFAULT, 0);
2829 /* Check for leftover bytes. */
2830 if (offset < tvb_captured_length(tvb)) {
2831 /* Bytes leftover! */
2832 tvbuff_t *leftover_tvb = tvb_new_subset_remaining(tvb, offset);
2833 /* Dump the leftover to the data dissector. */
2834 call_data_dissector(leftover_tvb, pinfo, tree);
2837 return tvb_captured_length(tvb);
2841 * Proto ZBOSS Network Coprocessor product registration routine
2843 void proto_register_zbee_tlv(void)
2845 /* NCP protocol headers */
2846 static hf_register_info hf[] = {
2847 { &hf_zbee_tlv_relay_msg_type,
2848 { "Type", "zbee_tlv.relay.type", FT_UINT8, BASE_HEX, VALS(zbee_aps_relay_tlvs), 0x0, NULL, HFILL }},
2850 { &hf_zbee_tlv_relay_msg_length,
2851 { "Length", "zbee_tlv.relay.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2853 { &hf_zbee_tlv_relay_msg_joiner_ieee,
2854 { "Joiner IEEE", "zbee_tlv.relay.joiner_ieee", FT_EUI64, BASE_NONE, NULL, 0x0,
2855 NULL, HFILL }},
2857 { &hf_zbee_tlv_global_type,
2858 { "Type", "zbee_tlv.type_global", FT_UINT8, BASE_HEX,
2859 VALS(zbee_tlv_global_types), 0x0, NULL, HFILL }},
2861 { &hf_zbee_tlv_local_type_key_update_req_rsp,
2862 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2863 VALS(zbee_tlv_local_types_key_update_req_rsp), 0x0, NULL, HFILL }},
2865 { &hf_zbee_tlv_local_type_key_negotiation_req_rsp,
2866 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2867 VALS(zbee_tlv_local_types_key_negotiation_req_rsp), 0x0, NULL, HFILL }},
2869 { &hf_zbee_tlv_local_type_get_auth_level_rsp,
2870 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2871 VALS(zbee_tlv_local_types_get_auth_level_rsp), 0x0, NULL, HFILL }},
2873 { &hf_zbee_tlv_local_type_clear_all_bindings_req,
2874 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2875 VALS(zbee_tlv_local_types_clear_all_bindings_req), 0x0, NULL, HFILL }},
2877 { &hf_zbee_tlv_local_type_req_security_get_auth_token,
2878 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2879 VALS(zbee_tlv_local_types_req_security_get_auth_token), 0x0, NULL, HFILL }},
2881 { &hf_zbee_tlv_local_type_req_security_get_auth_level,
2882 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2883 VALS(zbee_tlv_local_types_req_security_get_auth_level), 0x0, NULL, HFILL }},
2885 { &hf_zbee_tlv_local_type_req_security_decommission,
2886 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2887 VALS(zbee_tlv_local_types_req_security_decommission), 0x0, NULL, HFILL }},
2889 { &hf_zbee_tlv_local_type_req_beacon_survey,
2890 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2891 VALS(zbee_tlv_local_types_req_beacon_survey), 0x0, NULL, HFILL }},
2893 { &hf_zbee_tlv_local_type_rsp_beacon_survey,
2894 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2895 VALS(zbee_tlv_local_types_rsp_beacon_survey), 0x0, NULL, HFILL }},
2897 { &hf_zbee_tlv_local_type_req_challenge,
2898 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2899 VALS(zbee_tlv_local_types_req_challenge), 0x0, NULL, HFILL }},
2901 { &hf_zbee_tlv_local_type_rsp_challenge,
2902 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2903 VALS(zbee_tlv_local_types_rsp_challenge), 0x0, NULL, HFILL }},
2905 { &hf_zbee_tlv_local_type_rsp_set_configuration,
2906 { "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
2907 VALS(zbee_tlv_local_types_rsp_set_configuration), 0x0, NULL, HFILL }},
2909 { &hf_zbee_tlv_type,
2910 { "Unknown Type", "zbee_tlv.type", FT_UINT8, BASE_HEX,
2911 NULL, 0x0, NULL, HFILL }},
2913 { &hf_zbee_tlv_length,
2914 { "Length", "zbee_tlv.length", FT_UINT8, BASE_DEC, NULL, 0x0,
2915 NULL, HFILL }},
2917 { &hf_zbee_tlv_value,
2918 { "Value", "zbee_tlv.value", FT_BYTES, BASE_NONE, NULL, 0x0,
2919 NULL, HFILL }},
2921 { &hf_zbee_tlv_count,
2922 { "Count", "zbee_tlv.count", FT_UINT8, BASE_DEC, NULL, 0x0,
2923 NULL, HFILL }},
2925 { &hf_zbee_tlv_local_status_count,
2926 { "TLV Status Count", "zbee_tlv.tlv_status_count", FT_UINT8, BASE_DEC, NULL, 0x0,
2927 NULL, HFILL }},
2929 { &hf_zbee_tlv_local_type_id,
2930 { "TLV Type ID", "zbee_tlv.tlv_type_id", FT_UINT8, BASE_HEX, VALS(zbee_tlv_global_types), 0x0,
2931 NULL, HFILL }},
2933 { &hf_zbee_tlv_local_proc_status,
2934 { "TLV Processing Status", "zbee_tlv.tlv_proc_status", FT_UINT8, BASE_HEX, NULL, 0x0,
2935 NULL, HFILL }},
2937 { &hf_zbee_tlv_manufacturer_specific,
2938 { "ZigBee Manufacturer ID", "zbee_tlv.manufacturer_specific", FT_UINT16, BASE_HEX, NULL,
2939 0x0, NULL, HFILL }},
2941 { &hf_zbee_tlv_supported_key_negotiation_methods,
2942 { "Supported Key Negotiation Methods", "zbee_tlv.supported_key_negotiation_methods", FT_UINT8, BASE_HEX, NULL,
2943 0x0, NULL, HFILL }},
2945 { &hf_zbee_tlv_supported_key_negotiation_methods_key_request,
2946 { "Key Request (ZigBee 3.0)", "zbee_tlv.supported_key_negotiation_methods.key_request", FT_BOOLEAN, 8, NULL,
2947 ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_KEY_REQUEST, NULL, HFILL }},
2949 { &hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_aes_mmo128,
2950 { "ECDHE using Curve25519 with Hash AES-MMO-128", "zbee_tlv.supported_key_negotiation_methods.ecdhe_using_curve25519_aes_mmo128", FT_BOOLEAN, 8, NULL,
2951 ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_ANONYMOUS_ECDHE_USING_CURVE25519_AES_MMO128, NULL, HFILL }},
2953 { &hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_sha256,
2954 { "ECDHE using Curve25519 with Hash SHA-256", "zbee_tlv.supported_key_negotiation_methods.ecdhe_using_curve25519_sha256", FT_BOOLEAN, 8, NULL,
2955 ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_ANONYMOUS_ECDHE_USING_CURVE25519_SHA256, NULL, HFILL }},
2957 { &hf_zbee_tlv_supported_secrets,
2958 { "Supported Pre-shared Secrets Bitmask", "zbee_tlv.supported_secrets", FT_UINT8, BASE_HEX, NULL,
2959 0x0, NULL, HFILL }},
2961 { &hf_zbee_tlv_supported_preshared_secrets_auth_token,
2962 { "Symmetric Authentication Token", "zbee_tlv.supported_secrets.auth_token", FT_BOOLEAN, 8, NULL,
2963 0x1, NULL, HFILL }},
2965 { &hf_zbee_tlv_supported_preshared_secrets_ic,
2966 { "128-bit pre-configured link-key from install code", "zbee_tlv.supported_secrets.ic", FT_BOOLEAN, 8, NULL,
2967 0x2, NULL, HFILL }},
2969 { &hf_zbee_tlv_supported_preshared_secrets_passcode_pake,
2970 { "Variable-length pass code for PAKE protocols", "zbee_tlv.supported_secrets.passcode_pake", FT_BOOLEAN, 8, NULL,
2971 0x4, NULL, HFILL }},
2973 { &hf_zbee_tlv_supported_preshared_secrets_basic_access_key,
2974 { "Basic Access Key", "zbee_tlv.supported_secrets.basic_key", FT_BOOLEAN, 8, NULL,
2975 0x8, NULL, HFILL }},
2977 { &hf_zbee_tlv_supported_preshared_secrets_admin_access_key,
2978 { "Administrative Access Key", "zbee_tlv.supported_secrets.admin_key", FT_BOOLEAN, 8, NULL,
2979 0x10, NULL, HFILL }},
2981 { &hf_zbee_tlv_panid_conflict_cnt,
2982 { "PAN ID Conflict Count", "zbee_tlv.panid_conflict_cnt", FT_UINT16, BASE_DEC, NULL,
2983 0x0, NULL, HFILL }},
2985 { &hf_zbee_tlv_next_pan_id,
2986 { "Next PAN ID Change", "zbee_tlv.next_pan_id", FT_UINT16, BASE_HEX, NULL,
2987 0x0, NULL, HFILL }},
2989 { &hf_zbee_tlv_next_channel_change,
2990 { "Next Channel Change", "zbee_tlv.next_channel", FT_UINT32, BASE_HEX, NULL,
2991 0x0, NULL, HFILL }},
2993 { &hf_zbee_tlv_passphrase,
2994 { "128-bit Symmetric Passphrase", "zbee_tlv.passphrase", FT_BYTES, BASE_NONE, NULL,
2995 0x0, NULL, HFILL }},
2997 { &hf_zbee_tlv_challenge_value,
2998 { "Challenge Value", "zbee_tlv.challenge_val", FT_BYTES, BASE_NONE, NULL,
2999 0x0, NULL, HFILL }},
3001 { &hf_zbee_tlv_aps_frame_counter,
3002 { "APS Frame Counter", "zbee_tlv.aps_frame_cnt", FT_UINT32, BASE_HEX, NULL,
3003 0x0, NULL, HFILL }},
3005 { &hf_zbee_tlv_challenge_counter,
3006 { "Challenge Counter", "zbee_tlv.challenge_cnt", FT_UINT32, BASE_HEX, NULL,
3007 0x0, NULL, HFILL }},
3009 { &hf_zbee_tlv_configuration_param,
3010 { "Configuration Parameters", "zbee_tlv.configuration_parameters", FT_UINT16, BASE_HEX, NULL,
3011 0x0, NULL, HFILL }},
3013 { &hf_zbee_tlv_configuration_param_restricted_mode,
3014 { "apsZdoRestrictedMode", "zbee_tlv.conf_param.restricted_mode", FT_UINT16, BASE_DEC, NULL,
3015 0x1, NULL, HFILL }},
3017 { &hf_zbee_tlv_configuration_param_link_key_enc,
3018 { "requireLinkKeyEncryptionForApsTransportKey", "zbee_tlv.conf_param.req_link_key_enc", FT_UINT16, BASE_DEC, NULL,
3019 0x2, NULL, HFILL }},
3021 { &hf_zbee_tlv_configuration_param_leave_req_allowed,
3022 { "nwkLeaveRequestAllowed", "zbee_tlv.conf_param.leave_req_allowed", FT_UINT16, BASE_DEC, NULL,
3023 0x4, NULL, HFILL }},
3025 { &hf_zbee_tlv_dev_cap_ext_capability_information,
3026 { "Capability Information", "zbee_tlv.dev_cap_ext_cap_info", FT_UINT16, BASE_HEX, NULL,
3027 0x0, NULL, HFILL }},
3029 { &hf_zbee_tlv_dev_cap_ext_zbdirect_virt_device,
3030 { "Zigbee Direct Virtual Device", "zbee_tlv.dev_cap_ext.zbdirect_virt_dev", FT_UINT16, BASE_DEC, NULL,
3031 0x1, NULL, HFILL }},
3033 { &hf_zbee_tlv_lqa,
3034 { "LQA", "zbee_tlv.lqa", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3036 { &hf_zbee_tlv_router_information,
3037 { "Router Information", "zbee_tlv.router_information", FT_UINT16, BASE_HEX, NULL,
3038 0x0, NULL, HFILL }},
3040 { &hf_zbee_tlv_router_information_hub_connectivity,
3041 { "Hub Connectivity", "zbee_tlv.router_information.hub_connectivity", FT_BOOLEAN, 16, NULL,
3042 ZBEE_TLV_ROUTER_INFORMATION_HUB_CONNECTIVITY, NULL, HFILL }},
3044 { &hf_zbee_tlv_router_information_uptime,
3045 { "Uptime", "zbee_tlv.router_information.uptime", FT_BOOLEAN, 16, NULL,
3046 ZBEE_TLV_ROUTER_INFORMATION_UPTIME, NULL, HFILL }},
3048 { &hf_zbee_tlv_router_information_pref_parent,
3049 { "Preferred parent", "zbee_tlv.router_information.pref_parent", FT_BOOLEAN, 16, NULL,
3050 ZBEE_TLV_ROUTER_INFORMATION_PREF_PARENT, NULL, HFILL }},
3052 { &hf_zbee_tlv_router_information_battery_backup,
3053 { "Battery Backup", "zbee_tlv.router_information.battery", FT_BOOLEAN, 16, NULL,
3054 ZBEE_TLV_ROUTER_INFORMATION_BATTERY_BACKUP, NULL, HFILL }},
3056 { &hf_zbee_tlv_router_information_enhanced_beacon_request_support,
3057 { "Enhanced Beacon Request Support", "zbee_tlv.router_information.enhanced_beacon", FT_BOOLEAN, 16, NULL,
3058 ZBEE_TLV_ROUTER_INFORMATION_ENHANCED_BEACON_REQUEST_SUPPORT, NULL, HFILL }},
3060 { &hf_zbee_tlv_router_information_mac_data_poll_keepalive_support,
3061 { "MAC Data Poll Keepalive Support", "zbee_tlv.router_information.mac_data_poll_keepalive", FT_BOOLEAN, 16, NULL,
3062 ZBEE_TLV_ROUTER_INFORMATION_MAC_DATA_POLL_KEEPALIVE_SUPPORT, NULL, HFILL }},
3064 { &hf_zbee_tlv_router_information_end_device_keepalive_support,
3065 { "End Device Keepalive Support", "zbee_tlv.router_information.end_dev_keepalive", FT_BOOLEAN, 16, NULL,
3066 ZBEE_TLV_ROUTER_INFORMATION_END_DEVICE_KEEPALIVE_SUPPORT, NULL, HFILL }},
3068 { &hf_zbee_tlv_router_information_power_negotiation_support,
3069 { "Power Negotiation Support", "zbee_tlv.router_information.power_negotiation", FT_BOOLEAN, 16, NULL,
3070 ZBEE_TLV_ROUTER_INFORMATION_POWER_NEGOTIATION_SUPPORT, NULL, HFILL }},
3072 { &hf_zbee_tlv_node_id,
3073 { "Node ID", "zbee_tlv.node_id", FT_UINT16, BASE_HEX, NULL,
3074 0x0, NULL, HFILL }},
3076 { &hf_zbee_tlv_frag_opt,
3077 { "Fragmentation Options", "zbee_tlv.frag_opt", FT_UINT8, BASE_HEX, NULL,
3078 0x0, NULL, HFILL }},
3080 { &hf_zbee_tlv_max_reassembled_buf_size,
3081 { "Maximum Reassembled Input Buffer Size", "zbee_tlv.max_buf_size", FT_UINT16, BASE_HEX, NULL,
3082 0x0, NULL, HFILL }},
3084 { &hf_zbee_tlv_selected_key_negotiation_method,
3085 { "Selected Key Negotiation Method", "zbee_tlv.selected_key_negotiation_method", FT_UINT8, BASE_HEX,
3086 VALS(zbee_tlv_selected_key_negotiation_method), 0x0, NULL, HFILL }},
3088 { &hf_zbee_tlv_selected_pre_shared_secret,
3089 { "Selected Pre Shared Secret", "zbee_tlv.selected_pre_shared_secret", FT_UINT8, BASE_HEX,
3090 VALS(zbee_tlv_selected_pre_shared_secret), 0x0, NULL, HFILL }},
3092 { &hf_zbee_tlv_device_eui64,
3093 { "Device EUI64", "zbee_tlv.device_eui64", FT_EUI64, BASE_NONE, NULL, 0x0,
3094 NULL, HFILL }},
3096 { &hf_zbee_tlv_public_point,
3097 { "Public Point", "zbee_tlv.public_point", FT_BYTES, BASE_NONE, NULL,
3098 0x0, NULL, HFILL }},
3100 { &hf_zbee_tlv_global_tlv_id,
3101 { "TLV Type ID", "zbee_tlv.global_tlv_id", FT_UINT8, BASE_HEX, VALS(zbee_tlv_global_types), 0x0,
3102 NULL, HFILL }},
3104 { &hf_zbee_tlv_local_ieee_addr,
3105 { "IEEE Addr", "zbee_tlv.ieee_addr", FT_EUI64, BASE_NONE, NULL, 0x0,
3106 NULL, HFILL }},
3108 { &hf_zbee_tlv_mic64,
3109 { "MIC", "zbee_tlv.mic64", FT_UINT64, BASE_HEX, NULL, 0x0,
3110 NULL, HFILL }},
3112 { &hf_zbee_tlv_local_initial_join_method,
3113 { "Initial Join Method", "zbee_tlv.init_method", FT_UINT8, BASE_HEX,
3114 VALS(zbee_initial_join_methods), 0x0, NULL, HFILL }},
3116 { &hf_zbee_tlv_local_active_lk_type,
3117 { "Active link key type", "zbee_tlv.lk_type", FT_UINT8, BASE_HEX,
3118 VALS(zbee_active_lk_types), 0x0, NULL, HFILL }},
3120 { &hf_zbee_tlv_zbd_comm_tlv,
3121 { "ZBD Commissioning Service TLV Type ID", "zbee_tlv.zbd.comm_tlv_id", FT_UINT8, BASE_HEX,
3122 VALS(zbee_tlv_zbd_comm_types), 0x0, NULL, HFILL }},
3124 { &hf_zbee_tlv_zbd_comm_mj_cmd_tlv,
3125 { "ZBD Manage Joiners TLV Type ID", "zbee_tlv.zbd.comm_mj_tlv_id", FT_UINT8, BASE_HEX,
3126 VALS(zbee_tlv_zbd_comm_mj_types), 0x0, NULL, HFILL }},
3128 { &hf_zbee_tlv_zbd_secur_tlv,
3129 { "ZBD Manage Joiners TLV Type ID", "zbee_tlv.zbd.comm_mj_tlv_id", FT_UINT8, BASE_HEX,
3130 VALS(zbee_tlv_zbd_secur_types), 0x0, NULL, HFILL }},
3132 { &hf_zbee_tlv_local_tunneling_npdu,
3133 { "NPDU", "zbee_tlv.zbd.npdu", FT_NONE, BASE_NONE,
3134 NULL, 0x0, NULL, HFILL }
3136 { &hf_zbee_tlv_zbd_tunneling_npdu_msg_tlv,
3137 { "NPDU Message TLV", "zbee_tlv.zbd.tlv.tunneling.npdu_msg", FT_NONE, BASE_NONE,
3138 NULL, 0x0, NULL, HFILL }
3140 { &hf_zbee_tlv_local_comm_ext_pan_id,
3141 { "Extended PAN ID", "zbee_tlv.zbd.comm.ext_pan_id", FT_BYTES, SEP_COLON,
3142 NULL, 0x0, NULL, HFILL }
3144 { &hf_zbee_tlv_local_comm_short_pan_id,
3145 { "Short PAN ID", "zbee_tlv.zbd.comm.short_pan_id", FT_UINT16, BASE_HEX,
3146 NULL, 0x0, NULL, HFILL }
3148 { &hf_zbee_tlv_local_comm_channel_mask,
3149 { "Network Channels", "zbee_tlv.zbd.comm.nwk_channel_mask", FT_UINT32, BASE_HEX,
3150 NULL, 0x0, NULL, HFILL }
3152 { &hf_zbee_tlv_local_comm_channel_page,
3153 { "Channel Page", "zbee_tlv.zbd.comm.nwk_channel_page", FT_UINT8, BASE_DEC,
3154 NULL, 0x0, NULL, HFILL }
3156 { &hf_zbee_tlv_local_comm_channel_page_count,
3157 { "Channel Page Count", "zbee_tlv.zbd.comm.nwk_channel_page_count", FT_UINT8, BASE_DEC,
3158 NULL, 0x0, NULL, HFILL }
3160 { &hf_zbee_tlv_local_comm_nwk_key,
3161 { "Network key", "zbee_tlv.zbd.comm.nwk_key", FT_BYTES, BASE_NONE,
3162 NULL, 0x0, NULL, HFILL }
3164 { &hf_zbee_tlv_local_comm_link_key,
3165 { "Link key", "zbee_tlv.zbd.comm.link_key", FT_BYTES, BASE_NONE,
3166 NULL, 0x0, NULL, HFILL }
3168 { &hf_zbee_tlv_local_comm_dev_type,
3169 { "Device type", "zbee_tlv.zbd.comm.dev_type", FT_UINT8, BASE_HEX,
3170 VALS(zbee_tlv_local_types_dev_type_str), 0x0, NULL, HFILL }
3172 { &hf_zbee_tlv_local_comm_nwk_addr,
3173 { "Network address", "zbee_tlv.zbd.comm.nwk_addr", FT_UINT16, BASE_HEX,
3174 NULL, 0x0, NULL, HFILL }
3176 { &hf_zbee_tlv_local_comm_join_method,
3177 { "Join method", "zbee_tlv.zbd.comm.join_method", FT_UINT8, BASE_HEX,
3178 VALS(zbee_tlv_local_types_join_method_str), 0x0, NULL, HFILL }
3180 { &hf_zbee_tlv_local_comm_tc_addr,
3181 { "TC address", "zbee_tlv.zbd.comm.tc_addr", FT_UINT64, BASE_HEX,
3182 NULL, 0x0, NULL, HFILL }
3184 { &hf_zbee_tlv_local_comm_nwk_upd_id,
3185 { "Network update ID", "zbee_tlv.zbd.comm.nwk_upd_id", FT_UINT8, BASE_HEX,
3186 NULL, 0x0, NULL, HFILL }
3188 { &hf_zbee_tlv_local_comm_key_seq_num,
3189 { "Network active key sequence number", "zbee_tlv.zbd.comm.nwk_key_seq_num", FT_UINT8, BASE_HEX,
3190 NULL, 0x0, NULL, HFILL }
3192 { &hf_zbee_tlv_local_comm_adm_key,
3193 { "Admin key", "zbee_tlv.zbd.comm.admin_key", FT_BYTES, BASE_NONE,
3194 NULL, 0x0, NULL, HFILL }
3196 { &hf_zbee_tlv_local_comm_status_code_domain,
3197 { "Domain", "zbee_tlv.zbd.comm.status_code_domain", FT_UINT8, BASE_HEX,
3198 VALS(zbee_tlv_local_types_status_code_domain_str), 0x0, NULL, HFILL }
3200 { &hf_zbee_tlv_local_comm_status_code_value,
3201 { "Code", "zbee_tlv.zbd.comm.status_code_value", FT_UINT8, BASE_HEX,
3202 NULL, 0x0, NULL, HFILL }
3204 { &hf_zbee_tlv_local_comm_mj_prov_lnk_key,
3205 { "Manage Joiners Provisional Link key", "zbee_tlv.zbd.comm.manage_joiners_prov_lnk_key", FT_BYTES, BASE_NONE,
3206 NULL, 0x0, NULL, HFILL }
3208 { &hf_zbee_tlv_local_comm_mj_ieee_addr,
3209 { "Manage Joiners IEEE Address", "zbee_tlv.zbd.comm.manage_joiners_ieee_addr", FT_UINT64, BASE_HEX,
3210 NULL, 0x0, NULL, HFILL }
3212 { &hf_zbee_tlv_local_comm_mj_cmd,
3213 { "Manage Joiners command", "zbee_tlv.zbd.comm.manage_joiners_cmd", FT_UINT8, BASE_HEX,
3214 VALS(zbee_tlv_local_types_mj_cmd_str), 0x0, NULL, HFILL }
3216 { &hf_zbee_tlv_local_tunneling_npdu_flags,
3217 { "NPDU Flags", "zbee_tlv.zbd.tunneling.npdu_flags", FT_UINT8, BASE_HEX,
3218 NULL, 0x0, NULL, HFILL }
3220 { &hf_zbee_tlv_local_tunneling_npdu_flags_security,
3221 { "Security Enabled", "zbee_tlv.zbd.tunneling.npdu_flags.security", FT_BOOLEAN, 8,
3222 NULL, 0b00000001, NULL, HFILL }
3224 { &hf_zbee_tlv_local_tunneling_npdu_flags_reserved,
3225 { "Reserved", "zbee_tlv.zbd.tunneling.npdu_flags.reserved", FT_UINT8, BASE_DEC,
3226 NULL, 0b11111110, NULL, HFILL }
3228 { &hf_zbee_tlv_local_tunneling_npdu_length,
3229 { "NPDU Length", "zbee_tlv.zbd.tunneling.npdu_length", FT_UINT8, BASE_DEC,
3230 NULL, 0x0, NULL, HFILL }
3232 { &hf_zbee_tlv_local_selected_key_method,
3233 { "Selected Key Negotiation Method", "zbee_tlv.zbd.secur.key_method", FT_UINT8, BASE_HEX,
3234 VALS(zbee_tlv_local_types_key_method_str), 0x0, NULL, HFILL }
3236 { &hf_zbee_tlv_local_selected_psk_secret,
3237 { "Selected PSK Secret", "zbee_tlv.zbd.secur.psk_secret", FT_UINT8, BASE_HEX,
3238 VALS(zbee_tlv_local_types_psk_secret_str), 0x0, NULL, HFILL }
3240 { &hf_zbee_tlv_local_nwk_key_seq_num,
3241 { "Network Key Sequence Number", "zbee_tlv.zbd.secur.nwk_key_seq_num", FT_UINT8, BASE_DEC,
3242 NULL, 0x0, NULL, HFILL }
3244 { &hf_zbee_tlv_local_mac_tag,
3245 { "MAC Tag", "zbee_tlv.zbd.secur.mac_tag", FT_BYTES, BASE_NONE,
3246 NULL, 0x0, NULL, HFILL }
3248 { &hf_zbee_tlv_local_comm_link_key_flags,
3249 { "Link Key", "zbee_tlv.zbd.comm.join.link_key", FT_UINT8, BASE_HEX,
3250 NULL, 0x0, NULL, HFILL }
3252 { &hf_zbee_tlv_local_comm_link_key_flags_unique,
3253 { "Unique", "zbee_tlv.zbd.comm.join.link_key.unique", FT_UINT8, BASE_DEC,
3254 VALS(zbee_tlv_local_types_lnk_key_unique_str), ZBEE_TLV_LINK_KEY_UNIQUE, NULL, HFILL }
3256 { &hf_zbee_tlv_local_comm_link_key_flags_provisional,
3257 { "Provisional", "zbee_tlv.zbd.comm.join.link_key.provisional", FT_UINT8, BASE_DEC,
3258 VALS(zbee_tlv_local_types_lnk_key_provisional_str), ZBEE_TLV_LINK_KEY_PROVISIONAL, NULL, HFILL }
3260 { &hf_zbee_tlv_local_comm_network_status_map,
3261 { "Network Status Map", "zbee_tlv.zbd.comm.status_map", FT_UINT8, BASE_HEX,
3262 NULL, 0x0, NULL, HFILL }
3264 { &hf_zbee_tlv_local_comm_network_status_map_joined_status,
3265 { "Joined", "zbee_tlv.zbd.comm.status_map.joined_status", FT_UINT8, BASE_HEX,
3266 VALS(zbee_tlv_local_types_joined_status_str), ZBEE_TLV_STATUS_MAP_JOINED_STATUS, NULL, HFILL }
3268 { &hf_zbee_tlv_local_comm_network_status_map_open_status,
3269 { "Open/Closed", "zbee_tlv.zbd.comm.status_map.open_status", FT_UINT8, BASE_DEC,
3270 VALS(zbee_tlv_local_types_nwk_state_str), ZBEE_TLV_STATUS_MAP_OPEN_STATUS, NULL, HFILL }
3272 { &hf_zbee_tlv_network_status_map_network_type,
3273 { "Network Type", "zbee_tlv.zbd.comm.status_map.network_type", FT_UINT8, BASE_DEC,
3274 VALS(zbee_tlv_local_types_nwk_type_str), ZBEE_TLV_STATUS_MAP_NETWORK_TYPE, NULL, HFILL }
3278 /* Protocol subtrees */
3279 static int *ett[] =
3281 &ett_zbee_aps_tlv,
3282 &ett_zbee_aps_relay,
3283 &ett_zbee_tlv,
3284 &ett_zbee_tlv_supported_key_negotiation_methods,
3285 &ett_zbee_tlv_supported_secrets,
3286 &ett_zbee_tlv_router_information,
3287 &ett_zbee_tlv_configuration_param,
3288 &ett_zbee_tlv_capability_information,
3289 &ett_zbee_tlv_zbd_tunneling_npdu,
3290 &ett_zbee_tlv_zbd_tunneling_npdu_flags,
3291 &ett_zbee_tlv_link_key_flags,
3292 &ett_zbee_tlv_network_status_map
3295 static ei_register_info ei[] = {
3296 { &ei_zbee_tlv_max_recursion_depth_reached, { "zbee_tlv.max_recursion_depth_reached",
3297 PI_PROTOCOL, PI_WARN, "Maximum allowed recursion depth reached - stop decoding", EXPFILL }}
3300 proto_zbee_tlv = proto_register_protocol("Zigbee TLV", "ZB TLV", "zbee_tlv");
3302 proto_register_field_array(proto_zbee_tlv, hf, array_length(hf));
3303 proto_register_subtree_array(ett, array_length(ett));
3305 expert_module_t* expert_zbee_tlv = expert_register_protocol(proto_zbee_tlv);
3306 expert_register_field_array(expert_zbee_tlv, ei, array_length(ei));
3308 register_dissector("zbee_tlv", dissect_zbee_tlv_default, proto_zbee_tlv);
3309 zbee_nwk_handle = find_dissector("zbee_nwk");
3310 } /* proto_register_zbee_tlv */