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