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