Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-wifi-nan.c
blobbfe68b510d20e79c0ebbcf3cfbd7f9db0420daa9
1 /* packet-wifi-nan.c
3 * Wi-Fi Neighbour Awareness Networking (NAN)
5 * Copyright 2019 Samsung Electronics
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
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"
17 #include <wsutil/str_util.h>
19 void proto_reg_handoff_nan(void);
20 void proto_register_nan(void);
22 static dissector_handle_t nan_act_handle;
23 static dissector_handle_t nan_disco_handle;
24 static dissector_handle_t nan_beacon_handle;
26 static dissector_table_t ie_handle_table;
28 #define WFA_ACTION_OUI_TYPE 0x18
29 #define WFA_NAN_IE_OUI_TYPE 0x13
30 #define WFA_SERVICE_DISCOVERY_SUBTYPE 0x13
32 #define NAN_MASTER_IND_LENGTH 2
33 #define NAN_CLUSTER_LENGTH 13
34 #define NAN_SDA_MIN_LENGTH 9
35 #define NAN_SDEA_MIN_LENGTH 3
36 #define NAN_CONNECTION_CAP_LENGTH 2
37 #define NAN_WLAN_INFRA_MIN_LENGTH 15
38 #define NAN_P2P_OP_MIN_LENGTH 9
39 #define NAN_IBSS_MIN_LENGTH 14
40 #define NAN_MESH_MIN_LENGTH 8
41 #define NAN_RANGING_MIN_LENGTH 8
42 #define NAN_CLUSTER_DISC_LENGTH 22
43 #define NAN_DEVICE_CAP_LENGTH 9
44 #define NAN_NDP_MIN_LENGTH 11
45 #define NAN_NDPE_MIN_LENGTH 11
46 #define NAN_AVAILABILITY_MIN_LENGTH 8
47 #define NAN_NDC_MIN_LENGTH 11
48 #define NAN_NDL_MIN_LENGTH 4
49 #define NAN_NDL_QOS_LENGTH 3
50 #define NAN_UNALIGNED_SCH_MIN_LENGTH 16
51 #define NAN_RANGING_SETUP_MIN_LENGTH 4
52 #define NAN_EXTENDED_WLAN_INFRA_LENGTH 20
53 #define NAN_EXTENDED_P2P_OP_LENGTH 14
54 #define NAN_EXTENDED_IBSS_LENGTH 19
55 #define NAN_EXTENDED_MESH_MIN_LENGTH 13
56 #define NAN_CIPHER_SUITE_INFO_MIN_LENGTH 3
57 #define NAN_SECURITY_CONTEXT_INFO_MIN_LENGTH 4
58 #define NAN_PUBLIC_AVAIL_MIN_LENGTH 4
59 #define NAN_VENDOR_SPECIFIC_MIN_LENGTH 3
60 #define NAN_DEVICE_CAPABILITY_EXTENSION_MIN_LENGTH 2
61 #define NAN_IDENTITY_RESOLUTION_MIN_LEN 1
62 #define NAN_PAIRING_BOOTSTRAPPING_LEN 5
64 #define NAN_UNALIGNED_SCH_BAND_ID_EXIST 0
65 #define NAN_UNALIGNED_SCH_CHANNEL_ENTRY_EXIST 1
66 #define NAN_UNALIGNED_SCH_CHANNEL_ENTRY_W_AUX_EXIST 2
68 static int proto_nan;
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;
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;
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;
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;
400 static int hf_nan_attr_reserved;
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
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 }
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
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
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"
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"
526 static const true_false_string sdea_ctr_data_path_type_flags = {
527 "Reserved",
528 "Unicast NDP required (Reserved if NDP is not required)"
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)"
536 static const true_false_string device_cap_map_id_apply_to_flags = {
537 "Only specified map",
538 "All maps"
541 static const true_false_string device_cap_op_mode_phy_flags_vht = {
542 "VHT",
543 "HT"
546 static const true_false_string device_cap_op_mode_phy_flags_he = {
547 "HE",
548 "HE Not Supported"
551 static const true_false_string availability_entry_entries_type_flags = {
552 "Operating Classes and channel entries",
553 "Indicated bands"
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"
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 }
569 static const value_string service_ctr_type[] = {
570 { 0, "Publish" },
571 { 1, "Subscribe" },
572 { 2, "Follow up" },
573 { 3, "Reserved" },
574 { 0, NULL }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
671 static const range_string status_type2_values[] = {
672 { 0, 0, "Accepted" },
673 { 1, 1, "Rejected" },
674 { 2, 15, "Reserved" },
675 { 0, 0, NULL }
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 }
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 }
715 static const value_string ndl_type_string[] = {
716 { 0, "S-NDL" },
717 { 1, "Reserved (P-NDL)" },
718 { 0, NULL }
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 }
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 }
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 }
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 }
751 static const range_string furth_av_map_id[] = {
752 {0, 15, "Identify Further Availability attribute"},
753 {16, 255, "Reserved"},
754 {0, 0, NULL}
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 }
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 }
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 */
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 */
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 }
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 }
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 }
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 }
812 #define PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN (64)
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;
820 static const int *
821 rval_to_channel_set(const uint32_t val, const range_channel_set* ra)
823 int i = 0;
824 if (ra)
826 while (*ra[i].channel_set) /* no such thing as channel 0 - end of list */
828 if ((val >= ra[i].value_min) && (val <= ra[i].value_max))
830 return ra[i].channel_set;
832 i++;
835 return NULL;
838 static unsigned int channel_number_valid(const uint8_t channel_number, const int *const channel_set)
840 for (unsigned int i = 0; i < PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN; i++)
842 if (channel_set[i] == channel_number)
844 return i;
848 return PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN;
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 */
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}
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}
994 static void
995 dissect_attr_master_indication(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
997 if (attr_len != NAN_MASTER_IND_LENGTH)
999 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1000 return;
1003 proto_tree_add_item(attr_tree, hf_nan_attr_master_preference, tvb,
1004 offset + 3, 1, ENC_BIG_ENDIAN);
1005 proto_tree_add_item(attr_tree, hf_nan_attr_master_random_factor, tvb,
1006 offset + 4, 1, ENC_BIG_ENDIAN);
1009 static void
1010 dissect_attr_cluster(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1012 if (attr_len != NAN_CLUSTER_LENGTH)
1014 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1015 return;
1018 proto_tree* anchor_master_tree = proto_tree_add_subtree(attr_tree, tvb, offset + 3, 13,
1019 ett_cluster_anchor_master_info, NULL, "Anchor Master Information");
1020 proto_tree_add_item(anchor_master_tree, hf_nan_attr_cluster_anchor_master_rank, tvb,
1021 offset + 3, 8, ENC_BIG_ENDIAN);
1022 proto_tree_add_item(anchor_master_tree, hf_nan_attr_cluster_hop_count, tvb,
1023 offset + 11, 1, ENC_BIG_ENDIAN);
1024 proto_tree_add_item(anchor_master_tree, hf_nan_attr_cluster_beacon_transmission_time, tvb,
1025 offset + 12, 4, ENC_BIG_ENDIAN);
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)
1031 if (attr_len % 6 != 0 || attr_len == 0)
1033 expert_add_info_format(pinfo, attr_tree, &ei_nan_elem_len_invalid, "Invalid Service ID length");
1034 return;
1037 int num_service_ids = attr_len / 6;
1038 offset += 3;
1039 for (int i = 1; i <= num_service_ids; ++i)
1041 proto_tree_add_item(attr_tree, hf_nan_service_id, tvb, offset, 6, ENC_NA);
1042 offset += 6;
1046 static void
1047 dissect_attr_sda(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1049 if (attr_len < NAN_SDA_MIN_LENGTH)
1051 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1052 return;
1055 proto_tree_add_item(attr_tree, hf_nan_service_id, tvb,
1056 offset + 3, 6, ENC_NA);
1057 proto_tree_add_item(attr_tree, hf_nan_instance_id, tvb,
1058 offset + 9, 1, ENC_BIG_ENDIAN);
1059 proto_tree_add_item(attr_tree, hf_nan_attr_sda_requestor_instance_id, tvb,
1060 offset + 10, 1, ENC_BIG_ENDIAN);
1061 offset += 11;
1063 static int* const service_ctr_fields[] = {
1064 &hf_nan_attr_sda_sc_type,
1065 &hf_nan_attr_sda_sc_matching_filter,
1066 &hf_nan_attr_sda_sc_service_response,
1067 &hf_nan_attr_sda_sc_service_info,
1068 &hf_nan_attr_sda_sc_discovery_range,
1069 &hf_nan_attr_sda_sc_binding_bitmap,
1070 NULL
1073 proto_tree_add_bitmask(attr_tree, tvb, offset, hf_nan_attr_sda_sc,
1074 ett_sda_service_ctr, service_ctr_fields, ENC_LITTLE_ENDIAN);
1076 uint8_t service_ctr_byte = tvb_get_uint8(tvb, offset);
1077 offset += 1;
1079 const uint8_t BITMASK_TYPE_SUBSCRIBE = 0x01;
1080 const uint8_t BITMASK_TYPE_FOLLOW_UP = 0x02;
1081 const uint8_t BITMASK_MATCHING_FILTER_PRESENT = 0x04;
1082 const uint8_t BITMASK_SERVICE_RESPONSE_FILTER_PRESENT = 0x08;
1083 const uint8_t BITMASK_SERVICE_INFO_PRESENT = 0x10;
1084 const uint8_t BITMASK_BITMAP_PRESENT = 0x40;
1086 if (service_ctr_byte & BITMASK_TYPE_SUBSCRIBE)
1088 col_prepend_fstr(pinfo->cinfo, COL_INFO, "SDF Subscribe, ");
1090 else if (service_ctr_byte & BITMASK_TYPE_FOLLOW_UP)
1092 col_prepend_fstr(pinfo->cinfo, COL_INFO, "SDF Follow up, ");
1094 else
1096 col_prepend_fstr(pinfo->cinfo, COL_INFO, "SDF Publish, ");
1099 if (service_ctr_byte & BITMASK_BITMAP_PRESENT)
1101 proto_tree_add_item(attr_tree, hf_nan_attr_sda_binding_bitmap, tvb,
1102 offset, 2, ENC_LITTLE_ENDIAN);
1103 offset += 2;
1106 if (service_ctr_byte & BITMASK_MATCHING_FILTER_PRESENT)
1108 proto_tree_add_item(attr_tree, hf_nan_attr_sda_matching_filter_len, tvb,
1109 offset, 1, ENC_LITTLE_ENDIAN);
1110 int mf_len = tvb_get_uint8(tvb, offset);
1111 int dissected_mf_len = 0;
1112 offset += 1;
1113 while (dissected_mf_len < mf_len)
1115 int filter_len = tvb_get_uint8(tvb, offset);
1116 proto_tree_add_item(attr_tree, hf_nan_attr_sda_matching_filter_val, tvb,
1117 offset + 1, filter_len, ENC_NA);
1118 offset += filter_len + 1;
1119 dissected_mf_len += filter_len + 1;
1123 if (service_ctr_byte & BITMASK_SERVICE_RESPONSE_FILTER_PRESENT)
1125 proto_tree_add_item(attr_tree, hf_nan_attr_sda_service_response_filter_len, tvb,
1126 offset, 1, ENC_LITTLE_ENDIAN);
1127 int srf_len = tvb_get_uint8(tvb, offset);
1129 static int* const srf_ctr_fields[] = {
1130 &hf_nan_attr_sda_srf_ctr_type,
1131 &hf_nan_attr_sda_srf_ctr_include,
1132 &hf_nan_attr_sda_srf_ctr_bloom_filter_index,
1133 NULL
1136 proto_tree_add_bitmask(attr_tree, tvb, offset + 1, hf_nan_attr_sda_srf_ctr,
1137 ett_sda_service_ctr, srf_ctr_fields, ENC_LITTLE_ENDIAN);
1138 proto_tree_add_item(attr_tree, hf_nan_attr_sda_srf_address_set, tvb,
1139 offset + 2, srf_len - 1, ENC_NA);
1140 offset += srf_len + 1;
1143 if (service_ctr_byte & BITMASK_SERVICE_INFO_PRESENT)
1145 uint32_t service_info_len;
1147 /* XXX - use FT_UINT_BYTES? */
1148 proto_tree_add_item_ret_uint(attr_tree, hf_nan_attr_sda_service_info_len, tvb,
1149 offset, 1, ENC_BIG_ENDIAN, &service_info_len);
1150 proto_tree_add_item(attr_tree, hf_nan_attr_sda_service_info, tvb,
1151 offset + 1, service_info_len, ENC_NA);
1152 // offset += service_info_len + 1;
1156 static void
1157 dissect_attr_sdea(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1159 if (attr_len < NAN_SDEA_MIN_LENGTH)
1161 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1162 return;
1165 proto_tree_add_item(attr_tree, hf_nan_instance_id, tvb,
1166 offset + 3, 1, ENC_LITTLE_ENDIAN);
1167 offset += 4;
1168 uint16_t dissected_len = 1;
1170 static int* const sdea_ctr_fields[] = {
1171 &hf_nan_attr_sdea_ctr_fsd,
1172 &hf_nan_attr_sdea_ctr_fsd_w_gas,
1173 &hf_nan_attr_sdea_ctr_data_path,
1174 &hf_nan_attr_sdea_ctr_data_path_type,
1175 &hf_nan_attr_sdea_ctr_reserved_multicast_type,
1176 &hf_nan_attr_sdea_ctr_qos,
1177 &hf_nan_attr_sdea_ctr_security,
1178 &hf_nan_attr_sdea_ctr_ranging,
1179 &hf_nan_attr_sdea_ctr_range_limit,
1180 &hf_nan_attr_sdea_ctr_service_update_indicator,
1181 NULL
1184 proto_tree_add_bitmask(attr_tree, tvb, offset, hf_nan_attr_sdea_ctr, ett_sdea_ctr,
1185 sdea_ctr_fields, ENC_LITTLE_ENDIAN);
1187 uint16_t sdea_ctr_byte = tvb_get_letohs(tvb, offset);
1188 offset += 2;
1189 dissected_len += 2;
1191 if (sdea_ctr_byte & 0x100)
1193 proto_tree* range_lim_tree = proto_tree_add_subtree(attr_tree, tvb, offset, 4,
1194 ett_sdea_range_limit, NULL, "Range Limit");
1195 proto_tree_add_item(range_lim_tree, hf_nan_attr_sdea_ingress_range_limit, tvb,
1196 offset, 2, ENC_LITTLE_ENDIAN);
1197 proto_tree_add_item(range_lim_tree, hf_nan_attr_sdea_egress_range_limit, tvb,
1198 offset + 2, 2, ENC_LITTLE_ENDIAN);
1199 offset += 4;
1200 dissected_len += 4;
1203 if (sdea_ctr_byte & 0x200)
1205 proto_tree_add_item(attr_tree, hf_nan_attr_sdea_service_update_indicator, tvb,
1206 offset, 1, ENC_LITTLE_ENDIAN);
1207 offset += 1;
1208 dissected_len += 1;
1211 // If Service Info field is present
1212 if (dissected_len < attr_len)
1214 proto_tree_add_item(attr_tree, hf_nan_attr_sdea_service_info_length, tvb,
1215 offset, 2, ENC_LITTLE_ENDIAN);
1216 proto_tree* service_info_tree = proto_tree_add_subtree(attr_tree, tvb, offset + 2,
1217 attr_len - dissected_len - 2, ett_sdea_service_info, NULL, "Service Info");
1218 proto_tree_add_item(service_info_tree, hf_nan_oui, tvb,
1219 offset + 2, 3, ENC_NA);
1220 proto_tree_add_item(service_info_tree, hf_nan_attr_sdea_service_info_protocol_type, tvb,
1221 offset + 5, 1, ENC_BIG_ENDIAN);
1222 proto_tree_add_item(service_info_tree, hf_nan_attr_sdea_service_info_specific, tvb,
1223 offset + 6, attr_len - dissected_len - 6, ENC_NA);
1227 static void
1228 dissect_attr_connection_capability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1230 if (attr_len != NAN_CONNECTION_CAP_LENGTH)
1232 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1233 return;
1236 static int* const connection_cap_bitmap_fields[] = {
1237 &hf_nan_attr_connection_cap_wifi_direct,
1238 &hf_nan_attr_connection_cap_p2ps,
1239 &hf_nan_attr_connection_cap_tdls,
1240 &hf_nan_attr_connection_cap_wlan_infra,
1241 &hf_nan_attr_connection_cap_ibss,
1242 &hf_nan_attr_connection_cap_mesh,
1243 NULL
1246 proto_tree_add_bitmask(attr_tree, tvb, offset + 3, hf_nan_attr_connection_cap_bitmap,
1247 ett_connection_cap_field, connection_cap_bitmap_fields, ENC_LITTLE_ENDIAN);
1250 static void
1251 dissect_attr_wlan_infra(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1253 if (attr_len < NAN_WLAN_INFRA_MIN_LENGTH)
1255 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1256 return;
1259 unsigned sub_offset = offset + 3;
1260 proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN);
1261 sub_offset += 6;
1262 proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
1263 sub_offset += 6;
1264 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1265 ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1266 sub_offset++;
1267 int bitmap_length = attr_len - 14;
1268 proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, bitmap_length, ENC_NA);
1269 sub_offset += bitmap_length;
1270 proto_tree_add_item(attr_tree, hf_nan_attr_wlan_infra_device_role, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1273 static void
1274 dissect_attr_p2p_operation(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1276 if (attr_len < NAN_P2P_OP_MIN_LENGTH)
1278 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1279 return;
1282 unsigned sub_offset = offset + 3;
1283 static int* const p2p_bitmap_fields[] = {
1284 &hf_nan_attr_p2p_device_role_device,
1285 &hf_nan_attr_p2p_device_role_group_owner,
1286 &hf_nan_attr_p2p_device_role_client,
1287 NULL
1290 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_p2p_device_role,
1291 ett_p2p_device_role, p2p_bitmap_fields, ENC_LITTLE_ENDIAN);
1292 sub_offset++;
1293 proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
1294 sub_offset += 6;
1295 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1296 ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1297 sub_offset++;
1298 proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, -1, ENC_NA);
1301 static void
1302 dissect_attr_ibss(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1304 if (attr_len < NAN_IBSS_MIN_LENGTH)
1306 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1307 return;
1310 unsigned sub_offset = offset + 3;
1311 proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN);
1312 sub_offset += 6;
1313 proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
1314 sub_offset += 6;
1315 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1316 ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1317 sub_offset++;
1318 proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, -1, ENC_NA);
1321 static void
1322 dissect_attr_mesh(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1324 if (attr_len < NAN_MESH_MIN_LENGTH)
1326 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1327 return;
1330 unsigned sub_offset = offset + 3;
1331 proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
1332 sub_offset += 6;
1334 uint8_t duration = tvb_get_bits8(tvb, sub_offset * 8 + 5, 2);
1335 unsigned bitmap_length;
1336 switch (duration) {
1337 case 0:
1338 bitmap_length = 4;
1339 break;
1340 case 1:
1341 bitmap_length = 2;
1342 break;
1343 case 2:
1344 bitmap_length = 1;
1345 break;
1346 default:
1347 bitmap_length = 0;
1350 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1351 ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1352 sub_offset++;
1353 proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, bitmap_length, ENC_NA);
1354 sub_offset += bitmap_length;
1355 proto_tree_add_item(attr_tree, hf_nan_attr_mesh_id, tvb, sub_offset, -1, ENC_NA);
1358 static void
1359 dissect_attr_further_service_discovery(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len)
1361 unsigned sub_offset = offset + 3;
1362 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1363 ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1364 sub_offset++;
1365 int bitmap_length = attr_len - 1;
1366 proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, bitmap_length, ENC_NA);
1369 static void
1370 dissect_attr_further_availability_map(proto_tree* attr_tree, tvbuff_t* tvb, int offset)
1372 unsigned sub_offset = offset + 3;
1373 proto_tree_add_item(attr_tree, hf_nan_attr_further_av_map_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1374 sub_offset++;
1376 static int* const availability_entry_control_fields[] = {
1377 &hf_nan_attr_further_av_map_entry_av_interval_duration,
1378 NULL
1381 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_further_av_map_entry_ctrl,
1382 ett_further_av_map_entry_ctrl, availability_entry_control_fields, ENC_LITTLE_ENDIAN);
1383 sub_offset++;
1384 proto_tree_add_item(attr_tree, hf_nan_attr_further_av_map_op_class, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1385 sub_offset++;
1386 proto_tree_add_item(attr_tree, hf_nan_attr_further_av_map_channel_num, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1387 sub_offset++;
1388 proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, -1, ENC_NA);
1391 static void
1392 dissect_attr_country_code(proto_tree* attr_tree, tvbuff_t* tvb, int offset)
1394 unsigned sub_offset = offset + 3;
1395 proto_tree_add_item(attr_tree, hf_nan_attr_country_code, tvb, sub_offset, 2, ENC_ASCII);
1398 static void
1399 dissect_attr_ranging(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1401 if (attr_len < NAN_RANGING_MIN_LENGTH)
1403 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1404 return;
1407 unsigned sub_offset = offset + 3;
1408 proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
1409 sub_offset += 6;
1410 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_ctrl_field,
1411 ett_map_control, map_control_fields, ENC_LITTLE_ENDIAN);
1412 sub_offset++;
1413 proto_tree_add_item(attr_tree, hf_nan_attr_ranging_protocol, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1414 sub_offset++;
1415 proto_tree_add_item(attr_tree, hf_nan_availability_intervals_bitmap, tvb, sub_offset, -1, ENC_NA);
1418 static void
1419 dissect_attr_cluter_discovery(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1421 if (attr_len != NAN_CLUSTER_DISC_LENGTH)
1423 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1424 return;
1427 unsigned sub_offset = offset + 3;
1428 proto_tree_add_item(attr_tree, hf_nan_attr_cluster_disc_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN);
1429 sub_offset += 6;
1430 proto_tree_add_item(attr_tree, hf_nan_attr_cluster_disc_time_offset, tvb, sub_offset, 8, ENC_LITTLE_ENDIAN);
1431 sub_offset += 8;
1432 proto_tree_add_item(attr_tree, hf_nan_attr_cluster_disc_anchor_master_rank, tvb, sub_offset, 8, ENC_LITTLE_ENDIAN);
1435 static void
1436 dissect_attr_device_capability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1438 if (attr_len != NAN_DEVICE_CAP_LENGTH)
1440 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1441 return;
1444 static int* const device_cap_map_id_fields[] = {
1445 &hf_nan_attr_device_cap_map_id_apply_to,
1446 &hf_nan_attr_device_cap_map_id_associated_maps,
1447 NULL
1449 static int* const device_cap_committed_dw_fields[] = {
1450 &hf_nan_attr_device_cap_committed_dw_24ghz,
1451 &hf_nan_attr_device_cap_committed_dw_5ghz,
1452 &hf_nan_attr_device_cap_committed_dw_24ghz_overwrite,
1453 &hf_nan_attr_device_cap_committed_dw_5ghz_overwrite,
1454 NULL
1456 static int* const device_cap_supported_bands_fields[] = {
1457 &hf_nan_attr_device_cap_supported_bands_reserved_tv_whitespaces,
1458 &hf_nan_attr_device_cap_supported_bands_sub_1ghz,
1459 &hf_nan_attr_device_cap_supported_bands_24ghz,
1460 &hf_nan_attr_device_cap_supported_bands_reserved_36ghz,
1461 &hf_nan_attr_device_cap_supported_bands_5ghz,
1462 &hf_nan_attr_device_cap_supported_bands_reserved_60ghz,
1463 &hf_nan_attr_device_cap_supported_bands_reserved_45ghz,
1464 &hf_nan_attr_device_cap_supported_bands_6ghz,
1465 NULL
1467 static int* const device_cap_op_mode_fields[] = {
1468 &hf_nan_attr_device_cap_op_mode_phy_vht,
1469 &hf_nan_attr_device_cap_op_mode_phy_he_vht8080,
1470 &hf_nan_attr_device_cap_op_mode_phy_he_vht160,
1471 &hf_nan_attr_device_cap_op_mode_reserved_paging_ndl,
1472 &hf_nan_attr_device_cap_op_mode_phy_he,
1473 NULL
1475 static int* const device_cap_antennas_fields[] = {
1476 &hf_nan_attr_device_cap_antennas_tx,
1477 &hf_nan_attr_device_cap_antennas_rx,
1478 NULL
1480 static int* const device_cap_capabilities_fields[] = {
1481 &hf_nan_attr_device_cap_capabilities_dfs_master,
1482 &hf_nan_attr_device_cap_capabilities_extended_key_id,
1483 &hf_nan_attr_device_cap_capabilities_simul_ndp_reception,
1484 &hf_nan_attr_device_cap_capabilities_ndpe_attr_support,
1485 &hf_nan_attr_device_cap_capabilities_s3_capable,
1486 NULL
1489 proto_tree_add_bitmask(attr_tree, tvb, offset + 3, hf_nan_map_id,
1490 ett_device_cap_map_id, device_cap_map_id_fields, ENC_LITTLE_ENDIAN);
1491 proto_tree_add_bitmask(attr_tree, tvb, offset + 4, hf_nan_attr_device_cap_committed_dw,
1492 ett_device_cap_committed_dw, device_cap_committed_dw_fields, ENC_LITTLE_ENDIAN);
1493 proto_tree_add_bitmask(attr_tree, tvb, offset + 6, hf_nan_attr_device_cap_supported_bands,
1494 ett_device_cap_supported_bands, device_cap_supported_bands_fields, ENC_LITTLE_ENDIAN);
1495 proto_tree_add_bitmask(attr_tree, tvb, offset + 7, hf_nan_attr_device_cap_op_mode,
1496 ett_device_cap_op_mode, device_cap_op_mode_fields, ENC_LITTLE_ENDIAN);
1497 proto_tree_add_bitmask(attr_tree, tvb, offset + 8, hf_nan_attr_device_cap_antennas,
1498 ett_device_cap_antennas, device_cap_antennas_fields, ENC_LITTLE_ENDIAN);
1499 proto_tree_add_item(attr_tree, hf_nan_attr_device_cap_max_channel_switch_time, tvb,
1500 offset + 9, 2, ENC_LITTLE_ENDIAN);
1501 proto_tree_add_bitmask(attr_tree, tvb, offset + 11, hf_nan_attr_device_cap_capabilities,
1502 ett_device_cap_capabilities, device_cap_capabilities_fields, ENC_LITTLE_ENDIAN);
1505 static void
1506 dissect_attr_ndp(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1508 if (attr_len < NAN_NDP_MIN_LENGTH)
1510 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1511 return;
1514 unsigned sub_offset = offset + 3;
1515 proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1516 sub_offset++;
1518 static int* const ndp_type_status_fields[] = {
1519 &hf_nan_attr_ndp_type,
1520 &hf_nan_status_1,
1521 NULL
1523 static int* const ndp_control_fields[] = {
1524 &hf_nan_attr_ndp_ctrl_confirm,
1525 &hf_nan_attr_ndp_ctrl_security_pres,
1526 &hf_nan_attr_ndp_ctrl_publish_id_pres,
1527 &hf_nan_attr_ndp_ctrl_responder_ndi_pres,
1528 &hf_nan_attr_ndp_ctrl_sepcific_info_pres,
1529 NULL
1532 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_type_status,
1533 ett_type_status, ndp_type_status_fields, ENC_LITTLE_ENDIAN);
1535 uint8_t bits_type = tvb_get_bits8(tvb, sub_offset * 8 + 4, 4);
1536 uint8_t bit_offset = (sub_offset * 8) + 4;
1537 uint8_t bits_status = tvb_get_bits8(tvb, bit_offset, 4);
1538 sub_offset++;
1539 proto_tree_add_item(attr_tree, hf_nan_reason_code, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1540 sub_offset++;
1541 proto_tree_add_item(attr_tree, hf_nan_attr_ndp_initiator, tvb, sub_offset, 6, ENC_NA);
1542 sub_offset += 6;
1543 proto_tree_add_item(attr_tree, hf_nan_attr_ndp_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1544 sub_offset++;
1545 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ndp_control,
1546 ett_ndp_control, ndp_control_fields, ENC_LITTLE_ENDIAN);
1548 uint8_t bits_ndp_info = tvb_get_bits8(tvb, (sub_offset * 8) + 2, 1);
1549 uint8_t bits_publish_id = tvb_get_bits8(tvb, (sub_offset * 8) + 4, 1);
1550 sub_offset++;
1552 if (bits_publish_id == 1 && bits_type == 0)
1554 proto_tree_add_item(attr_tree, hf_nan_publish_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1555 sub_offset++;
1557 if (bits_type == 1 && (bits_status == 0 || bits_status == 1))
1559 proto_tree_add_item(attr_tree, hf_nan_attr_ndp_responder_ndi, tvb, sub_offset, 6, ENC_NA);
1560 sub_offset += 6;
1562 if (bits_ndp_info)
1564 proto_tree_add_item(attr_tree, hf_nan_attr_ndp_specific_info, tvb, sub_offset, -1, ENC_NA);
1568 static void
1569 dissect_attr_ndpe(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1571 if (attr_len < NAN_NDPE_MIN_LENGTH)
1573 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1574 return;
1577 static int* const ndp_type_status_fields[] = {
1578 &hf_nan_attr_ndp_type,
1579 &hf_nan_status_1,
1580 NULL
1582 static int* const ndpe_control_fields[] = {
1583 &hf_nan_attr_ndpe_ctrl_confirm,
1584 &hf_nan_attr_ndpe_ctrl_security_pres,
1585 &hf_nan_attr_ndpe_ctrl_publish_id_pres,
1586 &hf_nan_attr_ndpe_ctrl_responder_ndi_pres,
1587 &hf_nan_attr_ndpe_ctrl_gtk_requried,
1588 NULL
1591 int dissected_len = 0;
1592 proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
1593 proto_tree_add_bitmask(attr_tree, tvb, offset + 4, hf_nan_type_status,
1594 ett_type_status, ndp_type_status_fields, ENC_LITTLE_ENDIAN);
1596 offset += 4;
1597 dissected_len += 4;
1598 uint8_t bits_type = tvb_get_bits8(tvb, offset * 8 + 4, 4);
1599 uint32_t bit_offset = (offset * 8) + 4;
1600 uint8_t bits_status = tvb_get_bits8(tvb, bit_offset, 4);
1602 proto_tree_add_item(attr_tree, hf_nan_reason_code, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
1603 proto_tree_add_item(attr_tree, hf_nan_attr_ndp_initiator, tvb, offset + 2, 6, ENC_NA);
1604 proto_tree_add_item(attr_tree, hf_nan_attr_ndp_id, tvb, offset + 8, 1, ENC_BIG_ENDIAN);
1605 proto_tree_add_bitmask(attr_tree, tvb, offset + 9, hf_nan_attr_ndpe_control,
1606 ett_ndp_control, ndpe_control_fields, ENC_LITTLE_ENDIAN);
1607 offset += 9;
1608 dissected_len += 9;
1610 uint8_t bits_publish_id = tvb_get_bits8(tvb, (offset * 8) + 4, 1);
1611 offset++;
1612 dissected_len++;
1614 if (bits_publish_id == 1 && bits_type == 0)
1616 proto_tree_add_item(attr_tree, hf_nan_publish_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1617 offset++;
1618 dissected_len++;
1620 if (bits_type == 1 && (bits_status == 0 || bits_status == 1))
1622 proto_tree_add_item(attr_tree, hf_nan_attr_ndp_responder_ndi, tvb, offset, 6, ENC_NA);
1623 offset += 6;
1624 dissected_len += 6;
1627 while (dissected_len < attr_len)
1629 uint8_t tlv_type = tvb_get_uint8(tvb, offset);
1630 uint16_t tlv_len = tvb_get_letohs(tvb, offset + 1);
1631 proto_tree* tlv_tree = proto_tree_add_subtree(attr_tree, tvb, offset, tlv_len + 3,
1632 ett_ndpe_tlv, NULL, "TLV entry");
1633 proto_tree_add_item(tlv_tree, hf_nan_attr_ndpe_tlv_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1634 proto_tree_add_item(tlv_tree, hf_nan_attr_ndpe_tlv_len, tvb, offset + 1, 2, ENC_LITTLE_ENDIAN);
1636 switch (tlv_type)
1638 case 0:
1639 proto_tree_add_item(tlv_tree, hf_nan_attr_ndpe_tlv_ipv6_interface_identifier, tvb, offset + 3, 8, ENC_NA);
1640 offset += 11;
1641 dissected_len += 11;
1642 break;
1643 case 1:
1644 proto_tree_add_item(tlv_tree, hf_nan_oui, tvb, offset + 3, 3, ENC_NA);
1645 proto_tree_add_item(tlv_tree, hf_nan_attr_vendor_specific_body, tvb, offset + 6, tlv_len - 3, ENC_NA);
1646 offset += tlv_len + 3;
1647 dissected_len += tlv_len + 3;
1648 break;
1649 default:
1650 proto_tree_add_item(tlv_tree, hf_nan_attr_vendor_specific_body, tvb, offset + 3, tlv_len, ENC_NA);
1651 offset += tlv_len + 3;
1652 dissected_len += tlv_len + 3;
1653 break;
1658 static void
1659 dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1661 if (attr_len < NAN_AVAILABILITY_MIN_LENGTH)
1663 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1664 return;
1667 static int* const availability_ctr_fields[] = {
1668 &hf_nan_attr_availability_map_id,
1669 &hf_nan_attr_availability_committed_changed,
1670 &hf_nan_attr_availability_potential_changed,
1671 &hf_nan_attr_availability_public_availability_changed,
1672 &hf_nan_attr_availability_ndc_changed,
1673 &hf_nan_attr_availability_reserved_multicast_schedule_changed,
1674 &hf_nan_attr_availability_reserved_multicast_schedule_change_changed,
1675 NULL
1677 static int* const availability_entry_ctr_fields[] = {
1678 &hf_nan_attr_availability_entry_ctr_type,
1679 &hf_nan_attr_availability_entry_ctr_pref,
1680 &hf_nan_attr_availability_entry_ctr_utilization,
1681 &hf_nan_attr_availability_entry_ctr_rx_nss,
1682 &hf_nan_attr_availability_entry_ctr_time_bitmap,
1683 NULL
1686 proto_tree_add_item(attr_tree, hf_nan_attr_availability_sequence_id, tvb,
1687 offset + 3, 1, ENC_LITTLE_ENDIAN);
1688 proto_tree_add_bitmask(attr_tree, tvb, offset + 4, hf_nan_attr_availability_ctr,
1689 ett_device_cap_capabilities, availability_ctr_fields, ENC_LITTLE_ENDIAN);
1690 offset += 6;
1692 int dissected_len = 3;
1693 while (dissected_len < attr_len)
1695 uint16_t entry_len = tvb_get_letohs(tvb, offset);
1696 uint8_t entry_type = tvb_get_bits8(tvb, offset * 8 + 21, 3);
1697 uint8_t hdr_len = 2;
1698 uint32_t time_bitmap_len = 0;
1699 uint64_t avail_entry;
1700 const char* entry_type_msg = val_to_str(entry_type, availability_entry_type,
1701 "Unknown type (%u)");
1702 char* info_msg = wmem_strconcat(pinfo->pool, "Availability Type : ", entry_type_msg, NULL);
1703 proto_tree* entry_tree = proto_tree_add_subtree(attr_tree, tvb, offset, entry_len + 2,
1704 ett_availability_entry, NULL, info_msg);
1705 proto_tree_add_item(entry_tree, hf_nan_attr_availability_entry_len, tvb,
1706 offset, 2, ENC_LITTLE_ENDIAN);
1707 proto_tree_add_bitmask_ret_uint64(entry_tree, tvb, offset + 2, hf_nan_attr_availability_entry_ctr,
1708 ett_availability_entry_ctr, availability_entry_ctr_fields, ENC_LITTLE_ENDIAN, &avail_entry);
1709 offset += 4;
1711 bool time_bitmap_present = avail_entry & (1 << 12);
1712 if (time_bitmap_present)
1714 proto_tree_add_bitmask(entry_tree, tvb, offset,
1715 hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl,
1716 time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
1717 proto_tree_add_item_ret_uint(entry_tree, hf_nan_time_bitmap_len, tvb,
1718 offset + 2, 1, ENC_LITTLE_ENDIAN, &time_bitmap_len);
1719 proto_tree_add_item(entry_tree, hf_nan_time_bitmap, tvb,
1720 offset + 3, time_bitmap_len, ENC_NA);
1721 hdr_len = 5;
1722 offset += 3 + time_bitmap_len;
1725 int entries_len = entry_len - hdr_len - time_bitmap_len;
1726 proto_tree* entries_tree = proto_tree_add_subtree(entry_tree, tvb, offset, entries_len,
1727 ett_availability_entry_entries, NULL, "Band/Channel Entries");
1729 uint64_t entries_type, non_contiguous_bw, num_entries;
1730 proto_tree_add_bits_ret_val(entries_tree, hf_nan_attr_availability_entry_entries_type, tvb,
1731 offset * 8, 1, &entries_type, ENC_LITTLE_ENDIAN);
1732 proto_tree_add_bits_ret_val(entries_tree,
1733 hf_nan_attr_availability_entry_entries_non_contiguous_bw, tvb, offset * 8 + 1, 1,
1734 &non_contiguous_bw, ENC_LITTLE_ENDIAN);
1735 proto_tree_add_bits_ret_val(entries_tree, hf_nan_attr_availability_entry_entries_num_entries,
1736 tvb, offset * 8 + 4, 4, &num_entries, ENC_LITTLE_ENDIAN);
1738 offset += 1;
1739 for (uint8_t i = 0; i < num_entries; i++)
1741 switch (entries_type) {
1742 case 0:
1744 proto_tree_add_item(entries_tree, hf_nan_attr_availability_entry_entries_band, tvb,
1745 offset, 1, ENC_LITTLE_ENDIAN);
1746 offset += 1;
1747 break;
1749 case 1:
1751 int channel_entry_len = (non_contiguous_bw == 0) ? 4 : 6;
1752 proto_tree* channel_tree = proto_tree_add_subtree(entries_tree, tvb, offset,
1753 channel_entry_len, ett_availability_entry_entries_channel, NULL, "Channel Entry");
1754 uint8_t op_class = tvb_get_uint8(tvb, offset);
1755 uint16_t bitmap = tvb_get_uint16(tvb, offset + 1, ENC_LITTLE_ENDIAN);
1756 proto_tree* op_class_tree = proto_tree_add_subtree(channel_tree, tvb, offset, 1, ett_availability_op_class, NULL, "Operating Class");
1757 proto_tree_add_item(op_class_tree, hf_nan_attr_availability_entry_entries_start_freq, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1758 proto_tree_add_item(op_class_tree, hf_nan_attr_availability_entry_entries_bandwidth, tvb, offset, 1, ENC_LITTLE_ENDIAN);
1759 wmem_strbuf_t* str;
1760 str = wmem_strbuf_new(pinfo->pool, "");
1761 if (op_class < 131)
1763 for(unsigned i_bitmap = 0; i_bitmap < 16; ++i_bitmap)
1765 if (bitmap & (1u << i_bitmap))
1768 const int *channel_set = rval_to_channel_set(op_class, op_class_channel);
1769 if (channel_set == NULL)
1771 expert_add_info(pinfo, channel_tree, &ei_nan_unknown_op_class);
1772 break;
1774 int channel = channel_set[i_bitmap];
1776 switch (channel)
1778 // TODO: replace these magic numbers (or use 802.11 dissector for this)
1779 case -3:
1780 wmem_strbuf_append_printf(str, "%s", "Derived from regulation ");
1781 break;
1782 case -2:
1783 wmem_strbuf_append_printf(str, "%s", "Vendor Specific ");
1784 break;
1785 case -1:
1786 wmem_strbuf_append_printf(str, "%s", "Reserved ");
1787 break;
1788 default:
1789 wmem_strbuf_append_printf(str, "%d ", channel);
1794 proto_tree_add_string(channel_tree, hf_nan_attr_availability_entry_entries_channel_set, tvb, offset + 1, 2, wmem_strbuf_finalize(str));
1796 else
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 uint8_t start_ch_number = bitmap & 0xff;
1803 uint8_t number_of_chs = (bitmap & 0xff00) >> 8;
1805 const int *channel_set_higher_op_class = rval_to_channel_set(op_class, op_class_channel);
1806 if (channel_set_higher_op_class)
1808 unsigned int start_ch_number_idx = channel_number_valid(start_ch_number, channel_set_higher_op_class);
1809 if (start_ch_number_idx == PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN)
1811 /* The given channel number does not belong to this operating class */
1812 expert_add_info(pinfo, channel_tree, &ei_nan_invalid_channel_num_for_op_class);
1815 if (!number_of_chs || number_of_chs > PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN)
1817 /* Number of channel should at least be one and should not exceed the maximum */
1818 expert_add_info(pinfo, channel_tree, &ei_nan_invalid_channel_count);
1821 uint8_t number_of_chs_max =
1822 (number_of_chs + start_ch_number_idx < PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN) ?
1823 (number_of_chs + start_ch_number_idx) : PACKET_WIFI_NAN_MAX_CHANNEL_SET_LEN;
1824 for (uint8_t num_ch = start_ch_number_idx; num_ch < number_of_chs_max; num_ch++)
1826 wmem_strbuf_append_printf(str, "%d ", channel_set_higher_op_class[num_ch]);
1829 else
1831 expert_add_info(pinfo, channel_tree, &ei_nan_unknown_op_class);
1833 proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_start_channel_number, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);
1834 proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_number_of_ch_included, tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
1836 proto_tree_add_string(channel_tree, hf_nan_attr_availability_entry_entries_channel_set, tvb, offset + 1, 2, wmem_strbuf_finalize(str));
1838 proto_tree_add_item(channel_tree,
1839 hf_nan_attr_availability_entry_entries_primary_channel_bitmap, tvb,
1840 offset + 3, 1, ENC_LITTLE_ENDIAN);
1842 if (non_contiguous_bw == 1)
1844 proto_tree_add_item(channel_tree,
1845 hf_nan_attr_availability_entry_entries_aux_channel_bitmap, tvb,
1846 offset + 4, 2, ENC_LITTLE_ENDIAN);
1848 offset += channel_entry_len;
1849 break;
1853 dissected_len += entry_len + 2;
1857 static void
1858 dissect_attr_ndc(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1860 if (attr_len < NAN_NDC_MIN_LENGTH)
1862 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1863 return;
1866 static int* const ndc_ctr_fields[] = {
1867 &hf_nan_attr_ndc_ctrl_selected,
1868 NULL
1871 static int* const ndc_map_id_fields[] = {
1872 &hf_nan_attr_ndc_map_id_related_sch,
1873 NULL
1876 proto_tree_add_item(attr_tree, hf_nan_attr_ndc_id, tvb, offset + 3, 6, ENC_NA);
1877 proto_tree_add_bitmask(attr_tree, tvb, offset + 9, hf_nan_attr_ndc_ctrl,
1878 ett_ndc_ctr, ndc_ctr_fields, ENC_LITTLE_ENDIAN);
1880 offset += 10;
1881 int dissected_len = 7;
1882 while (dissected_len < attr_len)
1884 uint8_t time_bitmap_len = tvb_get_uint8(tvb, offset + 3);
1885 proto_tree* entry_tree = proto_tree_add_subtree(attr_tree, tvb, offset,
1886 time_bitmap_len + 4, ett_ndc_entries, NULL, "Schedule Entry");
1887 proto_tree_add_bitmask(entry_tree, tvb, offset, hf_nan_map_id,
1888 ett_device_ndc_map_id, ndc_map_id_fields, ENC_LITTLE_ENDIAN);
1889 proto_tree_add_bitmask(entry_tree, tvb, offset + 1,
1890 hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl,
1891 time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
1892 proto_tree_add_item(entry_tree, hf_nan_time_bitmap_len, tvb,
1893 offset + 3, 1, ENC_BIG_ENDIAN);
1894 proto_tree_add_item(entry_tree, hf_nan_time_bitmap, tvb,
1895 offset + 4, time_bitmap_len, ENC_NA);
1897 offset += time_bitmap_len + 4;
1898 dissected_len += time_bitmap_len + 4;
1902 static void
1903 dissect_attr_ndl(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1905 if (attr_len < NAN_NDL_MIN_LENGTH)
1907 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1908 return;
1911 unsigned sub_offset = offset + 3;
1912 unsigned dissected_len = 0;
1913 proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1914 sub_offset++;
1916 static int* const ndl_type_status_fields[] = {
1917 &hf_nan_attr_ndl_type,
1918 &hf_nan_status_1,
1919 NULL
1921 static int* const ndl_control_fields[] = {
1922 &hf_nan_attr_ndl_ctrl_peer_id,
1923 &hf_nan_attr_ndl_ctrl_immutable_schedule_pres,
1924 &hf_nan_attr_ndl_ctrl_ndc_pres,
1925 &hf_nan_attr_ndl_ctrl_qos,
1926 &hf_nan_attr_ndl_ctrl_max_idle_pres,
1927 &hf_nan_attr_ndl_ctrl_type,
1928 &hf_nan_attr_ndl_ctrl_setup_reason,
1929 NULL
1932 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_type_status,
1933 ett_type_status, ndl_type_status_fields, ENC_LITTLE_ENDIAN);
1934 sub_offset++;
1935 proto_tree_add_item(attr_tree, hf_nan_reason_code, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1936 sub_offset++;
1937 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ndl_control,
1938 ett_ndl_control, ndl_control_fields, ENC_LITTLE_ENDIAN);
1940 uint8_t peer_id_pres = tvb_get_bits8(tvb, sub_offset * 8 + 7, 1);
1941 uint8_t immutable_sched_pres = tvb_get_bits8(tvb, sub_offset * 8 + 6, 1);
1942 uint8_t idle_per = tvb_get_bits8(tvb, sub_offset * 8 + 3, 1);
1943 sub_offset++;
1944 dissected_len += 4;
1946 if (peer_id_pres)
1948 proto_tree_add_item(attr_tree, hf_nan_attr_ndl_reserved_peer_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1949 sub_offset++;
1950 dissected_len++;
1952 if (idle_per)
1954 proto_tree_add_item(attr_tree, hf_nan_attr_ndl_max_idle, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
1955 sub_offset += 2;
1956 dissected_len += 2;
1958 if (immutable_sched_pres)
1960 char* info_msg = "Immutable Schedule entry list";
1961 proto_tree* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, attr_len - dissected_len,
1962 ett_ndl_schedule_entries, NULL, info_msg);
1963 while (dissected_len < attr_len)
1965 proto_tree_add_item(sub_attr_tree, hf_nan_map_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1966 sub_offset++;
1967 proto_tree_add_bitmask(sub_attr_tree, tvb, sub_offset, hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl,
1968 time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
1969 sub_offset += 2;
1970 unsigned field_length = tvb_get_uint8(tvb, sub_offset);
1971 proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1972 sub_offset++;
1973 proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap, tvb, sub_offset, field_length, ENC_NA);
1974 sub_offset += field_length;
1975 dissected_len += field_length + 4;
1980 static void
1981 dissect_attr_ndl_qos(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1983 if (attr_len != NAN_NDL_QOS_LENGTH)
1985 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
1986 return;
1989 unsigned sub_offset = offset + 3;
1990 proto_tree_add_item(attr_tree, hf_nan_attr_ndlqos_min_time_slots, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
1991 sub_offset++;
1992 proto_tree_add_item(attr_tree, hf_nan_attr_ndlqos_max_latency, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
1995 static void
1996 dissect_attr_unaligned_schedule(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
1998 if (attr_len < NAN_UNALIGNED_SCH_MIN_LENGTH)
2000 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2001 return;
2004 unsigned sub_offset = offset + 3;
2005 unsigned dissected_len = 0;
2006 static int* const control_fields[] = {
2007 &hf_nan_attr_unaligned_sch_ctrl_schedule_id,
2008 &hf_nan_attr_unaligned_sch_ctrl_seq_id,
2009 NULL
2012 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_unaligned_sch_ctrl,
2013 ett_unaligned_sch_ctrl, control_fields, ENC_LITTLE_ENDIAN);
2014 sub_offset += 2;
2015 proto_tree_add_item(attr_tree, hf_nan_attr_unaligned_sch_starting_time, tvb, sub_offset, 4, ENC_LITTLE_ENDIAN);
2016 sub_offset += 4;
2017 proto_tree_add_item(attr_tree, hf_nan_attr_unaligned_sch_duration, tvb, sub_offset, 4, ENC_LITTLE_ENDIAN);
2018 sub_offset += 4;
2019 proto_tree_add_item(attr_tree, hf_nan_attr_unaligned_sch_period, tvb, sub_offset, 4, ENC_LITTLE_ENDIAN);
2020 sub_offset += 4;
2021 proto_tree_add_item(attr_tree, hf_nan_attr_unaligned_sch_count_down, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2022 sub_offset++;
2024 static int* const ulw_overwrite_fields[] = {
2025 &hf_nan_attr_unaligned_sch_ulw_overwrite_all,
2026 &hf_nan_attr_unaligned_sch_ulw_overwrite_map_id,
2027 NULL
2030 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_unaligned_sch_ulw_overwrite,
2031 ett_unaligned_sch_ulw_overwrite, ulw_overwrite_fields, ENC_LITTLE_ENDIAN);
2032 sub_offset++;
2033 dissected_len += 16;
2035 // ULW Control and Band ID or Channel Entry present
2036 if (dissected_len < attr_len)
2038 static int* const ulw_control_fields[] = {
2039 &hf_nan_attr_unaligned_sch_ulw_ctrl_type,
2040 &hf_nan_attr_unaligned_sch_ulw_ctrl_channel_av,
2041 &hf_nan_attr_unaligned_sch_ulw_ctrl_rxnss,
2042 NULL
2045 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_unaligned_sch_ulw_ctrl,
2046 ett_unaligned_sch_ulw_ctrl, ulw_control_fields, ENC_LITTLE_ENDIAN);
2047 uint8_t entry_type = tvb_get_bits8(tvb, sub_offset * 8 + 6, 2);
2048 sub_offset++;
2050 switch (entry_type)
2052 case NAN_UNALIGNED_SCH_BAND_ID_EXIST:
2053 proto_tree_add_item(attr_tree, hf_nan_attr_availability_entry_entries_band,
2054 tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2055 sub_offset++;
2056 break;
2057 case NAN_UNALIGNED_SCH_CHANNEL_ENTRY_EXIST:
2059 proto_tree* channel_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2060 ett_availability_entry_entries_channel, NULL, "Channel Entry");
2061 proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_channel_op_class,
2062 tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2063 sub_offset++;
2064 proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_channel_bitmap,
2065 tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2066 sub_offset += 2;
2067 proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_primary_channel_bitmap,
2068 tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2069 break;
2071 case NAN_UNALIGNED_SCH_CHANNEL_ENTRY_W_AUX_EXIST:
2073 proto_tree* channel_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2074 ett_availability_entry_entries_channel, NULL, "Channel Entry");
2075 proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_channel_op_class,
2076 tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2077 sub_offset++;
2078 proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_channel_bitmap,
2079 tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2080 sub_offset += 2;
2081 proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_primary_channel_bitmap,
2082 tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2083 sub_offset++;
2084 proto_tree_add_item(channel_tree, hf_nan_attr_availability_entry_entries_aux_channel_bitmap,
2085 tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2086 break;
2092 static void
2093 dissect_attr_ranging_info(proto_tree* attr_tree, tvbuff_t* tvb, int offset)
2095 unsigned sub_offset = offset + 3;
2096 static int* const location_info_availability_fields[] = {
2097 &hf_nan_attr_ranging_info_location_info_avail_lci,
2098 &hf_nan_attr_ranging_info_location_info_avail_geospatial,
2099 &hf_nan_attr_ranging_info_location_info_avail_civic_location,
2100 &hf_nan_attr_ranging_info_location_info_avail_last_movement_pres,
2101 NULL
2104 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ranging_info_location_info_avail,
2105 ett_ranging_info_location_info_availability, location_info_availability_fields, ENC_LITTLE_ENDIAN);
2106 bool loc_exists = tvb_get_bits8(tvb, sub_offset * 8 + 4, 1);
2107 sub_offset++;
2108 if (loc_exists)
2110 proto_tree_add_item(attr_tree, hf_nan_attr_ranging_info_last_movement_indication, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2114 static void
2115 dissect_attr_ranging_setup(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2117 if (attr_len < NAN_RANGING_SETUP_MIN_LENGTH)
2119 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2120 return;
2123 unsigned sub_offset = offset + 3;
2124 unsigned dissected_len = 0;
2125 proto_tree_add_item(attr_tree, hf_nan_dialog_tokens, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2126 sub_offset++;
2128 static int* const ranging_setup_type_status_fields[] = {
2129 &hf_nan_attr_ranging_setup_type,
2130 &hf_nan_status_2,
2131 NULL
2133 static int* const ranging_setup_ctrl_fields[] = {
2134 &hf_nan_attr_ranging_setup_ctrl_report_req,
2135 &hf_nan_attr_ranging_setup_ctrl_ftm_params,
2136 &hf_nan_attr_ranging_setup_ctrl_entry_list,
2137 NULL
2140 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_type_status,
2141 ett_type_status, ranging_setup_type_status_fields, ENC_LITTLE_ENDIAN);
2142 sub_offset++;
2143 proto_tree_add_item(attr_tree, hf_nan_reason_code, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2144 sub_offset++;
2145 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ranging_setup_ctrl,
2146 ett_ranging_setup_ctrl, ranging_setup_ctrl_fields, ENC_LITTLE_ENDIAN);
2147 uint8_t ftm_check = tvb_get_bits8(tvb, sub_offset * 8 + 6, 1);
2148 uint8_t ranging_entry_check = tvb_get_bits8(tvb, sub_offset * 8 + 5, 1);
2149 sub_offset++;
2150 dissected_len += 4;
2152 if (ftm_check)
2154 static int* const ranging_setup_ftm_param_fields[] = {
2155 &hf_nan_attr_ranging_setup_ftm_max_burst_duration,
2156 &hf_nan_attr_ranging_setup_ftm_min_delta,
2157 &hf_nan_attr_ranging_setup_ftm_max_per_burst,
2158 &hf_nan_attr_ranging_setup_ftm_format_bw,
2159 NULL
2162 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_ranging_setup_ftm_params,
2163 ett_ranging_setup_ftm_params, ranging_setup_ftm_param_fields, ENC_LITTLE_ENDIAN);
2164 sub_offset += 3;
2165 dissected_len += 3;
2167 if (ranging_entry_check)
2169 char* info_msg = "Ranging Schedule Entry List";
2170 proto_tree* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, attr_len - dissected_len,
2171 ett_ranging_setup_schedule_entries, NULL, info_msg);
2173 while (dissected_len < attr_len)
2175 proto_tree_add_item(sub_attr_tree, hf_nan_map_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2176 sub_offset++;
2177 proto_tree_add_bitmask(sub_attr_tree, tvb, sub_offset, hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl,
2178 time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
2179 sub_offset += 2;
2180 unsigned field_length = tvb_get_uint8(tvb, sub_offset);
2181 proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2182 sub_offset++;
2183 proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap, tvb, sub_offset, field_length, ENC_NA);
2184 sub_offset += field_length;
2185 dissected_len += field_length + 4;
2190 static void
2191 dissect_attr_ftm_report(proto_tree* attr_tree, tvbuff_t* tvb, int offset)
2193 unsigned sub_offset = offset + 3;
2194 proto_tree_add_item(attr_tree, hf_nan_attr_ftm_range_report, tvb, sub_offset, -1, ENC_NA);
2197 static void
2198 dissect_attr_element_container(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2200 unsigned sub_offset = offset + 3;
2202 // Some header fields and trees are reused.
2203 static int* const container_map_id_fields[] = {
2204 &hf_nan_attr_device_cap_map_id_apply_to,
2205 &hf_nan_attr_device_cap_map_id_associated_maps,
2206 NULL
2208 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_map_id,
2209 ett_device_cap_map_id, container_map_id_fields, ENC_LITTLE_ENDIAN);
2210 sub_offset += 1;
2211 unsigned dissected_length = 1;
2212 proto_tree* sub_tree;
2213 while (dissected_length < attr_len)
2215 unsigned element_id = tvb_get_uint8(tvb, sub_offset);
2216 unsigned element_len = tvb_get_uint8(tvb, sub_offset + 1);
2217 const char* msg = val_to_str(element_id, ie_tag_num_vals, "Unknown element ID (%u)");
2219 sub_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, element_len + 2, ett_ie_tree, NULL, msg);
2220 proto_tree_add_item(sub_tree, hf_nan_attr_container_element_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2221 sub_offset++;
2222 proto_tree_add_item(sub_tree, hf_nan_attr_container_element_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2223 sub_offset++;
2225 ieee80211_tagged_field_data_t field_data = { 0 };
2226 tvbuff_t* ie_tvb = tvb_new_subset_length(tvb, sub_offset, element_len);
2227 field_data.item_tag = sub_tree;
2228 dissector_try_uint_with_data(ie_handle_table, element_id, ie_tvb, pinfo, sub_tree, true, &field_data);
2229 sub_offset += element_len;
2230 dissected_length += element_len + 2;
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)
2237 if (attr_len != NAN_EXTENDED_WLAN_INFRA_LENGTH)
2239 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2240 return;
2243 unsigned sub_offset = offset + 3;
2244 proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN);
2245 sub_offset += 6;
2246 proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
2247 sub_offset += 6;
2248 proto_tree_add_item(attr_tree, hf_nan_attr_wlan_infra_device_role, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2249 sub_offset += 1;
2251 char* info_msg = "Non-NAN Operating Channel Information";
2252 proto_tree* sub_attr_tree_op = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 3,
2253 ett_non_nan_op_channel, NULL, info_msg);
2254 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_global_op_class, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2255 sub_offset++;
2256 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_channel, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2257 sub_offset++;
2258 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_center_freq, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2259 sub_offset++;
2261 char* info_msg_beacon = "Non-NAN Beacon Information";
2262 proto_tree* sub_attr_tree_beacon = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2263 ett_non_nan_beacon, NULL, info_msg_beacon);
2264 proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_tbtt_offset, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2265 sub_offset += 2;
2266 proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_interval, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2267 // sub_offset += 2;
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)
2273 if (attr_len != NAN_EXTENDED_P2P_OP_LENGTH)
2275 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2276 return;
2279 unsigned sub_offset = offset + 3;
2280 static int* const ext_p2p_bitmap_fields[] = {
2281 &hf_nan_attr_p2p_device_role_device,
2282 &hf_nan_attr_p2p_device_role_group_owner,
2283 &hf_nan_attr_p2p_device_role_client,
2284 NULL
2287 proto_tree_add_bitmask(attr_tree, tvb, sub_offset, hf_nan_attr_p2p_device_role,
2288 ett_p2p_device_role, ext_p2p_bitmap_fields, ENC_LITTLE_ENDIAN);
2289 sub_offset += 1;
2290 proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
2291 sub_offset += 6;
2293 char* info_msg = "Non-NAN Operating Channel Information";
2294 proto_tree* sub_attr_tree_op = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 3,
2295 ett_non_nan_op_channel, NULL, info_msg);
2296 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_global_op_class, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2297 sub_offset++;
2298 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_channel, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2299 sub_offset++;
2300 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_center_freq, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2301 sub_offset++;
2303 char* info_msg_beacon = "Non-NAN Beacon Information";
2304 proto_tree* sub_attr_tree_beacon = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2305 ett_non_nan_beacon, NULL, info_msg_beacon);
2306 proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_tbtt_offset, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2307 sub_offset += 2;
2308 proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_interval, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2309 // sub_offset += 2;
2312 static void
2313 dissect_attr_extended_ibss(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2315 if (attr_len != NAN_EXTENDED_IBSS_LENGTH)
2317 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2318 return;
2321 unsigned sub_offset = offset + 3;
2322 proto_tree_add_item(attr_tree, hf_nan_bss_id, tvb, sub_offset, 6, ENC_LITTLE_ENDIAN);
2323 sub_offset += 6;
2324 proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
2325 sub_offset += 6;
2327 char* info_msg = "Non-NAN Operating Channel Information";
2328 proto_tree* sub_attr_tree_op = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 3,
2329 ett_non_nan_op_channel, NULL, info_msg);
2330 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_global_op_class, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2331 sub_offset++;
2332 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_channel, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2333 sub_offset++;
2334 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_center_freq, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2335 sub_offset++;
2337 char* info_msg_beacon = "Non-NAN Beacon Information";
2338 proto_tree* sub_attr_tree_beacon = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2339 ett_non_nan_beacon, NULL, info_msg_beacon);
2340 proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_tbtt_offset, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2341 sub_offset += 2;
2342 proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_interval, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2343 // sub_offset += 2;
2346 static void
2347 dissect_attr_extended_mesh(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2349 if (attr_len < NAN_EXTENDED_MESH_MIN_LENGTH)
2351 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2352 return;
2355 unsigned sub_offset = offset + 3;
2356 unsigned length = tvb_get_uint16(tvb, sub_offset - 2, ENC_LITTLE_ENDIAN);
2357 proto_tree_add_item(attr_tree, hf_nan_mac_address, tvb, sub_offset, 6, ENC_NA);
2358 sub_offset += 6;
2360 char* info_msg = "Non-NAN Operating Channel Information";
2361 proto_tree* sub_attr_tree_op = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 3,
2362 ett_non_nan_op_channel, NULL, info_msg);
2363 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_global_op_class, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2364 sub_offset++;
2365 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_channel, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2366 sub_offset++;
2367 proto_tree_add_item(sub_attr_tree_op, hf_nan_non_op_channel_center_freq, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2368 sub_offset++;
2370 char* info_msg_beacon = "Non-NAN Beacon Information";
2371 proto_tree* sub_attr_tree_beacon = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 4,
2372 ett_non_nan_beacon, NULL, info_msg_beacon);
2373 proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_tbtt_offset, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2374 sub_offset += 2;
2375 proto_tree_add_item(sub_attr_tree_beacon, hf_nan_non_beacon_interval, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2376 sub_offset += 2;
2378 proto_tree_add_item(attr_tree, hf_nan_attr_mesh_id, tvb, sub_offset, length - sub_offset + 3, ENC_NA);
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)
2384 if (attr_len < NAN_CIPHER_SUITE_INFO_MIN_LENGTH)
2386 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2387 return;
2390 unsigned sub_offset = offset + 3;
2391 unsigned dissected_len = 0;
2393 proto_tree* caps_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, 1, ett_nan_cipher_suite_capabilities, NULL, "Capabilities");
2394 proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_ndtksa_nmtksa_replay_counters, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2395 proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_gtksa_igtksa_bigtksa_support, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2396 proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_gtksa_replay_counters, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2397 proto_tree_add_item(caps_tree, hf_nan_attr_cipher_suite_capabilities_igtksa_bigtksa_cipher, tvb, sub_offset, 1, ENC_LITTLE_ENDIAN);
2399 sub_offset++;
2400 dissected_len++;
2402 char* info_msg = "Cipher Suite List";
2403 proto_tree* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, attr_len - dissected_len,
2404 ett_cipher_suite_info_list, NULL, info_msg);
2406 while (dissected_len < attr_len)
2408 proto_tree_add_item(sub_attr_tree, hf_nan_attr_cipher_suite_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2409 sub_offset++;
2410 proto_tree_add_item(sub_attr_tree, hf_nan_publish_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2411 sub_offset++;
2412 dissected_len += 2;
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)
2419 if (attr_len < NAN_CIPHER_SUITE_INFO_MIN_LENGTH)
2421 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2422 return;
2425 unsigned sub_offset = offset + 3;
2426 unsigned dissected_len = 0;
2428 while (dissected_len < attr_len)
2430 unsigned field_length = tvb_get_uint16(tvb, sub_offset, ENC_LITTLE_ENDIAN);
2431 proto_item* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, field_length + 4,
2432 ett_attributes, NULL, "Security Context Identifier");
2433 proto_tree_add_item(sub_attr_tree, hf_nan_attr_security_context_identifier_len, tvb, sub_offset, 2, ENC_LITTLE_ENDIAN);
2434 sub_offset += 2;
2435 proto_tree_add_item(sub_attr_tree, hf_nan_attr_security_context_identifier_type, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2436 sub_offset++;
2437 proto_tree_add_item(sub_attr_tree, hf_nan_publish_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2438 sub_offset++;
2439 proto_tree_add_item(sub_attr_tree, hf_nan_attr_security_context_identifier, tvb, sub_offset, field_length, ENC_NA);
2440 sub_offset += field_length;
2441 dissected_len += field_length + 4;
2445 static void
2446 dissect_attr_shared_key_descriptor(proto_tree* attr_tree, tvbuff_t* tvb, int offset)
2448 unsigned sub_offset = offset + 3;
2449 proto_tree_add_item(attr_tree, hf_nan_publish_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2450 sub_offset += 1;
2451 proto_tree_add_item(attr_tree, hf_nan_attr_shared_key_rsna_descriptor, tvb, sub_offset, -1, ENC_NA);
2454 static void
2455 dissect_attr_public_availability(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2457 if (attr_len < NAN_PUBLIC_AVAIL_MIN_LENGTH)
2459 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2460 return;
2463 unsigned sub_offset = offset + 3;
2464 unsigned dissected_len = 0;
2466 proto_tree* sub_attr_tree = proto_tree_add_subtree(attr_tree, tvb, sub_offset, attr_len,
2467 ett_public_availability_sch_entries, NULL, "Public Availability Schedule Entry List");
2468 while (dissected_len < attr_len)
2470 proto_tree_add_item(sub_attr_tree, hf_nan_map_id, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2471 sub_offset++;
2472 proto_tree_add_bitmask(sub_attr_tree, tvb, sub_offset, hf_nan_time_bitmap_ctrl, ett_time_bitmap_ctrl,
2473 time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
2474 sub_offset += 2;
2475 unsigned field_length = tvb_get_uint8(tvb, sub_offset);
2476 proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap_len, tvb, sub_offset, 1, ENC_BIG_ENDIAN);
2477 sub_offset++;
2478 proto_tree_add_item(sub_attr_tree, hf_nan_time_bitmap, tvb, sub_offset, field_length, ENC_NA);
2479 sub_offset += field_length;
2480 dissected_len += field_length + 4;
2484 static void
2485 dissect_attr_vendor_specific(proto_tree* attr_tree, tvbuff_t* tvb, int offset, uint16_t attr_len, packet_info* pinfo)
2487 if (attr_len < NAN_VENDOR_SPECIFIC_MIN_LENGTH)
2489 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2490 return;
2493 unsigned sub_offset = offset + 3;
2494 tvbuff_t* ie_tvb = tvb_new_subset_length(tvb, sub_offset, -1);
2495 ieee80211_tagged_field_data_t field_data = { 0 };
2496 field_data.item_tag = attr_tree;
2497 dissector_try_uint_with_data(ie_handle_table, TAG_VENDOR_SPECIFIC_IE, ie_tvb, pinfo, attr_tree, true, &field_data);
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)
2503 if (attr_len < NAN_DEVICE_CAPABILITY_EXTENSION_MIN_LENGTH)
2505 /* At least has 9 bits defined in NAN-R4 spec */
2506 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2507 return;
2510 static int* const capability_info_fields[] = {
2511 &hf_nan_attr_device_capability_extension_6g_regulatory_info_presented,
2512 &hf_nan_attr_device_capability_extension_6g_regulatory_info,
2513 &hf_nan_attr_device_capability_extension_6g_regulatory_info_reserved,
2514 &hf_nan_attr_device_capability_extension_paring_setup_enabled,
2515 &hf_nan_attr_device_capability_extension_npk_nik_cache_enabled,
2516 NULL
2519 proto_tree_add_bitmask(attr_tree, tvb, offset + 3, hf_nan_attr_device_capability_extension,
2520 ett_device_capability_extension, capability_info_fields, ENC_LITTLE_ENDIAN);
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)
2526 if (attr_len < NAN_IDENTITY_RESOLUTION_MIN_LEN)
2528 /* At least 1 byte: Cipher version */
2529 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2530 return;
2533 proto_tree_add_item(attr_tree, hf_nan_attr_identity_cipher_version, tvb,
2534 offset + 3, 1, ENC_LITTLE_ENDIAN);
2536 uint8_t cipher_version = tvb_get_uint8(tvb, offset + 3);
2537 switch (cipher_version)
2539 case 0:
2540 proto_tree_add_item(attr_tree, hf_nan_attr_identity_resolution_nonce, tvb,
2541 offset + 4, 8, ENC_NA);
2542 proto_tree_add_item(attr_tree, hf_nan_attr_identity_resolution_tag, tvb,
2543 offset + 12, 8, ENC_NA);
2544 break;
2545 default:
2546 proto_tree_add_item(attr_tree, hf_nan_attr_reserved, tvb,
2547 offset + 3, attr_len - 1, ENC_NA);
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)
2554 if (attr_len < NAN_PAIRING_BOOTSTRAPPING_LEN)
2556 /* At least 5 bytes: Dialog Token(1) + Type and Status(1) + Reason Code(1) + Pairing Bootstrapping Method(2) */
2557 expert_add_info(pinfo, attr_tree, &ei_nan_elem_len_invalid);
2558 return;
2560 int npba_local_offset = offset + 3;
2562 /* Dialog Token */
2563 proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_dialog_token, tvb,
2564 npba_local_offset, 1, ENC_LITTLE_ENDIAN);
2565 npba_local_offset += 1;
2567 /* Type and Status */
2568 uint8_t type_status = tvb_get_uint8(tvb, npba_local_offset);
2569 uint8_t type = type_status & 0x0f;
2570 uint8_t status = (type_status & 0xf0) >> 4;
2572 static int* const type_and_status_fields[] = {
2573 &hf_nan_attr_pairing_bootstrapping_type,
2574 &hf_nan_attr_pairing_bootstrapping_status,
2575 NULL
2577 proto_tree_add_bitmask(attr_tree, tvb, npba_local_offset, hf_nan_attr_pairing_bootstrapping_type_status,
2578 ett_nan_pairing_bootstrapping_type_status, type_and_status_fields, ENC_LITTLE_ENDIAN);
2579 npba_local_offset += 1;
2581 /* Resaon code
2582 * Indicate the reject reason when Type = 2 (Response) and Status = 1 (Rejected); otherwise, reserved */
2583 if ((type == 2) && (status == 1))
2585 proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_resaon_code, tvb,
2586 npba_local_offset, 1, ENC_LITTLE_ENDIAN);
2588 else
2590 proto_tree_add_item(attr_tree, hf_nan_attr_reserved, tvb,
2591 npba_local_offset, 1, ENC_NA);
2593 npba_local_offset += 1;
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)
2599 bool comeback_presented = (attr_len > NAN_PAIRING_BOOTSTRAPPING_LEN);
2601 bool comeback_after_presented = comeback_presented && ((type == 2) && (status == 2));
2603 if (comeback_after_presented)
2605 proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_comeback_after, tvb,
2606 npba_local_offset, 2, ENC_LITTLE_ENDIAN);
2607 npba_local_offset += 2;
2610 if (comeback_presented)
2612 uint8_t cookie_len = tvb_get_uint8(tvb, npba_local_offset);
2613 proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_comeback_cookie_len, tvb,
2614 npba_local_offset, 1, ENC_LITTLE_ENDIAN);
2615 npba_local_offset += 1;
2617 if (cookie_len)
2619 proto_tree_add_item(attr_tree, hf_nan_attr_pairing_bootstrapping_comeback_cookie, tvb,
2620 npba_local_offset, cookie_len, ENC_NA);
2621 npba_local_offset += cookie_len;
2625 /* Pairing Bootstrapping Method */
2626 static int* const pairing_bootstrapping_method[] = {
2627 &hf_nan_attr_pairing_bootstrapping_method_opportunistic_bootstrapping,
2628 &hf_nan_attr_pairing_bootstrapping_method_pin_code_display,
2629 &hf_nan_attr_pairing_bootstrapping_method_passphrase_display,
2630 &hf_nan_attr_pairing_bootstrapping_method_qr_code_display,
2631 &hf_nan_attr_pairing_bootstrapping_method_nfc_tag,
2632 &hf_nan_attr_pairing_bootstrapping_method_keypad_pin_code_only,
2633 &hf_nan_attr_pairing_bootstrapping_method_keypad_passphrase,
2634 &hf_nan_attr_pairing_bootstrapping_method_qr_code_scan,
2635 &hf_nan_attr_pairing_bootstrapping_method_nfc_reader,
2636 &hf_nan_attr_pairing_bootstrapping_method_reserved,
2637 &hf_nan_attr_pairing_bootstrapping_method_service_managed_bootstrapping,
2638 &hf_nan_attr_pairing_bootstrapping_method_bootstrapping_handshakes_skipped,
2639 NULL
2641 if (type == 2 && status)
2643 proto_tree_add_item(attr_tree, hf_nan_attr_reserved, tvb,
2644 npba_local_offset, 2, ENC_NA);
2646 else
2648 proto_tree_add_bitmask(attr_tree, tvb, npba_local_offset, hf_nan_attr_pairing_bootstrapping_methods,
2649 ett_nan_pairing_bootstrapping_method, pairing_bootstrapping_method, ENC_LITTLE_ENDIAN);
2653 static void
2654 find_attribute_field(proto_tree* nan_tree, tvbuff_t* tvb, unsigned tvb_len, unsigned* offset, packet_info* pinfo)
2656 if ((tvb_len - *offset) < 3)
2658 proto_tree_add_expert_format(nan_tree, pinfo, &ei_nan_elem_len_invalid, tvb, *offset, -1,
2659 "Insufficient remaining packet bytes for NAN attribute");
2660 *offset = tvb_len;
2661 return;
2664 int attr_id = tvb_get_uint8(tvb, *offset);
2665 uint16_t attr_len = tvb_get_letohs(tvb, *offset + 1);
2667 if ((*offset + 3 + attr_len) > tvb_len)
2669 proto_tree_add_expert_format(nan_tree, pinfo, &ei_nan_elem_len_invalid, tvb, *offset, -1,
2670 "Attribute length (%u) exceeds remaining packet length. Attribute id: %u", attr_len, attr_id);
2671 *offset = tvb_len;
2672 return;
2675 proto_tree* attr_tree = proto_tree_add_subtree(nan_tree, tvb, *offset, attr_len + 3,
2676 ett_attributes, NULL, val_to_str(attr_id, attribute_types, "Unknown attribute ID (%u)"));
2678 proto_tree_add_item(attr_tree, hf_nan_attribute_type, tvb, *offset, 1, ENC_NA);
2679 proto_tree_add_item(attr_tree, hf_nan_attribute_len, tvb, *offset + 1, 2, ENC_LITTLE_ENDIAN);
2681 switch (attr_id) {
2682 case NAN_ATTR_SERVICE_DESCRIPTOR:
2683 dissect_attr_sda(attr_tree, tvb, *offset, attr_len, pinfo);
2684 break;
2685 case NAN_ATTR_MASTER_INDICATION:
2686 dissect_attr_master_indication(attr_tree, tvb, *offset, attr_len, pinfo);
2687 break;
2688 case NAN_ATTR_CLUSTER:
2689 dissect_attr_cluster(attr_tree, tvb, *offset, attr_len, pinfo);
2690 break;
2691 case NAN_ATTR_CIPHER_SUITE_INFO:
2692 dissect_attr_cipher_suite_info(attr_tree, tvb, *offset, attr_len, pinfo);
2693 break;
2694 case NAN_ATTR_SECURITY_CONTEXT_INFO:
2695 dissect_attr_security_context_info(attr_tree, tvb, *offset, attr_len, pinfo);
2696 break;
2697 case NAN_ATTR_SHARED_KEY_DESCRIPTOR:
2698 dissect_attr_shared_key_descriptor(attr_tree, tvb, *offset);
2699 break;
2700 case NAN_ATTR_PUBLIC_AVAILABILITY:
2701 dissect_attr_public_availability(attr_tree, tvb, *offset, attr_len, pinfo);
2702 break;
2703 case NAN_ATTR_ELEMENT_CONTAINER:
2704 dissect_attr_element_container(attr_tree, tvb, *offset, attr_len, pinfo);
2705 break;
2706 case NAN_ATTR_FTM_RANGING_REPORT:
2707 dissect_attr_ftm_report(attr_tree, tvb, *offset);
2708 break;
2709 case NAN_ATTR_RANGING_SETUP:
2710 dissect_attr_ranging_setup(attr_tree, tvb, *offset, attr_len, pinfo);
2711 break;
2712 case NAN_ATTR_RANGING_INFORMATION:
2713 dissect_attr_ranging_info(attr_tree, tvb, *offset);
2714 break;
2715 case NAN_ATTR_UNALIGNED_SCHEDULE:
2716 dissect_attr_unaligned_schedule(attr_tree, tvb, *offset, attr_len, pinfo);
2717 break;
2718 case NAN_ATTR_NDL_QOS:
2719 dissect_attr_ndl_qos(attr_tree, tvb, *offset, attr_len, pinfo);
2720 break;
2721 case NAN_ATTR_EXTENDED_WLAN_INFRA:
2722 dissect_attr_extended_wlan_infra(attr_tree, tvb, *offset, attr_len, pinfo);
2723 break;
2724 case NAN_ATTR_EXTENDED_P2P_OPERATION:
2725 dissect_attr_extended_p2p_operation(attr_tree, tvb, *offset, attr_len, pinfo);
2726 break;
2727 case NAN_ATTR_EXTENDED_IBSS:
2728 dissect_attr_extended_ibss(attr_tree, tvb, *offset, attr_len, pinfo);
2729 break;
2730 case NAN_ATTR_EXTENDED_MESH:
2731 dissect_attr_extended_mesh(attr_tree, tvb, *offset, attr_len, pinfo);
2732 break;
2733 case NAN_ATTR_CONNECTION_CAPABILITY:
2734 dissect_attr_connection_capability(attr_tree, tvb, *offset, attr_len, pinfo);
2735 break;
2736 case NAN_ATTR_CLUSTER_DISCOVERY:
2737 dissect_attr_cluter_discovery(attr_tree, tvb, *offset, attr_len, pinfo);
2738 break;
2739 case NAN_ATTR_RANGING:
2740 dissect_attr_ranging(attr_tree, tvb, *offset, attr_len, pinfo);
2741 break;
2742 case NAN_ATTR_COUNTRY_CODE:
2743 dissect_attr_country_code(attr_tree, tvb, *offset);
2744 break;
2745 case NAN_ATTR_FURTHER_AVAILABILITY_MAP:
2746 dissect_attr_further_availability_map(attr_tree, tvb, *offset);
2747 break;
2748 case NAN_ATTR_FURTHER_SERVICE_DISCOVERY:
2749 dissect_attr_further_service_discovery(attr_tree, tvb, *offset, attr_len);
2750 break;
2751 case NAN_ATTR_MESH:
2752 dissect_attr_mesh(attr_tree, tvb, *offset, attr_len, pinfo);
2753 break;
2754 case NAN_ATTR_IBSS:
2755 dissect_attr_ibss(attr_tree, tvb, *offset, attr_len, pinfo);
2756 break;
2757 case NAN_ATTR_P2P_OPERATION:
2758 dissect_attr_p2p_operation(attr_tree, tvb, *offset, attr_len, pinfo);
2759 break;
2760 case NAN_ATTR_WLAN_INFRA:
2761 dissect_attr_wlan_infra(attr_tree, tvb, *offset, attr_len, pinfo);
2762 break;
2763 case NAN_ATTR_NDP:
2764 dissect_attr_ndp(attr_tree, tvb, *offset, attr_len, pinfo);
2765 break;
2766 case NAN_ATTR_NDP_EXTENSION:
2767 dissect_attr_ndpe(attr_tree, tvb, *offset, attr_len, pinfo);
2768 break;
2769 case NAN_ATTR_SERVICE_DESCRIPTOR_EXTENSION:
2770 dissect_attr_sdea(attr_tree, tvb, *offset, attr_len, pinfo);
2771 break;
2772 case NAN_ATTR_DEVICE_CAPABILITY:
2773 dissect_attr_device_capability(attr_tree, tvb, *offset, attr_len, pinfo);
2774 break;
2775 case NAN_ATTR_AVAILABILITY:
2776 dissect_attr_availability(attr_tree, tvb, *offset, attr_len, pinfo);
2777 break;
2778 case NAN_ATTR_NDC:
2779 dissect_attr_ndc(attr_tree, tvb, *offset, attr_len, pinfo);
2780 break;
2781 case NAN_ATTR_SERVICE_ID_LIST:
2782 case NAN_ATTR_SUBSCRIBE_SERVICE_ID_LIST:
2783 dissect_attr_service_id_list(attr_tree, tvb, *offset, attr_len, pinfo);
2784 break;
2785 case NAN_ATTR_VENDOR_SPECIFIC:
2786 dissect_attr_vendor_specific(attr_tree, tvb, *offset, attr_len, pinfo);
2787 break;
2788 case NAN_ATTR_NDL:
2789 dissect_attr_ndl(attr_tree, tvb, *offset, attr_len, pinfo);
2790 break;
2791 case NAN_ATTR_DEVICE_CAPABILITY_EXTENSION:
2792 dissect_attr_device_capability_extension(attr_tree, tvb, *offset, attr_len, pinfo);
2793 break;
2794 case NAN_ATTR_IDENTITY_RESOLUTION:
2795 dissect_attr_nan_identity_resolution(attr_tree, tvb, *offset, attr_len, pinfo);
2796 break;
2797 case NAN_ATTR_PAIRING_BOOTSTRAPPING:
2798 dissect_attr_nan_pairing_bootstrapping(attr_tree, tvb, *offset, attr_len, pinfo);
2799 break;
2800 default:
2801 expert_add_info(pinfo, attr_tree, &ei_nan_unknown_attr_id);
2804 *offset += attr_len + 3;
2807 static int
2808 dissect_nan_beacon(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
2810 unsigned offset = 0;
2812 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NAN");
2815 // Workaround to identify NAN Discovery vs Synchronization beacon frames.
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".
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.
2828 // An interval of 100, meaning .1024 seconds, means it's a Discovery
2829 // beacon, and an interval of 512, meaning .524288 seconds, means
2830 // it's a Sync beacon.
2832 const char* info_text = col_get_text(pinfo->cinfo, COL_INFO);
2833 if (info_text != NULL && g_str_has_suffix(info_text, "100"))
2835 col_prepend_fstr(pinfo->cinfo, COL_INFO, "Discovery ");
2837 else if (info_text != NULL && g_str_has_suffix(info_text, "512"))
2839 col_prepend_fstr(pinfo->cinfo, COL_INFO, "Sync ");
2841 else
2843 expert_add_info(pinfo, tree, &ei_nan_unknown_beacon_type);
2844 col_prepend_fstr(pinfo->cinfo, COL_INFO, "[Unknown] ");
2847 proto_item* ti = proto_tree_add_item(tree, proto_nan, tvb, 0, -1, ENC_NA);
2848 proto_tree* nan_tree = proto_item_add_subtree(ti, ett_nan);
2850 unsigned tvb_len = tvb_reported_length(tvb);
2851 while (offset < tvb_len)
2853 find_attribute_field(nan_tree, tvb, tvb_len, &offset, pinfo);
2855 return tvb_captured_length(tvb);
2858 static int
2859 dissect_nan_action(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
2861 unsigned offset = 0;
2863 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NAN");
2865 proto_tree* upper_tree = proto_tree_get_parent_tree(tree);
2866 proto_item* ti = proto_tree_add_item(upper_tree, proto_nan, tvb, 0, -1, ENC_NA);
2867 proto_tree* nan_tree = proto_item_add_subtree(ti, ett_nan);
2869 uint8_t subtype = tvb_get_uint8(tvb, offset);
2870 const char* subtype_text = rval_to_str(subtype, action_frame_type_values, "Unknown type (%u)");
2871 proto_item_set_text(ti, "%s", subtype_text);
2872 proto_tree_add_item(nan_tree, hf_nan_action_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
2874 col_prepend_fstr(pinfo->cinfo, COL_INFO, "%s", subtype_text);
2875 offset++;
2877 unsigned tvb_len = tvb_reported_length(tvb);
2878 while (offset < tvb_len)
2880 find_attribute_field(nan_tree, tvb, tvb_len, &offset, pinfo);
2882 return tvb_captured_length(tvb);
2885 static int
2886 dissect_nan_service_discovery(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
2888 unsigned offset = 0;
2889 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NAN");
2890 proto_item* ti = proto_tree_add_item(tree, proto_nan, tvb, 0, -1, ENC_NA);
2891 proto_tree* nan_tree = proto_item_add_subtree(ti, ett_nan);
2893 unsigned tvb_len = tvb_reported_length(tvb);
2894 while (offset < tvb_len)
2896 find_attribute_field(nan_tree, tvb, tvb_len, &offset, pinfo);
2898 return tvb_captured_length(tvb);
2901 void
2902 proto_register_nan(void)
2904 static hf_register_info hf[] = {
2905 { &hf_nan_attribute_type,
2907 "Attribute Type",
2908 "wifi_nan.attribute.type",
2909 FT_UINT8, BASE_DEC, VALS(attribute_types), 0x0, NULL, HFILL
2912 { &hf_nan_attribute_len,
2914 "Attribute Length",
2915 "wifi_nan.attribute.len",
2916 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
2919 { &hf_nan_action_subtype,
2921 "Subtype",
2922 "wifi_nan.action.subtype",
2923 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(action_frame_type_values), 0x0, NULL, HFILL
2926 { &hf_nan_instance_id,
2928 "Instance ID",
2929 "wifi_nan.instance_id",
2930 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
2933 { &hf_nan_service_id,
2935 "Service ID",
2936 "wifi_nan.service_id",
2937 FT_BYTES, SEP_COLON, NULL, 0x0, NULL, HFILL
2940 { &hf_nan_map_id,
2942 "Map ID",
2943 "wifi_nan.map_id",
2944 FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
2947 { &hf_nan_oui,
2949 "OUI",
2950 "wifi_nan.oui",
2951 FT_BYTES, SEP_COLON, NULL, 0x0, NULL, HFILL
2954 { &hf_nan_type_status,
2956 "Type and Status",
2957 "wifi_nan.type_status",
2958 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
2961 { &hf_nan_reason_code,
2963 "Reason Code",
2964 "wifi_nan.reason_code",
2965 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(reason_code_values), 0x0, NULL, HFILL
2968 { &hf_nan_status_1,
2970 "Status",
2971 "wifi_nan.status",
2972 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(status_type1_values), 0xF0, NULL, HFILL
2975 { &hf_nan_status_2,
2977 "Status",
2978 "wifi_nan.status",
2979 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(status_type2_values), 0xF0, NULL, HFILL
2982 { &hf_nan_bss_id,
2984 "BSS ID",
2985 "wifi_nan.bss_id",
2986 FT_UINT48, BASE_DEC, NULL, 0x0, NULL, HFILL
2989 { &hf_nan_availability_intervals_bitmap,
2991 "Availability Intervals Bitmap",
2992 "wifi_nan.availability_intervals_bitmap",
2993 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
2996 { &hf_nan_mac_address,
2998 "MAC Address",
2999 "wifi_nan.mac_address",
3000 FT_BYTES, SEP_COLON, NULL, 0x0, NULL, HFILL
3003 { &hf_nan_publish_id,
3005 "Publish ID",
3006 "wifi_nan.publish_id",
3007 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3010 { &hf_nan_dialog_tokens,
3012 "Dialog Token",
3013 "wifi_nan.dialog_token",
3014 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3017 { &hf_nan_time_bitmap,
3019 "Time Bitmap",
3020 "wifi_nan.time_bitmap",
3021 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3024 { &hf_nan_time_bitmap_len,
3026 "Time Bitmap Length",
3027 "wifi_nan.time_bitmap.len",
3028 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3031 { &hf_nan_time_bitmap_ctrl,
3033 "Time Bitmap Control",
3034 "wifi_nan.time_bitmap.ctrl",
3035 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
3038 { &hf_nan_time_bitmap_ctrl_bit_duration,
3040 "Bit Duration",
3041 "wifi_nan.time_bitmap.ctrl.bit_duration",
3042 FT_UINT16, BASE_DEC | BASE_RANGE_STRING, RVALS(availability_entry_time_bitmap_ctr_bit_duration_type),
3043 0x0007, NULL, HFILL
3046 { &hf_nan_time_bitmap_ctrl_period,
3048 "Period",
3049 "wifi_nan.time_bitmap.ctrl.period",
3050 FT_UINT16, BASE_DEC, VALS(availability_entry_time_bitmap_ctr_period_type),
3051 0x0038, NULL, HFILL
3054 { &hf_nan_time_bitmap_ctrl_start_offset,
3056 "Start Offset",
3057 "wifi_nan.time_bitmap.ctrl.start_offset",
3058 FT_UINT16, BASE_DEC, NULL, 0x7FC0, NULL, HFILL
3061 { &hf_nan_map_ctrl_map_id,
3063 "Map ID",
3064 "wifi_nan.map_ctrl.map_id",
3065 FT_UINT8, BASE_HEX_DEC, NULL, 0xF, NULL, HFILL
3068 { &hf_nan_map_ctrl_availability_interval_duration,
3070 "Availability Interval Duration",
3071 "wifi_nan.map_ctrl.interval_duration",
3072 FT_UINT8, BASE_DEC, VALS(map_ctrl_availability_interval_duration), 0x30, NULL, HFILL
3075 { &hf_nan_map_ctrl_repeat,
3077 "Repeat",
3078 "wifi_nan.map_ctrl.repeat",
3079 FT_UINT8, BASE_DEC, NULL, 0x40, NULL, HFILL
3082 { &hf_nan_map_ctrl_field,
3084 "Map Control",
3085 "wifi_nan.map_ctrl",
3086 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3089 { &hf_nan_non_op_channel_global_op_class,
3091 "Global Operation Class",
3092 "wifi_nan.non_op_channel.global_op_class",
3093 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3096 { &hf_nan_non_op_channel_channel,
3098 "Channel",
3099 "wifi_nan.non_op_channel.channel",
3100 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3103 { &hf_nan_non_op_channel_center_freq,
3105 "Channel Center Frequency",
3106 "wifi_nan.non_op_channel.center_freq",
3107 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3110 { &hf_nan_non_beacon_tbtt_offset,
3112 "TBTT Offset",
3113 "wifi_nan.non_beacon.tbtt_offset",
3114 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3117 { &hf_nan_non_beacon_interval,
3119 "Beacon Interval",
3120 "wifi_nan.non_beacon.interval",
3121 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3124 { &hf_nan_attr_master_preference,
3126 "Master Preference",
3127 "wifi_nan.master_indication.preference",
3128 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3131 { &hf_nan_attr_master_random_factor,
3133 "Random Factor",
3134 "wifi_nan.master_indication.random_factor",
3135 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3138 { &hf_nan_attr_cluster_anchor_master_rank,
3140 "Anchor Master Rank",
3141 "wifi_nan.cluster.anchor_master_rank",
3142 FT_UINT64, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL
3145 { &hf_nan_attr_cluster_hop_count,
3147 "Hop Count to Anchor Master",
3148 "wifi_nan.cluster.hop_count",
3149 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3152 { &hf_nan_attr_cluster_beacon_transmission_time,
3154 "Anchor Master Beacon Transmission Time",
3155 "wifi_nan.cluster.beacon_transmission_time",
3156 FT_UINT32, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3159 { &hf_nan_attr_sda_requestor_instance_id,
3161 "Requestor Instance ID",
3162 "wifi_nan.sda.requestor_instance_id",
3163 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3166 { &hf_nan_attr_sda_sc,
3168 "Service Control",
3169 "wifi_nan.sda.sc",
3170 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3173 { &hf_nan_attr_sda_sc_type,
3175 "Service Control Type",
3176 "wifi_nan.sda.sc.type",
3177 FT_UINT8, BASE_HEX, VALS(service_ctr_type), 0x03, NULL, HFILL
3180 { &hf_nan_attr_sda_sc_matching_filter,
3182 "Matching Filter Present",
3183 "wifi_nan.sda.sc.matching_filter",
3184 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL
3187 { &hf_nan_attr_sda_sc_service_response,
3189 "Service Response Filter Present",
3190 "wifi_nan.sda.sc.service_response",
3191 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL
3194 { &hf_nan_attr_sda_sc_service_info,
3196 "Service Info Present",
3197 "wifi_nan.sda.sc.service_info",
3198 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
3201 { &hf_nan_attr_sda_sc_discovery_range,
3203 "Discovery Range Limited",
3204 "wifi_nan.sda.sc.discovery_range",
3205 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL
3208 { &hf_nan_attr_sda_sc_binding_bitmap,
3210 "Binding Bitmap Present",
3211 "wifi_nan.sda.sc.binding_bitmap",
3212 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL
3215 { &hf_nan_attr_sda_binding_bitmap,
3217 "Binding Bitmap",
3218 "wifi_nan.sda.binding_bitmap",
3219 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
3222 { &hf_nan_attr_sda_matching_filter_len,
3224 "Matching Filter Length",
3225 "wifi_nan.sda.matching_filter_len",
3226 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3229 { &hf_nan_attr_sda_matching_filter_val,
3231 "Matching Filter Value",
3232 "wifi_nan.sda.matching_filter_val",
3233 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3236 { &hf_nan_attr_sda_service_response_filter_len,
3238 "Service Response Filter Length",
3239 "wifi_nan.sda.service_response_filter_len",
3240 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3243 { &hf_nan_attr_sda_srf_ctr,
3245 "SRF Control",
3246 "wifi_nan.sda.srf_ctr",
3247 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3250 { &hf_nan_attr_sda_srf_ctr_type,
3252 "SRF Type",
3253 "wifi_nan.sda.srf_type",
3254 FT_BOOLEAN, 8, TFS(&srf_type_flags), 0x01, NULL, HFILL
3257 { &hf_nan_attr_sda_srf_ctr_include,
3259 "Include",
3260 "wifi_nan.sda.srf_include",
3261 FT_BOOLEAN, 8, TFS(&srf_include_flags), 0x02, NULL, HFILL
3264 { &hf_nan_attr_sda_srf_ctr_bloom_filter_index,
3266 "Bloom Filter Index",
3267 "wifi_nan.sda.srf_bloom_filter_index",
3268 FT_UINT8, BASE_DEC_HEX, NULL, 0x0C, NULL, HFILL
3271 { &hf_nan_attr_sda_srf_address_set,
3273 "Address Set",
3274 "wifi_nan.sda.srf_address_set",
3275 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3278 { &hf_nan_attr_sda_service_info_len,
3280 "Service Info Length",
3281 "wifi_nan.sda.service_info_len",
3282 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3285 { &hf_nan_attr_sda_service_info,
3287 "Service Info",
3288 "wifi_nan.sda.service_info",
3289 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3292 { &hf_nan_attr_sdea_ctr,
3294 "SDEA Control",
3295 "wifi_nan.sdea.ctr",
3296 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
3299 { &hf_nan_attr_sdea_ctr_fsd,
3301 "FSD Required",
3302 "wifi_nan.sdea.ctr_fsd",
3303 FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL
3306 { &hf_nan_attr_sdea_ctr_fsd_w_gas,
3308 "FSD with GAS",
3309 "wifi_nan.sdea.ctr_fsd_w_gas",
3310 FT_BOOLEAN, 16, NULL, 0x0002, NULL, HFILL
3313 { &hf_nan_attr_sdea_ctr_data_path,
3315 "Data Path Required",
3316 "wifi_nan.sdea.ctr_data_path",
3317 FT_BOOLEAN, 16, NULL, 0x0004, NULL, HFILL
3320 { &hf_nan_attr_sdea_ctr_data_path_type,
3322 "Data Path Type",
3323 "wifi_nan.sdea.ctr_data_path_type",
3324 FT_BOOLEAN, 16, TFS(&sdea_ctr_data_path_type_flags), 0x0008, NULL, HFILL
3327 { &hf_nan_attr_sdea_ctr_reserved_multicast_type,
3329 "Reserved (Multicast Type)",
3330 "wifi_nan.sdea.ctr_reserved_multicast_type",
3331 FT_BOOLEAN, 16, TFS(&sdea_ctr_reserved_multicast_type_flags), 0x0010, NULL, HFILL
3334 { &hf_nan_attr_sdea_ctr_qos,
3336 "QoS Required",
3337 "wifi_nan.sdea.ctr_qos",
3338 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL
3341 { &hf_nan_attr_sdea_ctr_security,
3343 "Security Required",
3344 "wifi_nan.sdea.ctr_security",
3345 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL
3348 { &hf_nan_attr_sdea_ctr_ranging,
3350 "Ranging Required",
3351 "wifi_nan.sdea.ctr_ranging",
3352 FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL
3355 { &hf_nan_attr_sdea_ctr_range_limit,
3357 "Range Limit Present",
3358 "wifi_nan.sdea.ctr_range_limit",
3359 FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL
3362 { &hf_nan_attr_sdea_ctr_service_update_indicator,
3364 "Service Update Indicator Present",
3365 "wifi_nan.sdea.ctr_service_update_indicator",
3366 FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL
3369 { &hf_nan_attr_sdea_ingress_range_limit,
3371 "Ingress Range Limit",
3372 "wifi_nan.sdea.range_limit_ingress",
3373 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3376 { &hf_nan_attr_sdea_egress_range_limit,
3378 "Egress Range Limit",
3379 "wifi_nan.sdea.range_limit_egress",
3380 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3383 { &hf_nan_attr_sdea_service_update_indicator,
3385 "Service Update Indicator",
3386 "wifi_nan.sdea.service_update_indicator",
3387 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3390 { &hf_nan_attr_sdea_service_info_length,
3392 "Service Info Length",
3393 "wifi_nan.sdea.service_info_len",
3394 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3397 { &hf_nan_attr_sdea_service_info_protocol_type,
3399 "Service Protocol Type",
3400 "wifi_nan.sdea.service_info_protocol_type",
3401 FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(service_info_protocol_type), 0x0, NULL, HFILL
3404 { &hf_nan_attr_sdea_service_info_specific,
3406 "Service Specific info",
3407 "wifi_nan.sdea.service_info_specific",
3408 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3411 { &hf_nan_attr_connection_cap_bitmap,
3413 "Connection Capability Bitmap",
3414 "wifi_nan.connection_cap.bitmap",
3415 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3418 { &hf_nan_attr_connection_cap_wifi_direct,
3420 "Wifi Direct",
3421 "wifi_nan.connection_cap.wifi_direct",
3422 FT_BOOLEAN, 16, NULL, 0x1, NULL, HFILL
3425 { &hf_nan_attr_connection_cap_p2ps,
3427 "P2Ps",
3428 "wifi_nan.connection_cap.p2ps",
3429 FT_BOOLEAN, 16, NULL, 0x2, NULL, HFILL
3432 { &hf_nan_attr_connection_cap_tdls,
3434 "TDLS",
3435 "wifi_nan.connection_cap.tdls",
3436 FT_BOOLEAN, 16, NULL, 0x4, NULL, HFILL
3439 { &hf_nan_attr_connection_cap_wlan_infra,
3441 "WLAN Infrastructure",
3442 "wifi_nan.connection_cap.wlan_infra",
3443 FT_BOOLEAN, 16, NULL, 0x8, NULL, HFILL
3446 { &hf_nan_attr_connection_cap_ibss,
3448 "IBSS",
3449 "wifi_nan.connection_cap.ibss",
3450 FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL
3453 { &hf_nan_attr_connection_cap_mesh,
3455 "Mesh",
3456 "wifi_nan.connection_cap.mesh",
3457 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL
3460 { &hf_nan_attr_wlan_infra_device_role,
3462 "Device Role",
3463 "wifi_nan.wlan_infra.device_role",
3464 FT_UINT8, BASE_DEC, VALS(device_role), 0x0, NULL, HFILL
3467 { &hf_nan_attr_p2p_device_role_device,
3469 "P2P Device",
3470 "wifi_nan.p2p.device",
3471 FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
3474 { &hf_nan_attr_p2p_device_role_group_owner,
3476 "P2P Group Owner",
3477 "wifi_nan.p2p.group_owner",
3478 FT_BOOLEAN, 8, NULL, 0x2, NULL, HFILL
3481 { &hf_nan_attr_p2p_device_role_client,
3483 "P2P Client",
3484 "wifi_nan.p2p.client",
3485 FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
3488 { &hf_nan_attr_p2p_device_role,
3490 "P2P Device Role",
3491 "wifi_nan.p2p.device_role",
3492 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3495 { &hf_nan_attr_mesh_id,
3497 "Mesh ID",
3498 "wifi_nan.mesh.id",
3499 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3502 { &hf_nan_attr_further_av_map_id,
3504 "Map ID",
3505 "wifi_nan.furth.av.map.id",
3506 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(furth_av_map_id), 0x0, NULL, HFILL
3509 { &hf_nan_attr_further_av_map_entry_av_interval_duration,
3511 "Availability Interval Duration",
3512 "wifi_nan.further_av_map.entry.av_interval_duration",
3513 FT_UINT8, BASE_DEC, VALS(map_ctrl_availability_interval_duration), 0x03, NULL, HFILL
3516 { &hf_nan_attr_further_av_map_op_class,
3518 "Operating Class",
3519 "wifi_nan.further_av_map.entry.op_class",
3520 FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3523 { &hf_nan_attr_further_av_map_channel_num,
3525 "Channel Number",
3526 "wifi_nan.further_av_map.entry.channel_number",
3527 FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3530 { &hf_nan_attr_further_av_map_entry_ctrl,
3532 "Entry Control Fields",
3533 "wifi_nan.further_av_map.entry.ctrl",
3534 FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3537 { &hf_nan_attr_country_code,
3539 "Condensed Country String",
3540 "wifi_nan.country_code",
3541 FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL
3544 { &hf_nan_attr_ranging_protocol,
3546 "Ranging Protocol",
3547 "wifi_nan.ranging.protocol",
3548 FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3551 { &hf_nan_attr_cluster_disc_id,
3553 "Cluster ID",
3554 "wifi_nan.cluster_disc.id",
3555 FT_UINT48, BASE_HEX, NULL, 0x0, NULL, HFILL
3558 { &hf_nan_attr_cluster_disc_time_offset,
3560 "Cluster Time Offset",
3561 "wifi_nan.cluster_disc.time_offset",
3562 FT_UINT64, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL
3565 { &hf_nan_attr_cluster_disc_anchor_master_rank,
3567 "Anchor Master Rank",
3568 "wifi_nan.cluster_disc.anchor_master_rank",
3569 FT_UINT64, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL
3572 { &hf_nan_attr_device_cap_map_id_apply_to,
3574 "Apply to",
3575 "wifi_nan.device_cap.map_id_apply_to",
3576 FT_BOOLEAN, 8, TFS(&device_cap_map_id_apply_to_flags), 0x01, NULL, HFILL
3579 { &hf_nan_attr_device_cap_map_id_associated_maps,
3581 "Map ID",
3582 "wifi_nan.device_cap.map_id_associated_maps",
3583 FT_UINT8, BASE_HEX_DEC, NULL, 0x1E, NULL, HFILL
3586 { &hf_nan_attr_device_cap_committed_dw,
3588 "Committed DW Info",
3589 "wifi_nan.device_cap.committed_dw_info",
3590 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3593 { &hf_nan_attr_device_cap_committed_dw_24ghz,
3595 "2.4 GHz DW",
3596 "wifi_nan.device_cap.committed_dw_info.24ghz",
3597 FT_UINT16, BASE_DEC, NULL, 0x0007, NULL, HFILL
3600 { &hf_nan_attr_device_cap_committed_dw_5ghz,
3602 "5 GHz DW",
3603 "wifi_nan.device_cap.committed_dw_info.5ghz",
3604 FT_UINT16, BASE_DEC, NULL, 0x0038, NULL, HFILL
3607 { &hf_nan_attr_device_cap_committed_dw_24ghz_overwrite,
3609 "2.4 GHz DW Overwrite",
3610 "wifi_nan.device_cap.committed_dw_info.24ghz_overwrite",
3611 FT_UINT16, BASE_DEC, NULL, 0x03C0, NULL, HFILL
3614 { &hf_nan_attr_device_cap_committed_dw_5ghz_overwrite,
3616 "5 GHz DW Overwrite",
3617 "wifi_nan.device_cap.committed_dw_info.5ghz_overwrite",
3618 FT_UINT16, BASE_DEC, NULL, 0x3C00, NULL, HFILL
3621 { &hf_nan_attr_device_cap_supported_bands,
3623 "Supported Bands",
3624 "wifi_nan.device_cap.supported_bands",
3625 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3628 { &hf_nan_attr_device_cap_supported_bands_reserved_tv_whitespaces,
3630 "Reserved (for TV white spaces)",
3631 "wifi_nan.device_cap.supported_bands.tv_whitespaces",
3632 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL
3635 { &hf_nan_attr_device_cap_supported_bands_sub_1ghz,
3637 "Sub-1 GHz",
3638 "wifi_nan.device_cap.supported_bands.sub_1ghz",
3639 FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL
3642 { &hf_nan_attr_device_cap_supported_bands_24ghz,
3644 "2.4 GHz",
3645 "wifi_nan.device_cap.supported_bands.24ghz",
3646 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL
3649 { &hf_nan_attr_device_cap_supported_bands_reserved_36ghz,
3651 "Reserved (for 3.6 GHz)",
3652 "wifi_nan.device_cap.supported_bands.reserved_36ghz",
3653 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL
3656 { &hf_nan_attr_device_cap_supported_bands_5ghz,
3658 "4.9 and 5 GHz",
3659 "wifi_nan.device_cap.supported_bands.5ghz",
3660 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
3663 { &hf_nan_attr_device_cap_supported_bands_reserved_60ghz,
3665 "Reserved (for 60 GHz)",
3666 "wifi_nan.device_cap.supported_bands.reserved_60ghz",
3667 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL
3670 { &hf_nan_attr_device_cap_supported_bands_reserved_45ghz,
3672 "Reserved (for 45 GHz)",
3673 "wifi_nan.device_cap.supported_bands.reserved_45ghz",
3674 FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL
3677 { &hf_nan_attr_device_cap_supported_bands_6ghz,
3679 "6GHz",
3680 "wifi_nan.device_cap.supported_bands.6ghz",
3681 FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL
3684 { &hf_nan_attr_device_cap_op_mode,
3686 "Operation Mode",
3687 "wifi_nan.device_cap.op_mode",
3688 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3691 { &hf_nan_attr_device_cap_op_mode_phy_vht,
3693 "PHY Mode (VHT/HT)",
3694 "wifi_nan.device_cap.op_mode.phy.vht",
3695 FT_BOOLEAN, 8, TFS(&device_cap_op_mode_phy_flags_vht), 0x01, NULL, HFILL
3698 { &hf_nan_attr_device_cap_op_mode_phy_he,
3700 "PHY Mode (HE)",
3701 "wifi_nan.device_cap.op_mode.phy.he",
3702 FT_BOOLEAN, 8, TFS(&device_cap_op_mode_phy_flags_he), 0x10, NULL, HFILL
3705 { &hf_nan_attr_device_cap_op_mode_phy_he_vht8080,
3707 "HE/VHT 80+80",
3708 "wifi_nan.device_cap.op_mode.vht8080",
3709 FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL
3712 { &hf_nan_attr_device_cap_op_mode_phy_he_vht160,
3714 "HE/VHT 160",
3715 "wifi_nan.device_cap.op_mode.vht160",
3716 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL
3719 { &hf_nan_attr_device_cap_op_mode_reserved_paging_ndl,
3721 "Reserved (Paging NDL Support)",
3722 "wifi_nan.device_cap.op_mode.reserved_paging_ndl",
3723 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL
3726 { &hf_nan_attr_device_cap_antennas,
3728 "Antennas",
3729 "wifi_nan.device_cap.antennas",
3730 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3733 { &hf_nan_attr_device_cap_antennas_tx,
3735 "Number of TX antennas",
3736 "wifi_nan.device_cap.antennas.tx",
3737 FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL
3740 { &hf_nan_attr_device_cap_antennas_rx,
3742 "Number of RX antennas",
3743 "wifi_nan.device_cap.antennas.rx",
3744 FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL
3747 { &hf_nan_attr_device_cap_max_channel_switch_time,
3749 "Max Channel Switch Time (us)",
3750 "wifi_nan.device_cap.max_channel_switch_time",
3751 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3754 { &hf_nan_attr_device_cap_capabilities,
3756 "Capabilities",
3757 "wifi_nan.device_cap.capabilities",
3758 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
3761 { &hf_nan_attr_device_cap_capabilities_dfs_master,
3763 "DFS Master",
3764 "wifi_nan.device_cap.capabilities.dfs_master",
3765 FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL
3768 { &hf_nan_attr_device_cap_capabilities_extended_key_id,
3770 "Extended key ID",
3771 "wifi_nan.device_cap.capabilities.extended_key_id",
3772 FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL
3775 { &hf_nan_attr_device_cap_capabilities_simul_ndp_reception,
3777 "Simultaneous NDP data reception",
3778 "wifi_nan.device_cap.capabilities.simul_ndp_reception",
3779 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL
3782 { &hf_nan_attr_device_cap_capabilities_ndpe_attr_support,
3784 "NDPE attribute support",
3785 "wifi_nan.device_cap.capabilities.ndpe_attr_support",
3786 FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL
3789 { &hf_nan_attr_device_cap_capabilities_s3_capable,
3791 "S3 Capable",
3792 "wifi_nan.device_cap.capabilities.s3_capable",
3793 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
3796 { &hf_nan_attr_ndp_type,
3798 "Type",
3799 "wifi_nan.ndp.type",
3800 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(ndp_type_values), 0xF, NULL, HFILL
3803 { &hf_nan_attr_ndp_initiator,
3805 "Initiator NDI",
3806 "wifi_nan.ndp.initiator_ndi",
3807 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3810 { &hf_nan_attr_ndp_id,
3812 "NDP ID",
3813 "wifi_nan.ndp.id",
3814 FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3817 { &hf_nan_attr_ndp_ctrl_confirm,
3819 "Confirm Required",
3820 "wifi_nan.ndp.ctrl.confirm",
3821 FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
3824 { &hf_nan_attr_ndp_ctrl_security_pres,
3826 "Security Present",
3827 "wifi_nan.ndp.ctrl.security_pres",
3828 FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
3831 { &hf_nan_attr_ndp_ctrl_publish_id_pres,
3833 "Publish ID Present",
3834 "wifi_nan.ndp.ctrl.publish_id_pres",
3835 FT_BOOLEAN, 8, NULL, 0x8, NULL, HFILL
3838 { &hf_nan_attr_ndp_ctrl_responder_ndi_pres,
3840 "Responder NDI Present",
3841 "wifi_nan.ndp.ctrl.responder_ndi_pres",
3842 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
3845 { &hf_nan_attr_ndp_ctrl_sepcific_info_pres,
3847 "NDP Specific Info Present",
3848 "wifi_nan.ndp.ctrl.specific_info_pres",
3849 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL
3852 { &hf_nan_attr_ndpe_ctrl_confirm,
3854 "Confirm Required",
3855 "wifi_nan.ndpe.ctrl.confirm",
3856 FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
3859 { &hf_nan_attr_ndpe_ctrl_security_pres,
3861 "Security Present",
3862 "wifi_nan.ndpe.ctrl.security_pres",
3863 FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
3866 { &hf_nan_attr_ndpe_ctrl_publish_id_pres,
3868 "Publish ID Present",
3869 "wifi_nan.ndpe.ctrl.publish_id_pres",
3870 FT_BOOLEAN, 8, NULL, 0x8, NULL, HFILL
3873 { &hf_nan_attr_ndpe_ctrl_responder_ndi_pres,
3875 "Responder NDI Present",
3876 "wifi_nan.ndpe.ctrl.responder_ndi_pres",
3877 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
3880 { &hf_nan_attr_ndpe_ctrl_gtk_requried,
3882 "GTK Required",
3883 "wifi_nan.ndpe.ctrl.gtk_required",
3884 FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL
3887 { &hf_nan_attr_ndp_control,
3889 "NDP Control",
3890 "wifi_nan.ndp.ctrl",
3891 FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3894 { &hf_nan_attr_ndpe_control,
3896 "NDPE Control",
3897 "wifi_nan.ndpe.ctrl",
3898 FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
3901 { &hf_nan_attr_ndp_responder_ndi,
3903 "Responder NDI",
3904 "wifi_nan.ndp.responder.ndi",
3905 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3908 { &hf_nan_attr_ndp_specific_info,
3910 "NDP Specific Info",
3911 "wifi_nan.ndp.specific_info",
3912 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
3915 { &hf_nan_attr_ndpe_tlv_type,
3917 "Type",
3918 "wifi_nan.ndpe.tlv.type",
3919 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(ndpe_tlv_type_values), 0x0, NULL, HFILL
3922 { &hf_nan_attr_ndpe_tlv_len,
3924 "Length",
3925 "wifi_nan.ndpe.tlv.len",
3926 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
3929 { &hf_nan_attr_ndpe_tlv_ipv6_interface_identifier,
3931 "Interface Identifier",
3932 "wifi_nan.ndpe.tlv.ipv6_interface_identifier",
3933 FT_BYTES, SEP_COLON, NULL, 0x0, NULL, HFILL
3936 { &hf_nan_attr_availability_sequence_id,
3938 "Sequence ID",
3939 "wifi_nan.availability.sequence_id",
3940 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
3943 { &hf_nan_attr_availability_ctr,
3945 "Attribute Control",
3946 "wifi_nan.availability.ctr",
3947 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
3950 { &hf_nan_attr_availability_map_id,
3952 "Map ID",
3953 "wifi_nan.availability.map_id",
3954 FT_UINT16, BASE_HEX_DEC, NULL, 0x000F, NULL, HFILL
3957 { &hf_nan_attr_availability_committed_changed,
3959 "Committed Changed",
3960 "wifi_nan.availability.committed_changed",
3961 FT_BOOLEAN, 16, NULL, 0x0010, NULL, HFILL
3964 { &hf_nan_attr_availability_potential_changed,
3966 "Potential Changed",
3967 "wifi_nan.availability.potential_changed",
3968 FT_BOOLEAN, 16, NULL, 0x0020, NULL, HFILL
3971 { &hf_nan_attr_availability_public_availability_changed,
3973 "Public Availability Attribute Changed",
3974 "wifi_nan.availability.public_availability_changed",
3975 FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL
3978 { &hf_nan_attr_availability_ndc_changed,
3980 "NDC Attribute Changed",
3981 "wifi_nan.availability.ndc_changed",
3982 FT_BOOLEAN, 16, NULL, 0x0080, NULL, HFILL
3985 { &hf_nan_attr_availability_reserved_multicast_schedule_changed,
3987 "Reserved (Multicast Schedule Attribute Changed)",
3988 "wifi_nan.availability.reserved_multicast_schedule_changed",
3989 FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL
3992 { &hf_nan_attr_availability_reserved_multicast_schedule_change_changed,
3994 "Reserved (Multicast Schedule Change Attribute Change Changed)",
3995 "wifi_nan.availability.reserved_multicast_schedule_change_changed",
3996 FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL
3999 { &hf_nan_attr_availability_entry_len,
4001 "Length",
4002 "wifi_nan.availability.entry.len",
4003 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4006 { &hf_nan_attr_availability_entry_ctr,
4008 "Entry Control",
4009 "wifi_nan.availability.entry.ctr",
4010 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
4013 { &hf_nan_attr_availability_entry_ctr_type,
4015 "Availability Type",
4016 "wifi_nan.availability.entry.ctr.type",
4017 FT_UINT16, BASE_HEX, VALS(availability_entry_type), 0x0007, NULL, HFILL
4020 { &hf_nan_attr_availability_entry_ctr_pref,
4022 "Usage Preference",
4023 "wifi_nan.availability.entry.ctr.pref",
4024 FT_UINT16, BASE_DEC, NULL, 0x0018, NULL, HFILL
4027 { &hf_nan_attr_availability_entry_ctr_utilization,
4029 "Utilization",
4030 "wifi_nan.availability.entry.ctr.utilization",
4031 FT_UINT16, BASE_DEC, NULL, 0x00E0, NULL, HFILL
4034 { &hf_nan_attr_availability_entry_ctr_rx_nss,
4036 "Rx Nss",
4037 "wifi_nan.availability.entry.ctr.rx_nss",
4038 FT_UINT16, BASE_DEC, NULL, 0x0F00, NULL, HFILL
4041 { &hf_nan_attr_availability_entry_ctr_time_bitmap,
4043 "Time Bitmap Present",
4044 "wifi_nan.availability.entry.ctr.time_bitmap",
4045 FT_BOOLEAN, 16, NULL, 0x1000, NULL, HFILL
4048 { &hf_nan_attr_availability_entry_entries_type,
4050 "Type",
4051 "wifi_nan.availability.entry.entries.type",
4052 FT_BOOLEAN, BASE_NONE, TFS(&availability_entry_entries_type_flags), 0x0, NULL, HFILL
4055 { &hf_nan_attr_availability_entry_entries_non_contiguous_bw,
4057 "Non-contiguous Bandwidth",
4058 "wifi_nan.availability.entry.entries.non_contiguous_bw",
4059 FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL
4062 { &hf_nan_attr_availability_entry_entries_num_entries,
4064 "Number of Entries",
4065 "wifi_nan.availability.entry.entries.num_entries",
4066 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4069 { &hf_nan_attr_availability_entry_entries_band,
4071 "Band Entry",
4072 "wifi_nan.availability.entry.entries.band",
4073 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(availability_entry_entries_band_type), 0x0, NULL, HFILL
4076 { &hf_nan_attr_availability_entry_entries_channel_op_class,
4078 "Operating Class",
4079 "wifi_nan.availability.entry.entries.channel.op_class",
4080 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4083 { &hf_nan_attr_availability_entry_entries_channel_bitmap,
4085 "Channel Bitmap",
4086 "wifi_nan.availability.entry.entries.channel.bitmap",
4087 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
4090 { &hf_nan_attr_availability_entry_entries_primary_channel_bitmap,
4092 "Primary Channel Bitmap",
4093 "wifi_nan.availability.entry.entries.channel.primary_bitmap",
4094 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4097 { &hf_nan_attr_availability_entry_entries_aux_channel_bitmap,
4099 "Auxiliary Channel Bitmap",
4100 "wifi_nan.availability.entry.entries.channel.aux_bitmap",
4101 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
4104 { &hf_nan_attr_availability_entry_entries_channel_set,
4106 "Channel Bitmap - Channel Set",
4107 "wifi_nan.ava.chan.set",
4108 FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL
4111 { &hf_nan_attr_availability_entry_entries_start_channel_number,
4113 "Start Channel Number",
4114 "wifi_nan.availability.entry.entries.channel.start_channel_number",
4115 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4118 { &hf_nan_attr_availability_entry_entries_number_of_ch_included,
4120 "Number of Channels Included",
4121 "wifi_nan.availability.entry.entries.channel.num_of_channel",
4122 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4125 { &hf_nan_attr_availability_entry_entries_start_freq,
4127 "Starting Frequency",
4128 "wifi_nan.av.entry.start.freq",
4129 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(op_starting_freq), 0x0, NULL, HFILL
4132 { &hf_nan_attr_availability_entry_entries_bandwidth,
4134 "Bandwidth",
4135 "wifi_nan.av.entry.bandwidth",
4136 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(op_channel_spacing), 0x0, NULL, HFILL
4139 { &hf_nan_attr_ndc_id,
4141 "NDC ID",
4142 "wifi_nan.ndc.id",
4143 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4146 { &hf_nan_attr_ndc_ctrl,
4148 "Control",
4149 "wifi_nan.ndc.ctrl",
4150 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4153 { &hf_nan_attr_ndc_ctrl_selected,
4155 "Selected NDC",
4156 "wifi_nan.ndc.ctrl.selected",
4157 FT_BOOLEAN, 8, TFS(&ndc_ctr_selected_flags), 0x01, NULL, HFILL
4160 { &hf_nan_attr_ndc_map_id_related_sch,
4162 "NAN Availability associated with schedule time bitmap",
4163 "wifi_nan.ndc.map.id.rel",
4164 FT_UINT8, BASE_DEC, NULL, 0x0f, NULL, HFILL
4167 { &hf_nan_attr_ndl_type,
4169 "Type",
4170 "wifi_nan.ndl.type",
4171 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(ndl_type_values), 0xF, NULL, HFILL
4174 { &hf_nan_attr_ndl_control,
4176 "NDL Control",
4177 "wifi_nan.ndl.ctrl",
4178 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4181 { &hf_nan_attr_ndl_ctrl_peer_id,
4183 "NDL Peer ID Present",
4184 "wifi_nan.ndl.ctrl.peer_id",
4185 FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
4188 { &hf_nan_attr_ndl_ctrl_immutable_schedule_pres,
4190 "Immutable Schedule Present",
4191 "wifi_nan.ndl.ctrl.immutable_schedule_pres",
4192 FT_BOOLEAN, 8, NULL, 0x2, NULL, HFILL
4195 { &hf_nan_attr_ndl_ctrl_ndc_pres,
4197 "NDC Attribute Present",
4198 "wifi_nan.ndl.ctrl.ndc_pres",
4199 FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
4202 { &hf_nan_attr_ndl_ctrl_qos,
4204 "NDL QoS Present",
4205 "wifi_nan.ndl.ctrl.qos_pres",
4206 FT_BOOLEAN, 8, NULL, 0x8, NULL, HFILL
4209 { &hf_nan_attr_ndl_ctrl_max_idle_pres,
4211 "Max Idle period Present",
4212 "wifi_nan.ndl.ctrl.max_idle_period_pres",
4213 FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL
4216 { &hf_nan_attr_ndl_ctrl_type,
4218 "NDL Type",
4219 "wifi_nan.ndl.ctrl.type",
4220 FT_UINT8, BASE_DEC, VALS(ndl_type_string), 0x20, NULL, HFILL
4223 { &hf_nan_attr_ndl_ctrl_setup_reason,
4225 "NDL Setup Reason",
4226 "wifi_nan.ndl.ctrl.setup_reason",
4227 FT_UINT8, BASE_DEC, VALS(ndl_setup_reason), 0xC0, NULL, HFILL
4230 { &hf_nan_attr_ndl_reserved_peer_id,
4232 "Reserved (NDL Peer ID)",
4233 "wifi_nan.ndl.peer_id",
4234 FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL
4237 { &hf_nan_attr_ndl_max_idle,
4239 "Max Idle Period",
4240 "wifi_nan.ndl.max.idle",
4241 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4244 { &hf_nan_attr_ndlqos_min_time_slots,
4246 "Minimum Time Slots",
4247 "wifi_nan.ndl_qos.min_time_slots",
4248 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4251 { &hf_nan_attr_ndlqos_max_latency,
4253 "Maximum Latency",
4254 "wifi_nan.ndl_qos.max_latency",
4255 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4258 { &hf_nan_attr_unaligned_sch_ctrl,
4260 "Attribute Control",
4261 "wifi_nan.unaligned_schedule.ctrl",
4262 FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
4265 { &hf_nan_attr_unaligned_sch_ctrl_schedule_id,
4267 "Schedule ID",
4268 "wifi_nan.unaligned_schedule.ctrl.schedule_id",
4269 FT_UINT16, BASE_HEX_DEC, NULL, 0xF, NULL, HFILL
4272 { &hf_nan_attr_unaligned_sch_ctrl_seq_id,
4274 "Sequence ID",
4275 "wifi_nan.unaligned_schedule.ctrl.sequence_id",
4276 FT_UINT16, BASE_HEX_DEC, NULL, 0x0F00, NULL, HFILL
4279 { &hf_nan_attr_unaligned_sch_starting_time,
4281 "Starting Time",
4282 "wifi_nan.unaligned_schedule.starting_time",
4283 FT_UINT32, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
4286 { &hf_nan_attr_unaligned_sch_duration,
4288 "Duration",
4289 "wifi_nan.unaligned_schedule.duration",
4290 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
4293 { &hf_nan_attr_unaligned_sch_period,
4295 "Period",
4296 "wifi_nan.unaligned_schedule.period",
4297 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL
4300 { &hf_nan_attr_unaligned_sch_count_down,
4302 "Count Down",
4303 "wifi_nan.unaligned_schedule.count_down",
4304 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4307 { &hf_nan_attr_unaligned_sch_ulw_overwrite,
4309 "ULW Overwrite",
4310 "wifi_nan.unaligned_schedule.ulw_overwrite",
4311 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4314 { &hf_nan_attr_unaligned_sch_ulw_overwrite_all,
4316 "Overwrite All",
4317 "wifi_nan.unaligned_schedule.ulw_overwrite.overwrite_all",
4318 FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
4321 { &hf_nan_attr_unaligned_sch_ulw_overwrite_map_id,
4323 "Map ID",
4324 "wifi_nan.unaligned_schedule.ulw_overwrite.map_id",
4325 FT_UINT8, BASE_HEX_DEC, NULL, 0x1E, NULL, HFILL
4328 { &hf_nan_attr_unaligned_sch_ulw_ctrl,
4330 "ULW Control Field",
4331 "wifi_nan.attribute.ulw.ctrl",
4332 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4335 { &hf_nan_attr_unaligned_sch_ulw_ctrl_type,
4337 "Type",
4338 "wifi_nan.unaligned_schedule.ulw_ctrl.type",
4339 FT_UINT8, BASE_DEC_HEX, VALS(unaligned_sch_ulw_type), 0x3, NULL, HFILL
4342 { &hf_nan_attr_unaligned_sch_ulw_ctrl_channel_av,
4344 "Channel Availability",
4345 "wifi_nan.unaligned_schedule.ulw_ctrl.channel_availability",
4346 FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL
4349 { &hf_nan_attr_unaligned_sch_ulw_ctrl_rxnss,
4351 "Rx Nss",
4352 "wifi_nan.unaligned_schedule.ulw_ctrl.rx_nss",
4353 FT_UINT8, BASE_HEX, NULL, 0x78, NULL, HFILL
4356 { &hf_nan_attr_ranging_info_location_info_avail,
4358 "Location Info Availability",
4359 "wifi_nan.ranging_info.location_info_availability",
4360 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4363 { &hf_nan_attr_ranging_info_location_info_avail_lci,
4365 "LCI Local Coordinates",
4366 "wifi_nan.ranging_info.location_info_availability.local_coord",
4367 FT_BOOLEAN, 8, NULL, 0x1, NULL, HFILL
4370 { &hf_nan_attr_ranging_info_location_info_avail_geospatial,
4372 "Geospatial LCI WGS84",
4373 "wifi_nan.ranging_info.location_info_availability.geospatial",
4374 FT_BOOLEAN, 8, NULL, 0x2, NULL, HFILL
4377 { &hf_nan_attr_ranging_info_location_info_avail_civic_location,
4379 "Civic Location",
4380 "wifi_nan.ranging_info.location_info_availability.civic_location",
4381 FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL
4384 { &hf_nan_attr_ranging_info_location_info_avail_last_movement_pres,
4386 "Last Movement Indication",
4387 "wifi_nan.ranging_info.location_info_availability.last_movement_indication",
4388 FT_BOOLEAN, 8, NULL, 0x8, NULL, HFILL
4391 { &hf_nan_attr_ranging_info_last_movement_indication,
4393 "Last Movement Indication",
4394 "wifi_nan.ranging_info.last_movement_indication",
4395 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4398 { &hf_nan_attr_ranging_setup_type,
4400 "Type",
4401 "wifi_nan.ranging_setup.type",
4402 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(ranging_setup_type_values), 0xF, NULL, HFILL
4405 { &hf_nan_attr_ranging_setup_ctrl,
4407 "Ranging Control",
4408 "wifi_nan.ranging_setup.ctrl",
4409 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4412 { &hf_nan_attr_ranging_setup_ctrl_report_req,
4414 "Ranging Report Required",
4415 "wifi_nan.ranging_setup.ctrl.report_required",
4416 FT_BOOLEAN, 3, NULL, 0x1, NULL, HFILL
4419 { &hf_nan_attr_ranging_setup_ctrl_ftm_params,
4421 "FTM Parameters Present",
4422 "wifi_nan.ranging_setup.ctrl.ftm_params",
4423 FT_BOOLEAN, 3, NULL, 0x2, NULL, HFILL
4426 { &hf_nan_attr_ranging_setup_ctrl_entry_list,
4428 "Ranging Schedule Entry List Present",
4429 "wifi_nan.ranging_setup.ctrl.sch_entry_pres",
4430 FT_BOOLEAN, 3, NULL, 0x4, NULL, HFILL
4433 { &hf_nan_attr_ranging_setup_ftm_params,
4435 "FTM Parameters",
4436 "wifi_nan.ranging_setup.ftm",
4437 FT_UINT24, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL
4440 { &hf_nan_attr_ranging_setup_ftm_max_burst_duration,
4442 "Max Burst Duration",
4443 "wifi_nan.ranging_setup.ftm.max_burst_duration",
4444 FT_UINT24, BASE_HEX_DEC, NULL, 0xF, NULL, HFILL
4447 { &hf_nan_attr_ranging_setup_ftm_min_delta,
4449 "Min Delta FTM",
4450 "wifi_nan.ranging_setup.ftm.min_delta_ftm",
4451 FT_UINT24, BASE_HEX_DEC, NULL, 0x03F0, NULL, HFILL
4454 { &hf_nan_attr_ranging_setup_ftm_max_per_burst,
4456 "Max FTMs per Burst",
4457 "wifi_nan.ranging_setup.ftm.max_ftms_per_burst",
4458 FT_UINT24, BASE_HEX_DEC, NULL, 0x7C00, NULL, HFILL
4461 { &hf_nan_attr_ranging_setup_ftm_format_bw,
4463 "FTM Format and Bandwidth",
4464 "wifi_nan.ranging_setup.ftm.format_bw",
4465 FT_UINT24, BASE_HEX_DEC, NULL, 0x1F8000, NULL, HFILL
4468 { &hf_nan_attr_ftm_range_report,
4470 "FTM Range Report",
4471 "wifi_nan.ftm.range_report",
4472 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4475 { &hf_nan_attr_cipher_suite_capabilities,
4477 "Capabilities",
4478 "wifi_nan.cipher_suite.capabilities",
4479 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
4482 { &hf_nan_attr_cipher_suite_capabilities_ndtksa_nmtksa_replay_counters,
4484 "ND-TKSA and NM-TKSA Replay Counters",
4485 "wifi_nan.cipher_suite.capabilities.replay_counters.ndtksa",
4486 FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_nd_nm_tksa_replay_counters), 0x01, NULL, HFILL
4489 { &hf_nan_attr_cipher_suite_capabilities_gtksa_igtksa_bigtksa_support,
4491 "GTKSA, IGTKSA, and BIGTKSA Support",
4492 "wifi_nan.cipher_suite.capabilities.group_key_support",
4493 FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_group_and_integrity_sa_support), 0x06, NULL, HFILL
4496 { &hf_nan_attr_cipher_suite_capabilities_gtksa_replay_counters,
4498 "GTKSA Replay Counters",
4499 "wifi_nan.cipher_suite.capabilities.replay_counters.gtksa",
4500 FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_gtksa_replay_counters), 0x08, NULL, HFILL
4503 { &hf_nan_attr_cipher_suite_capabilities_igtksa_bigtksa_cipher,
4505 "IGTKSA and BIGTKSA Cipher",
4506 "wifi_nan.cipher_suite.capabilities.integrity_key_cipher",
4507 FT_UINT8, BASE_HEX, VALS(cipher_suite_capabilities_integrity_sa_ciphers), 0x10, NULL, HFILL
4510 { &hf_nan_attr_cipher_suite_id,
4512 "Cipher Suite ID",
4513 "wifi_nan.cipher_suite.id",
4514 FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL
4517 { &hf_nan_attr_security_context_identifier,
4519 "Security Context Identifier",
4520 "wifi_nan.security_context.identifier",
4521 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4524 { &hf_nan_attr_security_context_identifier_len,
4526 "Security Context Identifier Length",
4527 "wifi_nan.security_context.identifier_len",
4528 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4531 { &hf_nan_attr_security_context_identifier_type,
4533 "Security Context Identifier Type",
4534 "wifi_nan.security_context.identifier_type",
4535 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(security_context_iden_type), 0x0, NULL, HFILL
4538 { &hf_nan_attr_shared_key_rsna_descriptor,
4540 "IEEE 802.11 RSNA Key Descriptor",
4541 "wifi_nan.shared_key.rsna_key_descriptor",
4542 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4545 { &hf_nan_attr_vendor_specific_body,
4547 "Body",
4548 "wifi_nan.vendor_specific.body",
4549 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4552 { &hf_nan_attr_container_element_id,
4554 "Element Id",
4555 "wifi_nan.container.element.id",
4556 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4559 { &hf_nan_attr_container_element_len,
4561 "Element Length",
4562 "wifi_nan.container.element.len",
4563 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4566 { &hf_nan_attr_device_capability_extension,
4568 "Capability Extension",
4569 "wifi_nan.device_capability_extension.capability_info",
4570 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
4573 { &hf_nan_attr_device_capability_extension_6g_regulatory_info_presented,
4575 "6GHz Regulatory Info Presented",
4576 "wifi_nan.device_capability_extension.6g_regulatory_presented",
4577 FT_BOOLEAN, 16, NULL, 0x0001, NULL, HFILL
4580 { &hf_nan_attr_device_capability_extension_6g_regulatory_info,
4582 "6GHz Regulatory Info",
4583 "wifi_nan.device_capability_extension.6g_regulatory",
4584 FT_UINT16, BASE_HEX_DEC, VALS(device_capability_extension_6g_regulatoty_info), 0x000e, NULL, HFILL
4587 { &hf_nan_attr_device_capability_extension_6g_regulatory_info_reserved,
4589 "Reserved for 6GHz Regulatory Info",
4590 "wifi_nan.device_capability_extension.6g_regulatory_reserved",
4591 FT_UINT16, BASE_HEX_DEC, NULL, 0x00f0, NULL, HFILL
4594 { &hf_nan_attr_device_capability_extension_paring_setup_enabled,
4596 "Paring Enable",
4597 "wifi_nan.device_capability_extension.paring_enable",
4598 FT_BOOLEAN, 16, NULL, 0x0100, NULL, HFILL
4601 { &hf_nan_attr_device_capability_extension_npk_nik_cache_enabled,
4603 "NPK/NIK Caching Enable",
4604 "wifi_nan.device_capability_extension.npk_nik_caching_enable",
4605 FT_BOOLEAN, 16, NULL, 0x0200, NULL, HFILL
4608 { &hf_nan_attr_identity_cipher_version,
4610 "Cipher Version",
4611 "wifi_nan.identity_resolution.cipher_version",
4612 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(nan_identity_resolution_cipher_version), 0x0, NULL, HFILL
4615 { &hf_nan_attr_identity_resolution_nonce,
4617 "Nonce",
4618 "wifi_nan.identity_resolution.nonce",
4619 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4622 { &hf_nan_attr_identity_resolution_tag,
4624 "Tag",
4625 "wifi_nan.identity_resolution.tag",
4626 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4629 { &hf_nan_attr_reserved,
4631 "Reserved",
4632 "wifi_nan.reserved",
4633 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4636 { &hf_nan_attr_pairing_bootstrapping_dialog_token,
4638 "Dialog Token",
4639 "wifi_nan.nan_pairing_bootstrapping.dialog_token",
4640 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4643 { &hf_nan_attr_pairing_bootstrapping_type_status,
4645 "Type and Status",
4646 "wifi_nan.nan_pairing_bootstrapping.type_status",
4647 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4650 { &hf_nan_attr_pairing_bootstrapping_type,
4652 "Type",
4653 "wifi_nan.nan_pairing_bootstrapping.type",
4654 FT_UINT8, BASE_HEX_DEC, VALS(nan_pairing_bootstrapping_pairing_bootstrapping_type), 0x0f, NULL, HFILL
4657 { &hf_nan_attr_pairing_bootstrapping_status,
4659 "Status",
4660 "wifi_nan.nan_pairing_bootstrapping.status",
4661 FT_UINT8, BASE_HEX_DEC, VALS(nan_pairing_bootstrapping_pairing_bootstrapping_status), 0xf0, NULL, HFILL
4664 { &hf_nan_attr_pairing_bootstrapping_comeback_after,
4666 "Comeback after (TU)",
4667 "wifi_nan.nan_pairing_bootstrapping.comeback_after",
4668 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
4671 { &hf_nan_attr_pairing_bootstrapping_comeback_cookie_len,
4673 "Cookie Length",
4674 "wifi_nan.nan_pairing_bootstrapping.cookie_len",
4675 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
4678 { &hf_nan_attr_pairing_bootstrapping_comeback_cookie,
4680 "Cookie",
4681 "wifi_nan.nan_pairing_bootstrapping.cookie",
4682 FT_BYTES, SEP_DASH, NULL, 0x0, NULL, HFILL
4685 { &hf_nan_attr_pairing_bootstrapping_methods,
4687 "Bootstrapping Methods",
4688 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods",
4689 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
4692 { &hf_nan_attr_pairing_bootstrapping_method_opportunistic_bootstrapping,
4694 "Opportunistic Bootstrapping",
4695 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.opportunistic",
4696 FT_UINT16, BASE_HEX, NULL, 0x0001, NULL, HFILL
4699 { &hf_nan_attr_pairing_bootstrapping_method_pin_code_display,
4701 "Pin Code (Display)",
4702 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.pin_code_display",
4703 FT_UINT16, BASE_HEX, NULL, 0x0002, NULL, HFILL
4706 { &hf_nan_attr_pairing_bootstrapping_method_passphrase_display,
4708 "Passphrase (Display)",
4709 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.passphrase_display",
4710 FT_UINT16, BASE_HEX, NULL, 0x0004, NULL, HFILL
4713 { &hf_nan_attr_pairing_bootstrapping_method_qr_code_display,
4715 "QR Code (Display)",
4716 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.qr_code_display",
4717 FT_UINT16, BASE_HEX, NULL, 0x0008, NULL, HFILL
4720 { &hf_nan_attr_pairing_bootstrapping_method_nfc_tag,
4722 "NFC Tag",
4723 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.nfc_tag",
4724 FT_UINT16, BASE_HEX, NULL, 0x0010, NULL, HFILL
4727 { &hf_nan_attr_pairing_bootstrapping_method_keypad_pin_code_only,
4729 "Pin Code Only (Keypad)",
4730 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.pin_code_keypad",
4731 FT_UINT16, BASE_HEX, NULL, 0x0020, NULL, HFILL
4734 { &hf_nan_attr_pairing_bootstrapping_method_keypad_passphrase,
4736 "Passphrase (Keypad)",
4737 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.passphrase_keypad",
4738 FT_UINT16, BASE_HEX, NULL, 0x0040, NULL, HFILL
4741 { &hf_nan_attr_pairing_bootstrapping_method_qr_code_scan,
4743 "QR Code (Scan)",
4744 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.qr_code_scan",
4745 FT_UINT16, BASE_HEX, NULL, 0x0080, NULL, HFILL
4748 { &hf_nan_attr_pairing_bootstrapping_method_nfc_reader,
4750 "NFC Reader",
4751 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.nfc_reader",
4752 FT_UINT16, BASE_HEX, NULL, 0x0100, NULL, HFILL
4755 { &hf_nan_attr_pairing_bootstrapping_method_reserved,
4757 "Reserved",
4758 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.reserved",
4759 FT_UINT16, BASE_HEX, NULL, 0x3e00, NULL, HFILL
4762 { &hf_nan_attr_pairing_bootstrapping_method_service_managed_bootstrapping,
4764 "Service Managed",
4765 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.service_managed",
4766 FT_UINT16, BASE_HEX, NULL, 0x4000, NULL, HFILL
4769 { &hf_nan_attr_pairing_bootstrapping_method_bootstrapping_handshakes_skipped,
4771 "Bootstrapping Handshakes Skipped",
4772 "wifi_nan.nan_pairing_bootstrapping.bootstrapping_methods.bootstrapping_handshakes_skipped",
4773 FT_UINT16, BASE_HEX, NULL, 0x8000, NULL, HFILL
4778 static int* ett[] = {
4779 &ett_nan,
4780 &ett_attributes,
4781 &ett_type_status,
4782 &ett_map_control,
4783 &ett_time_bitmap_ctrl,
4784 &ett_non_nan_op_channel,
4785 &ett_non_nan_beacon,
4786 &ett_cluster_anchor_master_info,
4787 &ett_sda_service_ctr,
4788 &ett_sda_srf_ctr,
4789 &ett_sdea_ctr,
4790 &ett_sdea_range_limit,
4791 &ett_sdea_service_info,
4792 &ett_connection_cap_field,
4793 &ett_further_av_map_entry_ctrl,
4794 &ett_p2p_device_role,
4795 &ett_device_cap_map_id,
4796 &ett_device_cap_committed_dw,
4797 &ett_device_cap_supported_bands,
4798 &ett_device_cap_op_mode,
4799 &ett_device_cap_antennas,
4800 &ett_device_cap_capabilities,
4801 &ett_ndp_control,
4802 &ett_ndpe_tlv,
4803 &ett_availability_ctr,
4804 &ett_availability_entry,
4805 &ett_availability_entry_ctr,
4806 &ett_availability_entry_entries,
4807 &ett_availability_entry_entries_channel,
4808 &ett_availability_op_class,
4809 &ett_ndc_ctr,
4810 &ett_ndc_entries,
4811 &ett_device_ndc_map_id,
4812 &ett_ndl_control,
4813 &ett_ndl_schedule_entries,
4814 &ett_unaligned_sch_ctrl,
4815 &ett_unaligned_sch_ulw_overwrite,
4816 &ett_unaligned_sch_ulw_ctrl,
4817 &ett_ranging_info_location_info_availability,
4818 &ett_ranging_setup_ctrl,
4819 &ett_ranging_setup_ftm_params,
4820 &ett_ranging_setup_schedule_entries,
4821 &ett_cipher_suite_info_list,
4822 &ett_security_context_identifiers,
4823 &ett_public_availability_sch_entries,
4824 &ett_ie_tree,
4825 &ett_device_capability_extension,
4826 &ett_nan_pairing_bootstrapping_type_status,
4827 &ett_nan_pairing_bootstrapping_method,
4828 &ett_nan_cipher_suite_capabilities
4831 static ei_register_info ei[] = {
4832 { &ei_nan_elem_len_invalid,
4834 "wifi_nan.expert.elem_len_invalid",
4835 PI_MALFORMED, PI_ERROR,
4836 "Element length invalid",
4837 EXPFILL
4840 { &ei_nan_unknown_attr_id,
4842 "wifi_nan.expert.unknown_attr_id",
4843 PI_PROTOCOL, PI_ERROR,
4844 "Unknown attribute ID",
4845 EXPFILL
4848 { &ei_nan_unknown_op_class,
4850 "wifi_nan.expert.unknown_op_class",
4851 PI_PROTOCOL, PI_COMMENT,
4852 "Unknown Operating Class - Channel Set unavailable",
4853 EXPFILL
4856 { &ei_nan_unknown_beacon_type,
4858 "wifi_nan.expert.unknown_beacon_type",
4859 PI_PROTOCOL, PI_WARN,
4860 "Unknown beacon type - Beacon type detection error",
4861 EXPFILL
4864 { &ei_nan_invalid_channel_num_for_op_class,
4866 "wifi_nan.expert.invalid_ch_num",
4867 PI_PROTOCOL, PI_WARN,
4868 "Invalid Channel number for given operation class",
4869 EXPFILL
4872 { &ei_nan_invalid_channel_count,
4874 "wifi_nan.expert.invalid_ch_count",
4875 PI_PROTOCOL, PI_WARN,
4876 "Invalid Channel count",
4877 EXPFILL
4882 proto_nan = proto_register_protocol("Wi-Fi Neighbor Awareness Networking (NAN)", "Wi-Fi NAN", "wifi_nan");
4884 proto_register_field_array(proto_nan, hf, array_length(hf));
4885 proto_register_subtree_array(ett, array_length(ett));
4887 nan_act_handle = register_dissector("nan.action", dissect_nan_action, proto_nan);
4888 nan_disco_handle = register_dissector("nan.service_discovery", dissect_nan_service_discovery, proto_nan);
4889 nan_beacon_handle = register_dissector("nan.beacon", dissect_nan_beacon, proto_nan);
4891 expert_module_t* expert_nan = expert_register_protocol(proto_nan);
4892 expert_register_field_array(expert_nan, ei, array_length(ei));
4894 ie_handle_table = find_dissector_table("wlan.tag.number");
4897 void
4898 proto_reg_handoff_nan(void)
4900 dissector_add_uint("wlan.pa.wifi_alliance.subtype", WFA_ACTION_OUI_TYPE, nan_act_handle);
4901 dissector_add_uint("wlan.pa.wifi_alliance.subtype", WFA_SERVICE_DISCOVERY_SUBTYPE, nan_disco_handle);
4902 dissector_add_uint("wlan.ie.wifi_alliance.subtype", WFA_NAN_IE_OUI_TYPE, nan_beacon_handle);
4906 * Editor modelines - https://www.wireshark.org/tools/modelines.html
4908 * Local variables:
4909 * c-basic-offset: 4
4910 * tab-width: 8
4911 * indent-tabs-mode: nil
4912 * End:
4914 * vi: set shiftwidth=4 tabstop=8 expandtab:
4915 * :indentSize=4:tabSize=8:noTabs=true: