Coverage Report

Created: 2025-08-04 07:15

/src/wireshark/epan/dissectors/packet-wifi-nan.c
Line
Count
Source (jump to first uncovered line)
1
/* packet-wifi-nan.c
2
 *
3
 * Wi-Fi Neighbour Awareness Networking (NAN)
4
 *
5
 * Copyright 2019 Samsung Electronics
6
 *
7
 * SPDX-License-Identifier: GPL-2.0-or-later
8
 */
9
10
#include <config.h>
11
#include <epan/packet.h>
12
#include <epan/expert.h>
13
#include <epan/tfs.h>
14
#include <wsutil/array.h>
15
#include "packet-ieee80211.h"
16
17
#include <wsutil/str_util.h>
18
19
void proto_reg_handoff_nan(void);
20
void proto_register_nan(void);
21
22
static dissector_handle_t nan_act_handle;
23
static dissector_handle_t nan_disco_handle;
24
static dissector_handle_t nan_beacon_handle;
25
26
static dissector_table_t ie_handle_table;
27
28
14
#define WFA_ACTION_OUI_TYPE 0x18
29
14
#define WFA_NAN_IE_OUI_TYPE 0x13
30
14
#define WFA_SERVICE_DISCOVERY_SUBTYPE 0x13
31
32
0
#define NAN_MASTER_IND_LENGTH 2
33
0
#define NAN_CLUSTER_LENGTH 13
34
0
#define NAN_SDA_MIN_LENGTH 9
35
0
#define NAN_SDEA_MIN_LENGTH 3
36
0
#define NAN_CONNECTION_CAP_LENGTH 2
37
0
#define NAN_WLAN_INFRA_MIN_LENGTH 15
38
0
#define NAN_P2P_OP_MIN_LENGTH 9
39
0
#define NAN_IBSS_MIN_LENGTH 14
40
0
#define NAN_MESH_MIN_LENGTH 8
41
0
#define NAN_RANGING_MIN_LENGTH 8
42
0
#define NAN_CLUSTER_DISC_LENGTH 22
43
0
#define NAN_DEVICE_CAP_LENGTH 9
44
0
#define NAN_NDP_MIN_LENGTH 11
45
0
#define NAN_NDPE_MIN_LENGTH 11
46
0
#define NAN_AVAILABILITY_MIN_LENGTH 8
47
0
#define NAN_NDC_MIN_LENGTH 11
48
0
#define NAN_NDL_MIN_LENGTH 4
49
0
#define NAN_NDL_QOS_LENGTH 3
50
0
#define NAN_UNALIGNED_SCH_MIN_LENGTH 16
51
0
#define NAN_RANGING_SETUP_MIN_LENGTH 4
52
0
#define NAN_EXTENDED_WLAN_INFRA_LENGTH 20
53
0
#define NAN_EXTENDED_P2P_OP_LENGTH 14
54
0
#define NAN_EXTENDED_IBSS_LENGTH 19
55
0
#define NAN_EXTENDED_MESH_MIN_LENGTH 13
56
0
#define NAN_CIPHER_SUITE_INFO_MIN_LENGTH 3
57
#define NAN_SECURITY_CONTEXT_INFO_MIN_LENGTH 4
58
0
#define NAN_PUBLIC_AVAIL_MIN_LENGTH 4
59
0
#define NAN_VENDOR_SPECIFIC_MIN_LENGTH 3
60
0
#define NAN_DEVICE_CAPABILITY_EXTENSION_MIN_LENGTH 2
61
0
#define NAN_IDENTITY_RESOLUTION_MIN_LEN 1
62
0
#define NAN_PAIRING_BOOTSTRAPPING_LEN 5
63
64
0
#define NAN_UNALIGNED_SCH_BAND_ID_EXIST 0
65
0
#define NAN_UNALIGNED_SCH_CHANNEL_ENTRY_EXIST 1
66
0
#define NAN_UNALIGNED_SCH_CHANNEL_ENTRY_W_AUX_EXIST 2
67
68
static int proto_nan;
69
70
static expert_field ei_nan_elem_len_invalid;
71
static expert_field ei_nan_unknown_attr_id;
72
static expert_field ei_nan_unknown_op_class;
73
static expert_field ei_nan_unknown_beacon_type;
74
static expert_field ei_nan_invalid_channel_num_for_op_class;
75
static expert_field ei_nan_invalid_channel_count;
76
77
static int ett_nan;
78
static int ett_attributes;
79
static int ett_map_control;
80
static int ett_type_status;
81
static int ett_time_bitmap_ctrl;
82
static int ett_non_nan_op_channel;
83
static int ett_non_nan_beacon;
84
static int ett_cluster_anchor_master_info;
85
static int ett_sda_service_ctr;
86
static int ett_sda_srf_ctr;
87
static int ett_sdea_ctr;
88
static int ett_sdea_range_limit;
89
static int ett_sdea_service_info;
90
static int ett_connection_cap_field;
91
static int ett_further_av_map_entry_ctrl;
92
static int ett_device_cap_map_id;
93
static int ett_device_cap_committed_dw;
94
static int ett_device_cap_supported_bands;
95
static int ett_device_cap_op_mode;
96
static int ett_device_cap_antennas;
97
static int ett_device_cap_capabilities;
98
static int ett_ndp_control;
99
static int ett_ndpe_tlv;
100
static int ett_availability_ctr;
101
static int ett_availability_entry;
102
static int ett_availability_entry_ctr;
103
static int ett_availability_entry_entries;
104
static int ett_availability_entry_entries_channel;
105
static int ett_ndc_ctr;
106
static int ett_ndc_entries;
107
static int ett_device_ndc_map_id;
108
static int ett_ndl_control;
109
static int ett_ndl_schedule_entries;
110
static int ett_unaligned_sch_ctrl;
111
static int ett_unaligned_sch_ulw_overwrite;
112
static int ett_unaligned_sch_ulw_ctrl;
113
static int ett_ranging_setup_ftm_params;
114
static int ett_ranging_setup_ctrl;
115
static int ett_ranging_setup_schedule_entries;
116
static int ett_ranging_info_location_info_availability;
117
static int ett_p2p_device_role;
118
static int ett_cipher_suite_info_list;
119
static int ett_security_context_identifiers;
120
static int ett_public_availability_sch_entries;
121
static int ett_ie_tree;
122
static int ett_availability_op_class;
123
static int ett_device_capability_extension;
124
static int ett_nan_pairing_bootstrapping_type_status;
125
static int ett_nan_pairing_bootstrapping_method;
126
static int ett_nan_cipher_suite_capabilities;
127
128
static int hf_nan_attribute_type;
129
static int hf_nan_attribute_len;
130
static int hf_nan_action_subtype;
131
static int hf_nan_instance_id;
132
static int hf_nan_service_id;
133
static int hf_nan_map_id;
134
static int hf_nan_oui;
135
static int hf_nan_type_status;
136
static int hf_nan_reason_code;
137
static int hf_nan_status_1;
138
static int hf_nan_status_2;
139
static int hf_nan_bss_id;
140
static int hf_nan_availability_intervals_bitmap;
141
static int hf_nan_mac_address;
142
static int hf_nan_publish_id;
143
static int hf_nan_dialog_tokens;
144
static int hf_nan_time_bitmap;
145
static int hf_nan_time_bitmap_len;
146
static int hf_nan_time_bitmap_ctrl;
147
static int hf_nan_time_bitmap_ctrl_bit_duration;
148
static int hf_nan_time_bitmap_ctrl_period;
149
static int hf_nan_time_bitmap_ctrl_start_offset;
150
static int hf_nan_map_ctrl_map_id;
151
static int hf_nan_map_ctrl_availability_interval_duration;
152
static int hf_nan_map_ctrl_repeat;
153
static int hf_nan_map_ctrl_field;
154
static int hf_nan_non_op_channel_global_op_class;
155
static int hf_nan_non_op_channel_channel;
156
static int hf_nan_non_op_channel_center_freq;
157
static int hf_nan_non_beacon_tbtt_offset;
158
static int hf_nan_non_beacon_interval;
159
static int hf_nan_attr_master_preference;
160
static int hf_nan_attr_master_random_factor;
161
static int hf_nan_attr_cluster_anchor_master_rank;
162
static int hf_nan_attr_cluster_hop_count;
163
static int hf_nan_attr_cluster_beacon_transmission_time;
164
static int hf_nan_attr_sda_requestor_instance_id;
165
static int hf_nan_attr_sda_sc;
166
static int hf_nan_attr_sda_sc_type;
167
static int hf_nan_attr_sda_sc_matching_filter;
168
static int hf_nan_attr_sda_sc_service_response;
169
static int hf_nan_attr_sda_sc_service_info;
170
static int hf_nan_attr_sda_sc_discovery_range;
171
static int hf_nan_attr_sda_sc_binding_bitmap;
172
static int hf_nan_attr_sda_binding_bitmap;
173
static int hf_nan_attr_sda_matching_filter_len;
174
static int hf_nan_attr_sda_matching_filter_val;
175
static int hf_nan_attr_sda_service_response_filter_len;
176
static int hf_nan_attr_sda_srf_ctr;
177
static int hf_nan_attr_sda_srf_ctr_type;
178
static int hf_nan_attr_sda_srf_ctr_include;
179
static int hf_nan_attr_sda_srf_ctr_bloom_filter_index;
180
static int hf_nan_attr_sda_srf_address_set;
181
static int hf_nan_attr_sda_service_info_len;
182
static int hf_nan_attr_sda_service_info;
183
static int hf_nan_attr_sdea_ctr;
184
static int hf_nan_attr_sdea_ctr_fsd;
185
static int hf_nan_attr_sdea_ctr_fsd_w_gas;
186
static int hf_nan_attr_sdea_ctr_data_path;
187
static int hf_nan_attr_sdea_ctr_data_path_type;
188
static int hf_nan_attr_sdea_ctr_reserved_multicast_type;
189
static int hf_nan_attr_sdea_ctr_qos;
190
static int hf_nan_attr_sdea_ctr_security;
191
static int hf_nan_attr_sdea_ctr_ranging;
192
static int hf_nan_attr_sdea_ctr_range_limit;
193
static int hf_nan_attr_sdea_ctr_service_update_indicator;
194
static int hf_nan_attr_sdea_ingress_range_limit;
195
static int hf_nan_attr_sdea_egress_range_limit;
196
static int hf_nan_attr_sdea_service_update_indicator;
197
static int hf_nan_attr_sdea_service_info_length;
198
static int hf_nan_attr_sdea_service_info_protocol_type;
199
static int hf_nan_attr_sdea_service_info_specific;
200
static int hf_nan_attr_connection_cap_bitmap;
201
static int hf_nan_attr_connection_cap_wifi_direct;
202
static int hf_nan_attr_connection_cap_p2ps;
203
static int hf_nan_attr_connection_cap_tdls;
204
static int hf_nan_attr_connection_cap_wlan_infra;
205
static int hf_nan_attr_connection_cap_ibss;
206
static int hf_nan_attr_connection_cap_mesh;
207
static int hf_nan_attr_wlan_infra_device_role;
208
static int hf_nan_attr_p2p_device_role_device;
209
static int hf_nan_attr_p2p_device_role_group_owner;
210
static int hf_nan_attr_p2p_device_role_client;
211
static int hf_nan_attr_p2p_device_role;
212
static int hf_nan_attr_mesh_id;
213
static int hf_nan_attr_further_av_map_entry_av_interval_duration;
214
static int hf_nan_attr_further_av_map_op_class;
215
static int hf_nan_attr_further_av_map_channel_num;
216
static int hf_nan_attr_further_av_map_entry_ctrl;
217
static int hf_nan_attr_further_av_map_id;
218
static int hf_nan_attr_country_code;
219
static int hf_nan_attr_ranging_protocol;
220
static int hf_nan_attr_cluster_disc_id;
221
static int hf_nan_attr_cluster_disc_time_offset;
222
static int hf_nan_attr_cluster_disc_anchor_master_rank;
223
static int hf_nan_attr_device_cap_map_id_apply_to;
224
static int hf_nan_attr_device_cap_map_id_associated_maps;
225
static int hf_nan_attr_device_cap_committed_dw;
226
static int hf_nan_attr_device_cap_committed_dw_24ghz;
227
static int hf_nan_attr_device_cap_committed_dw_5ghz;
228
static int hf_nan_attr_device_cap_committed_dw_24ghz_overwrite;
229
static int hf_nan_attr_device_cap_committed_dw_5ghz_overwrite;
230
static int hf_nan_attr_device_cap_supported_bands;
231
static int hf_nan_attr_device_cap_supported_bands_reserved_tv_whitespaces;
232
static int hf_nan_attr_device_cap_supported_bands_sub_1ghz;
233
static int hf_nan_attr_device_cap_supported_bands_24ghz;
234
static int hf_nan_attr_device_cap_supported_bands_reserved_36ghz;
235
static int hf_nan_attr_device_cap_supported_bands_5ghz;
236
static int hf_nan_attr_device_cap_supported_bands_reserved_60ghz;
237
static int hf_nan_attr_device_cap_supported_bands_reserved_45ghz;
238
static int hf_nan_attr_device_cap_supported_bands_6ghz;
239
static int hf_nan_attr_device_cap_op_mode;
240
static int hf_nan_attr_device_cap_op_mode_phy_vht;
241
static int hf_nan_attr_device_cap_op_mode_phy_he;
242
static int hf_nan_attr_device_cap_op_mode_phy_he_vht8080;
243
static int hf_nan_attr_device_cap_op_mode_phy_he_vht160;
244
static int hf_nan_attr_device_cap_op_mode_reserved_paging_ndl;
245
static int hf_nan_attr_device_cap_antennas;
246
static int hf_nan_attr_device_cap_antennas_tx;
247
static int hf_nan_attr_device_cap_antennas_rx;
248
static int hf_nan_attr_device_cap_max_channel_switch_time;
249
static int hf_nan_attr_device_cap_capabilities;
250
static int hf_nan_attr_device_cap_capabilities_dfs_master;
251
static int hf_nan_attr_device_cap_capabilities_extended_key_id;
252
static int hf_nan_attr_device_cap_capabilities_simul_ndp_reception;
253
static int hf_nan_attr_device_cap_capabilities_ndpe_attr_support;
254
static int hf_nan_attr_device_cap_capabilities_s3_capable;
255
static int hf_nan_attr_ndp_type;
256
static int hf_nan_attr_ndp_initiator;
257
static int hf_nan_attr_ndp_id;
258
static int hf_nan_attr_ndp_ctrl_confirm;
259
static int hf_nan_attr_ndp_ctrl_security_pres;
260
static int hf_nan_attr_ndp_ctrl_publish_id_pres;
261
static int hf_nan_attr_ndp_ctrl_responder_ndi_pres;
262
static int hf_nan_attr_ndp_ctrl_sepcific_info_pres;
263
static int hf_nan_attr_ndpe_ctrl_confirm;
264
static int hf_nan_attr_ndpe_ctrl_security_pres;
265
static int hf_nan_attr_ndpe_ctrl_publish_id_pres;
266
static int hf_nan_attr_ndpe_ctrl_responder_ndi_pres;
267
static int hf_nan_attr_ndpe_ctrl_gtk_requried;
268
static int hf_nan_attr_ndp_control;
269
static int hf_nan_attr_ndpe_control;
270
static int hf_nan_attr_ndp_responder_ndi;
271
static int hf_nan_attr_ndp_specific_info;
272
static int hf_nan_attr_ndpe_tlv_type;
273
static int hf_nan_attr_ndpe_tlv_len;
274
static int hf_nan_attr_ndpe_tlv_ipv6_interface_identifier;
275
static int hf_nan_attr_availability_sequence_id;
276
static int hf_nan_attr_availability_ctr;
277
static int hf_nan_attr_availability_map_id;
278
static int hf_nan_attr_availability_committed_changed;
279
static int hf_nan_attr_availability_potential_changed;
280
static int hf_nan_attr_availability_public_availability_changed;
281
static int hf_nan_attr_availability_ndc_changed;
282
static int hf_nan_attr_availability_reserved_multicast_schedule_changed;
283
static int hf_nan_attr_availability_reserved_multicast_schedule_change_changed;
284
static int hf_nan_attr_availability_entry_len;
285
static int hf_nan_attr_availability_entry_ctr;
286
static int hf_nan_attr_availability_entry_ctr_type;
287
static int hf_nan_attr_availability_entry_ctr_pref;
288
static int hf_nan_attr_availability_entry_ctr_utilization;
289
static int hf_nan_attr_availability_entry_ctr_rx_nss;
290
static int hf_nan_attr_availability_entry_ctr_time_bitmap;
291
static int hf_nan_attr_availability_entry_entries_type;
292
static int hf_nan_attr_availability_entry_entries_non_contiguous_bw;
293
static int hf_nan_attr_availability_entry_entries_num_entries;
294
static int hf_nan_attr_availability_entry_entries_band;
295
static int hf_nan_attr_availability_entry_entries_channel_op_class;
296
static int hf_nan_attr_availability_entry_entries_channel_bitmap;
297
static int hf_nan_attr_availability_entry_entries_primary_channel_bitmap;
298
static int hf_nan_attr_availability_entry_entries_aux_channel_bitmap;
299
static int hf_nan_attr_availability_entry_entries_channel_set;
300
static int hf_nan_attr_availability_entry_entries_start_channel_number;
301
static int hf_nan_attr_availability_entry_entries_number_of_ch_included;
302
static int hf_nan_attr_availability_entry_entries_start_freq;
303
static int hf_nan_attr_availability_entry_entries_bandwidth;
304
static int hf_nan_attr_ndc_id;
305
static int hf_nan_attr_ndc_ctrl;
306
static int hf_nan_attr_ndc_ctrl_selected;
307
static int hf_nan_attr_ndc_map_id_related_sch;
308
static int hf_nan_attr_ndl_type;
309
static int hf_nan_attr_ndl_control;
310
static int hf_nan_attr_ndl_ctrl_peer_id;
311
static int hf_nan_attr_ndl_ctrl_immutable_schedule_pres;
312
static int hf_nan_attr_ndl_ctrl_ndc_pres;
313
static int hf_nan_attr_ndl_ctrl_qos;
314
static int hf_nan_attr_ndl_ctrl_type;
315
static int hf_nan_attr_ndl_ctrl_setup_reason;
316
static int hf_nan_attr_ndl_ctrl_max_idle_pres;
317
static int hf_nan_attr_ndl_reserved_peer_id;
318
static int hf_nan_attr_ndl_max_idle;
319
static int hf_nan_attr_ndlqos_min_time_slots;
320
static int hf_nan_attr_ndlqos_max_latency;
321
static int hf_nan_attr_unaligned_sch_ctrl;
322
static int hf_nan_attr_unaligned_sch_ctrl_schedule_id;
323
static int hf_nan_attr_unaligned_sch_ctrl_seq_id;
324
static int hf_nan_attr_unaligned_sch_starting_time;
325
static int hf_nan_attr_unaligned_sch_duration;
326
static int hf_nan_attr_unaligned_sch_period;
327
static int hf_nan_attr_unaligned_sch_count_down;
328
static int hf_nan_attr_unaligned_sch_ulw_overwrite;
329
static int hf_nan_attr_unaligned_sch_ulw_overwrite_all;
330
static int hf_nan_attr_unaligned_sch_ulw_overwrite_map_id;
331
static int hf_nan_attr_unaligned_sch_ulw_ctrl;
332
static int hf_nan_attr_unaligned_sch_ulw_ctrl_type;
333
static int hf_nan_attr_unaligned_sch_ulw_ctrl_channel_av;
334
static int hf_nan_attr_unaligned_sch_ulw_ctrl_rxnss;
335
static int hf_nan_attr_ranging_info_location_info_avail;
336
static int hf_nan_attr_ranging_info_location_info_avail_lci;
337
static int hf_nan_attr_ranging_info_location_info_avail_geospatial;
338
static int hf_nan_attr_ranging_info_location_info_avail_civic_location;
339
static int hf_nan_attr_ranging_info_location_info_avail_last_movement_pres;
340
static int hf_nan_attr_ranging_info_last_movement_indication;
341
static int hf_nan_attr_ranging_setup_type;
342
static int hf_nan_attr_ranging_setup_ctrl;
343
static int hf_nan_attr_ranging_setup_ctrl_report_req;
344
static int hf_nan_attr_ranging_setup_ctrl_ftm_params;
345
static int hf_nan_attr_ranging_setup_ctrl_entry_list;
346
static int hf_nan_attr_ranging_setup_ftm_params;
347
static int hf_nan_attr_ranging_setup_ftm_max_per_burst;
348
static int hf_nan_attr_ranging_setup_ftm_min_delta;
349
static int hf_nan_attr_ranging_setup_ftm_max_burst_duration;
350
static int hf_nan_attr_ranging_setup_ftm_format_bw;
351
static int hf_nan_attr_ftm_range_report;
352
static int hf_nan_attr_cipher_suite_capabilities;
353
static int hf_nan_attr_cipher_suite_capabilities_ndtksa_nmtksa_replay_counters;
354
static int hf_nan_attr_cipher_suite_capabilities_gtksa_igtksa_bigtksa_support;
355
static int hf_nan_attr_cipher_suite_capabilities_gtksa_replay_counters;
356
static int hf_nan_attr_cipher_suite_capabilities_igtksa_bigtksa_cipher;
357
static int hf_nan_attr_cipher_suite_id;
358
static int hf_nan_attr_security_context_identifier;
359
static int hf_nan_attr_security_context_identifier_len;
360
static int hf_nan_attr_security_context_identifier_type;
361
static int hf_nan_attr_shared_key_rsna_descriptor;
362
static int hf_nan_attr_vendor_specific_body;
363
static int hf_nan_attr_container_element_id;
364
static int hf_nan_attr_container_element_len;
365
/* Device Capability Extension attribute, Capability Info field */
366
static int hf_nan_attr_device_capability_extension;
367
static int hf_nan_attr_device_capability_extension_6g_regulatory_info_presented;
368
static int hf_nan_attr_device_capability_extension_6g_regulatory_info;
369
static int hf_nan_attr_device_capability_extension_6g_regulatory_info_reserved;
370
static int hf_nan_attr_device_capability_extension_paring_setup_enabled;
371
static int hf_nan_attr_device_capability_extension_npk_nik_cache_enabled;
372
/* NAN Identity Resolution attribute */
373
static int hf_nan_attr_identity_cipher_version;
374
static int hf_nan_attr_identity_resolution_nonce;
375
static int hf_nan_attr_identity_resolution_tag;
376
377
/* NAN Pairing Bootstrapping attribute */
378
static int hf_nan_attr_pairing_bootstrapping_dialog_token;
379
static int hf_nan_attr_pairing_bootstrapping_type_status;
380
static int hf_nan_attr_pairing_bootstrapping_type;
381
static int hf_nan_attr_pairing_bootstrapping_status;
382
static int hf_nan_attr_pairing_bootstrapping_resaon_code;
383
static int hf_nan_attr_pairing_bootstrapping_comeback_after;
384
static int hf_nan_attr_pairing_bootstrapping_comeback_cookie_len;
385
static int hf_nan_attr_pairing_bootstrapping_comeback_cookie;
386
static int hf_nan_attr_pairing_bootstrapping_methods;
387
static int hf_nan_attr_pairing_bootstrapping_method_opportunistic_bootstrapping;
388
static int hf_nan_attr_pairing_bootstrapping_method_pin_code_display;
389
static int hf_nan_attr_pairing_bootstrapping_method_passphrase_display;
390
static int hf_nan_attr_pairing_bootstrapping_method_qr_code_display;
391
static int hf_nan_attr_pairing_bootstrapping_method_nfc_tag;
392
static int hf_nan_attr_pairing_bootstrapping_method_keypad_pin_code_only;
393
static int hf_nan_attr_pairing_bootstrapping_method_keypad_passphrase;
394
static int hf_nan_attr_pairing_bootstrapping_method_qr_code_scan;
395
static int hf_nan_attr_pairing_bootstrapping_method_nfc_reader;
396
static int hf_nan_attr_pairing_bootstrapping_method_reserved;
397
static int hf_nan_attr_pairing_bootstrapping_method_service_managed_bootstrapping;
398
static int hf_nan_attr_pairing_bootstrapping_method_bootstrapping_handshakes_skipped;
399
400
static int hf_nan_attr_reserved;
401
402
enum {
403
    NAN_ATTR_MASTER_INDICATION = 0x00,
404
    NAN_ATTR_CLUSTER = 0x01,
405
    NAN_ATTR_SERVICE_ID_LIST = 0x02,
406
    NAN_ATTR_SERVICE_DESCRIPTOR = 0x03,
407
    NAN_ATTR_CONNECTION_CAPABILITY = 0x04,
408
    NAN_ATTR_WLAN_INFRA = 0x05,
409
    NAN_ATTR_P2P_OPERATION = 0x06,
410
    NAN_ATTR_IBSS = 0x07,
411
    NAN_ATTR_MESH = 0x08,
412
    NAN_ATTR_FURTHER_SERVICE_DISCOVERY = 0x09,
413
    NAN_ATTR_FURTHER_AVAILABILITY_MAP = 0x0A,
414
    NAN_ATTR_COUNTRY_CODE = 0x0B,
415
    NAN_ATTR_RANGING = 0x0C,
416
    NAN_ATTR_CLUSTER_DISCOVERY = 0x0D,
417
    NAN_ATTR_SERVICE_DESCRIPTOR_EXTENSION = 0x0E,
418
    NAN_ATTR_DEVICE_CAPABILITY = 0x0F,
419
    NAN_ATTR_NDP = 0x10,
420
    NAN_ATTR_RESERVED_NMSG = 0x11,
421
    NAN_ATTR_AVAILABILITY = 0x12,
422
    NAN_ATTR_NDC = 0x13,
423
    NAN_ATTR_NDL = 0x14,
424
    NAN_ATTR_NDL_QOS = 0x15,
425
    NAN_ATTR_RESERVED_MULTICAST_SCHEDULE = 0x16,
426
    NAN_ATTR_UNALIGNED_SCHEDULE = 0x17,
427
    NAN_ATTR_RESERVED_UNICAST_PAGING = 0x18,
428
    NAN_ATTR_RESERVED_MULTICAST_PAGING = 0x19,
429
    NAN_ATTR_RANGING_INFORMATION = 0x1A,
430
    NAN_ATTR_RANGING_SETUP = 0x1B,
431
    NAN_ATTR_FTM_RANGING_REPORT = 0x1C,
432
    NAN_ATTR_ELEMENT_CONTAINER = 0x1D,
433
    NAN_ATTR_EXTENDED_WLAN_INFRA = 0x1E,
434
    NAN_ATTR_EXTENDED_P2P_OPERATION = 0x1F,
435
    NAN_ATTR_EXTENDED_IBSS = 0x20,
436
    NAN_ATTR_EXTENDED_MESH = 0x21,
437
    NAN_ATTR_CIPHER_SUITE_INFO = 0x22,
438
    NAN_ATTR_SECURITY_CONTEXT_INFO = 0x23,
439
    NAN_ATTR_SHARED_KEY_DESCRIPTOR = 0x24,
440
    NAN_ATTR_RESERVED_MULTICAST_SCHEDULE_CHANGE = 0x25,
441
    NAN_ATTR_RESERVED_MULTICAST_SCHEDULE_OWNER_CHANGE = 0x26,
442
    NAN_ATTR_PUBLIC_AVAILABILITY = 0x27,
443
    NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST = 0x28,
444
    NAN_ATTR_NDP_EXTENSION = 0x29,
445
    NAN_ATTR_DEVICE_CAPABILITY_EXTENSION = 0x2a,
446
    NAN_ATTR_IDENTITY_RESOLUTION = 0x2b,
447
    NAN_ATTR_PAIRING_BOOTSTRAPPING = 0x2c,
448
    NAN_ATTR_VENDOR_SPECIFIC = 0xDD
449
};
450
451
static const value_string attribute_types[] = {
452
    { NAN_ATTR_MASTER_INDICATION, "Master Indication Attribute" },
453
    { NAN_ATTR_CLUSTER, "Cluster Attribute" },
454
    { NAN_ATTR_SERVICE_ID_LIST, "Service ID List Attribute" },
455
    { NAN_ATTR_SERVICE_DESCRIPTOR, "Service Descriptor Attribute" },
456
    { NAN_ATTR_CONNECTION_CAPABILITY, "NAN Connection Capability Attribute" },
457
    { NAN_ATTR_WLAN_INFRA, "WLAN Infrastructure Attribute" },
458
    { NAN_ATTR_P2P_OPERATION, "P2P Operation Attribute" },
459
    { NAN_ATTR_IBSS, "IBSS Attribute" },
460
    { NAN_ATTR_MESH, "Mesh Attribute" },
461
    { NAN_ATTR_FURTHER_SERVICE_DISCOVERY, "Further NAN Service Discovery Attribute" },
462
    { NAN_ATTR_FURTHER_AVAILABILITY_MAP, "Further Availability Map Attribute" },
463
    { NAN_ATTR_COUNTRY_CODE, "Country Code Attribute" },
464
    { NAN_ATTR_RANGING, "Ranging Attribute" },
465
    { NAN_ATTR_CLUSTER_DISCOVERY, "Cluster Discovery Attribute" },
466
    { NAN_ATTR_SERVICE_DESCRIPTOR_EXTENSION, "Service Descriptor Extension Attribute" },
467
    { NAN_ATTR_DEVICE_CAPABILITY, "Device Capability" },
468
    { NAN_ATTR_NDP, "NDP Attribute" },
469
    { NAN_ATTR_RESERVED_NMSG, "Reserved (NMSG)" },
470
    { NAN_ATTR_AVAILABILITY, "NAN Availability" },
471
    { NAN_ATTR_NDC, "NDC Attribute" },
472
    { NAN_ATTR_NDL, "NDL Attribute" },
473
    { NAN_ATTR_NDL_QOS, "NDL QoS Attribute" },
474
    { NAN_ATTR_RESERVED_MULTICAST_SCHEDULE, "Reserved (Multicast Schedule)" },
475
    { NAN_ATTR_UNALIGNED_SCHEDULE, "Unaligned Schedule Attribute" },
476
    { NAN_ATTR_RESERVED_UNICAST_PAGING, "Reserved (Unicast Paging)" },
477
    { NAN_ATTR_RESERVED_MULTICAST_PAGING, "Reserved (Multicast Paging)" },
478
    { NAN_ATTR_RANGING_INFORMATION, "Ranging Information Attribute" },
479
    { NAN_ATTR_RANGING_SETUP, "Ranging Setup Attribute" },
480
    { NAN_ATTR_FTM_RANGING_REPORT, "FTM Ranging Report Attribute" },
481
    { NAN_ATTR_ELEMENT_CONTAINER, "Element Container Attribute" },
482
    { NAN_ATTR_EXTENDED_WLAN_INFRA, "Extended WLAN Infrastructure Attribute" },
483
    { NAN_ATTR_EXTENDED_P2P_OPERATION, "Extended P2P Operation Attribute" },
484
    { NAN_ATTR_EXTENDED_IBSS, "Extended IBSS Attribute" },
485
    { NAN_ATTR_EXTENDED_MESH, "Extended Mesh Attribute" },
486
    { NAN_ATTR_CIPHER_SUITE_INFO, "Cipher Suite Info Attribute" },
487
    { NAN_ATTR_SECURITY_CONTEXT_INFO, "Security Context Info Attribute" },
488
    { NAN_ATTR_SHARED_KEY_DESCRIPTOR, "Shared-Key Descriptor Attribute" },
489
    { NAN_ATTR_RESERVED_MULTICAST_SCHEDULE_CHANGE, "Reserved (Multicast Schedule Change)" },
490
    { NAN_ATTR_RESERVED_MULTICAST_SCHEDULE_OWNER_CHANGE, "Reserved (Multicast Schedule Owner Change)" },
491
    { NAN_ATTR_PUBLIC_AVAILABILITY, "Public Availability Attribute" },
492
    { NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST, "Subscribe Service ID List Attribute" },
493
    { NAN_ATTR_NDP_EXTENSION, "NDP Extension Attribute" },
494
    { NAN_ATTR_DEVICE_CAPABILITY_EXTENSION, "Device Capability Extension"},
495
    { NAN_ATTR_IDENTITY_RESOLUTION, "NAN Identity Resolution"},
496
    { NAN_ATTR_PAIRING_BOOTSTRAPPING, "NAN Pairing Bootstrapping"},
497
    { NAN_ATTR_VENDOR_SPECIFIC, "Vendor Specific Attribute" },
498
    { 0, NULL }
499
};
500
501
// Bitmask fields shared by multiple attributes
502
static int* const map_control_fields[] = {
503
    &hf_nan_map_ctrl_map_id,
504
    &hf_nan_map_ctrl_availability_interval_duration,
505
    &hf_nan_map_ctrl_repeat,
506
    NULL
507
};
508
509
static int* const time_bitmap_ctr_fields[] = {
510
    &hf_nan_time_bitmap_ctrl_bit_duration,
511
    &hf_nan_time_bitmap_ctrl_period,
512
    &hf_nan_time_bitmap_ctrl_start_offset,
513
    NULL
514
};
515
516
static const true_false_string srf_type_flags = {
517
    "Address Set is a Bloom filter",
518
    "Address Set is a sequence of MAC Addresses"
519
};
520
521
static const true_false_string srf_include_flags = {
522
    "Only STAs Present in Address Set shall send a response",
523
    "STAs present in Address Set shall not send responses"
524
};
525
526
static const true_false_string sdea_ctr_data_path_type_flags = {
527
    "Reserved",
528
    "Unicast NDP required (Reserved if NDP is not required)"
529
};
530
531
static const true_false_string sdea_ctr_reserved_multicast_type_flags = {
532
    "Many to many (Reserved if NDP is not required)",
533
    "One to many (Reserved if NDP is not required)"
534
};
535
536
static const true_false_string device_cap_map_id_apply_to_flags = {
537
    "Only specified map",
538
    "All maps"
539
};
540
541
static const true_false_string device_cap_op_mode_phy_flags_vht = {
542
    "VHT",
543
    "HT"
544
};
545
546
static const true_false_string device_cap_op_mode_phy_flags_he = {
547
    "HE",
548
    "HE Not Supported"
549
};
550
551
static const true_false_string availability_entry_entries_type_flags = {
552
    "Operating Classes and channel entries",
553
    "Indicated bands"
554
};
555
556
static const true_false_string ndc_ctr_selected_flags = {
557
    "Selected NDC for a NDL Schedule",
558
    "NDC included for the peer's information"
559
};
560
561
static const value_string map_ctrl_availability_interval_duration[] = {
562
    { 0, "16 TU" },
563
    { 1, "32 TU" },
564
    { 2, "64 TU" },
565
    { 3, "Reserved" },
566
    { 0, NULL }
567
};
568
569
static const value_string service_ctr_type[] = {
570
    { 0, "Publish" },
571
    { 1, "Subscribe" },
572
    { 2, "Follow up" },
573
    { 3, "Reserved" },
574
    { 0, NULL }
575
};
576
577
static const range_string service_info_protocol_type[] = {
578
    { 0, 0, "Reserved" },
579
    { 1, 1, "Bonjour" },
580
    { 2, 2, "Generic" },
581
    { 3, 255, "Reserved" },
582
    { 0, 0, NULL }
583
};
584
585
static const value_string availability_entry_type[] = {
586
    { 0, "Reserved" },
587
    { 1, "Committed" },
588
    { 2, "Potential" },
589
    { 3, "Committed + Potential" },
590
    { 4, "Conditional" },
591
    { 5, "Reserved" },
592
    { 6, "Potential + Conditional" },
593
    { 7, "Reserved" },
594
    { 0, NULL }
595
};
596
597
static const range_string availability_entry_time_bitmap_ctr_bit_duration_type[] = {
598
    { 0, 0, "16 TU" },
599
    { 1, 1, "32 TU" },
600
    { 2, 2, "64 TU" },
601
    { 3, 3, "128 TU" },
602
    { 4, 7, "Reserved" },
603
    { 0, 0, NULL }
604
};
605
606
static const value_string availability_entry_time_bitmap_ctr_period_type[] = {
607
    { 1, "128 TU" },
608
    { 2, "256 TU" },
609
    { 3, "512 TU" },
610
    { 4, "1024 TU" },
611
    { 5, "2048 TU" },
612
    { 6, "4096 TU" },
613
    { 7, "8192 TU" },
614
    { 0, NULL }
615
};
616
617
static const range_string availability_entry_entries_band_type[] = {
618
    { 0, 0, "Reserved (for TV white spaces)" },
619
    { 1, 1, "Sub-1 GHz" },
620
    { 2, 2, "2.4 GHz" },
621
    { 3, 3, "Reserved (for 3.6 GHz)" },
622
    { 4, 4, "4.9 and 5 GHz" },
623
    { 5, 5, "Reserved (for 60 GHz)" },
624
    { 6, 6, "Reserved (for 45 GHz)" },
625
    { 7, 7, "6 Ghz" },
626
    { 8, 255, "Reserved" },
627
    { 0, 0, NULL }
628
};
629
630
static const range_string ndp_type_values[] = {
631
    { 0, 0, "Request" },
632
    { 1, 1, "Response" },
633
    { 2, 2, "Confirm" },
634
    { 3, 3, "Security Install" },
635
    { 4, 4, "Terminate" },
636
    { 5, 15, "Reserved" },
637
    { 0, 0, NULL }
638
};
639
640
static const range_string ndpe_tlv_type_values[] = {
641
    { 0, 0, "IPv6 Link Local" },
642
    { 1, 1, "Service Info" },
643
    { 2, 255, "Reserved" },
644
    { 0, 0, NULL }
645
};
646
647
static const range_string ndl_type_values[] = {
648
    { 0, 0, "Request" },
649
    { 1, 1, "Response" },
650
    { 2, 2, "Confirm" },
651
    { 3, 15, "Reserved" },
652
    { 0, 0, NULL }
653
};
654
655
static const range_string ranging_setup_type_values[] = {
656
    { 0, 0, "Request" },
657
    { 1, 1, "Response" },
658
    { 2, 2, "Termination" },
659
    { 3, 15, "Reserved" },
660
    { 0, 0, NULL }
661
};
662
663
static const range_string status_type1_values[] = {
664
    { 0, 0, "Continue" },
665
    { 1, 1, "Accepted" },
666
    { 2, 2, "Rejected" },
667
    { 3, 15, "Reserved" },
668
    { 0, 0, NULL }
669
};
670
671
static const range_string status_type2_values[] = {
672
    { 0, 0, "Accepted" },
673
    { 1, 1, "Rejected" },
674
    { 2, 15, "Reserved" },
675
    { 0, 0, NULL }
676
};
677
678
static const range_string reason_code_values[] = {
679
    { 0, 0, "Reserved" },
680
    { 1, 1, "UNSPECIFIED_REASON" },
681
    { 2, 2, "RESOURCE_LIMITATION" },
682
    { 3, 3, "INVALID_PARAMETERS" },
683
    { 4, 4, "FTM_PARAMETERS_INCAPABLE" },
684
    { 5, 5, "NO_MOVEMENT" },
685
    { 6, 6, "INVALID_AVAILABILITY" },
686
    { 7, 7, "IMMUTABLE_UNACCEPTABLE" },
687
    { 8, 8, "SECURITY_POLICY" },
688
    { 9, 9, "QoS_UNACCEPTABLE" },
689
    { 10, 10, "NDP_REJECTED" },
690
    { 11, 11, "NDL_UNACCEPTABLE" },
691
    { 12, 12, "Ranging Schedule unacceptable" },
692
    { 13, 255, "Reserved" },
693
    { 0, 0, NULL }
694
};
695
696
static const range_string action_frame_type_values[] = {
697
    { 0, 0, "Reserved" },
698
    { 1, 1, "Ranging Request" },
699
    { 2, 2, "Ranging Response" },
700
    { 3, 3, "Ranging Termination" },
701
    { 4, 4, "Ranging Report" },
702
    { 5, 5, "Data Path Request" },
703
    { 6, 6, "Data Path Response" },
704
    { 7, 7, "Data Path Confirm" },
705
    { 8, 8, "Data Path Key Installment" },
706
    { 9, 9, "Data Path Termination" },
707
    { 10, 10, "Schedule Request" },
708
    { 11, 11, "Schedule Response" },
709
    { 12, 12, "Schedule Confirm" },
710
    { 13, 13, "Schedule Update Notification" },
711
    { 14, 255, "Reserved" },
712
    { 0, 0, NULL }
713
};
714
715
static const value_string ndl_type_string[] = {
716
    { 0, "S-NDL" },
717
    { 1, "Reserved (P-NDL)" },
718
    { 0, NULL }
719
};
720
721
static const value_string ndl_setup_reason[] = {
722
    { 0, "NDP" },
723
    { 1, "FSD using GAS" },
724
    { 2, "Reserved" },
725
    { 3, "Reserved" },
726
    { 0, NULL }
727
};
728
729
static const value_string unaligned_sch_ulw_type[] = {
730
    { 0, "Followed by a Band ID field" },
731
    { 1, "Followed by a Channel Entry field without Auxiliary Channel" },
732
    { 2, "Followed by a Channel Entry field with Auxiliary Channel" },
733
    { 3, "Reserved" },
734
    { 0, NULL }
735
};
736
737
static const range_string security_context_iden_type[] = {
738
    { 0, 0, "Reserved" },
739
    { 1, 1, "ND-PMKID" },
740
    { 2, 255, "Reserved" },
741
    { 0, 0, NULL }
742
};
743
744
static const value_string device_role[] = {
745
    { 0, "AP" },
746
    { 1, "Non-AP STA associated with AP" },
747
    { 2, "Non-AP STA listening to AP" },
748
    { 0, NULL }
749
};
750
751
static const range_string furth_av_map_id[] = {
752
    {0, 15, "Identify Further Availability attribute"},
753
    {16, 255, "Reserved"},
754
    {0, 0, NULL}
755
};
756
757
static const value_string device_capability_extension_6g_regulatoty_info[] = {
758
    { 0, "Indoor AP" },
759
    { 1, "Standard Power AP" },
760
    { 2, "Very Low Power AP" },
761
    { 3, "Indoor Enabled AP" },
762
    { 4, "Indoor Standard Power AP" },
763
    { 0, NULL }
764
};
765
766
static const range_string nan_identity_resolution_cipher_version[] = {
767
    {0, 0, "128-bit NIK, 64-bit Nonce, 64-bit Tag, HMAC-SHA-256"},
768
    {1, 255, "Reserved"},
769
    {0, 0, NULL }
770
};
771
772
static const value_string nan_pairing_bootstrapping_pairing_bootstrapping_type[] = {
773
    { 0, "Advertise" },
774
    { 1, "Request" },
775
    { 2, "Response" },
776
    { 0, NULL } /* Reserved for other value */
777
};
778
779
static const value_string nan_pairing_bootstrapping_pairing_bootstrapping_status[] = {
780
    { 0, "Accepted" },
781
    { 1, "Rejected" },
782
    { 2, "Comeback" },
783
    { 0, NULL } /* Reserved for other value */
784
};
785
786
static const value_string cipher_suite_capabilities_nd_nm_tksa_replay_counters[] = {
787
    { 0, "4 ND-TKSA and NM-TKSA (if applicable) replay counters" },
788
    { 1, "16 ND-TKSA and NM-TKSA (if applicable) replay counters" },
789
    { 0, NULL }
790
};
791
792
static const value_string cipher_suite_capabilities_group_and_integrity_sa_support[] = {
793
    { 0, "GTKSA, IGTKSA, BIGTKSA are not supported" },
794
    { 1, "GTKSA and IGTKSA are supported, and BIGTKSA is not supported" },
795
    { 2, "GTKSA, IGTKSA, and BIGTKSA are supported" },
796
    { 3, "Reserved" },
797
    { 0, NULL }
798
};
799
800
static const value_string cipher_suite_capabilities_gtksa_replay_counters[] = {
801
    { 0, "4 GTKSA replay counters" },
802
    { 1, "16 GTKSA replay counters" },
803
    { 0, NULL }
804
};
805
806
static const value_string cipher_suite_capabilities_integrity_sa_ciphers[] = {
807
    { 0, "NCS-BIP-128 (BIP-CMAC-128)" },
808
    { 1, "NCS-BIP_256 (BIP-GMAC-256)" },
809
    { 0, NULL }
810
};
811
812
0
#define PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN (64)
813
814
typedef struct _range_channel_set {
815
    uint32_t   value_min;
816
    uint32_t   value_max;
817
    const int channel_set[PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN];
818
} range_channel_set;
819
820
static const int *
821
rval_to_channel_set(const uint32_t val, const range_channel_set* ra)
822
0
{
823
0
    int i = 0;
824
0
    if (ra)
825
0
    {
826
0
        while (*ra[i].channel_set) /* no such thing as channel 0 - end of list */
827
0
        {
828
0
            if ((val >= ra[i].value_min) && (val <= ra[i].value_max))
829
0
            {
830
0
                return ra[i].channel_set;
831
0
            }
832
0
            i++;
833
0
        }
834
0
    }
835
0
    return NULL;
836
0
}
837
838
static unsigned int channel_number_valid(const uint8_t channel_number, const int *const channel_set)
839
0
{
840
0
    for (unsigned int i = 0; i < PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN; i++)
841
0
    {
842
0
        if (channel_set[i] == channel_number)
843
0
        {
844
0
            return i;
845
0
        }
846
0
    }
847
848
0
    return PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN;
849
0
}
850
851
// TODO: this table corresponds to the 802.11 global operating classes.
852
//   it's probably in the 802.11 dissector somewhere and ideally this
853
//   should be used instead...
854
static const range_channel_set op_class_channel[] = {
855
    {1, 80, {-1}},
856
    {81, 81, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}},
857
    {82, 82, {14}},
858
    {83, 83, {1, 2, 3, 4, 5, 6, 7, 8, 9}},
859
    {84, 84, {5, 6, 7, 8, 9, 10, 11, 12, 13}},
860
    {85, 85, {-3}},
861
    {86, 86, {-3}},
862
    {87, 87, {-3}},
863
    {88, 93, {-1}},
864
    {94, 94, {133, 137}},
865
    {95, 95, {136, 138}},
866
    {96, 96, {131, 132, 133, 134, 135, 136, 137, 138}},
867
    {97, 100, {-1}},
868
    {101, 101, {21, 25}},
869
    {102, 102, {11, 13, 15, 17, 19}},
870
    {103, 103, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}},
871
    {104, 104, {184, 192}},
872
    {105, 105, {188, 196}},
873
    {106, 106, {191, 195}},
874
    {107, 107, {189, 191, 193, 195, 197}},
875
    {108, 108, {188, 189, 190, 191, 192, 193, 194, 195, 196, 197}},
876
    {109, 109, {184, 188, 192, 196}},
877
    {110, 110, {183, 184, 185, 186, 187, 188, 189}},
878
    {111, 111, {182, 183, 184, 185, 186, 187, 188, 189}},
879
    {112, 112, {8, 12, 16}},
880
    {113, 113, {7, 8, 9, 10, 11}},
881
    {114, 114, {6, 7, 8, 9, 10, 11}},
882
    {115, 115, {36, 40, 44, 48}},
883
    {116, 116, {36, 44}},
884
    {117, 117, {40, 48}},
885
    {118, 118, {52, 56, 60, 64}},
886
    {119, 119, {52, 60}},
887
    {120, 120, {56, 64}},
888
    {121, 121, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144}},
889
    {122, 122, {100, 108, 116, 124, 132, 140}},
890
    {123, 123, {103, 112, 120, 128, 136, 144}},
891
    {124, 124, {149, 153, 157, 161}},
892
    {125, 125, {149, 153, 157, 161,165, 169}},
893
    {126, 126, {149, 157}},
894
    {127, 127, {153, 161}},
895
    {128, 128, {42, 58, 106, 122, 138, 155}},
896
    {129, 129, {50, 114}},
897
    {130, 130, {42, 58, 106, 122, 138, 155}},
898
    {131, 131, {1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233}},
899
    {132, 132, {3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, 155, 163, 171, 179, 187, 195, 203, 211, 219, 227}},
900
    {133, 133, {7, 23, 39, 55, 71, 87, 103, 119, 135, 151, 167, 183, 199, 215}},
901
    {134, 134, {15, 47, 79, 111, 143, 175, 207}},
902
    {135, 135, {7, 23, 39, 55, 71, 87, 103, 119, 135, 151, 167, 183, 199, 215}},
903
    {137, 137, {31, 63, 95, 127, 159, 191}},
904
    {138, 179, {-1}},
905
    {137, 179, {-1}},
906
    {180, 180, {1, 2, 3, 4, 5, 6}},
907
    {181, 191, {-1}},
908
    {192, 254, {-2}},
909
    {255, 255, {-1}},
910
    {0, 0, {0}}, /* no such thing as channel 1 - end of list */
911
};
912
913
static const range_string op_channel_spacing[] = {
914
    {1, 80, "Reserved"},
915
    {81, 82, "25"},
916
    {83, 84, "40"},
917
    {85, 85, "6, 7, 8"},
918
    {86, 86, "12, 14, 16"},
919
    {87, 87, "24, 28, 32"},
920
    {88, 93, "Reserved"},
921
    {94, 94, "20"},
922
    {95, 95, "10"},
923
    {96, 96, "5"},
924
    {97, 100, "Reserved"},
925
    {101, 101, "20"},
926
    {102, 102, "10"},
927
    {103, 103, "5"},
928
    {104, 105, "40"},
929
    {106, 106, "20"},
930
    {107, 107, "10"},
931
    {108, 108, "5"},
932
    {109, 109, "20"},
933
    {110, 110, "10"},
934
    {111, 111, "5"},
935
    {112, 112, "20"},
936
    {113, 113, "10"},
937
    {114, 114, "5"},
938
    {115, 115, "20"},
939
    {116, 117, "40"},
940
    {118, 118, "20"},
941
    {119, 120, "40"},
942
    {121, 121, "20"},
943
    {122, 123, "40"},
944
    {124, 125, "20"},
945
    {126, 127, "40"},
946
    {128, 128, "80"},
947
    {129, 129, "160"},
948
    {130, 130, "80"},
949
    {131, 131, "20"},
950
    {132, 132, "40"},
951
    {133, 133, "80"},
952
    {134, 134, "160"},
953
    {135, 135, "80"},
954
    {136, 136, "20"},
955
    {137, 137, "320"},
956
    {138, 179, "Reserved"},
957
    {180, 180, "2160"},
958
    {181, 191, "Reserved"},
959
    {255, 255, "Reserved"},
960
    {0, 0, NULL}
961
};
962
963
static const range_string op_starting_freq[] = {
964
    {1, 80, "Reserved"},
965
    {81, 81, "2.407"},
966
    {82, 82, "2.414"},
967
    {83, 83, "2.407"},
968
    {84, 84, "2.407"},
969
    {88, 93, "Reserved"},
970
    {94, 95, "3"},
971
    {96, 96, "3.0025"},
972
    {97, 100, "Reserved"},
973
    {101, 101, "4.85"},
974
    {102, 102, "4.89"},
975
    {103, 103, "4.9375"},
976
    {104, 104, "4"},
977
    {105, 107, "4"},
978
    {108, 108, "4.0025"},
979
    {109, 110, "4"},
980
    {111, 111, "4.0025"},
981
    {112, 113, "5"},
982
    {114, 114, "5.0025"},
983
    {115, 130, "5"},
984
    {131, 135, "5.950"},
985
    {136, 136, "5.925"},
986
    {137, 137, "5.950"},
987
    {138, 179, "Reserved"},
988
    {180, 180, "56.16"},
989
    {181, 191, "Reserved"},
990
    {255, 255, "Reserved"},
991
    {0, 0, NULL}
992
};
993
994
static void
995
dissect_attr_master_indication(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
996
0
{
997
0
    if (attr_len != NAN_MASTER_IND_LENGTH)
998
0
    {
999
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1000
0
        return;
1001
0
    }
1002
1003
0
    proto_tree_add_item(attr_tree, hf_nan_attr_master_preference, tvb,
1004
0
        offset + 3, 1, ENC_BIG_ENDIAN);
1005
0
    proto_tree_add_item(attr_tree, hf_nan_attr_master_random_factor, tvb,
1006
0
        offset + 4, 1, ENC_BIG_ENDIAN);
1007
0
}
1008
1009
static void
1010
dissect_attr_cluster(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1011
0
{
1012
0
    if (attr_len != NAN_CLUSTER_LENGTH)
1013
0
    {
1014
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1015
0
        return;
1016
0
    }
1017
1018
0
    proto_tree* anchor_master_tree = proto_tree_add_subtree(attr_tree, tvb, offset + 3, 13,
1019
0
        ett_cluster_anchor_master_info, NULL, "Anchor Master Information");
1020
0
    proto_tree_add_item(anchor_master_tree, hf_nan_attr_cluster_anchor_master_rank, tvb,
1021
0
        offset + 3, 8, ENC_BIG_ENDIAN);
1022
0
    proto_tree_add_item(anchor_master_tree, hf_nan_attr_cluster_hop_count, tvb,
1023
0
        offset + 11, 1, ENC_BIG_ENDIAN);
1024
0
    proto_tree_add_item(anchor_master_tree, hf_nan_attr_cluster_beacon_transmission_time, tvb,
1025
0
        offset + 12, 4, ENC_LITTLE_ENDIAN);
1026
0
}
1027
1028
static void
1029
dissect_attr_service_id_list(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1030
0
{
1031
0
    if (attr_len % 6 != 0 || attr_len == 0)
1032
0
    {
1033
0
        expert_add_info_format(pinfo, attr_tree, &ei_nan_elem_len_invalid, "Invalid Service ID length");
1034
0
        return;
1035
0
    }
1036
1037
0
    int num_service_ids = attr_len / 6;
1038
0
    offset += 3;
1039
0
    for (int i = 1; i <= num_service_ids; ++i)
1040
0
    {
1041
0
        proto_tree_add_item(attr_tree, hf_nan_service_id, tvb, offset, 6, ENC_NA);
1042
0
        offset += 6;
1043
0
    }
1044
0
}
1045
1046
static void
1047
dissect_attr_sda(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1048
0
{
1049
0
    if (attr_len < NAN_SDA_MIN_LENGTH)
1050
0
    {
1051
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1052
0
        return;
1053
0
    }
1054
1055
0
    proto_tree_add_item(attr_tree, hf_nan_service_id, tvb,
1056
0
        offset + 3, 6, ENC_NA);
1057
0
    proto_tree_add_item(attr_tree, hf_nan_instance_id, tvb,
1058
0
        offset + 9, 1, ENC_BIG_ENDIAN);
1059
0
    proto_tree_add_item(attr_tree, hf_nan_attr_sda_requestor_instance_id, tvb,
1060
0
        offset + 10, 1, ENC_BIG_ENDIAN);
1061
0
    offset += 11;
1062
1063
0
    static int* const service_ctr_fields[] = {
1064
0
        &hf_nan_attr_sda_sc_type,
1065
0
        &hf_nan_attr_sda_sc_matching_filter,
1066
0
        &hf_nan_attr_sda_sc_service_response,
1067
0
        &hf_nan_attr_sda_sc_service_info,
1068
0
        &hf_nan_attr_sda_sc_discovery_range,
1069
0
        &hf_nan_attr_sda_sc_binding_bitmap,
1070
0
        NULL
1071
0
    };
1072
1073
0
    proto_tree_add_bitmask(attr_tree, tvb, offset, hf_nan_attr_sda_sc,
1074
0
        ett_sda_service_ctr, service_ctr_fields, ENC_LITTLE_ENDIAN);
1075
1076
0
    uint8_t service_ctr_byte = tvb_get_uint8(tvb, offset);
1077
0
    offset += 1;
1078
1079
0
    const uint8_t BITMASK_TYPE_SUBSCRIBE = 0x01;
1080
0
    const uint8_t BITMASK_TYPE_FOLLOW_UP = 0x02;
1081
0
    const uint8_t BITMASK_MATCHING_FILTER_PRESENT = 0x04;
1082
0
    const uint8_t BITMASK_SERVICE_RESPONSE_FILTER_PRESENT = 0x08;
1083
0
    const uint8_t BITMASK_SERVICE_INFO_PRESENT = 0x10;
1084
0
    const uint8_t BITMASK_BITMAP_PRESENT = 0x40;
1085
1086
0
    if (service_ctr_byte & BITMASK_TYPE_SUBSCRIBE)
1087
0
    {
1088
0
        col_prepend_fstr(pinfo->cinfo, COL_INFO, "SDF Subscribe, ");
1089
0
    }
1090
0
    else if (service_ctr_byte & BITMASK_TYPE_FOLLOW_UP)
1091
0
    {
1092
0
        col_prepend_fstr(pinfo->cinfo, COL_INFO, "SDF Follow up, ");
1093
0
    }
1094
0
    else
1095
0
    {
1096
0
        col_prepend_fstr(pinfo->cinfo, COL_INFO, "SDF Publish, ");
1097
0
    }
1098
1099
0
    if (service_ctr_byte & BITMASK_BITMAP_PRESENT)
1100
0
    {
1101
0
        proto_tree_add_item(attr_tree, hf_nan_attr_sda_binding_bitmap, tvb,
1102
0
            offset, 2, ENC_LITTLE_ENDIAN);
1103
0
        offset += 2;
1104
0
    }
1105
1106
0
    if (service_ctr_byte & BITMASK_MATCHING_FILTER_PRESENT)
1107
0
    {
1108
0
        proto_tree_add_item(attr_tree, hf_nan_attr_sda_matching_filter_len, tvb,
1109
0
            offset, 1, ENC_LITTLE_ENDIAN);
1110
0
        int mf_len = tvb_get_uint8(tvb, offset);
1111
0
        int dissected_mf_len = 0;
1112
0
        offset += 1;
1113
0
        while (dissected_mf_len < mf_len)
1114
0
        {
1115
0
            int filter_len = tvb_get_uint8(tvb, offset);
1116
0
            proto_tree_add_item(attr_tree, hf_nan_attr_sda_matching_filter_val, tvb,
1117
0
                offset + 1, filter_len, ENC_NA);
1118
0
            offset += filter_len + 1;
1119
0
            dissected_mf_len += filter_len + 1;
1120
0
        }
1121
0
    }
1122
1123
0
    if (service_ctr_byte & BITMASK_SERVICE_RESPONSE_FILTER_PRESENT)
1124
0
    {
1125
0
        proto_tree_add_item(attr_tree, hf_nan_attr_sda_service_response_filter_len, tvb,
1126
0
            offset, 1, ENC_LITTLE_ENDIAN);
1127
0
        int srf_len = tvb_get_uint8(tvb, offset);
1128
1129
0
        static int* const srf_ctr_fields[] = {
1130
0
            &hf_nan_attr_sda_srf_ctr_type,
1131
0
            &hf_nan_attr_sda_srf_ctr_include,
1132
0
            &hf_nan_attr_sda_srf_ctr_bloom_filter_index,
1133
0
            NULL
1134
0
        };
1135
1136
0
        proto_tree_add_bitmask(attr_tree, tvb, offset + 1, hf_nan_attr_sda_srf_ctr,
1137
0
            ett_sda_service_ctr, srf_ctr_fields, ENC_LITTLE_ENDIAN);
1138
0
        proto_tree_add_item(attr_tree, hf_nan_attr_sda_srf_address_set, tvb,
1139
0
            offset + 2, srf_len - 1, ENC_NA);
1140
0
        offset += srf_len + 1;
1141
0
    }
1142
1143
0
    if (service_ctr_byte & BITMASK_SERVICE_INFO_PRESENT)
1144
0
    {
1145
0
        uint32_t service_info_len;
1146
1147
        /* XXX - use FT_UINT_BYTES? */
1148
0
        proto_tree_add_item_ret_uint(attr_tree, hf_nan_attr_sda_service_info_len, tvb,
1149
0
            offset, 1, ENC_BIG_ENDIAN, &service_info_len);
1150
0
        proto_tree_add_item(attr_tree, hf_nan_attr_sda_service_info, tvb,
1151
0
            offset + 1, service_info_len, ENC_NA);
1152
        // offset += service_info_len + 1;
1153
0
    }
1154
0
}
1155
1156
static void
1157
dissect_attr_sdea(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1158
0
{
1159
0
    if (attr_len < NAN_SDEA_MIN_LENGTH)
1160
0
    {
1161
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1162
0
        return;
1163
0
    }
1164
1165
0
    proto_tree_add_item(attr_tree, hf_nan_instance_id, tvb,
1166
0
        offset + 3, 1, ENC_LITTLE_ENDIAN);
1167
0
    offset += 4;
1168
0
    uint16_t dissected_len = 1;
1169
1170
0
    static int* const sdea_ctr_fields[] = {
1171
0
        &hf_nan_attr_sdea_ctr_fsd,
1172
0
        &hf_nan_attr_sdea_ctr_fsd_w_gas,
1173
0
        &hf_nan_attr_sdea_ctr_data_path,
1174
0
        &hf_nan_attr_sdea_ctr_data_path_type,
1175
0
        &hf_nan_attr_sdea_ctr_reserved_multicast_type,
1176
0
        &hf_nan_attr_sdea_ctr_qos,
1177
0
        &hf_nan_attr_sdea_ctr_security,
1178
0
        &hf_nan_attr_sdea_ctr_ranging,
1179
0
        &hf_nan_attr_sdea_ctr_range_limit,
1180
0
        &hf_nan_attr_sdea_ctr_service_update_indicator,
1181
0
        NULL
1182
0
    };
1183
1184
0
    proto_tree_add_bitmask(attr_tree, tvb, offset, hf_nan_attr_sdea_ctr, ett_sdea_ctr,
1185
0
        sdea_ctr_fields, ENC_LITTLE_ENDIAN);
1186
1187
0
    uint16_t sdea_ctr_byte = tvb_get_letohs(tvb, offset);
1188
0
    offset += 2;
1189
0
    dissected_len += 2;
1190
1191
0
    if (sdea_ctr_byte & 0x100)
1192
0
    {
1193
0
        proto_tree* range_lim_tree = proto_tree_add_subtree(attr_tree, tvb, offset, 4,
1194
0
            ett_sdea_range_limit, NULL, "Range Limit");
1195
0
        proto_tree_add_item(range_lim_tree, hf_nan_attr_sdea_ingress_range_limit, tvb,
1196
0
            offset, 2, ENC_LITTLE_ENDIAN);
1197
0
        proto_tree_add_item(range_lim_tree, hf_nan_attr_sdea_egress_range_limit, tvb,
1198
0
            offset + 2, 2, ENC_LITTLE_ENDIAN);
1199
0
        offset += 4;
1200
0
        dissected_len += 4;
1201
0
    }
1202
1203
0
    if (sdea_ctr_byte & 0x200)
1204
0
    {
1205
0
        proto_tree_add_item(attr_tree, hf_nan_attr_sdea_service_update_indicator, tvb,
1206
0
            offset, 1, ENC_LITTLE_ENDIAN);
1207
0
        offset += 1;
1208
0
        dissected_len += 1;
1209
0
    }
1210
1211
    // If Service Info field is present
1212
0
    if (dissected_len < attr_len)
1213
0
    {
1214
0
        proto_tree_add_item(attr_tree, hf_nan_attr_sdea_service_info_length, tvb,
1215
0
            offset, 2, ENC_LITTLE_ENDIAN);
1216
0
        proto_tree* service_info_tree = proto_tree_add_subtree(attr_tree, tvb, offset + 2,
1217
0
            attr_len - dissected_len - 2, ett_sdea_service_info, NULL, "Service Info");
1218
0
        proto_tree_add_item(service_info_tree, hf_nan_oui, tvb,
1219
0
            offset + 2, 3, ENC_NA);
1220
0
        proto_tree_add_item(service_info_tree, hf_nan_attr_sdea_service_info_protocol_type, tvb,
1221
0
            offset + 5, 1, ENC_BIG_ENDIAN);
1222
0
        proto_tree_add_item(service_info_tree, hf_nan_attr_sdea_service_info_specific, tvb,
1223
0
            offset + 6, attr_len - dissected_len - 6, ENC_NA);
1224
0
    }
1225
0
}
1226
1227
static void
1228
dissect_attr_connection_capability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1229
0
{
1230
0
    if (attr_len != NAN_CONNECTION_CAP_LENGTH)
1231
0
    {
1232
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1233
0
        return;
1234
0
    }
1235
1236
0
    static int* const connection_cap_bitmap_fields[] = {
1237
0
        &hf_nan_attr_connection_cap_wifi_direct,
1238
0
        &hf_nan_attr_connection_cap_p2ps,
1239
0
        &hf_nan_attr_connection_cap_tdls,
1240
0
        &hf_nan_attr_connection_cap_wlan_infra,
1241
0
        &hf_nan_attr_connection_cap_ibss,
1242
0
        &hf_nan_attr_connection_cap_mesh,
1243
0
        NULL
1244
0
    };
1245
1246
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 3, hf_nan_attr_connection_cap_bitmap,
1247
0
        ett_connection_cap_field, connection_cap_bitmap_fields, ENC_LITTLE_ENDIAN);
1248
0
}
1249
1250
static void
1251
dissect_attr_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1252
0
{
1253
0
    if (attr_len < NAN_WLAN_INFRA_MIN_LENGTH)
1254
0
    {
1255
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1256
0
        return;
1257
0
    }
1258
1259
0
    unsigned sub_offset = offset + 3;
1260
0
    proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN);
1261
0
    sub_offset += 6;
1262
0
    proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
1263
0
    sub_offset += 6;
1264
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1265
0
        ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1266
0
    sub_offset++;
1267
0
    int bitmap_length = attr_len - 14;
1268
0
    proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, bitmap_length, ENC_NA);
1269
0
    sub_offset += bitmap_length;
1270
0
    proto_tree_add_item(attr_tree, hf_nan_attr_wlan_infra_device_role, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1271
0
}
1272
1273
static void
1274
dissect_attr_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1275
0
{
1276
0
    if (attr_len < NAN_P2P_OP_MIN_LENGTH)
1277
0
    {
1278
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1279
0
        return;
1280
0
    }
1281
1282
0
    unsigned sub_offset = offset + 3;
1283
0
    static int* const p2p_bitmap_fields[] = {
1284
0
        &hf_nan_attr_p2p_device_role_device,
1285
0
        &hf_nan_attr_p2p_device_role_group_owner,
1286
0
        &hf_nan_attr_p2p_device_role_client,
1287
0
        NULL
1288
0
    };
1289
1290
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_p2p_device_role,
1291
0
        ett_p2p_device_role, p2p_bitmap_fields, ENC_LITTLE_ENDIAN);
1292
0
    sub_offset++;
1293
0
    proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
1294
0
    sub_offset += 6;
1295
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1296
0
        ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1297
0
    sub_offset++;
1298
0
    proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, -1, ENC_NA);
1299
0
}
1300
1301
static void
1302
dissect_attr_ibss(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1303
0
{
1304
0
    if (attr_len < NAN_IBSS_MIN_LENGTH)
1305
0
    {
1306
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1307
0
        return;
1308
0
    }
1309
1310
0
    unsigned sub_offset = offset + 3;
1311
0
    proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN);
1312
0
    sub_offset += 6;
1313
0
    proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
1314
0
    sub_offset += 6;
1315
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1316
0
        ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1317
0
    sub_offset++;
1318
0
    proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, -1, ENC_NA);
1319
0
}
1320
1321
static void
1322
dissect_attr_mesh(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1323
0
{
1324
0
    if (attr_len < NAN_MESH_MIN_LENGTH)
1325
0
    {
1326
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1327
0
        return;
1328
0
    }
1329
1330
0
    unsigned sub_offset = offset + 3;
1331
0
    proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
1332
0
    sub_offset += 6;
1333
1334
0
    uint8_t duration = tvb_get_bits8(tvb, sub_offset * 8 + 5, 2);
1335
0
    unsigned bitmap_length;
1336
0
    switch (duration) {
1337
0
    case 0:
1338
0
        bitmap_length = 4;
1339
0
        break;
1340
0
    case 1:
1341
0
        bitmap_length = 2;
1342
0
        break;
1343
0
    case 2:
1344
0
        bitmap_length = 1;
1345
0
        break;
1346
0
    default:
1347
0
        bitmap_length = 0;
1348
0
    }
1349
1350
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1351
0
        ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1352
0
    sub_offset++;
1353
0
    proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, bitmap_length, ENC_NA);
1354
0
    sub_offset += bitmap_length;
1355
0
    proto_tree_add_item(attr_tree, hf_nan_attr_mesh_id, tvb, sub_offset, -1, ENC_NA);
1356
0
}
1357
1358
static void
1359
dissect_attr_further_service_discovery(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len)
1360
0
{
1361
0
    unsigned sub_offset = offset + 3;
1362
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1363
0
        ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1364
0
    sub_offset++;
1365
0
    int bitmap_length = attr_len - 1;
1366
0
    proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, bitmap_length, ENC_NA);
1367
0
}
1368
1369
static void
1370
dissect_attr_further_availability_map(proto_tree* attr_tree, tvbuff_t* tvb, int offset)
1371
0
{
1372
0
    unsigned sub_offset = offset + 3;
1373
0
    proto_tree_add_item(attr_tree, hf_nan_attr_further_av_map_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1374
0
    sub_offset++;
1375
1376
0
    static int* const availability_entry_control_fields[] = {
1377
0
        &hf_nan_attr_further_av_map_entry_av_interval_duration,
1378
0
        NULL
1379
0
    };
1380
1381
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_further_av_map_entry_ctrl,
1382
0
        ett_further_av_map_entry_ctrl, availability_entry_control_fields, ENC_LITTLE_ENDIAN);
1383
0
    sub_offset++;
1384
0
    proto_tree_add_item(attr_tree, hf_nan_attr_further_av_map_op_class, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1385
0
    sub_offset++;
1386
0
    proto_tree_add_item(attr_tree, hf_nan_attr_further_av_map_channel_num, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1387
0
    sub_offset++;
1388
0
    proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, -1, ENC_NA);
1389
0
}
1390
1391
static void
1392
dissect_attr_country_code(proto_tree* attr_tree, tvbuff_t* tvb, int offset)
1393
0
{
1394
0
    unsigned sub_offset = offset + 3;
1395
0
    proto_tree_add_item(attr_tree, hf_nan_attr_country_code, tvb, sub_offset, 2, ENC_ASCII);
1396
0
}
1397
1398
static void
1399
dissect_attr_ranging(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1400
0
{
1401
0
    if (attr_len < NAN_RANGING_MIN_LENGTH)
1402
0
    {
1403
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1404
0
        return;
1405
0
    }
1406
1407
0
    unsigned sub_offset = offset + 3;
1408
0
    proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
1409
0
    sub_offset += 6;
1410
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1411
0
        ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1412
0
    sub_offset++;
1413
0
    proto_tree_add_item(attr_tree, hf_nan_attr_ranging_protocol, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1414
0
    sub_offset++;
1415
0
    proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, -1, ENC_NA);
1416
0
}
1417
1418
static void
1419
dissect_attr_cluter_discovery(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1420
0
{
1421
0
    if (attr_len != NAN_CLUSTER_DISC_LENGTH)
1422
0
    {
1423
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1424
0
        return;
1425
0
    }
1426
1427
0
    unsigned sub_offset = offset + 3;
1428
0
    proto_tree_add_item(attr_tree, hf_nan_attr_cluster_disc_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN);
1429
0
    sub_offset += 6;
1430
0
    proto_tree_add_item(attr_tree, hf_nan_attr_cluster_disc_time_offset, tvb, sub_offset, 8, ENC_LITTLE_ENDIAN);
1431
0
    sub_offset += 8;
1432
0
    proto_tree_add_item(attr_tree, hf_nan_attr_cluster_disc_anchor_master_rank, tvb, sub_offset, 8, ENC_LITTLE_ENDIAN);
1433
0
}
1434
1435
static void
1436
dissect_attr_device_capability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1437
0
{
1438
0
    if (attr_len != NAN_DEVICE_CAP_LENGTH)
1439
0
    {
1440
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1441
0
        return;
1442
0
    }
1443
1444
0
    static int* const device_cap_map_id_fields[] = {
1445
0
        &hf_nan_attr_device_cap_map_id_apply_to,
1446
0
        &hf_nan_attr_device_cap_map_id_associated_maps,
1447
0
        NULL
1448
0
    };
1449
0
    static int* const device_cap_committed_dw_fields[] = {
1450
0
        &hf_nan_attr_device_cap_committed_dw_24ghz,
1451
0
        &hf_nan_attr_device_cap_committed_dw_5ghz,
1452
0
        &hf_nan_attr_device_cap_committed_dw_24ghz_overwrite,
1453
0
        &hf_nan_attr_device_cap_committed_dw_5ghz_overwrite,
1454
0
        NULL
1455
0
    };
1456
0
    static int* const device_cap_supported_bands_fields[] = {
1457
0
        &hf_nan_attr_device_cap_supported_bands_reserved_tv_whitespaces,
1458
0
        &hf_nan_attr_device_cap_supported_bands_sub_1ghz,
1459
0
        &hf_nan_attr_device_cap_supported_bands_24ghz,
1460
0
        &hf_nan_attr_device_cap_supported_bands_reserved_36ghz,
1461
0
        &hf_nan_attr_device_cap_supported_bands_5ghz,
1462
0
        &hf_nan_attr_device_cap_supported_bands_reserved_60ghz,
1463
0
        &hf_nan_attr_device_cap_supported_bands_reserved_45ghz,
1464
0
        &hf_nan_attr_device_cap_supported_bands_6ghz,
1465
0
        NULL
1466
0
    };
1467
0
    static int* const device_cap_op_mode_fields[] = {
1468
0
        &hf_nan_attr_device_cap_op_mode_phy_vht,
1469
0
        &hf_nan_attr_device_cap_op_mode_phy_he_vht8080,
1470
0
        &hf_nan_attr_device_cap_op_mode_phy_he_vht160,
1471
0
        &hf_nan_attr_device_cap_op_mode_reserved_paging_ndl,
1472
0
        &hf_nan_attr_device_cap_op_mode_phy_he,
1473
0
        NULL
1474
0
    };
1475
0
    static int* const device_cap_antennas_fields[] = {
1476
0
        &hf_nan_attr_device_cap_antennas_tx,
1477
0
        &hf_nan_attr_device_cap_antennas_rx,
1478
0
        NULL
1479
0
    };
1480
0
    static int* const device_cap_capabilities_fields[] = {
1481
0
        &hf_nan_attr_device_cap_capabilities_dfs_master,
1482
0
        &hf_nan_attr_device_cap_capabilities_extended_key_id,
1483
0
        &hf_nan_attr_device_cap_capabilities_simul_ndp_reception,
1484
0
        &hf_nan_attr_device_cap_capabilities_ndpe_attr_support,
1485
0
        &hf_nan_attr_device_cap_capabilities_s3_capable,
1486
0
        NULL
1487
0
    };
1488
1489
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 3, hf_nan_map_id,
1490
0
        ett_device_cap_map_id, device_cap_map_id_fields, ENC_LITTLE_ENDIAN);
1491
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 4, hf_nan_attr_device_cap_committed_dw,
1492
0
        ett_device_cap_committed_dw, device_cap_committed_dw_fields, ENC_LITTLE_ENDIAN);
1493
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 6, hf_nan_attr_device_cap_supported_bands,
1494
0
        ett_device_cap_supported_bands, device_cap_supported_bands_fields, ENC_LITTLE_ENDIAN);
1495
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 7, hf_nan_attr_device_cap_op_mode,
1496
0
        ett_device_cap_op_mode, device_cap_op_mode_fields, ENC_LITTLE_ENDIAN);
1497
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 8, hf_nan_attr_device_cap_antennas,
1498
0
        ett_device_cap_antennas, device_cap_antennas_fields, ENC_LITTLE_ENDIAN);
1499
0
    proto_tree_add_item(attr_tree, hf_nan_attr_device_cap_max_channel_switch_time, tvb,
1500
0
        offset + 9, 2, ENC_LITTLE_ENDIAN);
1501
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 11, hf_nan_attr_device_cap_capabilities,
1502
0
        ett_device_cap_capabilities, device_cap_capabilities_fields, ENC_LITTLE_ENDIAN);
1503
0
}
1504
1505
static void
1506
dissect_attr_ndp(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1507
0
{
1508
0
    if (attr_len < NAN_NDP_MIN_LENGTH)
1509
0
    {
1510
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1511
0
        return;
1512
0
    }
1513
1514
0
    unsigned sub_offset = offset + 3;
1515
0
    proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1516
0
    sub_offset++;
1517
1518
0
    static int* const ndp_type_status_fields[] = {
1519
0
        &hf_nan_attr_ndp_type,
1520
0
        &hf_nan_status_1,
1521
0
        NULL
1522
0
    };
1523
0
    static int* const ndp_control_fields[] = {
1524
0
        &hf_nan_attr_ndp_ctrl_confirm,
1525
0
        &hf_nan_attr_ndp_ctrl_security_pres,
1526
0
        &hf_nan_attr_ndp_ctrl_publish_id_pres,
1527
0
        &hf_nan_attr_ndp_ctrl_responder_ndi_pres,
1528
0
        &hf_nan_attr_ndp_ctrl_sepcific_info_pres,
1529
0
        NULL
1530
0
    };
1531
1532
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_type_status,
1533
0
        ett_type_status, ndp_type_status_fields, ENC_LITTLE_ENDIAN);
1534
1535
0
    uint8_t bits_type = tvb_get_bits8(tvb, sub_offset * 8 + 4, 4);
1536
0
    uint8_t bit_offset = (sub_offset * 8) + 4;
1537
0
    uint8_t bits_status = tvb_get_bits8(tvb, bit_offset, 4);
1538
0
    sub_offset++;
1539
0
    proto_tree_add_item(attr_tree, hf_nan_reason_code, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1540
0
    sub_offset++;
1541
0
    proto_tree_add_item(attr_tree, hf_nan_attr_ndp_initiator, tvb, sub_offset, 6, ENC_NA);
1542
0
    sub_offset += 6;
1543
0
    proto_tree_add_item(attr_tree, hf_nan_attr_ndp_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1544
0
    sub_offset++;
1545
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ndp_control,
1546
0
        ett_ndp_control, ndp_control_fields, ENC_LITTLE_ENDIAN);
1547
1548
0
    uint8_t bits_ndp_info = tvb_get_bits8(tvb, (sub_offset * 8) + 2, 1);
1549
0
    uint8_t bits_publish_id = tvb_get_bits8(tvb, (sub_offset * 8) + 4, 1);
1550
0
    sub_offset++;
1551
1552
0
    if (bits_publish_id == 1 && bits_type == 0)
1553
0
    {
1554
0
        proto_tree_add_item(attr_tree, hf_nan_publish_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1555
0
        sub_offset++;
1556
0
    }
1557
0
    if (bits_type == 1 && (bits_status == 0 || bits_status == 1))
1558
0
    {
1559
0
        proto_tree_add_item(attr_tree, hf_nan_attr_ndp_responder_ndi, tvb, sub_offset, 6, ENC_NA);
1560
0
        sub_offset += 6;
1561
0
    }
1562
0
    if (bits_ndp_info)
1563
0
    {
1564
0
        proto_tree_add_item(attr_tree, hf_nan_attr_ndp_specific_info, tvb, sub_offset, -1, ENC_NA);
1565
0
    }
1566
0
}
1567
1568
static void
1569
dissect_attr_ndpe(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1570
0
{
1571
0
    if (attr_len < NAN_NDPE_MIN_LENGTH)
1572
0
    {
1573
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1574
0
        return;
1575
0
    }
1576
1577
0
    static int* const ndp_type_status_fields[] = {
1578
0
        &hf_nan_attr_ndp_type,
1579
0
        &hf_nan_status_1,
1580
0
        NULL
1581
0
    };
1582
0
    static int* const ndpe_control_fields[] = {
1583
0
        &hf_nan_attr_ndpe_ctrl_confirm,
1584
0
        &hf_nan_attr_ndpe_ctrl_security_pres,
1585
0
        &hf_nan_attr_ndpe_ctrl_publish_id_pres,
1586
0
        &hf_nan_attr_ndpe_ctrl_responder_ndi_pres,
1587
0
        &hf_nan_attr_ndpe_ctrl_gtk_requried,
1588
0
        NULL
1589
0
    };
1590
1591
0
    int dissected_len = 0;
1592
0
    proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
1593
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 4, hf_nan_type_status,
1594
0
        ett_type_status, ndp_type_status_fields, ENC_LITTLE_ENDIAN);
1595
1596
0
    offset += 4;
1597
0
    dissected_len += 4;
1598
0
    uint8_t bits_type = tvb_get_bits8(tvb, offset * 8 + 4, 4);
1599
0
    uint32_t bit_offset = (offset * 8) + 4;
1600
0
    uint8_t bits_status = tvb_get_bits8(tvb, bit_offset, 4);
1601
1602
0
    proto_tree_add_item(attr_tree, hf_nan_reason_code, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
1603
0
    proto_tree_add_item(attr_tree, hf_nan_attr_ndp_initiator, tvb, offset + 2, 6, ENC_NA);
1604
0
    proto_tree_add_item(attr_tree, hf_nan_attr_ndp_id, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
1605
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 9, hf_nan_attr_ndpe_control,
1606
0
        ett_ndp_control, ndpe_control_fields, ENC_LITTLE_ENDIAN);
1607
0
    offset += 9;
1608
0
    dissected_len += 9;
1609
1610
0
    uint8_t bits_publish_id = tvb_get_bits8(tvb, (offset * 8) + 4, 1);
1611
0
    offset++;
1612
0
    dissected_len++;
1613
1614
0
    if (bits_publish_id == 1 && bits_type == 0)
1615
0
    {
1616
0
        proto_tree_add_item(attr_tree, hf_nan_publish_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1617
0
        offset++;
1618
0
        dissected_len++;
1619
0
    }
1620
0
    if (bits_type == 1 && (bits_status == 0 || bits_status == 1))
1621
0
    {
1622
0
        proto_tree_add_item(attr_tree, hf_nan_attr_ndp_responder_ndi, tvb, offset, 6, ENC_NA);
1623
0
        offset += 6;
1624
0
        dissected_len += 6;
1625
0
    }
1626
1627
0
    while (dissected_len < attr_len)
1628
0
    {
1629
0
        uint8_t tlv_type = tvb_get_uint8(tvb, offset);
1630
0
        uint16_t tlv_len = tvb_get_letohs(tvb, offset + 1);
1631
0
        proto_tree* tlv_tree = proto_tree_add_subtree(attr_tree, tvb, offset, tlv_len + 3,
1632
0
            ett_ndpe_tlv, NULL, "TLV entry");
1633
0
        proto_tree_add_item(tlv_tree, hf_nan_attr_ndpe_tlv_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1634
0
        proto_tree_add_item(tlv_tree, hf_nan_attr_ndpe_tlv_len, tvb, offset + 1, 2, ENC_LITTLE_ENDIAN);
1635
1636
0
        switch (tlv_type)
1637
0
        {
1638
0
        case 0:
1639
0
            proto_tree_add_item(tlv_tree, hf_nan_attr_ndpe_tlv_ipv6_interface_identifier, tvb, offset + 3, 8, ENC_NA);
1640
0
            offset += 11;
1641
0
            dissected_len += 11;
1642
0
            break;
1643
0
        case 1:
1644
0
            proto_tree_add_item(tlv_tree, hf_nan_oui, tvb, offset + 3, 3, ENC_NA);
1645
0
            proto_tree_add_item(tlv_tree, hf_nan_attr_vendor_specific_body, tvb, offset + 6, tlv_len - 3, ENC_NA);
1646
0
            offset += tlv_len + 3;
1647
0
            dissected_len += tlv_len + 3;
1648
0
            break;
1649
0
        default:
1650
0
            proto_tree_add_item(tlv_tree, hf_nan_attr_vendor_specific_body, tvb, offset + 3, tlv_len, ENC_NA);
1651
0
            offset += tlv_len + 3;
1652
0
            dissected_len += tlv_len + 3;
1653
0
            break;
1654
0
        }
1655
0
    }
1656
0
}
1657
1658
static void
1659
dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1660
0
{
1661
0
    if (attr_len < NAN_AVAILABILITY_MIN_LENGTH)
1662
0
    {
1663
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1664
0
        return;
1665
0
    }
1666
1667
0
    static int* const availability_ctr_fields[] = {
1668
0
        &hf_nan_attr_availability_map_id,
1669
0
        &hf_nan_attr_availability_committed_changed,
1670
0
        &hf_nan_attr_availability_potential_changed,
1671
0
        &hf_nan_attr_availability_public_availability_changed,
1672
0
        &hf_nan_attr_availability_ndc_changed,
1673
0
        &hf_nan_attr_availability_reserved_multicast_schedule_changed,
1674
0
        &hf_nan_attr_availability_reserved_multicast_schedule_change_changed,
1675
0
        NULL
1676
0
    };
1677
0
    static int* const availability_entry_ctr_fields[] = {
1678
0
        &hf_nan_attr_availability_entry_ctr_type,
1679
0
        &hf_nan_attr_availability_entry_ctr_pref,
1680
0
        &hf_nan_attr_availability_entry_ctr_utilization,
1681
0
        &hf_nan_attr_availability_entry_ctr_rx_nss,
1682
0
        &hf_nan_attr_availability_entry_ctr_time_bitmap,
1683
0
        NULL
1684
0
    };
1685
1686
0
    proto_tree_add_item(attr_tree, hf_nan_attr_availability_sequence_id, tvb,
1687
0
        offset + 3, 1, ENC_LITTLE_ENDIAN);
1688
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 4, hf_nan_attr_availability_ctr,
1689
0
        ett_device_cap_capabilities, availability_ctr_fields, ENC_LITTLE_ENDIAN);
1690
0
    offset += 6;
1691
1692
0
    int dissected_len = 3;
1693
0
    while (dissected_len < attr_len)
1694
0
    {
1695
0
        uint16_t entry_len = tvb_get_letohs(tvb, offset);
1696
0
        uint8_t entry_type = tvb_get_bits8(tvb, offset * 8 + 21, 3);
1697
0
        uint8_t hdr_len = 2;
1698
0
        uint32_t time_bitmap_len = 0;
1699
0
        uint64_t avail_entry;
1700
0
        const char* entry_type_msg = val_to_str(entry_type, availability_entry_type,
1701
0
            "Unknown type (%u)");
1702
0
        char* info_msg = wmem_strconcat(pinfo->pool, "Availability Type : ", entry_type_msg, NULL);
1703
0
        proto_tree* entry_tree = proto_tree_add_subtree(attr_tree, tvb, offset, entry_len + 2,
1704
0
            ett_availability_entry, NULL, info_msg);
1705
0
        proto_tree_add_item(entry_tree, hf_nan_attr_availability_entry_len, tvb,
1706
0
            offset, 2, ENC_LITTLE_ENDIAN);
1707
0
        proto_tree_add_bitmask_ret_uint64(entry_tree, tvb, offset + 2, hf_nan_attr_availability_entry_ctr,
1708
0
            ett_availability_entry_ctr, availability_entry_ctr_fields, ENC_LITTLE_ENDIAN, &avail_entry);
1709
0
        offset += 4;
1710
1711
0
        bool time_bitmap_present = avail_entry & (1 << 12);
1712
0
        if (time_bitmap_present)
1713
0
        {
1714
0
            proto_tree_add_bitmask(entry_tree, tvb, offset,
1715
0
                hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl,
1716
0
                time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
1717
0
            proto_tree_add_item_ret_uint(entry_tree, hf_nan_time_bitmap_len, tvb,
1718
0
                offset + 2, 1, ENC_LITTLE_ENDIAN, &time_bitmap_len);
1719
0
            proto_tree_add_item(entry_tree, hf_nan_time_bitmap, tvb,
1720
0
                offset + 3, time_bitmap_len, ENC_NA);
1721
0
            hdr_len = 5;
1722
0
            offset += 3 + time_bitmap_len;
1723
0
        }
1724
1725
0
        int entries_len = entry_len - hdr_len - time_bitmap_len;
1726
0
        proto_tree* entries_tree = proto_tree_add_subtree(entry_tree, tvb, offset, entries_len,
1727
0
            ett_availability_entry_entries, NULL, "Band/Channel Entries");
1728
1729
0
        uint64_t entries_type, non_contiguous_bw, num_entries;
1730
0
        proto_tree_add_bits_ret_val(entries_tree, hf_nan_attr_availability_entry_entries_type, tvb,
1731
0
            offset * 8, 1, &entries_type, ENC_LITTLE_ENDIAN);
1732
0
        proto_tree_add_bits_ret_val(entries_tree,
1733
0
            hf_nan_attr_availability_entry_entries_non_contiguous_bw, tvb, offset * 8 + 1, 1,
1734
0
            &non_contiguous_bw, ENC_LITTLE_ENDIAN);
1735
0
        proto_tree_add_bits_ret_val(entries_tree, hf_nan_attr_availability_entry_entries_num_entries,
1736
0
            tvb, offset * 8 + 4, 4, &num_entries, ENC_LITTLE_ENDIAN);
1737
1738
0
        offset += 1;
1739
0
        for (uint64_t i = 0; i < num_entries; i++)
1740
0
        {
1741
0
            switch (entries_type) {
1742
0
            case 0:
1743
0
            {
1744
0
                proto_tree_add_item(entries_tree, hf_nan_attr_availability_entry_entries_band, tvb,
1745
0
                    offset, 1, ENC_LITTLE_ENDIAN);
1746
0
                offset += 1;
1747
0
                break;
1748
0
            }
1749
0
            case 1:
1750
0
            {
1751
0
                int channel_entry_len = (non_contiguous_bw == 0) ? 4 : 6;
1752
0
                proto_tree* channel_tree = proto_tree_add_subtree(entries_tree, tvb, offset,
1753
0
                    channel_entry_len, ett_availability_entry_entries_channel, NULL, "Channel Entry");
1754
0
                uint8_t op_class = tvb_get_uint8(tvb, offset);
1755
0
                uint16_t bitmap = tvb_get_uint16(tvb, offset + 1, ENC_LITTLE_ENDIAN);
1756
0
                proto_tree* op_class_tree = proto_tree_add_subtree(channel_tree, tvb, offset, 1, ett_availability_op_class, NULL, "Operating Class");
1757
0
                proto_tree_add_item(op_class_tree, hf_nan_attr_availability_entry_entries_start_freq, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1758
0
                proto_tree_add_item(op_class_tree, hf_nan_attr_availability_entry_entries_bandwidth, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1759
0
                wmem_strbuf_t* str;
1760
0
                str = wmem_strbuf_new(pinfo->pool, "");
1761
0
                if (op_class < 131)
1762
0
                {
1763
0
                    for(unsigned i_bitmap = 0; i_bitmap < 16; ++i_bitmap)
1764
0
                    {
1765
0
                        if (bitmap & (1u << i_bitmap))
1766
0
                        {
1767
1768
0
                            const int *channel_set = rval_to_channel_set(op_class, op_class_channel);
1769
0
                            if (channel_set == NULL)
1770
0
                            {
1771
0
                                expert_add_info(pinfo, channel_tree, &ei_nan_unknown_op_class);
1772
0
                                break;
1773
0
                            }
1774
0
                            int channel = channel_set[i_bitmap];
1775
1776
0
                            switch (channel)
1777
0
                            {
1778
                            // TODO: replace these magic numbers (or use 802.11 dissector for this)
1779
0
                            case -3:
1780
0
                                wmem_strbuf_append_printf(str, "%s", "Derived from regulation ");
1781
0
                                break;
1782
0
                            case -2:
1783
0
                                wmem_strbuf_append_printf(str, "%s", "Vendor Specific ");
1784
0
                                break;
1785
0
                            case -1:
1786
0
                                wmem_strbuf_append_printf(str, "%s", "Reserved ");
1787
0
                                break;
1788
0
                            default:
1789
0
                                wmem_strbuf_append_printf(str, "%d ", channel);
1790
0
                            }
1791
0
                        }
1792
0
                    }
1793
1794
0
                    proto_tree_add_string(channel_tree, hf_nan_attr_availability_entry_entries_channel_set, tvb, offset + 1, 2, wmem_strbuf_finalize(str));
1795
0
                }
1796
0
                else
1797
0
                {
1798
                    /* This is the new and standard rules for mapping channels for 6G channels introduced in NAN R4.
1799
                     * Some vendors may have already implemetned a different approach to support NAN 6G before
1800
                     * the introduction of standard 6G NAN operation. And hence, in this case, the availability
1801
                     * may not be correct. */
1802
0
                    uint8_t start_ch_number = bitmap & 0xff;
1803
0
                    uint8_t number_of_chs = (bitmap & 0xff00) >> 8;
1804
1805
0
                    const int *channel_set_higher_op_class = rval_to_channel_set(op_class, op_class_channel);
1806
0
                    if (channel_set_higher_op_class)
1807
0
                    {
1808
0
                        unsigned int start_ch_number_idx = channel_number_valid(start_ch_number, channel_set_higher_op_class);
1809
0
                        if (start_ch_number_idx == PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN)
1810
0
                        {
1811
                            /* The given channel number does not belong to this operating class */
1812
0
                            expert_add_info(pinfo, channel_tree, &ei_nan_invalid_channel_num_for_op_class);
1813
0
                        }
1814
1815
0
                        if (!number_of_chs || number_of_chs > PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN)
1816
0
                        {
1817
                            /* Number of channel should at least be one and should not exceed the maximum */
1818
0
                            expert_add_info(pinfo, channel_tree, &ei_nan_invalid_channel_count);
1819
0
                        }
1820
1821
0
                        uint8_t number_of_chs_max =
1822
0
                            (number_of_chs + start_ch_number_idx < PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN) ?
1823
0
                            (number_of_chs + start_ch_number_idx) : PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN;
1824
0
                        for (uint8_t num_ch = start_ch_number_idx; num_ch < number_of_chs_max; num_ch++)
1825
0
                        {
1826
0
                            wmem_strbuf_append_printf(str, "%d ", channel_set_higher_op_class[num_ch]);
1827
0
                        }
1828
0
                    }
1829
0
                    else
1830
0
                    {
1831
0
                        expert_add_info(pinfo, channel_tree, &ei_nan_unknown_op_class);
1832
0
                    }
1833
0
                    proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_start_channel_number, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
1834
0
                    proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_number_of_ch_included, tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
1835
1836
0
                    proto_tree_add_string(channel_tree, hf_nan_attr_availability_entry_entries_channel_set, tvb, offset + 1, 2, wmem_strbuf_finalize(str));
1837
0
                }
1838
0
                proto_tree_add_item(channel_tree,
1839
0
                    hf_nan_attr_availability_entry_entries_primary_channel_bitmap, tvb,
1840
0
                    offset + 3, 1, ENC_LITTLE_ENDIAN);
1841
1842
0
                if (non_contiguous_bw == 1)
1843
0
                {
1844
0
                    proto_tree_add_item(channel_tree,
1845
0
                        hf_nan_attr_availability_entry_entries_aux_channel_bitmap, tvb,
1846
0
                        offset + 4, 2, ENC_LITTLE_ENDIAN);
1847
0
                }
1848
0
                offset += channel_entry_len;
1849
0
                break;
1850
0
            }
1851
0
            }
1852
0
        }
1853
0
        dissected_len += entry_len + 2;
1854
0
    }
1855
0
}
1856
1857
static void
1858
dissect_attr_ndc(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1859
0
{
1860
0
    if (attr_len < NAN_NDC_MIN_LENGTH)
1861
0
    {
1862
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1863
0
        return;
1864
0
    }
1865
1866
0
    static int* const ndc_ctr_fields[] = {
1867
0
        &hf_nan_attr_ndc_ctrl_selected,
1868
0
        NULL
1869
0
    };
1870
1871
0
    static int* const ndc_map_id_fields[] = {
1872
0
        &hf_nan_attr_ndc_map_id_related_sch,
1873
0
        NULL
1874
0
    };
1875
1876
0
    proto_tree_add_item(attr_tree, hf_nan_attr_ndc_id, tvb, offset + 3, 6, ENC_NA);
1877
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 9, hf_nan_attr_ndc_ctrl,
1878
0
        ett_ndc_ctr, ndc_ctr_fields, ENC_LITTLE_ENDIAN);
1879
1880
0
    offset += 10;
1881
0
    int dissected_len = 7;
1882
0
    while (dissected_len < attr_len)
1883
0
    {
1884
0
        uint8_t time_bitmap_len = tvb_get_uint8(tvb, offset + 3);
1885
0
        proto_tree* entry_tree = proto_tree_add_subtree(attr_tree, tvb, offset,
1886
0
            time_bitmap_len + 4, ett_ndc_entries, NULL, "Schedule Entry");
1887
0
        proto_tree_add_bitmask(entry_tree, tvb, offset, hf_nan_map_id,
1888
0
            ett_device_ndc_map_id, ndc_map_id_fields, ENC_LITTLE_ENDIAN);
1889
0
        proto_tree_add_bitmask(entry_tree, tvb, offset + 1,
1890
0
            hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl,
1891
0
            time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
1892
0
        proto_tree_add_item(entry_tree, hf_nan_time_bitmap_len, tvb,
1893
0
            offset + 3, 1, ENC_BIG_ENDIAN);
1894
0
        proto_tree_add_item(entry_tree, hf_nan_time_bitmap, tvb,
1895
0
            offset + 4, time_bitmap_len, ENC_NA);
1896
1897
0
        offset += time_bitmap_len + 4;
1898
0
        dissected_len += time_bitmap_len + 4;
1899
0
    }
1900
0
}
1901
1902
static void
1903
dissect_attr_ndl(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1904
0
{
1905
0
    if (attr_len < NAN_NDL_MIN_LENGTH)
1906
0
    {
1907
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1908
0
        return;
1909
0
    }
1910
1911
0
    unsigned sub_offset = offset + 3;
1912
0
    unsigned dissected_len = 0;
1913
0
    proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1914
0
    sub_offset++;
1915
1916
0
    static int* const ndl_type_status_fields[] = {
1917
0
        &hf_nan_attr_ndl_type,
1918
0
        &hf_nan_status_1,
1919
0
        NULL
1920
0
    };
1921
0
    static int* const ndl_control_fields[] = {
1922
0
        &hf_nan_attr_ndl_ctrl_peer_id,
1923
0
        &hf_nan_attr_ndl_ctrl_immutable_schedule_pres,
1924
0
        &hf_nan_attr_ndl_ctrl_ndc_pres,
1925
0
        &hf_nan_attr_ndl_ctrl_qos,
1926
0
        &hf_nan_attr_ndl_ctrl_max_idle_pres,
1927
0
        &hf_nan_attr_ndl_ctrl_type,
1928
0
        &hf_nan_attr_ndl_ctrl_setup_reason,
1929
0
        NULL
1930
0
    };
1931
1932
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_type_status,
1933
0
        ett_type_status, ndl_type_status_fields, ENC_LITTLE_ENDIAN);
1934
0
    sub_offset++;
1935
0
    proto_tree_add_item(attr_tree, hf_nan_reason_code, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1936
0
    sub_offset++;
1937
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ndl_control,
1938
0
        ett_ndl_control, ndl_control_fields, ENC_LITTLE_ENDIAN);
1939
1940
0
    uint8_t peer_id_pres = tvb_get_bits8(tvb, sub_offset * 8 + 7, 1);
1941
0
    uint8_t immutable_sched_pres = tvb_get_bits8(tvb, sub_offset * 8 + 6, 1);
1942
0
    uint8_t idle_per = tvb_get_bits8(tvb, sub_offset * 8 + 3, 1);
1943
0
    sub_offset++;
1944
0
    dissected_len += 4;
1945
1946
0
    if (peer_id_pres)
1947
0
    {
1948
0
        proto_tree_add_item(attr_tree, hf_nan_attr_ndl_reserved_peer_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1949
0
        sub_offset++;
1950
0
        dissected_len++;
1951
0
    }
1952
0
    if (idle_per)
1953
0
    {
1954
0
        proto_tree_add_item(attr_tree, hf_nan_attr_ndl_max_idle, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
1955
0
        sub_offset += 2;
1956
0
        dissected_len += 2;
1957
0
    }
1958
0
    if (immutable_sched_pres)
1959
0
    {
1960
0
        char* info_msg = "Immutable Schedule entry list";
1961
0
        proto_tree* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, attr_len - dissected_len,
1962
0
            ett_ndl_schedule_entries, NULL, info_msg);
1963
0
        while (dissected_len < attr_len)
1964
0
        {
1965
0
            proto_tree_add_item(sub_attr_tree, hf_nan_map_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1966
0
            sub_offset++;
1967
0
            proto_tree_add_bitmask(sub_attr_tree, tvb, sub_offset, hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl,
1968
0
                time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
1969
0
            sub_offset += 2;
1970
0
            unsigned field_length = tvb_get_uint8(tvb, sub_offset);
1971
0
            proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1972
0
            sub_offset++;
1973
0
            proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap, tvb, sub_offset, field_length, ENC_NA);
1974
0
            sub_offset += field_length;
1975
0
            dissected_len += field_length + 4;
1976
0
        }
1977
0
    }
1978
0
}
1979
1980
static void
1981
dissect_attr_ndl_qos(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1982
0
{
1983
0
    if (attr_len != NAN_NDL_QOS_LENGTH)
1984
0
    {
1985
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1986
0
        return;
1987
0
    }
1988
1989
0
    unsigned sub_offset = offset + 3;
1990
0
    proto_tree_add_item(attr_tree, hf_nan_attr_ndlqos_min_time_slots, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1991
0
    sub_offset++;
1992
0
    proto_tree_add_item(attr_tree, hf_nan_attr_ndlqos_max_latency, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
1993
0
}
1994
1995
static void
1996
dissect_attr_unaligned_schedule(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1997
0
{
1998
0
    if (attr_len < NAN_UNALIGNED_SCH_MIN_LENGTH)
1999
0
    {
2000
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2001
0
        return;
2002
0
    }
2003
2004
0
    unsigned sub_offset = offset + 3;
2005
0
    unsigned dissected_len = 0;
2006
0
    static int* const control_fields[] = {
2007
0
        &hf_nan_attr_unaligned_sch_ctrl_schedule_id,
2008
0
        &hf_nan_attr_unaligned_sch_ctrl_seq_id,
2009
0
        NULL
2010
0
    };
2011
2012
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_unaligned_sch_ctrl,
2013
0
        ett_unaligned_sch_ctrl, control_fields, ENC_LITTLE_ENDIAN);
2014
0
    sub_offset += 2;
2015
0
    proto_tree_add_item(attr_tree, hf_nan_attr_unaligned_sch_starting_time, tvb, sub_offset, 4, ENC_LITTLE_ENDIAN);
2016
0
    sub_offset += 4;
2017
0
    proto_tree_add_item(attr_tree, hf_nan_attr_unaligned_sch_duration, tvb, sub_offset, 4, ENC_LITTLE_ENDIAN);
2018
0
    sub_offset += 4;
2019
0
    proto_tree_add_item(attr_tree, hf_nan_attr_unaligned_sch_period, tvb, sub_offset, 4, ENC_LITTLE_ENDIAN);
2020
0
    sub_offset += 4;
2021
0
    proto_tree_add_item(attr_tree, hf_nan_attr_unaligned_sch_count_down, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2022
0
    sub_offset++;
2023
2024
0
    static int* const ulw_overwrite_fields[] = {
2025
0
        &hf_nan_attr_unaligned_sch_ulw_overwrite_all,
2026
0
        &hf_nan_attr_unaligned_sch_ulw_overwrite_map_id,
2027
0
        NULL
2028
0
    };
2029
2030
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_unaligned_sch_ulw_overwrite,
2031
0
        ett_unaligned_sch_ulw_overwrite, ulw_overwrite_fields, ENC_LITTLE_ENDIAN);
2032
0
    sub_offset++;
2033
0
    dissected_len += 16;
2034
2035
    // ULW Control and Band ID or Channel Entry present
2036
0
    if (dissected_len < attr_len)
2037
0
    {
2038
0
        static int* const ulw_control_fields[] = {
2039
0
            &hf_nan_attr_unaligned_sch_ulw_ctrl_type,
2040
0
            &hf_nan_attr_unaligned_sch_ulw_ctrl_channel_av,
2041
0
            &hf_nan_attr_unaligned_sch_ulw_ctrl_rxnss,
2042
0
            NULL
2043
0
        };
2044
2045
0
        proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_unaligned_sch_ulw_ctrl,
2046
0
            ett_unaligned_sch_ulw_ctrl, ulw_control_fields, ENC_LITTLE_ENDIAN);
2047
0
        uint8_t entry_type = tvb_get_bits8(tvb, sub_offset * 8 + 6, 2);
2048
0
        sub_offset++;
2049
2050
0
        switch (entry_type)
2051
0
        {
2052
0
        case NAN_UNALIGNED_SCH_BAND_ID_EXIST:
2053
0
            proto_tree_add_item(attr_tree, hf_nan_attr_availability_entry_entries_band,
2054
0
                tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2055
0
            sub_offset++;
2056
0
            break;
2057
0
        case NAN_UNALIGNED_SCH_CHANNEL_ENTRY_EXIST:
2058
0
        {
2059
0
            proto_tree* channel_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2060
0
                ett_availability_entry_entries_channel, NULL, "Channel Entry");
2061
0
            proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_channel_op_class,
2062
0
                tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2063
0
            sub_offset++;
2064
0
            proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_channel_bitmap,
2065
0
                tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2066
0
            sub_offset += 2;
2067
0
            proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_primary_channel_bitmap,
2068
0
                tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2069
0
            break;
2070
0
        }
2071
0
        case NAN_UNALIGNED_SCH_CHANNEL_ENTRY_W_AUX_EXIST:
2072
0
        {
2073
0
            proto_tree* channel_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2074
0
                ett_availability_entry_entries_channel, NULL, "Channel Entry");
2075
0
            proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_channel_op_class,
2076
0
                tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2077
0
            sub_offset++;
2078
0
            proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_channel_bitmap,
2079
0
                tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2080
0
            sub_offset += 2;
2081
0
            proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_primary_channel_bitmap,
2082
0
                tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2083
0
            sub_offset++;
2084
0
            proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_aux_channel_bitmap,
2085
0
                tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2086
0
            break;
2087
0
        }
2088
0
        }
2089
0
    }
2090
0
}
2091
2092
static void
2093
dissect_attr_ranging_info(proto_tree* attr_tree, tvbuff_t* tvb, int offset)
2094
0
{
2095
0
    unsigned sub_offset = offset + 3;
2096
0
    static int* const location_info_availability_fields[] = {
2097
0
        &hf_nan_attr_ranging_info_location_info_avail_lci,
2098
0
        &hf_nan_attr_ranging_info_location_info_avail_geospatial,
2099
0
        &hf_nan_attr_ranging_info_location_info_avail_civic_location,
2100
0
        &hf_nan_attr_ranging_info_location_info_avail_last_movement_pres,
2101
0
        NULL
2102
0
    };
2103
2104
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ranging_info_location_info_avail,
2105
0
        ett_ranging_info_location_info_availability, location_info_availability_fields, ENC_LITTLE_ENDIAN);
2106
0
    bool loc_exists = tvb_get_bits8(tvb, sub_offset * 8 + 4, 1);
2107
0
    sub_offset++;
2108
0
    if (loc_exists)
2109
0
    {
2110
0
        proto_tree_add_item(attr_tree, hf_nan_attr_ranging_info_last_movement_indication, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2111
0
    }
2112
0
}
2113
2114
static void
2115
dissect_attr_ranging_setup(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2116
0
{
2117
0
    if (attr_len < NAN_RANGING_SETUP_MIN_LENGTH)
2118
0
    {
2119
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2120
0
        return;
2121
0
    }
2122
2123
0
    unsigned sub_offset = offset + 3;
2124
0
    unsigned dissected_len = 0;
2125
0
    proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2126
0
    sub_offset++;
2127
2128
0
    static int* const ranging_setup_type_status_fields[] = {
2129
0
        &hf_nan_attr_ranging_setup_type,
2130
0
        &hf_nan_status_2,
2131
0
        NULL
2132
0
    };
2133
0
    static int* const ranging_setup_ctrl_fields[] = {
2134
0
        &hf_nan_attr_ranging_setup_ctrl_report_req,
2135
0
        &hf_nan_attr_ranging_setup_ctrl_ftm_params,
2136
0
        &hf_nan_attr_ranging_setup_ctrl_entry_list,
2137
0
        NULL
2138
0
    };
2139
2140
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_type_status,
2141
0
        ett_type_status, ranging_setup_type_status_fields, ENC_LITTLE_ENDIAN);
2142
0
    sub_offset++;
2143
0
    proto_tree_add_item(attr_tree, hf_nan_reason_code, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2144
0
    sub_offset++;
2145
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ranging_setup_ctrl,
2146
0
        ett_ranging_setup_ctrl, ranging_setup_ctrl_fields, ENC_LITTLE_ENDIAN);
2147
0
    uint8_t ftm_check = tvb_get_bits8(tvb, sub_offset * 8 + 6, 1);
2148
0
    uint8_t ranging_entry_check = tvb_get_bits8(tvb, sub_offset * 8 + 5, 1);
2149
0
    sub_offset++;
2150
0
    dissected_len += 4;
2151
2152
0
    if (ftm_check)
2153
0
    {
2154
0
        static int* const ranging_setup_ftm_param_fields[] = {
2155
0
            &hf_nan_attr_ranging_setup_ftm_max_burst_duration,
2156
0
            &hf_nan_attr_ranging_setup_ftm_min_delta,
2157
0
            &hf_nan_attr_ranging_setup_ftm_max_per_burst,
2158
0
            &hf_nan_attr_ranging_setup_ftm_format_bw,
2159
0
            NULL
2160
0
        };
2161
2162
0
        proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ranging_setup_ftm_params,
2163
0
            ett_ranging_setup_ftm_params, ranging_setup_ftm_param_fields, ENC_LITTLE_ENDIAN);
2164
0
        sub_offset += 3;
2165
0
        dissected_len += 3;
2166
0
    }
2167
0
    if (ranging_entry_check)
2168
0
    {
2169
0
        char* info_msg = "Ranging Schedule Entry List";
2170
0
        proto_tree* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, attr_len - dissected_len,
2171
0
            ett_ranging_setup_schedule_entries, NULL, info_msg);
2172
2173
0
        while (dissected_len < attr_len)
2174
0
        {
2175
0
            proto_tree_add_item(sub_attr_tree, hf_nan_map_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2176
0
            sub_offset++;
2177
0
            proto_tree_add_bitmask(sub_attr_tree, tvb, sub_offset, hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl,
2178
0
                time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
2179
0
            sub_offset += 2;
2180
0
            unsigned field_length = tvb_get_uint8(tvb, sub_offset);
2181
0
            proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2182
0
            sub_offset++;
2183
0
            proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap, tvb, sub_offset, field_length, ENC_NA);
2184
0
            sub_offset += field_length;
2185
0
            dissected_len += field_length + 4;
2186
0
        }
2187
0
    }
2188
0
}
2189
2190
static void
2191
dissect_attr_ftm_report(proto_tree* attr_tree, tvbuff_t* tvb, int offset)
2192
0
{
2193
0
    unsigned sub_offset = offset + 3;
2194
0
    proto_tree_add_item(attr_tree, hf_nan_attr_ftm_range_report, tvb, sub_offset, -1, ENC_NA);
2195
0
}
2196
2197
static void
2198
dissect_attr_element_container(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2199
0
{
2200
0
    unsigned sub_offset = offset + 3;
2201
2202
    // Some header fields and trees are reused.
2203
0
    static int* const container_map_id_fields[] = {
2204
0
        &hf_nan_attr_device_cap_map_id_apply_to,
2205
0
        &hf_nan_attr_device_cap_map_id_associated_maps,
2206
0
        NULL
2207
0
    };
2208
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_id,
2209
0
        ett_device_cap_map_id, container_map_id_fields, ENC_LITTLE_ENDIAN);
2210
0
    sub_offset += 1;
2211
0
    unsigned dissected_length = 1;
2212
0
    proto_tree* sub_tree;
2213
0
    while (dissected_length < attr_len)
2214
0
    {
2215
0
        unsigned element_id = tvb_get_uint8(tvb, sub_offset);
2216
0
        unsigned element_len = tvb_get_uint8(tvb, sub_offset + 1);
2217
0
        const char* msg = val_to_str(element_id, ie_tag_num_vals, "Unknown element ID (%u)");
2218
2219
0
        sub_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, element_len + 2, ett_ie_tree, NULL, msg);
2220
0
        proto_tree_add_item(sub_tree, hf_nan_attr_container_element_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2221
0
        sub_offset++;
2222
0
        proto_tree_add_item(sub_tree, hf_nan_attr_container_element_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2223
0
        sub_offset++;
2224
2225
0
        ieee80211_tagged_field_data_t field_data = { 0 };
2226
0
        tvbuff_t* ie_tvb = tvb_new_subset_length(tvb, sub_offset, element_len);
2227
0
        field_data.item_tag = sub_tree;
2228
0
        dissector_try_uint_with_data(ie_handle_table, element_id, ie_tvb, pinfo, sub_tree, true, &field_data);
2229
0
        sub_offset += element_len;
2230
0
        dissected_length += element_len + 2;
2231
0
    }
2232
0
}
2233
2234
static void
2235
dissect_attr_extended_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2236
0
{
2237
0
    if (attr_len != NAN_EXTENDED_WLAN_INFRA_LENGTH)
2238
0
    {
2239
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2240
0
        return;
2241
0
    }
2242
2243
0
    unsigned sub_offset = offset + 3;
2244
0
    proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN);
2245
0
    sub_offset += 6;
2246
0
    proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
2247
0
    sub_offset += 6;
2248
0
    proto_tree_add_item(attr_tree, hf_nan_attr_wlan_infra_device_role, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2249
0
    sub_offset += 1;
2250
2251
0
    char* info_msg = "Non-NAN Operating Channel Information";
2252
0
    proto_tree* sub_attr_tree_op = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 3,
2253
0
        ett_non_nan_op_channel, NULL, info_msg);
2254
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_global_op_class, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2255
0
    sub_offset++;
2256
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_channel, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2257
0
    sub_offset++;
2258
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_center_freq, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2259
0
    sub_offset++;
2260
2261
0
    char* info_msg_beacon = "Non-NAN Beacon Information";
2262
0
    proto_tree* sub_attr_tree_beacon = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2263
0
        ett_non_nan_beacon, NULL, info_msg_beacon);
2264
0
    proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_tbtt_offset, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2265
0
    sub_offset += 2;
2266
0
    proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_interval, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2267
    // sub_offset += 2;
2268
0
}
2269
2270
static void
2271
dissect_attr_extended_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2272
0
{
2273
0
    if (attr_len != NAN_EXTENDED_P2P_OP_LENGTH)
2274
0
    {
2275
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2276
0
        return;
2277
0
    }
2278
2279
0
    unsigned sub_offset = offset + 3;
2280
0
    static int* const ext_p2p_bitmap_fields[] = {
2281
0
        &hf_nan_attr_p2p_device_role_device,
2282
0
        &hf_nan_attr_p2p_device_role_group_owner,
2283
0
        &hf_nan_attr_p2p_device_role_client,
2284
0
        NULL
2285
0
    };
2286
2287
0
    proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_p2p_device_role,
2288
0
        ett_p2p_device_role, ext_p2p_bitmap_fields, ENC_LITTLE_ENDIAN);
2289
0
    sub_offset += 1;
2290
0
    proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
2291
0
    sub_offset += 6;
2292
2293
0
    char* info_msg = "Non-NAN Operating Channel Information";
2294
0
    proto_tree* sub_attr_tree_op = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 3,
2295
0
        ett_non_nan_op_channel, NULL, info_msg);
2296
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_global_op_class, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2297
0
    sub_offset++;
2298
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_channel, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2299
0
    sub_offset++;
2300
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_center_freq, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2301
0
    sub_offset++;
2302
2303
0
    char* info_msg_beacon = "Non-NAN Beacon Information";
2304
0
    proto_tree* sub_attr_tree_beacon = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2305
0
        ett_non_nan_beacon, NULL, info_msg_beacon);
2306
0
    proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_tbtt_offset, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2307
0
    sub_offset += 2;
2308
0
    proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_interval, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2309
    // sub_offset += 2;
2310
0
}
2311
2312
static void
2313
dissect_attr_extended_ibss(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2314
0
{
2315
0
    if (attr_len != NAN_EXTENDED_IBSS_LENGTH)
2316
0
    {
2317
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2318
0
        return;
2319
0
    }
2320
2321
0
    unsigned sub_offset = offset + 3;
2322
0
    proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN);
2323
0
    sub_offset += 6;
2324
0
    proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
2325
0
    sub_offset += 6;
2326
2327
0
    char* info_msg = "Non-NAN Operating Channel Information";
2328
0
    proto_tree* sub_attr_tree_op = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 3,
2329
0
        ett_non_nan_op_channel, NULL, info_msg);
2330
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_global_op_class, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2331
0
    sub_offset++;
2332
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_channel, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2333
0
    sub_offset++;
2334
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_center_freq, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2335
0
    sub_offset++;
2336
2337
0
    char* info_msg_beacon = "Non-NAN Beacon Information";
2338
0
    proto_tree* sub_attr_tree_beacon = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2339
0
        ett_non_nan_beacon, NULL, info_msg_beacon);
2340
0
    proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_tbtt_offset, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2341
0
    sub_offset += 2;
2342
0
    proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_interval, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2343
    // sub_offset += 2;
2344
0
}
2345
2346
static void
2347
dissect_attr_extended_mesh(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2348
0
{
2349
0
    if (attr_len < NAN_EXTENDED_MESH_MIN_LENGTH)
2350
0
    {
2351
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2352
0
        return;
2353
0
    }
2354
2355
0
    unsigned sub_offset = offset + 3;
2356
0
    unsigned length = tvb_get_uint16(tvb, sub_offset - 2, ENC_LITTLE_ENDIAN);
2357
0
    proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
2358
0
    sub_offset += 6;
2359
2360
0
    char* info_msg = "Non-NAN Operating Channel Information";
2361
0
    proto_tree* sub_attr_tree_op = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 3,
2362
0
        ett_non_nan_op_channel, NULL, info_msg);
2363
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_global_op_class, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2364
0
    sub_offset++;
2365
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_channel, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2366
0
    sub_offset++;
2367
0
    proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_center_freq, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2368
0
    sub_offset++;
2369
2370
0
    char* info_msg_beacon = "Non-NAN Beacon Information";
2371
0
    proto_tree* sub_attr_tree_beacon = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2372
0
        ett_non_nan_beacon, NULL, info_msg_beacon);
2373
0
    proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_tbtt_offset, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2374
0
    sub_offset += 2;
2375
0
    proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_interval, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2376
0
    sub_offset += 2;
2377
2378
0
    proto_tree_add_item(attr_tree, hf_nan_attr_mesh_id, tvb, sub_offset, length - sub_offset + 3, ENC_NA);
2379
0
}
2380
2381
static void
2382
dissect_attr_cipher_suite_info(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2383
0
{
2384
0
    if (attr_len < NAN_CIPHER_SUITE_INFO_MIN_LENGTH)
2385
0
    {
2386
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2387
0
        return;
2388
0
    }
2389
2390
0
    unsigned sub_offset = offset + 3;
2391
0
    unsigned dissected_len = 0;
2392
2393
0
    proto_tree* caps_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 1, ett_nan_cipher_suite_capabilities, NULL, "Capabilities");
2394
0
    proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_ndtksa_nmtksa_replay_counters, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2395
0
    proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_gtksa_igtksa_bigtksa_support, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2396
0
    proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_gtksa_replay_counters, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2397
0
    proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_igtksa_bigtksa_cipher, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2398
2399
0
    sub_offset++;
2400
0
    dissected_len++;
2401
2402
0
    char* info_msg = "Cipher Suite List";
2403
0
    proto_tree* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, attr_len - dissected_len,
2404
0
        ett_cipher_suite_info_list, NULL, info_msg);
2405
2406
0
    while (dissected_len < attr_len)
2407
0
    {
2408
0
        proto_tree_add_item(sub_attr_tree, hf_nan_attr_cipher_suite_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2409
0
        sub_offset++;
2410
0
        proto_tree_add_item(sub_attr_tree, hf_nan_publish_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2411
0
        sub_offset++;
2412
0
        dissected_len += 2;
2413
0
    }
2414
0
}
2415
2416
static void
2417
dissect_attr_security_context_info(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2418
0
{
2419
0
    if (attr_len < NAN_CIPHER_SUITE_INFO_MIN_LENGTH)
2420
0
    {
2421
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2422
0
        return;
2423
0
    }
2424
2425
0
    unsigned sub_offset = offset + 3;
2426
0
    unsigned dissected_len = 0;
2427
2428
0
    while (dissected_len < attr_len)
2429
0
    {
2430
0
        unsigned field_length = tvb_get_uint16(tvb, sub_offset, ENC_LITTLE_ENDIAN);
2431
0
        proto_item* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, field_length + 4,
2432
0
            ett_attributes, NULL, "Security Context Identifier");
2433
0
        proto_tree_add_item(sub_attr_tree, hf_nan_attr_security_context_identifier_len, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2434
0
        sub_offset += 2;
2435
0
        proto_tree_add_item(sub_attr_tree, hf_nan_attr_security_context_identifier_type, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2436
0
        sub_offset++;
2437
0
        proto_tree_add_item(sub_attr_tree, hf_nan_publish_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2438
0
        sub_offset++;
2439
0
        proto_tree_add_item(sub_attr_tree, hf_nan_attr_security_context_identifier, tvb, sub_offset, field_length, ENC_NA);
2440
0
        sub_offset += field_length;
2441
0
        dissected_len += field_length + 4;
2442
0
    }
2443
0
}
2444
2445
static void
2446
dissect_attr_shared_key_descriptor(proto_tree* attr_tree, tvbuff_t* tvb, int offset)
2447
0
{
2448
0
    unsigned sub_offset = offset + 3;
2449
0
    proto_tree_add_item(attr_tree, hf_nan_publish_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2450
0
    sub_offset += 1;
2451
0
    proto_tree_add_item(attr_tree, hf_nan_attr_shared_key_rsna_descriptor, tvb, sub_offset, -1, ENC_NA);
2452
0
}
2453
2454
static void
2455
dissect_attr_public_availability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2456
0
{
2457
0
    if (attr_len < NAN_PUBLIC_AVAIL_MIN_LENGTH)
2458
0
    {
2459
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2460
0
        return;
2461
0
    }
2462
2463
0
    unsigned sub_offset = offset + 3;
2464
0
    unsigned dissected_len = 0;
2465
2466
0
    proto_tree* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, attr_len,
2467
0
        ett_public_availability_sch_entries, NULL, "Public Availability Schedule Entry List");
2468
0
    while (dissected_len < attr_len)
2469
0
    {
2470
0
        proto_tree_add_item(sub_attr_tree, hf_nan_map_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2471
0
        sub_offset++;
2472
0
        proto_tree_add_bitmask(sub_attr_tree, tvb, sub_offset, hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl,
2473
0
            time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
2474
0
        sub_offset += 2;
2475
0
        unsigned field_length = tvb_get_uint8(tvb, sub_offset);
2476
0
        proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2477
0
        sub_offset++;
2478
0
        proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap, tvb, sub_offset, field_length, ENC_NA);
2479
0
        sub_offset += field_length;
2480
0
        dissected_len += field_length + 4;
2481
0
    }
2482
0
}
2483
2484
static void
2485
dissect_attr_vendor_specific(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2486
0
{
2487
0
    if (attr_len < NAN_VENDOR_SPECIFIC_MIN_LENGTH)
2488
0
    {
2489
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2490
0
        return;
2491
0
    }
2492
2493
0
    unsigned sub_offset = offset + 3;
2494
0
    tvbuff_t* ie_tvb = tvb_new_subset_length(tvb, sub_offset, -1);
2495
0
    ieee80211_tagged_field_data_t field_data = { 0 };
2496
0
    field_data.item_tag = attr_tree;
2497
0
    dissector_try_uint_with_data(ie_handle_table, TAG_VENDOR_SPECIFIC_IE, ie_tvb, pinfo, attr_tree, true, &field_data);
2498
0
}
2499
2500
static void
2501
dissect_attr_device_capability_extension(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2502
0
{
2503
0
    if (attr_len < NAN_DEVICE_CAPABILITY_EXTENSION_MIN_LENGTH)
2504
0
    {
2505
        /* At least has 9 bits defined in NAN-R4 spec  */
2506
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2507
0
        return;
2508
0
    }
2509
2510
0
    static int* const capability_info_fields[] = {
2511
0
        &hf_nan_attr_device_capability_extension_6g_regulatory_info_presented,
2512
0
        &hf_nan_attr_device_capability_extension_6g_regulatory_info,
2513
0
        &hf_nan_attr_device_capability_extension_6g_regulatory_info_reserved,
2514
0
        &hf_nan_attr_device_capability_extension_paring_setup_enabled,
2515
0
        &hf_nan_attr_device_capability_extension_npk_nik_cache_enabled,
2516
0
        NULL
2517
0
    };
2518
2519
0
    proto_tree_add_bitmask(attr_tree, tvb, offset + 3, hf_nan_attr_device_capability_extension,
2520
0
        ett_device_capability_extension, capability_info_fields, ENC_LITTLE_ENDIAN);
2521
0
}
2522
2523
static void
2524
dissect_attr_nan_identity_resolution(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2525
0
{
2526
0
    if (attr_len < NAN_IDENTITY_RESOLUTION_MIN_LEN)
2527
0
    {
2528
        /* At least 1 byte: Cipher version  */
2529
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2530
0
        return;
2531
0
    }
2532
2533
0
    proto_tree_add_item(attr_tree, hf_nan_attr_identity_cipher_version, tvb,
2534
0
            offset + 3, 1, ENC_LITTLE_ENDIAN);
2535
2536
0
    uint8_t cipher_version = tvb_get_uint8(tvb, offset + 3);
2537
0
    switch (cipher_version)
2538
0
    {
2539
0
    case 0:
2540
0
        proto_tree_add_item(attr_tree, hf_nan_attr_identity_resolution_nonce, tvb,
2541
0
            offset + 4, 8, ENC_NA);
2542
0
        proto_tree_add_item(attr_tree, hf_nan_attr_identity_resolution_tag, tvb,
2543
0
            offset + 12, 8, ENC_NA);
2544
0
        break;
2545
0
    default:
2546
0
        proto_tree_add_item(attr_tree, hf_nan_attr_reserved, tvb,
2547
0
            offset + 3, attr_len - 1, ENC_NA);
2548
0
    }
2549
0
}
2550
2551
static void
2552
dissect_attr_nan_pairing_bootstrapping(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2553
0
{
2554
0
    if (attr_len < NAN_PAIRING_BOOTSTRAPPING_LEN)
2555
0
    {
2556
        /* At least 5 bytes: Dialog Token(1) + Type and Status(1) + Reason Code(1) + Pairing Bootstrapping Method(2) */
2557
0
        expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2558
0
        return;
2559
0
    }
2560
0
    int npba_local_offset = offset + 3;
2561
2562
    /* Dialog Token */
2563
0
    proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_dialog_token, tvb,
2564
0
            npba_local_offset, 1, ENC_LITTLE_ENDIAN);
2565
0
    npba_local_offset += 1;
2566
2567
    /* Type and Status */
2568
0
    uint8_t type_status = tvb_get_uint8(tvb, npba_local_offset);
2569
0
    uint8_t type = type_status & 0x0f;
2570
0
    uint8_t status = (type_status & 0xf0) >> 4;
2571
2572
0
    static int* const type_and_status_fields[] = {
2573
0
        &hf_nan_attr_pairing_bootstrapping_type,
2574
0
        &hf_nan_attr_pairing_bootstrapping_status,
2575
0
        NULL
2576
0
    };
2577
0
    proto_tree_add_bitmask(attr_tree, tvb, npba_local_offset, hf_nan_attr_pairing_bootstrapping_type_status,
2578
0
        ett_nan_pairing_bootstrapping_type_status, type_and_status_fields, ENC_LITTLE_ENDIAN);
2579
0
    npba_local_offset += 1;
2580
2581
    /* Resaon code
2582
     * Indicate the reject reason when Type = 2 (Response) and Status = 1 (Rejected); otherwise, reserved */
2583
0
    if ((type == 2) && (status == 1))
2584
0
    {
2585
0
        proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_resaon_code, tvb,
2586
0
            npba_local_offset, 1, ENC_LITTLE_ENDIAN);
2587
0
    }
2588
0
    else
2589
0
    {
2590
0
        proto_tree_add_item(attr_tree, hf_nan_attr_reserved, tvb,
2591
0
            npba_local_offset, 1, ENC_NA);
2592
0
    }
2593
0
    npba_local_offset += 1;
2594
2595
    /* Comeback, if any. Presetned if,
2596
     * a) type is 2 and status is 2, or
2597
     * b) type is 1 and status is 2, and cookie is requried (based on attribute length)
2598
     */
2599
0
    bool comeback_presented = (attr_len > NAN_PAIRING_BOOTSTRAPPING_LEN);
2600
2601
0
    bool comeback_after_presented = comeback_presented && ((type == 2) && (status == 2));
2602
2603
0
    if (comeback_after_presented)
2604
0
    {
2605
0
        proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_comeback_after, tvb,
2606
0
            npba_local_offset, 2, ENC_LITTLE_ENDIAN);
2607
0
        npba_local_offset += 2;
2608
0
    }
2609
2610
0
    if (comeback_presented)
2611
0
    {
2612
0
        uint8_t cookie_len = tvb_get_uint8(tvb, npba_local_offset);
2613
0
        proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_comeback_cookie_len, tvb,
2614
0
            npba_local_offset, 1, ENC_LITTLE_ENDIAN);
2615
0
        npba_local_offset += 1;
2616
2617
0
        if (cookie_len)
2618
0
        {
2619
0
            proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_comeback_cookie, tvb,
2620
0
                npba_local_offset, cookie_len, ENC_NA);
2621
0
            npba_local_offset += cookie_len;
2622
0
        }
2623
0
    }
2624
2625
    /* Pairing Bootstrapping Method */
2626
0
    static int* const pairing_bootstrapping_method[] = {
2627
0
        &hf_nan_attr_pairing_bootstrapping_method_opportunistic_bootstrapping,
2628
0
        &hf_nan_attr_pairing_bootstrapping_method_pin_code_display,
2629
0
        &hf_nan_attr_pairing_bootstrapping_method_passphrase_display,
2630
0
        &hf_nan_attr_pairing_bootstrapping_method_qr_code_display,
2631
0
        &hf_nan_attr_pairing_bootstrapping_method_nfc_tag,
2632
0
        &hf_nan_attr_pairing_bootstrapping_method_keypad_pin_code_only,
2633
0
        &hf_nan_attr_pairing_bootstrapping_method_keypad_passphrase,
2634
0
        &hf_nan_attr_pairing_bootstrapping_method_qr_code_scan,
2635
0
        &hf_nan_attr_pairing_bootstrapping_method_nfc_reader,
2636
0
        &hf_nan_attr_pairing_bootstrapping_method_reserved,
2637
0
        &hf_nan_attr_pairing_bootstrapping_method_service_managed_bootstrapping,
2638
0
        &hf_nan_attr_pairing_bootstrapping_method_bootstrapping_handshakes_skipped,
2639
0
        NULL
2640
0
    };
2641
0
    if (type == 2 && status)
2642
0
    {
2643
0
        proto_tree_add_item(attr_tree, hf_nan_attr_reserved, tvb,
2644
0
            npba_local_offset, 2, ENC_NA);
2645
0
    }
2646
0
    else
2647
0
    {
2648
0
        proto_tree_add_bitmask(attr_tree, tvb, npba_local_offset, hf_nan_attr_pairing_bootstrapping_methods,
2649
0
            ett_nan_pairing_bootstrapping_method, pairing_bootstrapping_method, ENC_LITTLE_ENDIAN);
2650
0
    }
2651
0
}
2652
2653
static void
2654
find_attribute_field(proto_tree* nan_tree, tvbuff_t* tvb, unsigned tvb_len, unsigned* offset, packet_info* pinfo)
2655
0
{
2656
0
    if ((tvb_len - *offset) < 3)
2657
0
    {
2658
0
        proto_tree_add_expert_format(nan_tree, pinfo, &ei_nan_elem_len_invalid, tvb, *offset, -1,
2659
0
            "Insufficient remaining packet bytes for NAN attribute");
2660
0
        *offset = tvb_len;
2661
0
        return;
2662
0
    }
2663
2664
0
    int attr_id = tvb_get_uint8(tvb, *offset);
2665
0
    uint16_t attr_len = tvb_get_letohs(tvb, *offset + 1);
2666
2667
0
    if ((*offset + 3 + attr_len) > tvb_len)
2668
0
    {
2669
0
        proto_tree_add_expert_format(nan_tree, pinfo, &ei_nan_elem_len_invalid, tvb, *offset, -1,
2670
0
            "Attribute length (%u) exceeds remaining packet length. Attribute id: %u", attr_len, attr_id);
2671
0
        *offset = tvb_len;
2672
0
        return;
2673
0
    }
2674
2675
0
    proto_tree* attr_tree = proto_tree_add_subtree(nan_tree, tvb, *offset, attr_len + 3,
2676
0
        ett_attributes, NULL, val_to_str(attr_id, attribute_types, "Unknown attribute ID (%u)"));
2677
2678
0
    proto_tree_add_item(attr_tree, hf_nan_attribute_type, tvb, *offset, 1, ENC_NA);
2679
0
    proto_tree_add_item(attr_tree, hf_nan_attribute_len, tvb, *offset + 1, 2, ENC_LITTLE_ENDIAN);
2680
2681
0
    switch (attr_id) {
2682
0
    case NAN_ATTR_SERVICE_DESCRIPTOR:
2683
0
        dissect_attr_sda(attr_tree, tvb, *offset, attr_len, pinfo);
2684
0
        break;
2685
0
    case NAN_ATTR_MASTER_INDICATION:
2686
0
        dissect_attr_master_indication(attr_tree, tvb, *offset, attr_len, pinfo);
2687
0
        break;
2688
0
    case NAN_ATTR_CLUSTER:
2689
0
        dissect_attr_cluster(attr_tree, tvb, *offset, attr_len, pinfo);
2690
0
        break;
2691
0
    case NAN_ATTR_CIPHER_SUITE_INFO:
2692
0
        dissect_attr_cipher_suite_info(attr_tree, tvb, *offset, attr_len, pinfo);
2693
0
        break;
2694
0
    case NAN_ATTR_SECURITY_CONTEXT_INFO:
2695
0
        dissect_attr_security_context_info(attr_tree, tvb, *offset, attr_len, pinfo);
2696
0
        break;
2697
0
    case NAN_ATTR_SHARED_KEY_DESCRIPTOR:
2698
0
        dissect_attr_shared_key_descriptor(attr_tree, tvb, *offset);
2699
0
        break;
2700
0
    case NAN_ATTR_PUBLIC_AVAILABILITY:
2701
0
        dissect_attr_public_availability(attr_tree, tvb, *offset, attr_len, pinfo);
2702
0
        break;
2703
0
    case NAN_ATTR_ELEMENT_CONTAINER:
2704
0
        dissect_attr_element_container(attr_tree, tvb, *offset, attr_len, pinfo);
2705
0
        break;
2706
0
    case NAN_ATTR_FTM_RANGING_REPORT:
2707
0
        dissect_attr_ftm_report(attr_tree, tvb, *offset);
2708
0
        break;
2709
0
    case NAN_ATTR_RANGING_SETUP:
2710
0
        dissect_attr_ranging_setup(attr_tree, tvb, *offset, attr_len, pinfo);
2711
0
        break;
2712
0
    case NAN_ATTR_RANGING_INFORMATION:
2713
0
        dissect_attr_ranging_info(attr_tree, tvb, *offset);
2714
0
        break;
2715
0
    case NAN_ATTR_UNALIGNED_SCHEDULE:
2716
0
        dissect_attr_unaligned_schedule(attr_tree, tvb, *offset, attr_len, pinfo);
2717
0
        break;
2718
0
    case NAN_ATTR_NDL_QOS:
2719
0
        dissect_attr_ndl_qos(attr_tree, tvb, *offset, attr_len, pinfo);
2720
0
        break;
2721
0
    case NAN_ATTR_EXTENDED_WLAN_INFRA:
2722
0
        dissect_attr_extended_wlan_infra(attr_tree, tvb, *offset, attr_len, pinfo);
2723
0
        break;
2724
0
    case NAN_ATTR_EXTENDED_P2P_OPERATION:
2725
0
        dissect_attr_extended_p2p_operation(attr_tree, tvb, *offset, attr_len, pinfo);
2726
0
        break;
2727
0
    case NAN_ATTR_EXTENDED_IBSS:
2728
0
        dissect_attr_extended_ibss(attr_tree, tvb, *offset, attr_len, pinfo);
2729
0
        break;
2730
0
    case NAN_ATTR_EXTENDED_MESH:
2731
0
        dissect_attr_extended_mesh(attr_tree, tvb, *offset, attr_len, pinfo);
2732
0
        break;
2733
0
    case NAN_ATTR_CONNECTION_CAPABILITY:
2734
0
        dissect_attr_connection_capability(attr_tree, tvb, *offset, attr_len, pinfo);
2735
0
        break;
2736
0
    case NAN_ATTR_CLUSTER_DISCOVERY:
2737
0
        dissect_attr_cluter_discovery(attr_tree, tvb, *offset, attr_len, pinfo);
2738
0
        break;
2739
0
    case NAN_ATTR_RANGING:
2740
0
        dissect_attr_ranging(attr_tree, tvb, *offset, attr_len, pinfo);
2741
0
        break;
2742
0
    case NAN_ATTR_COUNTRY_CODE:
2743
0
        dissect_attr_country_code(attr_tree, tvb, *offset);
2744
0
        break;
2745
0
    case NAN_ATTR_FURTHER_AVAILABILITY_MAP:
2746
0
        dissect_attr_further_availability_map(attr_tree, tvb, *offset);
2747
0
        break;
2748
0
    case NAN_ATTR_FURTHER_SERVICE_DISCOVERY:
2749
0
        dissect_attr_further_service_discovery(attr_tree, tvb, *offset, attr_len);
2750
0
        break;
2751
0
    case NAN_ATTR_MESH:
2752
0
        dissect_attr_mesh(attr_tree, tvb, *offset, attr_len, pinfo);
2753
0
        break;
2754
0
    case NAN_ATTR_IBSS:
2755
0
        dissect_attr_ibss(attr_tree, tvb, *offset, attr_len, pinfo);
2756
0
        break;
2757
0
    case NAN_ATTR_P2P_OPERATION:
2758
0
        dissect_attr_p2p_operation(attr_tree, tvb, *offset, attr_len, pinfo);
2759
0
        break;
2760
0
    case NAN_ATTR_WLAN_INFRA:
2761
0
        dissect_attr_wlan_infra(attr_tree, tvb, *offset, attr_len, pinfo);
2762
0
        break;
2763
0
    case NAN_ATTR_NDP:
2764
0
        dissect_attr_ndp(attr_tree, tvb, *offset, attr_len, pinfo);
2765
0
        break;
2766
0
    case NAN_ATTR_NDP_EXTENSION:
2767
0
        dissect_attr_ndpe(attr_tree, tvb, *offset, attr_len, pinfo);
2768
0
        break;
2769
0
    case NAN_ATTR_SERVICE_DESCRIPTOR_EXTENSION:
2770
0
        dissect_attr_sdea(attr_tree, tvb, *offset, attr_len, pinfo);
2771
0
        break;
2772
0
    case NAN_ATTR_DEVICE_CAPABILITY:
2773
0
        dissect_attr_device_capability(attr_tree, tvb, *offset, attr_len, pinfo);
2774
0
        break;
2775
0
    case NAN_ATTR_AVAILABILITY:
2776
0
        dissect_attr_availability(attr_tree, tvb, *offset, attr_len, pinfo);
2777
0
        break;
2778
0
    case NAN_ATTR_NDC:
2779
0
        dissect_attr_ndc(attr_tree, tvb, *offset, attr_len, pinfo);
2780
0
        break;
2781
0
    case NAN_ATTR_SERVICE_ID_LIST:
2782
0
    case NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST:
2783
0
        dissect_attr_service_id_list(attr_tree, tvb, *offset, attr_len, pinfo);
2784
0
        break;
2785
0
    case NAN_ATTR_VENDOR_SPECIFIC:
2786
0
        dissect_attr_vendor_specific(attr_tree, tvb, *offset, attr_len, pinfo);
2787
0
        break;
2788
0
    case NAN_ATTR_NDL:
2789
0
        dissect_attr_ndl(attr_tree, tvb, *offset, attr_len, pinfo);
2790
0
        break;
2791
0
    case NAN_ATTR_DEVICE_CAPABILITY_EXTENSION:
2792
0
        dissect_attr_device_capability_extension(attr_tree, tvb, *offset, attr_len, pinfo);
2793
0
        break;
2794
0
    case NAN_ATTR_IDENTITY_RESOLUTION:
2795
0
        dissect_attr_nan_identity_resolution(attr_tree, tvb, *offset, attr_len, pinfo);
2796
0
        break;
2797
0
    case NAN_ATTR_PAIRING_BOOTSTRAPPING:
2798
0
        dissect_attr_nan_pairing_bootstrapping(attr_tree, tvb, *offset, attr_len, pinfo);
2799
0
        break;
2800
0
    default:
2801
0
        expert_add_info(pinfo, attr_tree, &ei_nan_unknown_attr_id);
2802
0
    }
2803
2804
0
    *offset += attr_len + 3;
2805
0
}
2806
2807
static int
2808
dissect_nan_beacon(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
2809
0
{
2810
0
    unsigned offset = 0;
2811
2812
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "NAN");
2813
2814
    //
2815
    // Workaround to identify NAN Discovery vs Synchronization beacon frames.
2816
    //
2817
    // We have to determine the beacon interval, but there is, unfortunately,
2818
    // no mechanism by which a subdissector can request that an arbitrary
2819
    // field value be provided to it by the calling dissector, so we can't
2820
    // just ask for "wlan.fixed.beacon".
2821
    //
2822
    // Fortunately, we are currently putting the Discovery vs. Sync information
2823
    // only in the Info column, and the beacon interval is put at the end
2824
    // of the Info column, as "BI={interval}", by the 802.11 dissector, so
2825
    // we can just fetch the Info column string and, if it's present, extract
2826
    // that value.
2827
    //
2828
    // An interval of 512, meaning .524288 seconds, means
2829
    // it's a Sync beacon. Otherwise, it's a Discovery Beacon.
2830
    //
2831
0
    const char* info_text = col_get_text(pinfo->cinfo, COL_INFO);
2832
0
    if (info_text != NULL && g_str_has_suffix(info_text, "512"))
2833
0
    {
2834
0
        col_prepend_fstr(pinfo->cinfo, COL_INFO, "Sync ");
2835
0
    }
2836
0
    else
2837
0
    {
2838
0
        col_prepend_fstr(pinfo->cinfo, COL_INFO, "Discovery ");
2839
0
    }
2840
2841
0
    proto_item* ti = proto_tree_add_item(tree, proto_nan, tvb, 0, -1, ENC_NA);
2842
0
    proto_tree* nan_tree = proto_item_add_subtree(ti, ett_nan);
2843
2844
0
    unsigned tvb_len = tvb_reported_length(tvb);
2845
0
    while (offset < tvb_len)
2846
0
    {
2847
0
        find_attribute_field(nan_tree, tvb, tvb_len, &offset, pinfo);
2848
0
    }
2849
0
    return tvb_captured_length(tvb);
2850
0
}
2851
2852
static int
2853
dissect_nan_action(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
2854
0
{
2855
0
    unsigned offset = 0;
2856
2857
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "NAN");
2858
2859
0
    proto_tree* upper_tree = proto_tree_get_parent_tree(tree);
2860
0
    proto_item* ti = proto_tree_add_item(upper_tree, proto_nan, tvb, 0, -1, ENC_NA);
2861
0
    proto_tree* nan_tree = proto_item_add_subtree(ti, ett_nan);
2862
2863
0
    uint8_t subtype = tvb_get_uint8(tvb, offset);
2864
0
    const char* subtype_text = rval_to_str_wmem(pinfo->pool, subtype, action_frame_type_values, "Unknown type (%u)");
2865
0
    proto_item_set_text(ti, "%s", subtype_text);
2866
0
    proto_tree_add_item(nan_tree, hf_nan_action_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
2867
2868
0
    col_prepend_fstr(pinfo->cinfo, COL_INFO, "%s", subtype_text);
2869
0
    offset++;
2870
2871
0
    unsigned tvb_len = tvb_reported_length(tvb);
2872
0
    while (offset < tvb_len)
2873
0
    {
2874
0
        find_attribute_field(nan_tree, tvb, tvb_len, &offset, pinfo);
2875
0
    }
2876
0
    return tvb_captured_length(tvb);
2877
0
}
2878
2879
static int
2880
dissect_nan_service_discovery(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
2881
0
{
2882
0
    unsigned offset = 0;
2883
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "NAN");
2884
0
    proto_item* ti = proto_tree_add_item(tree, proto_nan, tvb, 0, -1, ENC_NA);
2885
0
    proto_tree* nan_tree = proto_item_add_subtree(ti, ett_nan);
2886
2887
0
    unsigned tvb_len = tvb_reported_length(tvb);
2888
0
    while (offset < tvb_len)
2889
0
    {
2890
0
        find_attribute_field(nan_tree, tvb, tvb_len, &offset, pinfo);
2891
0
    }
2892
0
    return tvb_captured_length(tvb);
2893
0
}
2894
2895
void
2896
proto_register_nan(void)
2897
14
{
2898
14
    static hf_register_info hf[] = {
2899
14
        { &hf_nan_attribute_type,
2900
14
            {
2901
14
            "Attribute Type",
2902
14
            "wifi_nan.attribute.type",
2903
14
            FT_UINT8, BASE_DEC, VALS(attribute_types), 0x0, NULL, HFILL
2904
14
            }
2905
14
        },
2906
14
        { &hf_nan_attribute_len,
2907
14
            {
2908
14
            "Attribute Length",
2909
14
            "wifi_nan.attribute.len",
2910
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
2911
14
            }
2912
14
        },
2913
14
        { &hf_nan_action_subtype,
2914
14
            {
2915
14
            "Subtype",
2916
14
            "wifi_nan.action.subtype",
2917
14
            FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(action_frame_type_values), 0x0, NULL, HFILL
2918
14
            }
2919
14
        },
2920
14
        { &hf_nan_instance_id,
2921
14
            {
2922
14
            "Instance ID",
2923
14
            "wifi_nan.instance_id",
2924
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
2925
14
            }
2926
14
        },
2927
14
        { &hf_nan_service_id,
2928
14
            {
2929
14
            "Service ID",
2930
14
            "wifi_nan.service_id",
2931
14
            FT_BYTES, SEP_COLON, NULL, 0x0, NULL, HFILL
2932
14
            }
2933
14
        },
2934
14
        { &hf_nan_map_id,
2935
14
            {
2936
14
            "Map ID",
2937
14
            "wifi_nan.map_id",
2938
14
            FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
2939
14
            }
2940
14
        },
2941
14
        { &hf_nan_oui,
2942
14
            {
2943
14
            "OUI",
2944
14
            "wifi_nan.oui",
2945
14
            FT_BYTES, SEP_COLON, NULL, 0x0, NULL, HFILL
2946
14
            }
2947
14
        },
2948
14
        { &hf_nan_type_status,
2949
14
            {
2950
14
            "Type and Status",
2951
14
            "wifi_nan.type_status",
2952
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
2953
14
            }
2954
14
        },
2955
14
        { &hf_nan_reason_code,
2956
14
            {
2957
14
            "Reason Code",
2958
14
            "wifi_nan.reason_code",
2959
14
            FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(reason_code_values), 0x0, NULL, HFILL
2960
14
            }
2961
14
        },
2962
14
        { &hf_nan_status_1,
2963
14
             {
2964
14
             "Status",
2965
14
             "wifi_nan.status",
2966
14
             FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(status_type1_values), 0xF0, NULL, HFILL
2967
14
             }
2968
14
        },
2969
14
        { &hf_nan_status_2,
2970
14
             {
2971
14
             "Status",
2972
14
             "wifi_nan.status",
2973
14
             FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(status_type2_values), 0xF0, NULL, HFILL
2974
14
             }
2975
14
        },
2976
14
        { &hf_nan_bss_id,
2977
14
            {
2978
14
            "BSS ID",
2979
14
            "wifi_nan.bss_id",
2980
14
            FT_UINT48, BASE_DEC, NULL, 0x0, NULL, HFILL
2981
14
            }
2982
14
        },
2983
14
        { &hf_nan_availability_intervals_bitmap,
2984
14
             {
2985
14
             "Availability Intervals Bitmap",
2986
14
             "wifi_nan.availability_intervals_bitmap",
2987
14
             FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
2988
14
             }
2989
14
        },
2990
14
        { &hf_nan_mac_address,
2991
14
            {
2992
14
            "MAC Address",
2993
14
            "wifi_nan.mac_address",
2994
14
            FT_BYTES, SEP_COLON, NULL, 0x0, NULL, HFILL
2995
14
            }
2996
14
        },
2997
14
        { &hf_nan_publish_id,
2998
14
            {
2999
14
            "Publish ID",
3000
14
            "wifi_nan.publish_id",
3001
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3002
14
            }
3003
14
        },
3004
14
        { &hf_nan_dialog_tokens,
3005
14
            {
3006
14
            "Dialog Token",
3007
14
            "wifi_nan.dialog_token",
3008
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3009
14
            }
3010
14
        },
3011
14
        { &hf_nan_time_bitmap,
3012
14
            {
3013
14
            "Time Bitmap",
3014
14
            "wifi_nan.time_bitmap",
3015
14
            FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3016
14
            }
3017
14
        },
3018
14
        { &hf_nan_time_bitmap_len,
3019
14
            {
3020
14
            "Time Bitmap Length",
3021
14
            "wifi_nan.time_bitmap.len",
3022
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3023
14
            }
3024
14
        },
3025
14
        { &hf_nan_time_bitmap_ctrl,
3026
14
            {
3027
14
            "Time Bitmap Control",
3028
14
            "wifi_nan.time_bitmap.ctrl",
3029
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
3030
14
            }
3031
14
        },
3032
14
        { &hf_nan_time_bitmap_ctrl_bit_duration,
3033
14
            {
3034
14
            "Bit Duration",
3035
14
            "wifi_nan.time_bitmap.ctrl.bit_duration",
3036
14
            FT_UINT16, BASE_DEC | BASE_RANGE_STRING, RVALS(availability_entry_time_bitmap_ctr_bit_duration_type),
3037
14
            0x0007, NULL, HFILL
3038
14
            }
3039
14
        },
3040
14
        { &hf_nan_time_bitmap_ctrl_period,
3041
14
            {
3042
14
            "Period",
3043
14
            "wifi_nan.time_bitmap.ctrl.period",
3044
14
            FT_UINT16, BASE_DEC, VALS(availability_entry_time_bitmap_ctr_period_type),
3045
14
            0x0038, NULL, HFILL
3046
14
            }
3047
14
        },
3048
14
        { &hf_nan_time_bitmap_ctrl_start_offset,
3049
14
            {
3050
14
            "Start Offset",
3051
14
            "wifi_nan.time_bitmap.ctrl.start_offset",
3052
14
            FT_UINT16, BASE_DEC, NULL, 0x7FC0, NULL, HFILL
3053
14
            }
3054
14
        },
3055
14
        { &hf_nan_map_ctrl_map_id,
3056
14
             {
3057
14
             "Map ID",
3058
14
             "wifi_nan.map_ctrl.map_id",
3059
14
             FT_UINT8, BASE_HEX_DEC, NULL, 0xF, NULL, HFILL
3060
14
             }
3061
14
        },
3062
14
        { &hf_nan_map_ctrl_availability_interval_duration,
3063
14
             {
3064
14
             "Availability Interval Duration",
3065
14
             "wifi_nan.map_ctrl.interval_duration",
3066
14
             FT_UINT8, BASE_DEC, VALS(map_ctrl_availability_interval_duration), 0x30, NULL, HFILL
3067
14
             }
3068
14
        },
3069
14
        { &hf_nan_map_ctrl_repeat,
3070
14
             {
3071
14
             "Repeat",
3072
14
             "wifi_nan.map_ctrl.repeat",
3073
14
             FT_UINT8, BASE_DEC, NULL, 0x40, NULL, HFILL
3074
14
             }
3075
14
        },
3076
14
        { &hf_nan_map_ctrl_field,
3077
14
             {
3078
14
             "Map Control",
3079
14
             "wifi_nan.map_ctrl",
3080
14
             FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3081
14
             }
3082
14
        },
3083
14
        { &hf_nan_non_op_channel_global_op_class,
3084
14
            {
3085
14
            "Global Operation Class",
3086
14
            "wifi_nan.non_op_channel.global_op_class",
3087
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3088
14
            }
3089
14
        },
3090
14
        { &hf_nan_non_op_channel_channel,
3091
14
            {
3092
14
            "Channel",
3093
14
            "wifi_nan.non_op_channel.channel",
3094
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3095
14
            }
3096
14
        },
3097
14
        { &hf_nan_non_op_channel_center_freq,
3098
14
            {
3099
14
            "Channel Center Frequency",
3100
14
            "wifi_nan.non_op_channel.center_freq",
3101
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3102
14
            }
3103
14
        },
3104
14
        { &hf_nan_non_beacon_tbtt_offset,
3105
14
            {
3106
14
            "TBTT Offset",
3107
14
            "wifi_nan.non_beacon.tbtt_offset",
3108
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3109
14
            }
3110
14
        },
3111
14
        { &hf_nan_non_beacon_interval,
3112
14
            {
3113
14
            "Beacon Interval",
3114
14
            "wifi_nan.non_beacon.interval",
3115
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3116
14
            }
3117
14
        },
3118
14
        { &hf_nan_attr_master_preference,
3119
14
            {
3120
14
            "Master Preference",
3121
14
            "wifi_nan.master_indication.preference",
3122
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3123
14
            }
3124
14
        },
3125
14
        { &hf_nan_attr_master_random_factor,
3126
14
            {
3127
14
            "Random Factor",
3128
14
            "wifi_nan.master_indication.random_factor",
3129
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3130
14
            }
3131
14
        },
3132
14
        { &hf_nan_attr_cluster_anchor_master_rank,
3133
14
            {
3134
14
            "Anchor Master Rank",
3135
14
            "wifi_nan.cluster.anchor_master_rank",
3136
14
            FT_UINT64, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL
3137
14
            }
3138
14
        },
3139
14
        { &hf_nan_attr_cluster_hop_count,
3140
14
            {
3141
14
            "Hop Count to Anchor Master",
3142
14
            "wifi_nan.cluster.hop_count",
3143
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3144
14
            }
3145
14
        },
3146
14
        { &hf_nan_attr_cluster_beacon_transmission_time,
3147
14
            {
3148
14
            "Anchor Master Beacon Transmission Time",
3149
14
            "wifi_nan.cluster.beacon_transmission_time",
3150
14
            FT_UINT32, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3151
14
            }
3152
14
        },
3153
14
        { &hf_nan_attr_sda_requestor_instance_id,
3154
14
            {
3155
14
            "Requestor Instance ID",
3156
14
            "wifi_nan.sda.requestor_instance_id",
3157
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3158
14
            }
3159
14
        },
3160
14
        { &hf_nan_attr_sda_sc,
3161
14
            {
3162
14
            "Service Control",
3163
14
            "wifi_nan.sda.sc",
3164
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3165
14
            }
3166
14
        },
3167
14
        { &hf_nan_attr_sda_sc_type,
3168
14
            {
3169
14
            "Service Control Type",
3170
14
            "wifi_nan.sda.sc.type",
3171
14
            FT_UINT8, BASE_HEX, VALS(service_ctr_type), 0x03, NULL, HFILL
3172
14
            }
3173
14
        },
3174
14
        { &hf_nan_attr_sda_sc_matching_filter,
3175
14
            {
3176
14
            "Matching Filter Present",
3177
14
            "wifi_nan.sda.sc.matching_filter",
3178
14
            FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL
3179
14
            }
3180
14
        },
3181
14
        { &hf_nan_attr_sda_sc_service_response,
3182
14
            {
3183
14
            "Service Response Filter Present",
3184
14
            "wifi_nan.sda.sc.service_response",
3185
14
            FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL
3186
14
            }
3187
14
        },
3188
14
        { &hf_nan_attr_sda_sc_service_info,
3189
14
            {
3190
14
            "Service Info Present",
3191
14
            "wifi_nan.sda.sc.service_info",
3192
14
            FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
3193
14
            }
3194
14
        },
3195
14
        { &hf_nan_attr_sda_sc_discovery_range,
3196
14
            {
3197
14
            "Discovery Range Limited",
3198
14
            "wifi_nan.sda.sc.discovery_range",
3199
14
            FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL
3200
14
            }
3201
14
        },
3202
14
        { &hf_nan_attr_sda_sc_binding_bitmap,
3203
14
            {
3204
14
            "Binding Bitmap Present",
3205
14
            "wifi_nan.sda.sc.binding_bitmap",
3206
14
            FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL
3207
14
            }
3208
14
        },
3209
14
        { &hf_nan_attr_sda_binding_bitmap,
3210
14
            {
3211
14
            "Binding Bitmap",
3212
14
            "wifi_nan.sda.binding_bitmap",
3213
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
3214
14
            }
3215
14
        },
3216
14
        { &hf_nan_attr_sda_matching_filter_len,
3217
14
            {
3218
14
            "Matching Filter Length",
3219
14
            "wifi_nan.sda.matching_filter_len",
3220
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3221
14
            }
3222
14
        },
3223
14
        { &hf_nan_attr_sda_matching_filter_val,
3224
14
            {
3225
14
            "Matching Filter Value",
3226
14
            "wifi_nan.sda.matching_filter_val",
3227
14
            FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3228
14
            }
3229
14
        },
3230
14
        { &hf_nan_attr_sda_service_response_filter_len,
3231
14
            {
3232
14
            "Service Response Filter Length",
3233
14
            "wifi_nan.sda.service_response_filter_len",
3234
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3235
14
            }
3236
14
        },
3237
14
        { &hf_nan_attr_sda_srf_ctr,
3238
14
            {
3239
14
            "SRF Control",
3240
14
            "wifi_nan.sda.srf_ctr",
3241
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3242
14
            }
3243
14
        },
3244
14
        { &hf_nan_attr_sda_srf_ctr_type,
3245
14
            {
3246
14
            "SRF Type",
3247
14
            "wifi_nan.sda.srf_type",
3248
14
            FT_BOOLEAN, 8, TFS(&srf_type_flags), 0x01, NULL, HFILL
3249
14
            }
3250
14
        },
3251
14
        { &hf_nan_attr_sda_srf_ctr_include,
3252
14
            {
3253
14
            "Include",
3254
14
            "wifi_nan.sda.srf_include",
3255
14
            FT_BOOLEAN, 8, TFS(&srf_include_flags), 0x02, NULL, HFILL
3256
14
            }
3257
14
        },
3258
14
        { &hf_nan_attr_sda_srf_ctr_bloom_filter_index,
3259
14
            {
3260
14
            "Bloom Filter Index",
3261
14
            "wifi_nan.sda.srf_bloom_filter_index",
3262
14
            FT_UINT8, BASE_DEC_HEX, NULL, 0x0C, NULL, HFILL
3263
14
            }
3264
14
        },
3265
14
        { &hf_nan_attr_sda_srf_address_set,
3266
14
            {
3267
14
            "Address Set",
3268
14
            "wifi_nan.sda.srf_address_set",
3269
14
            FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3270
14
            }
3271
14
        },
3272
14
        { &hf_nan_attr_sda_service_info_len,
3273
14
            {
3274
14
            "Service Info Length",
3275
14
            "wifi_nan.sda.service_info_len",
3276
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3277
14
            }
3278
14
        },
3279
14
        { &hf_nan_attr_sda_service_info,
3280
14
            {
3281
14
            "Service Info",
3282
14
            "wifi_nan.sda.service_info",
3283
14
            FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3284
14
            }
3285
14
        },
3286
14
        { &hf_nan_attr_sdea_ctr,
3287
14
            {
3288
14
            "SDEA Control",
3289
14
            "wifi_nan.sdea.ctr",
3290
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
3291
14
            }
3292
14
        },
3293
14
        { &hf_nan_attr_sdea_ctr_fsd,
3294
14
            {
3295
14
            "FSD Required",
3296
14
            "wifi_nan.sdea.ctr_fsd",
3297
14
            FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL
3298
14
            }
3299
14
        },
3300
14
        { &hf_nan_attr_sdea_ctr_fsd_w_gas,
3301
14
            {
3302
14
            "FSD with GAS",
3303
14
            "wifi_nan.sdea.ctr_fsd_w_gas",
3304
14
            FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL
3305
14
            }
3306
14
        },
3307
14
        { &hf_nan_attr_sdea_ctr_data_path,
3308
14
            {
3309
14
            "Data Path Required",
3310
14
            "wifi_nan.sdea.ctr_data_path",
3311
14
            FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL
3312
14
            }
3313
14
        },
3314
14
        { &hf_nan_attr_sdea_ctr_data_path_type,
3315
14
            {
3316
14
            "Data Path Type",
3317
14
            "wifi_nan.sdea.ctr_data_path_type",
3318
14
            FT_BOOLEAN, 16, TFS(&sdea_ctr_data_path_type_flags), 0x0008, NULL, HFILL
3319
14
            }
3320
14
        },
3321
14
        { &hf_nan_attr_sdea_ctr_reserved_multicast_type,
3322
14
            {
3323
14
            "Reserved (Multicast Type)",
3324
14
            "wifi_nan.sdea.ctr_reserved_multicast_type",
3325
14
            FT_BOOLEAN, 16, TFS(&sdea_ctr_reserved_multicast_type_flags), 0x0010, NULL, HFILL
3326
14
            }
3327
14
        },
3328
14
        { &hf_nan_attr_sdea_ctr_qos,
3329
14
            {
3330
14
            "QoS Required",
3331
14
            "wifi_nan.sdea.ctr_qos",
3332
14
            FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL
3333
14
            }
3334
14
        },
3335
14
        { &hf_nan_attr_sdea_ctr_security,
3336
14
            {
3337
14
            "Security Required",
3338
14
            "wifi_nan.sdea.ctr_security",
3339
14
            FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL
3340
14
            }
3341
14
        },
3342
14
        { &hf_nan_attr_sdea_ctr_ranging,
3343
14
            {
3344
14
            "Ranging Required",
3345
14
            "wifi_nan.sdea.ctr_ranging",
3346
14
            FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL
3347
14
            }
3348
14
        },
3349
14
        { &hf_nan_attr_sdea_ctr_range_limit,
3350
14
            {
3351
14
            "Range Limit Present",
3352
14
            "wifi_nan.sdea.ctr_range_limit",
3353
14
            FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL
3354
14
            }
3355
14
        },
3356
14
        { &hf_nan_attr_sdea_ctr_service_update_indicator,
3357
14
            {
3358
14
            "Service Update Indicator Present",
3359
14
            "wifi_nan.sdea.ctr_service_update_indicator",
3360
14
            FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL
3361
14
            }
3362
14
        },
3363
14
        { &hf_nan_attr_sdea_ingress_range_limit,
3364
14
            {
3365
14
            "Ingress Range Limit",
3366
14
            "wifi_nan.sdea.range_limit_ingress",
3367
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3368
14
            }
3369
14
        },
3370
14
        { &hf_nan_attr_sdea_egress_range_limit,
3371
14
            {
3372
14
            "Egress Range Limit",
3373
14
            "wifi_nan.sdea.range_limit_egress",
3374
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3375
14
            }
3376
14
        },
3377
14
        { &hf_nan_attr_sdea_service_update_indicator,
3378
14
            {
3379
14
            "Service Update Indicator",
3380
14
            "wifi_nan.sdea.service_update_indicator",
3381
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3382
14
            }
3383
14
        },
3384
14
        { &hf_nan_attr_sdea_service_info_length,
3385
14
            {
3386
14
            "Service Info Length",
3387
14
            "wifi_nan.sdea.service_info_len",
3388
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3389
14
            }
3390
14
        },
3391
14
        { &hf_nan_attr_sdea_service_info_protocol_type,
3392
14
            {
3393
14
            "Service Protocol Type",
3394
14
            "wifi_nan.sdea.service_info_protocol_type",
3395
14
            FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(service_info_protocol_type), 0x0, NULL, HFILL
3396
14
            }
3397
14
        },
3398
14
        { &hf_nan_attr_sdea_service_info_specific,
3399
14
            {
3400
14
            "Service Specific info",
3401
14
            "wifi_nan.sdea.service_info_specific",
3402
14
            FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3403
14
            }
3404
14
        },
3405
14
        { &hf_nan_attr_connection_cap_bitmap,
3406
14
             {
3407
14
             "Connection Capability Bitmap",
3408
14
             "wifi_nan.connection_cap.bitmap",
3409
14
             FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3410
14
             }
3411
14
        },
3412
14
        { &hf_nan_attr_connection_cap_wifi_direct,
3413
14
             {
3414
14
             "Wifi Direct",
3415
14
             "wifi_nan.connection_cap.wifi_direct",
3416
14
             FT_BOOLEAN, 16, NULL, 0x1, NULL, HFILL
3417
14
             }
3418
14
        },
3419
14
        { &hf_nan_attr_connection_cap_p2ps,
3420
14
             {
3421
14
             "P2Ps",
3422
14
             "wifi_nan.connection_cap.p2ps",
3423
14
             FT_BOOLEAN, 16, NULL, 0x2, NULL, HFILL
3424
14
             }
3425
14
        },
3426
14
        { &hf_nan_attr_connection_cap_tdls,
3427
14
             {
3428
14
             "TDLS",
3429
14
             "wifi_nan.connection_cap.tdls",
3430
14
             FT_BOOLEAN, 16, NULL, 0x4, NULL, HFILL
3431
14
             }
3432
14
        },
3433
14
        { &hf_nan_attr_connection_cap_wlan_infra,
3434
14
             {
3435
14
             "WLAN Infrastructure",
3436
14
             "wifi_nan.connection_cap.wlan_infra",
3437
14
             FT_BOOLEAN, 16, NULL, 0x8, NULL, HFILL
3438
14
             }
3439
14
        },
3440
14
        { &hf_nan_attr_connection_cap_ibss,
3441
14
             {
3442
14
             "IBSS",
3443
14
             "wifi_nan.connection_cap.ibss",
3444
14
             FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL
3445
14
             }
3446
14
        },
3447
14
        { &hf_nan_attr_connection_cap_mesh,
3448
14
             {
3449
14
             "Mesh",
3450
14
             "wifi_nan.connection_cap.mesh",
3451
14
             FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL
3452
14
             }
3453
14
        },
3454
14
        { &hf_nan_attr_wlan_infra_device_role,
3455
14
            {
3456
14
            "Device Role",
3457
14
            "wifi_nan.wlan_infra.device_role",
3458
14
            FT_UINT8, BASE_DEC, VALS(device_role), 0x0, NULL, HFILL
3459
14
            }
3460
14
        },
3461
14
        { &hf_nan_attr_p2p_device_role_device,
3462
14
             {
3463
14
             "P2P Device",
3464
14
             "wifi_nan.p2p.device",
3465
14
             FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
3466
14
             }
3467
14
        },
3468
14
        { &hf_nan_attr_p2p_device_role_group_owner,
3469
14
             {
3470
14
             "P2P Group Owner",
3471
14
             "wifi_nan.p2p.group_owner",
3472
14
             FT_BOOLEAN, 8, NULL, 0x2, NULL, HFILL
3473
14
             }
3474
14
        },
3475
14
        { &hf_nan_attr_p2p_device_role_client,
3476
14
             {
3477
14
             "P2P Client",
3478
14
             "wifi_nan.p2p.client",
3479
14
             FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
3480
14
             }
3481
14
        },
3482
14
        { &hf_nan_attr_p2p_device_role,
3483
14
             {
3484
14
             "P2P Device Role",
3485
14
             "wifi_nan.p2p.device_role",
3486
14
             FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3487
14
             }
3488
14
        },
3489
14
        { &hf_nan_attr_mesh_id,
3490
14
            {
3491
14
            "Mesh ID",
3492
14
            "wifi_nan.mesh.id",
3493
14
            FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3494
14
            }
3495
14
        },
3496
14
        { &hf_nan_attr_further_av_map_id,
3497
14
            {
3498
14
            "Map ID",
3499
14
            "wifi_nan.furth.av.map.id",
3500
14
            FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(furth_av_map_id), 0x0, NULL, HFILL
3501
14
            }
3502
14
        },
3503
14
        { &hf_nan_attr_further_av_map_entry_av_interval_duration,
3504
14
            {
3505
14
            "Availability Interval Duration",
3506
14
            "wifi_nan.further_av_map.entry.av_interval_duration",
3507
14
            FT_UINT8, BASE_DEC, VALS(map_ctrl_availability_interval_duration), 0x03, NULL, HFILL
3508
14
            }
3509
14
        },
3510
14
        { &hf_nan_attr_further_av_map_op_class,
3511
14
             {
3512
14
             "Operating Class",
3513
14
             "wifi_nan.further_av_map.entry.op_class",
3514
14
             FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3515
14
             }
3516
14
        },
3517
14
        { &hf_nan_attr_further_av_map_channel_num,
3518
14
             {
3519
14
             "Channel Number",
3520
14
             "wifi_nan.further_av_map.entry.channel_number",
3521
14
             FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3522
14
             }
3523
14
        },
3524
14
        { &hf_nan_attr_further_av_map_entry_ctrl,
3525
14
             {
3526
14
             "Entry Control Fields",
3527
14
             "wifi_nan.further_av_map.entry.ctrl",
3528
14
             FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3529
14
             }
3530
14
        },
3531
14
        { &hf_nan_attr_country_code,
3532
14
             {
3533
14
             "Condensed Country String",
3534
14
             "wifi_nan.country_code",
3535
14
             FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL
3536
14
             }
3537
14
        },
3538
14
        { &hf_nan_attr_ranging_protocol,
3539
14
             {
3540
14
             "Ranging Protocol",
3541
14
             "wifi_nan.ranging.protocol",
3542
14
             FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3543
14
             }
3544
14
        },
3545
14
        { &hf_nan_attr_cluster_disc_id,
3546
14
             {
3547
14
             "Cluster ID",
3548
14
             "wifi_nan.cluster_disc.id",
3549
14
             FT_UINT48, BASE_HEX, NULL, 0x0, NULL, HFILL
3550
14
             }
3551
14
        },
3552
14
        { &hf_nan_attr_cluster_disc_time_offset,
3553
14
             {
3554
14
             "Cluster Time Offset",
3555
14
             "wifi_nan.cluster_disc.time_offset",
3556
14
             FT_UINT64, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL
3557
14
             }
3558
14
        },
3559
14
        { &hf_nan_attr_cluster_disc_anchor_master_rank,
3560
14
             {
3561
14
             "Anchor Master Rank",
3562
14
             "wifi_nan.cluster_disc.anchor_master_rank",
3563
14
             FT_UINT64, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL
3564
14
             }
3565
14
        },
3566
14
        { &hf_nan_attr_device_cap_map_id_apply_to,
3567
14
            {
3568
14
            "Apply to",
3569
14
            "wifi_nan.device_cap.map_id_apply_to",
3570
14
            FT_BOOLEAN, 8, TFS(&device_cap_map_id_apply_to_flags), 0x01, NULL, HFILL
3571
14
            }
3572
14
        },
3573
14
        { &hf_nan_attr_device_cap_map_id_associated_maps,
3574
14
            {
3575
14
            "Map ID",
3576
14
            "wifi_nan.device_cap.map_id_associated_maps",
3577
14
            FT_UINT8, BASE_HEX_DEC, NULL, 0x1E, NULL, HFILL
3578
14
            }
3579
14
        },
3580
14
        { &hf_nan_attr_device_cap_committed_dw,
3581
14
            {
3582
14
            "Committed DW Info",
3583
14
            "wifi_nan.device_cap.committed_dw_info",
3584
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3585
14
            }
3586
14
        },
3587
14
        { &hf_nan_attr_device_cap_committed_dw_24ghz,
3588
14
            {
3589
14
            "2.4 GHz DW",
3590
14
            "wifi_nan.device_cap.committed_dw_info.24ghz",
3591
14
            FT_UINT16, BASE_DEC, NULL, 0x0007, NULL, HFILL
3592
14
            }
3593
14
        },
3594
14
        { &hf_nan_attr_device_cap_committed_dw_5ghz,
3595
14
            {
3596
14
            "5 GHz DW",
3597
14
            "wifi_nan.device_cap.committed_dw_info.5ghz",
3598
14
            FT_UINT16, BASE_DEC, NULL, 0x0038, NULL, HFILL
3599
14
            }
3600
14
        },
3601
14
        { &hf_nan_attr_device_cap_committed_dw_24ghz_overwrite,
3602
14
            {
3603
14
            "2.4 GHz DW Overwrite",
3604
14
            "wifi_nan.device_cap.committed_dw_info.24ghz_overwrite",
3605
14
            FT_UINT16, BASE_DEC, NULL, 0x03C0, NULL, HFILL
3606
14
            }
3607
14
        },
3608
14
        { &hf_nan_attr_device_cap_committed_dw_5ghz_overwrite,
3609
14
            {
3610
14
            "5 GHz DW Overwrite",
3611
14
            "wifi_nan.device_cap.committed_dw_info.5ghz_overwrite",
3612
14
            FT_UINT16, BASE_DEC, NULL, 0x3C00, NULL, HFILL
3613
14
            }
3614
14
        },
3615
14
        { &hf_nan_attr_device_cap_supported_bands,
3616
14
            {
3617
14
            "Supported Bands",
3618
14
            "wifi_nan.device_cap.supported_bands",
3619
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3620
14
            }
3621
14
        },
3622
14
        { &hf_nan_attr_device_cap_supported_bands_reserved_tv_whitespaces,
3623
14
            {
3624
14
            "Reserved (for TV white spaces)",
3625
14
            "wifi_nan.device_cap.supported_bands.tv_whitespaces",
3626
14
            FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL
3627
14
            }
3628
14
        },
3629
14
        { &hf_nan_attr_device_cap_supported_bands_sub_1ghz,
3630
14
            {
3631
14
            "Sub-1 GHz",
3632
14
            "wifi_nan.device_cap.supported_bands.sub_1ghz",
3633
14
            FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL
3634
14
            }
3635
14
        },
3636
14
        { &hf_nan_attr_device_cap_supported_bands_24ghz,
3637
14
            {
3638
14
            "2.4 GHz",
3639
14
            "wifi_nan.device_cap.supported_bands.24ghz",
3640
14
            FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL
3641
14
            }
3642
14
        },
3643
14
        { &hf_nan_attr_device_cap_supported_bands_reserved_36ghz,
3644
14
            {
3645
14
            "Reserved (for 3.6 GHz)",
3646
14
            "wifi_nan.device_cap.supported_bands.reserved_36ghz",
3647
14
            FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL
3648
14
            }
3649
14
        },
3650
14
        { &hf_nan_attr_device_cap_supported_bands_5ghz,
3651
14
            {
3652
14
            "4.9 and 5 GHz",
3653
14
            "wifi_nan.device_cap.supported_bands.5ghz",
3654
14
            FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
3655
14
            }
3656
14
        },
3657
14
        { &hf_nan_attr_device_cap_supported_bands_reserved_60ghz,
3658
14
            {
3659
14
            "Reserved (for 60 GHz)",
3660
14
            "wifi_nan.device_cap.supported_bands.reserved_60ghz",
3661
14
            FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL
3662
14
            }
3663
14
        },
3664
14
        { &hf_nan_attr_device_cap_supported_bands_reserved_45ghz,
3665
14
            {
3666
14
            "Reserved (for 45 GHz)",
3667
14
            "wifi_nan.device_cap.supported_bands.reserved_45ghz",
3668
14
            FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL
3669
14
            }
3670
14
        },
3671
14
        { &hf_nan_attr_device_cap_supported_bands_6ghz,
3672
14
            {
3673
14
            "6GHz",
3674
14
            "wifi_nan.device_cap.supported_bands.6ghz",
3675
14
            FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL
3676
14
            }
3677
14
        },
3678
14
        { &hf_nan_attr_device_cap_op_mode,
3679
14
            {
3680
14
            "Operation Mode",
3681
14
            "wifi_nan.device_cap.op_mode",
3682
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3683
14
            }
3684
14
        },
3685
14
        { &hf_nan_attr_device_cap_op_mode_phy_vht,
3686
14
            {
3687
14
            "PHY Mode (VHT/HT)",
3688
14
            "wifi_nan.device_cap.op_mode.phy.vht",
3689
14
            FT_BOOLEAN, 8, TFS(&device_cap_op_mode_phy_flags_vht), 0x01, NULL, HFILL
3690
14
            }
3691
14
        },
3692
14
        { &hf_nan_attr_device_cap_op_mode_phy_he,
3693
14
            {
3694
14
            "PHY Mode (HE)",
3695
14
            "wifi_nan.device_cap.op_mode.phy.he",
3696
14
            FT_BOOLEAN, 8, TFS(&device_cap_op_mode_phy_flags_he), 0x10, NULL, HFILL
3697
14
            }
3698
14
        },
3699
14
        { &hf_nan_attr_device_cap_op_mode_phy_he_vht8080,
3700
14
            {
3701
14
            "HE/VHT 80+80",
3702
14
            "wifi_nan.device_cap.op_mode.vht8080",
3703
14
            FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL
3704
14
            }
3705
14
        },
3706
14
        { &hf_nan_attr_device_cap_op_mode_phy_he_vht160,
3707
14
            {
3708
14
            "HE/VHT 160",
3709
14
            "wifi_nan.device_cap.op_mode.vht160",
3710
14
            FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL
3711
14
            }
3712
14
        },
3713
14
        { &hf_nan_attr_device_cap_op_mode_reserved_paging_ndl,
3714
14
            {
3715
14
            "Reserved (Paging NDL Support)",
3716
14
            "wifi_nan.device_cap.op_mode.reserved_paging_ndl",
3717
14
            FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL
3718
14
            }
3719
14
        },
3720
14
        { &hf_nan_attr_device_cap_antennas,
3721
14
            {
3722
14
            "Antennas",
3723
14
            "wifi_nan.device_cap.antennas",
3724
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3725
14
            }
3726
14
        },
3727
14
        { &hf_nan_attr_device_cap_antennas_tx,
3728
14
            {
3729
14
            "Number of TX antennas",
3730
14
            "wifi_nan.device_cap.antennas.tx",
3731
14
            FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL
3732
14
            }
3733
14
        },
3734
14
        { &hf_nan_attr_device_cap_antennas_rx,
3735
14
            {
3736
14
            "Number of RX antennas",
3737
14
            "wifi_nan.device_cap.antennas.rx",
3738
14
            FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL
3739
14
            }
3740
14
        },
3741
14
        { &hf_nan_attr_device_cap_max_channel_switch_time,
3742
14
            {
3743
14
            "Max Channel Switch Time (us)",
3744
14
            "wifi_nan.device_cap.max_channel_switch_time",
3745
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3746
14
            }
3747
14
        },
3748
14
        { &hf_nan_attr_device_cap_capabilities,
3749
14
            {
3750
14
            "Capabilities",
3751
14
            "wifi_nan.device_cap.capabilities",
3752
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3753
14
            }
3754
14
        },
3755
14
        { &hf_nan_attr_device_cap_capabilities_dfs_master,
3756
14
            {
3757
14
            "DFS Master",
3758
14
            "wifi_nan.device_cap.capabilities.dfs_master",
3759
14
            FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL
3760
14
            }
3761
14
        },
3762
14
        { &hf_nan_attr_device_cap_capabilities_extended_key_id,
3763
14
            {
3764
14
            "Extended key ID",
3765
14
            "wifi_nan.device_cap.capabilities.extended_key_id",
3766
14
            FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL
3767
14
            }
3768
14
        },
3769
14
        { &hf_nan_attr_device_cap_capabilities_simul_ndp_reception,
3770
14
            {
3771
14
            "Simultaneous NDP data reception",
3772
14
            "wifi_nan.device_cap.capabilities.simul_ndp_reception",
3773
14
            FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL
3774
14
            }
3775
14
        },
3776
14
        { &hf_nan_attr_device_cap_capabilities_ndpe_attr_support,
3777
14
            {
3778
14
            "NDPE attribute support",
3779
14
            "wifi_nan.device_cap.capabilities.ndpe_attr_support",
3780
14
            FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL
3781
14
            }
3782
14
        },
3783
14
        { &hf_nan_attr_device_cap_capabilities_s3_capable,
3784
14
            {
3785
14
            "S3 Capable",
3786
14
            "wifi_nan.device_cap.capabilities.s3_capable",
3787
14
            FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
3788
14
            }
3789
14
        },
3790
14
        { &hf_nan_attr_ndp_type,
3791
14
             {
3792
14
             "Type",
3793
14
             "wifi_nan.ndp.type",
3794
14
             FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(ndp_type_values), 0xF, NULL, HFILL
3795
14
             }
3796
14
        },
3797
14
        { &hf_nan_attr_ndp_initiator,
3798
14
            {
3799
14
            "Initiator NDI",
3800
14
            "wifi_nan.ndp.initiator_ndi",
3801
14
            FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3802
14
            }
3803
14
        },
3804
14
        { &hf_nan_attr_ndp_id,
3805
14
             {
3806
14
             "NDP ID",
3807
14
             "wifi_nan.ndp.id",
3808
14
             FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3809
14
             }
3810
14
        },
3811
14
        { &hf_nan_attr_ndp_ctrl_confirm,
3812
14
             {
3813
14
             "Confirm Required",
3814
14
             "wifi_nan.ndp.ctrl.confirm",
3815
14
             FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
3816
14
             }
3817
14
        },
3818
14
        { &hf_nan_attr_ndp_ctrl_security_pres,
3819
14
             {
3820
14
             "Security Present",
3821
14
             "wifi_nan.ndp.ctrl.security_pres",
3822
14
             FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
3823
14
             }
3824
14
        },
3825
14
        { &hf_nan_attr_ndp_ctrl_publish_id_pres,
3826
14
             {
3827
14
             "Publish ID Present",
3828
14
             "wifi_nan.ndp.ctrl.publish_id_pres",
3829
14
             FT_BOOLEAN, 8, NULL, 0x8, NULL, HFILL
3830
14
             }
3831
14
        },
3832
14
        { &hf_nan_attr_ndp_ctrl_responder_ndi_pres,
3833
14
             {
3834
14
             "Responder NDI Present",
3835
14
             "wifi_nan.ndp.ctrl.responder_ndi_pres",
3836
14
             FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
3837
14
             }
3838
14
        },
3839
14
        { &hf_nan_attr_ndp_ctrl_sepcific_info_pres,
3840
14
             {
3841
14
             "NDP Specific Info Present",
3842
14
             "wifi_nan.ndp.ctrl.specific_info_pres",
3843
14
             FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL
3844
14
             }
3845
14
        },
3846
14
        { &hf_nan_attr_ndpe_ctrl_confirm,
3847
14
             {
3848
14
             "Confirm Required",
3849
14
             "wifi_nan.ndpe.ctrl.confirm",
3850
14
             FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
3851
14
             }
3852
14
        },
3853
14
        { &hf_nan_attr_ndpe_ctrl_security_pres,
3854
14
             {
3855
14
             "Security Present",
3856
14
             "wifi_nan.ndpe.ctrl.security_pres",
3857
14
             FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
3858
14
             }
3859
14
        },
3860
14
        { &hf_nan_attr_ndpe_ctrl_publish_id_pres,
3861
14
             {
3862
14
             "Publish ID Present",
3863
14
             "wifi_nan.ndpe.ctrl.publish_id_pres",
3864
14
             FT_BOOLEAN, 8, NULL, 0x8, NULL, HFILL
3865
14
             }
3866
14
        },
3867
14
        { &hf_nan_attr_ndpe_ctrl_responder_ndi_pres,
3868
14
             {
3869
14
             "Responder NDI Present",
3870
14
             "wifi_nan.ndpe.ctrl.responder_ndi_pres",
3871
14
             FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
3872
14
             }
3873
14
        },
3874
14
        { &hf_nan_attr_ndpe_ctrl_gtk_requried,
3875
14
             {
3876
14
             "GTK Required",
3877
14
             "wifi_nan.ndpe.ctrl.gtk_required",
3878
14
             FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL
3879
14
             }
3880
14
        },
3881
14
        { &hf_nan_attr_ndp_control,
3882
14
             {
3883
14
             "NDP Control",
3884
14
             "wifi_nan.ndp.ctrl",
3885
14
             FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3886
14
             }
3887
14
        },
3888
14
        { &hf_nan_attr_ndpe_control,
3889
14
             {
3890
14
             "NDPE Control",
3891
14
             "wifi_nan.ndpe.ctrl",
3892
14
             FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3893
14
             }
3894
14
        },
3895
14
        { &hf_nan_attr_ndp_responder_ndi,
3896
14
             {
3897
14
             "Responder NDI",
3898
14
             "wifi_nan.ndp.responder.ndi",
3899
14
             FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3900
14
             }
3901
14
        },
3902
14
        { &hf_nan_attr_ndp_specific_info,
3903
14
             {
3904
14
             "NDP Specific Info",
3905
14
             "wifi_nan.ndp.specific_info",
3906
14
             FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3907
14
             }
3908
14
        },
3909
14
        { &hf_nan_attr_ndpe_tlv_type,
3910
14
             {
3911
14
             "Type",
3912
14
             "wifi_nan.ndpe.tlv.type",
3913
14
             FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(ndpe_tlv_type_values), 0x0, NULL, HFILL
3914
14
             }
3915
14
        },
3916
14
        { &hf_nan_attr_ndpe_tlv_len,
3917
14
             {
3918
14
             "Length",
3919
14
             "wifi_nan.ndpe.tlv.len",
3920
14
             FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3921
14
             }
3922
14
        },
3923
14
        { &hf_nan_attr_ndpe_tlv_ipv6_interface_identifier,
3924
14
             {
3925
14
             "Interface Identifier",
3926
14
             "wifi_nan.ndpe.tlv.ipv6_interface_identifier",
3927
14
             FT_BYTES, SEP_COLON, NULL, 0x0, NULL, HFILL
3928
14
             }
3929
14
        },
3930
14
        { &hf_nan_attr_availability_sequence_id,
3931
14
            {
3932
14
            "Sequence ID",
3933
14
            "wifi_nan.availability.sequence_id",
3934
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3935
14
            }
3936
14
        },
3937
14
        { &hf_nan_attr_availability_ctr,
3938
14
            {
3939
14
            "Attribute Control",
3940
14
            "wifi_nan.availability.ctr",
3941
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
3942
14
            }
3943
14
        },
3944
14
        { &hf_nan_attr_availability_map_id,
3945
14
            {
3946
14
            "Map ID",
3947
14
            "wifi_nan.availability.map_id",
3948
14
            FT_UINT16, BASE_HEX_DEC, NULL, 0x000F, NULL, HFILL
3949
14
            }
3950
14
        },
3951
14
        { &hf_nan_attr_availability_committed_changed,
3952
14
            {
3953
14
            "Committed Changed",
3954
14
            "wifi_nan.availability.committed_changed",
3955
14
            FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL
3956
14
            }
3957
14
        },
3958
14
        { &hf_nan_attr_availability_potential_changed,
3959
14
            {
3960
14
            "Potential Changed",
3961
14
            "wifi_nan.availability.potential_changed",
3962
14
            FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL
3963
14
            }
3964
14
        },
3965
14
        { &hf_nan_attr_availability_public_availability_changed,
3966
14
            {
3967
14
            "Public Availability Attribute Changed",
3968
14
            "wifi_nan.availability.public_availability_changed",
3969
14
            FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL
3970
14
            }
3971
14
        },
3972
14
        { &hf_nan_attr_availability_ndc_changed,
3973
14
            {
3974
14
            "NDC Attribute Changed",
3975
14
            "wifi_nan.availability.ndc_changed",
3976
14
            FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL
3977
14
            }
3978
14
        },
3979
14
        { &hf_nan_attr_availability_reserved_multicast_schedule_changed,
3980
14
            {
3981
14
            "Reserved (Multicast Schedule Attribute Changed)",
3982
14
            "wifi_nan.availability.reserved_multicast_schedule_changed",
3983
14
            FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL
3984
14
            }
3985
14
        },
3986
14
        { &hf_nan_attr_availability_reserved_multicast_schedule_change_changed,
3987
14
            {
3988
14
            "Reserved (Multicast Schedule Change Attribute Change Changed)",
3989
14
            "wifi_nan.availability.reserved_multicast_schedule_change_changed",
3990
14
            FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL
3991
14
            }
3992
14
        },
3993
14
        { &hf_nan_attr_availability_entry_len,
3994
14
            {
3995
14
            "Length",
3996
14
            "wifi_nan.availability.entry.len",
3997
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3998
14
            }
3999
14
        },
4000
14
        { &hf_nan_attr_availability_entry_ctr,
4001
14
            {
4002
14
            "Entry Control",
4003
14
            "wifi_nan.availability.entry.ctr",
4004
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
4005
14
            }
4006
14
        },
4007
14
        { &hf_nan_attr_availability_entry_ctr_type,
4008
14
            {
4009
14
            "Availability Type",
4010
14
            "wifi_nan.availability.entry.ctr.type",
4011
14
            FT_UINT16, BASE_HEX, VALS(availability_entry_type), 0x0007, NULL, HFILL
4012
14
            }
4013
14
        },
4014
14
        { &hf_nan_attr_availability_entry_ctr_pref,
4015
14
            {
4016
14
            "Usage Preference",
4017
14
            "wifi_nan.availability.entry.ctr.pref",
4018
14
            FT_UINT16, BASE_DEC, NULL, 0x0018, NULL, HFILL
4019
14
            }
4020
14
        },
4021
14
        { &hf_nan_attr_availability_entry_ctr_utilization,
4022
14
            {
4023
14
            "Utilization",
4024
14
            "wifi_nan.availability.entry.ctr.utilization",
4025
14
            FT_UINT16, BASE_DEC, NULL, 0x00E0, NULL, HFILL
4026
14
            }
4027
14
        },
4028
14
        { &hf_nan_attr_availability_entry_ctr_rx_nss,
4029
14
            {
4030
14
            "Rx Nss",
4031
14
            "wifi_nan.availability.entry.ctr.rx_nss",
4032
14
            FT_UINT16, BASE_DEC, NULL, 0x0F00, NULL, HFILL
4033
14
            }
4034
14
        },
4035
14
        { &hf_nan_attr_availability_entry_ctr_time_bitmap,
4036
14
            {
4037
14
            "Time Bitmap Present",
4038
14
            "wifi_nan.availability.entry.ctr.time_bitmap",
4039
14
            FT_BOOLEAN, 16, NULL, 0x1000, NULL, HFILL
4040
14
            }
4041
14
        },
4042
14
        { &hf_nan_attr_availability_entry_entries_type,
4043
14
            {
4044
14
            "Type",
4045
14
            "wifi_nan.availability.entry.entries.type",
4046
14
            FT_BOOLEAN, BASE_NONE, TFS(&availability_entry_entries_type_flags), 0x0, NULL, HFILL
4047
14
            }
4048
14
        },
4049
14
        { &hf_nan_attr_availability_entry_entries_non_contiguous_bw,
4050
14
            {
4051
14
            "Non-contiguous Bandwidth",
4052
14
            "wifi_nan.availability.entry.entries.non_contiguous_bw",
4053
14
            FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL
4054
14
            }
4055
14
        },
4056
14
        { &hf_nan_attr_availability_entry_entries_num_entries,
4057
14
            {
4058
14
            "Number of Entries",
4059
14
            "wifi_nan.availability.entry.entries.num_entries",
4060
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4061
14
            }
4062
14
        },
4063
14
        { &hf_nan_attr_availability_entry_entries_band,
4064
14
            {
4065
14
            "Band Entry",
4066
14
            "wifi_nan.availability.entry.entries.band",
4067
14
            FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(availability_entry_entries_band_type), 0x0, NULL, HFILL
4068
14
            }
4069
14
        },
4070
14
        { &hf_nan_attr_availability_entry_entries_channel_op_class,
4071
14
            {
4072
14
            "Operating Class",
4073
14
            "wifi_nan.availability.entry.entries.channel.op_class",
4074
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4075
14
            }
4076
14
        },
4077
14
        { &hf_nan_attr_availability_entry_entries_channel_bitmap,
4078
14
            {
4079
14
            "Channel Bitmap",
4080
14
            "wifi_nan.availability.entry.entries.channel.bitmap",
4081
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
4082
14
            }
4083
14
        },
4084
14
        { &hf_nan_attr_availability_entry_entries_primary_channel_bitmap,
4085
14
            {
4086
14
            "Primary Channel Bitmap",
4087
14
            "wifi_nan.availability.entry.entries.channel.primary_bitmap",
4088
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4089
14
            }
4090
14
        },
4091
14
        { &hf_nan_attr_availability_entry_entries_aux_channel_bitmap,
4092
14
            {
4093
14
            "Auxiliary Channel Bitmap",
4094
14
            "wifi_nan.availability.entry.entries.channel.aux_bitmap",
4095
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
4096
14
            }
4097
14
        },
4098
14
        { &hf_nan_attr_availability_entry_entries_channel_set,
4099
14
            {
4100
14
            "Channel Bitmap - Channel Set",
4101
14
            "wifi_nan.ava.chan.set",
4102
14
            FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL
4103
14
            }
4104
14
        },
4105
14
        { &hf_nan_attr_availability_entry_entries_start_channel_number,
4106
14
            {
4107
14
            "Start Channel Number",
4108
14
            "wifi_nan.availability.entry.entries.channel.start_channel_number",
4109
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4110
14
            }
4111
14
        },
4112
14
        { &hf_nan_attr_availability_entry_entries_number_of_ch_included,
4113
14
            {
4114
14
            "Number of Channels Included",
4115
14
            "wifi_nan.availability.entry.entries.channel.num_of_channel",
4116
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4117
14
            }
4118
14
        },
4119
14
        { &hf_nan_attr_availability_entry_entries_start_freq,
4120
14
            {
4121
14
            "Starting Frequency",
4122
14
            "wifi_nan.av.entry.start.freq",
4123
14
            FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(op_starting_freq), 0x0, NULL, HFILL
4124
14
            }
4125
14
        },
4126
14
        { &hf_nan_attr_availability_entry_entries_bandwidth,
4127
14
            {
4128
14
            "Bandwidth",
4129
14
            "wifi_nan.av.entry.bandwidth",
4130
14
            FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(op_channel_spacing), 0x0, NULL, HFILL
4131
14
            }
4132
14
        },
4133
14
        { &hf_nan_attr_ndc_id,
4134
14
            {
4135
14
            "NDC ID",
4136
14
            "wifi_nan.ndc.id",
4137
14
            FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4138
14
            }
4139
14
        },
4140
14
        { &hf_nan_attr_ndc_ctrl,
4141
14
            {
4142
14
            "Control",
4143
14
            "wifi_nan.ndc.ctrl",
4144
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4145
14
            }
4146
14
        },
4147
14
        { &hf_nan_attr_ndc_ctrl_selected,
4148
14
            {
4149
14
            "Selected NDC",
4150
14
            "wifi_nan.ndc.ctrl.selected",
4151
14
            FT_BOOLEAN, 8, TFS(&ndc_ctr_selected_flags), 0x01, NULL, HFILL
4152
14
            }
4153
14
        },
4154
14
        { &hf_nan_attr_ndc_map_id_related_sch,
4155
14
            {
4156
14
            "NAN Availability associated with schedule time bitmap",
4157
14
            "wifi_nan.ndc.map.id.rel",
4158
14
            FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL
4159
14
            }
4160
14
        },
4161
14
        { &hf_nan_attr_ndl_type,
4162
14
             {
4163
14
             "Type",
4164
14
             "wifi_nan.ndl.type",
4165
14
             FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(ndl_type_values), 0xF, NULL, HFILL
4166
14
             }
4167
14
        },
4168
14
        { &hf_nan_attr_ndl_control,
4169
14
             {
4170
14
             "NDL Control",
4171
14
             "wifi_nan.ndl.ctrl",
4172
14
             FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4173
14
             }
4174
14
        },
4175
14
        { &hf_nan_attr_ndl_ctrl_peer_id,
4176
14
            {
4177
14
            "NDL Peer ID Present",
4178
14
            "wifi_nan.ndl.ctrl.peer_id",
4179
14
            FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
4180
14
            }
4181
14
        },
4182
14
        { &hf_nan_attr_ndl_ctrl_immutable_schedule_pres,
4183
14
            {
4184
14
            "Immutable Schedule Present",
4185
14
            "wifi_nan.ndl.ctrl.immutable_schedule_pres",
4186
14
            FT_BOOLEAN, 8, NULL, 0x2, NULL, HFILL
4187
14
            }
4188
14
        },
4189
14
        { &hf_nan_attr_ndl_ctrl_ndc_pres,
4190
14
            {
4191
14
            "NDC Attribute Present",
4192
14
            "wifi_nan.ndl.ctrl.ndc_pres",
4193
14
            FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
4194
14
            }
4195
14
        },
4196
14
        { &hf_nan_attr_ndl_ctrl_qos,
4197
14
            {
4198
14
            "NDL QoS Present",
4199
14
            "wifi_nan.ndl.ctrl.qos_pres",
4200
14
            FT_BOOLEAN, 8, NULL, 0x8, NULL, HFILL
4201
14
            }
4202
14
        },
4203
14
        { &hf_nan_attr_ndl_ctrl_max_idle_pres,
4204
14
            {
4205
14
            "Max Idle period Present",
4206
14
            "wifi_nan.ndl.ctrl.max_idle_period_pres",
4207
14
            FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
4208
14
            }
4209
14
        },
4210
14
        { &hf_nan_attr_ndl_ctrl_type,
4211
14
            {
4212
14
            "NDL Type",
4213
14
            "wifi_nan.ndl.ctrl.type",
4214
14
            FT_UINT8, BASE_DEC, VALS(ndl_type_string), 0x20, NULL, HFILL
4215
14
            }
4216
14
        },
4217
14
        { &hf_nan_attr_ndl_ctrl_setup_reason,
4218
14
            {
4219
14
            "NDL Setup Reason",
4220
14
            "wifi_nan.ndl.ctrl.setup_reason",
4221
14
            FT_UINT8, BASE_DEC, VALS(ndl_setup_reason), 0xC0, NULL, HFILL
4222
14
            }
4223
14
        },
4224
14
        { &hf_nan_attr_ndl_reserved_peer_id,
4225
14
            {
4226
14
            "Reserved (NDL Peer ID)",
4227
14
            "wifi_nan.ndl.peer_id",
4228
14
            FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL
4229
14
            }
4230
14
        },
4231
14
        { &hf_nan_attr_ndl_max_idle,
4232
14
            {
4233
14
            "Max Idle Period",
4234
14
            "wifi_nan.ndl.max.idle",
4235
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4236
14
            }
4237
14
        },
4238
14
        { &hf_nan_attr_ndlqos_min_time_slots,
4239
14
            {
4240
14
            "Minimum Time Slots",
4241
14
            "wifi_nan.ndl_qos.min_time_slots",
4242
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4243
14
            }
4244
14
        },
4245
14
        { &hf_nan_attr_ndlqos_max_latency,
4246
14
            {
4247
14
            "Maximum Latency",
4248
14
            "wifi_nan.ndl_qos.max_latency",
4249
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4250
14
            }
4251
14
        },
4252
14
        { &hf_nan_attr_unaligned_sch_ctrl,
4253
14
             {
4254
14
             "Attribute Control",
4255
14
             "wifi_nan.unaligned_schedule.ctrl",
4256
14
             FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
4257
14
             }
4258
14
        },
4259
14
        { &hf_nan_attr_unaligned_sch_ctrl_schedule_id,
4260
14
            {
4261
14
            "Schedule ID",
4262
14
            "wifi_nan.unaligned_schedule.ctrl.schedule_id",
4263
14
            FT_UINT16, BASE_HEX_DEC, NULL, 0xF, NULL, HFILL
4264
14
            }
4265
14
        },
4266
14
        { &hf_nan_attr_unaligned_sch_ctrl_seq_id,
4267
14
            {
4268
14
            "Sequence ID",
4269
14
            "wifi_nan.unaligned_schedule.ctrl.sequence_id",
4270
14
            FT_UINT16, BASE_HEX_DEC, NULL, 0x0F00, NULL, HFILL
4271
14
            }
4272
14
        },
4273
14
        { &hf_nan_attr_unaligned_sch_starting_time,
4274
14
            {
4275
14
            "Starting Time",
4276
14
            "wifi_nan.unaligned_schedule.starting_time",
4277
14
            FT_UINT32, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
4278
14
            }
4279
14
        },
4280
14
        { &hf_nan_attr_unaligned_sch_duration,
4281
14
            {
4282
14
            "Duration",
4283
14
            "wifi_nan.unaligned_schedule.duration",
4284
14
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
4285
14
            }
4286
14
        },
4287
14
        { &hf_nan_attr_unaligned_sch_period,
4288
14
            {
4289
14
            "Period",
4290
14
            "wifi_nan.unaligned_schedule.period",
4291
14
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
4292
14
            }
4293
14
        },
4294
14
        { &hf_nan_attr_unaligned_sch_count_down,
4295
14
            {
4296
14
            "Count Down",
4297
14
            "wifi_nan.unaligned_schedule.count_down",
4298
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4299
14
            }
4300
14
        },
4301
14
        { &hf_nan_attr_unaligned_sch_ulw_overwrite,
4302
14
             {
4303
14
             "ULW Overwrite",
4304
14
             "wifi_nan.unaligned_schedule.ulw_overwrite",
4305
14
             FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4306
14
             }
4307
14
        },
4308
14
        { &hf_nan_attr_unaligned_sch_ulw_overwrite_all,
4309
14
             {
4310
14
             "Overwrite All",
4311
14
             "wifi_nan.unaligned_schedule.ulw_overwrite.overwrite_all",
4312
14
             FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
4313
14
             }
4314
14
        },
4315
14
        { &hf_nan_attr_unaligned_sch_ulw_overwrite_map_id,
4316
14
             {
4317
14
             "Map ID",
4318
14
             "wifi_nan.unaligned_schedule.ulw_overwrite.map_id",
4319
14
             FT_UINT8, BASE_HEX_DEC, NULL, 0x1E, NULL, HFILL
4320
14
             }
4321
14
        },
4322
14
        { &hf_nan_attr_unaligned_sch_ulw_ctrl,
4323
14
             {
4324
14
             "ULW Control Field",
4325
14
             "wifi_nan.attribute.ulw.ctrl",
4326
14
             FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4327
14
             }
4328
14
        },
4329
14
        { &hf_nan_attr_unaligned_sch_ulw_ctrl_type,
4330
14
             {
4331
14
             "Type",
4332
14
             "wifi_nan.unaligned_schedule.ulw_ctrl.type",
4333
14
             FT_UINT8, BASE_DEC_HEX, VALS(unaligned_sch_ulw_type), 0x3, NULL, HFILL
4334
14
             }
4335
14
        },
4336
14
        { &hf_nan_attr_unaligned_sch_ulw_ctrl_channel_av,
4337
14
             {
4338
14
             "Channel Availability",
4339
14
             "wifi_nan.unaligned_schedule.ulw_ctrl.channel_availability",
4340
14
             FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL
4341
14
             }
4342
14
        },
4343
14
        { &hf_nan_attr_unaligned_sch_ulw_ctrl_rxnss,
4344
14
             {
4345
14
             "Rx Nss",
4346
14
             "wifi_nan.unaligned_schedule.ulw_ctrl.rx_nss",
4347
14
             FT_UINT8, BASE_HEX, NULL, 0x78, NULL, HFILL
4348
14
             }
4349
14
        },
4350
14
        { &hf_nan_attr_ranging_info_location_info_avail,
4351
14
            {
4352
14
            "Location Info Availability",
4353
14
            "wifi_nan.ranging_info.location_info_availability",
4354
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4355
14
            }
4356
14
        },
4357
14
        { &hf_nan_attr_ranging_info_location_info_avail_lci,
4358
14
             {
4359
14
             "LCI Local Coordinates",
4360
14
             "wifi_nan.ranging_info.location_info_availability.local_coord",
4361
14
             FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
4362
14
             }
4363
14
        },
4364
14
        { &hf_nan_attr_ranging_info_location_info_avail_geospatial,
4365
14
             {
4366
14
             "Geospatial LCI WGS84",
4367
14
             "wifi_nan.ranging_info.location_info_availability.geospatial",
4368
14
             FT_BOOLEAN, 8, NULL, 0x2, NULL, HFILL
4369
14
             }
4370
14
        },
4371
14
        { &hf_nan_attr_ranging_info_location_info_avail_civic_location,
4372
14
             {
4373
14
             "Civic Location",
4374
14
             "wifi_nan.ranging_info.location_info_availability.civic_location",
4375
14
             FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
4376
14
             }
4377
14
        },
4378
14
        { &hf_nan_attr_ranging_info_location_info_avail_last_movement_pres,
4379
14
             {
4380
14
             "Last Movement Indication",
4381
14
             "wifi_nan.ranging_info.location_info_availability.last_movement_indication",
4382
14
             FT_BOOLEAN, 8, NULL, 0x8, NULL, HFILL
4383
14
             }
4384
14
        },
4385
14
        { &hf_nan_attr_ranging_info_last_movement_indication,
4386
14
            {
4387
14
            "Last Movement Indication",
4388
14
            "wifi_nan.ranging_info.last_movement_indication",
4389
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4390
14
            }
4391
14
        },
4392
14
        { &hf_nan_attr_ranging_setup_type,
4393
14
             {
4394
14
             "Type",
4395
14
             "wifi_nan.ranging_setup.type",
4396
14
             FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(ranging_setup_type_values), 0xF, NULL, HFILL
4397
14
             }
4398
14
        },
4399
14
        { &hf_nan_attr_ranging_setup_ctrl,
4400
14
            {
4401
14
            "Ranging Control",
4402
14
            "wifi_nan.ranging_setup.ctrl",
4403
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4404
14
            }
4405
14
        },
4406
14
        { &hf_nan_attr_ranging_setup_ctrl_report_req,
4407
14
            {
4408
14
            "Ranging Report Required",
4409
14
            "wifi_nan.ranging_setup.ctrl.report_required",
4410
14
            FT_BOOLEAN, 3, NULL, 0x1, NULL, HFILL
4411
14
            }
4412
14
        },
4413
14
        { &hf_nan_attr_ranging_setup_ctrl_ftm_params,
4414
14
            {
4415
14
            "FTM Parameters Present",
4416
14
            "wifi_nan.ranging_setup.ctrl.ftm_params",
4417
14
            FT_BOOLEAN, 3, NULL, 0x2, NULL, HFILL
4418
14
            }
4419
14
        },
4420
14
        { &hf_nan_attr_ranging_setup_ctrl_entry_list,
4421
14
            {
4422
14
            "Ranging Schedule Entry List Present",
4423
14
            "wifi_nan.ranging_setup.ctrl.sch_entry_pres",
4424
14
            FT_BOOLEAN, 3, NULL, 0x4, NULL, HFILL
4425
14
            }
4426
14
        },
4427
14
        { &hf_nan_attr_ranging_setup_ftm_params,
4428
14
            {
4429
14
            "FTM Parameters",
4430
14
            "wifi_nan.ranging_setup.ftm",
4431
14
            FT_UINT24, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
4432
14
            }
4433
14
        },
4434
14
        { &hf_nan_attr_ranging_setup_ftm_max_burst_duration,
4435
14
             {
4436
14
             "Max Burst Duration",
4437
14
             "wifi_nan.ranging_setup.ftm.max_burst_duration",
4438
14
             FT_UINT24, BASE_HEX_DEC, NULL, 0xF, NULL, HFILL
4439
14
             }
4440
14
        },
4441
14
        { &hf_nan_attr_ranging_setup_ftm_min_delta,
4442
14
             {
4443
14
             "Min Delta FTM",
4444
14
             "wifi_nan.ranging_setup.ftm.min_delta_ftm",
4445
14
             FT_UINT24, BASE_HEX_DEC, NULL, 0x03F0, NULL, HFILL
4446
14
             }
4447
14
        },
4448
14
        { &hf_nan_attr_ranging_setup_ftm_max_per_burst,
4449
14
             {
4450
14
             "Max FTMs per Burst",
4451
14
             "wifi_nan.ranging_setup.ftm.max_ftms_per_burst",
4452
14
             FT_UINT24, BASE_HEX_DEC, NULL, 0x7C00, NULL, HFILL
4453
14
             }
4454
14
        },
4455
14
        { &hf_nan_attr_ranging_setup_ftm_format_bw,
4456
14
             {
4457
14
             "FTM Format and Bandwidth",
4458
14
             "wifi_nan.ranging_setup.ftm.format_bw",
4459
14
             FT_UINT24, BASE_HEX_DEC, NULL, 0x1F8000, NULL, HFILL
4460
14
             }
4461
14
        },
4462
14
        { &hf_nan_attr_ftm_range_report,
4463
14
             {
4464
14
             "FTM Range Report",
4465
14
             "wifi_nan.ftm.range_report",
4466
14
             FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4467
14
             }
4468
14
        },
4469
14
        { &hf_nan_attr_cipher_suite_capabilities,
4470
14
            {
4471
14
            "Capabilities",
4472
14
            "wifi_nan.cipher_suite.capabilities",
4473
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4474
14
            }
4475
14
        },
4476
14
        { &hf_nan_attr_cipher_suite_capabilities_ndtksa_nmtksa_replay_counters,
4477
14
            {
4478
14
            "ND-TKSA and NM-TKSA Replay Counters",
4479
14
            "wifi_nan.cipher_suite.capabilities.replay_counters.ndtksa",
4480
14
            FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_nd_nm_tksa_replay_counters), 0x01, NULL, HFILL
4481
14
            }
4482
14
        },
4483
14
        { &hf_nan_attr_cipher_suite_capabilities_gtksa_igtksa_bigtksa_support,
4484
14
            {
4485
14
            "GTKSA, IGTKSA, and BIGTKSA Support",
4486
14
            "wifi_nan.cipher_suite.capabilities.group_key_support",
4487
14
            FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_group_and_integrity_sa_support), 0x06, NULL, HFILL
4488
14
            }
4489
14
        },
4490
14
        { &hf_nan_attr_cipher_suite_capabilities_gtksa_replay_counters,
4491
14
            {
4492
14
            "GTKSA Replay Counters",
4493
14
            "wifi_nan.cipher_suite.capabilities.replay_counters.gtksa",
4494
14
            FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_gtksa_replay_counters), 0x08, NULL, HFILL
4495
14
            }
4496
14
        },
4497
14
        { &hf_nan_attr_cipher_suite_capabilities_igtksa_bigtksa_cipher,
4498
14
            {
4499
14
            "IGTKSA and BIGTKSA Cipher",
4500
14
            "wifi_nan.cipher_suite.capabilities.integrity_key_cipher",
4501
14
            FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_integrity_sa_ciphers), 0x10, NULL, HFILL
4502
14
            }
4503
14
        },
4504
14
        { &hf_nan_attr_cipher_suite_id,
4505
14
            {
4506
14
            "Cipher Suite ID",
4507
14
            "wifi_nan.cipher_suite.id",
4508
14
            FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL
4509
14
            }
4510
14
        },
4511
14
        { &hf_nan_attr_security_context_identifier,
4512
14
            {
4513
14
            "Security Context Identifier",
4514
14
            "wifi_nan.security_context.identifier",
4515
14
            FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4516
14
            }
4517
14
        },
4518
14
        { &hf_nan_attr_security_context_identifier_len,
4519
14
            {
4520
14
            "Security Context Identifier Length",
4521
14
            "wifi_nan.security_context.identifier_len",
4522
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4523
14
            }
4524
14
        },
4525
14
        { &hf_nan_attr_security_context_identifier_type,
4526
14
            {
4527
14
            "Security Context Identifier Type",
4528
14
            "wifi_nan.security_context.identifier_type",
4529
14
            FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(security_context_iden_type), 0x0, NULL, HFILL
4530
14
            }
4531
14
        },
4532
14
        { &hf_nan_attr_shared_key_rsna_descriptor,
4533
14
             {
4534
14
             "IEEE 802.11 RSNA Key Descriptor",
4535
14
             "wifi_nan.shared_key.rsna_key_descriptor",
4536
14
             FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4537
14
             }
4538
14
        },
4539
14
        { &hf_nan_attr_vendor_specific_body,
4540
14
            {
4541
14
            "Body",
4542
14
            "wifi_nan.vendor_specific.body",
4543
14
            FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4544
14
            }
4545
14
        },
4546
14
        { &hf_nan_attr_container_element_id,
4547
14
            {
4548
14
            "Element Id",
4549
14
            "wifi_nan.container.element.id",
4550
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4551
14
            }
4552
14
        },
4553
14
        { &hf_nan_attr_container_element_len,
4554
14
            {
4555
14
            "Element Length",
4556
14
            "wifi_nan.container.element.len",
4557
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4558
14
            }
4559
14
        },
4560
14
        { &hf_nan_attr_device_capability_extension,
4561
14
            {
4562
14
                "Capability Extension",
4563
14
                "wifi_nan.device_capability_extension.capability_info",
4564
14
                FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
4565
14
            }
4566
14
        },
4567
14
        { &hf_nan_attr_device_capability_extension_6g_regulatory_info_presented,
4568
14
            {
4569
14
                "6GHz Regulatory Info Presented",
4570
14
                "wifi_nan.device_capability_extension.6g_regulatory_presented",
4571
14
                FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL
4572
14
            }
4573
14
        },
4574
14
        { &hf_nan_attr_device_capability_extension_6g_regulatory_info,
4575
14
            {
4576
14
                "6GHz Regulatory Info",
4577
14
                "wifi_nan.device_capability_extension.6g_regulatory",
4578
14
                FT_UINT16, BASE_HEX_DEC, VALS(device_capability_extension_6g_regulatoty_info), 0x000e, NULL, HFILL
4579
14
            }
4580
14
        },
4581
14
        { &hf_nan_attr_device_capability_extension_6g_regulatory_info_reserved,
4582
14
            {
4583
14
                "Reserved for 6GHz Regulatory Info",
4584
14
                "wifi_nan.device_capability_extension.6g_regulatory_reserved",
4585
14
                FT_UINT16, BASE_HEX_DEC, NULL, 0x00f0, NULL, HFILL
4586
14
            }
4587
14
        },
4588
14
        { &hf_nan_attr_device_capability_extension_paring_setup_enabled,
4589
14
            {
4590
14
                "Paring Enable",
4591
14
                "wifi_nan.device_capability_extension.paring_enable",
4592
14
                FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL
4593
14
            }
4594
14
        },
4595
14
        { &hf_nan_attr_device_capability_extension_npk_nik_cache_enabled,
4596
14
            {
4597
14
                "NPK/NIK Caching Enable",
4598
14
                "wifi_nan.device_capability_extension.npk_nik_caching_enable",
4599
14
                FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL
4600
14
            }
4601
14
        },
4602
14
        { &hf_nan_attr_identity_cipher_version,
4603
14
            {
4604
14
                "Cipher Version",
4605
14
                "wifi_nan.identity_resolution.cipher_version",
4606
14
                FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(nan_identity_resolution_cipher_version), 0x0, NULL, HFILL
4607
14
            }
4608
14
        },
4609
14
        { &hf_nan_attr_identity_resolution_nonce,
4610
14
            {
4611
14
                "Nonce",
4612
14
                "wifi_nan.identity_resolution.nonce",
4613
14
                FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4614
14
            }
4615
14
        },
4616
14
        { &hf_nan_attr_identity_resolution_tag,
4617
14
            {
4618
14
                "Tag",
4619
14
                "wifi_nan.identity_resolution.tag",
4620
14
                FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4621
14
            }
4622
14
        },
4623
14
        { &hf_nan_attr_reserved,
4624
14
            {
4625
14
                "Reserved",
4626
14
                "wifi_nan.reserved",
4627
14
                FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4628
14
            }
4629
14
        },
4630
14
        { &hf_nan_attr_pairing_bootstrapping_dialog_token,
4631
14
            {
4632
14
                "Dialog Token",
4633
14
                "wifi_nan.nan_pairing_bootstrapping.dialog_token",
4634
14
                FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4635
14
            }
4636
14
        },
4637
14
        { &hf_nan_attr_pairing_bootstrapping_type_status,
4638
14
            {
4639
14
                "Type and Status",
4640
14
                "wifi_nan.nan_pairing_bootstrapping.type_status",
4641
14
                FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4642
14
            }
4643
14
        },
4644
14
        { &hf_nan_attr_pairing_bootstrapping_type,
4645
14
            {
4646
14
                "Type",
4647
14
                "wifi_nan.nan_pairing_bootstrapping.type",
4648
14
                FT_UINT8, BASE_HEX_DEC, VALS(nan_pairing_bootstrapping_pairing_bootstrapping_type), 0x0f, NULL, HFILL
4649
14
            }
4650
14
        },
4651
14
        { &hf_nan_attr_pairing_bootstrapping_status,
4652
14
            {
4653
14
                "Status",
4654
14
                "wifi_nan.nan_pairing_bootstrapping.status",
4655
14
                FT_UINT8, BASE_HEX_DEC, VALS(nan_pairing_bootstrapping_pairing_bootstrapping_status), 0xf0, NULL, HFILL
4656
14
            }
4657
14
        },
4658
14
        { &hf_nan_attr_pairing_bootstrapping_comeback_after,
4659
14
            {
4660
14
                "Comeback after (TU)",
4661
14
                "wifi_nan.nan_pairing_bootstrapping.comeback_after",
4662
14
                FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4663
14
            }
4664
14
        },
4665
14
        { &hf_nan_attr_pairing_bootstrapping_comeback_cookie_len,
4666
14
            {
4667
14
                "Cookie Length",
4668
14
                "wifi_nan.nan_pairing_bootstrapping.cookie_len",
4669
14
                FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4670
14
            }
4671
14
        },
4672
14
        { &hf_nan_attr_pairing_bootstrapping_comeback_cookie,
4673
14
            {
4674
14
                "Cookie",
4675
14
                "wifi_nan.nan_pairing_bootstrapping.cookie",
4676
14
                FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4677
14
            }
4678
14
        },
4679
14
        { &hf_nan_attr_pairing_bootstrapping_methods,
4680
14
            {
4681
14
                "Bootstrapping Methods",
4682
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods",
4683
14
                FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
4684
14
            }
4685
14
        },
4686
14
        { &hf_nan_attr_pairing_bootstrapping_method_opportunistic_bootstrapping,
4687
14
            {
4688
14
                "Opportunistic Bootstrapping",
4689
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.opportunistic",
4690
14
                FT_UINT16, BASE_HEX, NULL, 0x0001, NULL, HFILL
4691
14
            }
4692
14
        },
4693
14
        { &hf_nan_attr_pairing_bootstrapping_method_pin_code_display,
4694
14
            {
4695
14
                "Pin Code (Display)",
4696
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.pin_code_display",
4697
14
                FT_UINT16, BASE_HEX, NULL, 0x0002, NULL, HFILL
4698
14
            }
4699
14
        },
4700
14
        { &hf_nan_attr_pairing_bootstrapping_method_passphrase_display,
4701
14
            {
4702
14
                "Passphrase (Display)",
4703
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.passphrase_display",
4704
14
                FT_UINT16, BASE_HEX, NULL, 0x0004, NULL, HFILL
4705
14
            }
4706
14
        },
4707
14
        { &hf_nan_attr_pairing_bootstrapping_method_qr_code_display,
4708
14
            {
4709
14
                "QR Code (Display)",
4710
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.qr_code_display",
4711
14
                FT_UINT16, BASE_HEX, NULL, 0x0008, NULL, HFILL
4712
14
            }
4713
14
        },
4714
14
        { &hf_nan_attr_pairing_bootstrapping_method_nfc_tag,
4715
14
            {
4716
14
                "NFC Tag",
4717
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.nfc_tag",
4718
14
                FT_UINT16, BASE_HEX, NULL, 0x0010, NULL, HFILL
4719
14
            }
4720
14
        },
4721
14
        { &hf_nan_attr_pairing_bootstrapping_method_keypad_pin_code_only,
4722
14
            {
4723
14
                "Pin Code Only (Keypad)",
4724
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.pin_code_keypad",
4725
14
                FT_UINT16, BASE_HEX, NULL, 0x0020, NULL, HFILL
4726
14
            }
4727
14
        },
4728
14
        { &hf_nan_attr_pairing_bootstrapping_method_keypad_passphrase,
4729
14
            {
4730
14
                "Passphrase (Keypad)",
4731
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.passphrase_keypad",
4732
14
                FT_UINT16, BASE_HEX, NULL, 0x0040, NULL, HFILL
4733
14
            }
4734
14
        },
4735
14
        { &hf_nan_attr_pairing_bootstrapping_method_qr_code_scan,
4736
14
            {
4737
14
                "QR Code (Scan)",
4738
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.qr_code_scan",
4739
14
                FT_UINT16, BASE_HEX, NULL, 0x0080, NULL, HFILL
4740
14
            }
4741
14
        },
4742
14
        { &hf_nan_attr_pairing_bootstrapping_method_nfc_reader,
4743
14
            {
4744
14
                "NFC Reader",
4745
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.nfc_reader",
4746
14
                FT_UINT16, BASE_HEX, NULL, 0x0100, NULL, HFILL
4747
14
            }
4748
14
        },
4749
14
        { &hf_nan_attr_pairing_bootstrapping_method_reserved,
4750
14
            {
4751
14
                "Reserved",
4752
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.reserved",
4753
14
                FT_UINT16, BASE_HEX, NULL, 0x3e00, NULL, HFILL
4754
14
            }
4755
14
        },
4756
14
        { &hf_nan_attr_pairing_bootstrapping_method_service_managed_bootstrapping,
4757
14
            {
4758
14
                "Service Managed",
4759
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.service_managed",
4760
14
                FT_UINT16, BASE_HEX, NULL, 0x4000, NULL, HFILL
4761
14
            }
4762
14
        },
4763
14
        { &hf_nan_attr_pairing_bootstrapping_method_bootstrapping_handshakes_skipped,
4764
14
            {
4765
14
                "Bootstrapping Handshakes Skipped",
4766
14
                "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.bootstrapping_handshakes_skipped",
4767
14
                FT_UINT16, BASE_HEX, NULL, 0x8000, NULL, HFILL
4768
14
            }
4769
14
        },
4770
14
    };
4771
4772
14
    static int* ett[] = {
4773
14
        &ett_nan,
4774
14
        &ett_attributes,
4775
14
        &ett_type_status,
4776
14
        &ett_map_control,
4777
14
        &ett_time_bitmap_ctrl,
4778
14
        &ett_non_nan_op_channel,
4779
14
        &ett_non_nan_beacon,
4780
14
        &ett_cluster_anchor_master_info,
4781
14
        &ett_sda_service_ctr,
4782
14
        &ett_sda_srf_ctr,
4783
14
        &ett_sdea_ctr,
4784
14
        &ett_sdea_range_limit,
4785
14
        &ett_sdea_service_info,
4786
14
        &ett_connection_cap_field,
4787
14
        &ett_further_av_map_entry_ctrl,
4788
14
        &ett_p2p_device_role,
4789
14
        &ett_device_cap_map_id,
4790
14
        &ett_device_cap_committed_dw,
4791
14
        &ett_device_cap_supported_bands,
4792
14
        &ett_device_cap_op_mode,
4793
14
        &ett_device_cap_antennas,
4794
14
        &ett_device_cap_capabilities,
4795
14
        &ett_ndp_control,
4796
14
        &ett_ndpe_tlv,
4797
14
        &ett_availability_ctr,
4798
14
        &ett_availability_entry,
4799
14
        &ett_availability_entry_ctr,
4800
14
        &ett_availability_entry_entries,
4801
14
        &ett_availability_entry_entries_channel,
4802
14
        &ett_availability_op_class,
4803
14
        &ett_ndc_ctr,
4804
14
        &ett_ndc_entries,
4805
14
        &ett_device_ndc_map_id,
4806
14
        &ett_ndl_control,
4807
14
        &ett_ndl_schedule_entries,
4808
14
        &ett_unaligned_sch_ctrl,
4809
14
        &ett_unaligned_sch_ulw_overwrite,
4810
14
        &ett_unaligned_sch_ulw_ctrl,
4811
14
        &ett_ranging_info_location_info_availability,
4812
14
        &ett_ranging_setup_ctrl,
4813
14
        &ett_ranging_setup_ftm_params,
4814
14
        &ett_ranging_setup_schedule_entries,
4815
14
        &ett_cipher_suite_info_list,
4816
14
        &ett_security_context_identifiers,
4817
14
        &ett_public_availability_sch_entries,
4818
14
        &ett_ie_tree,
4819
14
        &ett_device_capability_extension,
4820
14
        &ett_nan_pairing_bootstrapping_type_status,
4821
14
        &ett_nan_pairing_bootstrapping_method,
4822
14
        &ett_nan_cipher_suite_capabilities
4823
14
    };
4824
4825
14
    static ei_register_info ei[] = {
4826
14
        { &ei_nan_elem_len_invalid,
4827
14
            {
4828
14
            "wifi_nan.expert.elem_len_invalid",
4829
14
            PI_MALFORMED, PI_ERROR,
4830
14
            "Element length invalid",
4831
14
            EXPFILL
4832
14
            }
4833
14
        },
4834
14
        { &ei_nan_unknown_attr_id,
4835
14
            {
4836
14
            "wifi_nan.expert.unknown_attr_id",
4837
14
            PI_PROTOCOL, PI_ERROR,
4838
14
            "Unknown attribute ID",
4839
14
            EXPFILL
4840
14
            }
4841
14
        },
4842
14
        { &ei_nan_unknown_op_class,
4843
14
            {
4844
14
            "wifi_nan.expert.unknown_op_class",
4845
14
            PI_PROTOCOL, PI_COMMENT,
4846
14
            "Unknown Operating Class - Channel Set unavailable",
4847
14
            EXPFILL
4848
14
            }
4849
14
        },
4850
14
        { &ei_nan_unknown_beacon_type,
4851
14
            {
4852
14
            "wifi_nan.expert.unknown_beacon_type",
4853
14
            PI_PROTOCOL, PI_WARN,
4854
14
            "Unknown beacon type - Beacon type detection error",
4855
14
            EXPFILL
4856
14
            }
4857
14
        },
4858
14
        { &ei_nan_invalid_channel_num_for_op_class,
4859
14
            {
4860
14
            "wifi_nan.expert.invalid_ch_num",
4861
14
            PI_PROTOCOL, PI_WARN,
4862
14
            "Invalid Channel number for given operation class",
4863
14
            EXPFILL
4864
14
            }
4865
14
        },
4866
14
        { &ei_nan_invalid_channel_count,
4867
14
            {
4868
14
            "wifi_nan.expert.invalid_ch_count",
4869
14
            PI_PROTOCOL, PI_WARN,
4870
14
            "Invalid Channel count",
4871
14
            EXPFILL
4872
14
            }
4873
14
        },
4874
14
    };
4875
4876
14
    proto_nan = proto_register_protocol("Wi-Fi Neighbor Awareness Networking (NAN)", "Wi-Fi NAN", "wifi_nan");
4877
4878
14
    proto_register_field_array(proto_nan, hf, array_length(hf));
4879
14
    proto_register_subtree_array(ett, array_length(ett));
4880
4881
14
    nan_act_handle = register_dissector("nan.action", dissect_nan_action, proto_nan);
4882
14
    nan_disco_handle = register_dissector("nan.service_discovery", dissect_nan_service_discovery, proto_nan);
4883
14
    nan_beacon_handle = register_dissector("nan.beacon", dissect_nan_beacon, proto_nan);
4884
4885
14
    expert_module_t* expert_nan = expert_register_protocol(proto_nan);
4886
14
    expert_register_field_array(expert_nan, ei, array_length(ei));
4887
4888
14
    ie_handle_table = find_dissector_table("wlan.tag.number");
4889
14
}
4890
4891
void
4892
proto_reg_handoff_nan(void)
4893
14
{
4894
14
    dissector_add_uint("wlan.pa.wifi_alliance.subtype", WFA_ACTION_OUI_TYPE, nan_act_handle);
4895
14
    dissector_add_uint("wlan.pa.wifi_alliance.subtype", WFA_SERVICE_DISCOVERY_SUBTYPE, nan_disco_handle);
4896
14
    dissector_add_uint("wlan.ie.wifi_alliance.subtype", WFA_NAN_IE_OUI_TYPE, nan_beacon_handle);
4897
14
}
4898
4899
/*
4900
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
4901
 *
4902
 * Local variables:
4903
 * c-basic-offset: 4
4904
 * tab-width: 8
4905
 * indent-tabs-mode: nil
4906
 * End:
4907
 *
4908
 * vi: set shiftwidth=4 tabstop=8 expandtab:
4909
 * :indentSize=4:tabSize=8:noTabs=true:
4910
 */