• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __NAN_H__
18 #define __NAN_H__
19 
20 #include <net/if.h>
21 #include <stdbool.h>
22 #include "rtt.h"
23 #include "wifi_hal.h"
24 
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif /* __cplusplus */
29 
30 /*****************************************************************************
31  * Neighbour Aware Network Service Structures and Functions
32  *****************************************************************************/
33 
34 /*
35   Definitions
36   All multi-byte fields within all NAN protocol stack messages are assumed to be in Little Endian order.
37 */
38 
39 typedef int NanVersion;
40 typedef u16 transaction_id;
41 typedef u32 NanDataPathId;
42 
43 #define NAN_MAC_ADDR_LEN                6
44 #define NAN_MAJOR_VERSION               4
45 #define NAN_MINOR_VERSION               0
46 #define NAN_MICRO_VERSION               0
47 #define NAN_MAX_SOCIAL_CHANNELS         3
48 
49 /* NAN Maximum Lengths */
50 #define NAN_MAX_SERVICE_NAME_LEN                255
51 #define NAN_MAX_MATCH_FILTER_LEN                255
52 #define NAN_MAX_SERVICE_SPECIFIC_INFO_LEN       1024
53 #define NAN_MAX_VSA_DATA_LEN                    1024
54 #define NAN_MAX_MESH_DATA_LEN                   32
55 #define NAN_MAX_INFRA_DATA_LEN                  32
56 #define NAN_MAX_CLUSTER_ATTRIBUTE_LEN           255
57 #define NAN_MAX_SUBSCRIBE_MAX_ADDRESS           42
58 #define NAN_MAX_FAM_CHANNELS                    32
59 #define NAN_MAX_POSTDISCOVERY_LEN               5
60 #define NAN_MAX_FRAME_DATA_LEN                  504
61 #define NAN_DP_MAX_APP_INFO_LEN                 512
62 #define NAN_ERROR_STR_LEN                       255
63 #define NAN_PMK_INFO_LEN                        32
64 #define NAN_MAX_SCID_BUF_LEN                    1024
65 #define NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN  2048
66 #define NAN_SECURITY_MIN_PASSPHRASE_LEN         8
67 #define NAN_SECURITY_MAX_PASSPHRASE_LEN         63
68 #define NAN_MAX_CHANNEL_INFO_SUPPORTED          4
69 #define NAN_IDENTITY_KEY_LEN                    16
70 #define NAN_IDENTITY_TAG_LEN                    8
71 #define NAN_IDENTITY_NONCE_LEN                  8
72 #define NAN_MAX_MATCH_IDENTITY_LEN             1024
73 /*
74   Definition of various NanResponseType
75 */
76 typedef enum {
77     NAN_RESPONSE_ENABLED                 = 0,
78     NAN_RESPONSE_DISABLED                = 1,
79     NAN_RESPONSE_PUBLISH                 = 2,
80     NAN_RESPONSE_PUBLISH_CANCEL          = 3,
81     NAN_RESPONSE_TRANSMIT_FOLLOWUP       = 4,
82     NAN_RESPONSE_SUBSCRIBE               = 5,
83     NAN_RESPONSE_SUBSCRIBE_CANCEL        = 6,
84     NAN_RESPONSE_STATS                   = 7,
85     NAN_RESPONSE_CONFIG                  = 8,
86     NAN_RESPONSE_TCA                     = 9,
87     NAN_RESPONSE_ERROR                   = 10,
88     NAN_RESPONSE_BEACON_SDF_PAYLOAD      = 11,
89     NAN_GET_CAPABILITIES                 = 12,
90     NAN_DP_INTERFACE_CREATE              = 13,
91     NAN_DP_INTERFACE_DELETE              = 14,
92     NAN_DP_INITIATOR_RESPONSE            = 15,
93     NAN_DP_RESPONDER_RESPONSE            = 16,
94     NAN_DP_END                           = 17,
95     NAN_PAIRING_INITIATOR_RESPONSE       = 18,
96     NAN_PAIRING_RESPONDER_RESPONSE       = 19,
97     NAN_BOOTSTRAPPING_INITIATOR_RESPONSE = 20,
98     NAN_BOOTSTRAPPING_RESPONDER_RESPONSE = 21,
99     NAN_PAIRING_END                      = 22,
100     NAN_SUSPEND_REQUEST_RESPONSE         = 23,
101     NAN_RESUME_REQUEST_RESPONSE          = 24
102 } NanResponseType;
103 
104 /* NAN Publish Types */
105 typedef enum {
106     NAN_PUBLISH_TYPE_UNSOLICITED = 0,
107     NAN_PUBLISH_TYPE_SOLICITED,
108     NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED
109 } NanPublishType;
110 
111 /* NAN Transmit Priorities */
112 typedef enum {
113     NAN_TX_PRIORITY_NORMAL = 0,
114     NAN_TX_PRIORITY_HIGH
115 } NanTxPriority;
116 
117 /* NAN Statistics Request ID Codes */
118 typedef enum {
119     NAN_STATS_ID_DE_PUBLISH = 0,
120     NAN_STATS_ID_DE_SUBSCRIBE,
121     NAN_STATS_ID_DE_MAC,
122     NAN_STATS_ID_DE_TIMING_SYNC,
123     NAN_STATS_ID_DE_DW,
124     NAN_STATS_ID_DE
125 } NanStatsType;
126 
127 /* NAN Protocol Event ID Codes */
128 typedef enum {
129     NAN_EVENT_ID_DISC_MAC_ADDR = 0,
130     NAN_EVENT_ID_STARTED_CLUSTER,
131     NAN_EVENT_ID_JOINED_CLUSTER
132 } NanDiscEngEventType;
133 
134 /* NAN Data Path type */
135 typedef enum {
136     NAN_DATA_PATH_UNICAST_MSG = 0,
137     NAN_DATA_PATH_MULTICAST_MSG
138 } NdpType;
139 
140 /* NAN Ranging Configuration */
141 typedef enum {
142     NAN_RANGING_DISABLE = 0,
143     NAN_RANGING_ENABLE
144 } NanRangingState;
145 
146 /* TCA Type */
147 typedef enum {
148     NAN_TCA_ID_CLUSTER_SIZE = 0
149 } NanTcaType;
150 
151 /* pairing request type*/
152 typedef enum {
153     NAN_PAIRING_SETUP = 0,
154     NAN_PAIRING_VERIFICATION = 1
155 } NanPairingRequestType;
156 
157 /* Nan AKM type */
158 typedef enum {
159     SAE = 0,
160     PASN = 1
161 } NanAkm;
162 
163 /* NAN Channel Info */
164 typedef struct {
165     u32 channel;
166     u32 bandwidth;
167     u32 nss;
168 } NanChannelInfo;
169 
170 /*
171   Various NAN Protocol Response code
172 */
173 typedef enum {
174     /* NAN Protocol Response Codes */
175     NAN_STATUS_SUCCESS = 0,
176     /*  NAN Discovery Engine/Host driver failures */
177     NAN_STATUS_INTERNAL_FAILURE = 1,
178     /*  NAN OTA failures */
179     NAN_STATUS_PROTOCOL_FAILURE = 2,
180     /* if the publish/subscribe id is invalid */
181     NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID = 3,
182     /* If we run out of resources allocated */
183     NAN_STATUS_NO_RESOURCE_AVAILABLE = 4,
184     /* if invalid params are passed */
185     NAN_STATUS_INVALID_PARAM = 5,
186     /*  if the requestor instance id is invalid */
187     NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID = 6,
188     /*  if the ndp id is invalid */
189     NAN_STATUS_INVALID_NDP_ID = 7,
190     /* if NAN is enabled when wifi is turned off */
191     NAN_STATUS_NAN_NOT_ALLOWED = 8,
192     /* if over the air ack is not received */
193     NAN_STATUS_NO_OTA_ACK = 9,
194     /* If NAN is already enabled and we are try to re-enable the same */
195     NAN_STATUS_ALREADY_ENABLED = 10,
196     /* If followup message internal queue is full */
197     NAN_STATUS_FOLLOWUP_QUEUE_FULL = 11,
198     /* Unsupported concurrency session enabled, NAN disabled notified */
199     NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12,
200     /*  if the pairing id is invalid */
201     NAN_STATUS_INVALID_PAIRING_ID = 13,
202     /*  if the bootstrapping id is invalid */
203     NAN_STATUS_INVALID_BOOTSTRAPPING_ID = 14,
204     /* If same request is received again */
205     NAN_STATUS_REDUNDANT_REQUEST = 15,
206     /* If current request is not supported */
207     NAN_STATUS_NOT_SUPPORTED = 16,
208     /* If no Wifi Aware connection is active */
209     NAN_STATUS_NO_CONNECTION = 17,
210 } NanStatusType;
211 
212 /* NAN Transmit Types */
213 typedef enum {
214     NAN_TX_TYPE_BROADCAST = 0,
215     NAN_TX_TYPE_UNICAST
216 } NanTxType;
217 
218 /* NAN Subscribe Type */
219 typedef enum {
220     NAN_SUBSCRIBE_TYPE_PASSIVE = 0,
221     NAN_SUBSCRIBE_TYPE_ACTIVE
222 } NanSubscribeType;
223 
224 /* NAN Service Response Filter Attribute Bit */
225 typedef enum {
226     NAN_SRF_ATTR_BLOOM_FILTER = 0,
227     NAN_SRF_ATTR_PARTIAL_MAC_ADDR
228 } NanSRFType;
229 
230 /* NAN Service Response Filter Include Bit */
231 typedef enum {
232     NAN_SRF_INCLUDE_DO_NOT_RESPOND = 0,
233     NAN_SRF_INCLUDE_RESPOND
234 } NanSRFIncludeType;
235 
236 /* NAN Match indication type */
237 typedef enum {
238     NAN_MATCH_ALG_MATCH_ONCE = 0,
239     NAN_MATCH_ALG_MATCH_CONTINUOUS,
240     NAN_MATCH_ALG_MATCH_NEVER
241 } NanMatchAlg;
242 
243 /* NAN Transmit Window Type */
244 typedef enum {
245     NAN_TRANSMIT_IN_DW = 0,
246     NAN_TRANSMIT_IN_FAW
247 } NanTransmitWindowType;
248 
249 /* NAN SRF State in Subscribe */
250 typedef enum {
251     NAN_DO_NOT_USE_SRF = 0,
252     NAN_USE_SRF
253 } NanSRFState;
254 
255 /* NAN Include SSI in MatchInd */
256 typedef enum {
257     NAN_SSI_NOT_REQUIRED_IN_MATCH_IND = 0,
258     NAN_SSI_REQUIRED_IN_MATCH_IND
259 } NanSsiInMatchInd;
260 
261 /* NAN DP security Configuration */
262 typedef enum {
263     NAN_DP_CONFIG_NO_SECURITY = 0,
264     NAN_DP_CONFIG_SECURITY
265 } NanDataPathSecurityCfgStatus;
266 
267 typedef enum {
268     NAN_QOS_NOT_REQUIRED = 0,
269     NAN_QOS_REQUIRED
270 } NanQosCfgStatus;
271 
272 
273 /* Data request Responder's response */
274 typedef enum {
275     NAN_DP_REQUEST_ACCEPT = 0,
276     NAN_DP_REQUEST_REJECT
277 } NanDataPathResponseCode;
278 
279 /* Pairing request Responder's response */
280 typedef enum {
281     NAN_PAIRING_REQUEST_ACCEPT = 0,
282     NAN_PAIRING_REQUEST_REJECT
283 } NanPairingResponseCode;
284 
285 /* Pairing bootstrapping Responder's response */
286 typedef enum {
287     NAN_BOOTSTRAPPING_REQUEST_ACCEPT = 0,
288     NAN_BOOTSTRAPPING_REQUEST_REJECT = 1,
289     NAN_BOOTSTRAPPING_REQUEST_COMEBACK = 2
290 } NanBootstrappingResponseCode;
291 
292 /* NAN DP channel config options */
293 typedef enum {
294     NAN_DP_CHANNEL_NOT_REQUESTED = 0,
295     NAN_DP_REQUEST_CHANNEL_SETUP,
296     NAN_DP_FORCE_CHANNEL_SETUP
297 } NanDataPathChannelCfg;
298 
299 /* Enable/Disable NAN Ranging Auto response */
300 typedef enum {
301     NAN_RANGING_AUTO_RESPONSE_ENABLE = 1,
302     NAN_RANGING_AUTO_RESPONSE_DISABLE
303 } NanRangingAutoResponse;
304 
305 /* Enable/Disable NAN service range report */
306 typedef enum {
307     NAN_DISABLE_RANGE_REPORT = 1,
308     NAN_ENABLE_RANGE_REPORT
309 } NanRangeReport;
310 
311 /* NAN Range Response */
312 typedef enum {
313     NAN_RANGE_REQUEST_ACCEPT = 1,
314     NAN_RANGE_REQUEST_REJECT,
315     NAN_RANGE_REQUEST_CANCEL
316 } NanRangeResponse;
317 
318 /* NAN Security Key Input Type*/
319 typedef enum {
320     NAN_SECURITY_KEY_INPUT_PMK = 1,
321     NAN_SECURITY_KEY_INPUT_PASSPHRASE
322 } NanSecurityKeyInputType;
323 
324 typedef struct {
325     /* pmk length */
326     u32 pmk_len;
327     /*
328        PMK: Info is optional in Discovery phase.
329        PMK info can be passed during
330        the NDP session.
331      */
332     u8 pmk[NAN_PMK_INFO_LEN];
333 } NanSecurityPmk;
334 
335 typedef struct {
336     /* passphrase length */
337     u32 passphrase_len;
338     /*
339        passphrase info is optional in Discovery phase.
340        passphrase info can be passed during
341        the NDP session.
342      */
343     u8 passphrase[NAN_SECURITY_MAX_PASSPHRASE_LEN];
344 } NanSecurityPassPhrase;
345 
346 typedef struct {
347     NanSecurityKeyInputType key_type;
348     union {
349         NanSecurityPmk pmk_info;
350         NanSecurityPassPhrase passphrase_info;
351     } body;
352 } NanSecurityKeyInfo;
353 
354 /* NAN Security Cipher Suites Mask */
355 #define NAN_CIPHER_SUITE_SHARED_KEY_NONE               0x00
356 #define NAN_CIPHER_SUITE_SHARED_KEY_128_MASK           0x01
357 #define NAN_CIPHER_SUITE_SHARED_KEY_256_MASK           0x02
358 #define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_128_MASK      0x04
359 #define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_256_MASK      0x08
360 #define NAN_CIPHER_SUITE_PUBLIC_KEY_PASN_128_MASK      0x40
361 #define NAN_CIPHER_SUITE_PUBLIC_KEY_PASN_256_MASK      0x80
362 
363 /* NAN ranging indication condition MASKS */
364 #define NAN_RANGING_INDICATE_CONTINUOUS_MASK   0x01
365 #define NAN_RANGING_INDICATE_INGRESS_MET_MASK  0x02
366 #define NAN_RANGING_INDICATE_EGRESS_MET_MASK   0x04
367 
368 /* NAN schedule update reason MASKS */
369 #define NAN_SCHEDULE_UPDATE_NSS_MASK   0x01
370 #define NAN_SCHEDULE_UPDATE_CHANNEL_MASK  0x02
371 
372 /* NAN pairing bootstrapping method */
373 #define NAN_PAIRING_BOOTSTRAPPING_OPPORTUNISTIC_MASK       0x01
374 #define NAN_PAIRING_BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK    0x02
375 #define NAN_PAIRING_BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK  0x04
376 #define NAN_PAIRING_BOOTSTRAPPING_QR_DISPLAY_MASK          0x08
377 #define NAN_PAIRING_BOOTSTRAPPING_NFC_TAG_MASK             0x10
378 #define NAN_PAIRING_BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK     0x20
379 #define NAN_PAIRING_BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK   0x40
380 #define NAN_PAIRING_BOOTSTRAPPING_QR_SCAN_MASK             0x80
381 #define NAN_PAIRING_BOOTSTRAPPING_NFC_READER_MASK          0x100
382 #define NAN_PAIRING_BOOTSTRAPPING_SERVICE_MANAGED_MASK     0x4000
383 #define NAN_PAIRING_BOOTSTRAPPING_HANDSHAKE_SHIP_MASK      0x8000
384 
385 /*
386    Structure to set the Service Descriptor Extension
387    Attribute (SDEA) passed as part of NanPublishRequest/
388    NanSubscribeRequest/NanMatchInd.
389 */
390 typedef struct {
391     /*
392        Optional configuration of Data Path Enable request.
393        configure flag determines whether configuration needs
394        to be passed or not.
395     */
396     u8 config_nan_data_path;
397     NdpType ndp_type;
398     /*
399        NAN secuirty required flag to indicate
400        if the security is enabled or disabled
401     */
402     NanDataPathSecurityCfgStatus security_cfg;
403     /*
404        NAN ranging required flag to indicate
405        if ranging is enabled on disabled
406     */
407     NanRangingState ranging_state;
408     /*
409       Enable/Disable Ranging report,
410       when configured NanRangeReportInd received
411     */
412     NanRangeReport range_report;
413     /*
414       NAN QOS required flag to indicate
415       if QOS is required or not.
416     */
417     NanQosCfgStatus qos_cfg;
418     /*
419       Config to set FSD with Gas bit
420       in the SDEA Control Field.
421      */
422     u8 config_fsd_gas;
423     u8 enable_fsd_gas;
424 
425     /*
426       Config to set FSD Required bit
427       in the SDEA Control Field.
428      */
429     u8 config_fsd_req;
430     u8 enable_fsd_req;
431 
432     /*
433       Config to set gtk protection bit
434       in the SDEA Control Field.
435      */
436     u8 gtk_protection;
437 } NanSdeaCtrlParams;
438 
439 /*
440    Nan Ranging Peer Info in MatchInd
441 */
442 typedef struct {
443     /*
444        Distance to the NAN device with the MAC address indicated
445        with ranged mac address.
446     */
447     u32 range_measurement_mm;
448     /* Ranging event matching the configuration of continuous/ingress/egress. */
449     u32 ranging_event_type;
450 } NanRangeInfo;
451 
452 /* Nan/NDP Capabilites info */
453 typedef struct {
454     u32 max_concurrent_nan_clusters;
455     u32 max_publishes;
456     u32 max_subscribes;
457     u32 max_service_name_len;
458     u32 max_match_filter_len;
459     u32 max_total_match_filter_len;
460     u32 max_service_specific_info_len;
461     u32 max_vsa_data_len;
462     u32 max_mesh_data_len;
463     u32 max_ndi_interfaces;
464     u32 max_ndp_sessions;
465     u32 max_app_info_len;
466     u32 max_queued_transmit_followup_msgs;
467     u32 ndp_supported_bands;
468     u32 cipher_suites_supported;
469     u32 max_scid_len;
470     bool is_ndp_security_supported;
471     u32 max_sdea_service_specific_info_len;
472     u32 max_subscribe_address;
473     u32 ndpe_attr_supported;
474     bool is_instant_mode_supported;
475     bool is_6g_supported;
476     bool is_he_supported;
477     bool is_pairing_supported;
478     bool is_set_cluster_id_supported;
479     bool is_suspension_supported;
480     bool is_periodic_ranging_supported;
481     wifi_rtt_bw supported_bw;
482     u8 num_rx_chains_supported;
483 } NanCapabilities;
484 
485 /*
486   Nan accept policy: Per service basis policy
487   Based on this policy(ALL/NONE), responder side
488   will send ACCEPT/REJECT
489 */
490 typedef enum {
491     NAN_SERVICE_ACCEPT_POLICY_NONE = 0,
492     /* Default value */
493     NAN_SERVICE_ACCEPT_POLICY_ALL
494 } NanServiceAcceptPolicy;
495 
496 /*
497   Host can send Vendor specific attributes which the Discovery Engine can
498   enclose in Beacons and/or Service Discovery frames transmitted.
499   Below structure is used to populate that.
500 */
501 typedef struct {
502     /*
503        0 = transmit only in the next discovery window
504        1 = transmit in next 16 discovery window
505     */
506     u8 payload_transmit_flag;
507     /*
508        Below flags will determine in which all frames
509        the vendor specific attributes should be included
510     */
511     u8 tx_in_discovery_beacon;
512     u8 tx_in_sync_beacon;
513     u8 tx_in_service_discovery;
514     /* Organizationally Unique Identifier */
515     u32 vendor_oui;
516     /*
517        vendor specific attribute to be transmitted
518        vsa_len : Length of the vsa data.
519      */
520     u32 vsa_len;
521     u8 vsa[NAN_MAX_VSA_DATA_LEN];
522 } NanTransmitVendorSpecificAttribute;
523 
524 
525 /*
526   Discovery Engine will forward any Vendor Specific Attributes
527   which it received as part of this structure.
528 */
529 /* Mask to determine on which frames attribute was received */
530 #define RX_DISCOVERY_BEACON_MASK  0x01
531 #define RX_SYNC_BEACON_MASK       0x02
532 #define RX_SERVICE_DISCOVERY_MASK 0x04
533 typedef struct {
534     /*
535        Frames on which this vendor specific attribute
536        was received. Mask defined above
537     */
538     u8 vsa_received_on;
539     /* Organizationally Unique Identifier */
540     u32 vendor_oui;
541     /* vendor specific attribute */
542     u32 attr_len;
543     u8 vsa[NAN_MAX_VSA_DATA_LEN];
544 } NanReceiveVendorSpecificAttribute;
545 
546 /*
547    NAN Beacon SDF Payload Received structure
548    Discovery engine sends the details of received Beacon or
549    Service Discovery Frames as part of this structure.
550 */
551 typedef struct {
552     /* Frame data */
553     u32 frame_len;
554     u8 frame_data[NAN_MAX_FRAME_DATA_LEN];
555 } NanBeaconSdfPayloadReceive;
556 
557 /*
558   Host can set the Periodic scan parameters for each of the
559   3(6, 44, 149) Social channels. Only these channels are allowed
560   any other channels are rejected
561 */
562 typedef enum {
563     NAN_CHANNEL_24G_BAND = 0,
564     NAN_CHANNEL_5G_BAND_LOW,
565     NAN_CHANNEL_5G_BAND_HIGH
566 } NanChannelIndex;
567 
568 /*
569    Structure to set the Social Channel Scan parameters
570    passed as part of NanEnableRequest/NanConfigRequest
571 */
572 typedef struct {
573     /*
574        Dwell time of each social channel in milliseconds
575        NanChannelIndex corresponds to the respective channel
576        If time set to 0 then the FW default time will be used.
577     */
578     u8 dwell_time[NAN_MAX_SOCIAL_CHANNELS]; // default value 200 msec
579 
580     /*
581        Scan period of each social channel in seconds
582        NanChannelIndex corresponds to the respective channel
583        If time set to 0 then the FW default time will be used.
584     */
585     u16 scan_period[NAN_MAX_SOCIAL_CHANNELS]; // default value 20 sec
586 } NanSocialChannelScanParams;
587 
588 /*
589   Host can send Post Connectivity Capability attributes
590   to be included in Service Discovery frames transmitted
591   as part of this structure.
592 */
593 typedef struct {
594     /*
595        0 = transmit only in the next discovery window
596        1 = transmit in next 16 discovery window
597     */
598     u8 payload_transmit_flag;
599     /* 1 - Wifi Direct supported 0 - Not supported */
600     u8 is_wfd_supported;
601     /* 1 - Wifi Direct Services supported 0 - Not supported */
602     u8 is_wfds_supported;
603     /* 1 - TDLS supported 0 - Not supported */
604     u8 is_tdls_supported;
605     /* 1 - IBSS supported 0 - Not supported */
606     u8 is_ibss_supported;
607     /* 1 - Mesh supported 0 - Not supported */
608     u8 is_mesh_supported;
609     /*
610        1 - NAN Device currently connect to WLAN Infra AP
611        0 - otherwise
612     */
613     u8 wlan_infra_field;
614 } NanTransmitPostConnectivityCapability;
615 
616 /*
617   Discovery engine providing the post connectivity capability
618   received.
619 */
620 typedef struct {
621     /* 1 - Wifi Direct supported 0 - Not supported */
622     u8 is_wfd_supported;
623     /* 1 - Wifi Direct Services supported 0 - Not supported */
624     u8 is_wfds_supported;
625     /* 1 - TDLS supported 0 - Not supported */
626     u8 is_tdls_supported;
627     /* 1 - IBSS supported 0 - Not supported */
628     u8 is_ibss_supported;
629     /* 1 - Mesh supported 0 - Not supported */
630     u8 is_mesh_supported;
631     /*
632        1 - NAN Device currently connect to WLAN Infra AP
633        0 - otherwise
634     */
635     u8 wlan_infra_field;
636 } NanReceivePostConnectivityCapability;
637 
638 /*
639   Indicates the availability interval duration associated with the
640   Availability Intervals Bitmap field
641 */
642 typedef enum {
643     NAN_DURATION_16MS = 0,
644     NAN_DURATION_32MS = 1,
645     NAN_DURATION_64MS = 2
646 } NanAvailDuration;
647 
648 /* Further availability per channel information */
649 typedef struct {
650     /* Defined above */
651     NanAvailDuration entry_control;
652     /*
653        1 byte field indicating the frequency band the NAN Device
654        will be available as defined in IEEE Std. 802.11-2012
655        Annex E Table E-4 Global Operating Classes
656     */
657     u8 class_val;
658     /*
659        1 byte field indicating the channel the NAN Device
660        will be available.
661     */
662     u8 channel;
663     /*
664         Map Id - 4 bit field which identifies the Further
665         availability map attribute.
666     */
667     u8 mapid;
668     /*
669        divides the time between the beginnings of consecutive Discovery
670        Windows of a given NAN cluster into consecutive time intervals
671        of equal durations. The time interval duration is specified by
672        the Availability Interval Duration subfield of the Entry Control
673        field.
674 
675        A Nan device that sets the i-th bit of the Availability
676        Intervals Bitmap to 1 shall be present during the corresponding
677        i-th time interval in the operation channel indicated by the
678        Operating Class and Channel Number fields in the same Availability Entry.
679 
680        A Nan device that sets the i-th bit of the Availability Intervals Bitmap to
681        0 may be present during the corresponding i-th time interval in the operation
682        channel indicated by the Operating Class and Channel Number fields in the same
683        Availability Entry.
684 
685        The size of the Bitmap is dependent upon the Availability Interval Duration
686        chosen in the Entry Control Field.  The size can be either 1, 2 or 4 bytes long
687 
688        - Duration field is equal to 0, only AIB[0] is valid
689        - Duration field is equal to 1, only AIB [0] and AIB [1] is valid
690        - Duration field is equal to 2, AIB [0], AIB [1], AIB [2] and AIB [3] are valid
691     */
692     u32 avail_interval_bitmap;
693 } NanFurtherAvailabilityChannel;
694 
695 /*
696   Further availability map which can be sent and received from
697   Discovery engine
698 */
699 typedef struct {
700     /*
701        Number of channels indicates the number of channel
702        entries which is part of fam
703     */
704     u8 numchans;
705     NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS];
706 } NanFurtherAvailabilityMap;
707 
708 /*
709   Host can send Post-Nan Discovery attributes which the Discovery Engine can
710   enclose in Service Discovery frames
711 */
712 /* Possible connection types in Post NAN Discovery attributes */
713 typedef enum {
714     NAN_CONN_WLAN_INFRA = 0,
715     NAN_CONN_P2P_OPER = 1,
716     NAN_CONN_WLAN_IBSS = 2,
717     NAN_CONN_WLAN_MESH = 3,
718     NAN_CONN_FURTHER_SERVICE_AVAILABILITY = 4,
719     NAN_CONN_WLAN_RANGING = 5
720 } NanConnectionType;
721 
722 /* Possible device roles in Post NAN Discovery attributes */
723 typedef enum {
724     NAN_WLAN_INFRA_AP = 0,
725     NAN_WLAN_INFRA_STA = 1,
726     NAN_P2P_OPER_GO = 2,
727     NAN_P2P_OPER_DEV = 3,
728     NAN_P2P_OPER_CLI = 4
729 } NanDeviceRole;
730 
731 /* Configuration params of NAN Ranging */
732 typedef struct {
733     /*
734       Interval in milli sec between two ranging measurements.
735       If the Awake DW intervals in NanEnable/Config are larger
736       than the ranging intervals priority is given to Awake DW
737       Intervals. Only on a match the ranging is initiated for the
738       peer
739     */
740     u32 ranging_interval_msec;
741     /*
742       Flags indicating the type of ranging event to be notified
743       NAN_RANGING_INDICATE_ MASKS are used to set these.
744       BIT0 - Continuous Ranging event notification.
745       BIT1 - Ingress distance is <=.
746       BIT2 - Egress distance is >=.
747     */
748     u32 config_ranging_indications;
749     /* Ingress distance in millimeters (optional) */
750     u32 distance_ingress_mm;
751     /* Egress distance in millmilliimeters (optional) */
752     u32 distance_egress_mm;
753     /* Number of FTM frames per burst */
754     u32 rtt_burst_size;
755     /* RTT Measurement Preamble */
756     wifi_rtt_preamble preamble;
757     /* Channel information */
758     wifi_channel_info channel_info;
759 } NanRangingCfg;
760 
761 /* NAN Ranging request's response */
762 typedef struct {
763     /* Publish Id of an earlier Publisher */
764     u16 publish_id;
765     /*
766        A 32 bit Requestor instance Id which is sent to the Application.
767        This Id will be used in subsequent RangeResponse on Subscribe side.
768     */
769     u32 requestor_instance_id;
770     /* Peer MAC addr of Range Requestor */
771     u8 peer_addr[NAN_MAC_ADDR_LEN];
772     /* Response indicating ACCEPT/REJECT/CANCEL of Range Request */
773     NanRangeResponse ranging_response;
774 } NanRangeResponseCfg;
775 
776 /* Structure of Post NAN Discovery attribute */
777 typedef struct {
778     /* Connection type of the host */
779     NanConnectionType  type;
780     /*
781        Device role of the host based on
782        the connection type
783     */
784     NanDeviceRole role;
785     /*
786        Flag to send the information as a single shot or repeated
787        for next 16 discovery windows
788        0 - Single_shot
789        1 - next 16 discovery windows
790     */
791     u8 transmit_freq;
792     /* Duration of the availability bitmask */
793     NanAvailDuration duration;
794     /* Availability interval bitmap based on duration */
795     u32 avail_interval_bitmap;
796     /*
797        Mac address depending on the conn type and device role
798        --------------------------------------------------
799        | Conn Type  |  Device Role |  Mac address Usage  |
800        --------------------------------------------------
801        | WLAN_INFRA |  AP/STA      |   BSSID of the AP   |
802        --------------------------------------------------
803        | P2P_OPER   |  GO          |   GO's address      |
804        --------------------------------------------------
805        | P2P_OPER   |  P2P_DEVICE  |   Address of who    |
806        |            |              |   would become GO   |
807        --------------------------------------------------
808        | WLAN_IBSS  |  NA          |   BSSID             |
809        --------------------------------------------------
810        | WLAN_MESH  |  NA          |   BSSID             |
811        --------------------------------------------------
812     */
813     u8 addr[NAN_MAC_ADDR_LEN];
814     /*
815        Mandatory mesh id value if connection type is WLAN_MESH
816        Mesh id contains 0-32 octet identifier and should be
817        as per IEEE Std.802.11-2012 spec.
818     */
819     u16 mesh_id_len;
820     u8 mesh_id[NAN_MAX_MESH_DATA_LEN];
821     /*
822        Optional infrastructure SSID if conn_type is set to
823        NAN_CONN_WLAN_INFRA
824     */
825     u16 infrastructure_ssid_len;
826     u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN];
827 } NanTransmitPostDiscovery;
828 
829 /*
830    Discovery engine providing the structure of Post NAN
831    Discovery
832 */
833 typedef struct {
834     /* Connection type of the host */
835     NanConnectionType  type;
836     /*
837        Device role of the host based on
838        the connection type
839     */
840     NanDeviceRole role;
841     /* Duration of the availability bitmask */
842     NanAvailDuration duration;
843     /* Availability interval bitmap based on duration */
844     u32 avail_interval_bitmap;
845     /*
846        Map Id - 4 bit field which identifies the Further
847        availability map attribute.
848     */
849     u8 mapid;
850     /*
851        Mac address depending on the conn type and device role
852        --------------------------------------------------
853        | Conn Type  |  Device Role |  Mac address Usage  |
854        --------------------------------------------------
855        | WLAN_INFRA |  AP/STA      |   BSSID of the AP   |
856        --------------------------------------------------
857        | P2P_OPER   |  GO          |   GO's address      |
858        --------------------------------------------------
859        | P2P_OPER   |  P2P_DEVICE  |   Address of who    |
860        |            |              |   would become GO   |
861        --------------------------------------------------
862        | WLAN_IBSS  |  NA          |   BSSID             |
863        --------------------------------------------------
864        | WLAN_MESH  |  NA          |   BSSID             |
865        --------------------------------------------------
866     */
867     u8 addr[NAN_MAC_ADDR_LEN];
868     /*
869        Mandatory mesh id value if connection type is WLAN_MESH
870        Mesh id contains 0-32 octet identifier and should be
871        as per IEEE Std.802.11-2012 spec.
872     */
873     u16 mesh_id_len;
874     u8 mesh_id[NAN_MAX_MESH_DATA_LEN];
875     /*
876        Optional infrastructure SSID if conn_type is set to
877        NAN_CONN_WLAN_INFRA
878     */
879     u16 infrastructure_ssid_len;
880     u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN];
881 } NanReceivePostDiscovery;
882 
883 /*
884    NAN device level configuration of SDF and Sync beacons in both
885    2.4/5GHz bands
886 */
887 typedef struct {
888     /* Configure 2.4GHz DW Band */
889     u8 config_2dot4g_dw_band;
890     /*
891        Indicates the interval for Sync beacons and SDF's in 2.4GHz band.
892        Valid values of DW Interval are: 1, 2, 3, 4 and 5, 0 is reserved.
893        The SDF includes in OTA when enabled. The publish/subscribe period
894        values don't override the device level configurations.
895     */
896     u32 dw_2dot4g_interval_val; // default value 1
897     /* Configure 5GHz DW Band */
898     u8 config_5g_dw_band;
899     /*
900        Indicates the interval for Sync beacons and SDF's in 5GHz band
901        Valid values of DW Interval are: 1, 2, 3, 4 and 5, 0 no wake up for
902        any interval. The SDF includes in OTA when enabled. The publish/subscribe
903        period values don't override the device level configurations.
904     */
905     u32 dw_5g_interval_val; // default value 1 when 5G is enabled
906 } NanConfigDW;
907 
908 /*
909   Enable Request Message Structure
910   The NanEnableReq message instructs the Discovery Engine to enter an operational state
911 */
912 typedef struct {
913     /* Mandatory parameters below */
914     u8 master_pref; // default value 0x02
915     /*
916       A cluster_low value matching cluster_high indicates a request to join
917       a cluster with that value. If the requested cluster is not found the
918       device will start its own cluster.
919     */
920     u16 cluster_low; // default value 0
921     u16 cluster_high; // default value 0xFFFF
922 
923     /*
924       Optional configuration of Enable request.
925       Each of the optional parameters have configure flag which
926       determine whether configuration is to be passed or not.
927     */
928     u8 config_support_5g;
929     u8 support_5g_val; // default value 0; turned off by default
930     /*
931        BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons
932        0 - Do not include SIDs in any beacons
933        1 - Include SIDs in all beacons.
934        Rest 7 bits are count field which allows control over the number of SIDs
935        included in the Beacon.  0 means to include as many SIDs that fit into
936        the maximum allow Beacon frame size
937     */
938     u8 config_sid_beacon;
939     u8 sid_beacon_val; // default value 0x01
940     /*
941        The rssi values below should be specified without sign.
942        For eg: -70dBm should be specified as 70.
943     */
944     u8 config_2dot4g_rssi_close;
945     u8 rssi_close_2dot4g_val;    // default value -60 dBm
946 
947     u8 config_2dot4g_rssi_middle;
948     u8 rssi_middle_2dot4g_val;    // default value -70 dBm
949 
950     u8 config_2dot4g_rssi_proximity;
951     u8 rssi_proximity_2dot4g_val;//  default value -60dBm
952 
953     u8 config_hop_count_limit;
954     u8 hop_count_limit_val; //  default value 0x02
955 
956     /*
957        Defines 2.4G channel access support
958        0 - No Support
959        1 - Supported
960     */
961     u8 config_2dot4g_support;
962     u8 support_2dot4g_val; // default value 0x01
963     /*
964        Defines 2.4G channels will be used for sync/discovery beacons
965        0 - 2.4G channels not used for beacons
966        1 - 2.4G channels used for beacons
967     */
968     u8 config_2dot4g_beacons;
969     u8 beacon_2dot4g_val; // default value 1
970     /*
971        Defines 2.4G channels will be used for Service Discovery frames
972        0 - 2.4G channels not used for Service Discovery frames
973        1 - 2.4G channels used for Service Discovery frames
974     */
975     u8 config_2dot4g_sdf;
976     u8 sdf_2dot4g_val; // default value 1
977     /*
978        Defines 5G channels will be used for sync/discovery beacons
979        0 - 5G channels not used for beacons
980        1 - 5G channels used for beacons
981     */
982     u8 config_5g_beacons;
983     u8 beacon_5g_val; // default value 1 when 5G is enabled
984     /*
985        Defines 5G channels will be used for Service Discovery frames
986        0 - 5G channels not used for Service Discovery frames
987        1 - 5G channels used for Service Discovery frames
988     */
989     u8 config_5g_sdf;
990     u8 sdf_5g_val; // default value is 0 when 5G is enabled
991     /*
992        1 byte value which defines the RSSI in
993        dBm for a close by Peer in 5 Ghz channels.
994        The rssi values should be specified without sign.
995        For eg: -70dBm should be specified as 70.
996     */
997     u8 config_5g_rssi_close;
998     u8 rssi_close_5g_val; // default value -60dBm when 5G is enabled
999     /*
1000        1 byte value which defines the RSSI value in
1001        dBm for a close by Peer in 5 Ghz channels.
1002        The rssi values should be specified without sign.
1003        For eg: -70dBm should be specified as 70.
1004     */
1005     u8 config_5g_rssi_middle;
1006     u8 rssi_middle_5g_val; // default value -75dBm when 5G is enabled
1007     /*
1008        1 byte value which defines the RSSI filter
1009        threshold.  Any Service Descriptors received above this
1010        value that are configured for RSSI filtering will be dropped.
1011        The rssi values should be specified without sign.
1012        For eg: -70dBm should be specified as 70.
1013     */
1014     u8 config_5g_rssi_close_proximity;
1015     u8 rssi_close_proximity_5g_val; // default value -60dBm when 5G is enabled
1016     /*
1017        1 byte quantity which defines the window size over
1018        which the “average RSSI” will be calculated over.
1019     */
1020     u8 config_rssi_window_size;
1021     u8 rssi_window_size_val; // default value 0x08
1022     /*
1023        The 24 bit Organizationally Unique ID + the 8 bit Network Id.
1024     */
1025     u8 config_oui;
1026     u32 oui_val; // default value {0x51, 0x6F, 0x9A, 0x01, 0x00, 0x00}
1027     /*
1028        NAN Interface Address, If not configured the Discovery Engine
1029        will generate a 6 byte Random MAC.
1030     */
1031     u8 config_intf_addr;
1032     u8 intf_addr_val[NAN_MAC_ADDR_LEN];
1033     /*
1034        If set to 1, the Discovery Engine will enclose the Cluster
1035        Attribute only sent in Beacons in a Vendor Specific Attribute
1036        and transmit in a Service Descriptor Frame.
1037     */
1038     u8 config_cluster_attribute_val;
1039     /*
1040        The periodicity in seconds between full scan’s to find any new
1041        clusters available in the area.  A Full scan should not be done
1042        more than every 10 seconds and should not be done less than every
1043        30 seconds.
1044     */
1045     u8 config_scan_params;
1046     NanSocialChannelScanParams scan_params_val;
1047     /*
1048        1 byte quantity which forces the Random Factor to a particular
1049        value for all transmitted Sync/Discovery beacons
1050     */
1051     u8 config_random_factor_force;
1052     u8 random_factor_force_val; // default value off and set to 0x00
1053     /*
1054        1 byte quantity which forces the HC for all transmitted Sync and
1055        Discovery Beacon NO matter the real HC being received over the
1056        air.
1057     */
1058     u8 config_hop_count_force;
1059     u8 hop_count_force_val; // default value 0x00
1060 
1061     /* channel frequency in MHz to enable Nan on */
1062     u8 config_24g_channel;
1063     wifi_channel channel_24g_val; // default value channel 0x6
1064 
1065     u8 config_5g_channel;
1066     wifi_channel channel_5g_val; // default value channel 44 or 149 regulatory
1067                                  // domain
1068     /* Configure 2.4/5GHz DW */
1069     NanConfigDW config_dw;
1070 
1071     /*
1072        By default discovery MAC address randomization is enabled
1073        and default interval value is 30 minutes i.e. 1800 seconds.
1074        The value 0 is used to disable MAC addr randomization.
1075     */
1076     u8 config_disc_mac_addr_randomization;
1077     u32 disc_mac_addr_rand_interval_sec; // default value 1800 sec
1078 
1079     /*
1080       Set/Enable corresponding bits to disable Discovery indications:
1081       BIT0 - Disable Discovery MAC Address Event.
1082       BIT1 - Disable Started Cluster Event.
1083       BIT2 - Disable Joined Cluster Event.
1084     */
1085     u8 discovery_indication_cfg;  // default value 0x0
1086     /*
1087        BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons
1088        0 - Do not include SIDs in any beacons
1089        1 - Include SIDs in all beacons.
1090        Rest 7 bits are count field which allows control over the number of SIDs
1091        included in the Beacon.  0 means to include as many SIDs that fit into
1092        the maximum allow Beacon frame size
1093     */
1094     u8 config_subscribe_sid_beacon;
1095     u32 subscribe_sid_beacon_val; // default value 0x0
1096     /*
1097        Discovery Beacon Interval config.
1098        Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW.
1099        When 0 value is passed it is reset to default value of 128 or 176 msec.
1100     */
1101     u8 config_discovery_beacon_int;
1102     u32 discovery_beacon_interval;
1103     /*
1104        Enable Number of Spatial Streams.
1105        This is NAN Power Optimization feature for NAN discovery.
1106     */
1107     u8 config_nss;
1108     // default value is implementation specific and passing 0 sets it to default
1109     u32 nss;
1110     /*
1111        Enable device level NAN Ranging feature.
1112        0 - Disable
1113        1 - Enable
1114     */
1115     u8 config_enable_ranging;
1116     u32 enable_ranging;
1117     /*
1118        Enable/Disable DW Early termination.
1119        0 - Disable
1120        1 - Enable
1121     */
1122     u8 config_dw_early_termination;
1123     u32 enable_dw_termination;
1124     /*
1125        Indicate whether to use NDPE attribute to bring-up TCP/IP connection.
1126        If config_ndpe_attr is not configured, the default behavior is
1127        not using NDPE attr, and the capability is not advertised.
1128        0 - Not use
1129        1 - Use
1130     */
1131     u8 config_ndpe_attr;
1132     u32 use_ndpe_attr;
1133     /*
1134         Enable NAN v3.1 instant communication mode.
1135         0 - Disable
1136         1 - Enable
1137     */
1138     u8 config_enable_instant_mode;
1139     u32 enable_instant_mode;
1140     /*
1141         Config NAN v3.1 instant communication channel frequency selected over NFC/OOB method.
1142         If dual band is supported default channel is 149 or 44 as per regulatory domain,
1143         else channel 6 (send frequency in MHz).
1144         Sometimes depending on country code retrictions, even 149/44 may be restricted
1145         in those cases instant channel will be operational only in 2.4GHz.
1146         Use wifi_get_usable_channels() API to get supported bands/channels before
1147         Instant mode NFC handshake is triggered
1148     */
1149     u8 config_instant_mode_channel;
1150     wifi_channel instant_mode_channel;
1151 
1152     /*
1153        Enable/Disable unsync service discovery.
1154        0 - Disable
1155        1 - Enable
1156     */
1157     u8 config_unsync_srvdsc;
1158     u8 enable_unsync_srvdsc;
1159 
1160     /*
1161       Configure regulatory information.
1162     */
1163     u8 config_reg_info;
1164     u8 reg_info_val;
1165 } NanEnableRequest;
1166 
1167 /*
1168   NAN pairing config.
1169 */
1170 typedef struct {
1171 
1172     /*
1173       Enable Nan pairing setup
1174     */
1175     u32 enable_pairing_setup;
1176 
1177     /*
1178       Enable cache NIK/NPK after Nan pairing setup
1179     */
1180     u32 enable_pairing_cache;
1181 
1182     /*
1183       Enable Nan pairing verification with cached NIK/NPK
1184     */
1185     u32 enable_pairing_verification;
1186 
1187     /*
1188       The set of supported bootstrapping methods.
1189     */
1190     u16 supported_bootstrapping_methods;
1191 } NanPairingConfig;
1192 
1193 /*
1194   Publish Msg Structure
1195   Message is used to request the DE to publish the Service Name
1196   using the parameters passed into the Discovery Window
1197 */
1198 typedef struct {
1199     u16 publish_id;/* id  0 means new publish, any other id is existing publish */
1200     u16 ttl; /* how many seconds to run for. 0 means forever until canceled */
1201     /*
1202        period: Awake DW Interval for publish(service)
1203        Indicates the interval between two Discovery Windows in which
1204        the device supporting the service is awake to transmit or
1205        receive the Service Discovery frames.
1206        Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16, value 0 will
1207        default to 1.
1208     */
1209     u16 period;
1210     NanPublishType publish_type;/* 0= unsolicited, solicited = 1, 2= both */
1211     NanTxType tx_type; /* 0 = broadcast, 1= unicast  if solicited publish */
1212     u8 publish_count; /* number of OTA Publish, 0 means forever until canceled */
1213     u16 service_name_len; /* length of service name */
1214     u8 service_name[NAN_MAX_SERVICE_NAME_LEN];/* UTF-8 encoded string identifying the service */
1215     /*
1216        Field which specifies how the matching indication to host is controlled.
1217        0 - Match and Indicate Once
1218        1 - Match and Indicate continuous
1219        2 - Match and Indicate never. This means don't indicate the match to the host.
1220        3 - Reserved
1221     */
1222     NanMatchAlg publish_match_indicator;
1223 
1224     /*
1225        Sequence of values
1226        NAN Device that has invoked a Subscribe method corresponding to this Publish method
1227     */
1228     u16 service_specific_info_len;
1229     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
1230 
1231     /*
1232        Ordered sequence of <length, value> pairs which specify further response conditions
1233        beyond the service name used to filter subscribe messages to respond to.
1234        This is only needed when the PT is set to NAN_SOLICITED or NAN_SOLICITED_UNSOLICITED.
1235     */
1236     u16 rx_match_filter_len;
1237     u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN];
1238 
1239     /*
1240        Ordered sequence of <length, value> pairs to be included in the Discovery Frame.
1241        If present it is always sent in a Discovery Frame
1242     */
1243     u16 tx_match_filter_len;
1244     u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN];
1245 
1246     /*
1247        flag which specifies that the Publish should use the configured RSSI
1248        threshold and the received RSSI in order to filter requests
1249        0 – ignore the configured RSSI threshold when running a Service
1250            Descriptor attribute or Service ID List Attribute through the DE matching logic.
1251        1 – use the configured RSSI threshold when running a Service
1252            Descriptor attribute or Service ID List Attribute through the DE matching logic.
1253 
1254     */
1255     u8 rssi_threshold_flag;
1256 
1257     /*
1258        8-bit bitmap which allows the Host to associate this publish
1259        with a particular Post-NAN Connectivity attribute
1260        which has been sent down in a NanConfigureRequest/NanEnableRequest
1261        message.  If the DE fails to find a configured Post-NAN
1262        connectivity attributes referenced by the bitmap,
1263        the DE will return an error code to the Host.
1264        If the Publish is configured to use a Post-NAN Connectivity
1265        attribute and the Host does not refresh the Post-NAN Connectivity
1266        attribute the Publish will be canceled and the Host will be sent
1267        a PublishTerminatedIndication message.
1268     */
1269     u8 connmap;
1270     /*
1271       Set/Enable corresponding bits to disable any indications that follow a publish.
1272       BIT0 - Disable publish termination indication.
1273       BIT1 - Disable match expired indication.
1274       BIT2 - Disable followUp indication received (OTA).
1275       BIT3 - Disable publishReplied indication.
1276     */
1277     u8 recv_indication_cfg;
1278     /*
1279       Nan accept policy for the specific service(publish)
1280     */
1281     NanServiceAcceptPolicy service_responder_policy;
1282     /* NAN Cipher Suite Type */
1283     u32 cipher_type;
1284     /*
1285        Nan Security Key Info is optional in Discovery phase.
1286        PMK or passphrase info can be passed during
1287        the NDP session.
1288     */
1289     NanSecurityKeyInfo key_info;
1290 
1291     /* Security Context Identifiers length */
1292     u32 scid_len;
1293     /*
1294        Security Context Identifier attribute contains PMKID
1295        shall be included in NDP setup and response messages.
1296        Security Context Identifier, Identifies the Security
1297        Context. For NAN Shared Key Cipher Suite, this field
1298        contains the 16 octet PMKID identifying the PMK used
1299        for setting up the Secure Data Path.
1300     */
1301     u8 scid[NAN_MAX_SCID_BUF_LEN];
1302 
1303     /* NAN configure service discovery extended attributes */
1304     NanSdeaCtrlParams sdea_params;
1305 
1306     /* NAN Ranging configuration */
1307     NanRangingCfg ranging_cfg;
1308 
1309     /* Enable/disable NAN serivce Ranging auto response mode */
1310     NanRangingAutoResponse ranging_auto_response;
1311 
1312     /*
1313       When the ranging_auto_response_cfg is not set, NanRangeRequestInd is
1314       received. Nan Range Response to Peer MAC Addr is notified to indicate
1315       ACCEPT/REJECT/CANCEL to the requestor.
1316     */
1317     NanRangeResponseCfg range_response_cfg;
1318 
1319     /*
1320        Sequence of values indicating the service specific info in SDEA
1321     */
1322     u16 sdea_service_specific_info_len;
1323     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
1324 
1325     /*
1326        The Identity key for pairing, used to generate NIRA
1327     */
1328     u8 nan_identity_key[NAN_IDENTITY_KEY_LEN];
1329 
1330     /*
1331       The config for Nan pairing
1332     */
1333     NanPairingConfig nan_pairing_config;
1334 
1335     /*
1336       Specifies whether suspension can be possible in this publish session.
1337       The request would fail if enable_suspendability is true but
1338       is_suspension_supported is false in NanCapabilities.
1339     */
1340     bool enable_suspendability;
1341 
1342     /* s3 capabilities */
1343     u16 s3_capabilities;
1344 
1345     /* cipher capabilities */
1346     u8 cipher_capabilities;
1347 } NanPublishRequest;
1348 
1349 /*
1350   Publish Cancel Msg Structure
1351   The PublishServiceCancelReq Message is used to request the DE to stop publishing
1352   the Service Name identified by the Publish Id in the message.
1353 */
1354 typedef struct {
1355     u16 publish_id;
1356 } NanPublishCancelRequest;
1357 
1358 /*
1359   NAN Subscribe Structure
1360   The SubscribeServiceReq message is sent to the Discovery Engine
1361   whenever the Upper layers would like to listen for a Service Name
1362 */
1363 typedef struct {
1364     u16 subscribe_id; /* id 0 means new subscribe, non zero is existing subscribe */
1365     u16 ttl; /* how many seconds to run for. 0 means forever until canceled */
1366     /*
1367        period: Awake DW Interval for subscribe(service)
1368        Indicates the interval between two Discovery Windows in which
1369        the device supporting the service is awake to transmit or
1370        receive the Service Discovery frames.
1371        Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16, value 0 will
1372        default to 1.
1373     */
1374     u16 period;
1375 
1376     /* Flag which specifies how the Subscribe request shall be processed. */
1377     NanSubscribeType subscribe_type; /* 0 - PASSIVE , 1- ACTIVE */
1378 
1379     /* Flag which specifies on Active Subscribes how the Service Response Filter attribute is populated.*/
1380     NanSRFType serviceResponseFilter; /* 0 - Bloom Filter, 1 - MAC Addr */
1381 
1382     /* Flag which specifies how the Service Response Filter Include bit is populated.*/
1383     NanSRFIncludeType serviceResponseInclude; /* 0=Do not respond if in the Address Set, 1= Respond */
1384 
1385     /* Flag which specifies if the Service Response Filter should be used when creating Subscribes.*/
1386     NanSRFState useServiceResponseFilter; /* 0=Do not send the Service Response Filter,1= send */
1387 
1388     /*
1389        Flag which specifies if the Service Specific Info is needed in
1390        the Publish message before creating the MatchIndication
1391     */
1392     NanSsiInMatchInd ssiRequiredForMatchIndication; /* 0=Not needed, 1= Required */
1393 
1394     /*
1395        Field which specifies how the matching indication to host is controlled.
1396        0 - Match and Indicate Once
1397        1 - Match and Indicate continuous
1398        2 - Match and Indicate never. This means don't indicate the match to the host.
1399        3 - Reserved
1400     */
1401     NanMatchAlg subscribe_match_indicator;
1402 
1403     /*
1404        The number of Subscribe Matches which should occur
1405        before the Subscribe request is automatically terminated.
1406     */
1407     u8 subscribe_count; /* If this value is 0 this field is not used by the DE.*/
1408 
1409     u16 service_name_len;/* length of service name */
1410     u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; /* UTF-8 encoded string identifying the service */
1411 
1412     /* Sequence of values which further specify the published service beyond the service name*/
1413     u16 service_specific_info_len;
1414     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
1415 
1416     /*
1417        Ordered sequence of <length, value> pairs used to filter out received publish discovery messages.
1418        This can be sent both for a Passive or an Active Subscribe
1419     */
1420     u16 rx_match_filter_len;
1421     u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN];
1422 
1423     /*
1424        Ordered sequence of <length, value> pairs  included in the
1425        Discovery Frame when an Active Subscribe is used.
1426     */
1427     u16 tx_match_filter_len;
1428     u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN];
1429 
1430     /*
1431        Flag which specifies that the Subscribe should use the configured RSSI
1432        threshold and the received RSSI in order to filter requests
1433        0 – ignore the configured RSSI threshold when running a Service
1434            Descriptor attribute or Service ID List Attribute through the DE matching logic.
1435        1 – use the configured RSSI threshold when running a Service
1436            Descriptor attribute or Service ID List Attribute through the DE matching logic.
1437 
1438     */
1439     u8 rssi_threshold_flag;
1440 
1441     /*
1442        8-bit bitmap which allows the Host to associate this Active
1443        Subscribe with a particular Post-NAN Connectivity attribute
1444        which has been sent down in a NanConfigureRequest/NanEnableRequest
1445        message.  If the DE fails to find a configured Post-NAN
1446        connectivity attributes referenced by the bitmap,
1447        the DE will return an error code to the Host.
1448        If the Subscribe is configured to use a Post-NAN Connectivity
1449        attribute and the Host does not refresh the Post-NAN Connectivity
1450        attribute the Subscribe will be canceled and the Host will be sent
1451        a SubscribeTerminatedIndication message.
1452     */
1453     u8 connmap;
1454     /*
1455        NAN Interface Address, conforming to the format as described in
1456        8.2.4.3.2 of IEEE Std. 802.11-2012.
1457     */
1458     u8 num_intf_addr_present;
1459     u8 intf_addr[NAN_MAX_SUBSCRIBE_MAX_ADDRESS][NAN_MAC_ADDR_LEN];
1460     /*
1461       Set/Enable corresponding bits to disable indications that follow a subscribe.
1462       BIT0 - Disable subscribe termination indication.
1463       BIT1 - Disable match expired indication.
1464       BIT2 - Disable followUp indication received (OTA).
1465     */
1466     u8 recv_indication_cfg;
1467 
1468     /* NAN Cipher Suite Type */
1469     u32 cipher_type;
1470     /*
1471        Nan Security Key Info is optional in Discovery phase.
1472        PMK or passphrase info can be passed during
1473        the NDP session.
1474     */
1475     NanSecurityKeyInfo key_info;
1476 
1477     /* Security Context Identifiers length */
1478     u32 scid_len;
1479     /*
1480        Security Context Identifier attribute contains PMKID
1481        shall be included in NDP setup and response messages.
1482        Security Context Identifier, Identifies the Security
1483        Context. For NAN Shared Key Cipher Suite, this field
1484        contains the 16 octet PMKID identifying the PMK used
1485        for setting up the Secure Data Path.
1486     */
1487     u8 scid[NAN_MAX_SCID_BUF_LEN];
1488 
1489     /* NAN configure service discovery extended attributes */
1490     NanSdeaCtrlParams sdea_params;
1491 
1492     /* NAN Ranging configuration */
1493     NanRangingCfg ranging_cfg;
1494 
1495     /* Enable/disable NAN serivce Ranging auto response mode */
1496     NanRangingAutoResponse ranging_auto_response;
1497 
1498     /*
1499       When the ranging_auto_response_cfg is not set, NanRangeRequestInd is
1500       received. Nan Range Response to Peer MAC Addr is notified to indicate
1501       ACCEPT/REJECT/CANCEL to the requestor.
1502     */
1503     NanRangeResponseCfg range_response_cfg;
1504 
1505     /*
1506        Sequence of values indicating the service specific info in SDEA
1507     */
1508     u16 sdea_service_specific_info_len;
1509     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
1510     /*
1511        The Identity key for pairing, used to generate NIRA
1512     */
1513     u8 nan_identity_key[NAN_IDENTITY_KEY_LEN];
1514 
1515     /*
1516       The config for Nan pairing
1517     */
1518     NanPairingConfig nan_pairing_config;
1519 
1520     /*
1521       Specifies whether suspension can be possible in this subscribe session.
1522       The request would fail if enable_suspendability is true but
1523       is_suspension_supported is false in NanCapabilities.
1524     */
1525     bool enable_suspendability;
1526 
1527     /* cipher capabilities */
1528     u8 cipher_capabilities;
1529 } NanSubscribeRequest;
1530 
1531 /*
1532   NAN Subscribe Cancel Structure
1533   The SubscribeCancelReq Message is used to request the DE to stop looking for the Service Name.
1534 */
1535 typedef struct {
1536     u16 subscribe_id;
1537 } NanSubscribeCancelRequest;
1538 
1539 /*
1540   Transmit follow up Structure
1541   The TransmitFollowupReq message is sent to the DE to allow the sending of the Service_Specific_Info
1542   to a particular MAC address.
1543 */
1544 typedef struct {
1545     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
1546     u16 publish_subscribe_id;
1547 
1548     /*
1549        This Id is the Requestor Instance that is passed as
1550        part of earlier MatchInd/FollowupInd message.
1551     */
1552     u32 requestor_instance_id;
1553     u8 addr[NAN_MAC_ADDR_LEN]; /* Unicast address */
1554     NanTxPriority priority; /* priority of the request 2=high */
1555     NanTransmitWindowType dw_or_faw; /* 0= send in a DW, 1=send in FAW */
1556 
1557     /*
1558        Sequence of values which further specify the published service beyond
1559        the service name.
1560     */
1561     u16 service_specific_info_len;
1562     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
1563     /*
1564       Set/Enable corresponding bits to disable responses after followUp.
1565       BIT0 - Disable followUp response from FW.
1566     */
1567     u8 recv_indication_cfg;
1568 
1569     /*
1570        Sequence of values indicating the service specific info in SDEA
1571     */
1572     u16 sdea_service_specific_info_len;
1573     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
1574 
1575     /*
1576        Add shared key descriptor attribute to the Followup request when the
1577        flag is set
1578     */
1579     u8 shared_key_desc_flag;
1580 } NanTransmitFollowupRequest;
1581 
1582 /*
1583   Stats Request structure
1584   The Discovery Engine can be queried at runtime by the Host processor for statistics
1585   concerning various parts of the Discovery Engine.
1586 */
1587 typedef struct {
1588     NanStatsType stats_type; /* NAN Statistics Request Type */
1589     u8 clear; /* 0= Do not clear the stats and return the current contents , 1= Clear the associated stats  */
1590 } NanStatsRequest;
1591 
1592 /*
1593   Suspend Request Structure
1594   The SuspendRequest message is used to request that the specified session is suspended.
1595   The session can be resumed using the NanResumeRequest message.
1596 */
1597 typedef struct {
1598     u16 publish_subscribe_id;
1599 } NanSuspendRequest;
1600 
1601 /*
1602   Resume Request Structure
1603   The ResumeRequest message is used to request that the specified session is resumed.
1604 */
1605 typedef struct {
1606     u16 publish_subscribe_id;
1607 } NanResumeRequest;
1608 
1609 /*
1610   Config Structure
1611   The NanConfigurationReq message is sent by the Host to the
1612   Discovery Engine in order to configure the Discovery Engine during runtime.
1613 */
1614 typedef struct {
1615     u8 config_sid_beacon;
1616     u8 sid_beacon;
1617     u8 config_rssi_proximity;
1618     u8 rssi_proximity; // default value -60dBm
1619     u8 config_master_pref;
1620     u8 master_pref; // default value 0x02
1621     /*
1622        1 byte value which defines the RSSI filter threshold.
1623        Any Service Descriptors received above this value
1624        that are configured for RSSI filtering will be dropped.
1625        The rssi values should be specified without sign.
1626        For eg: -70dBm should be specified as 70.
1627     */
1628     u8 config_5g_rssi_close_proximity;
1629     u8 rssi_close_proximity_5g_val;  // default value -60dBm
1630     /*
1631       Optional configuration of Configure request.
1632       Each of the optional parameters have configure flag which
1633       determine whether configuration is to be passed or not.
1634     */
1635     /*
1636        1 byte quantity which defines the window size over
1637        which the “average RSSI” will be calculated over.
1638     */
1639     u8 config_rssi_window_size;
1640     u8 rssi_window_size_val; // default value 0x08
1641     /*
1642        If set to 1, the Discovery Engine will enclose the Cluster
1643        Attribute only sent in Beacons in a Vendor Specific Attribute
1644        and transmit in a Service Descriptor Frame.
1645     */
1646     u8 config_cluster_attribute_val;
1647     /*
1648       The periodicity in seconds between full scan’s to find any new
1649       clusters available in the area.  A Full scan should not be done
1650       more than every 10 seconds and should not be done less than every
1651       30 seconds.
1652     */
1653     u8 config_scan_params;
1654     NanSocialChannelScanParams scan_params_val;
1655     /*
1656        1 byte quantity which forces the Random Factor to a particular
1657        value for all transmitted Sync/Discovery beacons
1658     */
1659     u8 config_random_factor_force;
1660     u8 random_factor_force_val; // default value 0x00
1661     /*
1662        1 byte quantity which forces the HC for all transmitted Sync and
1663        Discovery Beacon NO matter the real HC being received over the
1664        air.
1665     */
1666     u8 config_hop_count_force;
1667     u8 hop_count_force_val; // default value of 0
1668     /* NAN Post Connectivity Capability */
1669     u8 config_conn_capability;
1670     NanTransmitPostConnectivityCapability conn_capability_val;
1671     /* NAN Post Discover Capability */
1672     u8 num_config_discovery_attr;
1673     NanTransmitPostDiscovery discovery_attr_val[NAN_MAX_POSTDISCOVERY_LEN];
1674     /* NAN Further availability Map */
1675     u8 config_fam;
1676     NanFurtherAvailabilityMap fam_val;
1677     /* Configure 2.4/5GHz DW */
1678     NanConfigDW config_dw;
1679     /*
1680        By default discovery MAC address randomization is enabled
1681        and default interval value is 30 minutes i.e. 1800 seconds.
1682        The value 0 is used to disable MAC addr randomization.
1683     */
1684     u8 config_disc_mac_addr_randomization;
1685     u32 disc_mac_addr_rand_interval_sec; // default value of 30 minutes
1686 
1687     /*
1688       Set/Enable corresponding bits to disable Discovery indications:
1689       BIT0 - Disable Discovery MAC Address Event.
1690       BIT1 - Disable Started Cluster Event.
1691       BIT2 - Disable Joined Cluster Event.
1692     */
1693     u8 discovery_indication_cfg; // default value of 0
1694     /*
1695        BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons
1696        0 - Do not include SIDs in any beacons
1697        1 - Include SIDs in all beacons.
1698        Rest 7 bits are count field which allows control over the number of SIDs
1699        included in the Beacon.  0 means to include as many SIDs that fit into
1700        the maximum allow Beacon frame size
1701     */
1702     u8 config_subscribe_sid_beacon;
1703     u32 subscribe_sid_beacon_val; // default value 0x0
1704     /*
1705        Discovery Beacon Interval config.
1706        Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW.
1707        When 0 value is passed it is reset to default value of 128 or 176 msec.
1708     */
1709     u8 config_discovery_beacon_int;
1710     u32 discovery_beacon_interval;
1711     /*
1712        Enable Number of Spatial Streams.
1713        This is NAN Power Optimization feature for NAN discovery.
1714     */
1715     u8 config_nss;
1716     // default value is implementation specific and passing 0 sets it to default
1717     u32 nss;
1718     /*
1719        Enable device level NAN Ranging feature.
1720        0 - Disable
1721        1 - Enable
1722     */
1723     u8 config_enable_ranging;
1724     u32 enable_ranging;
1725     /*
1726        Enable/Disable DW Early termination.
1727        0 - Disable
1728        1 - Enable
1729     */
1730     u8 config_dw_early_termination;
1731     u32 enable_dw_termination;
1732     /*
1733        Indicate whether to use NDPE attribute to bring-up TCP/IP connection
1734        If config_ndpe_attr is not configured, the default behavior is
1735        not using NDPE attr, and the capability is not advertised.
1736        0 - Not use
1737        1 - Use
1738     */
1739     u8 config_ndpe_attr;
1740     u32 use_ndpe_attr;
1741     /*
1742             Enable NAN v3.1 instant communication mode.
1743             0 - Disable
1744             1 - Enable
1745     */
1746     u8 config_enable_instant_mode;
1747     u32 enable_instant_mode;
1748     /*
1749         Config NAN v3.1 instant communication channel selected over NFC/OOB method.
1750         If dual band is supported default channel is 149 or 44 as per regulatory domain,
1751         else channel 6 (send frequency in MHz).
1752         Sometimes depending on country code retrictions, even 149/44 may be restricted
1753         in those cases instant channel will be operational only in 2.4GHz.
1754         Use wifi_get_usable_channels() API to get supported bands/channels before
1755         Instant mode NFC handshake is triggered
1756     */
1757     u8 config_instant_mode_channel;
1758     wifi_channel instant_mode_channel;
1759     /*
1760        Config cluster ID with the cluster ID selected over NFC/OOB method.
1761     */
1762     u8 config_cluster_id;
1763     u16 cluster_id_val; // default value 0x0
1764 } NanConfigRequest;
1765 
1766 /*
1767   TCA Structure
1768   The Discovery Engine can be configured to send up Events whenever a configured
1769   Threshold Crossing Alert (TCA) Type crosses an integral threshold in a particular direction.
1770 */
1771 typedef struct {
1772     NanTcaType tca_type; /* Nan Protocol Threshold Crossing Alert (TCA) Codes */
1773 
1774     /* flag which control whether or not an event is generated for the Rising direction */
1775     u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */
1776 
1777     /* flag which control whether or not an event is generated for the Falling direction */
1778     u8 falling_direction_evt_flag;/* 0 - no event, 1 - event */
1779 
1780     /* flag which requests a previous TCA request to be cleared from the DE */
1781     u8 clear;/*0= Do not clear the TCA, 1=Clear the TCA */
1782 
1783     /* 32 bit value which represents the threshold to be used.*/
1784     u32 threshold;
1785 } NanTCARequest;
1786 
1787 /*
1788   Beacon Sdf Payload Structure
1789   The Discovery Engine can be configured to publish vendor specific attributes as part of
1790   beacon or service discovery frame transmitted as part of this request..
1791 */
1792 typedef struct {
1793     /*
1794        NanVendorAttribute will have the Vendor Specific Attribute which the
1795        vendor wants to publish as part of Discovery or Sync or Service discovery frame
1796     */
1797     NanTransmitVendorSpecificAttribute vsa;
1798 } NanBeaconSdfPayloadRequest;
1799 
1800 /* Publish statistics. */
1801 typedef struct
1802 {
1803     u32 validPublishServiceReqMsgs;
1804     u32 validPublishServiceRspMsgs;
1805     u32 validPublishServiceCancelReqMsgs;
1806     u32 validPublishServiceCancelRspMsgs;
1807     u32 validPublishRepliedIndMsgs;
1808     u32 validPublishTerminatedIndMsgs;
1809     u32 validActiveSubscribes;
1810     u32 validMatches;
1811     u32 validFollowups;
1812     u32 invalidPublishServiceReqMsgs;
1813     u32 invalidPublishServiceCancelReqMsgs;
1814     u32 invalidActiveSubscribes;
1815     u32 invalidMatches;
1816     u32 invalidFollowups;
1817     u32 publishCount;
1818     u32 publishNewMatchCount;
1819     u32 pubsubGlobalNewMatchCount;
1820 } NanPublishStats;
1821 
1822 /* Subscribe statistics. */
1823 typedef struct
1824 {
1825     u32 validSubscribeServiceReqMsgs;
1826     u32 validSubscribeServiceRspMsgs;
1827     u32 validSubscribeServiceCancelReqMsgs;
1828     u32 validSubscribeServiceCancelRspMsgs;
1829     u32 validSubscribeTerminatedIndMsgs;
1830     u32 validSubscribeMatchIndMsgs;
1831     u32 validSubscribeUnmatchIndMsgs;
1832     u32 validSolicitedPublishes;
1833     u32 validMatches;
1834     u32 validFollowups;
1835     u32 invalidSubscribeServiceReqMsgs;
1836     u32 invalidSubscribeServiceCancelReqMsgs;
1837     u32 invalidSubscribeFollowupReqMsgs;
1838     u32 invalidSolicitedPublishes;
1839     u32 invalidMatches;
1840     u32 invalidFollowups;
1841     u32 subscribeCount;
1842     u32 bloomFilterIndex;
1843     u32 subscribeNewMatchCount;
1844     u32 pubsubGlobalNewMatchCount;
1845 } NanSubscribeStats;
1846 
1847 /* NAN DW Statistics*/
1848 typedef struct
1849 {
1850     /* RX stats */
1851     u32 validFrames;
1852     u32 validActionFrames;
1853     u32 validBeaconFrames;
1854     u32 ignoredActionFrames;
1855     u32 ignoredBeaconFrames;
1856     u32 invalidFrames;
1857     u32 invalidActionFrames;
1858     u32 invalidBeaconFrames;
1859     u32 invalidMacHeaders;
1860     u32 invalidPafHeaders;
1861     u32 nonNanBeaconFrames;
1862 
1863     u32 earlyActionFrames;
1864     u32 inDwActionFrames;
1865     u32 lateActionFrames;
1866 
1867     /* TX stats */
1868     u32 framesQueued;
1869     u32 totalTRSpUpdates;
1870     u32 completeByTRSp;
1871     u32 completeByTp75DW;
1872     u32 completeByTendDW;
1873     u32 lateActionFramesTx;
1874 } NanDWStats;
1875 
1876 /* NAN MAC Statistics. */
1877 typedef struct
1878 {
1879     /* RX stats */
1880     u32 validFrames;
1881     u32 validActionFrames;
1882     u32 validBeaconFrames;
1883     u32 ignoredActionFrames;
1884     u32 ignoredBeaconFrames;
1885     u32 invalidFrames;
1886     u32 invalidActionFrames;
1887     u32 invalidBeaconFrames;
1888     u32 invalidMacHeaders;
1889     u32 invalidPafHeaders;
1890     u32 nonNanBeaconFrames;
1891 
1892     u32 earlyActionFrames;
1893     u32 inDwActionFrames;
1894     u32 lateActionFrames;
1895 
1896     /* TX stats */
1897     u32 framesQueued;
1898     u32 totalTRSpUpdates;
1899     u32 completeByTRSp;
1900     u32 completeByTp75DW;
1901     u32 completeByTendDW;
1902     u32 lateActionFramesTx;
1903 
1904     u32 twIncreases;
1905     u32 twDecreases;
1906     u32 twChanges;
1907     u32 twHighwater;
1908     u32 bloomFilterIndex;
1909 } NanMacStats;
1910 
1911 /* NAN Sync Statistics*/
1912 typedef struct
1913 {
1914     u64 currTsf;
1915     u64 myRank;
1916     u64 currAmRank;
1917     u64 lastAmRank;
1918     u32 currAmBTT;
1919     u32 lastAmBTT;
1920     u8  currAmHopCount;
1921     u8  currRole;
1922     u16 currClusterId;
1923 
1924     u64 timeSpentInCurrRole;
1925     u64 totalTimeSpentAsMaster;
1926     u64 totalTimeSpentAsNonMasterSync;
1927     u64 totalTimeSpentAsNonMasterNonSync;
1928     u32 transitionsToAnchorMaster;
1929     u32 transitionsToMaster;
1930     u32 transitionsToNonMasterSync;
1931     u32 transitionsToNonMasterNonSync;
1932     u32 amrUpdateCount;
1933     u32 amrUpdateRankChangedCount;
1934     u32 amrUpdateBTTChangedCount;
1935     u32 amrUpdateHcChangedCount;
1936     u32 amrUpdateNewDeviceCount;
1937     u32 amrExpireCount;
1938     u32 mergeCount;
1939     u32 beaconsAboveHcLimit;
1940     u32 beaconsBelowRssiThresh;
1941     u32 beaconsIgnoredNoSpace;
1942     u32 beaconsForOurCluster;
1943     u32 beaconsForOtherCluster;
1944     u32 beaconCancelRequests;
1945     u32 beaconCancelFailures;
1946     u32 beaconUpdateRequests;
1947     u32 beaconUpdateFailures;
1948     u32 syncBeaconTxAttempts;
1949     u32 syncBeaconTxFailures;
1950     u32 discBeaconTxAttempts;
1951     u32 discBeaconTxFailures;
1952     u32 amHopCountExpireCount;
1953     u32 ndpChannelFreq;
1954     u32 ndpChannelFreq2;
1955     u32 schedUpdateChannelFreq;
1956 } NanSyncStats;
1957 
1958 /* NAN Misc DE Statistics */
1959 typedef struct
1960 {
1961     u32 validErrorRspMsgs;
1962     u32 validTransmitFollowupReqMsgs;
1963     u32 validTransmitFollowupRspMsgs;
1964     u32 validFollowupIndMsgs;
1965     u32 validConfigurationReqMsgs;
1966     u32 validConfigurationRspMsgs;
1967     u32 validStatsReqMsgs;
1968     u32 validStatsRspMsgs;
1969     u32 validEnableReqMsgs;
1970     u32 validEnableRspMsgs;
1971     u32 validDisableReqMsgs;
1972     u32 validDisableRspMsgs;
1973     u32 validDisableIndMsgs;
1974     u32 validEventIndMsgs;
1975     u32 validTcaReqMsgs;
1976     u32 validTcaRspMsgs;
1977     u32 validTcaIndMsgs;
1978     u32 invalidTransmitFollowupReqMsgs;
1979     u32 invalidConfigurationReqMsgs;
1980     u32 invalidStatsReqMsgs;
1981     u32 invalidEnableReqMsgs;
1982     u32 invalidDisableReqMsgs;
1983     u32 invalidTcaReqMsgs;
1984 } NanDeStats;
1985 
1986 /* Publish Response Message structure */
1987 typedef struct {
1988     u16 publish_id;
1989 } NanPublishResponse;
1990 
1991 /* Subscribe Response Message structure */
1992 typedef struct {
1993     u16 subscribe_id;
1994 } NanSubscribeResponse;
1995 
1996 /*
1997   Stats Response Message structure
1998   The Discovery Engine response to a request by the Host for statistics.
1999 */
2000 typedef struct {
2001     NanStatsType stats_type;
2002     union {
2003         NanPublishStats publish_stats;
2004         NanSubscribeStats subscribe_stats;
2005         NanMacStats mac_stats;
2006         NanSyncStats sync_stats;
2007         NanDeStats de_stats;
2008         NanDWStats dw_stats;
2009     } data;
2010 } NanStatsResponse;
2011 
2012 /* Response returned for Initiators Data request */
2013 typedef struct {
2014     /*
2015       Unique token Id generated on the initiator
2016       side used for a NDP session between two NAN devices
2017     */
2018     NanDataPathId ndp_instance_id;
2019 } NanDataPathRequestResponse;
2020 
2021 /* Response returned for Initiators pairing request */
2022 typedef struct {
2023     /*
2024       Unique token Id generated on the initiator
2025       side used for a pairing session between two NAN devices
2026     */
2027     u32 paring_instance_id;
2028 } NanPairingRequestResponse;
2029 
2030 /* Response returned for Initiators bootstrapping request */
2031 typedef struct {
2032     /*
2033       Unique token Id generated on the initiator
2034       side used for a bootstrapping session between two NAN devices
2035     */
2036     u32 bootstrapping_instance_id;
2037 } NanBootstrappingRequestResponse;
2038 
2039 /*
2040   NAN Response messages
2041 */
2042 typedef struct {
2043     NanStatusType status; /* contains the result code */
2044     char nan_error[NAN_ERROR_STR_LEN]; /* Describe the NAN error type */
2045     NanResponseType response_type; /* NanResponseType Definitions */
2046     union {
2047         NanPublishResponse publish_response;
2048         NanSubscribeResponse subscribe_response;
2049         NanStatsResponse stats_response;
2050         NanDataPathRequestResponse data_request_response;
2051         NanCapabilities nan_capabilities;
2052         NanPairingRequestResponse pairing_request_response;
2053         NanBootstrappingRequestResponse bootstrapping_request_response;
2054     } body;
2055 } NanResponseMsg;
2056 
2057 /*
2058   Publish Replied Indication
2059   The PublishRepliedInd Message is sent by the DE when an Active Subscribe is
2060   received over the air and it matches a Solicited PublishServiceReq which had
2061   been created with the replied_event_flag set.
2062 */
2063 typedef struct {
2064     /*
2065        A 32 bit Requestor Instance Id which is sent to the Application.
2066        This Id will be sent in any subsequent UnmatchInd/FollowupInd
2067        messages
2068     */
2069     u32 requestor_instance_id;
2070     u8 addr[NAN_MAC_ADDR_LEN];
2071     /*
2072        If RSSI filtering was configured in NanPublishRequest then this
2073        field will contain the received RSSI value. 0 if not
2074     */
2075     u8 rssi_value;
2076 } NanPublishRepliedInd;
2077 
2078 /*
2079   Publish Terminated
2080   The PublishTerminatedInd message is sent by the DE whenever a Publish
2081   terminates from a user-specified timeout or a unrecoverable error in the DE.
2082 */
2083 typedef struct {
2084     /* Id returned during the initial Publish */
2085     u16 publish_id;
2086     /*
2087       For all user configured termination NAN_STATUS_SUCCESS
2088       and no other reasons expected from firmware.
2089     */
2090     NanStatusType reason;
2091     char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
2092 } NanPublishTerminatedInd;
2093 
2094 /* The NIRA used to identify the pairing devices*/
2095 typedef struct {
2096     u8 nonce[NAN_IDENTITY_NONCE_LEN];
2097     u8 tag[NAN_IDENTITY_TAG_LEN];
2098 } NanIdentityResolutionAttribute;
2099 
2100 /*
2101   Match Indication
2102   The MatchInd message is sent once per responding MAC address whenever
2103   the Discovery Engine detects a match for a previous SubscribeServiceReq
2104   or PublishServiceReq.
2105 */
2106 typedef struct {
2107     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
2108     u16 publish_subscribe_id;
2109     /*
2110        A 32 bit Requestor Instance Id which is sent to the Application.
2111        This Id will be sent in any subsequent UnmatchInd/FollowupInd
2112        messages
2113     */
2114     u32 requestor_instance_id;
2115     u8 addr[NAN_MAC_ADDR_LEN];
2116 
2117     /*
2118        Sequence of octets which were received in a Discovery Frame matching the
2119        Subscribe Request.
2120     */
2121     u16 service_specific_info_len;
2122     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
2123 
2124     /*
2125        Ordered sequence of <length, value> pairs received in the Discovery Frame
2126        matching the Subscribe Request.
2127     */
2128     u16 sdf_match_filter_len;
2129     u8 sdf_match_filter[NAN_MAX_MATCH_FILTER_LEN];
2130 
2131     /*
2132        flag to indicate if the Match occurred in a Beacon Frame or in a
2133        Service Discovery Frame.
2134          0 - Match occured in a Service Discovery Frame
2135          1 - Match occured in a Beacon Frame
2136     */
2137     u8 match_occured_flag;
2138 
2139     /*
2140        flag to indicate FW is out of resource and that it can no longer
2141        track this Service Name. The Host still need to send the received
2142        Match_Handle but duplicate MatchInd messages may be received on
2143        this Handle until the resource frees up.
2144          0 - FW is caching this match
2145          1 - FW is unable to cache this match
2146     */
2147     u8 out_of_resource_flag;
2148 
2149     /*
2150        If RSSI filtering was configured in NanSubscribeRequest then this
2151        field will contain the received RSSI value. 0 if not.
2152        All rssi values should be specified without sign.
2153        For eg: -70dBm should be specified as 70.
2154     */
2155     u8 rssi_value;
2156 
2157     /*
2158        optional attributes. Each optional attribute is associated with a flag
2159        which specifies whether the attribute is valid or not
2160     */
2161     /* NAN Post Connectivity Capability received */
2162     u8 is_conn_capability_valid;
2163     NanReceivePostConnectivityCapability conn_capability;
2164 
2165     /* NAN Post Discover Capability */
2166     u8 num_rx_discovery_attr;
2167     NanReceivePostDiscovery discovery_attr[NAN_MAX_POSTDISCOVERY_LEN];
2168 
2169     /* NAN Further availability Map */
2170     u8 num_chans;
2171     NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS];
2172 
2173     /* NAN Cluster Attribute */
2174     u8 cluster_attribute_len;
2175     u8 cluster_attribute[NAN_MAX_CLUSTER_ATTRIBUTE_LEN];
2176 
2177     /* NAN Cipher Suite */
2178     u32 peer_cipher_type;
2179 
2180     /* Security Context Identifiers length */
2181     u32 scid_len;
2182     /*
2183        Security Context Identifier attribute contains PMKID
2184        shall be included in NDP setup and response messages.
2185        Security Context Identifier, Identifies the Security
2186        Context. For NAN Shared Key Cipher Suite, this field
2187        contains the 16 octet PMKID identifying the PMK used
2188        for setting up the Secure Data Path.
2189     */
2190     u8 scid[NAN_MAX_SCID_BUF_LEN];
2191 
2192     /* Peer service discovery extended attributes */
2193     NanSdeaCtrlParams peer_sdea_params;
2194 
2195     /*
2196       Ranging indication and NanMatchAlg are not tied.
2197       Ex: NanMatchAlg can indicate Match_ONCE, but ranging
2198       indications can be continuous. All ranging indications
2199       depend on SDEA control parameters of ranging required for
2200       continuous, and ingress/egress values in the ranging config.
2201       Ranging indication data is notified if:
2202       1) Ranging required is enabled in SDEA.
2203          range info notified continuous.
2204       2) if range_limit ingress/egress MASKS are enabled
2205          notify once for ingress >= ingress_distance
2206          and egress <= egress_distance, same for ingress_egress_both
2207       3) if the Awake DW intervals are higher than the ranging intervals,
2208          priority is given to the device DW intervalsi.
2209     */
2210     /*
2211       Range Info includes:
2212       1) distance to the NAN device with the MAC address indicated
2213          with ranged mac address.
2214       2) Ranging event matching the configuration of continuous/ingress/egress.
2215     */
2216     NanRangeInfo range_info;
2217 
2218     /*
2219        Sequence of values indicating the service specific info in SDEA
2220     */
2221     u16 sdea_service_specific_info_len;
2222     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
2223 
2224     /*
2225       The config for Nan pairing set by the peer
2226     */
2227     NanPairingConfig peer_pairing_config;
2228 
2229     /*
2230       The NIRA from peer for Nan pairing verification
2231     */
2232     NanIdentityResolutionAttribute nira;
2233 } NanMatchInd;
2234 
2235 /*
2236   MatchExpired Indication
2237   The MatchExpiredInd message is sent whenever the Discovery Engine detects that
2238   a previously Matched Service has been gone for too long. If the previous
2239   MatchInd message for this Publish/Subscribe Id had the out_of_resource_flag
2240   set then this message will not be received
2241 */
2242 typedef struct {
2243     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
2244     u16 publish_subscribe_id;
2245     /*
2246        32 bit value sent by the DE in a previous
2247        MatchInd/FollowupInd to the application.
2248     */
2249     u32 requestor_instance_id;
2250 } NanMatchExpiredInd;
2251 
2252 /*
2253   Subscribe Terminated
2254   The SubscribeTerminatedInd message is sent by the DE whenever a
2255   Subscribe terminates from a user-specified timeout or a unrecoverable error in the DE.
2256 */
2257 typedef struct {
2258     /* Id returned during initial Subscribe */
2259     u16 subscribe_id;
2260     /*
2261       For all user configured termination NAN_STATUS_SUCCESS
2262       and no other reasons expected from firmware.
2263     */
2264     NanStatusType reason;
2265     char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
2266 } NanSubscribeTerminatedInd;
2267 
2268 /*
2269   Followup Indication Message
2270   The FollowupInd message is sent by the DE to the Host whenever it receives a
2271   Followup message from another peer.
2272 */
2273 typedef struct {
2274     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
2275     u16 publish_subscribe_id;
2276     /*
2277        A 32 bit Requestor instance Id which is sent to the Application.
2278        This Id will be used in subsequent UnmatchInd/FollowupInd messages.
2279     */
2280     u32 requestor_instance_id;
2281     u8 addr[NAN_MAC_ADDR_LEN];
2282 
2283     /* Flag which the DE uses to decide if received in a DW or a FAW*/
2284     u8 dw_or_faw; /* 0=Received  in a DW, 1 = Received in a FAW*/
2285 
2286     /*
2287        Sequence of values which further specify the published service beyond
2288        the service name
2289     */
2290     u16 service_specific_info_len;
2291     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
2292 
2293     /*
2294        Sequence of values indicating the service specific info in SDEA
2295     */
2296     u16 sdea_service_specific_info_len;
2297     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
2298 } NanFollowupInd;
2299 
2300 /*
2301    Event data notifying the Mac address of the Discovery engine.
2302    which is reported as one of the Discovery engine event
2303 */
2304 typedef struct {
2305     u8 addr[NAN_MAC_ADDR_LEN];
2306 } NanMacAddressEvent;
2307 
2308 /*
2309    Event data notifying the Cluster address of the cluster
2310    which is reported as one of the Discovery engine event
2311 */
2312 typedef struct {
2313     u8 addr[NAN_MAC_ADDR_LEN];
2314 } NanClusterEvent;
2315 
2316 /*
2317   Discovery Engine Event Indication
2318   The Discovery Engine can inform the Host when significant events occur
2319   The data following the EventId is dependent upon the EventId type.
2320   In other words, each new event defined will carry a different
2321   structure of information back to the host.
2322 */
2323 typedef struct {
2324     NanDiscEngEventType event_type; /* NAN Protocol Event Codes */
2325     union {
2326         /*
2327            MacAddressEvent which will have 6 byte mac address
2328            of the Discovery engine.
2329         */
2330         NanMacAddressEvent mac_addr;
2331         /*
2332            Cluster Event Data which will be obtained when the
2333            device starts a new cluster or joins a cluster.
2334            The event data will have 6 byte octet string of the
2335            cluster started or joined.
2336         */
2337         NanClusterEvent cluster;
2338     } data;
2339 } NanDiscEngEventInd;
2340 
2341 /* Cluster size TCA event*/
2342 typedef struct {
2343     /* size of the cluster*/
2344     u32 cluster_size;
2345 } NanTcaClusterEvent;
2346 
2347 /*
2348   NAN TCA Indication
2349   The Discovery Engine can inform the Host when significant events occur.
2350   The data following the TcaId is dependent upon the TcaId type.
2351   In other words, each new event defined will carry a different structure
2352   of information back to the host.
2353 */
2354 typedef struct {
2355     NanTcaType tca_type;
2356     /* flag which defines if the configured Threshold has risen above the threshold */
2357     u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */
2358 
2359     /* flag which defines if the configured Threshold has fallen below the threshold */
2360     u8 falling_direction_evt_flag;/* 0 - no event, 1 - event */
2361     union {
2362         /*
2363            This event in obtained when the cluser size threshold
2364            is crossed. Event will have the cluster size
2365         */
2366         NanTcaClusterEvent cluster;
2367     } data;
2368 } NanTCAInd;
2369 
2370 /*
2371   NAN Disabled Indication
2372   The NanDisableInd message indicates to the upper layers that the Discovery
2373   Engine has flushed all state and has been shutdown.  When this message is received
2374   the DE is guaranteed to have left the NAN cluster it was part of and will have terminated
2375   any in progress Publishes or Subscribes.
2376 */
2377 typedef struct {
2378     /*
2379       Following reasons expected:
2380       NAN_STATUS_SUCCESS
2381       NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED
2382     */
2383     NanStatusType reason;
2384     char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
2385 } NanDisabledInd;
2386 
2387 /*
2388   NAN Beacon or SDF Payload Indication
2389   The NanBeaconSdfPayloadInd message indicates to the upper layers that information
2390   elements were received either in a Beacon or SDF which needs to be delivered
2391   outside of a Publish/Subscribe Handle.
2392 */
2393 typedef struct {
2394     /* The MAC address of the peer which sent the attributes.*/
2395     u8 addr[NAN_MAC_ADDR_LEN];
2396     /*
2397        Optional attributes. Each optional attribute is associated with a flag
2398        which specifies whether the attribute is valid or not
2399     */
2400     /* NAN Receive Vendor Specific Attribute*/
2401     u8 is_vsa_received;
2402     NanReceiveVendorSpecificAttribute vsa;
2403 
2404     /* NAN Beacon or SDF Payload Received*/
2405     u8 is_beacon_sdf_payload_received;
2406     NanBeaconSdfPayloadReceive data;
2407 } NanBeaconSdfPayloadInd;
2408 
2409 /*
2410   Event Indication notifying the
2411   transmit followup in progress
2412 */
2413 typedef struct {
2414    transaction_id id;
2415    /*
2416      Following reason codes returned:
2417      NAN_STATUS_SUCCESS
2418      NAN_STATUS_NO_OTA_ACK
2419      NAN_STATUS_PROTOCOL_FAILURE
2420    */
2421    NanStatusType reason;
2422    char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
2423 } NanTransmitFollowupInd;
2424 
2425 /*
2426   Data request Initiator/Responder
2427   app/service related info
2428 */
2429 typedef struct {
2430     u16 ndp_app_info_len;
2431     u8 ndp_app_info[NAN_DP_MAX_APP_INFO_LEN];
2432 } NanDataPathAppInfo;
2433 
2434 /* QoS configuration */
2435 typedef enum {
2436     NAN_DP_CONFIG_NO_QOS = 0,
2437     NAN_DP_CONFIG_QOS
2438 } NanDataPathQosCfg;
2439 
2440 /* Configuration params of Data request Initiator/Responder */
2441 typedef struct {
2442     /* Status Indicating Security/No Security */
2443     NanDataPathSecurityCfgStatus security_cfg;
2444     NanDataPathQosCfg qos_cfg;
2445 } NanDataPathCfg;
2446 
2447 /* Nan Data Path Initiator requesting a data session */
2448 typedef struct {
2449     /*
2450      Unique Instance Id identifying the Responder's service.
2451      This is same as publish_id notified on the subscribe side
2452      in a publish/subscribe scenario
2453     */
2454     u32 requestor_instance_id; /* Value 0 for no publish/subscribe */
2455 
2456     /* Config flag for channel request */
2457     NanDataPathChannelCfg channel_request_type;
2458     /* Channel frequency in MHz to start data-path */
2459     wifi_channel channel;
2460     /*
2461       Discovery MAC addr of the publisher/peer
2462     */
2463     u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
2464     /*
2465      Interface name on which this NDP session is to be started.
2466      This will be the same interface name provided during interface
2467      create.
2468     */
2469     char ndp_iface[IFNAMSIZ+1];
2470     /* Initiator/Responder Security/QoS configuration */
2471     NanDataPathCfg ndp_cfg;
2472     /* App/Service information of the Initiator */
2473     NanDataPathAppInfo app_info;
2474     /* NAN Cipher Suite Type */
2475     u32 cipher_type;
2476     /*
2477        Nan Security Key Info is optional in Discovery phase.
2478        PMK or passphrase info can be passed during
2479        the NDP session.
2480     */
2481     NanSecurityKeyInfo key_info;
2482     /* length of service name */
2483     u32 service_name_len;
2484     /*
2485        UTF-8 encoded string identifying the service name.
2486        The service name field is only used if a Nan discovery
2487        is not associated with the NDP (out-of-band discovery).
2488     */
2489     u8 service_name[NAN_MAX_SERVICE_NAME_LEN];
2490 
2491     /* Security Context Identifiers length */
2492     u32 scid_len;
2493     /*
2494        Security Context Identifier attribute contains PMKID
2495        shall be included in NDP setup and response messages.
2496        Security Context Identifier, Identifies the Security
2497        Context. For NAN Shared Key Cipher Suite, this field
2498        contains the 16 octet PMKID identifying the PMK used
2499        for setting up the Secure Data Path.
2500     */
2501     u8 scid[NAN_MAX_SCID_BUF_LEN];
2502 
2503     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
2504     u16 publish_subscribe_id;
2505 
2506     /* configure CSIA (Cipher Suite Information attribute) capability to specify GTK, IGTK, BIGTK
2507        are supported or not
2508     */
2509     u8 csia_capabilities;
2510 
2511     /* configure GTK(Group Transient Key) protection required or not */
2512     u8 gtk_protection;
2513 
2514 } NanDataPathInitiatorRequest;
2515 
2516 /*
2517   Data struct to initiate a data response on the responder side
2518   for an indication received with a data request
2519 */
2520 typedef struct {
2521     /*
2522       Unique token Id generated on the initiator/responder
2523       side used for a NDP session between two NAN devices
2524     */
2525     NanDataPathId ndp_instance_id;
2526     /*
2527      Interface name on which this NDP session is to be started.
2528      This will be the same interface name provided during interface
2529      create.
2530     */
2531     char ndp_iface[IFNAMSIZ+1];
2532     /* Initiator/Responder Security/QoS configuration */
2533     NanDataPathCfg ndp_cfg;
2534     /* App/Service information of the responder */
2535     NanDataPathAppInfo app_info;
2536     /* Response Code indicating ACCEPT/REJECT/DEFER */
2537     NanDataPathResponseCode rsp_code;
2538     /* NAN Cipher Suite Type */
2539     u32 cipher_type;
2540     /*
2541        Nan Security Key Info is optional in Discovery phase.
2542        PMK or passphrase info can be passed during
2543        the NDP session.
2544     */
2545     NanSecurityKeyInfo key_info;
2546     /* length of service name */
2547     u32 service_name_len;
2548     /*
2549        UTF-8 encoded string identifying the service name.
2550        The service name field is only used if a Nan discovery
2551        is not associated with the NDP (out-of-band discovery).
2552     */
2553     u8 service_name[NAN_MAX_SERVICE_NAME_LEN];
2554 
2555     /* Security Context Identifiers length */
2556     u32 scid_len;
2557     /*
2558        Security Context Identifier attribute contains PMKID
2559        shall be included in NDP setup and response messages.
2560        Security Context Identifier, Identifies the Security
2561        Context. For NAN Shared Key Cipher Suite, this field
2562        contains the 16 octet PMKID identifying the PMK used
2563        for setting up the Secure Data Path.
2564     */
2565     u8 scid[NAN_MAX_SCID_BUF_LEN];
2566 
2567     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
2568     u16 publish_subscribe_id;
2569 
2570     /*
2571       Discovery MAC addr of the publisher/peer
2572     */
2573     u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
2574 
2575     /* configure CSIA (Cipher Suite Information attribute) capability to specify GTK, IGTK, BIGTK
2576        are supported or not
2577     */
2578     u8 csia_capabilities;
2579 
2580     /* configure GTK(Group Transient Key) protection required or not */
2581     u8 gtk_protection;
2582 } NanDataPathIndicationResponse;
2583 
2584 /* Sub slot parameters */
2585 typedef struct {
2586     u8 entry_control;
2587     u16 time_bitmap_control;
2588     u32 time_bitmap;
2589 } NanS3Params;
2590 
2591 /* NDP termination info */
2592 typedef struct {
2593     u8 num_ndp_instances;
2594     /*
2595       Unique token Id generated on the initiator/responder side
2596       used for a NDP session between two NAN devices
2597     */
2598     NanDataPathId ndp_instance_id[];
2599 } NanDataPathEndRequest;
2600 
2601 /*
2602   Event indication received on the
2603   responder side when a Nan Data request or
2604   NDP session is initiated on the Initiator side
2605 */
2606 typedef struct {
2607     /*
2608       Unique Instance Id corresponding to a service/session.
2609       This is similar to the publish_id generated on the
2610       publisher side
2611     */
2612     u16 service_instance_id;
2613     /* Discovery MAC addr of the peer/initiator */
2614     u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
2615     /*
2616       Unique token Id generated on the initiator/responder side
2617       used for a NDP session between two NAN devices
2618     */
2619     NanDataPathId ndp_instance_id;
2620     /* Initiator/Responder Security/QoS configuration */
2621     NanDataPathCfg ndp_cfg;
2622     /* App/Service information of the initiator */
2623     NanDataPathAppInfo app_info;
2624 
2625     /* Security Context Identifiers length */
2626     u32 scid_len;
2627     /*
2628        Security Context Identifier attribute contains PMKID
2629        shall be included in NDP setup and response messages.
2630        Security Context Identifier, Identifies the Security
2631        Context. For NAN Shared Key Cipher Suite, this field
2632        contains the 16 octet PMKID identifying the PMK used
2633        for setting up the Secure Data Path.
2634     */
2635     u8 scid[NAN_MAX_SCID_BUF_LEN];
2636 
2637     /* configure CSIA (Cipher Suite Information attribute) capability to specify GTK, IGTK, BIGTK
2638        are supported or not
2639     */
2640     u8 csia_capabilities;
2641 
2642     /* configure GTK(Group Transient Key) protection required or not */
2643     u8 gtk_protection;
2644 } NanDataPathRequestInd;
2645 
2646 /*
2647  Event indication of data confirm is received on both
2648  initiator and responder side confirming a NDP session
2649 */
2650 typedef struct {
2651     /*
2652       Unique token Id generated on the initiator/responder side
2653       used for a NDP session between two NAN devices
2654     */
2655     NanDataPathId ndp_instance_id;
2656     /*
2657       NDI mac address of the peer
2658       (required to derive target ipv6 address)
2659     */
2660     u8 peer_ndi_mac_addr[NAN_MAC_ADDR_LEN];
2661     /* App/Service information of Initiator/Responder */
2662     NanDataPathAppInfo app_info;
2663     /* Response code indicating ACCEPT/REJECT/DEFER */
2664     NanDataPathResponseCode rsp_code;
2665     /*
2666       Reason code indicating the cause for REJECT.
2667       NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are
2668       expected reason codes.
2669     */
2670     NanStatusType reason_code;
2671     /* Number of channels for which info is indicated */
2672     u32 num_channels;
2673     /*
2674       Data indicating the Channel list and BW of the channel.
2675     */
2676     NanChannelInfo channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED];
2677 } NanDataPathConfirmInd;
2678 
2679 /*
2680  Event indication of schedule update is received on both
2681  initiator and responder when a schedule change occurs
2682 */
2683 typedef struct {
2684     /*
2685       NMI mac address
2686     */
2687     u8 peer_mac_addr[NAN_MAC_ADDR_LEN];
2688     /*
2689       Reason code indicating the cause of schedule update.
2690       BIT_0 NSS Update
2691       BIT_1 Channel list update
2692     */
2693     u32 schedule_update_reason_code;
2694     /* Number of channels for which info is indicated */
2695     u32 num_channels;
2696     /*
2697       Data indicating the Channel list and BW of the channel.
2698     */
2699     NanChannelInfo channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED];
2700     /* Number of NDP instance Ids */
2701     u8 num_ndp_instances;
2702     /*
2703       Unique token Id generated on the initiator/responder side
2704       used for a NDP session between two NAN devices
2705     */
2706     NanDataPathId ndp_instance_id[];
2707 } NanDataPathScheduleUpdateInd;
2708 
2709 /*
2710   Event indication received on the
2711   initiator/responder side terminating
2712   a NDP session
2713 */
2714 typedef struct {
2715     u8 num_ndp_instances;
2716     /*
2717       Unique token Id generated on the initiator/responder side
2718       used for a NDP session between two NAN devices
2719     */
2720     NanDataPathId ndp_instance_id[];
2721 } NanDataPathEndInd;
2722 
2723 /*
2724   Event indicating Range Request received on the
2725   Published side.
2726 */
2727 typedef struct {
2728     u16 publish_id;/* id is existing publish */
2729     /* Range Requestor's MAC address */
2730     u8 range_req_intf_addr[NAN_MAC_ADDR_LEN];
2731 } NanRangeRequestInd;
2732 
2733 /*
2734   Event indicating Range report on the
2735   Published side.
2736 */
2737 typedef struct {
2738     u16 publish_id;/* id is existing publish */
2739     /* Range Requestor's MAC address */
2740     u8 range_req_intf_addr[NAN_MAC_ADDR_LEN];
2741     /*
2742        Distance to the NAN device with the MAC address indicated
2743        with ranged mac address.
2744     */
2745     u32 range_measurement_mm;
2746 } NanRangeReportInd;
2747 
2748 /*
2749   NAN pairing initator request
2750 */
2751 typedef struct {
2752     /*
2753        This Id is the Requestor Instance that is passed as
2754        part of earlier MatchInd/FollowupInd message.
2755     */
2756     u32 requestor_instance_id;
2757 
2758     /*
2759       Discovery MAC addr of the publisher/peer
2760     */
2761     u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
2762 
2763     /*
2764       Indicate the pairing session is of setup or verification
2765     */
2766     NanPairingRequestType nan_pairing_request_type;
2767 
2768     /*
2769       whether the pairing is opportunistic or password
2770     */
2771     u8 is_opportunistic;
2772 
2773     /*
2774       Security key info used for the pairing setup or verification
2775     */
2776     NanSecurityKeyInfo key_info;
2777     /*
2778       AKM used for the pairing verification
2779     */
2780     NanAkm akm;
2781 
2782     /*
2783       Whether should cache the negotiated NIK/NPK for future verification
2784     */
2785     u8 enable_pairing_cache;
2786 
2787     /*
2788       The Identity key for pairing, can be used for pairing verification
2789     */
2790     u8 nan_identity_key[NAN_IDENTITY_KEY_LEN];
2791 
2792     /*
2793       NAN Cipher Suite Type
2794     */
2795     u32 cipher_type;
2796 
2797 } NanPairingRequest;
2798 
2799 /*
2800   Data struct to initiate a pairing response on the responder side for an indication received with a
2801   pairing request
2802 */
2803 typedef struct {
2804 
2805     /*
2806       Unique token Id generated on the initiator/responder side
2807       used for a pairing session between two NAN devices
2808     */
2809     u32 pairing_instance_id;
2810 
2811     /*
2812       Indicate the pairing session is setup or verification
2813     */
2814     NanPairingRequestType nan_pairing_request_type;
2815 
2816     /* Response Code indicating ACCEPT/REJECT */
2817     NanPairingResponseCode rsp_code;
2818 
2819     /*
2820       whether the pairing is opportunistic or password
2821     */
2822     u8 is_opportunistic;
2823 
2824     /*
2825       Security key info used for the pairing setup or verification
2826     */
2827     NanSecurityKeyInfo key_info;
2828 
2829     /*
2830       AKM used for the pairing verification
2831     */
2832     NanAkm akm;
2833 
2834     /*
2835       Whether should cache the negotiated NIK/NPK for future verification
2836     */
2837     u8 enable_pairing_cache;
2838 
2839     /*
2840       The Identity key for pairing, can be used for pairing verification
2841     */
2842     u8 nan_identity_key[NAN_IDENTITY_KEY_LEN];
2843 
2844     /*
2845       NAN Cipher Suite Type
2846     */
2847     u32 cipher_type;
2848 } NanPairingIndicationResponse;
2849 
2850 typedef struct {
2851     /*
2852       Unique token Id generated on the initiator/responder side
2853       used for a pairing session between two NAN devices
2854     */
2855     u32 pairing_instance_id;
2856 } NanPairingEndRequest;
2857 
2858 /*
2859   Event indication received on the responder side when a Nan pairing session is initiated on the
2860   Initiator side
2861 */
2862 typedef struct {
2863     /* Publish instance id generated on Publisher side corresponding to a session */
2864     u16 publish_subscribe_id;
2865     /*
2866       This Id is the Requestor Instance that is passed as
2867       part of earlier MatchInd/FollowupInd message.
2868     */
2869     u32 requestor_instance_id;
2870     /*
2871       Unique Instance Id corresponding to a service/session.
2872       This is similar to the publish_id generated on the
2873       publisher side
2874     */
2875     u32 pairing_instance_id;
2876     /* Discovery MAC addr of the peer/initiator */
2877     u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
2878     /* Indicate the pairing session is setup or verification */
2879     NanPairingRequestType nan_pairing_request_type;
2880     /* Whether should cache the negotiated NIK/NPK for future verification */
2881     u8 enable_pairing_cache;
2882     /* The NIRA from peer for Nan pairing verification */
2883     NanIdentityResolutionAttribute nira;
2884 } NanPairingRequestInd;
2885 
2886 /*
2887   The security info negotiate after the pairing setup for caching
2888 */
2889 typedef struct {
2890     /* The inentity key of peer device*/
2891     u8 peer_nan_identity_key[NAN_IDENTITY_KEY_LEN];
2892     /* The inentity key of local device*/
2893     u8 local_nan_identity_key[NAN_IDENTITY_KEY_LEN];
2894     /* The PMK excahnge between two devices*/
2895     NanSecurityPmk npk;
2896     /* The AKM used during the key exchange*/
2897     NanAkm akm;
2898     /* NAN Cipher Suite Type */
2899     u32 cipher_type;
2900 } NpkSecurityAssociation;
2901 
2902 /*
2903  Event indication of pairing confirm is received on both
2904  initiator and responder side confirming a pairing session
2905 */
2906 typedef struct {
2907     /*
2908       Unique token Id generated on the initiator/responder side
2909       used for a pairing session between two NAN devices
2910     */
2911     u32 pairing_instance_id;
2912     /* Response code indicating ACCEPT/REJECT */
2913     NanPairingResponseCode rsp_code;
2914     /*
2915       Reason code indicating the cause for REJECT.
2916       NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are
2917       expected reason codes.
2918     */
2919     NanStatusType reason_code;
2920     /*
2921       Indicate the pairing session is setup or verification
2922     */
2923     NanPairingRequestType nan_pairing_request_type;
2924     /* Whether should cache the negotiated NIK/NPK for future verification */
2925     u8 enable_pairing_cache;
2926     /*
2927       The security association info negotiated in the pairing setup, used for future verification
2928     */
2929     NpkSecurityAssociation npk_security_association;
2930 } NanPairingConfirmInd;
2931 
2932 /*
2933   NAN pairing bootstrapping initiator request
2934 */
2935 typedef struct {
2936     /* Publish or Subscribe Id of local Publish/Subscribe */
2937     u16 publish_subscribe_id;
2938 
2939     /*
2940        This Id is the Requestor Instance that is passed as
2941        part of earlier MatchInd/FollowupInd message.
2942     */
2943     u32 requestor_instance_id;
2944 
2945     /*
2946       Discovery MAC addr of the publisher/peer
2947     */
2948     u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
2949 
2950     /* Proposed bootstrapping method */
2951     u16 request_bootstrapping_method;
2952 
2953     /*
2954        Sequence of values which further specify the published service beyond
2955        the service name.
2956     */
2957     u16 service_specific_info_len;
2958     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
2959 
2960     /*
2961        Sequence of values indicating the service specific info in SDEA
2962        Used for service managed bootstrapping method
2963     */
2964     u16 sdea_service_specific_info_len;
2965     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
2966 
2967     /* Indicates that this is comeback Bootstrapping request */
2968     u8 comeback;
2969 
2970     /* The length of cookie. */
2971     u32 cookie_length;
2972 
2973     /* Cookie for the follow up request */
2974     u8 cookie[];
2975 
2976 } NanBootstrappingRequest;
2977 /*
2978  NAN pairing bootstrapping response from responder to a initate request
2979 */
2980 typedef struct {
2981     /* Publish or Subscribe Id of local Publish/Subscribe */
2982     u16 publish_subscribe_id;
2983 
2984     /*
2985       Same as the bootstrapping_instance_id
2986     */
2987     u32 service_instance_id;
2988 
2989     /*
2990       Unique Instance Id corresponding to a service/session.
2991       This is similar to the publish_id generated on the
2992       publisher side
2993     */
2994     u32 bootstrapping_instance_id;
2995 
2996     /* Discovery MAC addr of the peer/initiator */
2997     u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
2998 
2999     /*
3000        Sequence of values which further specify the published service beyond
3001        the service name.
3002     */
3003     u16 service_specific_info_len;
3004     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
3005 
3006     /*
3007        Sequence of values indicating the service specific info in SDEA
3008        Used for service managed bootstrapping method
3009     */
3010     u16 sdea_service_specific_info_len;
3011     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
3012 
3013     /* Response Code indicating ACCEPT/REJECT */
3014     NanBootstrappingResponseCode rsp_code;
3015 
3016     /* The delay of bootstrapping in seconds */
3017     u32 come_back_delay;
3018 
3019     /* The length of cookie. */
3020     u32 cookie_length;
3021 
3022     /* Cookie for the follow up response */
3023     u8 cookie[];
3024 
3025 } NanBootstrappingIndicationResponse;
3026 
3027 /*
3028   Event indication received on the responder side when a Nan bootsrapping session is initiated on
3029   the Initiator side
3030 */
3031 typedef struct {
3032     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
3033     u16 publish_subscribe_id;
3034     /*
3035       Unique Instance Id corresponding to a service/session.
3036       This is similar to the publish_id generated on the
3037       publisher side
3038     */
3039     u32 bootstrapping_instance_id;
3040     /*
3041       This Id is the Requestor Instance that is passed as
3042       part of earlier MatchInd/FollowupInd message.
3043     */
3044     u32 requestor_instance_id;
3045     /* Discovery MAC addr of the peer/initiator */
3046     u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
3047     /* Proposed bootstrapping method from peer*/
3048     u16 request_bootstrapping_method;
3049 
3050 } NanBootstrappingRequestInd;
3051 
3052 /*
3053  Event indication of bootstapping confirm is received on both
3054  initiator side confirming a bootstrapping method
3055 */
3056 typedef struct {
3057     /*
3058       Unique token Id generated on the initiator/responder side
3059       used for a bootstrapping session between two NAN devices
3060     */
3061     u32 bootstrapping_instance_id;
3062     /* Response Code indicating ACCEPT/REJECT */
3063     NanBootstrappingResponseCode rsp_code;
3064     /*
3065       Reason code indicating the cause for REJECT.
3066       NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are
3067       expected reason codes.
3068     */
3069     NanStatusType reason_code;
3070     /* The delay of bootstrapping in seconds */
3071     u32 come_back_delay;
3072 
3073     /* The length of cookie. */
3074     u32 cookie_length;
3075 
3076     /* Cookie received from the comeback response */
3077     u8 cookie[];
3078 
3079 } NanBootstrappingConfirmInd;
3080 
3081 /*
3082  Event indication the device enter or exist the suspension mode
3083 */
3084 typedef struct {
3085     /* Indication the device is suspended or not */
3086     bool is_suspended;
3087 } NanSuspensionModeChangeInd;
3088 
3089 /* Response and Event Callbacks */
3090 typedef struct {
3091     /* NotifyResponse invoked to notify the status of the Request */
3092     void (*NotifyResponse)(transaction_id id, NanResponseMsg* rsp_data);
3093     /* Callbacks for various Events */
3094     void (*EventPublishReplied)(NanPublishRepliedInd *event);
3095     void (*EventPublishTerminated)(NanPublishTerminatedInd* event);
3096     void (*EventMatch) (NanMatchInd* event);
3097     void (*EventMatchExpired) (NanMatchExpiredInd* event);
3098     void (*EventSubscribeTerminated) (NanSubscribeTerminatedInd* event);
3099     void (*EventFollowup) (NanFollowupInd* event);
3100     void (*EventDiscEngEvent) (NanDiscEngEventInd* event);
3101     void (*EventDisabled) (NanDisabledInd* event);
3102     void (*EventTca) (NanTCAInd* event);
3103     void (*EventBeaconSdfPayload) (NanBeaconSdfPayloadInd* event);
3104     void (*EventDataRequest)(NanDataPathRequestInd* event);
3105     void (*EventDataConfirm)(NanDataPathConfirmInd* event);
3106     void (*EventDataEnd)(NanDataPathEndInd* event);
3107     void (*EventTransmitFollowup) (NanTransmitFollowupInd* event);
3108     void (*EventRangeRequest) (NanRangeRequestInd* event);
3109     void (*EventRangeReport) (NanRangeReportInd* event);
3110     void (*EventScheduleUpdate) (NanDataPathScheduleUpdateInd* event);
3111     void (*EventPairingRequest) (NanPairingRequestInd* event);
3112     void (*EventPairingConfirm) (NanPairingConfirmInd* event);
3113     void (*EventBootstrappingRequest) (NanBootstrappingRequestInd* event);
3114     void (*EventBootstrappingConfirm) (NanBootstrappingConfirmInd* event);
3115     void (*EventSuspensionModeChange) (NanSuspensionModeChangeInd* event);
3116     void (*EventRangingResults)(wifi_rtt_result* rtt_result[], u32 num_results, u16 session_id);
3117 } NanCallbackHandler;
3118 
3119 /**@brief nan_enable_request
3120  *        Enable NAN functionality
3121  *
3122  * @param transaction_id:
3123  * @param wifi_interface_handle:
3124  * @param NanEnableRequest:
3125  * @return Synchronous wifi_error
3126  * @return Asynchronous NotifyResponse CB return
3127  *                      NAN_STATUS_SUCCESS
3128  *                      NAN_STATUS_ALREADY_ENABLED
3129  *                      NAN_STATUS_INVALID_PARAM
3130  *                      NAN_STATUS_INTERNAL_FAILURE
3131  *                      NAN_STATUS_PROTOCOL_FAILURE
3132  *                      NAN_STATUS_NAN_NOT_ALLOWED
3133  */
3134 wifi_error nan_enable_request(transaction_id id,
3135                               wifi_interface_handle iface,
3136                               NanEnableRequest* msg);
3137 
3138 /**@brief nan_disbale_request
3139  *        Disable NAN functionality.
3140  *
3141  * @param transaction_id:
3142  * @param wifi_interface_handle:
3143  * @param NanDisableRequest:
3144  * @return Synchronous wifi_error
3145  * @return Asynchronous NotifyResponse CB return
3146  *                      NAN_STATUS_SUCCESS
3147  *                      NAN_STATUS_PROTOCOL_FAILURE
3148  *
3149  */
3150 wifi_error nan_disable_request(transaction_id id,
3151                                wifi_interface_handle iface);
3152 
3153 /**@brief nan_publish_request
3154  *        Publish request to advertize a service
3155  *
3156  * @param transaction_id:
3157  * @param wifi_interface_handle:
3158  * @param NanPublishRequest:
3159  * @return Synchronous wifi_error
3160  * @return Asynchronous NotifyResponse CB return
3161  *                      NAN_STATUS_SUCCESS
3162  *                      NAN_STATUS_INVALID_PARAM
3163  *                      NAN_STATUS_PROTOCOL_FAILURE
3164  *                      NAN_STATUS_NO_RESOURCE_AVAILABLE
3165  *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
3166  */
3167 wifi_error nan_publish_request(transaction_id id,
3168                                wifi_interface_handle iface,
3169                                NanPublishRequest* msg);
3170 
3171 /**@brief nan_publish_cancel_request
3172  *        Cancel previous publish request
3173  *
3174  * @param transaction_id:
3175  * @param wifi_interface_handle:
3176  * @param NanPublishCancelRequest:
3177  * @return Synchronous wifi_error
3178  * @return Asynchronous NotifyResponse CB return
3179  *                      NAN_STATUS_SUCCESS
3180  *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
3181  *                      NAN_STATUS_INTERNAL_FAILURE
3182  */
3183 wifi_error nan_publish_cancel_request(transaction_id id,
3184                                       wifi_interface_handle iface,
3185                                       NanPublishCancelRequest* msg);
3186 
3187 /**@brief nan_subscribe_request
3188  *        Subscribe request to search for a service
3189  *
3190  * @param transaction_id:
3191  * @param wifi_interface_handle:
3192  * @param NanSubscribeRequest:
3193  * @return Synchronous wifi_error
3194  * @return Asynchronous NotifyResponse CB return
3195  *                      NAN_STATUS_SUCCESS
3196  *                      NAN_STATUS_INVALID_PARAM
3197  *                      NAN_STATUS_PROTOCOL_FAILURE
3198  *                      NAN_STATUS_INTERNAL_FAILURE
3199  *                      NAN_STATUS_NO_SPACE_AVAILABLE
3200  *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
3201  */
3202 wifi_error nan_subscribe_request(transaction_id id,
3203                                  wifi_interface_handle iface,
3204                                  NanSubscribeRequest* msg);
3205 
3206 /**@brief nan_subscribe_cancel_request
3207  *         Cancel previous subscribe requests.
3208  *
3209  * @param transaction_id:
3210  * @param wifi_interface_handle:
3211  * @param NanSubscribeRequest:
3212  * @return Synchronous wifi_error
3213  * @return Asynchronous NotifyResponse CB return
3214  *                      NAN_STATUS_SUCCESS
3215  *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
3216  *                      NAN_STATUS_INTERNAL_FAILURE
3217  */
3218 wifi_error nan_subscribe_cancel_request(transaction_id id,
3219                                         wifi_interface_handle iface,
3220                                         NanSubscribeCancelRequest* msg);
3221 
3222 /**@brief nan_transmit_followup_request
3223  *         NAN transmit follow up request
3224  *
3225  * @param transaction_id:
3226  * @param wifi_interface_handle:
3227  * @param NanTransmitFollowupRequest:
3228  * @return Synchronous wifi_error
3229  * @return Asynchronous NotifyResponse CB return
3230  *                      NAN_STATUS_SUCCESS
3231  *                      NAN_STATUS_INVALID_PARAM
3232  *                      NAN_STATUS_INTERNAL_FAILURE
3233  *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
3234  *                      NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID
3235  *                      NAN_STATUS_FOLLOWUP_QUEUE_FULL
3236  * @return Asynchronous TransmitFollowupInd CB return
3237  *                      NAN_STATUS_SUCCESS
3238  *                      NAN_STATUS_PROTOCOL_FAILURE
3239  *                      NAN_STATUS_NO_OTA_ACK
3240  */
3241 wifi_error nan_transmit_followup_request(transaction_id id,
3242                                          wifi_interface_handle iface,
3243                                          NanTransmitFollowupRequest* msg);
3244 
3245 /**@brief nan_stats_request
3246  *        Request NAN statistics from Discovery Engine.
3247  *
3248  * @param transaction_id:
3249  * @param wifi_interface_handle:
3250  * @param NanStatsRequest:
3251  * @return Synchronous wifi_error
3252  * @return Asynchronous NotifyResponse CB return
3253  *                      NAN_STATUS_SUCCESS
3254  *                      NAN_STATUS_INTERNAL_FAILURE
3255  *                      NAN_STATUS_INVALID_PARAM
3256  */
3257 wifi_error nan_stats_request(transaction_id id,
3258                              wifi_interface_handle iface,
3259                              NanStatsRequest* msg);
3260 
3261 /**@brief nan_config_request
3262  *        NAN configuration request.
3263  *
3264  * @param transaction_id:
3265  * @param wifi_interface_handle:
3266  * @param NanConfigRequest:
3267  * @return Synchronous wifi_error
3268  * @return Asynchronous NotifyResponse CB return
3269  *                      NAN_STATUS_SUCCESS
3270  *                      NAN_STATUS_INVALID_PARAM
3271  *                      NAN_STATUS_PROTOCOL_FAILURE
3272  *                      NAN_STATUS_INTERNAL_FAILURE
3273  */
3274 wifi_error nan_config_request(transaction_id id,
3275                               wifi_interface_handle iface,
3276                               NanConfigRequest* msg);
3277 
3278 /**@brief nan_tca_request
3279  *        Configure the various Threshold crossing alerts
3280  *
3281  * @param transaction_id:
3282  * @param wifi_interface_handle:
3283  * @param NanStatsRequest:
3284  * @return Synchronous wifi_error
3285  * @return Asynchronous NotifyResponse CB return
3286  *                      NAN_STATUS_SUCCESS
3287  *                      NAN_STATUS_INVALID_PARAM
3288  *                      NAN_STATUS_INTERNAL_FAILURE
3289  */
3290 wifi_error nan_tca_request(transaction_id id,
3291                            wifi_interface_handle iface,
3292                            NanTCARequest* msg);
3293 
3294 /**@brief nan_beacon_sdf_payload_request
3295  *        Set NAN Beacon or sdf payload to discovery engine.
3296  *          This instructs the Discovery Engine to begin publishing the
3297  *        received payload in any Beacon or Service Discovery Frame transmitted
3298  *
3299  * @param transaction_id:
3300  * @param wifi_interface_handle:
3301  * @param NanStatsRequest:
3302  * @return Synchronous wifi_error
3303  * @return Asynchronous NotifyResponse CB return
3304  *                      NAN_STATUS_SUCCESS
3305  *                      NAN_STATUS_INVALID_PARAM
3306  *                      NAN_STATUS_INTERNAL_FAILURE
3307  */
3308 wifi_error nan_beacon_sdf_payload_request(transaction_id id,
3309                                          wifi_interface_handle iface,
3310                                          NanBeaconSdfPayloadRequest* msg);
3311 
3312 /* Register NAN callbacks. */
3313 wifi_error nan_register_handler(wifi_interface_handle iface,
3314                                 NanCallbackHandler handlers);
3315 
3316 /*  Get NAN HAL version. */
3317 wifi_error nan_get_version(wifi_handle handle,
3318                            NanVersion* version);
3319 
3320 /**@brief nan_get_capabilities
3321  *        Get NAN Capabilities
3322  *
3323  * @param transaction_id:
3324  * @param wifi_interface_handle:
3325  * @return Synchronous wifi_error
3326  * @return Asynchronous NotifyResponse CB return
3327  *                      NAN_STATUS_SUCCESS
3328  */
3329 /*  Get NAN capabilities. */
3330 wifi_error nan_get_capabilities(transaction_id id,
3331                                 wifi_interface_handle iface);
3332 
3333 /* ========== Nan Data Path APIs ================ */
3334 /**@brief nan_data_interface_create
3335  *        Create NAN Data Interface.
3336  *
3337  * @param transaction_id:
3338  * @param wifi_interface_handle:
3339  * @param iface_name:
3340  * @return Synchronous wifi_error
3341  * @return Asynchronous NotifyResponse CB return
3342  *                      NAN_STATUS_SUCCESS
3343  *                      NAN_STATUS_INVALID_PARAM
3344  *                      NAN_STATUS_INTERNAL_FAILURE
3345  */
3346 wifi_error nan_data_interface_create(transaction_id id,
3347                                      wifi_interface_handle iface,
3348                                      char* iface_name);
3349 
3350 /**@brief nan_data_interface_delete
3351  *        Delete NAN Data Interface.
3352  *
3353  * @param transaction_id:
3354  * @param wifi_interface_handle:
3355  * @param iface_name:
3356  * @return Synchronous wifi_error
3357  * @return Asynchronous NotifyResponse CB return
3358  *                      NAN_STATUS_SUCCESS
3359  *                      NAN_STATUS_INVALID_PARAM
3360  *                      NAN_STATUS_INTERNAL_FAILURE
3361  */
3362 wifi_error nan_data_interface_delete(transaction_id id,
3363                                      wifi_interface_handle iface,
3364                                      char* iface_name);
3365 
3366 /**@brief nan_data_request_initiator
3367  *        Initiate a NAN Data Path session.
3368  *
3369  * @param transaction_id:
3370  * @param wifi_interface_handle:
3371  * @param NanDataPathInitiatorRequest:
3372  * @return Synchronous wifi_error
3373  * @return Asynchronous NotifyResponse CB return
3374  *                      NAN_STATUS_SUCCESS
3375  *                      NAN_STATUS_INVALID_PARAM
3376  *                      NAN_STATUS_INTERNAL_FAILURE
3377  *                      NAN_STATUS_PROTOCOL_FAILURE
3378  *                      NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID
3379  */
3380 wifi_error nan_data_request_initiator(transaction_id id,
3381                                       wifi_interface_handle iface,
3382                                       NanDataPathInitiatorRequest* msg);
3383 
3384 /**@brief nan_data_indication_response
3385  *         Response to a data indication received
3386  *         corresponding to a NDP session. An indication
3387  *         is received with a data request and the responder
3388  *         will send a data response
3389  *
3390  * @param transaction_id:
3391  * @param wifi_interface_handle:
3392  * @param NanDataPathIndicationResponse:
3393  * @return Synchronous wifi_error
3394  * @return Asynchronous NotifyResponse CB return
3395  *                      NAN_STATUS_SUCCESS
3396  *                      NAN_STATUS_INVALID_PARAM
3397  *                      NAN_STATUS_INTERNAL_FAILURE
3398  *                      NAN_STATUS_PROTOCOL_FAILURE
3399  *                      NAN_STATUS_INVALID_NDP_ID
3400  */
3401 wifi_error nan_data_indication_response(transaction_id id,
3402                                         wifi_interface_handle iface,
3403                                         NanDataPathIndicationResponse* msg);
3404 
3405 /**@brief nan_data_end
3406  *         NDL termination request: from either Initiator/Responder
3407  *
3408  * @param transaction_id:
3409  * @param wifi_interface_handle:
3410  * @param NanDataPathEndRequest:
3411  * @return Synchronous wifi_error
3412  * @return Asynchronous NotifyResponse CB return
3413  *                      NAN_STATUS_SUCCESS
3414  *                      NAN_STATUS_INVALID_PARAM
3415  *                      NAN_STATUS_INTERNAL_FAILURE
3416  *                      NAN_STATUS_PROTOCOL_FAILURE
3417  *                      NAN_STATUS_INVALID_NDP_ID
3418  */
3419 wifi_error nan_data_end(transaction_id id,
3420                         wifi_interface_handle iface,
3421                         NanDataPathEndRequest* msg);
3422 /**@brief nan_pairing_request
3423  *        Initiate a NAN Pairingsession.
3424  *
3425  * @param transaction_id:
3426  * @param wifi_interface_handle:
3427  * @param NanPairingRequest:
3428  * @return Synchronous wifi_error
3429  * @return Asynchronous NotifyResponse CB return
3430  *                      NAN_STATUS_SUCCESS
3431  *                      NAN_STATUS_INVALID_PARAM
3432  *                      NAN_STATUS_INTERNAL_FAILURE
3433  *                      NAN_STATUS_PROTOCOL_FAILURE
3434  *                      NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID
3435  */
3436 wifi_error nan_pairing_request(transaction_id id, wifi_interface_handle iface,
3437                                NanPairingRequest* msg);
3438 
3439 /**@brief nan_pairing_indication_response
3440  *        Response to a pairing indication received
3441  *        corresponding to a pairing session. An indication
3442  *        is received with a pairing request and the responder
3443  *        will send a pairing response
3444  *
3445  * @param transaction_id:
3446  * @param wifi_interface_handle:
3447  * @param NanPairingIndicationResponse:
3448  * @return Synchronous wifi_error
3449  * @return Asynchronous NotifyResponse CB return
3450  *                      NAN_STATUS_SUCCESS
3451  *                      NAN_STATUS_INVALID_PARAM
3452  *                      NAN_STATUS_INTERNAL_FAILURE
3453  *                      NAN_STATUS_PROTOCOL_FAILURE
3454  *                      NAN_STATUS_INVALID_PAIRING_ID
3455  */
3456 wifi_error nan_pairing_indication_response(transaction_id id, wifi_interface_handle iface,
3457                                            NanPairingIndicationResponse* msg);
3458 
3459 /**@brief nan_pairing_end
3460  *        Cancel and remove the existing Pairing setups
3461  *
3462  * @param transaction_id:
3463  * @param wifi_interface_handle:
3464  * @param NanPairingEndRequest:
3465  * @return Synchronous wifi_error
3466  * @return Asynchronous NotifyResponse CB return
3467  *                      NAN_STATUS_SUCCESS
3468  *                      NAN_STATUS_INVALID_PARAM
3469  *                      NAN_STATUS_INTERNAL_FAILURE
3470  *                      NAN_STATUS_PROTOCOL_FAILURE
3471  *                      NAN_STATUS_INVALID_PAIRING_ID
3472  */
3473 wifi_error nan_pairing_end(transaction_id id, wifi_interface_handle iface,
3474                                                  NanPairingEndRequest* msg);
3475 
3476 /**@brief nan_bootstrapping_request
3477  *        Initiate a NAN Bootstrapping session.
3478  *
3479  * @param transaction_id:
3480  * @param wifi_interface_handle:
3481  * @param NanBootstrappingRequest:
3482  * @return Synchronous wifi_error
3483  * @return Asynchronous NotifyResponse CB return
3484  *                      NAN_STATUS_SUCCESS
3485  *                      NAN_STATUS_INVALID_PARAM
3486  *                      NAN_STATUS_INTERNAL_FAILURE
3487  *                      NAN_STATUS_PROTOCOL_FAILURE
3488  *                      NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID
3489  */
3490 wifi_error nan_bootstrapping_request(transaction_id id, wifi_interface_handle iface,
3491                                      NanBootstrappingRequest* msg);
3492 
3493 /**@brief nan_bootstrapping_indication_response
3494  *         Response to a pairing indication received
3495  *         corresponding to a pairing session. An indication
3496  *         is received with a pairing request and the responder
3497  *         will send a pairing response
3498  *
3499  * @param transaction_id:
3500  * @param wifi_interface_handle:
3501  * @param NanBootstrappingIndicationResponse:
3502  * @return Synchronous wifi_error
3503  * @return Asynchronous NotifyResponse CB return
3504  *                      NAN_STATUS_SUCCESS
3505  *                      NAN_STATUS_INVALID_PARAM
3506  *                      NAN_STATUS_INTERNAL_FAILURE
3507  *                      NAN_STATUS_PROTOCOL_FAILURE
3508  *                      NAN_STATUS_INVALID_BOOTSTRAPPING_ID
3509  */
3510 wifi_error nan_bootstrapping_indication_response(transaction_id id, wifi_interface_handle iface,
3511                                                  NanBootstrappingIndicationResponse* msg);
3512 
3513 #ifdef __cplusplus
3514 }
3515 #endif /* __cplusplus */
3516 
3517 #endif /* __NAN_H__ */
3518