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 "wifi_hal.h"
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif /* __cplusplus */
28 
29 /*****************************************************************************
30  * Neighbour Aware Network Service Structures and Functions
31  *****************************************************************************/
32 
33 /*
34   Definitions
35   All multi-byte fields within all NAN protocol stack messages are assumed to be in Little Endian order.
36 */
37 
38 typedef int NanVersion;
39 typedef u16 transaction_id;
40 typedef u32 NanDataPathId;
41 
42 #define NAN_MAC_ADDR_LEN                6
43 #define NAN_MAJOR_VERSION               2
44 #define NAN_MINOR_VERSION               0
45 #define NAN_MICRO_VERSION               0
46 #define NAN_MAX_SOCIAL_CHANNELS         3
47 
48 /* NAN Maximum Lengths */
49 #define NAN_MAX_SERVICE_NAME_LEN                255
50 #define NAN_MAX_MATCH_FILTER_LEN                255
51 #define NAN_MAX_SERVICE_SPECIFIC_INFO_LEN       1024
52 #define NAN_MAX_VSA_DATA_LEN                    1024
53 #define NAN_MAX_MESH_DATA_LEN                   32
54 #define NAN_MAX_INFRA_DATA_LEN                  32
55 #define NAN_MAX_CLUSTER_ATTRIBUTE_LEN           255
56 #define NAN_MAX_SUBSCRIBE_MAX_ADDRESS           42
57 #define NAN_MAX_FAM_CHANNELS                    32
58 #define NAN_MAX_POSTDISCOVERY_LEN               5
59 #define NAN_MAX_FRAME_DATA_LEN                  504
60 #define NAN_DP_MAX_APP_INFO_LEN                 512
61 #define NAN_ERROR_STR_LEN                       255
62 #define NAN_PMK_INFO_LEN                        32
63 #define NAN_MAX_SCID_BUF_LEN                    1024
64 #define NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN  1024
65 #define NAN_SECURITY_MIN_PASSPHRASE_LEN         8
66 #define NAN_SECURITY_MAX_PASSPHRASE_LEN         63
67 #define NAN_MAX_CHANNEL_INFO_SUPPORTED          4
68 
69 /*
70   Definition of various NanResponseType
71 */
72 typedef enum {
73     NAN_RESPONSE_ENABLED                = 0,
74     NAN_RESPONSE_DISABLED               = 1,
75     NAN_RESPONSE_PUBLISH                = 2,
76     NAN_RESPONSE_PUBLISH_CANCEL         = 3,
77     NAN_RESPONSE_TRANSMIT_FOLLOWUP      = 4,
78     NAN_RESPONSE_SUBSCRIBE              = 5,
79     NAN_RESPONSE_SUBSCRIBE_CANCEL       = 6,
80     NAN_RESPONSE_STATS                  = 7,
81     NAN_RESPONSE_CONFIG                 = 8,
82     NAN_RESPONSE_TCA                    = 9,
83     NAN_RESPONSE_ERROR                  = 10,
84     NAN_RESPONSE_BEACON_SDF_PAYLOAD     = 11,
85     NAN_GET_CAPABILITIES                = 12,
86     NAN_DP_INTERFACE_CREATE             = 13,
87     NAN_DP_INTERFACE_DELETE             = 14,
88     NAN_DP_INITIATOR_RESPONSE           = 15,
89     NAN_DP_RESPONDER_RESPONSE           = 16,
90     NAN_DP_END                          = 17
91 } NanResponseType;
92 
93 /* NAN Publish Types */
94 typedef enum {
95     NAN_PUBLISH_TYPE_UNSOLICITED = 0,
96     NAN_PUBLISH_TYPE_SOLICITED,
97     NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED
98 } NanPublishType;
99 
100 /* NAN Transmit Priorities */
101 typedef enum {
102     NAN_TX_PRIORITY_NORMAL = 0,
103     NAN_TX_PRIORITY_HIGH
104 } NanTxPriority;
105 
106 /* NAN Statistics Request ID Codes */
107 typedef enum {
108     NAN_STATS_ID_DE_PUBLISH = 0,
109     NAN_STATS_ID_DE_SUBSCRIBE,
110     NAN_STATS_ID_DE_MAC,
111     NAN_STATS_ID_DE_TIMING_SYNC,
112     NAN_STATS_ID_DE_DW,
113     NAN_STATS_ID_DE
114 } NanStatsType;
115 
116 /* NAN Protocol Event ID Codes */
117 typedef enum {
118     NAN_EVENT_ID_DISC_MAC_ADDR = 0,
119     NAN_EVENT_ID_STARTED_CLUSTER,
120     NAN_EVENT_ID_JOINED_CLUSTER
121 } NanDiscEngEventType;
122 
123 /* NAN Data Path type */
124 typedef enum {
125     NAN_DATA_PATH_UNICAST_MSG = 0,
126     NAN_DATA_PATH_MULTICAST_MSG
127 } NdpType;
128 
129 /* NAN Ranging Configuration */
130 typedef enum {
131     NAN_RANGING_DISABLE = 0,
132     NAN_RANGING_ENABLE
133 } NanRangingState;
134 
135 /* TCA Type */
136 typedef enum {
137     NAN_TCA_ID_CLUSTER_SIZE = 0
138 } NanTcaType;
139 
140 /* NAN Channel Info */
141 typedef struct {
142     u32 channel;
143     u32 bandwidth;
144     u32 nss;
145 } NanChannelInfo;
146 
147 /*
148   Various NAN Protocol Response code
149 */
150 typedef enum {
151     /* NAN Protocol Response Codes */
152     NAN_STATUS_SUCCESS = 0,
153     /*  NAN Discovery Engine/Host driver failures */
154     NAN_STATUS_INTERNAL_FAILURE = 1,
155     /*  NAN OTA failures */
156     NAN_STATUS_PROTOCOL_FAILURE = 2,
157     /* if the publish/subscribe id is invalid */
158     NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID = 3,
159     /* If we run out of resources allocated */
160     NAN_STATUS_NO_RESOURCE_AVAILABLE = 4,
161     /* if invalid params are passed */
162     NAN_STATUS_INVALID_PARAM = 5,
163     /*  if the requestor instance id is invalid */
164     NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID = 6,
165     /*  if the ndp id is invalid */
166     NAN_STATUS_INVALID_NDP_ID = 7,
167     /* if NAN is enabled when wifi is turned off */
168     NAN_STATUS_NAN_NOT_ALLOWED = 8,
169     /* if over the air ack is not received */
170     NAN_STATUS_NO_OTA_ACK = 9,
171     /* If NAN is already enabled and we are try to re-enable the same */
172     NAN_STATUS_ALREADY_ENABLED = 10,
173     /* If followup message internal queue is full */
174     NAN_STATUS_FOLLOWUP_QUEUE_FULL = 11,
175     /* Unsupported concurrency session enabled, NAN disabled notified */
176     NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12
177 } NanStatusType;
178 
179 /* NAN Transmit Types */
180 typedef enum {
181     NAN_TX_TYPE_BROADCAST = 0,
182     NAN_TX_TYPE_UNICAST
183 } NanTxType;
184 
185 /* NAN Subscribe Type */
186 typedef enum {
187     NAN_SUBSCRIBE_TYPE_PASSIVE = 0,
188     NAN_SUBSCRIBE_TYPE_ACTIVE
189 } NanSubscribeType;
190 
191 /* NAN Service Response Filter Attribute Bit */
192 typedef enum {
193     NAN_SRF_ATTR_BLOOM_FILTER = 0,
194     NAN_SRF_ATTR_PARTIAL_MAC_ADDR
195 } NanSRFType;
196 
197 /* NAN Service Response Filter Include Bit */
198 typedef enum {
199     NAN_SRF_INCLUDE_DO_NOT_RESPOND = 0,
200     NAN_SRF_INCLUDE_RESPOND
201 } NanSRFIncludeType;
202 
203 /* NAN Match indication type */
204 typedef enum {
205     NAN_MATCH_ALG_MATCH_ONCE = 0,
206     NAN_MATCH_ALG_MATCH_CONTINUOUS,
207     NAN_MATCH_ALG_MATCH_NEVER
208 } NanMatchAlg;
209 
210 /* NAN Transmit Window Type */
211 typedef enum {
212     NAN_TRANSMIT_IN_DW = 0,
213     NAN_TRANSMIT_IN_FAW
214 } NanTransmitWindowType;
215 
216 /* NAN SRF State in Subscribe */
217 typedef enum {
218     NAN_DO_NOT_USE_SRF = 0,
219     NAN_USE_SRF
220 } NanSRFState;
221 
222 /* NAN Include SSI in MatchInd */
223 typedef enum {
224     NAN_SSI_NOT_REQUIRED_IN_MATCH_IND = 0,
225     NAN_SSI_REQUIRED_IN_MATCH_IND
226 } NanSsiInMatchInd;
227 
228 /* NAN DP security Configuration */
229 typedef enum {
230     NAN_DP_CONFIG_NO_SECURITY = 0,
231     NAN_DP_CONFIG_SECURITY
232 } NanDataPathSecurityCfgStatus;
233 
234 typedef enum {
235     NAN_QOS_NOT_REQUIRED = 0,
236     NAN_QOS_REQUIRED
237 } NanQosCfgStatus;
238 
239 
240 /* Data request Responder's response */
241 typedef enum {
242     NAN_DP_REQUEST_ACCEPT = 0,
243     NAN_DP_REQUEST_REJECT
244 } NanDataPathResponseCode;
245 
246 /* NAN DP channel config options */
247 typedef enum {
248     NAN_DP_CHANNEL_NOT_REQUESTED = 0,
249     NAN_DP_REQUEST_CHANNEL_SETUP,
250     NAN_DP_FORCE_CHANNEL_SETUP
251 } NanDataPathChannelCfg;
252 
253 /* Enable/Disable NAN Ranging Auto response */
254 typedef enum {
255     NAN_RANGING_AUTO_RESPONSE_ENABLE = 1,
256     NAN_RANGING_AUTO_RESPONSE_DISABLE
257 } NanRangingAutoResponse;
258 
259 /* Enable/Disable NAN service range report */
260 typedef enum {
261     NAN_DISABLE_RANGE_REPORT = 1,
262     NAN_ENABLE_RANGE_REPORT
263 } NanRangeReport;
264 
265 /* NAN Range Response */
266 typedef enum {
267     NAN_RANGE_REQUEST_ACCEPT = 1,
268     NAN_RANGE_REQUEST_REJECT,
269     NAN_RANGE_REQUEST_CANCEL
270 } NanRangeResponse;
271 
272 /* NAN Security Key Input Type*/
273 typedef enum {
274     NAN_SECURITY_KEY_INPUT_PMK = 1,
275     NAN_SECURITY_KEY_INPUT_PASSPHRASE
276 } NanSecurityKeyInputType;
277 
278 typedef struct {
279     /* pmk length */
280     u32 pmk_len;
281     /*
282        PMK: Info is optional in Discovery phase.
283        PMK info can be passed during
284        the NDP session.
285      */
286     u8 pmk[NAN_PMK_INFO_LEN];
287 } NanSecurityPmk;
288 
289 typedef struct {
290     /* passphrase length */
291     u32 passphrase_len;
292     /*
293        passphrase info is optional in Discovery phase.
294        passphrase info can be passed during
295        the NDP session.
296      */
297     u8 passphrase[NAN_SECURITY_MAX_PASSPHRASE_LEN];
298 } NanSecurityPassPhrase;
299 
300 typedef struct {
301     NanSecurityKeyInputType key_type;
302     union {
303         NanSecurityPmk pmk_info;
304         NanSecurityPassPhrase passphrase_info;
305     } body;
306 } NanSecurityKeyInfo;
307 
308 /* NAN Shared Key Security Cipher Suites Mask */
309 #define NAN_CIPHER_SUITE_SHARED_KEY_NONE 0x00
310 #define NAN_CIPHER_SUITE_SHARED_KEY_128_MASK  0x01
311 #define NAN_CIPHER_SUITE_SHARED_KEY_256_MASK  0x02
312 
313 /* NAN ranging indication condition MASKS */
314 #define NAN_RANGING_INDICATE_CONTINUOUS_MASK   0x01
315 #define NAN_RANGING_INDICATE_INGRESS_MET_MASK  0x02
316 #define NAN_RANGING_INDICATE_EGRESS_MET_MASK   0x04
317 
318 /* NAN schedule update reason MASKS */
319 #define NAN_SCHEDULE_UPDATE_NSS_MASK   0x01
320 #define NAN_SCHEDULE_UPDATE_CHANNEL_MASK  0x02
321 
322 /*
323    Structure to set the Service Descriptor Extension
324    Attribute (SDEA) passed as part of NanPublishRequest/
325    NanSubscribeRequest/NanMatchInd.
326 */
327 typedef struct {
328     /*
329        Optional configuration of Data Path Enable request.
330        configure flag determines whether configuration needs
331        to be passed or not.
332     */
333     u8 config_nan_data_path;
334     NdpType ndp_type;
335     /*
336        NAN secuirty required flag to indicate
337        if the security is enabled or disabled
338     */
339     NanDataPathSecurityCfgStatus security_cfg;
340     /*
341        NAN ranging required flag to indicate
342        if ranging is enabled on disabled
343     */
344     NanRangingState ranging_state;
345     /*
346       Enable/Disable Ranging report,
347       when configured NanRangeReportInd received
348     */
349     NanRangeReport range_report;
350     /*
351       NAN QOS required flag to indicate
352       if QOS is required or not.
353     */
354     NanQosCfgStatus qos_cfg;
355 } NanSdeaCtrlParams;
356 
357 /*
358    Nan Ranging Peer Info in MatchInd
359 */
360 typedef struct {
361     /*
362        Distance to the NAN device with the MAC address indicated
363        with ranged mac address.
364     */
365     u32 range_measurement_mm;
366     /* Ranging event matching the configuration of continuous/ingress/egress. */
367     u32 ranging_event_type;
368 } NanRangeInfo;
369 
370 /* Nan/NDP Capabilites info */
371 typedef struct {
372     u32 max_concurrent_nan_clusters;
373     u32 max_publishes;
374     u32 max_subscribes;
375     u32 max_service_name_len;
376     u32 max_match_filter_len;
377     u32 max_total_match_filter_len;
378     u32 max_service_specific_info_len;
379     u32 max_vsa_data_len;
380     u32 max_mesh_data_len;
381     u32 max_ndi_interfaces;
382     u32 max_ndp_sessions;
383     u32 max_app_info_len;
384     u32 max_queued_transmit_followup_msgs;
385     u32 ndp_supported_bands;
386     u32 cipher_suites_supported;
387     u32 max_scid_len;
388     bool is_ndp_security_supported;
389     u32 max_sdea_service_specific_info_len;
390     u32 max_subscribe_address;
391 } NanCapabilities;
392 
393 /*
394   Nan accept policy: Per service basis policy
395   Based on this policy(ALL/NONE), responder side
396   will send ACCEPT/REJECT
397 */
398 typedef enum {
399     NAN_SERVICE_ACCEPT_POLICY_NONE = 0,
400     /* Default value */
401     NAN_SERVICE_ACCEPT_POLICY_ALL
402 } NanServiceAcceptPolicy;
403 
404 /*
405   Host can send Vendor specific attributes which the Discovery Engine can
406   enclose in Beacons and/or Service Discovery frames transmitted.
407   Below structure is used to populate that.
408 */
409 typedef struct {
410     /*
411        0 = transmit only in the next discovery window
412        1 = transmit in next 16 discovery window
413     */
414     u8 payload_transmit_flag;
415     /*
416        Below flags will determine in which all frames
417        the vendor specific attributes should be included
418     */
419     u8 tx_in_discovery_beacon;
420     u8 tx_in_sync_beacon;
421     u8 tx_in_service_discovery;
422     /* Organizationally Unique Identifier */
423     u32 vendor_oui;
424     /*
425        vendor specific attribute to be transmitted
426        vsa_len : Length of the vsa data.
427      */
428     u32 vsa_len;
429     u8 vsa[NAN_MAX_VSA_DATA_LEN];
430 } NanTransmitVendorSpecificAttribute;
431 
432 
433 /*
434   Discovery Engine will forward any Vendor Specific Attributes
435   which it received as part of this structure.
436 */
437 /* Mask to determine on which frames attribute was received */
438 #define RX_DISCOVERY_BEACON_MASK  0x01
439 #define RX_SYNC_BEACON_MASK       0x02
440 #define RX_SERVICE_DISCOVERY_MASK 0x04
441 typedef struct {
442     /*
443        Frames on which this vendor specific attribute
444        was received. Mask defined above
445     */
446     u8 vsa_received_on;
447     /* Organizationally Unique Identifier */
448     u32 vendor_oui;
449     /* vendor specific attribute */
450     u32 attr_len;
451     u8 vsa[NAN_MAX_VSA_DATA_LEN];
452 } NanReceiveVendorSpecificAttribute;
453 
454 /*
455    NAN Beacon SDF Payload Received structure
456    Discovery engine sends the details of received Beacon or
457    Service Discovery Frames as part of this structure.
458 */
459 typedef struct {
460     /* Frame data */
461     u32 frame_len;
462     u8 frame_data[NAN_MAX_FRAME_DATA_LEN];
463 } NanBeaconSdfPayloadReceive;
464 
465 /*
466   Host can set the Periodic scan parameters for each of the
467   3(6, 44, 149) Social channels. Only these channels are allowed
468   any other channels are rejected
469 */
470 typedef enum {
471     NAN_CHANNEL_24G_BAND = 0,
472     NAN_CHANNEL_5G_BAND_LOW,
473     NAN_CHANNEL_5G_BAND_HIGH
474 } NanChannelIndex;
475 
476 /*
477    Structure to set the Social Channel Scan parameters
478    passed as part of NanEnableRequest/NanConfigRequest
479 */
480 typedef struct {
481     /*
482        Dwell time of each social channel in milliseconds
483        NanChannelIndex corresponds to the respective channel
484        If time set to 0 then the FW default time will be used.
485     */
486     u8 dwell_time[NAN_MAX_SOCIAL_CHANNELS]; // default value 200 msec
487 
488     /*
489        Scan period of each social channel in seconds
490        NanChannelIndex corresponds to the respective channel
491        If time set to 0 then the FW default time will be used.
492     */
493     u16 scan_period[NAN_MAX_SOCIAL_CHANNELS]; // default value 20 sec
494 } NanSocialChannelScanParams;
495 
496 /*
497   Host can send Post Connectivity Capability attributes
498   to be included in Service Discovery frames transmitted
499   as part of this structure.
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     /* 1 - Wifi Direct supported 0 - Not supported */
508     u8 is_wfd_supported;
509     /* 1 - Wifi Direct Services supported 0 - Not supported */
510     u8 is_wfds_supported;
511     /* 1 - TDLS supported 0 - Not supported */
512     u8 is_tdls_supported;
513     /* 1 - IBSS supported 0 - Not supported */
514     u8 is_ibss_supported;
515     /* 1 - Mesh supported 0 - Not supported */
516     u8 is_mesh_supported;
517     /*
518        1 - NAN Device currently connect to WLAN Infra AP
519        0 - otherwise
520     */
521     u8 wlan_infra_field;
522 } NanTransmitPostConnectivityCapability;
523 
524 /*
525   Discovery engine providing the post connectivity capability
526   received.
527 */
528 typedef struct {
529     /* 1 - Wifi Direct supported 0 - Not supported */
530     u8 is_wfd_supported;
531     /* 1 - Wifi Direct Services supported 0 - Not supported */
532     u8 is_wfds_supported;
533     /* 1 - TDLS supported 0 - Not supported */
534     u8 is_tdls_supported;
535     /* 1 - IBSS supported 0 - Not supported */
536     u8 is_ibss_supported;
537     /* 1 - Mesh supported 0 - Not supported */
538     u8 is_mesh_supported;
539     /*
540        1 - NAN Device currently connect to WLAN Infra AP
541        0 - otherwise
542     */
543     u8 wlan_infra_field;
544 } NanReceivePostConnectivityCapability;
545 
546 /*
547   Indicates the availability interval duration associated with the
548   Availability Intervals Bitmap field
549 */
550 typedef enum {
551     NAN_DURATION_16MS = 0,
552     NAN_DURATION_32MS = 1,
553     NAN_DURATION_64MS = 2
554 } NanAvailDuration;
555 
556 /* Further availability per channel information */
557 typedef struct {
558     /* Defined above */
559     NanAvailDuration entry_control;
560     /*
561        1 byte field indicating the frequency band the NAN Device
562        will be available as defined in IEEE Std. 802.11-2012
563        Annex E Table E-4 Global Operating Classes
564     */
565     u8 class_val;
566     /*
567        1 byte field indicating the channel the NAN Device
568        will be available.
569     */
570     u8 channel;
571     /*
572         Map Id - 4 bit field which identifies the Further
573         availability map attribute.
574     */
575     u8 mapid;
576     /*
577        divides the time between the beginnings of consecutive Discovery
578        Windows of a given NAN cluster into consecutive time intervals
579        of equal durations. The time interval duration is specified by
580        the Availability Interval Duration subfield of the Entry Control
581        field.
582 
583        A Nan device that sets the i-th bit of the Availability
584        Intervals Bitmap to 1 shall be present during the corresponding
585        i-th time interval in the operation channel indicated by the
586        Operating Class and Channel Number fields in the same Availability Entry.
587 
588        A Nan device that sets the i-th bit of the Availability Intervals Bitmap to
589        0 may be present during the corresponding i-th time interval in the operation
590        channel indicated by the Operating Class and Channel Number fields in the same
591        Availability Entry.
592 
593        The size of the Bitmap is dependent upon the Availability Interval Duration
594        chosen in the Entry Control Field.  The size can be either 1, 2 or 4 bytes long
595 
596        - Duration field is equal to 0, only AIB[0] is valid
597        - Duration field is equal to 1, only AIB [0] and AIB [1] is valid
598        - Duration field is equal to 2, AIB [0], AIB [1], AIB [2] and AIB [3] are valid
599     */
600     u32 avail_interval_bitmap;
601 } NanFurtherAvailabilityChannel;
602 
603 /*
604   Further availability map which can be sent and received from
605   Discovery engine
606 */
607 typedef struct {
608     /*
609        Number of channels indicates the number of channel
610        entries which is part of fam
611     */
612     u8 numchans;
613     NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS];
614 } NanFurtherAvailabilityMap;
615 
616 /*
617   Host can send Post-Nan Discovery attributes which the Discovery Engine can
618   enclose in Service Discovery frames
619 */
620 /* Possible connection types in Post NAN Discovery attributes */
621 typedef enum {
622     NAN_CONN_WLAN_INFRA = 0,
623     NAN_CONN_P2P_OPER = 1,
624     NAN_CONN_WLAN_IBSS = 2,
625     NAN_CONN_WLAN_MESH = 3,
626     NAN_CONN_FURTHER_SERVICE_AVAILABILITY = 4,
627     NAN_CONN_WLAN_RANGING = 5
628 } NanConnectionType;
629 
630 /* Possible device roles in Post NAN Discovery attributes */
631 typedef enum {
632     NAN_WLAN_INFRA_AP = 0,
633     NAN_WLAN_INFRA_STA = 1,
634     NAN_P2P_OPER_GO = 2,
635     NAN_P2P_OPER_DEV = 3,
636     NAN_P2P_OPER_CLI = 4
637 } NanDeviceRole;
638 
639 /* Configuration params of NAN Ranging */
640 typedef struct {
641     /*
642       Interval in milli sec between two ranging measurements.
643       If the Awake DW intervals in NanEnable/Config are larger
644       than the ranging intervals priority is given to Awake DW
645       Intervals. Only on a match the ranging is initiated for the
646       peer
647     */
648     u32 ranging_interval_msec;
649     /*
650       Flags indicating the type of ranging event to be notified
651       NAN_RANGING_INDICATE_ MASKS are used to set these.
652       BIT0 - Continuous Ranging event notification.
653       BIT1 - Ingress distance is <=.
654       BIT2 - Egress distance is >=.
655     */
656     u32 config_ranging_indications;
657     /* Ingress distance in millimeters (optional) */
658     u32 distance_ingress_mm;
659     /* Egress distance in millmilliimeters (optional) */
660     u32 distance_egress_mm;
661 } NanRangingCfg;
662 
663 /* NAN Ranging request's response */
664 typedef struct {
665     /* Publish Id of an earlier Publisher */
666     u16 publish_id;
667     /*
668        A 32 bit Requestor instance Id which is sent to the Application.
669        This Id will be used in subsequent RangeResponse on Subscribe side.
670     */
671     u32 requestor_instance_id;
672     /* Peer MAC addr of Range Requestor */
673     u8 peer_addr[NAN_MAC_ADDR_LEN];
674     /* Response indicating ACCEPT/REJECT/CANCEL of Range Request */
675     NanRangeResponse ranging_response;
676 } NanRangeResponseCfg;
677 
678 /* Structure of Post NAN Discovery attribute */
679 typedef struct {
680     /* Connection type of the host */
681     NanConnectionType  type;
682     /*
683        Device role of the host based on
684        the connection type
685     */
686     NanDeviceRole role;
687     /*
688        Flag to send the information as a single shot or repeated
689        for next 16 discovery windows
690        0 - Single_shot
691        1 - next 16 discovery windows
692     */
693     u8 transmit_freq;
694     /* Duration of the availability bitmask */
695     NanAvailDuration duration;
696     /* Availability interval bitmap based on duration */
697     u32 avail_interval_bitmap;
698     /*
699        Mac address depending on the conn type and device role
700        --------------------------------------------------
701        | Conn Type  |  Device Role |  Mac address Usage  |
702        --------------------------------------------------
703        | WLAN_INFRA |  AP/STA      |   BSSID of the AP   |
704        --------------------------------------------------
705        | P2P_OPER   |  GO          |   GO's address      |
706        --------------------------------------------------
707        | P2P_OPER   |  P2P_DEVICE  |   Address of who    |
708        |            |              |   would become GO   |
709        --------------------------------------------------
710        | WLAN_IBSS  |  NA          |   BSSID             |
711        --------------------------------------------------
712        | WLAN_MESH  |  NA          |   BSSID             |
713        --------------------------------------------------
714     */
715     u8 addr[NAN_MAC_ADDR_LEN];
716     /*
717        Mandatory mesh id value if connection type is WLAN_MESH
718        Mesh id contains 0-32 octet identifier and should be
719        as per IEEE Std.802.11-2012 spec.
720     */
721     u16 mesh_id_len;
722     u8 mesh_id[NAN_MAX_MESH_DATA_LEN];
723     /*
724        Optional infrastructure SSID if conn_type is set to
725        NAN_CONN_WLAN_INFRA
726     */
727     u16 infrastructure_ssid_len;
728     u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN];
729 } NanTransmitPostDiscovery;
730 
731 /*
732    Discovery engine providing the structure of Post NAN
733    Discovery
734 */
735 typedef struct {
736     /* Connection type of the host */
737     NanConnectionType  type;
738     /*
739        Device role of the host based on
740        the connection type
741     */
742     NanDeviceRole role;
743     /* Duration of the availability bitmask */
744     NanAvailDuration duration;
745     /* Availability interval bitmap based on duration */
746     u32 avail_interval_bitmap;
747     /*
748        Map Id - 4 bit field which identifies the Further
749        availability map attribute.
750     */
751     u8 mapid;
752     /*
753        Mac address depending on the conn type and device role
754        --------------------------------------------------
755        | Conn Type  |  Device Role |  Mac address Usage  |
756        --------------------------------------------------
757        | WLAN_INFRA |  AP/STA      |   BSSID of the AP   |
758        --------------------------------------------------
759        | P2P_OPER   |  GO          |   GO's address      |
760        --------------------------------------------------
761        | P2P_OPER   |  P2P_DEVICE  |   Address of who    |
762        |            |              |   would become GO   |
763        --------------------------------------------------
764        | WLAN_IBSS  |  NA          |   BSSID             |
765        --------------------------------------------------
766        | WLAN_MESH  |  NA          |   BSSID             |
767        --------------------------------------------------
768     */
769     u8 addr[NAN_MAC_ADDR_LEN];
770     /*
771        Mandatory mesh id value if connection type is WLAN_MESH
772        Mesh id contains 0-32 octet identifier and should be
773        as per IEEE Std.802.11-2012 spec.
774     */
775     u16 mesh_id_len;
776     u8 mesh_id[NAN_MAX_MESH_DATA_LEN];
777     /*
778        Optional infrastructure SSID if conn_type is set to
779        NAN_CONN_WLAN_INFRA
780     */
781     u16 infrastructure_ssid_len;
782     u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN];
783 } NanReceivePostDiscovery;
784 
785 /*
786    NAN device level configuration of SDF and Sync beacons in both
787    2.4/5GHz bands
788 */
789 typedef struct {
790     /* Configure 2.4GHz DW Band */
791     u8 config_2dot4g_dw_band;
792     /*
793        Indicates the interval for Sync beacons and SDF's in 2.4GHz band.
794        Valid values of DW Interval are: 1, 2, 3, 4 and 5, 0 is reserved.
795        The SDF includes in OTA when enabled. The publish/subscribe period
796        values don't override the device level configurations.
797     */
798     u32 dw_2dot4g_interval_val; // default value 1
799     /* Configure 5GHz DW Band */
800     u8 config_5g_dw_band;
801     /*
802        Indicates the interval for Sync beacons and SDF's in 5GHz band
803        Valid values of DW Interval are: 1, 2, 3, 4 and 5, 0 no wake up for
804        any interval. The SDF includes in OTA when enabled. The publish/subscribe
805        period values don't override the device level configurations.
806     */
807     u32 dw_5g_interval_val; // default value 1 when 5G is enabled
808 } NanConfigDW;
809 
810 /*
811   Enable Request Message Structure
812   The NanEnableReq message instructs the Discovery Engine to enter an operational state
813 */
814 typedef struct {
815     /* Mandatory parameters below */
816     u8 master_pref; // default value 0x02
817     /*
818       A cluster_low value matching cluster_high indicates a request to join
819       a cluster with that value. If the requested cluster is not found the
820       device will start its own cluster.
821     */
822     u16 cluster_low; // default value 0
823     u16 cluster_high; // default value 0xFFFF
824 
825     /*
826       Optional configuration of Enable request.
827       Each of the optional parameters have configure flag which
828       determine whether configuration is to be passed or not.
829     */
830     u8 config_support_5g;
831     u8 support_5g_val; // default value 0; turned off by default
832     /*
833        BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons
834        0 - Do not include SIDs in any beacons
835        1 - Include SIDs in all beacons.
836        Rest 7 bits are count field which allows control over the number of SIDs
837        included in the Beacon.  0 means to include as many SIDs that fit into
838        the maximum allow Beacon frame size
839     */
840     u8 config_sid_beacon;
841     u8 sid_beacon_val; // default value 0x01
842     /*
843        The rssi values below should be specified without sign.
844        For eg: -70dBm should be specified as 70.
845     */
846     u8 config_2dot4g_rssi_close;
847     u8 rssi_close_2dot4g_val;    // default value -60 dBm
848 
849     u8 config_2dot4g_rssi_middle;
850     u8 rssi_middle_2dot4g_val;    // default value -70 dBm
851 
852     u8 config_2dot4g_rssi_proximity;
853     u8 rssi_proximity_2dot4g_val;//  default value -60dBm
854 
855     u8 config_hop_count_limit;
856     u8 hop_count_limit_val; //  default value 0x02
857 
858     /*
859        Defines 2.4G channel access support
860        0 - No Support
861        1 - Supported
862     */
863     u8 config_2dot4g_support;
864     u8 support_2dot4g_val; // default value 0x01
865     /*
866        Defines 2.4G channels will be used for sync/discovery beacons
867        0 - 2.4G channels not used for beacons
868        1 - 2.4G channels used for beacons
869     */
870     u8 config_2dot4g_beacons;
871     u8 beacon_2dot4g_val; // default value 1
872     /*
873        Defines 2.4G channels will be used for Service Discovery frames
874        0 - 2.4G channels not used for Service Discovery frames
875        1 - 2.4G channels used for Service Discovery frames
876     */
877     u8 config_2dot4g_sdf;
878     u8 sdf_2dot4g_val; // default value 1
879     /*
880        Defines 5G channels will be used for sync/discovery beacons
881        0 - 5G channels not used for beacons
882        1 - 5G channels used for beacons
883     */
884     u8 config_5g_beacons;
885     u8 beacon_5g_val; // default value 1 when 5G is enabled
886     /*
887        Defines 5G channels will be used for Service Discovery frames
888        0 - 5G channels not used for Service Discovery frames
889        1 - 5G channels used for Service Discovery frames
890     */
891     u8 config_5g_sdf;
892     u8 sdf_5g_val; // default value is 0 when 5G is enabled
893     /*
894        1 byte value which defines the RSSI in
895        dBm for a close by Peer in 5 Ghz channels.
896        The rssi values should be specified without sign.
897        For eg: -70dBm should be specified as 70.
898     */
899     u8 config_5g_rssi_close;
900     u8 rssi_close_5g_val; // default value -60dBm when 5G is enabled
901     /*
902        1 byte value which defines the RSSI value in
903        dBm for a close by Peer in 5 Ghz channels.
904        The rssi values should be specified without sign.
905        For eg: -70dBm should be specified as 70.
906     */
907     u8 config_5g_rssi_middle;
908     u8 rssi_middle_5g_val; // default value -75dBm when 5G is enabled
909     /*
910        1 byte value which defines the RSSI filter
911        threshold.  Any Service Descriptors received above this
912        value that are configured for RSSI filtering will be dropped.
913        The rssi values should be specified without sign.
914        For eg: -70dBm should be specified as 70.
915     */
916     u8 config_5g_rssi_close_proximity;
917     u8 rssi_close_proximity_5g_val; // default value -60dBm when 5G is enabled
918     /*
919        1 byte quantity which defines the window size over
920        which the “average RSSI” will be calculated over.
921     */
922     u8 config_rssi_window_size;
923     u8 rssi_window_size_val; // default value 0x08
924     /*
925        The 24 bit Organizationally Unique ID + the 8 bit Network Id.
926     */
927     u8 config_oui;
928     u32 oui_val; // default value {0x51, 0x6F, 0x9A, 0x01, 0x00, 0x00}
929     /*
930        NAN Interface Address, If not configured the Discovery Engine
931        will generate a 6 byte Random MAC.
932     */
933     u8 config_intf_addr;
934     u8 intf_addr_val[NAN_MAC_ADDR_LEN];
935     /*
936        If set to 1, the Discovery Engine will enclose the Cluster
937        Attribute only sent in Beacons in a Vendor Specific Attribute
938        and transmit in a Service Descriptor Frame.
939     */
940     u8 config_cluster_attribute_val;
941     /*
942        The periodicity in seconds between full scan’s to find any new
943        clusters available in the area.  A Full scan should not be done
944        more than every 10 seconds and should not be done less than every
945        30 seconds.
946     */
947     u8 config_scan_params;
948     NanSocialChannelScanParams scan_params_val;
949     /*
950        1 byte quantity which forces the Random Factor to a particular
951        value for all transmitted Sync/Discovery beacons
952     */
953     u8 config_random_factor_force;
954     u8 random_factor_force_val; // default value off and set to 0x00
955     /*
956        1 byte quantity which forces the HC for all transmitted Sync and
957        Discovery Beacon NO matter the real HC being received over the
958        air.
959     */
960     u8 config_hop_count_force;
961     u8 hop_count_force_val; // default value 0x00
962 
963     /* channel frequency in MHz to enable Nan on */
964     u8 config_24g_channel;
965     wifi_channel channel_24g_val; // default value channel 0x6
966 
967     u8 config_5g_channel;
968     wifi_channel channel_5g_val; // default value channel 44 or 149 regulatory
969                                  // domain
970     /* Configure 2.4/5GHz DW */
971     NanConfigDW config_dw;
972 
973     /*
974        By default discovery MAC address randomization is enabled
975        and default interval value is 30 minutes i.e. 1800 seconds.
976        The value 0 is used to disable MAC addr randomization.
977     */
978     u8 config_disc_mac_addr_randomization;
979     u32 disc_mac_addr_rand_interval_sec; // default value 1800 sec
980 
981     /*
982       Set/Enable corresponding bits to disable Discovery indications:
983       BIT0 - Disable Discovery MAC Address Event.
984       BIT1 - Disable Started Cluster Event.
985       BIT2 - Disable Joined Cluster Event.
986     */
987     u8 discovery_indication_cfg;  // default value 0x0
988     /*
989        BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons
990        0 - Do not include SIDs in any beacons
991        1 - Include SIDs in all beacons.
992        Rest 7 bits are count field which allows control over the number of SIDs
993        included in the Beacon.  0 means to include as many SIDs that fit into
994        the maximum allow Beacon frame size
995     */
996     u8 config_subscribe_sid_beacon;
997     u32 subscribe_sid_beacon_val; // default value 0x0
998     /*
999        Discovery Beacon Interval config.
1000        Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW.
1001        When 0 value is passed it is reset to default value of 128 or 176 msec.
1002     */
1003     u8 config_discovery_beacon_int;
1004     u32 discovery_beacon_interval;
1005     /*
1006        Enable Number of Spatial Streams.
1007        This is NAN Power Optimization feature for NAN discovery.
1008     */
1009     u8 config_nss;
1010     // default value is implementation specific and passing 0 sets it to default
1011     u32 nss;
1012     /*
1013        Enable device level NAN Ranging feature.
1014        0 - Disable
1015        1 - Enable
1016     */
1017     u8 config_enable_ranging;
1018     u32 enable_ranging;
1019     /*
1020        Enable/Disable DW Early termination.
1021        0 - Disable
1022        1 - Enable
1023     */
1024     u8 config_dw_early_termination;
1025     u32 enable_dw_termination;
1026 } NanEnableRequest;
1027 
1028 /*
1029   Publish Msg Structure
1030   Message is used to request the DE to publish the Service Name
1031   using the parameters passed into the Discovery Window
1032 */
1033 typedef struct {
1034     u16 publish_id;/* id  0 means new publish, any other id is existing publish */
1035     u16 ttl; /* how many seconds to run for. 0 means forever until canceled */
1036     /*
1037        period: Awake DW Interval for publish(service)
1038        Indicates the interval between two Discovery Windows in which
1039        the device supporting the service is awake to transmit or
1040        receive the Service Discovery frames.
1041        Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16, value 0 will
1042        default to 1.
1043     */
1044     u16 period;
1045     NanPublishType publish_type;/* 0= unsolicited, solicited = 1, 2= both */
1046     NanTxType tx_type; /* 0 = broadcast, 1= unicast  if solicited publish */
1047     u8 publish_count; /* number of OTA Publish, 0 means forever until canceled */
1048     u16 service_name_len; /* length of service name */
1049     u8 service_name[NAN_MAX_SERVICE_NAME_LEN];/* UTF-8 encoded string identifying the service */
1050     /*
1051        Field which specifies how the matching indication to host is controlled.
1052        0 - Match and Indicate Once
1053        1 - Match and Indicate continuous
1054        2 - Match and Indicate never. This means don't indicate the match to the host.
1055        3 - Reserved
1056     */
1057     NanMatchAlg publish_match_indicator;
1058 
1059     /*
1060        Sequence of values
1061        NAN Device that has invoked a Subscribe method corresponding to this Publish method
1062     */
1063     u16 service_specific_info_len;
1064     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
1065 
1066     /*
1067        Ordered sequence of <length, value> pairs which specify further response conditions
1068        beyond the service name used to filter subscribe messages to respond to.
1069        This is only needed when the PT is set to NAN_SOLICITED or NAN_SOLICITED_UNSOLICITED.
1070     */
1071     u16 rx_match_filter_len;
1072     u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN];
1073 
1074     /*
1075        Ordered sequence of <length, value> pairs to be included in the Discovery Frame.
1076        If present it is always sent in a Discovery Frame
1077     */
1078     u16 tx_match_filter_len;
1079     u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN];
1080 
1081     /*
1082        flag which specifies that the Publish should use the configured RSSI
1083        threshold and the received RSSI in order to filter requests
1084        0 – ignore the configured RSSI threshold when running a Service
1085            Descriptor attribute or Service ID List Attribute through the DE matching logic.
1086        1 – use the configured RSSI threshold when running a Service
1087            Descriptor attribute or Service ID List Attribute through the DE matching logic.
1088 
1089     */
1090     u8 rssi_threshold_flag;
1091 
1092     /*
1093        8-bit bitmap which allows the Host to associate this publish
1094        with a particular Post-NAN Connectivity attribute
1095        which has been sent down in a NanConfigureRequest/NanEnableRequest
1096        message.  If the DE fails to find a configured Post-NAN
1097        connectivity attributes referenced by the bitmap,
1098        the DE will return an error code to the Host.
1099        If the Publish is configured to use a Post-NAN Connectivity
1100        attribute and the Host does not refresh the Post-NAN Connectivity
1101        attribute the Publish will be canceled and the Host will be sent
1102        a PublishTerminatedIndication message.
1103     */
1104     u8 connmap;
1105     /*
1106       Set/Enable corresponding bits to disable any indications that follow a publish.
1107       BIT0 - Disable publish termination indication.
1108       BIT1 - Disable match expired indication.
1109       BIT2 - Disable followUp indication received (OTA).
1110       BIT3 - Disable publishReplied indication.
1111     */
1112     u8 recv_indication_cfg;
1113     /*
1114       Nan accept policy for the specific service(publish)
1115     */
1116     NanServiceAcceptPolicy service_responder_policy;
1117     /* NAN Cipher Suite Type */
1118     u32 cipher_type;
1119     /*
1120        Nan Security Key Info is optional in Discovery phase.
1121        PMK or passphrase info can be passed during
1122        the NDP session.
1123     */
1124     NanSecurityKeyInfo key_info;
1125 
1126     /* Security Context Identifiers length */
1127     u32 scid_len;
1128     /*
1129        Security Context Identifier attribute contains PMKID
1130        shall be included in NDP setup and response messages.
1131        Security Context Identifier, Identifies the Security
1132        Context. For NAN Shared Key Cipher Suite, this field
1133        contains the 16 octet PMKID identifying the PMK used
1134        for setting up the Secure Data Path.
1135     */
1136     u8 scid[NAN_MAX_SCID_BUF_LEN];
1137 
1138     /* NAN configure service discovery extended attributes */
1139     NanSdeaCtrlParams sdea_params;
1140 
1141     /* NAN Ranging configuration */
1142     NanRangingCfg ranging_cfg;
1143 
1144     /* Enable/disable NAN serivce Ranging auto response mode */
1145     NanRangingAutoResponse ranging_auto_response;
1146 
1147     /*
1148       When the ranging_auto_response_cfg is not set, NanRangeRequestInd is
1149       received. Nan Range Response to Peer MAC Addr is notified to indicate
1150       ACCEPT/REJECT/CANCEL to the requestor.
1151     */
1152     NanRangeResponseCfg range_response_cfg;
1153 
1154     /*
1155        Sequence of values indicating the service specific info in SDEA
1156     */
1157     u16 sdea_service_specific_info_len;
1158     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
1159 } NanPublishRequest;
1160 
1161 /*
1162   Publish Cancel Msg Structure
1163   The PublishServiceCancelReq Message is used to request the DE to stop publishing
1164   the Service Name identified by the Publish Id in the message.
1165 */
1166 typedef struct {
1167     u16 publish_id;
1168 } NanPublishCancelRequest;
1169 
1170 /*
1171   NAN Subscribe Structure
1172   The SubscribeServiceReq message is sent to the Discovery Engine
1173   whenever the Upper layers would like to listen for a Service Name
1174 */
1175 typedef struct {
1176     u16 subscribe_id; /* id 0 means new subscribe, non zero is existing subscribe */
1177     u16 ttl; /* how many seconds to run for. 0 means forever until canceled */
1178     /*
1179        period: Awake DW Interval for subscribe(service)
1180        Indicates the interval between two Discovery Windows in which
1181        the device supporting the service is awake to transmit or
1182        receive the Service Discovery frames.
1183        Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16, value 0 will
1184        default to 1.
1185     */
1186     u16 period;
1187 
1188     /* Flag which specifies how the Subscribe request shall be processed. */
1189     NanSubscribeType subscribe_type; /* 0 - PASSIVE , 1- ACTIVE */
1190 
1191     /* Flag which specifies on Active Subscribes how the Service Response Filter attribute is populated.*/
1192     NanSRFType serviceResponseFilter; /* 0 - Bloom Filter, 1 - MAC Addr */
1193 
1194     /* Flag which specifies how the Service Response Filter Include bit is populated.*/
1195     NanSRFIncludeType serviceResponseInclude; /* 0=Do not respond if in the Address Set, 1= Respond */
1196 
1197     /* Flag which specifies if the Service Response Filter should be used when creating Subscribes.*/
1198     NanSRFState useServiceResponseFilter; /* 0=Do not send the Service Response Filter,1= send */
1199 
1200     /*
1201        Flag which specifies if the Service Specific Info is needed in
1202        the Publish message before creating the MatchIndication
1203     */
1204     NanSsiInMatchInd ssiRequiredForMatchIndication; /* 0=Not needed, 1= Required */
1205 
1206     /*
1207        Field which specifies how the matching indication to host is controlled.
1208        0 - Match and Indicate Once
1209        1 - Match and Indicate continuous
1210        2 - Match and Indicate never. This means don't indicate the match to the host.
1211        3 - Reserved
1212     */
1213     NanMatchAlg subscribe_match_indicator;
1214 
1215     /*
1216        The number of Subscribe Matches which should occur
1217        before the Subscribe request is automatically terminated.
1218     */
1219     u8 subscribe_count; /* If this value is 0 this field is not used by the DE.*/
1220 
1221     u16 service_name_len;/* length of service name */
1222     u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; /* UTF-8 encoded string identifying the service */
1223 
1224     /* Sequence of values which further specify the published service beyond the service name*/
1225     u16 service_specific_info_len;
1226     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
1227 
1228     /*
1229        Ordered sequence of <length, value> pairs used to filter out received publish discovery messages.
1230        This can be sent both for a Passive or an Active Subscribe
1231     */
1232     u16 rx_match_filter_len;
1233     u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN];
1234 
1235     /*
1236        Ordered sequence of <length, value> pairs  included in the
1237        Discovery Frame when an Active Subscribe is used.
1238     */
1239     u16 tx_match_filter_len;
1240     u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN];
1241 
1242     /*
1243        Flag which specifies that the Subscribe should use the configured RSSI
1244        threshold and the received RSSI in order to filter requests
1245        0 – ignore the configured RSSI threshold when running a Service
1246            Descriptor attribute or Service ID List Attribute through the DE matching logic.
1247        1 – use the configured RSSI threshold when running a Service
1248            Descriptor attribute or Service ID List Attribute through the DE matching logic.
1249 
1250     */
1251     u8 rssi_threshold_flag;
1252 
1253     /*
1254        8-bit bitmap which allows the Host to associate this Active
1255        Subscribe with a particular Post-NAN Connectivity attribute
1256        which has been sent down in a NanConfigureRequest/NanEnableRequest
1257        message.  If the DE fails to find a configured Post-NAN
1258        connectivity attributes referenced by the bitmap,
1259        the DE will return an error code to the Host.
1260        If the Subscribe is configured to use a Post-NAN Connectivity
1261        attribute and the Host does not refresh the Post-NAN Connectivity
1262        attribute the Subscribe will be canceled and the Host will be sent
1263        a SubscribeTerminatedIndication message.
1264     */
1265     u8 connmap;
1266     /*
1267        NAN Interface Address, conforming to the format as described in
1268        8.2.4.3.2 of IEEE Std. 802.11-2012.
1269     */
1270     u8 num_intf_addr_present;
1271     u8 intf_addr[NAN_MAX_SUBSCRIBE_MAX_ADDRESS][NAN_MAC_ADDR_LEN];
1272     /*
1273       Set/Enable corresponding bits to disable indications that follow a subscribe.
1274       BIT0 - Disable subscribe termination indication.
1275       BIT1 - Disable match expired indication.
1276       BIT2 - Disable followUp indication received (OTA).
1277     */
1278     u8 recv_indication_cfg;
1279 
1280     /* NAN Cipher Suite Type */
1281     u32 cipher_type;
1282     /*
1283        Nan Security Key Info is optional in Discovery phase.
1284        PMK or passphrase info can be passed during
1285        the NDP session.
1286     */
1287     NanSecurityKeyInfo key_info;
1288 
1289     /* Security Context Identifiers length */
1290     u32 scid_len;
1291     /*
1292        Security Context Identifier attribute contains PMKID
1293        shall be included in NDP setup and response messages.
1294        Security Context Identifier, Identifies the Security
1295        Context. For NAN Shared Key Cipher Suite, this field
1296        contains the 16 octet PMKID identifying the PMK used
1297        for setting up the Secure Data Path.
1298     */
1299     u8 scid[NAN_MAX_SCID_BUF_LEN];
1300 
1301     /* NAN configure service discovery extended attributes */
1302     NanSdeaCtrlParams sdea_params;
1303 
1304     /* NAN Ranging configuration */
1305     NanRangingCfg ranging_cfg;
1306 
1307     /* Enable/disable NAN serivce Ranging auto response mode */
1308     NanRangingAutoResponse ranging_auto_response;
1309 
1310     /*
1311       When the ranging_auto_response_cfg is not set, NanRangeRequestInd is
1312       received. Nan Range Response to Peer MAC Addr is notified to indicate
1313       ACCEPT/REJECT/CANCEL to the requestor.
1314     */
1315     NanRangeResponseCfg range_response_cfg;
1316 
1317     /*
1318        Sequence of values indicating the service specific info in SDEA
1319     */
1320     u16 sdea_service_specific_info_len;
1321     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
1322 } NanSubscribeRequest;
1323 
1324 /*
1325   NAN Subscribe Cancel Structure
1326   The SubscribeCancelReq Message is used to request the DE to stop looking for the Service Name.
1327 */
1328 typedef struct {
1329     u16 subscribe_id;
1330 } NanSubscribeCancelRequest;
1331 
1332 /*
1333   Transmit follow up Structure
1334   The TransmitFollowupReq message is sent to the DE to allow the sending of the Service_Specific_Info
1335   to a particular MAC address.
1336 */
1337 typedef struct {
1338     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
1339     u16 publish_subscribe_id;
1340 
1341     /*
1342        This Id is the Requestor Instance that is passed as
1343        part of earlier MatchInd/FollowupInd message.
1344     */
1345     u32 requestor_instance_id;
1346     u8 addr[NAN_MAC_ADDR_LEN]; /* Unicast address */
1347     NanTxPriority priority; /* priority of the request 2=high */
1348     NanTransmitWindowType dw_or_faw; /* 0= send in a DW, 1=send in FAW */
1349 
1350     /*
1351        Sequence of values which further specify the published service beyond
1352        the service name.
1353     */
1354     u16 service_specific_info_len;
1355     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
1356     /*
1357       Set/Enable corresponding bits to disable responses after followUp.
1358       BIT0 - Disable followUp response from FW.
1359     */
1360     u8 recv_indication_cfg;
1361 
1362     /*
1363        Sequence of values indicating the service specific info in SDEA
1364     */
1365     u16 sdea_service_specific_info_len;
1366     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
1367 } NanTransmitFollowupRequest;
1368 
1369 /*
1370   Stats Request structure
1371   The Discovery Engine can be queried at runtime by the Host processor for statistics
1372   concerning various parts of the Discovery Engine.
1373 */
1374 typedef struct {
1375     NanStatsType stats_type; /* NAN Statistics Request Type */
1376     u8 clear; /* 0= Do not clear the stats and return the current contents , 1= Clear the associated stats  */
1377 } NanStatsRequest;
1378 
1379 /*
1380   Config Structure
1381   The NanConfigurationReq message is sent by the Host to the
1382   Discovery Engine in order to configure the Discovery Engine during runtime.
1383 */
1384 typedef struct {
1385     u8 config_sid_beacon;
1386     u8 sid_beacon;
1387     u8 config_rssi_proximity;
1388     u8 rssi_proximity; // default value -60dBm
1389     u8 config_master_pref;
1390     u8 master_pref; // default value 0x02
1391     /*
1392        1 byte value which defines the RSSI filter threshold.
1393        Any Service Descriptors received above this value
1394        that are configured for RSSI filtering will be dropped.
1395        The rssi values should be specified without sign.
1396        For eg: -70dBm should be specified as 70.
1397     */
1398     u8 config_5g_rssi_close_proximity;
1399     u8 rssi_close_proximity_5g_val;  // default value -60dBm
1400     /*
1401       Optional configuration of Configure request.
1402       Each of the optional parameters have configure flag which
1403       determine whether configuration is to be passed or not.
1404     */
1405     /*
1406        1 byte quantity which defines the window size over
1407        which the “average RSSI” will be calculated over.
1408     */
1409     u8 config_rssi_window_size;
1410     u8 rssi_window_size_val; // default value 0x08
1411     /*
1412        If set to 1, the Discovery Engine will enclose the Cluster
1413        Attribute only sent in Beacons in a Vendor Specific Attribute
1414        and transmit in a Service Descriptor Frame.
1415     */
1416     u8 config_cluster_attribute_val;
1417     /*
1418       The periodicity in seconds between full scan’s to find any new
1419       clusters available in the area.  A Full scan should not be done
1420       more than every 10 seconds and should not be done less than every
1421       30 seconds.
1422     */
1423     u8 config_scan_params;
1424     NanSocialChannelScanParams scan_params_val;
1425     /*
1426        1 byte quantity which forces the Random Factor to a particular
1427        value for all transmitted Sync/Discovery beacons
1428     */
1429     u8 config_random_factor_force;
1430     u8 random_factor_force_val; // default value 0x00
1431     /*
1432        1 byte quantity which forces the HC for all transmitted Sync and
1433        Discovery Beacon NO matter the real HC being received over the
1434        air.
1435     */
1436     u8 config_hop_count_force;
1437     u8 hop_count_force_val; // default value of 0
1438     /* NAN Post Connectivity Capability */
1439     u8 config_conn_capability;
1440     NanTransmitPostConnectivityCapability conn_capability_val;
1441     /* NAN Post Discover Capability */
1442     u8 num_config_discovery_attr;
1443     NanTransmitPostDiscovery discovery_attr_val[NAN_MAX_POSTDISCOVERY_LEN];
1444     /* NAN Further availability Map */
1445     u8 config_fam;
1446     NanFurtherAvailabilityMap fam_val;
1447     /* Configure 2.4/5GHz DW */
1448     NanConfigDW config_dw;
1449     /*
1450        By default discovery MAC address randomization is enabled
1451        and default interval value is 30 minutes i.e. 1800 seconds.
1452        The value 0 is used to disable MAC addr randomization.
1453     */
1454     u8 config_disc_mac_addr_randomization;
1455     u32 disc_mac_addr_rand_interval_sec; // default value of 30 minutes
1456 
1457     /*
1458       Set/Enable corresponding bits to disable Discovery indications:
1459       BIT0 - Disable Discovery MAC Address Event.
1460       BIT1 - Disable Started Cluster Event.
1461       BIT2 - Disable Joined Cluster Event.
1462     */
1463     u8 discovery_indication_cfg; // default value of 0
1464     /*
1465        BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons
1466        0 - Do not include SIDs in any beacons
1467        1 - Include SIDs in all beacons.
1468        Rest 7 bits are count field which allows control over the number of SIDs
1469        included in the Beacon.  0 means to include as many SIDs that fit into
1470        the maximum allow Beacon frame size
1471     */
1472     u8 config_subscribe_sid_beacon;
1473     u32 subscribe_sid_beacon_val; // default value 0x0
1474     /*
1475        Discovery Beacon Interval config.
1476        Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW.
1477        When 0 value is passed it is reset to default value of 128 or 176 msec.
1478     */
1479     u8 config_discovery_beacon_int;
1480     u32 discovery_beacon_interval;
1481     /*
1482        Enable Number of Spatial Streams.
1483        This is NAN Power Optimization feature for NAN discovery.
1484     */
1485     u8 config_nss;
1486     // default value is implementation specific and passing 0 sets it to default
1487     u32 nss;
1488     /*
1489        Enable device level NAN Ranging feature.
1490        0 - Disable
1491        1 - Enable
1492     */
1493     u8 config_enable_ranging;
1494     u32 enable_ranging;
1495     /*
1496        Enable/Disable DW Early termination.
1497        0 - Disable
1498        1 - Enable
1499     */
1500     u8 config_dw_early_termination;
1501     u32 enable_dw_termination;
1502 } NanConfigRequest;
1503 
1504 /*
1505   TCA Structure
1506   The Discovery Engine can be configured to send up Events whenever a configured
1507   Threshold Crossing Alert (TCA) Type crosses an integral threshold in a particular direction.
1508 */
1509 typedef struct {
1510     NanTcaType tca_type; /* Nan Protocol Threshold Crossing Alert (TCA) Codes */
1511 
1512     /* flag which control whether or not an event is generated for the Rising direction */
1513     u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */
1514 
1515     /* flag which control whether or not an event is generated for the Falling direction */
1516     u8 falling_direction_evt_flag;/* 0 - no event, 1 - event */
1517 
1518     /* flag which requests a previous TCA request to be cleared from the DE */
1519     u8 clear;/*0= Do not clear the TCA, 1=Clear the TCA */
1520 
1521     /* 32 bit value which represents the threshold to be used.*/
1522     u32 threshold;
1523 } NanTCARequest;
1524 
1525 /*
1526   Beacon Sdf Payload Structure
1527   The Discovery Engine can be configured to publish vendor specific attributes as part of
1528   beacon or service discovery frame transmitted as part of this request..
1529 */
1530 typedef struct {
1531     /*
1532        NanVendorAttribute will have the Vendor Specific Attribute which the
1533        vendor wants to publish as part of Discovery or Sync or Service discovery frame
1534     */
1535     NanTransmitVendorSpecificAttribute vsa;
1536 } NanBeaconSdfPayloadRequest;
1537 
1538 /* Publish statistics. */
1539 typedef struct
1540 {
1541     u32 validPublishServiceReqMsgs;
1542     u32 validPublishServiceRspMsgs;
1543     u32 validPublishServiceCancelReqMsgs;
1544     u32 validPublishServiceCancelRspMsgs;
1545     u32 validPublishRepliedIndMsgs;
1546     u32 validPublishTerminatedIndMsgs;
1547     u32 validActiveSubscribes;
1548     u32 validMatches;
1549     u32 validFollowups;
1550     u32 invalidPublishServiceReqMsgs;
1551     u32 invalidPublishServiceCancelReqMsgs;
1552     u32 invalidActiveSubscribes;
1553     u32 invalidMatches;
1554     u32 invalidFollowups;
1555     u32 publishCount;
1556     u32 publishNewMatchCount;
1557     u32 pubsubGlobalNewMatchCount;
1558 } NanPublishStats;
1559 
1560 /* Subscribe statistics. */
1561 typedef struct
1562 {
1563     u32 validSubscribeServiceReqMsgs;
1564     u32 validSubscribeServiceRspMsgs;
1565     u32 validSubscribeServiceCancelReqMsgs;
1566     u32 validSubscribeServiceCancelRspMsgs;
1567     u32 validSubscribeTerminatedIndMsgs;
1568     u32 validSubscribeMatchIndMsgs;
1569     u32 validSubscribeUnmatchIndMsgs;
1570     u32 validSolicitedPublishes;
1571     u32 validMatches;
1572     u32 validFollowups;
1573     u32 invalidSubscribeServiceReqMsgs;
1574     u32 invalidSubscribeServiceCancelReqMsgs;
1575     u32 invalidSubscribeFollowupReqMsgs;
1576     u32 invalidSolicitedPublishes;
1577     u32 invalidMatches;
1578     u32 invalidFollowups;
1579     u32 subscribeCount;
1580     u32 bloomFilterIndex;
1581     u32 subscribeNewMatchCount;
1582     u32 pubsubGlobalNewMatchCount;
1583 } NanSubscribeStats;
1584 
1585 /* NAN DW Statistics*/
1586 typedef struct
1587 {
1588     /* RX stats */
1589     u32 validFrames;
1590     u32 validActionFrames;
1591     u32 validBeaconFrames;
1592     u32 ignoredActionFrames;
1593     u32 ignoredBeaconFrames;
1594     u32 invalidFrames;
1595     u32 invalidActionFrames;
1596     u32 invalidBeaconFrames;
1597     u32 invalidMacHeaders;
1598     u32 invalidPafHeaders;
1599     u32 nonNanBeaconFrames;
1600 
1601     u32 earlyActionFrames;
1602     u32 inDwActionFrames;
1603     u32 lateActionFrames;
1604 
1605     /* TX stats */
1606     u32 framesQueued;
1607     u32 totalTRSpUpdates;
1608     u32 completeByTRSp;
1609     u32 completeByTp75DW;
1610     u32 completeByTendDW;
1611     u32 lateActionFramesTx;
1612 } NanDWStats;
1613 
1614 /* NAN MAC Statistics. */
1615 typedef struct
1616 {
1617     /* RX stats */
1618     u32 validFrames;
1619     u32 validActionFrames;
1620     u32 validBeaconFrames;
1621     u32 ignoredActionFrames;
1622     u32 ignoredBeaconFrames;
1623     u32 invalidFrames;
1624     u32 invalidActionFrames;
1625     u32 invalidBeaconFrames;
1626     u32 invalidMacHeaders;
1627     u32 invalidPafHeaders;
1628     u32 nonNanBeaconFrames;
1629 
1630     u32 earlyActionFrames;
1631     u32 inDwActionFrames;
1632     u32 lateActionFrames;
1633 
1634     /* TX stats */
1635     u32 framesQueued;
1636     u32 totalTRSpUpdates;
1637     u32 completeByTRSp;
1638     u32 completeByTp75DW;
1639     u32 completeByTendDW;
1640     u32 lateActionFramesTx;
1641 
1642     u32 twIncreases;
1643     u32 twDecreases;
1644     u32 twChanges;
1645     u32 twHighwater;
1646     u32 bloomFilterIndex;
1647 } NanMacStats;
1648 
1649 /* NAN Sync Statistics*/
1650 typedef struct
1651 {
1652     u64 currTsf;
1653     u64 myRank;
1654     u64 currAmRank;
1655     u64 lastAmRank;
1656     u32 currAmBTT;
1657     u32 lastAmBTT;
1658     u8  currAmHopCount;
1659     u8  currRole;
1660     u16 currClusterId;
1661 
1662     u64 timeSpentInCurrRole;
1663     u64 totalTimeSpentAsMaster;
1664     u64 totalTimeSpentAsNonMasterSync;
1665     u64 totalTimeSpentAsNonMasterNonSync;
1666     u32 transitionsToAnchorMaster;
1667     u32 transitionsToMaster;
1668     u32 transitionsToNonMasterSync;
1669     u32 transitionsToNonMasterNonSync;
1670     u32 amrUpdateCount;
1671     u32 amrUpdateRankChangedCount;
1672     u32 amrUpdateBTTChangedCount;
1673     u32 amrUpdateHcChangedCount;
1674     u32 amrUpdateNewDeviceCount;
1675     u32 amrExpireCount;
1676     u32 mergeCount;
1677     u32 beaconsAboveHcLimit;
1678     u32 beaconsBelowRssiThresh;
1679     u32 beaconsIgnoredNoSpace;
1680     u32 beaconsForOurCluster;
1681     u32 beaconsForOtherCluster;
1682     u32 beaconCancelRequests;
1683     u32 beaconCancelFailures;
1684     u32 beaconUpdateRequests;
1685     u32 beaconUpdateFailures;
1686     u32 syncBeaconTxAttempts;
1687     u32 syncBeaconTxFailures;
1688     u32 discBeaconTxAttempts;
1689     u32 discBeaconTxFailures;
1690     u32 amHopCountExpireCount;
1691     u32 ndpChannelFreq;
1692     u32 ndpChannelFreq2;
1693     u32 schedUpdateChannelFreq;
1694 } NanSyncStats;
1695 
1696 /* NAN Misc DE Statistics */
1697 typedef struct
1698 {
1699     u32 validErrorRspMsgs;
1700     u32 validTransmitFollowupReqMsgs;
1701     u32 validTransmitFollowupRspMsgs;
1702     u32 validFollowupIndMsgs;
1703     u32 validConfigurationReqMsgs;
1704     u32 validConfigurationRspMsgs;
1705     u32 validStatsReqMsgs;
1706     u32 validStatsRspMsgs;
1707     u32 validEnableReqMsgs;
1708     u32 validEnableRspMsgs;
1709     u32 validDisableReqMsgs;
1710     u32 validDisableRspMsgs;
1711     u32 validDisableIndMsgs;
1712     u32 validEventIndMsgs;
1713     u32 validTcaReqMsgs;
1714     u32 validTcaRspMsgs;
1715     u32 validTcaIndMsgs;
1716     u32 invalidTransmitFollowupReqMsgs;
1717     u32 invalidConfigurationReqMsgs;
1718     u32 invalidStatsReqMsgs;
1719     u32 invalidEnableReqMsgs;
1720     u32 invalidDisableReqMsgs;
1721     u32 invalidTcaReqMsgs;
1722 } NanDeStats;
1723 
1724 /* Publish Response Message structure */
1725 typedef struct {
1726     u16 publish_id;
1727 } NanPublishResponse;
1728 
1729 /* Subscribe Response Message structure */
1730 typedef struct {
1731     u16 subscribe_id;
1732 } NanSubscribeResponse;
1733 
1734 /*
1735   Stats Response Message structure
1736   The Discovery Engine response to a request by the Host for statistics.
1737 */
1738 typedef struct {
1739     NanStatsType stats_type;
1740     union {
1741         NanPublishStats publish_stats;
1742         NanSubscribeStats subscribe_stats;
1743         NanMacStats mac_stats;
1744         NanSyncStats sync_stats;
1745         NanDeStats de_stats;
1746         NanDWStats dw_stats;
1747     } data;
1748 } NanStatsResponse;
1749 
1750 /* Response returned for Initiators Data request */
1751 typedef struct {
1752     /*
1753       Unique token Id generated on the initiator
1754       side used for a NDP session between two NAN devices
1755     */
1756     NanDataPathId ndp_instance_id;
1757 } NanDataPathRequestResponse;
1758 
1759 /*
1760   NAN Response messages
1761 */
1762 typedef struct {
1763     NanStatusType status; /* contains the result code */
1764     char nan_error[NAN_ERROR_STR_LEN]; /* Describe the NAN error type */
1765     NanResponseType response_type; /* NanResponseType Definitions */
1766     union {
1767         NanPublishResponse publish_response;
1768         NanSubscribeResponse subscribe_response;
1769         NanStatsResponse stats_response;
1770         NanDataPathRequestResponse data_request_response;
1771         NanCapabilities nan_capabilities;
1772     } body;
1773 } NanResponseMsg;
1774 
1775 /*
1776   Publish Replied Indication
1777   The PublishRepliedInd Message is sent by the DE when an Active Subscribe is
1778   received over the air and it matches a Solicited PublishServiceReq which had
1779   been created with the replied_event_flag set.
1780 */
1781 typedef struct {
1782     /*
1783        A 32 bit Requestor Instance Id which is sent to the Application.
1784        This Id will be sent in any subsequent UnmatchInd/FollowupInd
1785        messages
1786     */
1787     u32 requestor_instance_id;
1788     u8 addr[NAN_MAC_ADDR_LEN];
1789     /*
1790        If RSSI filtering was configured in NanPublishRequest then this
1791        field will contain the received RSSI value. 0 if not
1792     */
1793     u8 rssi_value;
1794 } NanPublishRepliedInd;
1795 
1796 /*
1797   Publish Terminated
1798   The PublishTerminatedInd message is sent by the DE whenever a Publish
1799   terminates from a user-specified timeout or a unrecoverable error in the DE.
1800 */
1801 typedef struct {
1802     /* Id returned during the initial Publish */
1803     u16 publish_id;
1804     /*
1805       For all user configured termination NAN_STATUS_SUCCESS
1806       and no other reasons expected from firmware.
1807     */
1808     NanStatusType reason;
1809     char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
1810 } NanPublishTerminatedInd;
1811 
1812 /*
1813   Match Indication
1814   The MatchInd message is sent once per responding MAC address whenever
1815   the Discovery Engine detects a match for a previous SubscribeServiceReq
1816   or PublishServiceReq.
1817 */
1818 typedef struct {
1819     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
1820     u16 publish_subscribe_id;
1821     /*
1822        A 32 bit Requestor Instance Id which is sent to the Application.
1823        This Id will be sent in any subsequent UnmatchInd/FollowupInd
1824        messages
1825     */
1826     u32 requestor_instance_id;
1827     u8 addr[NAN_MAC_ADDR_LEN];
1828 
1829     /*
1830        Sequence of octets which were received in a Discovery Frame matching the
1831        Subscribe Request.
1832     */
1833     u16 service_specific_info_len;
1834     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
1835 
1836     /*
1837        Ordered sequence of <length, value> pairs received in the Discovery Frame
1838        matching the Subscribe Request.
1839     */
1840     u16 sdf_match_filter_len;
1841     u8 sdf_match_filter[NAN_MAX_MATCH_FILTER_LEN];
1842 
1843     /*
1844        flag to indicate if the Match occurred in a Beacon Frame or in a
1845        Service Discovery Frame.
1846          0 - Match occured in a Service Discovery Frame
1847          1 - Match occured in a Beacon Frame
1848     */
1849     u8 match_occured_flag;
1850 
1851     /*
1852        flag to indicate FW is out of resource and that it can no longer
1853        track this Service Name. The Host still need to send the received
1854        Match_Handle but duplicate MatchInd messages may be received on
1855        this Handle until the resource frees up.
1856          0 - FW is caching this match
1857          1 - FW is unable to cache this match
1858     */
1859     u8 out_of_resource_flag;
1860 
1861     /*
1862        If RSSI filtering was configured in NanSubscribeRequest then this
1863        field will contain the received RSSI value. 0 if not.
1864        All rssi values should be specified without sign.
1865        For eg: -70dBm should be specified as 70.
1866     */
1867     u8 rssi_value;
1868 
1869     /*
1870        optional attributes. Each optional attribute is associated with a flag
1871        which specifies whether the attribute is valid or not
1872     */
1873     /* NAN Post Connectivity Capability received */
1874     u8 is_conn_capability_valid;
1875     NanReceivePostConnectivityCapability conn_capability;
1876 
1877     /* NAN Post Discover Capability */
1878     u8 num_rx_discovery_attr;
1879     NanReceivePostDiscovery discovery_attr[NAN_MAX_POSTDISCOVERY_LEN];
1880 
1881     /* NAN Further availability Map */
1882     u8 num_chans;
1883     NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS];
1884 
1885     /* NAN Cluster Attribute */
1886     u8 cluster_attribute_len;
1887     u8 cluster_attribute[NAN_MAX_CLUSTER_ATTRIBUTE_LEN];
1888 
1889     /* NAN Cipher Suite */
1890     u32 peer_cipher_type;
1891 
1892     /* Security Context Identifiers length */
1893     u32 scid_len;
1894     /*
1895        Security Context Identifier attribute contains PMKID
1896        shall be included in NDP setup and response messages.
1897        Security Context Identifier, Identifies the Security
1898        Context. For NAN Shared Key Cipher Suite, this field
1899        contains the 16 octet PMKID identifying the PMK used
1900        for setting up the Secure Data Path.
1901     */
1902     u8 scid[NAN_MAX_SCID_BUF_LEN];
1903 
1904     /* Peer service discovery extended attributes */
1905     NanSdeaCtrlParams peer_sdea_params;
1906 
1907     /*
1908       Ranging indication and NanMatchAlg are not tied.
1909       Ex: NanMatchAlg can indicate Match_ONCE, but ranging
1910       indications can be continuous. All ranging indications
1911       depend on SDEA control parameters of ranging required for
1912       continuous, and ingress/egress values in the ranging config.
1913       Ranging indication data is notified if:
1914       1) Ranging required is enabled in SDEA.
1915          range info notified continuous.
1916       2) if range_limit ingress/egress MASKS are enabled
1917          notify once for ingress >= ingress_distance
1918          and egress <= egress_distance, same for ingress_egress_both
1919       3) if the Awake DW intervals are higher than the ranging intervals,
1920          priority is given to the device DW intervalsi.
1921     */
1922     /*
1923       Range Info includes:
1924       1) distance to the NAN device with the MAC address indicated
1925          with ranged mac address.
1926       2) Ranging event matching the configuration of continuous/ingress/egress.
1927     */
1928     NanRangeInfo range_info;
1929 
1930     /*
1931        Sequence of values indicating the service specific info in SDEA
1932     */
1933     u16 sdea_service_specific_info_len;
1934     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
1935 } NanMatchInd;
1936 
1937 /*
1938   MatchExpired Indication
1939   The MatchExpiredInd message is sent whenever the Discovery Engine detects that
1940   a previously Matched Service has been gone for too long. If the previous
1941   MatchInd message for this Publish/Subscribe Id had the out_of_resource_flag
1942   set then this message will not be received
1943 */
1944 typedef struct {
1945     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
1946     u16 publish_subscribe_id;
1947     /*
1948        32 bit value sent by the DE in a previous
1949        MatchInd/FollowupInd to the application.
1950     */
1951     u32 requestor_instance_id;
1952 } NanMatchExpiredInd;
1953 
1954 /*
1955   Subscribe Terminated
1956   The SubscribeTerminatedInd message is sent by the DE whenever a
1957   Subscribe terminates from a user-specified timeout or a unrecoverable error in the DE.
1958 */
1959 typedef struct {
1960     /* Id returned during initial Subscribe */
1961     u16 subscribe_id;
1962     /*
1963       For all user configured termination NAN_STATUS_SUCCESS
1964       and no other reasons expected from firmware.
1965     */
1966     NanStatusType reason;
1967     char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
1968 } NanSubscribeTerminatedInd;
1969 
1970 /*
1971   Followup Indication Message
1972   The FollowupInd message is sent by the DE to the Host whenever it receives a
1973   Followup message from another peer.
1974 */
1975 typedef struct {
1976     /* Publish or Subscribe Id of an earlier Publish/Subscribe */
1977     u16 publish_subscribe_id;
1978     /*
1979        A 32 bit Requestor instance Id which is sent to the Application.
1980        This Id will be used in subsequent UnmatchInd/FollowupInd messages.
1981     */
1982     u32 requestor_instance_id;
1983     u8 addr[NAN_MAC_ADDR_LEN];
1984 
1985     /* Flag which the DE uses to decide if received in a DW or a FAW*/
1986     u8 dw_or_faw; /* 0=Received  in a DW, 1 = Received in a FAW*/
1987 
1988     /*
1989        Sequence of values which further specify the published service beyond
1990        the service name
1991     */
1992     u16 service_specific_info_len;
1993     u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
1994 
1995     /*
1996        Sequence of values indicating the service specific info in SDEA
1997     */
1998     u16 sdea_service_specific_info_len;
1999     u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
2000 } NanFollowupInd;
2001 
2002 /*
2003    Event data notifying the Mac address of the Discovery engine.
2004    which is reported as one of the Discovery engine event
2005 */
2006 typedef struct {
2007     u8 addr[NAN_MAC_ADDR_LEN];
2008 } NanMacAddressEvent;
2009 
2010 /*
2011    Event data notifying the Cluster address of the cluster
2012    which is reported as one of the Discovery engine event
2013 */
2014 typedef struct {
2015     u8 addr[NAN_MAC_ADDR_LEN];
2016 } NanClusterEvent;
2017 
2018 /*
2019   Discovery Engine Event Indication
2020   The Discovery Engine can inform the Host when significant events occur
2021   The data following the EventId is dependent upon the EventId type.
2022   In other words, each new event defined will carry a different
2023   structure of information back to the host.
2024 */
2025 typedef struct {
2026     NanDiscEngEventType event_type; /* NAN Protocol Event Codes */
2027     union {
2028         /*
2029            MacAddressEvent which will have 6 byte mac address
2030            of the Discovery engine.
2031         */
2032         NanMacAddressEvent mac_addr;
2033         /*
2034            Cluster Event Data which will be obtained when the
2035            device starts a new cluster or joins a cluster.
2036            The event data will have 6 byte octet string of the
2037            cluster started or joined.
2038         */
2039         NanClusterEvent cluster;
2040     } data;
2041 } NanDiscEngEventInd;
2042 
2043 /* Cluster size TCA event*/
2044 typedef struct {
2045     /* size of the cluster*/
2046     u32 cluster_size;
2047 } NanTcaClusterEvent;
2048 
2049 /*
2050   NAN TCA Indication
2051   The Discovery Engine can inform the Host when significant events occur.
2052   The data following the TcaId is dependent upon the TcaId type.
2053   In other words, each new event defined will carry a different structure
2054   of information back to the host.
2055 */
2056 typedef struct {
2057     NanTcaType tca_type;
2058     /* flag which defines if the configured Threshold has risen above the threshold */
2059     u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */
2060 
2061     /* flag which defines if the configured Threshold has fallen below the threshold */
2062     u8 falling_direction_evt_flag;/* 0 - no event, 1 - event */
2063     union {
2064         /*
2065            This event in obtained when the cluser size threshold
2066            is crossed. Event will have the cluster size
2067         */
2068         NanTcaClusterEvent cluster;
2069     } data;
2070 } NanTCAInd;
2071 
2072 /*
2073   NAN Disabled Indication
2074   The NanDisableInd message indicates to the upper layers that the Discovery
2075   Engine has flushed all state and has been shutdown.  When this message is received
2076   the DE is guaranteed to have left the NAN cluster it was part of and will have terminated
2077   any in progress Publishes or Subscribes.
2078 */
2079 typedef struct {
2080     /*
2081       Following reasons expected:
2082       NAN_STATUS_SUCCESS
2083       NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED
2084     */
2085     NanStatusType reason;
2086     char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
2087 } NanDisabledInd;
2088 
2089 /*
2090   NAN Beacon or SDF Payload Indication
2091   The NanBeaconSdfPayloadInd message indicates to the upper layers that information
2092   elements were received either in a Beacon or SDF which needs to be delivered
2093   outside of a Publish/Subscribe Handle.
2094 */
2095 typedef struct {
2096     /* The MAC address of the peer which sent the attributes.*/
2097     u8 addr[NAN_MAC_ADDR_LEN];
2098     /*
2099        Optional attributes. Each optional attribute is associated with a flag
2100        which specifies whether the attribute is valid or not
2101     */
2102     /* NAN Receive Vendor Specific Attribute*/
2103     u8 is_vsa_received;
2104     NanReceiveVendorSpecificAttribute vsa;
2105 
2106     /* NAN Beacon or SDF Payload Received*/
2107     u8 is_beacon_sdf_payload_received;
2108     NanBeaconSdfPayloadReceive data;
2109 } NanBeaconSdfPayloadInd;
2110 
2111 /*
2112   Event Indication notifying the
2113   transmit followup in progress
2114 */
2115 typedef struct {
2116    transaction_id id;
2117    /*
2118      Following reason codes returned:
2119      NAN_STATUS_SUCCESS
2120      NAN_STATUS_NO_OTA_ACK
2121      NAN_STATUS_PROTOCOL_FAILURE
2122    */
2123    NanStatusType reason;
2124    char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
2125 } NanTransmitFollowupInd;
2126 
2127 /*
2128   Data request Initiator/Responder
2129   app/service related info
2130 */
2131 typedef struct {
2132     u16 ndp_app_info_len;
2133     u8 ndp_app_info[NAN_DP_MAX_APP_INFO_LEN];
2134 } NanDataPathAppInfo;
2135 
2136 /* QoS configuration */
2137 typedef enum {
2138     NAN_DP_CONFIG_NO_QOS = 0,
2139     NAN_DP_CONFIG_QOS
2140 } NanDataPathQosCfg;
2141 
2142 /* Configuration params of Data request Initiator/Responder */
2143 typedef struct {
2144     /* Status Indicating Security/No Security */
2145     NanDataPathSecurityCfgStatus security_cfg;
2146     NanDataPathQosCfg qos_cfg;
2147 } NanDataPathCfg;
2148 
2149 /* Nan Data Path Initiator requesting a data session */
2150 typedef struct {
2151     /*
2152      Unique Instance Id identifying the Responder's service.
2153      This is same as publish_id notified on the subscribe side
2154      in a publish/subscribe scenario
2155     */
2156     u32 requestor_instance_id; /* Value 0 for no publish/subscribe */
2157 
2158     /* Config flag for channel request */
2159     NanDataPathChannelCfg channel_request_type;
2160     /* Channel frequency in MHz to start data-path */
2161     wifi_channel channel;
2162     /*
2163       Discovery MAC addr of the publisher/peer
2164     */
2165     u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
2166     /*
2167      Interface name on which this NDP session is to be started.
2168      This will be the same interface name provided during interface
2169      create.
2170     */
2171     char ndp_iface[IFNAMSIZ+1];
2172     /* Initiator/Responder Security/QoS configuration */
2173     NanDataPathCfg ndp_cfg;
2174     /* App/Service information of the Initiator */
2175     NanDataPathAppInfo app_info;
2176     /* NAN Cipher Suite Type */
2177     u32 cipher_type;
2178     /*
2179        Nan Security Key Info is optional in Discovery phase.
2180        PMK or passphrase info can be passed during
2181        the NDP session.
2182     */
2183     NanSecurityKeyInfo key_info;
2184     /* length of service name */
2185     u32 service_name_len;
2186     /*
2187        UTF-8 encoded string identifying the service name.
2188        The service name field is only used if a Nan discovery
2189        is not associated with the NDP (out-of-band discovery).
2190     */
2191     u8 service_name[NAN_MAX_SERVICE_NAME_LEN];
2192 } NanDataPathInitiatorRequest;
2193 
2194 /*
2195   Data struct to initiate a data response on the responder side
2196   for an indication received with a data request
2197 */
2198 typedef struct {
2199     /*
2200       Unique token Id generated on the initiator/responder
2201       side used for a NDP session between two NAN devices
2202     */
2203     NanDataPathId ndp_instance_id;
2204     /*
2205      Interface name on which this NDP session is to be started.
2206      This will be the same interface name provided during interface
2207      create.
2208     */
2209     char ndp_iface[IFNAMSIZ+1];
2210     /* Initiator/Responder Security/QoS configuration */
2211     NanDataPathCfg ndp_cfg;
2212     /* App/Service information of the responder */
2213     NanDataPathAppInfo app_info;
2214     /* Response Code indicating ACCEPT/REJECT/DEFER */
2215     NanDataPathResponseCode rsp_code;
2216     /* NAN Cipher Suite Type */
2217     u32 cipher_type;
2218     /*
2219        Nan Security Key Info is optional in Discovery phase.
2220        PMK or passphrase info can be passed during
2221        the NDP session.
2222     */
2223     NanSecurityKeyInfo key_info;
2224     /* length of service name */
2225     u32 service_name_len;
2226     /*
2227        UTF-8 encoded string identifying the service name.
2228        The service name field is only used if a Nan discovery
2229        is not associated with the NDP (out-of-band discovery).
2230     */
2231     u8 service_name[NAN_MAX_SERVICE_NAME_LEN];
2232 } NanDataPathIndicationResponse;
2233 
2234 /* NDP termination info */
2235 typedef struct {
2236     u8 num_ndp_instances;
2237     /*
2238       Unique token Id generated on the initiator/responder side
2239       used for a NDP session between two NAN devices
2240     */
2241     NanDataPathId ndp_instance_id[];
2242 } NanDataPathEndRequest;
2243 
2244 /*
2245   Event indication received on the
2246   responder side when a Nan Data request or
2247   NDP session is initiated on the Initiator side
2248 */
2249 typedef struct {
2250     /*
2251       Unique Instance Id corresponding to a service/session.
2252       This is similar to the publish_id generated on the
2253       publisher side
2254     */
2255     u16 service_instance_id;
2256     /* Discovery MAC addr of the peer/initiator */
2257     u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
2258     /*
2259       Unique token Id generated on the initiator/responder side
2260       used for a NDP session between two NAN devices
2261     */
2262     NanDataPathId ndp_instance_id;
2263     /* Initiator/Responder Security/QoS configuration */
2264     NanDataPathCfg ndp_cfg;
2265     /* App/Service information of the initiator */
2266     NanDataPathAppInfo app_info;
2267 } NanDataPathRequestInd;
2268 
2269 /*
2270  Event indication of data confirm is received on both
2271  initiator and responder side confirming a NDP session
2272 */
2273 typedef struct {
2274     /*
2275       Unique token Id generated on the initiator/responder side
2276       used for a NDP session between two NAN devices
2277     */
2278     NanDataPathId ndp_instance_id;
2279     /*
2280       NDI mac address of the peer
2281       (required to derive target ipv6 address)
2282     */
2283     u8 peer_ndi_mac_addr[NAN_MAC_ADDR_LEN];
2284     /* App/Service information of Initiator/Responder */
2285     NanDataPathAppInfo app_info;
2286     /* Response code indicating ACCEPT/REJECT/DEFER */
2287     NanDataPathResponseCode rsp_code;
2288     /*
2289       Reason code indicating the cause for REJECT.
2290       NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are
2291       expected reason codes.
2292     */
2293     NanStatusType reason_code;
2294     /* Number of channels for which info is indicated */
2295     u32 num_channels;
2296     /*
2297       Data indicating the Channel list and BW of the channel.
2298     */
2299     NanChannelInfo channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED];
2300 } NanDataPathConfirmInd;
2301 
2302 /*
2303  Event indication of schedule update is received on both
2304  initiator and responder when a schedule change occurs
2305 */
2306 typedef struct {
2307     /*
2308       NMI mac address
2309     */
2310     u8 peer_mac_addr[NAN_MAC_ADDR_LEN];
2311     /*
2312       Reason code indicating the cause of schedule update.
2313       BIT_0 NSS Update
2314       BIT_1 Channel list update
2315     */
2316     u32 schedule_update_reason_code;
2317     /* Number of channels for which info is indicated */
2318     u32 num_channels;
2319     /*
2320       Data indicating the Channel list and BW of the channel.
2321     */
2322     NanChannelInfo channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED];
2323     /* Number of NDP instance Ids */
2324     u8 num_ndp_instances;
2325     /*
2326       Unique token Id generated on the initiator/responder side
2327       used for a NDP session between two NAN devices
2328     */
2329     NanDataPathId ndp_instance_id[];
2330 } NanDataPathScheduleUpdateInd;
2331 
2332 /*
2333   Event indication received on the
2334   initiator/responder side terminating
2335   a NDP session
2336 */
2337 typedef struct {
2338     u8 num_ndp_instances;
2339     /*
2340       Unique token Id generated on the initiator/responder side
2341       used for a NDP session between two NAN devices
2342     */
2343     NanDataPathId ndp_instance_id[];
2344 } NanDataPathEndInd;
2345 
2346 /*
2347   Event indicating Range Request received on the
2348   Published side.
2349 */
2350 typedef struct {
2351     u16 publish_id;/* id is existing publish */
2352     /* Range Requestor's MAC address */
2353     u8 range_req_intf_addr[NAN_MAC_ADDR_LEN];
2354 } NanRangeRequestInd;
2355 
2356 /*
2357   Event indicating Range report on the
2358   Published side.
2359 */
2360 typedef struct {
2361     u16 publish_id;/* id is existing publish */
2362     /* Range Requestor's MAC address */
2363     u8 range_req_intf_addr[NAN_MAC_ADDR_LEN];
2364     /*
2365        Distance to the NAN device with the MAC address indicated
2366        with ranged mac address.
2367     */
2368     u32 range_measurement_mm;
2369 } NanRangeReportInd;
2370 
2371 /* Response and Event Callbacks */
2372 typedef struct {
2373     /* NotifyResponse invoked to notify the status of the Request */
2374     void (*NotifyResponse)(transaction_id id, NanResponseMsg* rsp_data);
2375     /* Callbacks for various Events */
2376     void (*EventPublishReplied)(NanPublishRepliedInd *event);
2377     void (*EventPublishTerminated)(NanPublishTerminatedInd* event);
2378     void (*EventMatch) (NanMatchInd* event);
2379     void (*EventMatchExpired) (NanMatchExpiredInd* event);
2380     void (*EventSubscribeTerminated) (NanSubscribeTerminatedInd* event);
2381     void (*EventFollowup) (NanFollowupInd* event);
2382     void (*EventDiscEngEvent) (NanDiscEngEventInd* event);
2383     void (*EventDisabled) (NanDisabledInd* event);
2384     void (*EventTca) (NanTCAInd* event);
2385     void (*EventBeaconSdfPayload) (NanBeaconSdfPayloadInd* event);
2386     void (*EventDataRequest)(NanDataPathRequestInd* event);
2387     void (*EventDataConfirm)(NanDataPathConfirmInd* event);
2388     void (*EventDataEnd)(NanDataPathEndInd* event);
2389     void (*EventTransmitFollowup) (NanTransmitFollowupInd* event);
2390     void (*EventRangeRequest) (NanRangeRequestInd* event);
2391     void (*EventRangeReport) (NanRangeReportInd* event);
2392     void (*EventScheduleUpdate)(NanDataPathScheduleUpdateInd* event);
2393 } NanCallbackHandler;
2394 
2395 /**@brief nan_enable_request
2396  *        Enable NAN functionality
2397  *
2398  * @param transaction_id:
2399  * @param wifi_interface_handle:
2400  * @param NanEnableRequest:
2401  * @return Synchronous wifi_error
2402  * @return Asynchronous NotifyResponse CB return
2403  *                      NAN_STATUS_SUCCESS
2404  *                      NAN_STATUS_ALREADY_ENABLED
2405  *                      NAN_STATUS_INVALID_PARAM
2406  *                      NAN_STATUS_INTERNAL_FAILURE
2407  *                      NAN_STATUS_PROTOCOL_FAILURE
2408  *                      NAN_STATUS_NAN_NOT_ALLOWED
2409  */
2410 wifi_error nan_enable_request(transaction_id id,
2411                               wifi_interface_handle iface,
2412                               NanEnableRequest* msg);
2413 
2414 /**@brief nan_disbale_request
2415  *        Disable NAN functionality.
2416  *
2417  * @param transaction_id:
2418  * @param wifi_interface_handle:
2419  * @param NanDisableRequest:
2420  * @return Synchronous wifi_error
2421  * @return Asynchronous NotifyResponse CB return
2422  *                      NAN_STATUS_SUCCESS
2423  *                      NAN_STATUS_PROTOCOL_FAILURE
2424  *
2425  */
2426 wifi_error nan_disable_request(transaction_id id,
2427                                wifi_interface_handle iface);
2428 
2429 /**@brief nan_publish_request
2430  *        Publish request to advertize a service
2431  *
2432  * @param transaction_id:
2433  * @param wifi_interface_handle:
2434  * @param NanPublishRequest:
2435  * @return Synchronous wifi_error
2436  * @return Asynchronous NotifyResponse CB return
2437  *                      NAN_STATUS_SUCCESS
2438  *                      NAN_STATUS_INVALID_PARAM
2439  *                      NAN_STATUS_PROTOCOL_FAILURE
2440  *                      NAN_STATUS_NO_RESOURCE_AVAILABLE
2441  *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
2442  */
2443 wifi_error nan_publish_request(transaction_id id,
2444                                wifi_interface_handle iface,
2445                                NanPublishRequest* msg);
2446 
2447 /**@brief nan_publish_cancel_request
2448  *        Cancel previous publish request
2449  *
2450  * @param transaction_id:
2451  * @param wifi_interface_handle:
2452  * @param NanPublishCancelRequest:
2453  * @return Synchronous wifi_error
2454  * @return Asynchronous NotifyResponse CB return
2455  *                      NAN_STATUS_SUCCESS
2456  *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
2457  *                      NAN_STATUS_INTERNAL_FAILURE
2458  */
2459 wifi_error nan_publish_cancel_request(transaction_id id,
2460                                       wifi_interface_handle iface,
2461                                       NanPublishCancelRequest* msg);
2462 
2463 /**@brief nan_subscribe_request
2464  *        Subscribe request to search for a service
2465  *
2466  * @param transaction_id:
2467  * @param wifi_interface_handle:
2468  * @param NanSubscribeRequest:
2469  * @return Synchronous wifi_error
2470  * @return Asynchronous NotifyResponse CB return
2471  *                      NAN_STATUS_SUCCESS
2472  *                      NAN_STATUS_INVALID_PARAM
2473  *                      NAN_STATUS_PROTOCOL_FAILURE
2474  *                      NAN_STATUS_INTERNAL_FAILURE
2475  *                      NAN_STATUS_NO_SPACE_AVAILABLE
2476  *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
2477  */
2478 wifi_error nan_subscribe_request(transaction_id id,
2479                                  wifi_interface_handle iface,
2480                                  NanSubscribeRequest* msg);
2481 
2482 /**@brief nan_subscribe_cancel_request
2483  *         Cancel previous subscribe requests.
2484  *
2485  * @param transaction_id:
2486  * @param wifi_interface_handle:
2487  * @param NanSubscribeRequest:
2488  * @return Synchronous wifi_error
2489  * @return Asynchronous NotifyResponse CB return
2490  *                      NAN_STATUS_SUCCESS
2491  *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
2492  *                      NAN_STATUS_INTERNAL_FAILURE
2493  */
2494 wifi_error nan_subscribe_cancel_request(transaction_id id,
2495                                         wifi_interface_handle iface,
2496                                         NanSubscribeCancelRequest* msg);
2497 
2498 /**@brief nan_transmit_followup_request
2499  *         NAN transmit follow up request
2500  *
2501  * @param transaction_id:
2502  * @param wifi_interface_handle:
2503  * @param NanTransmitFollowupRequest:
2504  * @return Synchronous wifi_error
2505  * @return Asynchronous NotifyResponse CB return
2506  *                      NAN_STATUS_SUCCESS
2507  *                      NAN_STATUS_INVALID_PARAM
2508  *                      NAN_STATUS_INTERNAL_FAILURE
2509  *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
2510  *                      NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID
2511  *                      NAN_STATUS_FOLLOWUP_QUEUE_FULL
2512  * @return Asynchronous TransmitFollowupInd CB return
2513  *                      NAN_STATUS_SUCCESS
2514  *                      NAN_STATUS_PROTOCOL_FAILURE
2515  *                      NAN_STATUS_NO_OTA_ACK
2516  */
2517 wifi_error nan_transmit_followup_request(transaction_id id,
2518                                          wifi_interface_handle iface,
2519                                          NanTransmitFollowupRequest* msg);
2520 
2521 /**@brief nan_stats_request
2522  *        Request NAN statistics from Discovery Engine.
2523  *
2524  * @param transaction_id:
2525  * @param wifi_interface_handle:
2526  * @param NanStatsRequest:
2527  * @return Synchronous wifi_error
2528  * @return Asynchronous NotifyResponse CB return
2529  *                      NAN_STATUS_SUCCESS
2530  *                      NAN_STATUS_INTERNAL_FAILURE
2531  *                      NAN_STATUS_INVALID_PARAM
2532  */
2533 wifi_error nan_stats_request(transaction_id id,
2534                              wifi_interface_handle iface,
2535                              NanStatsRequest* msg);
2536 
2537 /**@brief nan_config_request
2538  *        NAN configuration request.
2539  *
2540  * @param transaction_id:
2541  * @param wifi_interface_handle:
2542  * @param NanConfigRequest:
2543  * @return Synchronous wifi_error
2544  * @return Asynchronous NotifyResponse CB return
2545  *                      NAN_STATUS_SUCCESS
2546  *                      NAN_STATUS_INVALID_PARAM
2547  *                      NAN_STATUS_PROTOCOL_FAILURE
2548  *                      NAN_STATUS_INTERNAL_FAILURE
2549  */
2550 wifi_error nan_config_request(transaction_id id,
2551                               wifi_interface_handle iface,
2552                               NanConfigRequest* msg);
2553 
2554 /**@brief nan_tca_request
2555  *        Configure the various Threshold crossing alerts
2556  *
2557  * @param transaction_id:
2558  * @param wifi_interface_handle:
2559  * @param NanStatsRequest:
2560  * @return Synchronous wifi_error
2561  * @return Asynchronous NotifyResponse CB return
2562  *                      NAN_STATUS_SUCCESS
2563  *                      NAN_STATUS_INVALID_PARAM
2564  *                      NAN_STATUS_INTERNAL_FAILURE
2565  */
2566 wifi_error nan_tca_request(transaction_id id,
2567                            wifi_interface_handle iface,
2568                            NanTCARequest* msg);
2569 
2570 /**@brief nan_beacon_sdf_payload_request
2571  *        Set NAN Beacon or sdf payload to discovery engine.
2572  *          This instructs the Discovery Engine to begin publishing the
2573  *        received payload in any Beacon or Service Discovery Frame transmitted
2574  *
2575  * @param transaction_id:
2576  * @param wifi_interface_handle:
2577  * @param NanStatsRequest:
2578  * @return Synchronous wifi_error
2579  * @return Asynchronous NotifyResponse CB return
2580  *                      NAN_STATUS_SUCCESS
2581  *                      NAN_STATUS_INVALID_PARAM
2582  *                      NAN_STATUS_INTERNAL_FAILURE
2583  */
2584 wifi_error nan_beacon_sdf_payload_request(transaction_id id,
2585                                          wifi_interface_handle iface,
2586                                          NanBeaconSdfPayloadRequest* msg);
2587 
2588 /* Register NAN callbacks. */
2589 wifi_error nan_register_handler(wifi_interface_handle iface,
2590                                 NanCallbackHandler handlers);
2591 
2592 /*  Get NAN HAL version. */
2593 wifi_error nan_get_version(wifi_handle handle,
2594                            NanVersion* version);
2595 
2596 /**@brief nan_get_capabilities
2597  *        Get NAN Capabilities
2598  *
2599  * @param transaction_id:
2600  * @param wifi_interface_handle:
2601  * @return Synchronous wifi_error
2602  * @return Asynchronous NotifyResponse CB return
2603  *                      NAN_STATUS_SUCCESS
2604  */
2605 /*  Get NAN capabilities. */
2606 wifi_error nan_get_capabilities(transaction_id id,
2607                                 wifi_interface_handle iface);
2608 
2609 /* ========== Nan Data Path APIs ================ */
2610 /**@brief nan_data_interface_create
2611  *        Create NAN Data Interface.
2612  *
2613  * @param transaction_id:
2614  * @param wifi_interface_handle:
2615  * @param iface_name:
2616  * @return Synchronous wifi_error
2617  * @return Asynchronous NotifyResponse CB return
2618  *                      NAN_STATUS_SUCCESS
2619  *                      NAN_STATUS_INVALID_PARAM
2620  *                      NAN_STATUS_INTERNAL_FAILURE
2621  */
2622 wifi_error nan_data_interface_create(transaction_id id,
2623                                      wifi_interface_handle iface,
2624                                      char* iface_name);
2625 
2626 /**@brief nan_data_interface_delete
2627  *        Delete NAN Data Interface.
2628  *
2629  * @param transaction_id:
2630  * @param wifi_interface_handle:
2631  * @param iface_name:
2632  * @return Synchronous wifi_error
2633  * @return Asynchronous NotifyResponse CB return
2634  *                      NAN_STATUS_SUCCESS
2635  *                      NAN_STATUS_INVALID_PARAM
2636  *                      NAN_STATUS_INTERNAL_FAILURE
2637  */
2638 wifi_error nan_data_interface_delete(transaction_id id,
2639                                      wifi_interface_handle iface,
2640                                      char* iface_name);
2641 
2642 /**@brief nan_data_request_initiator
2643  *        Initiate a NAN Data Path session.
2644  *
2645  * @param transaction_id:
2646  * @param wifi_interface_handle:
2647  * @param NanDataPathInitiatorRequest:
2648  * @return Synchronous wifi_error
2649  * @return Asynchronous NotifyResponse CB return
2650  *                      NAN_STATUS_SUCCESS
2651  *                      NAN_STATUS_INVALID_PARAM
2652  *                      NAN_STATUS_INTERNAL_FAILURE
2653  *                      NAN_STATUS_PROTOCOL_FAILURE
2654  *                      NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID
2655  */
2656 wifi_error nan_data_request_initiator(transaction_id id,
2657                                       wifi_interface_handle iface,
2658                                       NanDataPathInitiatorRequest* msg);
2659 
2660 /**@brief nan_data_indication_response
2661  *         Response to a data indication received
2662  *         corresponding to a NDP session. An indication
2663  *         is received with a data request and the responder
2664  *         will send a data response
2665  *
2666  * @param transaction_id:
2667  * @param wifi_interface_handle:
2668  * @param NanDataPathIndicationResponse:
2669  * @return Synchronous wifi_error
2670  * @return Asynchronous NotifyResponse CB return
2671  *                      NAN_STATUS_SUCCESS
2672  *                      NAN_STATUS_INVALID_PARAM
2673  *                      NAN_STATUS_INTERNAL_FAILURE
2674  *                      NAN_STATUS_PROTOCOL_FAILURE
2675  *                      NAN_STATUS_INVALID_NDP_ID
2676  */
2677 wifi_error nan_data_indication_response(transaction_id id,
2678                                         wifi_interface_handle iface,
2679                                         NanDataPathIndicationResponse* msg);
2680 
2681 /**@brief nan_data_end
2682  *         NDL termination request: from either Initiator/Responder
2683  *
2684  * @param transaction_id:
2685  * @param wifi_interface_handle:
2686  * @param NanDataPathEndRequest:
2687  * @return Synchronous wifi_error
2688  * @return Asynchronous NotifyResponse CB return
2689  *                      NAN_STATUS_SUCCESS
2690  *                      NAN_STATUS_INVALID_PARAM
2691  *                      NAN_STATUS_INTERNAL_FAILURE
2692  *                      NAN_STATUS_PROTOCOL_FAILURE
2693  *                      NAN_STATUS_INVALID_NDP_ID
2694  */
2695 wifi_error nan_data_end(transaction_id id,
2696                         wifi_interface_handle iface,
2697                         NanDataPathEndRequest* msg);
2698 #ifdef __cplusplus
2699 }
2700 #endif /* __cplusplus */
2701 
2702 #endif /* __NAN_H__ */
2703