Coverage Report

Created: 2026-09-28 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-zbee-tlv.c
Line
Count
Source
1
/* packet-zbee-tlv.c
2
 * Dissector routines for the Zbee TLV (R23+)
3
 * Copyright 2021 DSR Corporation, http://dsr-wireless.com/
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include <config.h>
13
#include <epan/expert.h>
14
#include <epan/packet.h>
15
#include <epan/proto_data.h>
16
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"
25
26
#include "conversation.h"
27
28
/*-------------------------------------
29
 * Dissector Function Prototypes
30
 *-------------------------------------
31
 */
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_nwk_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, unsigned cmd_id);
36
static unsigned dissect_zbd_local_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset, void* data _U_, unsigned cmd_id);
37
static unsigned dissect_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
38
39
//Global TLV Dissector Routines
40
static unsigned dissect_zbee_tlv_manufacturer_specific(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t length);
41
static unsigned dissect_zbee_tlv_supported_key_negotiation_methods(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
42
static unsigned dissect_zbee_tlv_configuration_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
43
static unsigned dissect_zbee_tlv_dev_cap_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
44
static unsigned dissect_zbee_tlv_panid_conflict_report(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
45
static unsigned dissect_zbee_tlv_next_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
46
static unsigned dissect_zbee_tlv_next_channel_change(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
47
static unsigned dissect_zbee_tlv_passphrase(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
48
static unsigned dissect_zbee_tlv_router_information(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
49
static unsigned dissect_zbee_tlv_fragmentation_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
50
static unsigned dissect_zbee_tlv_potential_parents(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
51
52
//Local TLV Dissector Routines
53
static unsigned dissect_zbee_tlv_selected_key_negotiation_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
54
static unsigned dissect_zbee_tlv_public_point(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t length);
55
static unsigned dissect_zbee_tlv_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
56
static unsigned dissect_zbee_tlv_clear_all_bindigs_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
57
static unsigned dissect_zbee_tlv_requested_auth_token_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
58
static unsigned dissect_zbee_tlv_target_ieee_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
59
static unsigned dissect_zbee_tlv_device_auth_level(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
60
static unsigned dissect_zbee_tlv_chanmask(proto_tree *tree, tvbuff_t *tvb, unsigned offset, int hf_page, int hf_channel);
61
static unsigned dissect_zbee_tlv_ext_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
62
static unsigned dissect_zbee_tlv_short_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
63
static unsigned dissect_zbee_tlv_nwk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
64
static unsigned dissect_zbee_tlv_dev_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
65
static unsigned dissect_zbee_tlv_nwk_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
66
static unsigned dissect_zbee_tlv_join_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
67
static unsigned dissect_zbee_tlv_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
68
static unsigned dissect_zbee_tlv_tc_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
69
static unsigned dissect_zbee_tlv_nwk_upd_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
70
static unsigned dissect_zbee_tlv_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
71
static unsigned dissect_zbee_tlv_adm_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
72
static unsigned dissect_zbee_tlv_mj_prov_lnk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
73
static unsigned dissect_zbee_tlv_mj_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
74
static unsigned dissect_zbee_tlv_mj_cmd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
75
static unsigned dissect_zbee_tlv_nwk_channel_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
76
static unsigned dissect_zbee_tlv_link_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
77
static unsigned dissect_zbee_tlv_nwk_status_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
78
static unsigned dissect_zbee_tlv_status_code(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
79
static unsigned dissect_zbee_tlv_tunneling_npdu_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset, uint8_t length);
80
static unsigned dissect_zbee_tlv_key_neg_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
81
static unsigned dissect_zbee_tlv_mac_tag(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t mac_tag_size);
82
static unsigned dissect_zbee_tlv_nwk_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
83
84
//Dissectors for ZB Direct
85
static unsigned dissect_zbd_msg_status_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
86
static unsigned dissect_zbd_msg_tunneling_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
87
static unsigned dissect_zbd_msg_manage_joiners_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
88
static unsigned dissect_zbd_msg_join_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
89
static unsigned dissect_zbd_msg_formation_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
90
static unsigned dissect_zbd_msg_secur_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
91
92
void proto_register_zbee_tlv(void);
93
void proto_reg_handoff_zbee_tlv(void);
94
95
/* Initialize Protocol and Registered fields */
96
static int proto_zbee_tlv;
97
static dissector_handle_t zigbee_aps_handle;
98
static dissector_handle_t zbee_nwk_handle;
99
100
static int hf_zbee_tlv_global_type;
101
static int hf_zbee_tlv_local_type_key_update_req_rsp;
102
static int hf_zbee_tlv_local_type_key_negotiation_req_rsp;
103
static int hf_zbee_tlv_local_type_get_auth_level_rsp;
104
static int hf_zbee_tlv_local_type_clear_all_bindings_req;
105
static int hf_zbee_tlv_local_type_req_security_get_auth_token;
106
static int hf_zbee_tlv_local_type_req_security_get_auth_level;
107
static int hf_zbee_tlv_local_type_req_security_decommission;
108
static int hf_zbee_tlv_local_type_req_beacon_survey;
109
static int hf_zbee_tlv_local_type_rsp_beacon_survey;
110
static int hf_zbee_tlv_local_type_req_challenge;
111
static int hf_zbee_tlv_local_type_rsp_challenge;
112
static int hf_zbee_tlv_local_type_rsp_set_configuration;
113
static int hf_zbee_tlv_local_type_lk_features;
114
static int hf_zbee_tlv_local_type_lk_features_capabilities;
115
static int hf_zbee_tlv_local_type_lk_features_capabilities_aps_fc_sync;
116
static int hf_zbee_tlv_local_type_route_req;
117
static int hf_zbee_tlv_local_type_route_reply;
118
static int hf_zbee_tlv_local_type_network_status;
119
120
static int hf_zbee_tlv_length;
121
static int hf_zbee_tlv_type;
122
static int hf_zbee_tlv_value;
123
static int hf_zbee_tlv_count;
124
static int hf_zbee_tlv_manufacturer_specific;
125
126
static int hf_zbee_tlv_local_status_count;
127
static int hf_zbee_tlv_local_type_id;
128
static int hf_zbee_tlv_local_proc_status;
129
130
static int hf_zbee_tlv_local_comm_ext_pan_id;
131
static int hf_zbee_tlv_local_comm_short_pan_id;
132
static int hf_zbee_tlv_local_comm_channel_mask;
133
static int hf_zbee_tlv_local_comm_channel_page;
134
static int hf_zbee_tlv_local_comm_channel_page_count;
135
static int hf_zbee_tlv_local_comm_nwk_key;
136
static int hf_zbee_tlv_local_comm_link_key;
137
static int hf_zbee_tlv_local_comm_link_key_flags;
138
static int hf_zbee_tlv_local_comm_link_key_flags_unique;
139
static int hf_zbee_tlv_local_comm_link_key_flags_provisional;
140
static int hf_zbee_tlv_local_comm_dev_type;
141
static int hf_zbee_tlv_local_comm_nwk_addr;
142
static int hf_zbee_tlv_local_comm_join_method;
143
static int hf_zbee_tlv_local_comm_tc_addr;
144
static int hf_zbee_tlv_local_comm_network_status_map;
145
static int hf_zbee_tlv_local_comm_network_status_map_joined_status;
146
static int hf_zbee_tlv_local_comm_network_status_map_open_status;
147
static int hf_zbee_tlv_network_status_map_network_type;
148
static int hf_zbee_tlv_local_comm_nwk_upd_id;
149
static int hf_zbee_tlv_local_comm_key_seq_num;
150
static int hf_zbee_tlv_local_comm_adm_key;
151
static int hf_zbee_tlv_local_comm_status_code_domain;
152
static int hf_zbee_tlv_local_comm_status_code_value;
153
static int hf_zbee_tlv_local_comm_mj_prov_lnk_key;
154
static int hf_zbee_tlv_local_comm_mj_ieee_addr;
155
static int hf_zbee_tlv_local_comm_mj_cmd;
156
157
static int hf_zbee_tlv_local_tunneling_npdu;
158
static int hf_zbee_tlv_local_tunneling_npdu_flags;
159
static int hf_zbee_tlv_local_tunneling_npdu_flags_security;
160
static int hf_zbee_tlv_local_tunneling_npdu_flags_reserved;
161
static int hf_zbee_tlv_local_tunneling_npdu_length;
162
163
static int hf_zbee_tlv_local_selected_key_method;
164
static int hf_zbee_tlv_local_selected_psk_secret;
165
static int hf_zbee_tlv_local_nwk_key_seq_num;
166
static int hf_zbee_tlv_local_mac_tag;
167
168
static int hf_zbee_tlv_zbd_comm_tlv;
169
static int hf_zbee_tlv_zbd_comm_mj_cmd_tlv;
170
static int hf_zbee_tlv_zbd_secur_tlv;
171
static int hf_zbee_tlv_zbd_tunneling_npdu_msg_tlv;
172
173
static int hf_zbee_tlv_next_pan_id;
174
static int hf_zbee_tlv_next_channel_change;
175
static int hf_zbee_tlv_passphrase;
176
static int hf_zbee_tlv_configuration_param;
177
static int hf_zbee_tlv_configuration_param_restricted_mode;
178
static int hf_zbee_tlv_configuration_param_link_key_enc;
179
static int hf_zbee_tlv_configuration_param_leave_req_allowed;
180
181
static int hf_zbee_tlv_dev_cap_ext_capability_information;
182
static int hf_zbee_tlv_dev_cap_ext_zbdirect_virt_device;
183
184
static int hf_zbee_tlv_challenge_value;
185
static int hf_zbee_tlv_aps_frame_counter;
186
static int hf_zbee_tlv_challenge_counter;
187
static int hf_zbee_tlv_mic64;
188
189
static int hf_zbee_tlv_lqa;
190
191
static int hf_zbee_tlv_router_information;
192
static int hf_zbee_tlv_router_information_hub_connectivity;
193
static int hf_zbee_tlv_router_information_uptime;
194
static int hf_zbee_tlv_router_information_pref_parent;
195
static int hf_zbee_tlv_router_information_battery_backup;
196
static int hf_zbee_tlv_router_information_enhanced_beacon_request_support;
197
static int hf_zbee_tlv_router_information_mac_data_poll_keepalive_support;
198
static int hf_zbee_tlv_router_information_end_device_keepalive_support;
199
static int hf_zbee_tlv_router_information_power_negotiation_support;
200
201
static int hf_zbee_tlv_node_id;
202
static int hf_zbee_tlv_frag_opt;
203
static int hf_zbee_tlv_max_reassembled_buf_size;
204
205
static int hf_zbee_tlv_supported_key_negotiation_methods;
206
static int hf_zbee_tlv_supported_key_negotiation_methods_key_request;
207
static int hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_aes_mmo128;
208
static int hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_sha256;
209
static int hf_zbee_tlv_supported_secrets;
210
static int hf_zbee_tlv_supported_preshared_secrets_auth_token;
211
static int hf_zbee_tlv_supported_preshared_secrets_ic;
212
static int hf_zbee_tlv_supported_preshared_secrets_passcode_pake;
213
static int hf_zbee_tlv_supported_preshared_secrets_basic_access_key;
214
static int hf_zbee_tlv_supported_preshared_secrets_admin_access_key;
215
216
static int hf_zbee_tlv_panid_conflict_cnt;
217
218
static int hf_zbee_tlv_selected_key_negotiation_method;
219
static int hf_zbee_tlv_selected_pre_shared_secret;
220
static int hf_zbee_tlv_device_eui64;
221
static int hf_zbee_tlv_public_point;
222
static int hf_zbee_tlv_global_tlv_id;
223
static int hf_zbee_tlv_local_ieee_addr;
224
static int hf_zbee_tlv_local_initial_join_method;
225
static int hf_zbee_tlv_local_active_lk_type;
226
227
static int hf_zbee_tlv_relay_msg_type;
228
static int hf_zbee_tlv_relay_msg_length;
229
static int hf_zbee_tlv_relay_msg_joiner_ieee;
230
231
static int hf_zbee_tlv_routing_sequence_number;
232
static int hf_zbee_tlv_initial_radius;
233
static int hf_zbee_tlv_concentrator_discovery_time;
234
static int hf_zbee_tlv_max_source_route_length;
235
static int hf_zbee_tlv_nwk_addr_of_interest;
236
237
static int ett_zbee_aps_tlv;
238
static int ett_zbee_aps_relay;
239
static int ett_zbee_tlv;
240
static int ett_zbee_tlv_supported_key_negotiation_methods;
241
static int ett_zbee_tlv_supported_secrets;
242
static int ett_zbee_tlv_router_information;
243
static int ett_zbee_tlv_configuration_param;
244
static int ett_zbee_tlv_capability_information;
245
246
static int ett_zbee_tlv_zbd_tunneling_npdu;
247
static int ett_zbee_tlv_zbd_tunneling_npdu_flags;
248
249
static int ett_zbee_tlv_link_key_flags;
250
static int ett_zbee_tlv_network_status_map;
251
static int ett_zbee_tlv_lk_features_capabilities;
252
253
static expert_field ei_zbee_tlv_max_recursion_depth_reached;
254
255
/* Cached protocol identifier */
256
static int proto_zbee_nwk;
257
258
static const value_string zbee_tlv_local_types_key_method_str[] =
259
{
260
    { ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_25519_HASH_AESMMO128, "Curve 25519 / AESMMO-128" },
261
    { ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_25519_HASH_SHA256,    "Curve 25519 / SHA-256" },
262
    { ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_P256_HASH_SHA256,     "P-256 / SHA-256" },
263
    { 0, NULL }
264
};
265
266
static const value_string zbee_tlv_local_types_psk_secret_str[] =
267
{
268
    { ZBEE_TLV_TYPE_PSK_WELL_KNOWN_KEY,                   "Well known key" },
269
    { ZBEE_TLV_TYPE_PSK_SECRET_AUTH_TOKEN,                "Authorization token" },
270
    { ZBEE_TLV_TYPE_PSK_SECRET_INSTALL_CODE,              "Pre-configured link-ley derived from installation code" },
271
    { ZBEE_TLV_TYPE_PSK_SECRET_PAKE_PASSCODE,             "PAKE passcode" },
272
    { ZBEE_TLV_TYPE_PSK_SECRET_BASIC_ACCESS_KEY,          "Basic Access Key" },
273
    { ZBEE_TLV_TYPE_PSK_SECRET_ADMINISTRATIVE_ACCESS_KEY, "Administrative Access Key" },
274
    { 0, NULL }
275
};
276
277
static const value_string zbee_tlv_local_types_dev_type_str[] =
278
{
279
    { ZBEE_TLV_TYPE_DEV_TYPE_ZC, "ZigBee Coordinator" },
280
    { ZBEE_TLV_TYPE_DEV_TYPE_ZR, "ZigBee Router" },
281
    { ZBEE_TLV_TYPE_DEV_TYPE_ED, "ZigBee End Device" },
282
    { 0, NULL }
283
};
284
285
static const value_string zbee_tlv_local_types_join_method_str[] =
286
{
287
    { ZBEE_TLV_TYPE_JOIN_METHOD_MAC_ASS,           "MAC association" },
288
    { ZBEE_TLV_TYPE_JOIN_METHOD_NWK_REJ,           "NWK rejoin" },
289
    { ZBEE_TLV_TYPE_JOIN_METHOD_OOB_WITH_CHECK,    "Out-of-band commissioning (with check for nearby IEEE 802.15.4 beacons)" },
290
    { ZBEE_TLV_TYPE_JOIN_METHOD_OOB_WITHOUT_CHECK, "Out-of-band commissioning (without check for nearby IEEE 802.15.4 beacons)" },
291
    { 0, NULL }
292
};
293
294
static const value_string zbee_tlv_local_types_status_code_domain_str[] =
295
{
296
    { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_GENERAL,         "General domain or unspecific operation" },
297
    { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_FORM,            "Form Network Operation" },
298
    { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_JOIN,            "Join Network Operation" },
299
    { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_PERMIT_JOIN,     "Permit Joining Operation" },
300
    { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_LEAVE,           "Leave Network Operation" },
301
    { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_MANAGE_JOINERS,  "Manage Joiners Domain" },
302
    { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_IDENTIFY,        "Identify Operation" },
303
    { ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_FINDING_BINDING, "Finding & Binding Domain" },
304
    { 0, NULL }
305
};
306
307
static const value_string zbee_tlv_local_types_joined_status_str[] =
308
{
309
    { ZBEE_TLV_TYPE_JOINED_STATUS_NO_NWK,           "No network" },
310
    { ZBEE_TLV_TYPE_JOINED_STATUS_JOINING,          "Joining" },
311
    { ZBEE_TLV_TYPE_JOINED_STATUS_JOINED,           "Joined" },
312
    { ZBEE_TLV_TYPE_JOINED_STATUS_JOINED_NO_PARENT, "Joined (no parent)" },
313
    { ZBEE_TLV_TYPE_JOINED_STATUS_LEAVING,          "Leaving" },
314
    { 0, NULL }
315
};
316
317
static const value_string zbee_tlv_local_types_nwk_type_str[] =
318
{
319
    { ZBEE_TLV_NWK_TYPE_DISTRIBUTED, "Distributed" },
320
    { ZBEE_TLV_NWK_TYPE_CENTRALIZED, "Centralized" },
321
    { 0, NULL }
322
};
323
324
static const value_string zbee_tlv_local_types_nwk_state_str[] =
325
{
326
    { ZBEE_TLV_TYPE_NWK_STATE_CLOSED, "Closed" },
327
    { ZBEE_TLV_TYPE_NWK_STATE_OPENED, "Opened" },
328
    { 0, NULL }
329
};
330
331
static const value_string zbee_tlv_local_types_mj_cmd_str[] =
332
{
333
    { ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_DROP,   "Drop all joiners' Provisional Link Keys" },
334
    { ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_ADD,    "Add a joiner's Provisional Link Key" },
335
    { ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_REMOVE, "Remove a joiner's Provisional Link Key" },
336
    { 0, NULL }
337
};
338
339
static const value_string zbee_tlv_local_types_lnk_key_unique_str[] =
340
{
341
    { ZBEE_TLV_TYPE_LINK_KEY_FLAG_GLOBAL, "Global" },
342
    { ZBEE_TLV_TYPE_LINK_KEY_FLAG_UNIQUE, "Unique" },
343
    { 0, NULL }
344
};
345
346
static const value_string zbee_tlv_local_types_lnk_key_provisional_str[] =
347
{
348
    { ZBEE_TLV_TYPE_LINK_KEY_FLAG_PERMANENT,   "Permanent" },
349
    { ZBEE_TLV_TYPE_LINK_KEY_FLAG_PROVISIONAL, "Provisional" },
350
    { 0, NULL }
351
};
352
353
static const value_string zbee_tlv_zbd_comm_types[] = {
354
    { ZBEE_TLV_TYPE_COMM_EXT_PAN_ID,      "Extended PAN ID" },
355
    { ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID,    "Short PAN ID" },
356
    { ZBEE_TLV_TYPE_COMM_NWK_CH,          "Network Channel" },
357
    { ZBEE_TLV_TYPE_COMM_NWK_KEY,         "Network Key" },
358
    { ZBEE_TLV_TYPE_COMM_LNK_KEY,         "Link Key" },
359
    { ZBEE_TLV_TYPE_COMM_DEV_TYPE,        "Device Type" },
360
    { ZBEE_TLV_TYPE_COMM_NWK_ADDR,        "NWK Address" },
361
    { ZBEE_TLV_TYPE_COMM_JOIN_METHOD,     "Joining Method" },
362
    { ZBEE_TLV_TYPE_COMM_IEEE_ADDR,       "IEEE Address" },
363
    { ZBEE_TLV_TYPE_COMM_TC_ADDR,         "Trust Center Address" },
364
    { ZBEE_TLV_TYPE_COMM_NWK_STATUS_MAP,  "Network Status Map" },
365
    { ZBEE_TLV_TYPE_COMM_NWK_UPD_ID,      "NWK Update ID" },
366
    { ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM,     "NWK Active Key Seq Number" },
367
    { ZBEE_TLV_TYPE_COMM_ADMIN_KEY,       "Admin Key" },
368
    { ZBEE_TLV_TYPE_COMM_STATUS_CODE,     "Status Code" },
369
370
    // TODO: Not implemented yet
371
    // { 0x0f,                                      "Extended Status Code" },
372
    { 0, NULL }
373
};
374
375
static const value_string zbee_tlv_zbd_comm_mj_types[] = {
376
    { ZBEE_TLV_TYPE_COMM_MJ_PROVISIONAL_LINK_KEY,  "Provisional Link" },
377
    { ZBEE_TLV_TYPE_COMM_MJ_IEEE_ADDR,             "IEEE Address" },
378
    { ZBEE_TLV_TYPE_COMM_MJ_CMD,                   "Manage Joiners Command" },
379
380
    // 0x03-0xff - Reserved
381
    { 0, NULL }
382
};
383
384
static const value_string zbee_tlv_zbd_secur_types[] = {
385
    { ZBEE_TLV_TYPE_KEY_METHOD,        "ZBD Key Negotiation Method TLV" },
386
    { ZBEE_TLV_TYPE_PUB_POINT_P256,    "ZBD Key Negotiation P-256 Public Point TLV" },
387
    { ZBEE_TLV_TYPE_PUB_POINT_C25519,  "ZBD Key Negotiation Curve25519 Public Point TLV" },
388
    { ZBEE_TLV_TYPE_NWK_KEY_SEQ_NUM,   "Network KeySequence Number TLV" },
389
    { ZBEE_TLV_TYPE_MAC_TAG,           "MacTag Tlv" },
390
    { 0, NULL }
391
};
392
393
static const value_string zbee_aps_relay_tlvs[] = {
394
    { 0,          "Relay Message TLV" },
395
    { 0, NULL }
396
};
397
398
static const value_string zbee_tlv_global_types[] = {
399
    { ZBEE_TLV_TYPE_MANUFACTURER_SPECIFIC,                "Manufacturer Specific Global TLV" },
400
    { ZBEE_TLV_TYPE_SUPPORTED_KEY_NEGOTIATION_METHODS,    "Supported Key Negotiation Methods Global TLV" },
401
    { ZBEE_TLV_TYPE_PANID_CONFLICT_REPORT,                "PAN ID Conflict Report Global TLV"},
402
    { ZBEE_TLV_TYPE_NEXT_PAN_ID,                          "Next PAN ID Global TLV" },
403
    { ZBEE_TLV_TYPE_NEXT_CHANNEL_CHANGE,                  "Next Channel Change Global TLV" },
404
    { ZBEE_TLV_TYPE_PASSPHRASE,                           "Passphrase Global TLV" },
405
    { ZBEE_TLV_TYPE_ROUTER_INFORMATION,                   "Router Information Global TLV" },
406
    { ZBEE_TLV_TYPE_FRAGMENTATION_PARAMETERS,             "Fragmentation Parameters Global TLV" },
407
    { ZBEE_TLV_TYPE_JOINER_ENCAPSULATION_GLOBAL,          "Joiner Encapsulation Global TLV" },
408
    { ZBEE_TLV_TYPE_BEACON_APPENDIX_ENCAPSULATION_GLOBAL, "Beacon Appendix Encapsulation Global TLV" },
409
    { ZBEE_TLV_TYPE_CONFIGURATION_MODE_PARAMETERS,        "Configuration Mode Parameters Global TLV" },
410
    { ZBEE_TLV_TYPE_DEVICE_CAPABILITY_EXTENSION,          "Device Capability Extension Global TLV" },
411
    { 0, NULL }
412
};
413
414
static const value_string zbee_tlv_local_types_key_update_req_rsp[] = {
415
    { ZBEE_TLV_TYPE_KEY_UPD_REQ_SELECTED_KEY_NEGOTIATION_METHOD,   "Selected Key Negotiations Method Local TLV" },
416
    { 0, NULL }
417
};
418
419
static const value_string zbee_tlv_local_types_key_negotiation_req_rsp[] = {
420
    { ZBEE_TLV_TYPE_KEY_NEG_REQ_CURVE25519_PUBLIC_POINT,           "Curve25519 Public Point Local TLV" },
421
    { 0, NULL }
422
};
423
424
static const value_string zbee_tlv_local_types_get_auth_level_rsp[] = {
425
    { ZBEE_TLV_TYPE_GET_AUTH_LEVEL,                    "Device Authentication Level TLV" },
426
    { 0, NULL }
427
};
428
429
static const value_string zbee_tlv_local_types_clear_all_bindings_req[] = {
430
    { ZBEE_TLV_TYPE_CLEAR_ALL_BINDIGS_REQ_EUI64,       "Clear All Bindings Req EUI64 TLV" },
431
    { 0, NULL }
432
};
433
434
static const value_string zbee_tlv_local_types_req_security_get_auth_token[] = {
435
    { ZBEE_TLV_TYPE_REQUESTED_AUTH_TOKEN_ID,           "Requested Authentication Token ID TLV" },
436
    { 0, NULL }
437
};
438
439
static const value_string zbee_tlv_local_types_req_security_get_auth_level[] = {
440
    { ZBEE_TLV_TYPE_TARGET_IEEE_ADDRESS,               "Target IEEE Address TLV" },
441
    { 0, NULL }
442
};
443
444
static const value_string zbee_tlv_local_types_req_security_decommission[] = {
445
    { ZBEE_TLV_TYPE_EUI64,                             "EUI64 TLV" },
446
    { 0, NULL }
447
};
448
449
static const value_string zbee_tlv_local_types_req_beacon_survey[] = {
450
    { ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION,       "Beacon Survey Configuration TLV" },
451
    { 0, NULL }
452
};
453
454
static const value_string zbee_tlv_local_types_req_challenge[] = {
455
    { 0,       "APS Frame Counter Challenge Request TLV" },
456
    { 0, NULL }
457
};
458
459
static const value_string zbee_tlv_local_types_rsp_challenge[] = {
460
    { 0,       "APS Frame Counter Challenge Response TLV" },
461
    { 0, NULL }
462
};
463
464
static const value_string zbee_tlv_local_types_rsp_set_configuration[] = {
465
    { 0,       "Processing status TLV" },
466
    { 0, NULL }
467
};
468
469
static const value_string zbee_tlv_local_types_route_req[] = {
470
    { ZBEE_TLV_TYPE_EXTENDED_ROUTE_INFO,       "Extended Route Information TLV" },
471
    { ZBEE_TLV_TYPE_CONCENTRATOR_INFO,         "Concentrator Information TLV" },
472
    { ZBEE_TLV_TYPE_SOURCE_ROUTE_SOLICIT_INFO, "Source Route Solicitation TLV"},
473
    { 0, NULL }
474
};
475
476
static const value_string zbee_tlv_local_types_route_reply[] = {
477
    { ZBEE_TLV_TYPE_EXTENDED_ROUTE_INFO,       "Extended Route Information TLV" },
478
    { 0, NULL }
479
};
480
481
static const value_string zbee_tlv_local_types_network_status[] = {
482
    { ZBEE_TLV_TYPE_EXTENDED_ROUTE_INFO,       "Extended Route Information TLV" },
483
    { 0, NULL }
484
};
485
486
static const value_string zbee_tlv_local_types_rsp_beacon_survey[] = {
487
    { ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION,       "Beacon Survey Configuration TLV" },
488
    { ZBEE_TLV_TYPE_BEACON_SURVEY_RESULTS,             "Beacon Survey Results TLV" },
489
    { ZBEE_TLV_TYPE_BEACON_SURVEY_POTENTIAL_PARENTS,   "Beacon Survey Potential Parents TLV"},
490
    { 0, NULL }
491
};
492
493
static const value_string zbee_tlv_selected_key_negotiation_method[] = {
494
    { ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ZB_30,                             "Zigbee 3.0" },
495
    { ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ECDHE_USING_CURVE25519_AES_MMO128, "ECDHE using Curve25519 with Hash AES-MMO-128" },
496
    { ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ECDHE_USING_CURVE25519_SHA256,     "ECDHE using Curve25519 with Hash SHA-256" },
497
    { 0, NULL }
498
};
499
500
static const value_string zbee_tlv_selected_pre_shared_secret[] = {
501
    { ZBEE_TLV_SELECTED_PRE_SHARED_WELL_KNOWN_KEY,            "Well Known Key" },
502
    { ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_AUTH_TOKEN,         "Symmetric Authentication Token" },
503
    { ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_LINK_KEY_IC,        "Pre-configured link-ley derived from installation code" },
504
    { ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_VLEN_PASSCODE,      "Variable-length pass code" },
505
    { ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_BASIC_ACCESS_KEY,   "Basic Access Key" },
506
    { ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_ADMIN_ACCESS_KEY,   "Administrative Access Key" },
507
    { 0, NULL }
508
};
509
510
static const value_string zbee_initial_join_methods[] = {
511
    { 0x00, "No authentication" },
512
    { 0x01, "Install Code Key" },
513
    { 0x02, "Anonymous key negotiation" },
514
    { 0x03, "Authentication Key Negotiation" },
515
    { 0, NULL }
516
};
517
518
static const value_string zbee_active_lk_types[] = {
519
    { 0x00, "Not Updated" },
520
    { 0x01, "Key Request Method" },
521
    { 0x02, "Unauthentication Key Negotiation" },
522
    { 0x03, "Authentication Key Negotiation" },
523
    { 0x04, "Application Defined Certificate Based Mutual" },
524
    { 0, NULL }
525
};
526
527
static unsigned
528
dissect_aps_relay_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void *data)
529
44
{
530
44
  tvbuff_t    *relay_tvb;
531
44
  proto_item  *relayed_frame_root;
532
44
  proto_tree  *relayed_frame_tree;
533
44
  uint8_t     length;
534
44
  zbee_nwk_hints_t *nwk_hints;
535
536
44
  zigbee_aps_handle = find_dissector("zbee_aps");
537
538
44
  proto_tree_add_item(tree, hf_zbee_tlv_relay_msg_type, tvb, offset, 1, ENC_NA);
539
44
  offset += 1;
540
541
44
  length = tvb_get_uint8(tvb, offset) + 1;
542
44
  proto_tree_add_item(tree, hf_zbee_tlv_relay_msg_length, tvb, offset, 1, ENC_NA);
543
44
  offset += 1;
544
545
44
  proto_tree_add_item(tree, hf_zbee_tlv_relay_msg_joiner_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN);
546
44
  nwk_hints = (zbee_nwk_hints_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_zbee_nwk, 0);
547
44
  nwk_hints->joiner_addr64 = tvb_get_letoh64(tvb, offset);
548
44
  offset += 8;
549
550
  /* The remainder is a relayed APS frame. */
551
44
  relay_tvb = tvb_new_subset_remaining(tvb, offset);
552
44
  relayed_frame_tree = proto_tree_add_subtree_format(tree, tvb, offset, length - 8, ett_zbee_aps_relay, &relayed_frame_root,
553
44
          "Relayed APS Frame");
554
44
  call_dissector_with_data(zigbee_aps_handle, relay_tvb, pinfo, relayed_frame_tree, data);
555
556
  /* Add column info */
557
44
  col_append_str(pinfo->cinfo, COL_INFO, ", Relay");
558
559
44
  return tvb_captured_length(tvb);
560
44
}
561
562
/**
563
 *Dissector for Link-Key Features & Capabilities TLV
564
 *
565
 *@param tvb pointer to buffer containing raw packet.
566
 *@param pinfo pointer to packet information fields
567
 *@param tree pointer to data tree Wireshark uses to display packet.
568
 *@param  offset into the tvb to begin dissection.
569
 *@return offset after command dissection.
570
 */
571
static unsigned
572
dissect_lk_features_capabilities_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
573
159
{
574
159
    static int * const features_capabilities_flags[] = {
575
159
        &hf_zbee_tlv_local_type_lk_features_capabilities_aps_fc_sync,
576
159
        NULL
577
159
    };
578
579
    /* Type */
580
159
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_lk_features_capabilities, tvb, offset, 1, ENC_NA);
581
159
    offset += 1;
582
583
    /* Length */
584
159
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
585
159
    offset += 1;
586
587
    /* Features and Capabilities bitmask. */
588
159
    proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_local_type_lk_features,
589
159
        ett_zbee_tlv_lk_features_capabilities, features_capabilities_flags, ENC_NA);
590
159
    offset += 1;
591
592
159
    return offset;
593
159
}
594
595
596
static unsigned
597
dissect_aps_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void *data, unsigned cmd_id)
598
591
{
599
591
    switch (cmd_id) {
600
3
        case ZBEE_APS_CMD_RELAY_MSG_UPSTREAM:
601
        /* fallthrough */
602
44
        case ZBEE_APS_CMD_RELAY_MSG_DOWNSTREAM:
603
44
        {
604
44
            zbee_nwk_hints_t *nwk_hints  = (zbee_nwk_hints_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_zbee_nwk, 0);
605
44
            nwk_hints->relay_type = (cmd_id == ZBEE_APS_CMD_RELAY_MSG_DOWNSTREAM ? ZBEE_APS_RELAY_DOWNSTREAM : ZBEE_APS_RELAY_UPSTREAM);
606
44
            offset = dissect_aps_relay_local_tlv(tvb, pinfo, tree, offset, data);
607
44
            break;
608
3
        }
609
610
159
        case ZBEE_APS_CMD_TRANSPORT_KEY:
611
159
        {
612
159
            offset = dissect_lk_features_capabilities_tlv(tvb, pinfo, tree, offset);
613
159
            break;
614
3
        }
615
616
388
        default:
617
388
        {
618
388
            offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
619
388
            break;
620
3
        }
621
591
    }
622
623
564
    return offset;
624
591
}
625
626
/**
627
 *Dissector for Route Request Extended Route Information TLV
628
 *
629
 *@param tvb pointer to buffer containing raw packet.
630
 *@param pinfo pointer to packet information fields
631
 *@param tree pointer to data tree Wireshark uses to display packet.
632
 *@param  offset into the tvb to begin dissection.
633
 *@return offset after command dissection.
634
 */
635
static unsigned
636
dissect_zbee_tlv_route_req_extended_route_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
637
143
{
638
143
    proto_tree_add_item(tree, hf_zbee_tlv_routing_sequence_number, tvb, offset, 2, ENC_LITTLE_ENDIAN);
639
143
    offset += 2;
640
641
143
    proto_tree_add_item(tree, hf_zbee_tlv_initial_radius, tvb, offset, 1, ENC_NA);
642
143
    offset += 1;
643
644
143
    return offset;
645
143
}
646
647
/**
648
 *Dissector for Route Request Concentrator Information TLV
649
 *
650
 *@param tvb pointer to buffer containing raw packet.
651
 *@param pinfo pointer to packet information fields
652
 *@param tree pointer to data tree Wireshark uses to display packet.
653
 *@param  offset into the tvb to begin dissection.
654
 *@return offset after command dissection.
655
 */
656
static unsigned
657
dissect_zbee_tlv_concentrator_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
658
25
{
659
25
    proto_tree_add_item(tree, hf_zbee_tlv_concentrator_discovery_time, tvb, offset, 1, ENC_NA);
660
25
    offset += 1;
661
662
25
    proto_tree_add_item(tree, hf_zbee_tlv_max_source_route_length, tvb, offset, 1, ENC_NA);
663
25
    offset += 1;
664
665
25
    return offset;
666
25
}
667
668
/**
669
 *Dissector for Route Request Source Route Solicitation TLV
670
 *
671
 *@param tvb pointer to buffer containing raw packet.
672
 *@param pinfo pointer to packet information fields
673
 *@param tree pointer to data tree Wireshark uses to display packet.
674
 *@param  offset into the tvb to begin dissection.
675
 *@return offset after command dissection.
676
 */
677
static unsigned
678
dissect_zbee_tlv_source_route_solicit(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int length, unsigned offset)
679
57
{
680
57
    uint8_t i;
681
57
    uint8_t addr_count = length / 2U;
682
683
320
    for (i = 0; i < (addr_count); i++)
684
263
    {
685
263
        proto_tree_add_item(tree, hf_zbee_tlv_nwk_addr_of_interest, tvb, offset, 2, ENC_LITTLE_ENDIAN);
686
263
        offset += 2;
687
263
    }
688
689
57
    return offset;
690
57
}
691
692
static unsigned
693
dissect_nwk_route_req_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
694
292
{
695
292
    uint8_t type;
696
292
    uint8_t length;
697
698
292
    type = tvb_get_uint8(tvb, offset);
699
292
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_route_req, tvb, offset, 1, ENC_NA);
700
292
    offset += 1;
701
702
292
    length = tvb_get_uint8(tvb, offset);
703
292
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
704
292
    offset += 1;
705
706
292
    length += 1;
707
292
    switch (type) {
708
143
        case ZBEE_TLV_TYPE_EXTENDED_ROUTE_INFO:
709
143
            offset = dissect_zbee_tlv_route_req_extended_route_info(tvb, pinfo, tree, offset);
710
143
            break;
711
712
25
        case ZBEE_TLV_TYPE_CONCENTRATOR_INFO:
713
25
            offset = dissect_zbee_tlv_concentrator_info(tvb, pinfo, tree, offset);
714
25
            break;
715
716
57
        case ZBEE_TLV_TYPE_SOURCE_ROUTE_SOLICIT_INFO:
717
57
            offset = dissect_zbee_tlv_source_route_solicit(tvb, pinfo, tree, length, offset);
718
57
            break;
719
720
67
        default:
721
67
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
722
67
            offset += length;
723
67
            break;
724
292
    }
725
726
286
    return offset;
727
292
}
728
729
/**
730
 *Dissector for Extended Route Information TLV
731
 *
732
 *@param tvb pointer to buffer containing raw packet.
733
 *@param pinfo pointer to packet information fields
734
 *@param tree pointer to data tree Wireshark uses to display packet.
735
 *@param  offset into the tvb to begin dissection.
736
 *@return offset after command dissection.
737
 */
738
static unsigned
739
dissect_zbee_tlv_extended_route_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
740
165
{
741
165
    proto_tree_add_item(tree, hf_zbee_tlv_routing_sequence_number, tvb, offset, 2, ENC_LITTLE_ENDIAN);
742
165
    offset += 2;
743
744
165
    return offset;
745
165
}
746
747
static unsigned
748
dissect_nwk_route_reply_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
749
115
{
750
115
    uint8_t type;
751
115
    uint8_t length;
752
753
115
    type = tvb_get_uint8(tvb, offset);
754
115
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_route_reply, tvb, offset, 1, ENC_NA);
755
115
    offset += 1;
756
757
115
    length = tvb_get_uint8(tvb, offset);
758
115
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
759
115
    offset += 1;
760
761
115
    length += 1;
762
115
    switch (type) {
763
60
        case ZBEE_TLV_TYPE_EXTENDED_ROUTE_INFO:
764
60
            offset = dissect_zbee_tlv_extended_route_info(tvb, pinfo, tree, offset);
765
60
            break;
766
767
55
        default:
768
55
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
769
55
            offset += length;
770
55
            break;
771
115
    }
772
773
113
    return offset;
774
115
}
775
776
static unsigned
777
dissect_nwk_status_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
778
179
{
779
179
    uint8_t type;
780
179
    uint8_t length;
781
782
179
    type = tvb_get_uint8(tvb, offset);
783
179
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_network_status, tvb, offset, 1, ENC_NA);
784
179
    offset += 1;
785
786
179
    length = tvb_get_uint8(tvb, offset);
787
179
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
788
179
    offset += 1;
789
790
179
    length += 1;
791
179
    switch (type) {
792
105
        case ZBEE_TLV_TYPE_EXTENDED_ROUTE_INFO:
793
105
            offset = dissect_zbee_tlv_extended_route_info(tvb, pinfo, tree, offset);
794
105
            break;
795
796
74
        default:
797
74
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
798
74
            offset += length;
799
74
            break;
800
179
    }
801
802
176
    return offset;
803
179
}
804
805
static unsigned
806
dissect_nwk_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, unsigned cmd_id)
807
822
{
808
822
    switch (cmd_id) {
809
292
        case ZBEE_NWK_CMD_ROUTE_REQ:
810
292
            offset = dissect_nwk_route_req_local_tlv(tvb, pinfo, tree, offset);
811
292
            break;
812
813
115
        case ZBEE_NWK_CMD_ROUTE_REPLY:
814
115
            offset = dissect_nwk_route_reply_local_tlv(tvb, pinfo, tree, offset);
815
115
            break;
816
817
179
        case ZBEE_NWK_CMD_NWK_STATUS:
818
179
            offset = dissect_nwk_status_local_tlv(tvb, pinfo, tree, offset);
819
179
            break;
820
821
236
        default:
822
236
            offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
823
236
            break;
824
822
    }
825
826
796
    return offset;
827
822
}
828
829
/*
830
 *Helper dissector for the Security Decommission Request.
831
 *
832
 *@param tvb pointer to buffer containing raw packet.
833
 *@param pinfo pointer to packet information fields
834
 *@param tree pointer to the command subtree.
835
 *@param  offset into the tvb to begin dissection.
836
 *@return offset after command dissection.
837
*/
838
static unsigned
839
dissect_zdp_req_security_decommission_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
840
132
{
841
132
    uint8_t type;
842
132
    uint8_t length;
843
844
132
    proto_tree_add_item_ret_uint8(tree, hf_zbee_tlv_local_type_req_security_decommission, tvb, offset, 1, ENC_NA, &type);
845
132
    offset += 1;
846
847
132
    proto_tree_add_item_ret_uint8(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA, &length);
848
132
    offset += 1;
849
850
132
    length += 1;
851
132
    switch (type) {
852
72
        case ZBEE_TLV_TYPE_EUI64:
853
72
            offset = dissect_zbee_tlv_eui64(tvb, pinfo, tree, offset);
854
72
            break;
855
856
60
        default:
857
60
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
858
60
            offset += length;
859
60
            break;
860
132
    }
861
862
119
    return offset;
863
132
}
864
865
/*
866
 *Helper dissector for the Security Get Authentication Level Request.
867
 *
868
 *@param tvb pointer to buffer containing raw packet.
869
 *@param pinfo pointer to packet information fields
870
 *@param tree pointer to the command subtree.
871
 *@param  offset into the tvb to begin dissection.
872
 *@return offset after command dissection.
873
*/
874
static unsigned
875
dissect_zdp_req_security_get_auth_level_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
876
109
{
877
109
    uint8_t type;
878
109
    uint8_t length;
879
880
109
    type = tvb_get_uint8(tvb, offset);
881
109
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_security_get_auth_level, tvb, offset, 1, ENC_NA);
882
109
    offset += 1;
883
884
109
    length = tvb_get_uint8(tvb, offset);
885
109
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
886
109
    offset += 1;
887
888
109
    length += 1;
889
109
    switch (type) {
890
60
        case ZBEE_TLV_TYPE_TARGET_IEEE_ADDRESS:
891
60
            offset = dissect_zbee_tlv_target_ieee_address(tvb, pinfo, tree, offset);
892
60
            break;
893
894
49
        default:
895
49
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
896
49
            offset += length;
897
49
            break;
898
109
    }
899
900
105
    return offset;
901
109
}
902
/*
903
 *Helper dissector for the Security Get Authentication Token Request.
904
 *
905
 *@param tvb pointer to buffer containing raw packet.
906
 *@param pinfo pointer to packet information fields
907
 *@param tree pointer to the command subtree.
908
 *@param  offset into the tvb to begin dissection.
909
 *@return offset after command dissection.
910
*/
911
static unsigned
912
dissect_zdp_req_security_get_auth_token_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
913
285
{
914
285
    uint8_t type;
915
285
    uint8_t length;
916
917
285
    type = tvb_get_uint8(tvb, offset);
918
285
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_security_get_auth_token, tvb, offset, 1, ENC_NA);
919
285
    offset += 1;
920
921
285
    length = tvb_get_uint8(tvb, offset);
922
285
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
923
285
    offset += 1;
924
925
285
    length += 1;
926
285
    switch (type) {
927
218
        case ZBEE_TLV_TYPE_REQUESTED_AUTH_TOKEN_ID:
928
218
            offset = dissect_zbee_tlv_requested_auth_token_id(tvb, pinfo, tree, offset);
929
218
            break;
930
931
67
        default:
932
67
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
933
67
            offset += length;
934
67
            break;
935
285
    }
936
937
274
    return offset;
938
285
}
939
940
/*
941
 *Helper dissector for the Clear All Bindings Request.
942
 *
943
 *@param tvb pointer to buffer containing raw packet.
944
 *@param pinfo pointer to packet information fields
945
 *@param tree pointer to the command subtree.
946
 *@param  offset into the tvb to begin dissection.
947
 *@return offset after command dissection.
948
*/
949
static unsigned
950
dissect_zdp_req_clear_all_bindings_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
951
268
{
952
268
    uint8_t type;
953
268
    uint8_t length;
954
955
268
    type = tvb_get_uint8(tvb, offset);
956
268
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_clear_all_bindings_req, tvb, offset, 1, ENC_NA);
957
268
    offset += 1;
958
959
268
    length = tvb_get_uint8(tvb, offset);
960
268
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
961
268
    offset += 1;
962
963
268
    length += 1;
964
268
    switch (type) {
965
181
        case ZBEE_TLV_TYPE_CLEAR_ALL_BINDIGS_REQ_EUI64:
966
181
            offset = dissect_zbee_tlv_clear_all_bindigs_eui64(tvb, pinfo, tree, offset);
967
181
            break;
968
969
87
        default:
970
87
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
971
87
            offset += length;
972
87
            break;
973
268
    }
974
975
241
    return offset;
976
268
}
977
978
/*
979
 *Helper dissector for the Beacon Survey Request.
980
 *
981
 *@param tvb pointer to buffer containing raw packet.
982
 *@param pinfo pointer to packet information fields
983
 *@param tree pointer to the command subtree.
984
 *@param  offset into the tvb to begin dissection.
985
 *@return offset after command dissection.
986
*/
987
static unsigned
988
dissect_zdp_req_beacon_survey_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
989
453
{
990
453
    uint8_t type;
991
453
    uint8_t length;
992
993
453
    type = tvb_get_uint8(tvb, offset);
994
453
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_beacon_survey, tvb, offset, 1, ENC_NA);
995
453
    offset += 1;
996
997
453
    length = tvb_get_uint8(tvb, offset);
998
453
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
999
453
    offset += 1;
1000
1001
453
    length += 1;
1002
453
    switch (type) {
1003
330
        case ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION:
1004
330
        {
1005
330
            uint8_t cnt;
1006
330
            uint8_t i;
1007
1008
330
            cnt = tvb_get_uint8(tvb, offset);
1009
330
            proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask_cnt, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1010
330
            offset += 1;
1011
1012
1.14k
            for (i = 0; i < cnt; i++)
1013
813
            {
1014
813
              proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1015
813
              offset += 4;
1016
813
            }
1017
1018
330
            proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_conf_mask, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1019
330
            offset += 1;
1020
330
            break;
1021
0
        }
1022
123
        default:
1023
123
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1024
123
            offset += length;
1025
123
            break;
1026
453
    }
1027
1028
423
    return offset;
1029
453
}
1030
1031
/*
1032
 *Helper dissector for the Beacon Survey Response.
1033
 *
1034
 *@param tvb pointer to buffer containing raw packet.
1035
 *@param pinfo pointer to packet information fields
1036
 *@param tree pointer to the command subtree.
1037
 *@param  offset into the tvb to begin dissection.
1038
 *@return offset after command dissection.
1039
*/
1040
static unsigned
1041
dissect_zdp_rsp_beacon_survey_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1042
312
{
1043
312
    uint8_t type;
1044
312
    uint8_t length;
1045
1046
312
    type = tvb_get_uint8(tvb, offset);
1047
312
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_rsp_beacon_survey, tvb, offset, 1, ENC_NA);
1048
312
    offset += 1;
1049
1050
312
    length = tvb_get_uint8(tvb, offset);
1051
312
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1052
312
    offset += 1;
1053
1054
312
    length += 1;
1055
312
    switch (type) {
1056
213
        case ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION:
1057
213
        {
1058
213
            uint8_t cnt;
1059
213
            uint8_t i;
1060
1061
213
            proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_conf_mask, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1062
213
            offset += 1;
1063
1064
213
            cnt = tvb_get_uint8(tvb, offset);
1065
213
            proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask_cnt, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1066
213
            offset += 1;
1067
1068
669
            for (i = 0; i < cnt; i++)
1069
456
            {
1070
456
              proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1071
456
              offset += 4;
1072
456
            }
1073
1074
213
            break;
1075
0
        }
1076
1077
11
        case ZBEE_TLV_TYPE_BEACON_SURVEY_RESULTS:
1078
11
        {
1079
11
            proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_total, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1080
11
            offset += 1;
1081
1082
11
            proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_cur_zbn, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1083
11
            offset += 1;
1084
1085
11
            proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_cur_zbn_potent_parents, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1086
11
            offset += 1;
1087
1088
11
            proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_other_zbn, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1089
11
            offset += 1;
1090
1091
11
            break;
1092
0
        }
1093
1094
41
        case ZBEE_TLV_TYPE_BEACON_SURVEY_POTENTIAL_PARENTS:
1095
41
            offset = dissect_zbee_tlv_potential_parents(tvb, pinfo, tree, offset);
1096
41
            break;
1097
1098
47
        default:
1099
47
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1100
47
            offset += length;
1101
47
            break;
1102
312
    }
1103
1104
267
    return offset;
1105
312
}
1106
1107
/*
1108
 *Helper dissector for the Security Challenge Request.
1109
 *
1110
 *@param tvb pointer to buffer containing raw packet.
1111
 *@param pinfo pointer to packet information fields
1112
 *@param tree pointer to the command subtree.
1113
 *@param  offset into the tvb to begin dissection.
1114
 *@return offset after command dissection.
1115
*/
1116
static unsigned
1117
dissect_zdp_req_security_challenge_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1118
106
{
1119
106
    uint8_t type;
1120
106
    uint8_t length;
1121
1122
106
    type = tvb_get_uint8(tvb, offset);
1123
106
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_challenge, tvb, offset, 1, ENC_NA);
1124
106
    offset += 1;
1125
1126
106
    length = tvb_get_uint8(tvb, offset);
1127
106
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1128
106
    offset += 1;
1129
1130
106
    length += 1;
1131
106
    switch (type) {
1132
77
       case 0:
1133
77
       {
1134
77
           proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
1135
77
           offset += 8;
1136
1137
77
           proto_tree_add_item(tree, hf_zbee_tlv_challenge_value, tvb, offset, 8, ENC_NA);
1138
77
           offset += 8;
1139
77
           break;
1140
0
       }
1141
29
       default:
1142
29
           proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1143
29
           offset += length;
1144
29
           break;
1145
106
    }
1146
1147
102
    return offset;
1148
106
}
1149
1150
/*
1151
 *Helper dissector for the Security Challenge Response.
1152
 *
1153
 *@param tvb pointer to buffer containing raw packet.
1154
 *@param pinfo pointer to packet information fields
1155
 *@param tree pointer to the command subtree.
1156
 *@param  offset into the tvb to begin dissection.
1157
 *@return offset after command dissection.
1158
*/
1159
static unsigned
1160
dissect_zdp_rsp_security_challenge_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1161
24
{
1162
24
    uint8_t type;
1163
24
    uint8_t length;
1164
1165
24
    proto_tree_add_item_ret_uint8(tree, hf_zbee_tlv_local_type_rsp_challenge, tvb, offset, 1, ENC_NA, &type);
1166
24
    offset += 1;
1167
1168
24
    proto_tree_add_item_ret_uint8(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA, &length);
1169
24
    offset += 1;
1170
1171
24
    length += 1;
1172
24
    switch (type) {
1173
8
       case 0:
1174
8
       {
1175
8
           proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
1176
8
           offset += 8;
1177
1178
8
           proto_tree_add_item(tree, hf_zbee_tlv_challenge_value, tvb, offset, 8, ENC_NA);
1179
8
           offset += 8;
1180
1181
8
           proto_tree_add_item(tree, hf_zbee_tlv_aps_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1182
8
           offset += 4;
1183
1184
8
           proto_tree_add_item(tree, hf_zbee_tlv_challenge_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1185
8
           offset += 4;
1186
1187
           /* TODO: should this really be shown as big endian? */
1188
8
           proto_tree_add_item(tree, hf_zbee_tlv_mic64, tvb, offset, 8, ENC_BIG_ENDIAN);
1189
8
           offset += 8;
1190
8
           break;
1191
0
       }
1192
16
       default:
1193
16
           proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1194
16
           offset += length;
1195
16
           break;
1196
24
    }
1197
1198
24
    return offset;
1199
24
}
1200
1201
1202
/*
1203
 *Helper dissector for the Security Challenge Response.
1204
 *
1205
 *@param tvb pointer to buffer containing raw packet.
1206
 *@param pinfo pointer to packet information fields
1207
 *@param tree pointer to the command subtree.
1208
 *@param  offset into the tvb to begin dissection.
1209
 *@return offset after command dissection.
1210
*/
1211
static unsigned
1212
dissect_zdp_rsp_security_set_configuration_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1213
236
{
1214
236
  uint8_t type;
1215
236
  uint8_t length;
1216
1217
236
  proto_tree_add_item_ret_uint8(tree, hf_zbee_tlv_local_type_rsp_set_configuration, tvb, offset, 1, ENC_NA, &type);
1218
236
  offset += 1;
1219
1220
236
  proto_tree_add_item_ret_uint8(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA, &length);
1221
236
  offset += 1;
1222
1223
236
  length += 1;
1224
236
  switch (type) {
1225
153
     case 0:
1226
153
     {
1227
153
         uint8_t     count;
1228
153
         uint8_t     i;
1229
1230
153
         proto_tree_add_item_ret_uint8(tree, hf_zbee_tlv_local_status_count, tvb, offset, 1, ENC_NA, &count);
1231
153
         offset += 1;
1232
1233
597
         for (i = 0; i < count; i++)
1234
444
         {
1235
444
             proto_tree_add_item(tree, hf_zbee_tlv_local_type_id, tvb, offset, 1, ENC_NA);
1236
444
             offset += 1;
1237
444
             proto_tree_add_item(tree, hf_zbee_tlv_local_proc_status, tvb, offset, 1, ENC_NA);
1238
444
             offset += 1;
1239
444
         }
1240
153
         break;
1241
0
     }
1242
83
     default:
1243
83
         proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1244
83
         offset += length;
1245
83
         break;
1246
236
  }
1247
1248
214
  return offset;
1249
236
}
1250
1251
1252
/*
1253
 *Helper dissector for the Security Start Key Negotiation req/rsp
1254
 *
1255
 *@param tvb pointer to buffer containing raw packet.
1256
 *@param pinfo pointer to packet information fields
1257
 *@param tree pointer to the command subtree.
1258
 *@param  offset into the tvb to begin dissection.
1259
 *@return offset after command dissection.
1260
*/
1261
static unsigned
1262
dissect_zdp_security_start_key_neg_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1263
46
{
1264
46
    uint8_t type;
1265
46
    uint8_t length;
1266
1267
46
    type = tvb_get_uint8(tvb, offset);
1268
46
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_key_negotiation_req_rsp, tvb, offset, 1, ENC_NA);
1269
46
    offset += 1;
1270
1271
46
    length = tvb_get_uint8(tvb, offset);
1272
46
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1273
46
    offset += 1;
1274
1275
46
    length += 1; /* actual length */
1276
1277
46
    switch (type) {
1278
1279
20
       case ZBEE_TLV_TYPE_KEY_NEG_REQ_CURVE25519_PUBLIC_POINT:
1280
20
           offset = dissect_zbee_tlv_public_point(tvb, pinfo, tree, offset, length);
1281
20
           break;
1282
1283
26
       default:
1284
26
           proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1285
26
           offset += length;
1286
26
           break;
1287
46
    }
1288
1289
30
    return offset;
1290
46
}
1291
1292
/*
1293
 *Helper dissector for the Security Start Key Update req/rsp
1294
 *
1295
 *@param tvb pointer to buffer containing raw packet.
1296
 *@param pinfo pointer to packet information fields
1297
 *@param tree pointer to the command subtree.
1298
 *@param  offset into the tvb to begin dissection.
1299
 *@return offset after command dissection.
1300
*/
1301
static unsigned
1302
dissect_zdp_security_key_upd_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1303
128
{
1304
128
  uint8_t type;
1305
128
      uint8_t length;
1306
1307
128
      type = tvb_get_uint8(tvb, offset);
1308
128
      proto_tree_add_item(tree, hf_zbee_tlv_local_type_key_update_req_rsp, tvb, offset, 1, ENC_NA);
1309
128
      offset += 1;
1310
1311
128
      length = tvb_get_uint8(tvb, offset);
1312
128
      proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1313
128
      offset += 1;
1314
1315
128
      length += 1; /* actual length */
1316
1317
128
      switch (type) {
1318
1319
88
         case ZBEE_TLV_TYPE_KEY_UPD_REQ_SELECTED_KEY_NEGOTIATION_METHOD:
1320
88
             offset = dissect_zbee_tlv_selected_key_negotiation_method(tvb, pinfo, tree, offset);
1321
88
             break;
1322
1323
40
         default:
1324
40
             proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1325
40
             offset += length;
1326
40
             break;
1327
128
      }
1328
1329
114
      return offset;
1330
128
}
1331
/*
1332
 *Helper dissector for the Security Get Auth Level Response.
1333
 *
1334
 *@param tvb pointer to buffer containing raw packet.
1335
 *@param pinfo pointer to packet information fields
1336
 *@param tree pointer to the command subtree.
1337
 *@param  offset into the tvb to begin dissection.
1338
 *@return offset after command dissection.
1339
*/
1340
static unsigned
1341
dissect_zdp_rsp_security_get_auth_level_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1342
0
{
1343
0
    uint8_t type;
1344
0
    uint8_t length;
1345
1346
0
    type = tvb_get_uint8(tvb, offset);
1347
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_type_get_auth_level_rsp, tvb, offset, 1, ENC_NA);
1348
0
    offset += 1;
1349
1350
0
    length = tvb_get_uint8(tvb, offset);
1351
0
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
1352
0
    offset += 1;
1353
1354
0
    length += 1;
1355
0
    switch (type) {
1356
0
       case ZBEE_TLV_TYPE_GET_AUTH_LEVEL:
1357
0
           offset = dissect_zbee_tlv_device_auth_level(tvb, pinfo, tree, offset);
1358
0
           break;
1359
1360
0
       default:
1361
0
           proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
1362
0
           offset += length;
1363
0
           break;
1364
0
    }
1365
1366
0
    return offset;
1367
0
}
1368
1369
1370
/*
1371
 *Helper dissector for the ZDP commands.
1372
 *
1373
 *@param tvb pointer to buffer containing raw packet.
1374
 *@param pinfo pointer to packet information fields
1375
 *@param tree pointer to the command subtree.
1376
 *@param  offset into the tvb to begin dissection.
1377
 *@param  cmd_id - ZDP command id .
1378
 *@return offset after command dissection.
1379
*/
1380
static unsigned
1381
dissect_zdp_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, unsigned cmd_id)
1382
2.27k
{
1383
2.27k
    uint8_t total_tlv_length = 2 /*type + len fields*/ + tvb_get_uint8(tvb, offset + 1) + 1;
1384
2.27k
    uint8_t tmp_offset = offset;
1385
1386
2.27k
    switch (cmd_id) {
1387
268
        case ZBEE_ZDP_REQ_CLEAR_ALL_BINDINGS:
1388
268
            offset = dissect_zdp_req_clear_all_bindings_local_tlv(tvb, pinfo, tree, offset);
1389
268
            break;
1390
1391
85
        case ZBEE_ZDP_REQ_SECURITY_START_KEY_UPDATE:
1392
108
        case ZBEE_ZDP_RSP_SECURITY_START_KEY_UPDATE:
1393
128
        case ZBEE_ZDP_RSP_NODE_DESC:
1394
128
            offset = dissect_zdp_security_key_upd_local_tlv(tvb, pinfo, tree, offset);
1395
128
            break;
1396
1397
46
        case ZBEE_ZDP_REQ_SECURITY_START_KEY_NEGOTIATION:
1398
46
        case ZBEE_ZDP_RSP_SECURITY_START_KEY_NEGOTIATION:
1399
46
            offset = dissect_zdp_security_start_key_neg_local_tlv(tvb, pinfo, tree, offset);
1400
46
            break;
1401
1402
285
        case ZBEE_ZDP_REQ_SECURITY_GET_AUTH_TOKEN:
1403
285
            offset = dissect_zdp_req_security_get_auth_token_local_tlv(tvb, pinfo, tree, offset);
1404
285
            break;
1405
1406
109
        case ZBEE_ZDP_REQ_SECURITY_GET_AUTH_LEVEL:
1407
109
            offset = dissect_zdp_req_security_get_auth_level_local_tlv(tvb, pinfo, tree, offset);
1408
109
            break;
1409
1410
132
        case ZBEE_ZDP_REQ_SECURITY_DECOMMISSION:
1411
132
            offset = dissect_zdp_req_security_decommission_local_tlv(tvb, pinfo, tree, offset);
1412
132
            break;
1413
1414
0
        case ZBEE_ZDP_RSP_SECURITY_GET_AUTH_LEVEL:
1415
0
            offset = dissect_zdp_rsp_security_get_auth_level_local_tlv(tvb, pinfo, tree, offset);
1416
0
            break;
1417
1418
453
        case ZBEE_ZDP_REQ_MGMT_NWK_BEACON_SURVEY:
1419
453
            offset = dissect_zdp_req_beacon_survey_local_tlv(tvb, pinfo, tree, offset);
1420
453
            break;
1421
1422
312
        case ZBEE_ZDP_RSP_MGMT_NWK_BEACON_SURVEY:
1423
312
            offset = dissect_zdp_rsp_beacon_survey_local_tlv(tvb, pinfo, tree, offset);
1424
312
            break;
1425
1426
106
        case ZBEE_ZDP_REQ_SECURITY_CHALLENGE:
1427
106
            offset = dissect_zdp_req_security_challenge_local_tlv(tvb, pinfo, tree, offset);
1428
106
            break;
1429
1430
24
        case ZBEE_ZDP_RSP_SECURITY_CHALLENGE:
1431
24
            offset = dissect_zdp_rsp_security_challenge_local_tlv(tvb, pinfo, tree, offset);
1432
24
            break;
1433
1434
236
        case ZBEE_ZDP_RSP_SECURITY_SET_CONFIGURATION:
1435
236
            offset = dissect_zdp_rsp_security_set_configuration_local_tlv(tvb, pinfo, tree, offset);
1436
236
            break;
1437
175
        default:
1438
175
        {
1439
175
            offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
1440
175
            break;
1441
46
        }
1442
2.27k
    }
1443
1444
    /* check extra bytes */
1445
2.07k
    if ((offset - tmp_offset) < total_tlv_length)
1446
107
    {
1447
107
      proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, total_tlv_length - 2, ENC_NA);
1448
107
      offset = tmp_offset + total_tlv_length;
1449
107
    }
1450
1451
2.07k
    return offset;
1452
2.27k
}
1453
1454
/**
1455
 * Helper dissector for a channel mask.
1456
 *
1457
 * @param  tree        pointer to data tree Wireshark uses to display packet.
1458
 * @param  tvb         pointer to buffer containing raw packet.
1459
 * @param  offset      offset into the tvb to find the status value.
1460
 * @param  hf_page     page field index
1461
 * @param  hf_channel  channel field index
1462
 * @return mask
1463
 */
1464
static unsigned
1465
dissect_zbee_tlv_chanmask(proto_tree *tree, tvbuff_t *tvb, unsigned offset, int hf_page, int hf_channel)
1466
0
{
1467
0
    uint32_t    i;
1468
0
    uint32_t    mask;
1469
0
    uint8_t     page;
1470
0
    proto_item *ti;
1471
1472
    /* Get and display the channel mask. */
1473
0
    mask = tvb_get_letohl(tvb, offset);
1474
1475
0
    page = (uint8_t)((mask >> 27) & 0x07);
1476
0
    mask &= UINT32_C(0x07FFFFFF);
1477
1478
0
    proto_tree_add_uint(tree, hf_page, tvb, offset, 4, page);
1479
0
    ti = proto_tree_add_uint_format(tree, hf_channel, tvb, offset, 4, mask, "Channels: ");
1480
1481
    /* Check if there are any channels to display. */
1482
0
    if (mask == 0)
1483
0
    {
1484
0
        proto_item_append_text(ti, "None");
1485
0
    }
1486
1487
    /* Display the first channel #. */
1488
0
    for (i = 0; i < 32; i++)
1489
0
    {
1490
0
        if ((1 << i) & mask)
1491
0
        {
1492
0
            proto_item_append_text(ti, "%d", i++);
1493
0
            break;
1494
0
        }
1495
0
    }
1496
1497
    /* Display the rest of the channels. */
1498
0
    for (; i < 32; i++)
1499
0
    {
1500
0
        if (!((1 << i) & mask))
1501
0
        {
1502
            /* This channel isn't selected. */
1503
0
            continue;
1504
0
        }
1505
1506
        /* If the previous channel wasn't selected,
1507
         * then display the channel number.
1508
         */
1509
0
        if (!((1 << (i - 1)) & mask))
1510
0
        {
1511
0
            proto_item_append_text(ti, ", %d", i);
1512
0
        }
1513
1514
        /* If the next channel is selected too,
1515
         * skip past it and display a range of values instead.
1516
         */
1517
0
        while ((i<31) && ((2U << i) & mask)) i++;
1518
0
        proto_item_append_text(ti, "-%d", i);
1519
0
    }
1520
1521
0
    offset += sizeof(uint32_t);
1522
1523
0
    return offset;
1524
0
}
1525
1526
/**
1527
 * Dissector Extended PAN ID TLV.
1528
 *
1529
 * @param  tvb     pointer to buffer containing raw packet
1530
 * @param  pinfo   pointer to packet information fields
1531
 * @param  tree    pointer to subtree
1532
 * @param  offset  offset into the tvb to begin dissection
1533
 * @return offset after dissection
1534
 */
1535
1536
static unsigned
1537
dissect_zbee_tlv_ext_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1538
0
{
1539
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_ext_pan_id, tvb, offset, 8, ENC_LITTLE_ENDIAN);
1540
0
    offset += 8;
1541
1542
0
    return offset;
1543
0
}
1544
1545
/**
1546
 * Dissector Short PAN ID TLV.
1547
 *
1548
 * @param  tvb     pointer to buffer containing raw packet
1549
 * @param  pinfo   pointer to packet information fields
1550
 * @param  tree    pointer to subtree
1551
 * @param  offset  offset into the tvb to begin dissection
1552
 * @return offset after dissection
1553
 */
1554
1555
static unsigned
1556
dissect_zbee_tlv_short_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1557
0
{
1558
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_short_pan_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1559
0
    offset += 2;
1560
1561
0
    return offset;
1562
0
}
1563
1564
/**
1565
 * Dissector NWK Key TLV.
1566
 *
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
1572
 */
1573
1574
static unsigned dissect_zbee_tlv_nwk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1575
0
{
1576
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_nwk_key, tvb, offset, 16, ENC_NA);
1577
0
    offset += 16;
1578
1579
0
    return offset;
1580
0
}
1581
1582
/**
1583
 * Dissector Device Type TLV.
1584
 *
1585
 * @param  tvb     pointer to buffer containing raw packet
1586
 * @param  pinfo   pointer to packet information fields
1587
 * @param  tree    pointer to subtree
1588
 * @param  offset  offset into the tvb to begin dissection
1589
 * @return offset after dissection
1590
 */
1591
1592
static unsigned dissect_zbee_tlv_dev_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1593
0
{
1594
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_dev_type, tvb, offset, 1, ENC_NA);
1595
0
    offset += 1;
1596
1597
0
    return offset;
1598
0
}
1599
1600
/**
1601
 * Dissector NWK Address TLV.
1602
 *
1603
 * @param  tvb     pointer to buffer containing raw packet
1604
 * @param  pinfo   pointer to packet information fields
1605
 * @param  tree    pointer to subtree
1606
 * @param  offset  offset into the tvb to begin dissection
1607
 * @return offset after dissection
1608
 */
1609
1610
static unsigned dissect_zbee_tlv_nwk_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1611
0
{
1612
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_nwk_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1613
0
    offset += 2;
1614
1615
0
    return offset;
1616
0
}
1617
1618
/**
1619
 * Dissector Joining Method TLV.
1620
 *
1621
 * @param  tvb     pointer to buffer containing raw packet
1622
 * @param  pinfo   pointer to packet information fields
1623
 * @param  tree    pointer to subtree
1624
 * @param  offset  offset into the tvb to begin dissection
1625
 * @return offset after dissection
1626
 */
1627
1628
static unsigned dissect_zbee_tlv_join_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1629
0
{
1630
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_join_method, tvb, offset, 1, ENC_NA);
1631
0
    offset += 1;
1632
1633
0
    return offset;
1634
0
}
1635
1636
/**
1637
 * Dissector IEEE Address TLV.
1638
 *
1639
 * @param  tvb     pointer to buffer containing raw packet
1640
 * @param  pinfo   pointer to packet information fields
1641
 * @param  tree    pointer to subtree
1642
 * @param  offset  offset into the tvb to begin dissection
1643
 * @return offset after dissection
1644
 */
1645
1646
static unsigned dissect_zbee_tlv_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1647
0
{
1648
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
1649
0
    offset += 8;
1650
1651
0
    return offset;
1652
0
}
1653
1654
/**
1655
 * Dissector Trust Center Address TLV.
1656
 *
1657
 * @param  tvb     pointer to buffer containing raw packet
1658
 * @param  pinfo   pointer to packet information fields
1659
 * @param  tree    pointer to subtree
1660
 * @param  offset  offset into the tvb to begin dissection
1661
 * @return offset after dissection
1662
 */
1663
1664
static unsigned dissect_zbee_tlv_tc_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1665
0
{
1666
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_tc_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
1667
0
    offset += 8;
1668
1669
0
    return offset;
1670
0
}
1671
1672
/**
1673
 * Dissector NWK Update ID TLV.
1674
 *
1675
 * @param  tvb     pointer to buffer containing raw packet
1676
 * @param  pinfo   pointer to packet information fields
1677
 * @param  tree    pointer to subtree
1678
 * @param  offset  offset into the tvb to begin dissection
1679
 * @return offset after dissection
1680
 */
1681
1682
static unsigned dissect_zbee_tlv_nwk_upd_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1683
0
{
1684
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_nwk_upd_id, tvb, offset, 1, ENC_NA);
1685
0
    offset += 1;
1686
1687
0
    return offset;
1688
0
}
1689
1690
/**
1691
 * Dissector NWK Active Key Seq Number TLV.
1692
 *
1693
 * @param  tvb     pointer to buffer containing raw packet
1694
 * @param  pinfo   pointer to packet information fields
1695
 * @param  tree    pointer to subtree
1696
 * @param  offset  offset into the tvb to begin dissection
1697
 * @return offset after dissection
1698
 */
1699
1700
static unsigned dissect_zbee_tlv_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1701
0
{
1702
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_key_seq_num, tvb, offset, 1, ENC_NA);
1703
0
    offset += 1;
1704
1705
0
    return offset;
1706
0
}
1707
1708
/**
1709
 * Dissector Admin Key TLV.
1710
 *
1711
 * @param  tvb     pointer to buffer containing raw packet
1712
 * @param  pinfo   pointer to packet information fields
1713
 * @param  tree    pointer to subtree
1714
 * @param  offset  offset into the tvb to begin dissection
1715
 * @return offset after dissection
1716
 */
1717
1718
static unsigned dissect_zbee_tlv_adm_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1719
0
{
1720
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_adm_key, tvb, offset, 16, ENC_NA);
1721
0
    offset += 16;
1722
1723
0
    return offset;
1724
0
}
1725
1726
/**
1727
 * Dissector (Manager Joiners) Provisional Link Key TLV.
1728
 *
1729
 * @param  tvb     pointer to buffer containing raw packet
1730
 * @param  pinfo   pointer to packet information fields
1731
 * @param  tree    pointer to subtree
1732
 * @param  offset  offset into the tvb to begin dissection
1733
 * @return offset after dissection
1734
 */
1735
1736
static unsigned dissect_zbee_tlv_mj_prov_lnk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1737
0
{
1738
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_mj_prov_lnk_key, tvb, offset, 16, ENC_NA);
1739
0
    offset += 16;
1740
1741
0
    return offset;
1742
0
}
1743
1744
/**
1745
 * Dissector (Manager Joiners) IEEE Address TLV.
1746
 *
1747
 * @param  tvb     pointer to buffer containing raw packet
1748
 * @param  pinfo   pointer to packet information fields
1749
 * @param  tree    pointer to subtree
1750
 * @param  offset  offset into the tvb to begin dissection
1751
 * @return offset after dissection
1752
 */
1753
1754
static unsigned dissect_zbee_tlv_mj_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1755
0
{
1756
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_mj_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
1757
0
    offset += 8;
1758
1759
0
    return offset;
1760
0
}
1761
1762
/**
1763
 * Dissector (Manager Joiners) Command TLV.
1764
 *
1765
 * @param  tvb     pointer to buffer containing raw packet
1766
 * @param  pinfo   pointer to packet information fields
1767
 * @param  tree    pointer to subtree
1768
 * @param  offset  offset into the tvb to begin dissection
1769
 * @return offset after dissection
1770
 */
1771
1772
static unsigned dissect_zbee_tlv_mj_cmd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1773
0
{
1774
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_mj_cmd, tvb, offset, 1, ENC_NA);
1775
0
    offset += 1;
1776
1777
0
    return offset;
1778
0
}
1779
1780
/**
1781
 * Dissector Channel List TLV.
1782
 *
1783
 * @param  tvb     pointer to buffer containing raw packet
1784
 * @param  pinfo   pointer to packet information fields
1785
 * @param  tree    pointer to subtree
1786
 * @param  offset  offset into the tvb to begin dissection
1787
 * @return offset after dissection
1788
 */
1789
static unsigned
1790
dissect_zbee_tlv_nwk_channel_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1791
0
{
1792
0
    uint32_t count = 0;
1793
1794
0
    proto_tree_add_item_ret_uint(tree, hf_zbee_tlv_local_comm_channel_page_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &count);
1795
0
    offset += 1;
1796
1797
0
    for (unsigned i = 0; i < count; i++)
1798
0
    {
1799
0
        offset = dissect_zbee_tlv_chanmask(tree, tvb, offset, hf_zbee_tlv_local_comm_channel_page, hf_zbee_tlv_local_comm_channel_mask);
1800
0
    }
1801
1802
0
    return offset;
1803
0
}
1804
1805
/**
1806
 * Dissector Link Key TLV.
1807
 *
1808
 * @param  tvb     pointer to buffer containing raw packet
1809
 * @param  pinfo   pointer to packet information fields
1810
 * @param  tree    pointer to subtree
1811
 * @param  offset  offset into the tvb to begin dissection
1812
 * @return offset after dissection
1813
 */
1814
static unsigned
1815
dissect_zbee_tlv_link_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1816
0
{
1817
0
    static int * const link_key_flags[] = {
1818
0
        &hf_zbee_tlv_local_comm_link_key_flags_unique,
1819
0
        &hf_zbee_tlv_local_comm_link_key_flags_provisional,
1820
0
        NULL
1821
0
    };
1822
1823
0
    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);
1824
0
    offset += 1;
1825
1826
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_link_key, tvb, offset, 16, ENC_NA);
1827
0
    offset += 16;
1828
1829
0
    return offset;
1830
0
}
1831
1832
/**
1833
 * Dissector NWK Status Map TLV.
1834
 *
1835
 * @param  tvb     pointer to buffer containing raw packet
1836
 * @param  pinfo   pointer to packet information fields
1837
 * @param  tree    pointer to subtree
1838
 * @param  offset  offset into the tvb to begin dissection
1839
 * @return offset after dissection
1840
 */
1841
static unsigned
1842
dissect_zbee_tlv_nwk_status_map(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1843
0
{
1844
0
    uint8_t mask;
1845
0
    unsigned   joined, opened, centralized;
1846
1847
0
    static int * const network_status_map[] = {
1848
0
        &hf_zbee_tlv_local_comm_network_status_map_joined_status,
1849
0
        &hf_zbee_tlv_local_comm_network_status_map_open_status,
1850
0
        &hf_zbee_tlv_network_status_map_network_type,
1851
0
        NULL
1852
0
    };
1853
1854
0
    mask = tvb_get_uint8(tvb, offset);
1855
0
    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);
1856
1857
0
    offset += 1;
1858
1859
0
    joined      = (mask & ZBEE_TLV_STATUS_MAP_JOINED_STATUS) >> 0;
1860
0
    opened      = (mask & ZBEE_TLV_STATUS_MAP_OPEN_STATUS)   >> 3;
1861
0
    centralized = (mask & ZBEE_TLV_STATUS_MAP_NETWORK_TYPE)  >> 4;
1862
1863
1864
0
    if (joined == ZB_DIRECT_JOINED_STATUS_JOINED || joined == ZB_DIRECT_JOINED_STATUS_JOINED_NO_PARENT)
1865
0
    {
1866
0
        col_append_fstr(pinfo->cinfo,
1867
0
                        COL_INFO,
1868
0
                        " (%s, %s, %s)",
1869
0
                        zbee_tlv_local_types_joined_status_str[joined].strptr,
1870
0
                        opened ? "Opened" : "Closed",
1871
0
                        centralized ? "Centralized" : "Distributed");
1872
0
    }
1873
0
    else
1874
0
    {
1875
0
        col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", zbee_tlv_local_types_joined_status_str[joined].strptr);
1876
0
    }
1877
1878
0
    return offset;
1879
0
}
1880
1881
/**
1882
 * Dissector Status Code TLV.
1883
 *
1884
 * @param  tvb     pointer to buffer containing raw packet
1885
 * @param  pinfo   pointer to packet information fields
1886
 * @param  tree    pointer to subtree
1887
 * @param  offset  offset into the tvb to begin dissection
1888
 * @return offset after dissection
1889
 */
1890
static unsigned
1891
dissect_zbee_tlv_status_code(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1892
0
{
1893
0
    uint32_t code;
1894
0
    proto_item *code_item;
1895
1896
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_comm_status_code_domain, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1897
0
    offset += 1;
1898
1899
0
    code_item = proto_tree_add_item_ret_uint(tree, hf_zbee_tlv_local_comm_status_code_value, tvb, offset, 1, ENC_LITTLE_ENDIAN, &code);
1900
0
    offset += 1;
1901
1902
0
    proto_item_append_text(code_item, " (%s)", (code == 0) ? "Success" : "Failure");
1903
1904
0
    return offset;
1905
0
}
1906
1907
/**
1908
 * Helper dissector for Tunneling.
1909
 *
1910
 * @param  tvb     pointer to buffer containing raw packet
1911
 * @param  pinfo   pointer to packet information fields
1912
 * @param  tree    pointer to subtree
1913
 * @return offset after dissection
1914
 */
1915
static unsigned
1916
dissect_zbee_tlv_tunneling_npdu_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset,
1917
                                               uint8_t      length)
1918
0
{
1919
0
    uint32_t npdu_len = 0;
1920
1921
    /* Parse NPDU Message TLV */
1922
0
    {
1923
0
        proto_item *npdu_flags_item = proto_tree_add_item(tree, hf_zbee_tlv_local_tunneling_npdu_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1924
0
        proto_tree *npdu_flags_tree = proto_item_add_subtree(npdu_flags_item, ett_zbee_tlv_zbd_tunneling_npdu_flags);
1925
0
        bool secur;
1926
1927
0
        proto_tree_add_item_ret_boolean(npdu_flags_tree, hf_zbee_tlv_local_tunneling_npdu_flags_security, tvb, offset, 1, ENC_LITTLE_ENDIAN, &secur);
1928
0
        proto_tree_add_item_ret_uint(tree, hf_zbee_tlv_local_tunneling_npdu_length, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN, &npdu_len);
1929
1930
0
        proto_item_append_text(npdu_flags_item, ", Security: %s", secur ? "True" : "False");
1931
0
        proto_tree_add_item(npdu_flags_tree, hf_zbee_tlv_local_tunneling_npdu_flags_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1932
0
    }
1933
1934
    /* Proceed with NPDU that holds a Zigbee NWK frame */
1935
0
    {
1936
0
        proto_item *npdu_item = proto_tree_add_item(tree, hf_zbee_tlv_local_tunneling_npdu, tvb, offset + 2, npdu_len, ENC_NA);
1937
0
        proto_tree *npdu_tree = proto_item_add_subtree(npdu_item, ett_zbee_tlv_zbd_tunneling_npdu);
1938
1939
0
        ieee802154_packet packet;
1940
0
        memset(&packet, 0, sizeof(packet));
1941
        /* XXX - Every packet having a pointer to a global table seems odd. */
1942
0
        packet.short_table = ieee802154_map.short_table;
1943
        /* XXX - Ideally src_pan, etc. should be set with information from
1944
         * ZBD commissioning messages. */
1945
1946
0
        col_append_str(pinfo->cinfo, COL_PROTOCOL, "/");
1947
0
        col_set_fence(pinfo->cinfo, COL_PROTOCOL);
1948
0
        call_dissector_with_data(zbee_nwk_handle,
1949
0
                                 tvb_new_subset_length(tvb, offset + 2, npdu_len),
1950
0
                                 pinfo,
1951
0
                                 npdu_tree,
1952
0
                                 &packet);
1953
0
    }
1954
1955
0
    offset += length;
1956
1957
0
    return offset;
1958
0
}
1959
1960
/**
1961
 * Checks a curve, that was selected in the method.
1962
 *
1963
 * @param  tvb     pointer to buffer containing raw packet
1964
 * @param  pinfo   pointer to packet information fields
1965
 * @param  tree    pointer to the command subtree
1966
 * @param  offset  offset into the tvb to begin dissection
1967
 * @return offset after command dissection
1968
 */
1969
static unsigned
1970
dissect_zbee_tlv_key_neg_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
1971
0
{
1972
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_selected_key_method, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1973
0
    offset += 1;
1974
1975
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_selected_psk_secret, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1976
0
    offset += 1;
1977
1978
0
    return offset;
1979
0
}
1980
1981
/**
1982
 * Helper dissector for the MAC tag.
1983
 *
1984
 * @param  tvb     pointer to buffer containing raw packet
1985
 * @param  pinfo   pointer to packet information fields
1986
 * @param  tree    pointer to the command subtree
1987
 * @param  offset  offset into the tvb to begin dissection
1988
 * @return offset after command dissection
1989
 */
1990
static unsigned
1991
dissect_zbee_tlv_mac_tag(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t mac_tag_size)
1992
0
{
1993
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_mac_tag, tvb, offset, mac_tag_size, ENC_NA);
1994
0
    offset += mac_tag_size;
1995
1996
0
    return offset;
1997
0
}
1998
1999
/**
2000
 * Helper dissector for the NWK key sequence number.
2001
 *
2002
 * @param  tvb     pointer to buffer containing raw packet
2003
 * @param  pinfo   pointer to packet information fields
2004
 * @param  tree    pointer to the command subtree
2005
 * @param  offset  offset into the tvb to begin dissection
2006
 * @return offset after command dissection
2007
 */
2008
static unsigned
2009
dissect_zbee_tlv_nwk_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2010
0
{
2011
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_nwk_key_seq_num, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2012
0
    offset += 1;
2013
2014
0
    return offset;
2015
0
}
2016
2017
/*
2018
 *Helper dissector for the ZB Direct Status.
2019
 *
2020
 *@param tvb pointer to buffer containing raw packet.
2021
 *@param pinfo pointer to packet information fields
2022
 *@param tree pointer to the command subtree.
2023
 *@param  offset into the tvb to begin dissection.
2024
 *@return offset after command dissection.
2025
*/
2026
static unsigned
2027
dissect_zbd_msg_status_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2028
0
{
2029
0
    uint8_t type;
2030
0
    uint8_t length;
2031
2032
0
    type = tvb_get_uint8(tvb, offset);
2033
0
    proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_tlv, tvb, offset, 1, ENC_NA);
2034
0
    offset += 1;
2035
2036
0
    length = tvb_get_uint8(tvb, offset);
2037
0
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2038
0
    offset += 1;
2039
2040
0
    length += 1;
2041
2042
0
    switch (type)
2043
0
    {
2044
0
        case ZBEE_TLV_TYPE_COMM_IEEE_ADDR:
2045
0
            offset = dissect_zbee_tlv_ieee_addr(tvb, pinfo, tree, offset);
2046
0
            break;
2047
2048
0
        case ZBEE_TLV_TYPE_COMM_NWK_STATUS_MAP:
2049
0
            offset = dissect_zbee_tlv_nwk_status_map(tvb, pinfo, tree, offset);
2050
0
            break;
2051
2052
0
        case ZBEE_TLV_TYPE_COMM_TC_ADDR:
2053
0
            offset = dissect_zbee_tlv_tc_addr(tvb, pinfo, tree, offset);
2054
0
            break;
2055
2056
0
        case ZBEE_TLV_TYPE_COMM_EXT_PAN_ID:
2057
0
            offset = dissect_zbee_tlv_ext_pan_id(tvb, pinfo, tree, offset);
2058
0
            break;
2059
2060
0
        case ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID:
2061
0
            offset = dissect_zbee_tlv_short_pan_id(tvb, pinfo, tree, offset);
2062
0
            break;
2063
2064
0
        case ZBEE_TLV_TYPE_COMM_NWK_CH:
2065
0
            offset = dissect_zbee_tlv_nwk_channel_list(tvb, pinfo, tree, offset);
2066
0
            break;
2067
2068
0
        case ZBEE_TLV_TYPE_COMM_NWK_KEY:
2069
0
            offset = dissect_zbee_tlv_nwk_key(tvb, pinfo, tree, offset);
2070
0
            break;
2071
2072
0
        case ZBEE_TLV_TYPE_COMM_NWK_ADDR:
2073
0
            offset = dissect_zbee_tlv_nwk_addr(tvb, pinfo, tree, offset);
2074
0
            break;
2075
2076
0
        case ZBEE_TLV_TYPE_COMM_NWK_UPD_ID:
2077
0
            offset = dissect_zbee_tlv_nwk_upd_id(tvb, pinfo, tree, offset);
2078
0
            break;
2079
2080
0
        case ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM:
2081
0
            offset = dissect_zbee_tlv_key_seq_num(tvb, pinfo, tree, offset);
2082
0
            break;
2083
2084
0
        case ZBEE_TLV_TYPE_COMM_DEV_TYPE:
2085
0
            offset = dissect_zbee_tlv_dev_type(tvb, pinfo, tree, offset);
2086
0
            break;
2087
2088
0
        case ZBEE_TLV_TYPE_COMM_STATUS_CODE:
2089
0
            offset = dissect_zbee_tlv_status_code(tvb, pinfo, tree, offset);
2090
0
            break;
2091
2092
0
        default:
2093
0
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2094
0
            offset += length;
2095
0
            break;
2096
0
    }
2097
2098
0
    return offset;
2099
0
}
2100
2101
/*
2102
 *Helper dissector for the ZB Direct Tunneling.
2103
 *
2104
 *@param tvb pointer to buffer containing raw packet.
2105
 *@param pinfo pointer to packet information fields
2106
 *@param tree pointer to the command subtree.
2107
 *@param  offset into the tvb to begin dissection.
2108
 *@return offset after command dissection.
2109
*/
2110
static unsigned
2111
dissect_zbd_msg_tunneling_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2112
0
{
2113
0
    uint8_t opcode = tvb_get_uint8(tvb, offset);
2114
0
    uint8_t length;
2115
2116
0
    proto_tree_add_item(tree, hf_zbee_tlv_zbd_tunneling_npdu_msg_tlv, tvb, offset, 1, ENC_NA);
2117
0
    offset += 1;
2118
2119
0
    length = tvb_get_uint8(tvb, offset);
2120
0
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2121
0
    offset += 1;
2122
2123
0
    length += 1;
2124
2125
0
    switch (opcode)
2126
0
    {
2127
0
        case ZBEE_TLV_TYPE_TUNNELING_NPDU_MESSAGE:
2128
0
        {
2129
0
            offset = dissect_zbee_tlv_tunneling_npdu_msg(tvb, pinfo, tree, offset, length);
2130
0
            break;
2131
0
        }
2132
2133
0
        default:
2134
0
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2135
0
            offset += length;
2136
0
            break;
2137
0
    }
2138
2139
0
    return offset;
2140
0
}
2141
2142
/*
2143
 *Helper dissector for the ZB Direct Manage Joiners.
2144
 *
2145
 *@param tvb pointer to buffer containing raw packet.
2146
 *@param pinfo pointer to packet information fields
2147
 *@param tree pointer to the command subtree.
2148
 *@param  offset into the tvb to begin dissection.
2149
 *@return offset after command dissection.
2150
*/
2151
static unsigned
2152
dissect_zbd_msg_manage_joiners_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2153
0
{
2154
0
    uint8_t type;
2155
0
    uint8_t length;
2156
2157
0
    type = tvb_get_uint8(tvb, offset);
2158
2159
0
    proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_mj_cmd_tlv, tvb, offset, 1, ENC_NA);
2160
0
    offset += 1;
2161
2162
0
    length = tvb_get_uint8(tvb, offset);
2163
0
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2164
0
    offset += 1;
2165
2166
0
    length += 1;
2167
2168
0
    switch (type)
2169
0
    {
2170
0
        case ZBEE_TLV_TYPE_COMM_MJ_CMD:
2171
0
            offset = dissect_zbee_tlv_mj_cmd(tvb, pinfo, tree, offset);
2172
0
            break;
2173
2174
0
        case ZBEE_TLV_TYPE_COMM_MJ_IEEE_ADDR:
2175
0
            offset = dissect_zbee_tlv_mj_ieee_addr(tvb, pinfo, tree, offset);
2176
0
            break;
2177
2178
0
        case ZBEE_TLV_TYPE_COMM_MJ_PROVISIONAL_LINK_KEY:
2179
0
            offset = dissect_zbee_tlv_mj_prov_lnk_key(tvb, pinfo, tree, offset);
2180
0
            break;
2181
2182
0
        default:
2183
0
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2184
0
            offset += length;
2185
0
            break;
2186
0
    }
2187
2188
0
    return offset;
2189
0
}
2190
2191
/*
2192
 *Helper dissector for the ZB Direct Direct Join.
2193
 *
2194
 *@param tvb pointer to buffer containing raw packet.
2195
 *@param pinfo pointer to packet information fields
2196
 *@param tree pointer to the command subtree.
2197
 *@param  offset into the tvb to begin dissection.
2198
 *@return offset after command dissection.
2199
*/
2200
static unsigned
2201
dissect_zbd_msg_join_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2202
0
{
2203
0
    uint8_t type;
2204
0
    uint8_t length;
2205
2206
0
    type = tvb_get_uint8(tvb, offset);
2207
0
    proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_tlv, tvb, offset, 1, ENC_NA);
2208
0
    offset += 1;
2209
2210
0
    length = tvb_get_uint8(tvb, offset);
2211
0
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2212
0
    offset += 1;
2213
2214
0
    length += 1;
2215
2216
0
    switch (type)
2217
0
    {
2218
0
        case ZBEE_TLV_TYPE_COMM_JOIN_METHOD:
2219
0
            offset = dissect_zbee_tlv_join_method(tvb, pinfo, tree, offset);
2220
0
            break;
2221
2222
0
        case ZBEE_TLV_TYPE_COMM_ADMIN_KEY:
2223
0
            offset = dissect_zbee_tlv_adm_key(tvb, pinfo, tree, offset);
2224
0
            break;
2225
2226
0
        case ZBEE_TLV_TYPE_COMM_TC_ADDR:
2227
0
            offset = dissect_zbee_tlv_tc_addr(tvb, pinfo, tree, offset);
2228
0
            break;
2229
2230
0
        case ZBEE_TLV_TYPE_COMM_EXT_PAN_ID:
2231
0
            offset = dissect_zbee_tlv_ext_pan_id(tvb, pinfo, tree, offset);
2232
0
            break;
2233
2234
0
        case ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID:
2235
0
            offset = dissect_zbee_tlv_short_pan_id(tvb, pinfo, tree, offset);
2236
0
            break;
2237
2238
0
        case ZBEE_TLV_TYPE_COMM_NWK_CH:
2239
0
            offset = dissect_zbee_tlv_nwk_channel_list(tvb, pinfo, tree, offset);
2240
0
            break;
2241
2242
0
        case ZBEE_TLV_TYPE_COMM_NWK_KEY:
2243
0
            offset = dissect_zbee_tlv_nwk_key(tvb, pinfo, tree, offset);
2244
0
            break;
2245
2246
0
        case ZBEE_TLV_TYPE_COMM_LNK_KEY:
2247
0
            offset = dissect_zbee_tlv_link_key(tvb, pinfo, tree, offset);
2248
0
            break;
2249
2250
0
        case ZBEE_TLV_TYPE_COMM_NWK_ADDR:
2251
0
            offset = dissect_zbee_tlv_nwk_addr(tvb, pinfo, tree, offset);
2252
0
            break;
2253
2254
0
        case ZBEE_TLV_TYPE_COMM_NWK_UPD_ID:
2255
0
            offset = dissect_zbee_tlv_nwk_upd_id(tvb, pinfo, tree, offset);
2256
0
            break;
2257
2258
0
        case ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM:
2259
0
            offset = dissect_zbee_tlv_key_seq_num(tvb, pinfo, tree, offset);
2260
0
            break;
2261
2262
0
        default:
2263
0
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2264
0
            offset += length;
2265
0
            break;
2266
0
    }
2267
2268
0
    return offset;
2269
0
}
2270
2271
/*
2272
 *Helper dissector for the ZB Direct Formation.
2273
 *
2274
 *@param tvb pointer to buffer containing raw packet.
2275
 *@param pinfo pointer to packet information fields
2276
 *@param tree pointer to the command subtree.
2277
 *@param  offset into the tvb to begin dissection.
2278
 *@return offset after command dissection.
2279
*/
2280
static unsigned
2281
dissect_zbd_msg_formation_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2282
0
{
2283
0
    uint8_t type;
2284
0
    uint8_t length;
2285
2286
0
    type = tvb_get_uint8(tvb, offset);
2287
0
    proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_tlv, tvb, offset, 1, ENC_NA);
2288
0
    offset += 1;
2289
2290
0
    length = tvb_get_uint8(tvb, offset);
2291
0
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2292
0
    offset += 1;
2293
2294
0
    length += 1;
2295
2296
0
    switch (type)
2297
0
    {
2298
0
        case ZBEE_TLV_TYPE_COMM_ADMIN_KEY:
2299
0
            offset = dissect_zbee_tlv_adm_key(tvb, pinfo, tree, offset);
2300
0
            break;
2301
2302
0
        case ZBEE_TLV_TYPE_COMM_TC_ADDR:
2303
0
            offset = dissect_zbee_tlv_tc_addr(tvb, pinfo, tree, offset);
2304
0
            break;
2305
2306
0
        case ZBEE_TLV_TYPE_COMM_EXT_PAN_ID:
2307
0
            offset = dissect_zbee_tlv_ext_pan_id(tvb, pinfo, tree, offset);
2308
0
            break;
2309
2310
0
        case ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID:
2311
0
            offset = dissect_zbee_tlv_short_pan_id(tvb, pinfo, tree, offset);
2312
0
            break;
2313
2314
0
        case ZBEE_TLV_TYPE_COMM_NWK_CH:
2315
0
            offset = dissect_zbee_tlv_nwk_channel_list(tvb, pinfo, tree, offset);
2316
0
            break;
2317
2318
0
        case ZBEE_TLV_TYPE_COMM_NWK_KEY:
2319
0
            offset = dissect_zbee_tlv_nwk_key(tvb, pinfo, tree, offset);
2320
0
            break;
2321
2322
0
        case ZBEE_TLV_TYPE_COMM_LNK_KEY:
2323
0
            offset = dissect_zbee_tlv_link_key(tvb, pinfo, tree, offset);
2324
0
            break;
2325
2326
0
        case ZBEE_TLV_TYPE_COMM_NWK_ADDR:
2327
0
            offset = dissect_zbee_tlv_nwk_addr(tvb, pinfo, tree, offset);
2328
0
            break;
2329
2330
0
        case ZBEE_TLV_TYPE_COMM_NWK_UPD_ID:
2331
0
            offset = dissect_zbee_tlv_nwk_upd_id(tvb, pinfo, tree, offset);
2332
0
            break;
2333
2334
0
        case ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM:
2335
0
            offset = dissect_zbee_tlv_key_seq_num(tvb, pinfo, tree, offset);
2336
0
            break;
2337
2338
0
        default:
2339
0
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2340
0
            offset += length;
2341
0
            break;
2342
0
    }
2343
2344
0
    return offset;
2345
0
}
2346
2347
/*
2348
 *Helper dissector for the ZB Direct Security Messages.
2349
 *
2350
 *@param tvb pointer to buffer containing raw packet.
2351
 *@param pinfo pointer to packet information fields
2352
 *@param tree pointer to the command subtree.
2353
 *@param  offset into the tvb to begin dissection.
2354
 *@return offset after command dissection.
2355
*/
2356
static unsigned
2357
dissect_zbd_msg_secur_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2358
0
{
2359
0
    uint8_t type;
2360
0
    uint8_t length;
2361
2362
0
    type = tvb_get_uint8(tvb, offset);
2363
0
    proto_tree_add_item(tree, hf_zbee_tlv_zbd_secur_tlv, tvb, offset, 1, ENC_NA);
2364
0
    offset += 1;
2365
2366
0
    length = tvb_get_uint8(tvb, offset);
2367
0
    proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2368
0
    offset += 1;
2369
2370
0
    length += 1;
2371
2372
0
    switch (type)
2373
0
    {
2374
0
        case ZBEE_TLV_TYPE_KEY_METHOD:
2375
0
            offset = dissect_zbee_tlv_key_neg_method(tvb, pinfo, tree, offset);
2376
0
            break;
2377
2378
0
        case ZBEE_TLV_TYPE_PUB_POINT_P256:
2379
0
        case ZBEE_TLV_TYPE_PUB_POINT_C25519:
2380
0
            offset = dissect_zbee_tlv_public_point(tvb, pinfo, tree, offset, length);
2381
0
            break;
2382
2383
0
        case ZBEE_TLV_TYPE_NWK_KEY_SEQ_NUM:
2384
0
            offset = dissect_zbee_tlv_nwk_key_seq_num(tvb, pinfo, tree, offset);
2385
0
            break;
2386
2387
0
        case ZBEE_TLV_TYPE_MAC_TAG:
2388
0
            offset = dissect_zbee_tlv_mac_tag(tvb, pinfo, tree, offset, length);
2389
0
            break;
2390
2391
0
        default:
2392
0
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2393
0
            offset += length;
2394
0
            break;
2395
0
    }
2396
2397
0
    return offset;
2398
0
}
2399
2400
/*
2401
 *Helper dissector for the ZD Direct messages.
2402
 *
2403
 *@param  tvb pointer to buffer containing raw packet
2404
 *@param  pinfo pointer to packet information fields
2405
 *@param  tree pointer to the command subtree
2406
 *@param  offset into the tvb to begin dissection
2407
 *@param  cmd_id - ZB Direct local Message ID
2408
 *@return offset after command dissection
2409
*/
2410
static unsigned
2411
dissect_zbd_local_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset, void* data _U_, unsigned cmd_id)
2412
0
{
2413
0
    uint8_t total_tlv_length = 2 /*type + len fields*/ + tvb_get_uint8(tvb, offset + 1) + 1;
2414
0
    uint8_t tmp_offset = offset;
2415
2416
0
    switch (cmd_id)
2417
0
    {
2418
0
        case ZB_DIRECT_MSG_ID_STATUS:
2419
0
            offset = dissect_zbd_msg_status_local_tlv(tvb, pinfo, tree, offset);
2420
0
            break;
2421
2422
0
        case ZB_DIRECT_MSG_ID_TUNNELING:
2423
0
            offset = dissect_zbd_msg_tunneling_local_tlv(tvb, pinfo, tree, offset);
2424
0
            break;
2425
2426
0
        case ZB_DIRECT_MSG_ID_MANAGE_JOINERS:
2427
0
            offset = dissect_zbd_msg_manage_joiners_local_tlv(tvb, pinfo, tree, offset);
2428
0
            break;
2429
2430
0
        case ZB_DIRECT_MSG_ID_JOIN:
2431
0
            offset = dissect_zbd_msg_join_local_tlv(tvb, pinfo, tree, offset);
2432
0
            break;
2433
2434
0
        case ZB_DIRECT_MSG_ID_FORMATION:
2435
0
            offset = dissect_zbd_msg_formation_local_tlv(tvb, pinfo, tree, offset);
2436
0
            break;
2437
2438
0
        case ZB_DIRECT_MSG_ID_SECUR_C25519_AESMMO:
2439
0
        case ZB_DIRECT_MSG_ID_SECUR_C25519_SHA256:
2440
0
        case ZB_DIRECT_MSG_ID_SECUR_P256:
2441
0
            offset = dissect_zbd_msg_secur_local_tlv(tvb, pinfo, tree, offset);
2442
0
            break;
2443
2444
0
        default:
2445
0
            offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
2446
0
            break;
2447
0
    }
2448
2449
    /* check extra bytes */
2450
0
    if ((offset - tmp_offset) < total_tlv_length)
2451
0
    {
2452
0
        proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, total_tlv_length - 2, ENC_NA);
2453
0
        offset = tmp_offset + total_tlv_length;
2454
0
    }
2455
2456
0
    return offset;
2457
0
}
2458
2459
/**
2460
 * *Dissector for Zigbee Manufacturer Specific Global TLV
2461
 *
2462
 *@param tvb pointer to buffer containing raw packet.
2463
 *@param pinfo pointer to packet information fields
2464
 *@param tree pointer to data tree Wireshark uses to display packet.
2465
 *@param  offset into the tvb to begin dissection.
2466
 *@param  length of TLV data
2467
 *@return offset after command dissection.
2468
 */
2469
static unsigned
2470
dissect_zbee_tlv_manufacturer_specific(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t length)
2471
40
{
2472
40
    proto_tree_add_item(tree, hf_zbee_tlv_manufacturer_specific, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2473
40
    offset += 2;
2474
2475
40
    proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length - 2, ENC_NA);
2476
40
    offset += length - 2;
2477
2478
40
    return offset;
2479
40
} /* dissect_zbee_tlv_manufacturer_specific */
2480
2481
/**
2482
 *Dissector for Zigbee Supported Key Negotiation Methods Global TLV
2483
 *
2484
 *@param tvb pointer to buffer containing raw packet.
2485
 *@param pinfo pointer to packet information fields
2486
 *@param tree pointer to data tree Wireshark uses to display packet.
2487
 *@param  offset into the tvb to begin dissection.
2488
 *@return offset after command dissection.
2489
 */
2490
static unsigned
2491
dissect_zbee_tlv_supported_key_negotiation_methods(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2492
34
{
2493
34
    static int * const supported_key_negotiation_methods[] = {
2494
34
        &hf_zbee_tlv_supported_key_negotiation_methods_key_request,
2495
34
        &hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_aes_mmo128,
2496
34
        &hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_sha256,
2497
34
        NULL
2498
34
    };
2499
2500
34
    static int * const supported_secrets[] = {
2501
34
        &hf_zbee_tlv_supported_preshared_secrets_auth_token,
2502
34
        &hf_zbee_tlv_supported_preshared_secrets_ic,
2503
34
        &hf_zbee_tlv_supported_preshared_secrets_passcode_pake,
2504
34
        &hf_zbee_tlv_supported_preshared_secrets_basic_access_key,
2505
34
        &hf_zbee_tlv_supported_preshared_secrets_admin_access_key,
2506
34
        NULL
2507
34
    };
2508
2509
34
    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);
2510
34
    offset += 1;
2511
2512
34
    proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_supported_secrets, ett_zbee_tlv_supported_secrets, supported_secrets, ENC_NA);
2513
34
    offset += 1;
2514
2515
34
    proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2516
34
    offset += 8;
2517
2518
34
    return offset;
2519
34
} /* dissect_zbee_tlv_supported_key_negotiation_methods */
2520
2521
/**
2522
 *Dissector for Zigbee PAN ID conflict report Global TLV
2523
 *
2524
 *@param tvb pointer to buffer containing raw packet.
2525
 *@param pinfo pointer to packet information fields
2526
 *@param tree pointer to data tree Wireshark uses to display packet.
2527
 *@param  offset into the tvb to begin dissection.
2528
 *@return offset after command dissection.
2529
 */
2530
static unsigned
2531
dissect_zbee_tlv_panid_conflict_report(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2532
26
{
2533
26
    proto_tree_add_item(tree, hf_zbee_tlv_panid_conflict_cnt, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2534
26
    offset += 2;
2535
2536
26
    return offset;
2537
26
}
2538
2539
2540
/**
2541
 * *Dissector for Zigbee Configuration Parameters Global TLV
2542
 *
2543
 *@param tvb pointer to buffer containing raw packet.
2544
 *@param pinfo pointer to packet information fields
2545
 *@param tree pointer to data tree Wireshark uses to display packet.
2546
 *@param  offset into the tvb to begin dissection.
2547
 *@return offset after command dissection.
2548
 */
2549
static unsigned
2550
dissect_zbee_tlv_configuration_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2551
13
{
2552
13
    static int * const bitmask[] = {
2553
13
        &hf_zbee_tlv_configuration_param_restricted_mode,
2554
13
        &hf_zbee_tlv_configuration_param_link_key_enc,
2555
13
        &hf_zbee_tlv_configuration_param_leave_req_allowed,
2556
13
        NULL
2557
13
    };
2558
2559
13
    proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_configuration_param, ett_zbee_tlv_configuration_param, bitmask, ENC_LITTLE_ENDIAN);
2560
13
    offset += 2;
2561
2562
13
    return offset;
2563
13
} /* dissect_zbee_tlv_configuration_parameters */
2564
2565
2566
/**
2567
 * *Dissector for Zigbee Configuration Parameters Global TLV
2568
 *
2569
 *@param tvb pointer to buffer containing raw packet.
2570
 *@param pinfo pointer to packet information fields
2571
 *@param tree pointer to data tree Wireshark uses to display packet.
2572
 *@param  offset into the tvb to begin dissection.
2573
 *@return offset after command dissection.
2574
 */
2575
static unsigned
2576
dissect_zbee_tlv_dev_cap_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2577
27
{
2578
27
    static int * const bitmask[] = {
2579
27
        &hf_zbee_tlv_dev_cap_ext_zbdirect_virt_device,
2580
27
        NULL
2581
27
    };
2582
2583
27
    proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_dev_cap_ext_capability_information, ett_zbee_tlv_capability_information, bitmask, ENC_LITTLE_ENDIAN);
2584
27
    offset += 2;
2585
2586
27
    return offset;
2587
27
} /* dissect_zbee_tlv_configuration_parameters */
2588
2589
/**
2590
 * *Dissector for Zigbee CPotential Parents Global TLV
2591
 *
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.
2597
 */
2598
static unsigned
2599
dissect_zbee_tlv_potential_parents(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2600
41
{
2601
41
  uint8_t count, i;
2602
2603
41
  proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_current_parent, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2604
41
  offset += 2;
2605
2606
41
  proto_tree_add_item(tree, hf_zbee_tlv_lqa, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2607
41
  offset += 1;
2608
2609
41
  count = tvb_get_uint8(tvb, offset);
2610
41
  proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_cnt_parents, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2611
41
  offset += 1;
2612
2613
282
  for (i = 0; i < count; i++)
2614
241
  {
2615
241
    proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_parent, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2616
241
    offset += 2;
2617
2618
241
    proto_tree_add_item(tree, hf_zbee_tlv_lqa, tvb, offset, 1, ENC_LITTLE_ENDIAN);
2619
241
    offset += 1;
2620
241
  }
2621
2622
41
  return offset;
2623
41
}
2624
2625
/**
2626
 * *Dissector for Zigbee Next PAN ID Change Global TLV
2627
 *
2628
 *@param tvb pointer to buffer containing raw packet.
2629
 *@param pinfo pointer to packet information fields
2630
 *@param tree pointer to data tree Wireshark uses to display packet.
2631
 *@param  offset into the tvb to begin dissection.
2632
 *@return offset after command dissection.
2633
 */
2634
static unsigned
2635
dissect_zbee_tlv_next_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2636
27
{
2637
27
    proto_tree_add_item(tree, hf_zbee_tlv_next_pan_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2638
27
    offset += 2;
2639
2640
27
    return offset;
2641
27
} /* dissect_zbee_tlv_next_pan_id */
2642
2643
/**
2644
 * *Dissector for Zigbee Next Channel Change Global TLV
2645
 *
2646
 *@param tvb pointer to buffer containing raw packet.
2647
 *@param pinfo pointer to packet information fields
2648
 *@param tree pointer to data tree Wireshark uses to display packet.
2649
 *@param  offset into the tvb to begin dissection.
2650
 *@return offset after command dissection.
2651
 */
2652
static unsigned
2653
dissect_zbee_tlv_next_channel_change(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2654
33
{
2655
    /* todo: fix this (do channel mask) */
2656
33
    proto_tree_add_item(tree, hf_zbee_tlv_next_channel_change, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2657
33
    offset += 4;
2658
2659
33
    return offset;
2660
33
} /* dissect_zbee_tlv_next_channel_change */
2661
2662
/**
2663
 * *Dissector for Zigbee Passphrase Global TLV
2664
 *
2665
 *@param tvb pointer to buffer containing raw packet.
2666
 *@param pinfo pointer to packet information fields
2667
 *@param tree pointer to data tree Wireshark uses to display packet.
2668
 *@param  offset into the tvb to begin dissection.
2669
 *@return offset after command dissection.
2670
 */
2671
static unsigned
2672
dissect_zbee_tlv_passphrase(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2673
28
{
2674
28
    proto_tree_add_item(tree, hf_zbee_tlv_passphrase, tvb, offset, 16, ENC_NA);
2675
28
    offset += 16;
2676
2677
28
    return offset;
2678
28
} /* dissect_zbee_tlv_passphrase */
2679
2680
2681
/**
2682
 * *Dissector for Zigbee Router Information Global TLV
2683
 *
2684
 *@param tvb pointer to buffer containing raw packet.
2685
 *@param pinfo pointer to packet information fields
2686
 *@param tree pointer to data tree Wireshark uses to display packet.
2687
 *@param  offset into the tvb to begin dissection.
2688
 *@return offset after command dissection.
2689
 */
2690
static unsigned
2691
dissect_zbee_tlv_router_information(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2692
27
{
2693
27
    static int * const router_information[] = {
2694
27
        &hf_zbee_tlv_router_information_hub_connectivity,
2695
27
        &hf_zbee_tlv_router_information_uptime,
2696
27
        &hf_zbee_tlv_router_information_pref_parent,
2697
27
        &hf_zbee_tlv_router_information_battery_backup,
2698
27
        &hf_zbee_tlv_router_information_enhanced_beacon_request_support,
2699
27
        &hf_zbee_tlv_router_information_mac_data_poll_keepalive_support,
2700
27
        &hf_zbee_tlv_router_information_end_device_keepalive_support,
2701
27
        &hf_zbee_tlv_router_information_power_negotiation_support,
2702
27
        NULL
2703
27
    };
2704
2705
27
    proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_router_information, ett_zbee_tlv_router_information, router_information, ENC_LITTLE_ENDIAN);
2706
27
    offset += 2;
2707
2708
27
    return offset;
2709
27
} /* dissect_zbee_tlv_router_information */
2710
2711
/**
2712
 * *Dissector for Zigbee Fragmentation Parameters Global TLV
2713
 *
2714
 *@param tvb pointer to buffer containing raw packet.
2715
 *@param pinfo pointer to packet information fields
2716
 *@param tree pointer to data tree Wireshark uses to display packet.
2717
 *@param  offset into the tvb to begin dissection.
2718
 *@return offset after command dissection.
2719
 */
2720
static unsigned
2721
dissect_zbee_tlv_fragmentation_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2722
37
{
2723
37
    proto_tree_add_item(tree, hf_zbee_tlv_node_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2724
37
    offset += 2;
2725
2726
37
    proto_tree_add_item(tree, hf_zbee_tlv_frag_opt, tvb, offset, 1, ENC_NA);
2727
37
    offset += 1;
2728
2729
37
    proto_tree_add_item(tree, hf_zbee_tlv_max_reassembled_buf_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2730
37
    offset += 2;
2731
2732
37
    return offset;
2733
37
} /* dissect_zbee_tlv_fragmentation_parameters */
2734
2735
/**
2736
 *Dissector for Zigbee Selected Key Negotiation Methods TLV
2737
 *
2738
 *@param tvb pointer to buffer containing raw packet.
2739
 *@param pinfo pointer to packet information fields
2740
 *@param tree pointer to data tree Wireshark uses to display packet.
2741
 *@param  offset into the tvb to begin dissection.
2742
 *@return offset after command dissection.
2743
 */
2744
static unsigned
2745
dissect_zbee_tlv_selected_key_negotiation_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2746
88
{
2747
88
    proto_tree_add_item(tree, hf_zbee_tlv_selected_key_negotiation_method, tvb, offset, 1, ENC_NA);
2748
88
    offset += 1;
2749
2750
88
    proto_tree_add_item(tree, hf_zbee_tlv_selected_pre_shared_secret, tvb, offset, 1, ENC_NA);
2751
88
    offset += 1;
2752
2753
88
    proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2754
88
    offset += 8;
2755
2756
88
    return offset;
2757
88
} /* dissect_zbee_tlv_selected_key_negotiation_methods */
2758
2759
2760
/**
2761
 *Dissector for Public Point TLVs
2762
 *
2763
 *@param tvb pointer to buffer containing raw packet.
2764
 *@param pinfo pointer to packet information fields
2765
 *@param tree pointer to data tree Wireshark uses to display packet.
2766
 *@param  offset into the tvb to begin dissection.
2767
 *@return offset after command dissection.
2768
 */
2769
static unsigned
2770
dissect_zbee_tlv_public_point(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, uint8_t length)
2771
20
{
2772
20
    uint8_t public_point_length = length - 8;
2773
2774
20
    proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2775
20
    offset += 8;
2776
2777
20
    proto_tree_add_item(tree, hf_zbee_tlv_public_point, tvb, offset, public_point_length, ENC_NA);
2778
20
    offset += public_point_length;
2779
2780
20
    return offset;
2781
20
} /* dissect_zbee_tlv_curve25519_public_point */
2782
2783
/*
2784
 *Dissector for Security Decommission Req EUI64 TLV
2785
 *
2786
 *@param tvb pointer to buffer containing raw packet.
2787
 *@param pinfo pointer to packet information fields
2788
 *@param tree pointer to data tree Wireshark uses to display packet.
2789
 *@param  offset into the tvb to begin dissection.
2790
 *@return offset after command dissection.
2791
 */
2792
static unsigned
2793
dissect_zbee_tlv_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2794
253
{
2795
253
    uint8_t eui64_count;
2796
253
    uint8_t i;
2797
2798
253
    eui64_count = tvb_get_uint8(tvb, offset);
2799
253
    proto_tree_add_item(tree, hf_zbee_tlv_count, tvb, offset, 1, ENC_NA);
2800
253
    offset += 1;
2801
2802
764
    for (i = 0; i < eui64_count; i++)
2803
511
    {
2804
511
        proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2805
511
        offset += 8;
2806
511
    }
2807
2808
253
    return offset;
2809
253
}
2810
2811
/*
2812
 *Dissector for Clear All Bindings Req EUI64 TLV
2813
 *
2814
 *@param tvb pointer to buffer containing raw packet.
2815
 *@param pinfo pointer to packet information fields
2816
 *@param tree pointer to data tree Wireshark uses to display packet.
2817
 *@param  offset into the tvb to begin dissection.
2818
 *@return offset after command dissection.
2819
 */
2820
static unsigned
2821
dissect_zbee_tlv_clear_all_bindigs_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2822
181
{
2823
181
    return dissect_zbee_tlv_eui64(tvb, pinfo, tree, offset);
2824
181
}
2825
2826
/*
2827
 *Dissector for Requested Authentication Token ID TLV
2828
 *
2829
 *@param tvb pointer to buffer containing raw packet.
2830
 *@param pinfo pointer to packet information fields
2831
 *@param tree pointer to data tree Wireshark uses to display packet.
2832
 *@param  offset into the tvb to begin dissection.
2833
 *@return offset after command dissection.
2834
 */
2835
static unsigned
2836
dissect_zbee_tlv_requested_auth_token_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2837
218
{
2838
218
    proto_tree_add_item(tree, hf_zbee_tlv_global_tlv_id, tvb, offset, 1, ENC_NA);
2839
218
    offset += 1;
2840
2841
218
    return offset;
2842
218
}
2843
2844
/*
2845
 *Dissector for Target IEEE Address TLV
2846
 *
2847
 *@param tvb pointer to buffer containing raw packet.
2848
 *@param pinfo pointer to packet information fields
2849
 *@param tree pointer to data tree Wireshark uses to display packet.
2850
 *@param  offset into the tvb to begin dissection.
2851
 *@return offset after command dissection.
2852
 */
2853
static unsigned
2854
dissect_zbee_tlv_target_ieee_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2855
60
{
2856
60
    proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2857
60
    offset += 8;
2858
2859
60
    return offset;
2860
60
}
2861
2862
/**
2863
 * *Dissector for Device Authentication Level TLV
2864
 *
2865
 *@param tvb pointer to buffer containing raw packet.
2866
 *@param pinfo pointer to packet information fields
2867
 *@param tree pointer to data tree Wireshark uses to display packet.
2868
 *@param  offset into the tvb to begin dissection.
2869
 *@return offset after command dissection.
2870
 */
2871
static unsigned
2872
dissect_zbee_tlv_device_auth_level(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2873
0
{
2874
2875
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
2876
0
    offset += 8;
2877
2878
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_initial_join_method, tvb, offset, 1, ENC_NA);
2879
0
    offset += 1;
2880
2881
0
    proto_tree_add_item(tree, hf_zbee_tlv_local_active_lk_type, tvb, offset, 1, ENC_NA);
2882
0
    offset += 1;
2883
2884
0
    return offset;
2885
0
} /* dissect_zbee_tlv_device_auth_level */
2886
2887
/*
2888
 * ToDo: descr
2889
 */
2890
static unsigned
2891
// NOLINTNEXTLINE(misc-no-recursion)
2892
dissect_global_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2893
2.87k
{
2894
2.87k
    uint8_t type;
2895
2.87k
    uint8_t length;
2896
2.87k
    unsigned   tmp_offset;
2897
2898
2.87k
    proto_tree_add_item_ret_uint8(tree, hf_zbee_tlv_global_type, tvb, offset, 1, ENC_NA, &type);
2899
2.87k
    offset += 1;
2900
2901
2.87k
    length = tvb_get_uint8(tvb, offset);
2902
2.87k
    proto_tree_add_item_ret_uint8(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA, &length);
2903
2.87k
    offset += 1;
2904
2905
2.87k
    length += 1;
2906
2.87k
    tmp_offset = offset;
2907
2.87k
    switch (type) {
2908
40
        case ZBEE_TLV_TYPE_MANUFACTURER_SPECIFIC:
2909
40
            offset = dissect_zbee_tlv_manufacturer_specific(tvb, pinfo, tree, offset, length);
2910
40
            break;
2911
2912
34
        case ZBEE_TLV_TYPE_SUPPORTED_KEY_NEGOTIATION_METHODS:
2913
34
            offset = dissect_zbee_tlv_supported_key_negotiation_methods(tvb, pinfo, tree, offset);
2914
34
            break;
2915
2916
26
        case ZBEE_TLV_TYPE_PANID_CONFLICT_REPORT:
2917
26
            offset = dissect_zbee_tlv_panid_conflict_report(tvb, pinfo, tree, offset);
2918
26
            break;
2919
2920
27
        case ZBEE_TLV_TYPE_NEXT_PAN_ID:
2921
27
            offset = dissect_zbee_tlv_next_pan_id(tvb, pinfo, tree, offset);
2922
27
            break;
2923
2924
33
        case ZBEE_TLV_TYPE_NEXT_CHANNEL_CHANGE:
2925
33
            offset = dissect_zbee_tlv_next_channel_change(tvb, pinfo, tree, offset);
2926
33
            break;
2927
2928
28
        case ZBEE_TLV_TYPE_PASSPHRASE:
2929
28
            offset = dissect_zbee_tlv_passphrase(tvb, pinfo, tree, offset);
2930
28
            break;
2931
2932
27
        case ZBEE_TLV_TYPE_ROUTER_INFORMATION:
2933
27
            offset = dissect_zbee_tlv_router_information(tvb, pinfo, tree, offset);
2934
27
            break;
2935
2936
37
        case ZBEE_TLV_TYPE_FRAGMENTATION_PARAMETERS:
2937
37
            offset = dissect_zbee_tlv_fragmentation_parameters(tvb, pinfo, tree, offset);
2938
37
            break;
2939
2940
53
        case ZBEE_TLV_TYPE_JOINER_ENCAPSULATION_GLOBAL:
2941
53
            offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, NULL, ZBEE_TLV_SRC_TYPE_DEFAULT, 0);
2942
53
            break;
2943
2944
43
        case ZBEE_TLV_TYPE_BEACON_APPENDIX_ENCAPSULATION_GLOBAL:
2945
43
            offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, NULL, ZBEE_TLV_SRC_TYPE_DEFAULT, 0);
2946
43
            break;
2947
2948
13
        case ZBEE_TLV_TYPE_CONFIGURATION_MODE_PARAMETERS:
2949
13
            offset = dissect_zbee_tlv_configuration_parameters(tvb, pinfo, tree, offset);
2950
13
            break;
2951
2952
27
        case ZBEE_TLV_TYPE_DEVICE_CAPABILITY_EXTENSION:
2953
27
            offset = dissect_zbee_tlv_dev_cap_ext(tvb, pinfo, tree, offset);
2954
27
            break;
2955
2956
2.48k
        default:
2957
2.48k
            proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2958
2.48k
            offset += length;
2959
2.48k
            break;
2960
2.87k
    }
2961
2962
    /* check extra bytes */
2963
2.58k
    if ((offset - tmp_offset) < length)
2964
234
    {
2965
234
      proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2966
234
      offset = tmp_offset + length;
2967
234
    }
2968
2969
2.58k
    return offset;
2970
2.87k
}
2971
2972
/**
2973
 *Dissector for Unknown Zigbee TLV
2974
 *
2975
 *@param tvb pointer to buffer containing raw packet.
2976
 *@param pinfo pointer to packet information fields
2977
 *@param tree pointer to data tree Wireshark uses to display packet.
2978
 *@param  offset into the tvb to begin dissection.
2979
 *@return offset after command dissection.
2980
 */
2981
static unsigned
2982
dissect_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
2983
1.56k
{
2984
1.56k
  uint8_t      length;
2985
2986
1.56k
  proto_tree_add_item(tree, hf_zbee_tlv_type, tvb, offset, 1, ENC_NA);
2987
1.56k
  offset += 1;
2988
2989
1.56k
  length = tvb_get_uint8(tvb, offset);
2990
1.56k
  proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
2991
1.56k
  offset += 1;
2992
2993
1.56k
  length += 1; /* length of tlv_val == tlv_len + 1 */
2994
1.56k
  proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
2995
1.56k
  offset += length;
2996
2997
1.56k
  return offset;
2998
1.56k
}
2999
3000
/**
3001
 *Dissector for Zigbee TLV
3002
 *
3003
 *@param tvb pointer to buffer containing raw packet.
3004
 *@param pinfo pointer to packet information fields
3005
 *@param tree pointer to data tree Wireshark uses to display packet.
3006
 *@param  offset into the tvb to begin dissection.
3007
 *@return offset after command dissection.
3008
 */
3009
static unsigned
3010
// NOLINTNEXTLINE(misc-no-recursion)
3011
dissect_zbee_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void *data, uint8_t source_type, unsigned cmd_id)
3012
7.32k
{
3013
7.32k
    uint8_t      type;
3014
3015
7.32k
    type = tvb_get_uint8(tvb, offset);
3016
3017
7.32k
    if (type >= ZBEE_TLV_GLOBAL_START_NUMBER)
3018
2.87k
    {
3019
2.87k
        offset = dissect_global_tlv (tvb, pinfo, tree, offset);
3020
2.87k
    }
3021
4.45k
    else
3022
4.45k
    {
3023
4.45k
        switch (source_type)
3024
4.45k
        {
3025
2.27k
            case ZBEE_TLV_SRC_TYPE_ZBEE_ZDP:
3026
2.27k
                offset = dissect_zdp_local_tlv(tvb, pinfo, tree, offset, cmd_id);
3027
2.27k
                break;
3028
3029
591
            case ZBEE_TLV_SRC_TYPE_ZBEE_APS:
3030
591
                offset = dissect_aps_local_tlv(tvb, pinfo, tree, offset, data, cmd_id);
3031
591
                break;
3032
3033
822
            case ZBEE_TLV_SRC_TYPE_ZBEE_NWK:
3034
822
                offset = dissect_nwk_local_tlv(tvb, pinfo, tree, offset, cmd_id);
3035
822
                break;
3036
3037
0
            case ZBEE_TLV_SRC_TYPE_ZB_DIRECT:
3038
0
                offset = dissect_zbd_local_tlv(tvb, pinfo, tree, offset, data, cmd_id);
3039
0
                break;
3040
3041
764
            default:
3042
764
                offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
3043
764
                break;
3044
4.45k
        }
3045
4.45k
    }
3046
3047
6.98k
    return offset;
3048
7.32k
} /* dissect_zbee_tlv */
3049
3050
/**
3051
 *Dissector for Zigbee TLVs
3052
 *
3053
 *@param tvb pointer to buffer containing raw packet.
3054
 *@param pinfo pointer to packet information fields
3055
 *@param tree pointer to data tree Wireshark uses to display packet.
3056
 *@param  offset into the tvb to begin dissection.
3057
 *@param  source_type ToDo:
3058
 *@param  cmd_id ToDo:
3059
 *@return offset after command dissection.
3060
 */
3061
3062
1.08k
#define ZBEE_TLV_MAX_RECURSION_DEPTH 5 // Arbitrarily chosen
3063
3064
unsigned
3065
// NOLINTNEXTLINE(misc-no-recursion)
3066
dissect_zbee_tlvs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void *data, uint8_t source_type, unsigned cmd_id)
3067
1.08k
{
3068
1.08k
    proto_tree  *subtree;
3069
1.08k
    uint8_t      length;
3070
1.08k
    unsigned     recursion_depth = p_get_proto_depth(pinfo, proto_zbee_tlv);
3071
3072
1.08k
    if (++recursion_depth >= ZBEE_TLV_MAX_RECURSION_DEPTH) {
3073
97
        proto_tree_add_expert(tree, pinfo, &ei_zbee_tlv_max_recursion_depth_reached, tvb, 0, 0);
3074
97
        return offset;
3075
97
    }
3076
3077
991
    p_set_proto_depth(pinfo, proto_zbee_tlv, recursion_depth);
3078
3079
8.31k
    while (tvb_bytes_exist(tvb, offset, ZBEE_TLV_HEADER_LENGTH)) {
3080
7.32k
        length = tvb_get_uint8(tvb, offset + 1) + 1;
3081
7.32k
        subtree = proto_tree_add_subtree(tree, tvb, offset, ZBEE_TLV_HEADER_LENGTH + length, ett_zbee_tlv, NULL, "TLV");
3082
7.32k
        offset = dissect_zbee_tlv(tvb, pinfo, subtree, offset, data, source_type, cmd_id);
3083
7.32k
    }
3084
3085
991
    recursion_depth = p_get_proto_depth(pinfo, proto_zbee_tlv);
3086
991
    p_set_proto_depth(pinfo, proto_zbee_tlv, recursion_depth - 1);
3087
3088
991
    return offset;
3089
1.08k
} /* dissect_zbee_tlvs */
3090
3091
/**
3092
 * Dissector for ZBEE TLV.
3093
 *
3094
 * @param tvb pointer to buffer containing raw packet.
3095
 * @param pinfo pointer to packet information fields.
3096
 * @param tree pointer to data tree wireshark uses to display packet.
3097
 */
3098
static int
3099
dissect_zbee_tlv_default(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
3100
0
{
3101
0
  unsigned offset = 0;
3102
3103
0
  offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, data, ZBEE_TLV_SRC_TYPE_DEFAULT, 0);
3104
3105
  /* Check for leftover bytes. */
3106
0
  if (offset < tvb_captured_length(tvb)) {
3107
      /* Bytes leftover! */
3108
0
      tvbuff_t    *leftover_tvb   = tvb_new_subset_remaining(tvb, offset);
3109
      /* Dump the leftover to the data dissector. */
3110
0
      call_data_dissector(leftover_tvb, pinfo, tree);
3111
0
  }
3112
3113
0
  return tvb_captured_length(tvb);
3114
0
}
3115
3116
/**
3117
 * Proto ZBOSS Network Coprocessor product registration routine
3118
 */
3119
void proto_register_zbee_tlv(void)
3120
16
{
3121
    /* NCP protocol headers */
3122
16
    static hf_register_info hf[] = {
3123
16
        { &hf_zbee_tlv_relay_msg_type,
3124
16
        { "Type", "zbee_tlv.relay.type", FT_UINT8, BASE_HEX, VALS(zbee_aps_relay_tlvs), 0x0, NULL, HFILL }},
3125
3126
16
        { &hf_zbee_tlv_relay_msg_length,
3127
16
        { "Length", "zbee_tlv.relay.length", FT_UINT8, BASE_DEC, NULL, 0x0,  NULL, HFILL }},
3128
3129
16
        { &hf_zbee_tlv_relay_msg_joiner_ieee,
3130
16
        { "Joiner IEEE",        "zbee_tlv.relay.joiner_ieee", FT_EUI64, BASE_NONE, NULL, 0x0,
3131
16
            NULL, HFILL }},
3132
3133
16
        { &hf_zbee_tlv_global_type,
3134
16
          { "Type",        "zbee_tlv.type_global", FT_UINT8, BASE_HEX,
3135
16
            VALS(zbee_tlv_global_types), 0x0, NULL, HFILL }},
3136
3137
16
        { &hf_zbee_tlv_local_type_key_update_req_rsp,
3138
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3139
16
            VALS(zbee_tlv_local_types_key_update_req_rsp), 0x0, NULL, HFILL }},
3140
3141
16
        { &hf_zbee_tlv_local_type_key_negotiation_req_rsp,
3142
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3143
16
            VALS(zbee_tlv_local_types_key_negotiation_req_rsp), 0x0, NULL, HFILL }},
3144
3145
16
        { &hf_zbee_tlv_local_type_get_auth_level_rsp,
3146
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3147
16
            VALS(zbee_tlv_local_types_get_auth_level_rsp), 0x0, NULL, HFILL }},
3148
3149
16
        { &hf_zbee_tlv_local_type_clear_all_bindings_req,
3150
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3151
16
            VALS(zbee_tlv_local_types_clear_all_bindings_req), 0x0, NULL, HFILL }},
3152
3153
16
        { &hf_zbee_tlv_local_type_req_security_get_auth_token,
3154
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3155
16
            VALS(zbee_tlv_local_types_req_security_get_auth_token), 0x0, NULL, HFILL }},
3156
3157
16
        { &hf_zbee_tlv_local_type_req_security_get_auth_level,
3158
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3159
16
            VALS(zbee_tlv_local_types_req_security_get_auth_level), 0x0, NULL, HFILL }},
3160
3161
16
        { &hf_zbee_tlv_local_type_req_security_decommission,
3162
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3163
16
            VALS(zbee_tlv_local_types_req_security_decommission), 0x0, NULL, HFILL }},
3164
3165
16
        { &hf_zbee_tlv_local_type_req_beacon_survey,
3166
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3167
16
            VALS(zbee_tlv_local_types_req_beacon_survey), 0x0, NULL, HFILL }},
3168
3169
16
        { &hf_zbee_tlv_local_type_rsp_beacon_survey,
3170
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3171
16
            VALS(zbee_tlv_local_types_rsp_beacon_survey), 0x0, NULL, HFILL }},
3172
3173
16
        { &hf_zbee_tlv_local_type_req_challenge,
3174
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3175
16
            VALS(zbee_tlv_local_types_req_challenge), 0x0, NULL, HFILL }},
3176
3177
16
        { &hf_zbee_tlv_local_type_rsp_challenge,
3178
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3179
16
            VALS(zbee_tlv_local_types_rsp_challenge), 0x0, NULL, HFILL }},
3180
3181
16
        { &hf_zbee_tlv_local_type_rsp_set_configuration,
3182
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3183
16
            VALS(zbee_tlv_local_types_rsp_set_configuration), 0x0, NULL, HFILL }},
3184
3185
16
        { &hf_zbee_tlv_local_type_route_req,
3186
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3187
16
            VALS(zbee_tlv_local_types_route_req), 0x0, NULL, HFILL }},
3188
3189
16
        { &hf_zbee_tlv_local_type_route_reply,
3190
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3191
16
            VALS(zbee_tlv_local_types_route_reply), 0x0, NULL, HFILL }},
3192
3193
16
        { &hf_zbee_tlv_local_type_network_status,
3194
16
          { "Type",        "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
3195
16
            VALS(zbee_tlv_local_types_network_status), 0x0, NULL, HFILL }},
3196
3197
16
        { &hf_zbee_tlv_type,
3198
16
          { "Unknown Type", "zbee_tlv.type", FT_UINT8, BASE_HEX,
3199
16
            NULL, 0x0, NULL, HFILL }},
3200
3201
16
        { &hf_zbee_tlv_length,
3202
16
          { "Length",      "zbee_tlv.length", FT_UINT8, BASE_DEC, NULL, 0x0,
3203
16
            NULL, HFILL }},
3204
3205
16
        { &hf_zbee_tlv_value,
3206
16
          { "Value",       "zbee_tlv.value", FT_BYTES, BASE_NONE, NULL, 0x0,
3207
16
            NULL, HFILL }},
3208
3209
16
        { &hf_zbee_tlv_count,
3210
16
          { "Count",       "zbee_tlv.count", FT_UINT8, BASE_DEC, NULL, 0x0,
3211
16
            NULL, HFILL }},
3212
3213
16
        { &hf_zbee_tlv_local_status_count,
3214
16
            { "TLV Status Count",           "zbee_tlv.tlv_status_count", FT_UINT8, BASE_DEC, NULL, 0x0,
3215
16
            NULL, HFILL }},
3216
3217
16
        { &hf_zbee_tlv_local_type_id,
3218
16
            { "TLV Type ID",                "zbee_tlv.tlv_type_id", FT_UINT8, BASE_HEX, VALS(zbee_tlv_global_types), 0x0,
3219
16
            NULL, HFILL }},
3220
3221
16
        { &hf_zbee_tlv_local_proc_status,
3222
16
            { "TLV Processing Status",      "zbee_tlv.tlv_proc_status", FT_UINT8, BASE_HEX, NULL, 0x0,
3223
16
            NULL, HFILL }},
3224
3225
16
        { &hf_zbee_tlv_manufacturer_specific,
3226
16
          { "ZigBee Manufacturer ID", "zbee_tlv.manufacturer_specific", FT_UINT16, BASE_HEX, NULL,
3227
16
            0x0, NULL, HFILL }},
3228
3229
16
        { &hf_zbee_tlv_supported_key_negotiation_methods,
3230
16
          { "Supported Key Negotiation Methods", "zbee_tlv.supported_key_negotiation_methods", FT_UINT8, BASE_HEX, NULL,
3231
16
            0x0, NULL, HFILL }},
3232
3233
16
        { &hf_zbee_tlv_supported_key_negotiation_methods_key_request,
3234
16
          { "Key Request (ZigBee 3.0)",             "zbee_tlv.supported_key_negotiation_methods.key_request", FT_BOOLEAN, 8, NULL,
3235
16
            ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_KEY_REQUEST, NULL, HFILL }},
3236
3237
16
        { &hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_aes_mmo128,
3238
16
          { "ECDHE using Curve25519 with Hash AES-MMO-128", "zbee_tlv.supported_key_negotiation_methods.ecdhe_using_curve25519_aes_mmo128", FT_BOOLEAN, 8, NULL,
3239
16
            ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_ANONYMOUS_ECDHE_USING_CURVE25519_AES_MMO128, NULL, HFILL }},
3240
3241
16
        { &hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_sha256,
3242
16
          { "ECDHE using Curve25519 with Hash SHA-256", "zbee_tlv.supported_key_negotiation_methods.ecdhe_using_curve25519_sha256", FT_BOOLEAN, 8, NULL,
3243
16
            ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_ANONYMOUS_ECDHE_USING_CURVE25519_SHA256, NULL, HFILL }},
3244
3245
16
        { &hf_zbee_tlv_supported_secrets,
3246
16
          { "Supported Pre-shared Secrets Bitmask", "zbee_tlv.supported_secrets", FT_UINT8, BASE_HEX, NULL,
3247
16
            0x0, NULL, HFILL }},
3248
3249
16
        { &hf_zbee_tlv_supported_preshared_secrets_auth_token,
3250
16
          { "Symmetric Authentication Token", "zbee_tlv.supported_secrets.auth_token", FT_BOOLEAN, 8, NULL,
3251
16
            0x1, NULL, HFILL }},
3252
3253
16
        { &hf_zbee_tlv_supported_preshared_secrets_ic,
3254
16
          { "128-bit pre-configured link-key from install code", "zbee_tlv.supported_secrets.ic", FT_BOOLEAN, 8, NULL,
3255
16
            0x2, NULL, HFILL }},
3256
3257
16
        { &hf_zbee_tlv_supported_preshared_secrets_passcode_pake,
3258
16
          { "Variable-length pass code for PAKE protocols", "zbee_tlv.supported_secrets.passcode_pake", FT_BOOLEAN, 8, NULL,
3259
16
            0x4, NULL, HFILL }},
3260
3261
16
        { &hf_zbee_tlv_supported_preshared_secrets_basic_access_key,
3262
16
          { "Basic Access Key", "zbee_tlv.supported_secrets.basic_key", FT_BOOLEAN, 8, NULL,
3263
16
            0x8, NULL, HFILL }},
3264
3265
16
        { &hf_zbee_tlv_supported_preshared_secrets_admin_access_key,
3266
16
          { "Administrative Access Key", "zbee_tlv.supported_secrets.admin_key", FT_BOOLEAN, 8, NULL,
3267
16
            0x10, NULL, HFILL }},
3268
3269
16
        { &hf_zbee_tlv_panid_conflict_cnt,
3270
16
          { "PAN ID Conflict Count", "zbee_tlv.panid_conflict_cnt", FT_UINT16, BASE_DEC, NULL,
3271
16
            0x0, NULL, HFILL }},
3272
3273
16
        { &hf_zbee_tlv_next_pan_id,
3274
16
          { "Next PAN ID Change", "zbee_tlv.next_pan_id", FT_UINT16, BASE_HEX, NULL,
3275
16
            0x0, NULL, HFILL }},
3276
3277
16
        { &hf_zbee_tlv_next_channel_change,
3278
16
          { "Next Channel Change", "zbee_tlv.next_channel", FT_UINT32, BASE_HEX, NULL,
3279
16
            0x0, NULL, HFILL }},
3280
3281
16
        { &hf_zbee_tlv_passphrase,
3282
16
          { "128-bit Symmetric Passphrase", "zbee_tlv.passphrase", FT_BYTES, BASE_NONE, NULL,
3283
16
            0x0, NULL, HFILL }},
3284
3285
16
        { &hf_zbee_tlv_challenge_value,
3286
16
          { "Challenge Value", "zbee_tlv.challenge_val", FT_BYTES, BASE_NONE, NULL,
3287
16
            0x0, NULL, HFILL }},
3288
3289
16
        { &hf_zbee_tlv_aps_frame_counter,
3290
16
          { "APS Frame Counter", "zbee_tlv.aps_frame_cnt", FT_UINT32, BASE_HEX, NULL,
3291
16
            0x0, NULL, HFILL }},
3292
3293
16
        { &hf_zbee_tlv_challenge_counter,
3294
16
          { "Challenge Counter", "zbee_tlv.challenge_cnt", FT_UINT32, BASE_HEX, NULL,
3295
16
            0x0, NULL, HFILL }},
3296
3297
16
        { &hf_zbee_tlv_configuration_param,
3298
16
          { "Configuration Parameters", "zbee_tlv.configuration_parameters", FT_UINT16, BASE_HEX, NULL,
3299
16
            0x0, NULL, HFILL }},
3300
3301
16
        { &hf_zbee_tlv_configuration_param_restricted_mode,
3302
16
          { "apsZdoRestrictedMode", "zbee_tlv.conf_param.restricted_mode", FT_UINT16, BASE_DEC, NULL,
3303
16
            0x1, NULL, HFILL }},
3304
3305
16
        { &hf_zbee_tlv_configuration_param_link_key_enc,
3306
16
          { "requireLinkKeyEncryptionForApsTransportKey", "zbee_tlv.conf_param.req_link_key_enc", FT_UINT16, BASE_DEC, NULL,
3307
16
            0x2, NULL, HFILL }},
3308
3309
16
        { &hf_zbee_tlv_configuration_param_leave_req_allowed,
3310
16
          { "nwkLeaveRequestAllowed", "zbee_tlv.conf_param.leave_req_allowed", FT_UINT16, BASE_DEC, NULL,
3311
16
            0x4, NULL, HFILL }},
3312
3313
16
        { &hf_zbee_tlv_dev_cap_ext_capability_information,
3314
16
          { "Capability Information", "zbee_tlv.dev_cap_ext_cap_info", FT_UINT16, BASE_HEX, NULL,
3315
16
            0x0, NULL, HFILL }},
3316
3317
16
        { &hf_zbee_tlv_dev_cap_ext_zbdirect_virt_device,
3318
16
          { "Zigbee Direct Virtual Device", "zbee_tlv.dev_cap_ext.zbdirect_virt_dev", FT_UINT16, BASE_DEC, NULL,
3319
16
            0x1, NULL, HFILL }},
3320
3321
16
        { &hf_zbee_tlv_lqa,
3322
16
          { "LQA", "zbee_tlv.lqa", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
3323
3324
16
        { &hf_zbee_tlv_router_information,
3325
16
          { "Router Information", "zbee_tlv.router_information", FT_UINT16, BASE_HEX, NULL,
3326
16
            0x0, NULL, HFILL }},
3327
3328
16
        { &hf_zbee_tlv_router_information_hub_connectivity,
3329
16
          { "Hub Connectivity",   "zbee_tlv.router_information.hub_connectivity", FT_BOOLEAN, 16, NULL,
3330
16
              ZBEE_TLV_ROUTER_INFORMATION_HUB_CONNECTIVITY, NULL, HFILL }},
3331
3332
16
        { &hf_zbee_tlv_router_information_uptime,
3333
16
          { "Uptime",             "zbee_tlv.router_information.uptime", FT_BOOLEAN, 16, NULL,
3334
16
              ZBEE_TLV_ROUTER_INFORMATION_UPTIME, NULL, HFILL }},
3335
3336
16
        { &hf_zbee_tlv_router_information_pref_parent,
3337
16
          { "Preferred parent",        "zbee_tlv.router_information.pref_parent", FT_BOOLEAN, 16, NULL,
3338
16
              ZBEE_TLV_ROUTER_INFORMATION_PREF_PARENT, NULL, HFILL }},
3339
3340
16
        { &hf_zbee_tlv_router_information_battery_backup,
3341
16
          { "Battery Backup",     "zbee_tlv.router_information.battery", FT_BOOLEAN, 16, NULL,
3342
16
              ZBEE_TLV_ROUTER_INFORMATION_BATTERY_BACKUP, NULL, HFILL }},
3343
3344
16
        { &hf_zbee_tlv_router_information_enhanced_beacon_request_support,
3345
16
          { "Enhanced Beacon Request Support", "zbee_tlv.router_information.enhanced_beacon", FT_BOOLEAN, 16, NULL,
3346
16
              ZBEE_TLV_ROUTER_INFORMATION_ENHANCED_BEACON_REQUEST_SUPPORT, NULL, HFILL }},
3347
3348
16
        { &hf_zbee_tlv_router_information_mac_data_poll_keepalive_support,
3349
16
          { "MAC Data Poll Keepalive Support", "zbee_tlv.router_information.mac_data_poll_keepalive", FT_BOOLEAN, 16, NULL,
3350
16
              ZBEE_TLV_ROUTER_INFORMATION_MAC_DATA_POLL_KEEPALIVE_SUPPORT, NULL, HFILL }},
3351
3352
16
        { &hf_zbee_tlv_router_information_end_device_keepalive_support,
3353
16
          { "End Device Keepalive Support", "zbee_tlv.router_information.end_dev_keepalive", FT_BOOLEAN, 16, NULL,
3354
16
              ZBEE_TLV_ROUTER_INFORMATION_END_DEVICE_KEEPALIVE_SUPPORT, NULL, HFILL }},
3355
3356
16
        { &hf_zbee_tlv_router_information_power_negotiation_support,
3357
16
          { "Power Negotiation Support", "zbee_tlv.router_information.power_negotiation", FT_BOOLEAN, 16, NULL,
3358
16
              ZBEE_TLV_ROUTER_INFORMATION_POWER_NEGOTIATION_SUPPORT, NULL, HFILL }},
3359
3360
16
        { &hf_zbee_tlv_node_id,
3361
16
          { "Node ID", "zbee_tlv.node_id", FT_UINT16, BASE_HEX, NULL,
3362
16
            0x0, NULL, HFILL }},
3363
3364
16
        { &hf_zbee_tlv_frag_opt,
3365
16
          { "Fragmentation Options", "zbee_tlv.frag_opt", FT_UINT8, BASE_HEX, NULL,
3366
16
            0x0, NULL, HFILL }},
3367
3368
16
        { &hf_zbee_tlv_max_reassembled_buf_size,
3369
16
          { "Maximum Reassembled Input Buffer Size", "zbee_tlv.max_buf_size", FT_UINT16, BASE_HEX, NULL,
3370
16
            0x0, NULL, HFILL }},
3371
3372
16
        { &hf_zbee_tlv_selected_key_negotiation_method,
3373
16
          { "Selected Key Negotiation Method", "zbee_tlv.selected_key_negotiation_method", FT_UINT8, BASE_HEX,
3374
16
            VALS(zbee_tlv_selected_key_negotiation_method), 0x0, NULL, HFILL }},
3375
3376
16
        { &hf_zbee_tlv_selected_pre_shared_secret,
3377
16
          { "Selected Pre Shared Secret", "zbee_tlv.selected_pre_shared_secret", FT_UINT8, BASE_HEX,
3378
16
            VALS(zbee_tlv_selected_pre_shared_secret), 0x0, NULL, HFILL }},
3379
3380
16
        { &hf_zbee_tlv_device_eui64,
3381
16
          { "Device EUI64", "zbee_tlv.device_eui64", FT_EUI64, BASE_NONE, NULL, 0x0,
3382
16
            NULL, HFILL }},
3383
3384
16
        { &hf_zbee_tlv_public_point,
3385
16
          { "Public Point", "zbee_tlv.public_point", FT_BYTES, BASE_NONE, NULL,
3386
16
            0x0, NULL, HFILL }},
3387
3388
16
        { &hf_zbee_tlv_global_tlv_id,
3389
16
          { "TLV Type ID", "zbee_tlv.global_tlv_id", FT_UINT8, BASE_HEX, VALS(zbee_tlv_global_types), 0x0,
3390
16
            NULL, HFILL }},
3391
3392
16
        { &hf_zbee_tlv_local_ieee_addr,
3393
16
          { "IEEE Addr", "zbee_tlv.ieee_addr", FT_EUI64, BASE_NONE, NULL, 0x0,
3394
16
            NULL, HFILL }},
3395
3396
16
        { &hf_zbee_tlv_routing_sequence_number,
3397
16
          { "Routing Sequence Number", "zbee_tlv.route_seq_num", FT_UINT16, BASE_HEX, NULL, 0x0,
3398
16
            NULL, HFILL }},
3399
3400
16
        { &hf_zbee_tlv_initial_radius,
3401
16
          { "Initial Radius", "zbee_tlv.initial_radius", FT_UINT8, BASE_HEX, NULL, 0x0,
3402
16
            NULL, HFILL }},
3403
3404
16
        { &hf_zbee_tlv_concentrator_discovery_time,
3405
16
          { "Concentrator Discovery Timer", "zbee_tlv.concentrator_discovery_time", FT_UINT8, BASE_HEX, NULL, 0x0,
3406
16
            NULL, HFILL }},
3407
3408
16
        { &hf_zbee_tlv_max_source_route_length,
3409
16
          { "Max Source Route Length", "zbee_tlv.max_source_route_length", FT_UINT8, BASE_HEX, NULL, 0x0,
3410
16
            NULL, HFILL }},
3411
3412
16
        { &hf_zbee_tlv_nwk_addr_of_interest,
3413
16
          { "Network Address of Interest", "zbee_tlv.nwk_addr_of_interest", FT_UINT16, BASE_HEX, NULL, 0x0,
3414
16
            NULL, HFILL }},
3415
3416
16
        { &hf_zbee_tlv_mic64,
3417
16
          { "MIC", "zbee_tlv.mic64", FT_UINT64, BASE_HEX, NULL, 0x0,
3418
16
            NULL, HFILL }},
3419
3420
16
        { &hf_zbee_tlv_local_initial_join_method,
3421
16
          { "Initial Join Method",        "zbee_tlv.init_method", FT_UINT8, BASE_HEX,
3422
16
            VALS(zbee_initial_join_methods), 0x0, NULL, HFILL }},
3423
3424
16
        { &hf_zbee_tlv_local_active_lk_type,
3425
16
          { "Active link key type",        "zbee_tlv.lk_type", FT_UINT8, BASE_HEX,
3426
16
            VALS(zbee_active_lk_types), 0x0, NULL, HFILL }},
3427
3428
16
        { &hf_zbee_tlv_zbd_comm_tlv,
3429
16
            { "ZBD Commissioning Service TLV Type ID", "zbee_tlv.zbd.comm_tlv_id", FT_UINT8, BASE_HEX,
3430
16
              VALS(zbee_tlv_zbd_comm_types), 0x0, NULL, HFILL }},
3431
3432
16
        { &hf_zbee_tlv_zbd_comm_mj_cmd_tlv,
3433
16
            { "ZBD Manage Joiners TLV Type ID", "zbee_tlv.zbd.comm_mj_tlv_id", FT_UINT8, BASE_HEX,
3434
16
              VALS(zbee_tlv_zbd_comm_mj_types), 0x0, NULL, HFILL }},
3435
3436
16
        { &hf_zbee_tlv_zbd_secur_tlv,
3437
16
            { "ZBD Secure Session TLV Type ID", "zbee_tlv.zbd.secur_tlv_id", FT_UINT8, BASE_HEX,
3438
16
              VALS(zbee_tlv_zbd_secur_types), 0x0, NULL, HFILL }},
3439
3440
16
        { &hf_zbee_tlv_local_tunneling_npdu,
3441
16
            { "NPDU", "zbee_tlv.zbd.npdu", FT_NONE, BASE_NONE,
3442
16
                NULL, 0x0, NULL, HFILL }
3443
16
        },
3444
16
        { &hf_zbee_tlv_zbd_tunneling_npdu_msg_tlv,
3445
16
            { "NPDU Message TLV", "zbee_tlv.zbd.tlv.tunneling.npdu_msg", FT_NONE, BASE_NONE,
3446
16
                NULL, 0x0, NULL, HFILL }
3447
16
        },
3448
16
        { &hf_zbee_tlv_local_comm_ext_pan_id,
3449
16
            { "Extended PAN ID", "zbee_tlv.zbd.comm.ext_pan_id", FT_UINT64, BASE_HEX,
3450
16
                NULL, 0x0, NULL, HFILL }
3451
16
        },
3452
16
        { &hf_zbee_tlv_local_comm_short_pan_id,
3453
16
            { "Short PAN ID", "zbee_tlv.zbd.comm.short_pan_id", FT_UINT16, BASE_HEX,
3454
16
                NULL, 0x0, NULL, HFILL }
3455
16
        },
3456
16
        { &hf_zbee_tlv_local_comm_channel_mask,
3457
16
            { "Network Channels", "zbee_tlv.zbd.comm.nwk_channel_mask", FT_UINT32, BASE_HEX,
3458
16
                NULL, 0x0, NULL, HFILL }
3459
16
        },
3460
16
        { &hf_zbee_tlv_local_comm_channel_page,
3461
16
            { "Channel Page", "zbee_tlv.zbd.comm.nwk_channel_page", FT_UINT8, BASE_DEC,
3462
16
                NULL, 0x0, NULL, HFILL }
3463
16
        },
3464
16
        { &hf_zbee_tlv_local_comm_channel_page_count,
3465
16
            { "Channel Page Count", "zbee_tlv.zbd.comm.nwk_channel_page_count", FT_UINT8, BASE_DEC,
3466
16
                NULL, 0x0, NULL, HFILL }
3467
16
        },
3468
16
        { &hf_zbee_tlv_local_comm_nwk_key,
3469
16
            { "Network key", "zbee_tlv.zbd.comm.nwk_key", FT_BYTES, BASE_NONE,
3470
16
                NULL, 0x0, NULL, HFILL }
3471
16
        },
3472
16
        { &hf_zbee_tlv_local_comm_link_key,
3473
16
            { "Link key", "zbee_tlv.zbd.comm.link_key", FT_BYTES, BASE_NONE,
3474
16
                NULL, 0x0, NULL, HFILL }
3475
16
        },
3476
16
        { &hf_zbee_tlv_local_comm_dev_type,
3477
16
            { "Device type", "zbee_tlv.zbd.comm.dev_type", FT_UINT8, BASE_HEX,
3478
16
                VALS(zbee_tlv_local_types_dev_type_str), 0x0, NULL, HFILL }
3479
16
        },
3480
16
        { &hf_zbee_tlv_local_comm_nwk_addr,
3481
16
            { "Network address", "zbee_tlv.zbd.comm.nwk_addr", FT_UINT16, BASE_HEX,
3482
16
                NULL, 0x0, NULL, HFILL }
3483
16
        },
3484
16
        { &hf_zbee_tlv_local_comm_join_method,
3485
16
            { "Join method", "zbee_tlv.zbd.comm.join_method", FT_UINT8, BASE_HEX,
3486
16
                VALS(zbee_tlv_local_types_join_method_str), 0x0, NULL, HFILL }
3487
16
        },
3488
16
        { &hf_zbee_tlv_local_comm_tc_addr,
3489
16
            { "TC address", "zbee_tlv.zbd.comm.tc_addr", FT_UINT64, BASE_HEX,
3490
16
                NULL, 0x0, NULL, HFILL }
3491
16
        },
3492
16
        { &hf_zbee_tlv_local_comm_nwk_upd_id,
3493
16
            { "Network update ID", "zbee_tlv.zbd.comm.nwk_upd_id", FT_UINT8, BASE_HEX,
3494
16
                NULL, 0x0, NULL, HFILL }
3495
16
        },
3496
16
        { &hf_zbee_tlv_local_comm_key_seq_num,
3497
16
            { "Network active key sequence number", "zbee_tlv.zbd.comm.nwk_key_seq_num", FT_UINT8, BASE_HEX,
3498
16
                NULL, 0x0, NULL, HFILL }
3499
16
        },
3500
16
        { &hf_zbee_tlv_local_comm_adm_key,
3501
16
            { "Admin key", "zbee_tlv.zbd.comm.admin_key", FT_BYTES, BASE_NONE,
3502
16
                NULL, 0x0, NULL, HFILL }
3503
16
        },
3504
16
        { &hf_zbee_tlv_local_comm_status_code_domain,
3505
16
            { "Domain", "zbee_tlv.zbd.comm.status_code_domain", FT_UINT8, BASE_HEX,
3506
16
                VALS(zbee_tlv_local_types_status_code_domain_str), 0x0, NULL, HFILL }
3507
16
        },
3508
16
        { &hf_zbee_tlv_local_comm_status_code_value,
3509
16
            { "Code", "zbee_tlv.zbd.comm.status_code_value", FT_UINT8, BASE_HEX,
3510
16
                NULL, 0x0, NULL, HFILL }
3511
16
        },
3512
16
        { &hf_zbee_tlv_local_comm_mj_prov_lnk_key,
3513
16
            { "Manage Joiners Provisional Link key", "zbee_tlv.zbd.comm.manage_joiners_prov_lnk_key", FT_BYTES, BASE_NONE,
3514
16
                NULL, 0x0, NULL, HFILL }
3515
16
        },
3516
16
        { &hf_zbee_tlv_local_comm_mj_ieee_addr,
3517
16
            { "Manage Joiners IEEE Address", "zbee_tlv.zbd.comm.manage_joiners_ieee_addr", FT_UINT64, BASE_HEX,
3518
16
                NULL, 0x0, NULL, HFILL }
3519
16
        },
3520
16
        { &hf_zbee_tlv_local_comm_mj_cmd,
3521
16
            { "Manage Joiners command", "zbee_tlv.zbd.comm.manage_joiners_cmd", FT_UINT8, BASE_HEX,
3522
16
                VALS(zbee_tlv_local_types_mj_cmd_str), 0x0, NULL, HFILL }
3523
16
        },
3524
16
        { &hf_zbee_tlv_local_tunneling_npdu_flags,
3525
16
            { "NPDU Flags", "zbee_tlv.zbd.tunneling.npdu_flags", FT_UINT8, BASE_HEX,
3526
16
                NULL, 0x0, NULL, HFILL }
3527
16
        },
3528
16
        { &hf_zbee_tlv_local_tunneling_npdu_flags_security,
3529
16
            { "Security Enabled", "zbee_tlv.zbd.tunneling.npdu_flags.security", FT_BOOLEAN, 8,
3530
16
                NULL, 0b00000001, NULL, HFILL }
3531
16
        },
3532
16
        { &hf_zbee_tlv_local_tunneling_npdu_flags_reserved,
3533
16
            { "Reserved", "zbee_tlv.zbd.tunneling.npdu_flags.reserved", FT_UINT8, BASE_DEC,
3534
16
                NULL, 0b11111110, NULL, HFILL }
3535
16
        },
3536
16
        { &hf_zbee_tlv_local_tunneling_npdu_length,
3537
16
            { "NPDU Length", "zbee_tlv.zbd.tunneling.npdu_length", FT_UINT8, BASE_DEC,
3538
16
                NULL, 0x0, NULL, HFILL }
3539
16
        },
3540
16
        { &hf_zbee_tlv_local_selected_key_method,
3541
16
            { "Selected Key Negotiation Method", "zbee_tlv.zbd.secur.key_method", FT_UINT8, BASE_HEX,
3542
16
                VALS(zbee_tlv_local_types_key_method_str), 0x0, NULL, HFILL }
3543
16
        },
3544
16
        { &hf_zbee_tlv_local_selected_psk_secret,
3545
16
            { "Selected PSK Secret", "zbee_tlv.zbd.secur.psk_secret", FT_UINT8, BASE_HEX,
3546
16
                VALS(zbee_tlv_local_types_psk_secret_str), 0x0, NULL, HFILL }
3547
16
        },
3548
16
        { &hf_zbee_tlv_local_nwk_key_seq_num,
3549
16
            { "Network Key Sequence Number", "zbee_tlv.zbd.secur.nwk_key_seq_num", FT_UINT8, BASE_DEC,
3550
16
                NULL, 0x0, NULL, HFILL }
3551
16
        },
3552
16
        { &hf_zbee_tlv_local_mac_tag,
3553
16
            { "MAC Tag", "zbee_tlv.zbd.secur.mac_tag", FT_BYTES, BASE_NONE,
3554
16
                NULL, 0x0, NULL, HFILL }
3555
16
        },
3556
16
        { &hf_zbee_tlv_local_comm_link_key_flags,
3557
16
            { "Link Key", "zbee_tlv.zbd.comm.join.link_key", FT_UINT8, BASE_HEX,
3558
16
                NULL, 0x0, NULL, HFILL }
3559
16
        },
3560
16
        { &hf_zbee_tlv_local_comm_link_key_flags_unique,
3561
16
            { "Unique", "zbee_tlv.zbd.comm.join.link_key.unique", FT_UINT8, BASE_DEC,
3562
16
                VALS(zbee_tlv_local_types_lnk_key_unique_str), ZBEE_TLV_LINK_KEY_UNIQUE, NULL, HFILL }
3563
16
        },
3564
16
        { &hf_zbee_tlv_local_comm_link_key_flags_provisional,
3565
16
            { "Provisional", "zbee_tlv.zbd.comm.join.link_key.provisional", FT_UINT8, BASE_DEC,
3566
16
                VALS(zbee_tlv_local_types_lnk_key_provisional_str), ZBEE_TLV_LINK_KEY_PROVISIONAL, NULL, HFILL }
3567
16
        },
3568
16
        { &hf_zbee_tlv_local_type_lk_features,
3569
16
            { "Features", "zbee_tlv.lk_features", FT_UINT8, BASE_HEX,
3570
16
                NULL, 0x0, NULL, HFILL }
3571
16
        },
3572
16
        { &hf_zbee_tlv_local_type_lk_features_capabilities,
3573
16
            { "Link-Key Features & Capabilities TLV", "zbee_tlv.lk_features_capabilities", FT_UINT8, BASE_HEX,
3574
16
                NULL, 0x0, NULL, HFILL }
3575
16
        },
3576
16
        { &hf_zbee_tlv_local_type_lk_features_capabilities_aps_fc_sync,
3577
16
            { "Frame Counter Synchronization Support", "zbee_tlv.lk_features_capabilities.aps_fc_sync", FT_BOOLEAN, 8,
3578
16
                NULL, ZBEE_TLV_LK_FEATURES_CAPABILITIES_FC_SYNC_SUPPORTED, NULL, HFILL }
3579
16
        },
3580
16
        { &hf_zbee_tlv_local_comm_network_status_map,
3581
16
            { "Network Status Map", "zbee_tlv.zbd.comm.status_map", FT_UINT8, BASE_HEX,
3582
16
                NULL, 0x0, NULL, HFILL }
3583
16
        },
3584
16
        { &hf_zbee_tlv_local_comm_network_status_map_joined_status,
3585
16
            { "Joined", "zbee_tlv.zbd.comm.status_map.joined_status", FT_UINT8, BASE_HEX,
3586
16
                VALS(zbee_tlv_local_types_joined_status_str), ZBEE_TLV_STATUS_MAP_JOINED_STATUS, NULL, HFILL }
3587
16
        },
3588
16
        { &hf_zbee_tlv_local_comm_network_status_map_open_status,
3589
16
            { "Open/Closed", "zbee_tlv.zbd.comm.status_map.open_status", FT_UINT8, BASE_DEC,
3590
16
                VALS(zbee_tlv_local_types_nwk_state_str), ZBEE_TLV_STATUS_MAP_OPEN_STATUS, NULL, HFILL }
3591
16
        },
3592
16
        { &hf_zbee_tlv_network_status_map_network_type,
3593
16
            { "Network Type", "zbee_tlv.zbd.comm.status_map.network_type", FT_UINT8, BASE_DEC,
3594
16
                VALS(zbee_tlv_local_types_nwk_type_str), ZBEE_TLV_STATUS_MAP_NETWORK_TYPE, NULL, HFILL }
3595
16
        },
3596
16
    };
3597
3598
    /* Protocol subtrees */
3599
16
    static int *ett[] =
3600
16
        {
3601
16
            &ett_zbee_aps_tlv,
3602
16
            &ett_zbee_aps_relay,
3603
16
            &ett_zbee_tlv,
3604
16
            &ett_zbee_tlv_supported_key_negotiation_methods,
3605
16
            &ett_zbee_tlv_supported_secrets,
3606
16
            &ett_zbee_tlv_router_information,
3607
16
            &ett_zbee_tlv_configuration_param,
3608
16
            &ett_zbee_tlv_capability_information,
3609
16
            &ett_zbee_tlv_zbd_tunneling_npdu,
3610
16
            &ett_zbee_tlv_zbd_tunneling_npdu_flags,
3611
16
            &ett_zbee_tlv_link_key_flags,
3612
16
            &ett_zbee_tlv_lk_features_capabilities,
3613
16
            &ett_zbee_tlv_network_status_map
3614
16
        };
3615
3616
16
    static ei_register_info ei[] = {
3617
16
        { &ei_zbee_tlv_max_recursion_depth_reached, { "zbee_tlv.max_recursion_depth_reached",
3618
16
            PI_PROTOCOL, PI_WARN, "Maximum allowed recursion depth reached - stop decoding", EXPFILL }}
3619
16
    };
3620
3621
16
    proto_zbee_tlv = proto_register_protocol("Zigbee TLV", "ZB TLV", "zbee_tlv");
3622
3623
16
    proto_register_field_array(proto_zbee_tlv, hf, array_length(hf));
3624
16
    proto_register_subtree_array(ett, array_length(ett));
3625
3626
16
    expert_module_t* expert_zbee_tlv = expert_register_protocol(proto_zbee_tlv);
3627
16
    expert_register_field_array(expert_zbee_tlv, ei, array_length(ei));
3628
3629
16
    register_dissector("zbee_tlv", dissect_zbee_tlv_default, proto_zbee_tlv);
3630
16
    zbee_nwk_handle = find_dissector("zbee_nwk");
3631
16
} /* proto_register_zbee_tlv */
3632
3633
void proto_reg_handoff_zbee_tlv(void)
3634
16
{
3635
16
    proto_zbee_nwk = proto_get_id_by_filter_name(ZBEE_PROTOABBREV_NWK);
3636
16
}