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