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 "wifi_hal.h" 21 22 #ifdef __cplusplus 23 extern "C" 24 { 25 #endif /* __cplusplus */ 26 27 /***************************************************************************** 28 * Neighbour Aware Network Service Structures and Functions 29 *****************************************************************************/ 30 31 /* 32 Definitions 33 All multi-byte fields within all NAN protocol stack messages are assumed to be in Little Endian order. 34 */ 35 36 typedef int NanVersion; 37 typedef u16 transaction_id; 38 39 #define NAN_MAC_ADDR_LEN 6 40 #define NAN_MAJOR_VERSION 2 41 #define NAN_MINOR_VERSION 0 42 #define NAN_MICRO_VERSION 0 43 #define NAN_MAX_SOCIAL_CHANNELS 3 44 45 /* NAN Maximum Lengths */ 46 #define NAN_MAX_SERVICE_NAME_LEN 255 47 #define NAN_MAX_MATCH_FILTER_LEN 255 48 #define NAN_MAX_SERVICE_SPECIFIC_INFO_LEN 1024 49 #define NAN_MAX_VSA_DATA_LEN 1024 50 #define NAN_MAX_MESH_DATA_LEN 32 51 #define NAN_MAX_INFRA_DATA_LEN 32 52 #define NAN_MAX_CLUSTER_ATTRIBUTE_LEN 255 53 #define NAN_MAX_SUBSCRIBE_MAX_ADDRESS 42 54 #define NAN_MAX_FAM_CHANNELS 32 55 #define NAN_MAX_POSTDISCOVERY_LEN 5 56 #define NAN_MAX_FRAME_DATA_LEN 504 57 58 /* 59 Definition of various NanResponseType 60 */ 61 typedef enum { 62 NAN_RESPONSE_ENABLED = 0, 63 NAN_RESPONSE_DISABLED = 1, 64 NAN_RESPONSE_PUBLISH = 2, 65 NAN_RESPONSE_PUBLISH_CANCEL = 3, 66 NAN_RESPONSE_TRANSMIT_FOLLOWUP = 4, 67 NAN_RESPONSE_SUBSCRIBE = 5, 68 NAN_RESPONSE_SUBSCRIBE_CANCEL = 6, 69 NAN_RESPONSE_STATS = 7, 70 NAN_RESPONSE_CONFIG = 8, 71 NAN_RESPONSE_TCA = 9, 72 NAN_RESPONSE_ERROR = 10, 73 NAN_RESPONSE_BEACON_SDF_PAYLOAD = 11, 74 NAN_GET_CAPABILITIES = 12 75 } NanResponseType; 76 77 /* NAN Publish Types */ 78 typedef enum { 79 NAN_PUBLISH_TYPE_UNSOLICITED = 0, 80 NAN_PUBLISH_TYPE_SOLICITED, 81 NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED 82 } NanPublishType; 83 84 /* NAN Transmit Priorities */ 85 typedef enum { 86 NAN_TX_PRIORITY_NORMAL = 0, 87 NAN_TX_PRIORITY_HIGH 88 } NanTxPriority; 89 90 /* NAN Statistics Request ID Codes */ 91 typedef enum { 92 NAN_STATS_ID_DE_PUBLISH = 0, 93 NAN_STATS_ID_DE_SUBSCRIBE, 94 NAN_STATS_ID_DE_MAC, 95 NAN_STATS_ID_DE_TIMING_SYNC, 96 NAN_STATS_ID_DE_DW, 97 NAN_STATS_ID_DE 98 } NanStatsType; 99 100 /* NAN Protocol Event ID Codes */ 101 typedef enum { 102 NAN_EVENT_ID_DISC_MAC_ADDR = 0, 103 NAN_EVENT_ID_STARTED_CLUSTER, 104 NAN_EVENT_ID_JOINED_CLUSTER 105 } NanDiscEngEventType; 106 107 /* TCA Type */ 108 typedef enum { 109 NAN_TCA_ID_CLUSTER_SIZE = 0 110 } NanTcaType; 111 112 /* 113 Various NAN Protocol Response code 114 */ 115 typedef enum { 116 /* NAN Protocol Response Codes */ 117 NAN_STATUS_SUCCESS = 0, 118 NAN_STATUS_TIMEOUT = 1, 119 NAN_STATUS_DE_FAILURE = 2, 120 NAN_STATUS_INVALID_MSG_VERSION = 3, 121 NAN_STATUS_INVALID_MSG_LEN = 4, 122 NAN_STATUS_INVALID_MSG_ID = 5, 123 NAN_STATUS_INVALID_HANDLE = 6, 124 NAN_STATUS_NO_SPACE_AVAILABLE = 7, 125 NAN_STATUS_INVALID_PUBLISH_TYPE = 8, 126 NAN_STATUS_INVALID_TX_TYPE = 9, 127 NAN_STATUS_INVALID_MATCH_ALGORITHM = 10, 128 NAN_STATUS_DISABLE_IN_PROGRESS = 11, 129 NAN_STATUS_INVALID_TLV_LEN = 12, 130 NAN_STATUS_INVALID_TLV_TYPE = 13, 131 NAN_STATUS_MISSING_TLV_TYPE = 14, 132 NAN_STATUS_INVALID_TOTAL_TLVS_LEN = 15, 133 NAN_STATUS_INVALID_MATCH_HANDLE= 16, 134 NAN_STATUS_INVALID_TLV_VALUE = 17, 135 NAN_STATUS_INVALID_TX_PRIORITY = 18, 136 NAN_STATUS_INVALID_CONNECTION_MAP = 19, 137 NAN_STATUS_INVALID_TCA_ID = 20, 138 NAN_STATUS_INVALID_STATS_ID = 21, 139 NAN_STATUS_NAN_NOT_ALLOWED = 22, 140 NAN_STATUS_NO_OTA_ACK = 23, 141 NAN_STATUS_TX_FAIL = 24, 142 /* 25-4095 Reserved */ 143 /* NAN Configuration Response codes */ 144 NAN_STATUS_INVALID_RSSI_CLOSE_VALUE = 4096, 145 NAN_STATUS_INVALID_RSSI_MIDDLE_VALUE = 4097, 146 NAN_STATUS_INVALID_HOP_COUNT_LIMIT = 4098, 147 NAN_STATUS_INVALID_MASTER_PREFERENCE_VALUE = 4099, 148 NAN_STATUS_INVALID_LOW_CLUSTER_ID_VALUE = 4100, 149 NAN_STATUS_INVALID_HIGH_CLUSTER_ID_VALUE = 4101, 150 NAN_STATUS_INVALID_BACKGROUND_SCAN_PERIOD = 4102, 151 NAN_STATUS_INVALID_RSSI_PROXIMITY_VALUE = 4103, 152 NAN_STATUS_INVALID_SCAN_CHANNEL = 4104, 153 NAN_STATUS_INVALID_POST_NAN_CONNECTIVITY_CAPABILITIES_BITMAP = 4105, 154 NAN_STATUS_INVALID_FURTHER_AVAILABILITY_MAP_NUMCHAN_VALUE = 4106, 155 NAN_STATUS_INVALID_FURTHER_AVAILABILITY_MAP_DURATION_VALUE = 4107, 156 NAN_STATUS_INVALID_FURTHER_AVAILABILITY_MAP_CLASS_VALUE = 4108, 157 NAN_STATUS_INVALID_FURTHER_AVAILABILITY_MAP_CHANNEL_VALUE = 4109, 158 NAN_STATUS_INVALID_FURTHER_AVAILABILITY_MAP_AVAILABILITY_INTERVAL_BITMAP_VALUE = 4110, 159 NAN_STATUS_INVALID_FURTHER_AVAILABILITY_MAP_MAP_ID = 4111, 160 NAN_STATUS_INVALID_POST_NAN_DISCOVERY_CONN_TYPE_VALUE = 4112, 161 NAN_STATUS_INVALID_POST_NAN_DISCOVERY_DEVICE_ROLE_VALUE = 4113, 162 NAN_STATUS_INVALID_POST_NAN_DISCOVERY_DURATION_VALUE = 4114, 163 NAN_STATUS_INVALID_POST_NAN_DISCOVERY_BITMAP_VALUE = 4115, 164 NAN_STATUS_MISSING_FUTHER_AVAILABILITY_MAP = 4116, 165 NAN_STATUS_INVALID_BAND_CONFIG_FLAGS = 4117, 166 NAN_STATUS_INVALID_RANDOM_FACTOR_UPDATE_TIME_VALUE = 4118, 167 NAN_STATUS_INVALID_ONGOING_SCAN_PERIOD = 4119, 168 NAN_STATUS_INVALID_DW_INTERVAL_VALUE = 4120, 169 NAN_STATUS_INVALID_DB_INTERVAL_VALUE = 4121, 170 /* 4122-8191 RESERVED */ 171 NAN_TERMINATED_REASON_INVALID = 8192, 172 NAN_TERMINATED_REASON_TIMEOUT = 8193, 173 NAN_TERMINATED_REASON_USER_REQUEST = 8194, 174 NAN_TERMINATED_REASON_FAILURE = 8195, 175 NAN_TERMINATED_REASON_COUNT_REACHED = 8196, 176 NAN_TERMINATED_REASON_DE_SHUTDOWN = 8197, 177 NAN_TERMINATED_REASON_DISABLE_IN_PROGRESS = 8198, 178 NAN_TERMINATED_REASON_POST_DISC_ATTR_EXPIRED = 8199, 179 NAN_TERMINATED_REASON_POST_DISC_LEN_EXCEEDED = 8200, 180 NAN_TERMINATED_REASON_FURTHER_AVAIL_MAP_EMPTY = 8201 181 } NanStatusType; 182 183 /* NAN Transmit Types */ 184 typedef enum { 185 NAN_TX_TYPE_BROADCAST = 0, 186 NAN_TX_TYPE_UNICAST 187 } NanTxType; 188 189 /* NAN Subscribe Type */ 190 typedef enum { 191 NAN_SUBSCRIBE_TYPE_PASSIVE = 0, 192 NAN_SUBSCRIBE_TYPE_ACTIVE 193 } NanSubscribeType; 194 195 /* NAN Service Response Filter Attribute Bit */ 196 typedef enum { 197 NAN_SRF_ATTR_BLOOM_FILTER = 0, 198 NAN_SRF_ATTR_PARTIAL_MAC_ADDR 199 } NanSRFType; 200 201 /* NAN Service Response Filter Include Bit */ 202 typedef enum { 203 NAN_SRF_INCLUDE_DO_NOT_RESPOND = 0, 204 NAN_SRF_INCLUDE_RESPOND 205 } NanSRFIncludeType; 206 207 /* NAN Match indication type */ 208 typedef enum { 209 NAN_MATCH_ALG_MATCH_ONCE = 0, 210 NAN_MATCH_ALG_MATCH_CONTINUOUS, 211 NAN_MATCH_ALG_MATCH_NEVER 212 } NanMatchAlg; 213 214 /* NAN Transmit Window Type */ 215 typedef enum { 216 NAN_TRANSMIT_IN_DW = 0, 217 NAN_TRANSMIT_IN_FAW 218 } NanTransmitWindowType; 219 220 /* NAN SRF State in Subscribe */ 221 typedef enum { 222 NAN_USE_SRF = 0, 223 NAN_DO_NOT_USE_SRF 224 } NanSRFState; 225 226 /* NAN Include SSI in MatchInd */ 227 typedef enum { 228 NAN_SSI_NOT_REQUIRED_IN_MATCH_IND = 0, 229 NAN_SSI_REQUIRED_IN_MATCH_IND 230 } NanSsiInMatchInd; 231 232 /* Nan/NDP Capabilites info */ 233 typedef struct { 234 u32 max_concurrent_nan_clusters; 235 u32 max_publishes; 236 u32 max_subscribes; 237 u32 max_service_name_len; 238 u32 max_match_filter_len; 239 u32 max_total_match_filter_len; 240 u32 max_service_specific_info_len; 241 u32 max_vsa_data_len; 242 u32 max_mesh_data_len; 243 u32 max_ndi_interfaces; 244 u32 max_ndp_sessions; 245 u32 max_app_info_len; 246 } NanCapabilities; 247 248 /* 249 Host can send Vendor specific attributes which the Discovery Engine can 250 enclose in Beacons and/or Service Discovery frames transmitted. 251 Below structure is used to populate that. 252 */ 253 typedef struct { 254 /* 255 0 = transmit only in the next discovery window 256 1 = transmit in next 16 discovery window 257 */ 258 u8 payload_transmit_flag; 259 /* 260 Below flags will determine in which all frames 261 the vendor specific attributes should be included 262 */ 263 u8 tx_in_discovery_beacon; 264 u8 tx_in_sync_beacon; 265 u8 tx_in_service_discovery; 266 /* Organizationally Unique Identifier */ 267 u32 vendor_oui; 268 /* 269 vendor specific attribute to be transmitted 270 vsa_len : Length of the vsa data. 271 */ 272 u32 vsa_len; 273 u8 vsa[NAN_MAX_VSA_DATA_LEN]; 274 } NanTransmitVendorSpecificAttribute; 275 276 277 /* 278 Discovery Engine will forward any Vendor Specific Attributes 279 which it received as part of this structure. 280 */ 281 /* Mask to determine on which frames attribute was received */ 282 #define RX_DISCOVERY_BEACON_MASK 0x01 283 #define RX_SYNC_BEACON_MASK 0x02 284 #define RX_SERVICE_DISCOVERY_MASK 0x04 285 typedef struct { 286 /* 287 Frames on which this vendor specific attribute 288 was received. Mask defined above 289 */ 290 u8 vsa_received_on; 291 /* Organizationally Unique Identifier */ 292 u32 vendor_oui; 293 /* vendor specific attribute */ 294 u32 attr_len; 295 u8 vsa[NAN_MAX_VSA_DATA_LEN]; 296 } NanReceiveVendorSpecificAttribute; 297 298 /* 299 NAN Beacon SDF Payload Received structure 300 Discovery engine sends the details of received Beacon or 301 Service Discovery Frames as part of this structure. 302 */ 303 typedef struct { 304 /* Frame data */ 305 u32 frame_len; 306 u8 frame_data[NAN_MAX_FRAME_DATA_LEN]; 307 } NanBeaconSdfPayloadReceive; 308 309 /* 310 Host can set the Periodic scan parameters for each of the 311 3(6, 44, 149) Social channels. Only these channels are allowed 312 any other channels are rejected 313 */ 314 typedef enum { 315 NAN_CHANNEL_24G_BAND = 0, 316 NAN_CHANNEL_5G_BAND_LOW, 317 NAN_CHANNEL_5G_BAND_HIGH 318 } NanChannelIndex; 319 320 /* 321 Structure to set the Social Channel Scan parameters 322 passed as part of NanEnableRequest/NanConfigRequest 323 */ 324 typedef struct { 325 /* 326 Dwell time of each social channel in milliseconds 327 NanChannelIndex corresponds to the respective channel 328 If time set to 0 then the FW default time will be used. 329 */ 330 u8 dwell_time[NAN_MAX_SOCIAL_CHANNELS]; 331 332 /* 333 Scan period of each social channel in seconds 334 NanChannelIndex corresponds to the respective channel 335 If time set to 0 then the FW default time will be used. 336 */ 337 u16 scan_period[NAN_MAX_SOCIAL_CHANNELS]; 338 } NanSocialChannelScanParams; 339 340 /* 341 Host can send Post Connectivity Capability attributes 342 to be included in Service Discovery frames transmitted 343 as part of this structure. 344 */ 345 typedef struct { 346 /* 347 0 = transmit only in the next discovery window 348 1 = transmit in next 16 discovery window 349 */ 350 u8 payload_transmit_flag; 351 /* 1 - Wifi Direct supported 0 - Not supported */ 352 u8 is_wfd_supported; 353 /* 1 - Wifi Direct Services supported 0 - Not supported */ 354 u8 is_wfds_supported; 355 /* 1 - TDLS supported 0 - Not supported */ 356 u8 is_tdls_supported; 357 /* 1 - IBSS supported 0 - Not supported */ 358 u8 is_ibss_supported; 359 /* 1 - Mesh supported 0 - Not supported */ 360 u8 is_mesh_supported; 361 /* 362 1 - NAN Device currently connect to WLAN Infra AP 363 0 - otherwise 364 */ 365 u8 wlan_infra_field; 366 } NanTransmitPostConnectivityCapability; 367 368 /* 369 Discovery engine providing the post connectivity capability 370 received. 371 */ 372 typedef struct { 373 /* 1 - Wifi Direct supported 0 - Not supported */ 374 u8 is_wfd_supported; 375 /* 1 - Wifi Direct Services supported 0 - Not supported */ 376 u8 is_wfds_supported; 377 /* 1 - TDLS supported 0 - Not supported */ 378 u8 is_tdls_supported; 379 /* 1 - IBSS supported 0 - Not supported */ 380 u8 is_ibss_supported; 381 /* 1 - Mesh supported 0 - Not supported */ 382 u8 is_mesh_supported; 383 /* 384 1 - NAN Device currently connect to WLAN Infra AP 385 0 - otherwise 386 */ 387 u8 wlan_infra_field; 388 } NanReceivePostConnectivityCapability; 389 390 /* 391 Indicates the availability interval duration associated with the 392 Availability Intervals Bitmap field 393 */ 394 typedef enum { 395 NAN_DURATION_16MS = 0, 396 NAN_DURATION_32MS = 1, 397 NAN_DURATION_64MS = 2 398 } NanAvailDuration; 399 400 /* Further availability per channel information */ 401 typedef struct { 402 /* Defined above */ 403 NanAvailDuration entry_control; 404 /* 405 1 byte field indicating the frequency band the NAN Device 406 will be available as defined in IEEE Std. 802.11-2012 407 Annex E Table E-4 Global Operating Classes 408 */ 409 u8 class_val; 410 /* 411 1 byte field indicating the channel the NAN Device 412 will be available. 413 */ 414 u8 channel; 415 /* 416 Map Id - 4 bit field which identifies the Further 417 availability map attribute. 418 */ 419 u8 mapid; 420 /* 421 divides the time between the beginnings of consecutive Discovery 422 Windows of a given NAN cluster into consecutive time intervals 423 of equal durations. The time interval duration is specified by 424 the Availability Interval Duration subfield of the Entry Control 425 field. 426 427 A Nan device that sets the i-th bit of the Availability 428 Intervals Bitmap to 1 shall be present during the corresponding 429 i-th time interval in the operation channel indicated by the 430 Operating Class and Channel Number fields in the same Availability Entry. 431 432 A Nan device that sets the i-th bit of the Availability Intervals Bitmap to 433 0 may be present during the corresponding i-th time interval in the operation 434 channel indicated by the Operating Class and Channel Number fields in the same 435 Availability Entry. 436 437 The size of the Bitmap is dependent upon the Availability Interval Duration 438 chosen in the Entry Control Field. The size can be either 1, 2 or 4 bytes long 439 440 - Duration field is equal to 0, only AIB[0] is valid 441 - Duration field is equal to 1, only AIB [0] and AIB [1] is valid 442 - Duration field is equal to 2, AIB [0], AIB [1], AIB [2] and AIB [3] are valid 443 */ 444 u32 avail_interval_bitmap; 445 } NanFurtherAvailabilityChannel; 446 447 /* 448 Further availability map which can be sent and received from 449 Discovery engine 450 */ 451 typedef struct { 452 /* 453 Number of channels indicates the number of channel 454 entries which is part of fam 455 */ 456 u8 numchans; 457 NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS]; 458 } NanFurtherAvailabilityMap; 459 460 /* 461 Host can send Post-Nan Discovery attributes which the Discovery Engine can 462 enclose in Service Discovery frames 463 */ 464 /* Possible connection types in Post NAN Discovery attributes */ 465 typedef enum { 466 NAN_CONN_WLAN_INFRA = 0, 467 NAN_CONN_P2P_OPER = 1, 468 NAN_CONN_WLAN_IBSS = 2, 469 NAN_CONN_WLAN_MESH = 3, 470 NAN_CONN_FURTHER_SERVICE_AVAILABILITY = 4, 471 NAN_CONN_WLAN_RANGING = 5 472 } NanConnectionType; 473 474 /* Possible device roles in Post NAN Discovery attributes */ 475 typedef enum { 476 NAN_WLAN_INFRA_AP = 0, 477 NAN_WLAN_INFRA_STA = 1, 478 NAN_P2P_OPER_GO = 2, 479 NAN_P2P_OPER_DEV = 3, 480 NAN_P2P_OPER_CLI = 4 481 } NanDeviceRole; 482 483 /* Structure of Post NAN Discovery attribute */ 484 typedef struct { 485 /* Connection type of the host */ 486 NanConnectionType type; 487 /* 488 Device role of the host based on 489 the connection type 490 */ 491 NanDeviceRole role; 492 /* 493 Flag to send the information as a single shot or repeated 494 for next 16 discovery windows 495 0 - Single_shot 496 1 - next 16 discovery windows 497 */ 498 u8 transmit_freq; 499 /* Duration of the availability bitmask */ 500 NanAvailDuration duration; 501 /* Availability interval bitmap based on duration */ 502 u32 avail_interval_bitmap; 503 /* 504 Mac address depending on the conn type and device role 505 -------------------------------------------------- 506 | Conn Type | Device Role | Mac address Usage | 507 -------------------------------------------------- 508 | WLAN_INFRA | AP/STA | BSSID of the AP | 509 -------------------------------------------------- 510 | P2P_OPER | GO | GO's address | 511 -------------------------------------------------- 512 | P2P_OPER | P2P_DEVICE | Address of who | 513 | | | would become GO | 514 -------------------------------------------------- 515 | WLAN_IBSS | NA | BSSID | 516 -------------------------------------------------- 517 | WLAN_MESH | NA | BSSID | 518 -------------------------------------------------- 519 */ 520 u8 addr[NAN_MAC_ADDR_LEN]; 521 /* 522 Mandatory mesh id value if connection type is WLAN_MESH 523 Mesh id contains 0-32 octet identifier and should be 524 as per IEEE Std.802.11-2012 spec. 525 */ 526 u16 mesh_id_len; 527 u8 mesh_id[NAN_MAX_MESH_DATA_LEN]; 528 /* 529 Optional infrastructure SSID if conn_type is set to 530 NAN_CONN_WLAN_INFRA 531 */ 532 u16 infrastructure_ssid_len; 533 u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN]; 534 } NanTransmitPostDiscovery; 535 536 /* 537 Discovery engine providing the structure of Post NAN 538 Discovery 539 */ 540 typedef struct { 541 /* Connection type of the host */ 542 NanConnectionType type; 543 /* 544 Device role of the host based on 545 the connection type 546 */ 547 NanDeviceRole role; 548 /* Duration of the availability bitmask */ 549 NanAvailDuration duration; 550 /* Availability interval bitmap based on duration */ 551 u32 avail_interval_bitmap; 552 /* 553 Map Id - 4 bit field which identifies the Further 554 availability map attribute. 555 */ 556 u8 mapid; 557 /* 558 Mac address depending on the conn type and device role 559 -------------------------------------------------- 560 | Conn Type | Device Role | Mac address Usage | 561 -------------------------------------------------- 562 | WLAN_INFRA | AP/STA | BSSID of the AP | 563 -------------------------------------------------- 564 | P2P_OPER | GO | GO's address | 565 -------------------------------------------------- 566 | P2P_OPER | P2P_DEVICE | Address of who | 567 | | | would become GO | 568 -------------------------------------------------- 569 | WLAN_IBSS | NA | BSSID | 570 -------------------------------------------------- 571 | WLAN_MESH | NA | BSSID | 572 -------------------------------------------------- 573 */ 574 u8 addr[NAN_MAC_ADDR_LEN]; 575 /* 576 Mandatory mesh id value if connection type is WLAN_MESH 577 Mesh id contains 0-32 octet identifier and should be 578 as per IEEE Std.802.11-2012 spec. 579 */ 580 u16 mesh_id_len; 581 u8 mesh_id[NAN_MAX_MESH_DATA_LEN]; 582 /* 583 Optional infrastructure SSID if conn_type is set to 584 NAN_CONN_WLAN_INFRA 585 */ 586 u16 infrastructure_ssid_len; 587 u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN]; 588 } NanReceivePostDiscovery; 589 590 /* 591 Enable Request Message Structure 592 The NanEnableReq message instructs the Discovery Engine to enter an operational state 593 */ 594 typedef struct { 595 /* Mandatory parameters below */ 596 u8 master_pref; 597 /* 598 A cluster_low value matching cluster_high indicates a request to join 599 a cluster with that value. If the requested cluster is not found the 600 device will start its own cluster. 601 */ 602 u16 cluster_low; 603 u16 cluster_high; 604 605 /* 606 Optional configuration of Enable request. 607 Each of the optional parameters have configure flag which 608 determine whether configuration is to be passed or not. 609 */ 610 u8 config_support_5g; 611 u8 support_5g_val; 612 /* 613 BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons 614 0 - Do not include SIDs in any beacons 615 1 - Include SIDs in all beacons. 616 Rest 7 bits are count field which allows control over the number of SIDs 617 included in the Beacon. 0 means to include as many SIDs that fit into 618 the maximum allow Beacon frame size 619 */ 620 u8 config_sid_beacon; 621 u8 sid_beacon_val; 622 /* 623 The rssi values below should be specified without sign. 624 For eg: -70dBm should be specified as 70. 625 */ 626 u8 config_2dot4g_rssi_close; 627 u8 rssi_close_2dot4g_val; 628 629 u8 config_2dot4g_rssi_middle; 630 u8 rssi_middle_2dot4g_val; 631 632 u8 config_2dot4g_rssi_proximity; 633 u8 rssi_proximity_2dot4g_val; 634 635 u8 config_hop_count_limit; 636 u8 hop_count_limit_val; 637 638 /* 639 Defines 2.4G channel access support 640 0 - No Support 641 1 - Supported 642 */ 643 u8 config_2dot4g_support; 644 u8 support_2dot4g_val; 645 /* 646 Defines 2.4G channels will be used for sync/discovery beacons 647 0 - 2.4G channels not used for beacons 648 1 - 2.4G channels used for beacons 649 */ 650 u8 config_2dot4g_beacons; 651 u8 beacon_2dot4g_val; 652 /* 653 Defines 2.4G channels will be used for Service Discovery frames 654 0 - 2.4G channels not used for Service Discovery frames 655 1 - 2.4G channels used for Service Discovery frames 656 */ 657 u8 config_2dot4g_sdf; 658 u8 sdf_2dot4g_val; 659 /* 660 Defines 5G channels will be used for sync/discovery beacons 661 0 - 5G channels not used for beacons 662 1 - 5G channels used for beacons 663 */ 664 u8 config_5g_beacons; 665 u8 beacon_5g_val; 666 /* 667 Defines 5G channels will be used for Service Discovery frames 668 0 - 5G channels not used for Service Discovery frames 669 1 - 5G channels used for Service Discovery frames 670 */ 671 u8 config_5g_sdf; 672 u8 sdf_5g_val; 673 /* 674 1 byte value which defines the RSSI in 675 dBm for a close by Peer in 5 Ghz channels. 676 The rssi values should be specified without sign. 677 For eg: -70dBm should be specified as 70. 678 */ 679 u8 config_5g_rssi_close; 680 u8 rssi_close_5g_val; 681 /* 682 1 byte value which defines the RSSI value in 683 dBm for a close by Peer in 5 Ghz channels. 684 The rssi values should be specified without sign. 685 For eg: -70dBm should be specified as 70. 686 687 */ 688 u8 config_5g_rssi_middle; 689 u8 rssi_middle_5g_val; 690 /* 691 1 byte value which defines the RSSI filter 692 threshold. Any Service Descriptors received above this 693 value that are configured for RSSI filtering will be dropped. 694 The rssi values should be specified without sign. 695 For eg: -70dBm should be specified as 70. 696 */ 697 u8 config_5g_rssi_close_proximity; 698 u8 rssi_close_proximity_5g_val; 699 /* 700 1 byte quantity which defines the window size over 701 which the �average RSSI� will be calculated over. 702 */ 703 u8 config_rssi_window_size; 704 u8 rssi_window_size_val; 705 /* 706 The 24 bit Organizationally Unique ID + the 8 bit Network Id. 707 */ 708 u8 config_oui; 709 u32 oui_val; 710 /* 711 NAN Interface Address, If not configured the Discovery Engine 712 will generate a 6 byte Random MAC. 713 */ 714 u8 config_intf_addr; 715 u8 intf_addr_val[NAN_MAC_ADDR_LEN]; 716 /* 717 If set to 1, the Discovery Engine will enclose the Cluster 718 Attribute only sent in Beacons in a Vendor Specific Attribute 719 and transmit in a Service Descriptor Frame. 720 */ 721 u8 config_cluster_attribute_val; 722 /* 723 The periodicity in seconds between full scan�s to find any new 724 clusters available in the area. A Full scan should not be done 725 more than every 10 seconds and should not be done less than every 726 30 seconds. 727 */ 728 u8 config_scan_params; 729 NanSocialChannelScanParams scan_params_val; 730 /* 731 1 byte quantity which forces the Random Factor to a particular 732 value for all transmitted Sync/Discovery beacons 733 */ 734 u8 config_random_factor_force; 735 u8 random_factor_force_val; 736 /* 737 1 byte quantity which forces the HC for all transmitted Sync and 738 Discovery Beacon NO matter the real HC being received over the 739 air. 740 */ 741 u8 config_hop_count_force; 742 u8 hop_count_force_val; 743 744 /* channel frequency in MHz to enable Nan on */ 745 u8 config_24g_channel; 746 wifi_channel channel_24g_val; 747 748 u8 config_5g_channel; 749 wifi_channel channel_5g_val; 750 } NanEnableRequest; 751 752 /* 753 Publish Msg Structure 754 Message is used to request the DE to publish the Service Name 755 using the parameters passed into the Discovery Window 756 */ 757 typedef struct { 758 u16 publish_id;/* id 0 means new publish, any other id is existing publish */ 759 u16 ttl; /* how many seconds to run for. 0 means forever until canceled */ 760 u16 period; /* periodicity of OTA unsolicited publish. Specified in increments of 500 ms */ 761 NanPublishType publish_type;/* 0= unsolicited, solicited = 1, 2= both */ 762 NanTxType tx_type; /* 0 = broadcast, 1= unicast if solicited publish */ 763 u8 publish_count; /* number of OTA Publish, 0 means forever until canceled */ 764 u16 service_name_len; /* length of service name */ 765 u8 service_name[NAN_MAX_SERVICE_NAME_LEN];/* UTF-8 encoded string identifying the service */ 766 /* 767 Field which specifies how the matching indication to host is controlled. 768 0 - Match and Indicate Once 769 1 - Match and Indicate continuous 770 2 - Match and Indicate never. This means don't indicate the match to the host. 771 3 - Reserved 772 */ 773 NanMatchAlg publish_match_indicator; 774 775 /* 776 Sequence of values 777 NAN Device that has invoked a Subscribe method corresponding to this Publish method 778 */ 779 u16 service_specific_info_len; 780 u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; 781 782 /* 783 Ordered sequence of <length, value> pairs which specify further response conditions 784 beyond the service name used to filter subscribe messages to respond to. 785 This is only needed when the PT is set to NAN_SOLICITED or NAN_SOLICITED_UNSOLICITED. 786 */ 787 u16 rx_match_filter_len; 788 u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; 789 790 /* 791 Ordered sequence of <length, value> pairs to be included in the Discovery Frame. 792 If present it is always sent in a Discovery Frame 793 */ 794 u16 tx_match_filter_len; 795 u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; 796 797 /* 798 flag which specifies that the Publish should use the configured RSSI 799 threshold and the received RSSI in order to filter requests 800 0 � ignore the configured RSSI threshold when running a Service 801 Descriptor attribute or Service ID List Attribute through the DE matching logic. 802 1 � use the configured RSSI threshold when running a Service 803 Descriptor attribute or Service ID List Attribute through the DE matching logic. 804 805 */ 806 u8 rssi_threshold_flag; 807 808 /* 809 8-bit bitmap which allows the Host to associate this publish 810 with a particular Post-NAN Connectivity attribute 811 which has been sent down in a NanConfigureRequest/NanEnableRequest 812 message. If the DE fails to find a configured Post-NAN 813 connectivity attributes referenced by the bitmap, 814 the DE will return an error code to the Host. 815 If the Publish is configured to use a Post-NAN Connectivity 816 attribute and the Host does not refresh the Post-NAN Connectivity 817 attribute the Publish will be canceled and the Host will be sent 818 a PublishTerminatedIndication message. 819 */ 820 u8 connmap; 821 /* 822 Set/Enable corresponding bits to disable any indications that follow a publish. 823 BIT0 - Disable publish termination indication. 824 BIT1 - Disable match expired indication. 825 BIT2 - Disable followUp indication received (OTA). 826 */ 827 u8 recv_indication_cfg; 828 } NanPublishRequest; 829 830 /* 831 Publish Cancel Msg Structure 832 The PublishServiceCancelReq Message is used to request the DE to stop publishing 833 the Service Name identified by the Publish Id in the message. 834 */ 835 typedef struct { 836 u16 publish_id; 837 } NanPublishCancelRequest; 838 839 /* 840 NAN Subscribe Structure 841 The SubscribeServiceReq message is sent to the Discovery Engine 842 whenever the Upper layers would like to listen for a Service Name 843 */ 844 typedef struct { 845 u16 subscribe_id; /* id 0 means new subscribe, non zero is existing subscribe */ 846 u16 ttl; /* how many seconds to run for. 0 means forever until canceled */ 847 u16 period;/* periodicity of OTA Active Subscribe. Units in increments of 500 ms , 0 = attempt every DW*/ 848 849 /* Flag which specifies how the Subscribe request shall be processed. */ 850 NanSubscribeType subscribe_type; /* 0 - PASSIVE , 1- ACTIVE */ 851 852 /* Flag which specifies on Active Subscribes how the Service Response Filter attribute is populated.*/ 853 NanSRFType serviceResponseFilter; /* 0 - Bloom Filter, 1 - MAC Addr */ 854 855 /* Flag which specifies how the Service Response Filter Include bit is populated.*/ 856 NanSRFIncludeType serviceResponseInclude; /* 0=Do not respond if in the Address Set, 1= Respond */ 857 858 /* Flag which specifies if the Service Response Filter should be used when creating Subscribes.*/ 859 NanSRFState useServiceResponseFilter; /* 0=Do not send the Service Response Filter,1= send */ 860 861 /* 862 Flag which specifies if the Service Specific Info is needed in 863 the Publish message before creating the MatchIndication 864 */ 865 NanSsiInMatchInd ssiRequiredForMatchIndication; /* 0=Not needed, 1= Required */ 866 867 /* 868 Field which specifies how the matching indication to host is controlled. 869 0 - Match and Indicate Once 870 1 - Match and Indicate continuous 871 2 - Match and Indicate never. This means don't indicate the match to the host. 872 3 - Reserved 873 */ 874 NanMatchAlg subscribe_match_indicator; 875 876 /* 877 The number of Subscribe Matches which should occur 878 before the Subscribe request is automatically terminated. 879 */ 880 u8 subscribe_count; /* If this value is 0 this field is not used by the DE.*/ 881 882 u16 service_name_len;/* length of service name */ 883 u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; /* UTF-8 encoded string identifying the service */ 884 885 /* Sequence of values which further specify the published service beyond the service name*/ 886 u16 service_specific_info_len; 887 u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; 888 889 /* 890 Ordered sequence of <length, value> pairs used to filter out received publish discovery messages. 891 This can be sent both for a Passive or an Active Subscribe 892 */ 893 u16 rx_match_filter_len; 894 u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; 895 896 /* 897 Ordered sequence of <length, value> pairs included in the 898 Discovery Frame when an Active Subscribe is used. 899 */ 900 u16 tx_match_filter_len; 901 u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; 902 903 /* 904 Flag which specifies that the Subscribe should use the configured RSSI 905 threshold and the received RSSI in order to filter requests 906 0 � ignore the configured RSSI threshold when running a Service 907 Descriptor attribute or Service ID List Attribute through the DE matching logic. 908 1 � use the configured RSSI threshold when running a Service 909 Descriptor attribute or Service ID List Attribute through the DE matching logic. 910 911 */ 912 u8 rssi_threshold_flag; 913 914 /* 915 8-bit bitmap which allows the Host to associate this Active 916 Subscribe with a particular Post-NAN Connectivity attribute 917 which has been sent down in a NanConfigureRequest/NanEnableRequest 918 message. If the DE fails to find a configured Post-NAN 919 connectivity attributes referenced by the bitmap, 920 the DE will return an error code to the Host. 921 If the Subscribe is configured to use a Post-NAN Connectivity 922 attribute and the Host does not refresh the Post-NAN Connectivity 923 attribute the Subscribe will be canceled and the Host will be sent 924 a SubscribeTerminatedIndication message. 925 */ 926 u8 connmap; 927 /* 928 NAN Interface Address, conforming to the format as described in 929 8.2.4.3.2 of IEEE Std. 802.11-2012. 930 */ 931 u8 num_intf_addr_present; 932 u8 intf_addr[NAN_MAX_SUBSCRIBE_MAX_ADDRESS][NAN_MAC_ADDR_LEN]; 933 /* 934 Set/Enable corresponding bits to disable indications that follow a subscribe. 935 BIT0 - Disable subscribe termination indication. 936 BIT1 - Disable match expired indication. 937 BIT2 - Disable followUp indication received (OTA). 938 */ 939 u8 recv_indication_cfg; 940 } NanSubscribeRequest; 941 942 /* 943 NAN Subscribe Cancel Structure 944 The SubscribeCancelReq Message is used to request the DE to stop looking for the Service Name. 945 */ 946 typedef struct { 947 u16 subscribe_id; 948 } NanSubscribeCancelRequest; 949 950 /* 951 Transmit follow up Structure 952 The TransmitFollowupReq message is sent to the DE to allow the sending of the Service_Specific_Info 953 to a particular MAC address. 954 */ 955 typedef struct { 956 /* Publish or Subscribe Id of an earlier Publish/Subscribe */ 957 u16 publish_subscribe_id; 958 959 /* 960 This Id is the Requestor Instance that is passed as 961 part of earlier MatchInd/FollowupInd message. 962 */ 963 u32 requestor_instance_id; 964 u8 addr[NAN_MAC_ADDR_LEN]; /* Unicast address */ 965 NanTxPriority priority; /* priority of the request 2=high */ 966 NanTransmitWindowType dw_or_faw; /* 0= send in a DW, 1=send in FAW */ 967 968 /* 969 Sequence of values which further specify the published service beyond 970 the service name. 971 */ 972 u16 service_specific_info_len; 973 u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; 974 /* 975 Set/Enable corresponding bits to disable responses after followUp. 976 BIT0 - Disable followUp response from FW. 977 */ 978 u8 recv_indication_cfg; 979 } NanTransmitFollowupRequest; 980 981 /* 982 Stats Request structure 983 The Discovery Engine can be queried at runtime by the Host processor for statistics 984 concerning various parts of the Discovery Engine. 985 */ 986 typedef struct { 987 NanStatsType stats_type; /* NAN Statistics Request Type */ 988 u8 clear; /* 0= Do not clear the stats and return the current contents , 1= Clear the associated stats */ 989 } NanStatsRequest; 990 991 /* 992 Config Structure 993 The NanConfigurationReq message is sent by the Host to the 994 Discovery Engine in order to configure the Discovery Engine during runtime. 995 */ 996 typedef struct { 997 u8 config_sid_beacon; 998 u8 sid_beacon; 999 u8 config_rssi_proximity; 1000 u8 rssi_proximity; 1001 u8 config_master_pref; 1002 u8 master_pref; 1003 /* 1004 1 byte value which defines the RSSI filter threshold. 1005 Any Service Descriptors received above this value 1006 that are configured for RSSI filtering will be dropped. 1007 The rssi values should be specified without sign. 1008 For eg: -70dBm should be specified as 70. 1009 */ 1010 u8 config_5g_rssi_close_proximity; 1011 u8 rssi_close_proximity_5g_val; 1012 /* 1013 Optional configuration of Configure request. 1014 Each of the optional parameters have configure flag which 1015 determine whether configuration is to be passed or not. 1016 */ 1017 /* 1018 2 byte quantity which defines the window size over 1019 which the �average RSSI� will be calculated over. 1020 */ 1021 u8 config_rssi_window_size; 1022 u16 rssi_window_size_val; 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; 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; 1050 /* NAN Post Connectivity Capability */ 1051 u8 config_conn_capability; 1052 NanTransmitPostConnectivityCapability conn_capability_val; 1053 /* NAN Post Discover Capability */ 1054 u8 num_config_discovery_attr; 1055 NanTransmitPostDiscovery discovery_attr_val[NAN_MAX_POSTDISCOVERY_LEN]; 1056 /* NAN Further availability Map */ 1057 u8 config_fam; 1058 NanFurtherAvailabilityMap fam_val; 1059 } NanConfigRequest; 1060 1061 /* 1062 TCA Structure 1063 The Discovery Engine can be configured to send up Events whenever a configured 1064 Threshold Crossing Alert (TCA) Type crosses an integral threshold in a particular direction. 1065 */ 1066 typedef struct { 1067 NanTcaType tca_type; /* Nan Protocol Threshold Crossing Alert (TCA) Codes */ 1068 1069 /* flag which control whether or not an event is generated for the Rising direction */ 1070 u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */ 1071 1072 /* flag which control whether or not an event is generated for the Falling direction */ 1073 u8 falling_direction_evt_flag;/* 0 - no event, 1 - event */ 1074 1075 /* flag which requests a previous TCA request to be cleared from the DE */ 1076 u8 clear;/*0= Do not clear the TCA, 1=Clear the TCA */ 1077 1078 /* 32 bit value which represents the threshold to be used.*/ 1079 u32 threshold; 1080 } NanTCARequest; 1081 1082 /* 1083 Beacon Sdf Payload Structure 1084 The Discovery Engine can be configured to publish vendor specific attributes as part of 1085 beacon or service discovery frame transmitted as part of this request.. 1086 */ 1087 typedef struct { 1088 /* 1089 NanVendorAttribute will have the Vendor Specific Attribute which the 1090 vendor wants to publish as part of Discovery or Sync or Service discovery frame 1091 */ 1092 NanTransmitVendorSpecificAttribute vsa; 1093 } NanBeaconSdfPayloadRequest; 1094 1095 /* Publish statistics. */ 1096 typedef struct 1097 { 1098 u32 validPublishServiceReqMsgs; 1099 u32 validPublishServiceRspMsgs; 1100 u32 validPublishServiceCancelReqMsgs; 1101 u32 validPublishServiceCancelRspMsgs; 1102 u32 validPublishRepliedIndMsgs; 1103 u32 validPublishTerminatedIndMsgs; 1104 u32 validActiveSubscribes; 1105 u32 validMatches; 1106 u32 validFollowups; 1107 u32 invalidPublishServiceReqMsgs; 1108 u32 invalidPublishServiceCancelReqMsgs; 1109 u32 invalidActiveSubscribes; 1110 u32 invalidMatches; 1111 u32 invalidFollowups; 1112 u32 publishCount; 1113 u32 publishNewMatchCount; 1114 u32 pubsubGlobalNewMatchCount; 1115 } NanPublishStats; 1116 1117 /* Subscribe statistics. */ 1118 typedef struct 1119 { 1120 u32 validSubscribeServiceReqMsgs; 1121 u32 validSubscribeServiceRspMsgs; 1122 u32 validSubscribeServiceCancelReqMsgs; 1123 u32 validSubscribeServiceCancelRspMsgs; 1124 u32 validSubscribeTerminatedIndMsgs; 1125 u32 validSubscribeMatchIndMsgs; 1126 u32 validSubscribeUnmatchIndMsgs; 1127 u32 validSolicitedPublishes; 1128 u32 validMatches; 1129 u32 validFollowups; 1130 u32 invalidSubscribeServiceReqMsgs; 1131 u32 invalidSubscribeServiceCancelReqMsgs; 1132 u32 invalidSubscribeFollowupReqMsgs; 1133 u32 invalidSolicitedPublishes; 1134 u32 invalidMatches; 1135 u32 invalidFollowups; 1136 u32 subscribeCount; 1137 u32 bloomFilterIndex; 1138 u32 subscribeNewMatchCount; 1139 u32 pubsubGlobalNewMatchCount; 1140 } NanSubscribeStats; 1141 1142 /* NAN DW Statistics*/ 1143 typedef struct 1144 { 1145 /* RX stats */ 1146 u32 validFrames; 1147 u32 validActionFrames; 1148 u32 validBeaconFrames; 1149 u32 ignoredActionFrames; 1150 u32 ignoredBeaconFrames; 1151 u32 invalidFrames; 1152 u32 invalidActionFrames; 1153 u32 invalidBeaconFrames; 1154 u32 invalidMacHeaders; 1155 u32 invalidPafHeaders; 1156 u32 nonNanBeaconFrames; 1157 1158 u32 earlyActionFrames; 1159 u32 inDwActionFrames; 1160 u32 lateActionFrames; 1161 1162 /* TX stats */ 1163 u32 framesQueued; 1164 u32 totalTRSpUpdates; 1165 u32 completeByTRSp; 1166 u32 completeByTp75DW; 1167 u32 completeByTendDW; 1168 u32 lateActionFramesTx; 1169 } NanDWStats; 1170 1171 /* NAN MAC Statistics. */ 1172 typedef struct 1173 { 1174 /* RX stats */ 1175 u32 validFrames; 1176 u32 validActionFrames; 1177 u32 validBeaconFrames; 1178 u32 ignoredActionFrames; 1179 u32 ignoredBeaconFrames; 1180 u32 invalidFrames; 1181 u32 invalidActionFrames; 1182 u32 invalidBeaconFrames; 1183 u32 invalidMacHeaders; 1184 u32 invalidPafHeaders; 1185 u32 nonNanBeaconFrames; 1186 1187 u32 earlyActionFrames; 1188 u32 inDwActionFrames; 1189 u32 lateActionFrames; 1190 1191 /* TX stats */ 1192 u32 framesQueued; 1193 u32 totalTRSpUpdates; 1194 u32 completeByTRSp; 1195 u32 completeByTp75DW; 1196 u32 completeByTendDW; 1197 u32 lateActionFramesTx; 1198 1199 u32 twIncreases; 1200 u32 twDecreases; 1201 u32 twChanges; 1202 u32 twHighwater; 1203 u32 bloomFilterIndex; 1204 } NanMacStats; 1205 1206 /* NAN Sync Statistics*/ 1207 typedef struct 1208 { 1209 u64 currTsf; 1210 u64 myRank; 1211 u64 currAmRank; 1212 u64 lastAmRank; 1213 u32 currAmBTT; 1214 u32 lastAmBTT; 1215 u8 currAmHopCount; 1216 u8 currRole; 1217 u16 currClusterId; 1218 1219 u64 timeSpentInCurrRole; 1220 u64 totalTimeSpentAsMaster; 1221 u64 totalTimeSpentAsNonMasterSync; 1222 u64 totalTimeSpentAsNonMasterNonSync; 1223 u32 transitionsToAnchorMaster; 1224 u32 transitionsToMaster; 1225 u32 transitionsToNonMasterSync; 1226 u32 transitionsToNonMasterNonSync; 1227 u32 amrUpdateCount; 1228 u32 amrUpdateRankChangedCount; 1229 u32 amrUpdateBTTChangedCount; 1230 u32 amrUpdateHcChangedCount; 1231 u32 amrUpdateNewDeviceCount; 1232 u32 amrExpireCount; 1233 u32 mergeCount; 1234 u32 beaconsAboveHcLimit; 1235 u32 beaconsBelowRssiThresh; 1236 u32 beaconsIgnoredNoSpace; 1237 u32 beaconsForOurCluster; 1238 u32 beaconsForOtherCluster; 1239 u32 beaconCancelRequests; 1240 u32 beaconCancelFailures; 1241 u32 beaconUpdateRequests; 1242 u32 beaconUpdateFailures; 1243 u32 syncBeaconTxAttempts; 1244 u32 syncBeaconTxFailures; 1245 u32 discBeaconTxAttempts; 1246 u32 discBeaconTxFailures; 1247 u32 amHopCountExpireCount; 1248 } NanSyncStats; 1249 1250 /* NAN Misc DE Statistics */ 1251 typedef struct 1252 { 1253 u32 validErrorRspMsgs; 1254 u32 validTransmitFollowupReqMsgs; 1255 u32 validTransmitFollowupRspMsgs; 1256 u32 validFollowupIndMsgs; 1257 u32 validConfigurationReqMsgs; 1258 u32 validConfigurationRspMsgs; 1259 u32 validStatsReqMsgs; 1260 u32 validStatsRspMsgs; 1261 u32 validEnableReqMsgs; 1262 u32 validEnableRspMsgs; 1263 u32 validDisableReqMsgs; 1264 u32 validDisableRspMsgs; 1265 u32 validDisableIndMsgs; 1266 u32 validEventIndMsgs; 1267 u32 validTcaReqMsgs; 1268 u32 validTcaRspMsgs; 1269 u32 validTcaIndMsgs; 1270 u32 invalidTransmitFollowupReqMsgs; 1271 u32 invalidConfigurationReqMsgs; 1272 u32 invalidStatsReqMsgs; 1273 u32 invalidEnableReqMsgs; 1274 u32 invalidDisableReqMsgs; 1275 u32 invalidTcaReqMsgs; 1276 } NanDeStats; 1277 1278 /* Publish Response Message structure */ 1279 typedef struct { 1280 u16 publish_id; 1281 } NanPublishResponse; 1282 1283 /* Subscribe Response Message structure */ 1284 typedef struct { 1285 u16 subscribe_id; 1286 } NanSubscribeResponse; 1287 1288 /* 1289 Stats Response Message structure 1290 The Discovery Engine response to a request by the Host for statistics. 1291 */ 1292 typedef struct { 1293 NanStatsType stats_type; 1294 union { 1295 NanPublishStats publish_stats; 1296 NanSubscribeStats subscribe_stats; 1297 NanMacStats mac_stats; 1298 NanSyncStats sync_stats; 1299 NanDeStats de_stats; 1300 NanDWStats dw_stats; 1301 } data; 1302 } NanStatsResponse; 1303 1304 /* 1305 NAN Response messages 1306 */ 1307 typedef struct { 1308 NanStatusType status; /* contains the result code */ 1309 u32 value; /* For error returns the value is returned which was in error */ 1310 NanResponseType response_type; /* NanResponseType Definitions */ 1311 union { 1312 NanPublishResponse publish_response; 1313 NanSubscribeResponse subscribe_response; 1314 NanStatsResponse stats_response; 1315 NanCapabilities nan_capabilities; 1316 } body; 1317 } NanResponseMsg; 1318 1319 /* 1320 Publish Terminated 1321 The PublishTerminatedInd message is sent by the DE whenever a Publish 1322 terminates from a user-specified timeout or a unrecoverable error in the DE. 1323 */ 1324 typedef struct { 1325 /* Id returned during the initial Publish */ 1326 u16 publish_id; 1327 NanStatusType reason; 1328 } NanPublishTerminatedInd; 1329 1330 /* 1331 Match Indication 1332 The MatchInd message is sent once per responding MAC address whenever 1333 the Discovery Engine detects a match for a previous SubscribeServiceReq 1334 or PublishServiceReq. 1335 */ 1336 typedef struct { 1337 /* Publish or Subscribe Id of an earlier Publish/Subscribe */ 1338 u16 publish_subscribe_id; 1339 /* 1340 A 32 bit Requestor Instance Id which is sent to the Application. 1341 This Id will be sent in any subsequent UnmatchInd/FollowupInd 1342 messages 1343 */ 1344 u32 requestor_instance_id; 1345 u8 addr[NAN_MAC_ADDR_LEN]; 1346 1347 /* 1348 Sequence of octets which were received in a Discovery Frame matching the 1349 Subscribe Request. 1350 */ 1351 u16 service_specific_info_len; 1352 u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; 1353 1354 /* 1355 Ordered sequence of <length, value> pairs received in the Discovery Frame 1356 matching the Subscribe Request. 1357 */ 1358 u16 sdf_match_filter_len; 1359 u8 sdf_match_filter[NAN_MAX_MATCH_FILTER_LEN]; 1360 1361 /* 1362 flag to indicate if the Match occurred in a Beacon Frame or in a 1363 Service Discovery Frame. 1364 0 - Match occured in a Service Discovery Frame 1365 1 - Match occured in a Beacon Frame 1366 */ 1367 u8 match_occured_flag; 1368 1369 /* 1370 flag to indicate FW is out of resource and that it can no longer 1371 track this Service Name. The Host still need to send the received 1372 Match_Handle but duplicate MatchInd messages may be received on 1373 this Handle until the resource frees up. 1374 0 - FW is caching this match 1375 1 - FW is unable to cache this match 1376 */ 1377 u8 out_of_resource_flag; 1378 1379 /* 1380 If RSSI filtering was configured in NanSubscribeRequest then this 1381 field will contain the received RSSI value. 0 if not. 1382 All rssi values should be specified without sign. 1383 For eg: -70dBm should be specified as 70. 1384 */ 1385 u8 rssi_value; 1386 1387 /* 1388 optional attributes. Each optional attribute is associated with a flag 1389 which specifies whether the attribute is valid or not 1390 */ 1391 /* NAN Post Connectivity Capability received */ 1392 u8 is_conn_capability_valid; 1393 NanReceivePostConnectivityCapability conn_capability; 1394 1395 /* NAN Post Discover Capability */ 1396 u8 num_rx_discovery_attr; 1397 NanReceivePostDiscovery discovery_attr[NAN_MAX_POSTDISCOVERY_LEN]; 1398 1399 /* NAN Further availability Map */ 1400 u8 num_chans; 1401 NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS]; 1402 1403 /* NAN Cluster Attribute */ 1404 u8 cluster_attribute_len; 1405 u8 cluster_attribute[NAN_MAX_CLUSTER_ATTRIBUTE_LEN]; 1406 } NanMatchInd; 1407 1408 /* 1409 MatchExpired Indication 1410 The MatchExpiredInd message is sent whenever the Discovery Engine detects that 1411 a previously Matched Service has been gone for too long. If the previous 1412 MatchInd message for this Publish/Subscribe Id had the out_of_resource_flag 1413 set then this message will not be received 1414 */ 1415 typedef struct { 1416 /* Publish or Subscribe Id of an earlier Publish/Subscribe */ 1417 u16 publish_subscribe_id; 1418 /* 1419 32 bit value sent by the DE in a previous 1420 MatchInd/FollowupInd to the application. 1421 */ 1422 u32 requestor_instance_id; 1423 } NanMatchExpiredInd; 1424 1425 /* 1426 Subscribe Terminated 1427 The SubscribeTerminatedInd message is sent by the DE whenever a 1428 Subscribe terminates from a user-specified timeout or a unrecoverable error in the DE. 1429 */ 1430 typedef struct { 1431 /* Id returned during initial Subscribe */ 1432 u16 subscribe_id; 1433 NanStatusType reason; 1434 } NanSubscribeTerminatedInd; 1435 1436 /* 1437 Followup Indication Message 1438 The FollowupInd message is sent by the DE to the Host whenever it receives a 1439 Followup message from another peer. 1440 */ 1441 typedef struct { 1442 /* Publish or Subscribe Id of an earlier Publish/Subscribe */ 1443 u16 publish_subscribe_id; 1444 /* 1445 A 32 bit Requestor instance Id which is sent to the Application. 1446 This Id will be used in subsequent UnmatchInd/FollowupInd messages. 1447 */ 1448 u32 requestor_instance_id; 1449 u8 addr[NAN_MAC_ADDR_LEN]; 1450 1451 /* Flag which the DE uses to decide if received in a DW or a FAW*/ 1452 u8 dw_or_faw; /* 0=Received in a DW, 1 = Received in a FAW*/ 1453 1454 /* 1455 Sequence of values which further specify the published service beyond 1456 the service name 1457 */ 1458 u16 service_specific_info_len; 1459 u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; 1460 } NanFollowupInd; 1461 1462 /* 1463 Event data notifying the Mac address of the Discovery engine. 1464 which is reported as one of the Discovery engine event 1465 */ 1466 typedef struct { 1467 u8 addr[NAN_MAC_ADDR_LEN]; 1468 } NanMacAddressEvent; 1469 1470 /* 1471 Event data notifying the Cluster address of the cluster 1472 which is reported as one of the Discovery engine event 1473 */ 1474 typedef struct { 1475 u8 addr[NAN_MAC_ADDR_LEN]; 1476 } NanClusterEvent; 1477 1478 /* 1479 Discovery Engine Event Indication 1480 The Discovery Engine can inform the Host when significant events occur 1481 The data following the EventId is dependent upon the EventId type. 1482 In other words, each new event defined will carry a different 1483 structure of information back to the host. 1484 */ 1485 typedef struct { 1486 NanDiscEngEventType event_type; /* NAN Protocol Event Codes */ 1487 union { 1488 /* 1489 MacAddressEvent which will have 6 byte mac address 1490 of the Discovery engine. 1491 */ 1492 NanMacAddressEvent mac_addr; 1493 /* 1494 Cluster Event Data which will be obtained when the 1495 device starts a new cluster or joins a cluster. 1496 The event data will have 6 byte octet string of the 1497 cluster started or joined. 1498 */ 1499 NanClusterEvent cluster; 1500 } data; 1501 } NanDiscEngEventInd; 1502 1503 /* Cluster size TCA event*/ 1504 typedef struct { 1505 /* size of the cluster*/ 1506 u32 cluster_size; 1507 } NanTcaClusterEvent; 1508 1509 /* 1510 NAN TCA Indication 1511 The Discovery Engine can inform the Host when significant events occur. 1512 The data following the TcaId is dependent upon the TcaId type. 1513 In other words, each new event defined will carry a different structure 1514 of information back to the host. 1515 */ 1516 typedef struct { 1517 NanTcaType tca_type; 1518 /* flag which defines if the configured Threshold has risen above the threshold */ 1519 u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */ 1520 1521 /* flag which defines if the configured Threshold has fallen below the threshold */ 1522 u8 falling_direction_evt_flag;/* 0 - no event, 1 - event */ 1523 union { 1524 /* 1525 This event in obtained when the cluser size threshold 1526 is crossed. Event will have the cluster size 1527 */ 1528 NanTcaClusterEvent cluster; 1529 } data; 1530 } NanTCAInd; 1531 1532 /* 1533 NAN Disabled Indication 1534 The NanDisableInd message indicates to the upper layers that the Discovery 1535 Engine has flushed all state and has been shutdown. When this message is received 1536 the DE is guaranteed to have left the NAN cluster it was part of and will have terminated 1537 any in progress Publishes or Subscribes. 1538 */ 1539 typedef struct { 1540 NanStatusType reason; 1541 } NanDisabledInd; 1542 1543 /* 1544 NAN Beacon or SDF Payload Indication 1545 The NanBeaconSdfPayloadInd message indicates to the upper layers that information 1546 elements were received either in a Beacon or SDF which needs to be delivered 1547 outside of a Publish/Subscribe Handle. 1548 */ 1549 typedef struct { 1550 /* The MAC address of the peer which sent the attributes.*/ 1551 u8 addr[NAN_MAC_ADDR_LEN]; 1552 /* 1553 Optional attributes. Each optional attribute is associated with a flag 1554 which specifies whether the attribute is valid or not 1555 */ 1556 /* NAN Receive Vendor Specific Attribute*/ 1557 u8 is_vsa_received; 1558 NanReceiveVendorSpecificAttribute vsa; 1559 1560 /* NAN Beacon or SDF Payload Received*/ 1561 u8 is_beacon_sdf_payload_received; 1562 NanBeaconSdfPayloadReceive data; 1563 } NanBeaconSdfPayloadInd; 1564 1565 /* Response and Event Callbacks */ 1566 typedef struct { 1567 /* NotifyResponse invoked to notify the status of the Request */ 1568 void (*NotifyResponse)(transaction_id id, NanResponseMsg* rsp_data); 1569 /* Callbacks for various Events */ 1570 void (*EventPublishTerminated)(NanPublishTerminatedInd* event); 1571 void (*EventMatch) (NanMatchInd* event); 1572 void (*EventMatchExpired) (NanMatchExpiredInd* event); 1573 void (*EventSubscribeTerminated) (NanSubscribeTerminatedInd* event); 1574 void (*EventFollowup) (NanFollowupInd* event); 1575 void (*EventDiscEngEvent) (NanDiscEngEventInd* event); 1576 void (*EventDisabled) (NanDisabledInd* event); 1577 void (*EventTca) (NanTCAInd* event); 1578 void (*EventBeaconSdfPayload) (NanBeaconSdfPayloadInd* event); 1579 } NanCallbackHandler; 1580 1581 /* Enable NAN functionality. */ 1582 wifi_error nan_enable_request(transaction_id id, 1583 wifi_interface_handle iface, 1584 NanEnableRequest* msg); 1585 1586 /* Disable NAN functionality. */ 1587 wifi_error nan_disable_request(transaction_id id, 1588 wifi_interface_handle iface); 1589 1590 /* Publish request to advertize a service. */ 1591 wifi_error nan_publish_request(transaction_id id, 1592 wifi_interface_handle iface, 1593 NanPublishRequest* msg); 1594 1595 /* Cancel previous publish requests. */ 1596 wifi_error nan_publish_cancel_request(transaction_id id, 1597 wifi_interface_handle iface, 1598 NanPublishCancelRequest* msg); 1599 1600 /* Subscribe request to search for a service. */ 1601 wifi_error nan_subscribe_request(transaction_id id, 1602 wifi_interface_handle iface, 1603 NanSubscribeRequest* msg); 1604 1605 /* Cancel previous subscribe requests. */ 1606 wifi_error nan_subscribe_cancel_request(transaction_id id, 1607 wifi_interface_handle iface, 1608 NanSubscribeCancelRequest* msg); 1609 1610 /* NAN transmit follow up request. */ 1611 wifi_error nan_transmit_followup_request(transaction_id id, 1612 wifi_interface_handle iface, 1613 NanTransmitFollowupRequest* msg); 1614 1615 /* Request NAN statistics from Discovery Engine. */ 1616 wifi_error nan_stats_request(transaction_id id, 1617 wifi_interface_handle iface, 1618 NanStatsRequest* msg); 1619 1620 /* NAN configuration request. */ 1621 wifi_error nan_config_request(transaction_id id, 1622 wifi_interface_handle iface, 1623 NanConfigRequest* msg); 1624 1625 /* Configure the various Threshold crossing alerts. */ 1626 wifi_error nan_tca_request(transaction_id id, 1627 wifi_interface_handle iface, 1628 NanTCARequest* msg); 1629 1630 /* 1631 Set NAN Beacon or sdf payload to discovery engine. 1632 This instructs the Discovery Engine to begin publishing the 1633 received payload in any Beacon or Service Discovery Frame 1634 transmitted 1635 */ 1636 wifi_error nan_beacon_sdf_payload_request(transaction_id id, 1637 wifi_interface_handle iface, 1638 NanBeaconSdfPayloadRequest* msg); 1639 1640 /* Register NAN callbacks. */ 1641 wifi_error nan_register_handler(wifi_interface_handle iface, 1642 NanCallbackHandler handlers); 1643 1644 /* Get NAN HAL version. */ 1645 wifi_error nan_get_version(wifi_handle handle, 1646 NanVersion* version); 1647 1648 /* Get NAN capabilities. */ 1649 wifi_error nan_get_capabilities(transaction_id id, 1650 wifi_interface_handle iface); 1651 #ifdef __cplusplus 1652 } 1653 #endif /* __cplusplus */ 1654 1655 #endif /* __NAN_H__ */ 1656