1 /* 2 * Copyright 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 package android.hardware.wifi@1.0; 18 19 /** 20 * Enum values indicating the status of operation. 21 */ 22 enum WifiStatusCode : uint32_t { 23 /** No errors. */ 24 SUCCESS, 25 /** Method invoked on an invalid |IWifiChip| object. */ 26 ERROR_WIFI_CHIP_INVALID, 27 /** Method invoked on an invalid |IWifiIface| object. */ 28 ERROR_WIFI_IFACE_INVALID, 29 /** Method invoked on an invalid |IWifiRttController| object. */ 30 ERROR_WIFI_RTT_CONTROLLER_INVALID, 31 ERROR_NOT_SUPPORTED, 32 ERROR_NOT_AVAILABLE, 33 ERROR_NOT_STARTED, 34 ERROR_INVALID_ARGS, 35 ERROR_BUSY, 36 ERROR_UNKNOWN 37 }; 38 39 /** 40 * Generic structure to return the status of an operation. 41 */ 42 struct WifiStatus { 43 WifiStatusCode code; 44 /** 45 * A vendor specific error message from the vendor to provide more 46 * information beyond the reason code. 47 */ 48 string description; 49 }; 50 51 /** 52 * List of Iface types supported. 53 */ 54 enum IfaceType : uint32_t { 55 STA, 56 AP, 57 P2P, 58 /** 59 * NAN control interface. Datapath support must be queried and created 60 * through this interface. 61 */ 62 NAN, 63 }; 64 65 /** 66 * An identifier assigned to every chip on the device. 67 */ 68 typedef uint32_t ChipId; 69 70 /** 71 * An identifier for a mode that the chip can be put in. 72 */ 73 typedef uint32_t ChipModeId; 74 75 /** 76 * A unique handle provided by the client to identify individual invocations of 77 * certain API's like |IWifiStaIface.startBackgroundScan|, 78 * |IWifiStaIface.installApfPacketFilter|, etc. 79 */ 80 typedef uint32_t CommandId; 81 82 /** 83 * Channel frequency in Mhz. 84 */ 85 typedef uint32_t WifiChannelInMhz; 86 87 /** 88 * Channel operating width in Mhz. 89 */ 90 enum WifiChannelWidthInMhz : uint32_t { 91 WIDTH_20 = 0, 92 WIDTH_40 = 1, 93 WIDTH_80 = 2, 94 WIDTH_160 = 3, 95 WIDTH_80P80 = 4, 96 WIDTH_5 = 5, 97 WIDTH_10 = 6, 98 WIDTH_INVALID = -1 99 }; 100 101 /** 102 * Channel information. 103 */ 104 struct WifiChannelInfo { 105 /** 106 * Channel width (20, 40, 80, 80+80, 160). 107 */ 108 WifiChannelWidthInMhz width; 109 /** 110 * Primary 20 MHz channel. 111 */ 112 WifiChannelInMhz centerFreq; 113 /** 114 * Center frequency (MHz) first segment. 115 */ 116 WifiChannelInMhz centerFreq0; 117 /** 118 * Center frequency (MHz) second segment. 119 */ 120 WifiChannelInMhz centerFreq1; 121 }; 122 123 /** 124 * RSSI information. 125 */ 126 typedef int32_t Rssi; 127 128 /** 129 * Mac Address type. 6 octets representing physical address of a device. 130 */ 131 typedef uint8_t[6] MacAddress; 132 133 /** 134 * SSID type. 32 octets representing the network. 135 */ 136 typedef uint8_t[32] Ssid; 137 138 /** 139 * BSSID type. 6 octets representing the physical address of an AP. 140 */ 141 typedef MacAddress Bssid; 142 143 /** 144 * TimeStamp in milliseconds (ms). 145 */ 146 typedef uint64_t TimeStampInMs; 147 148 /** 149 * TimeStamp in microseconds (us). 150 */ 151 typedef uint64_t TimeStampInUs; 152 153 /** 154 * TimeStamp in picoseconds (ps). 155 */ 156 typedef uint64_t TimeSpanInPs; 157 158 /** 159 * Information elements contained within the |ScanResult| structure. 160 * These elements correspond to the IEEE_802.11 standard. 161 */ 162 struct WifiInformationElement { 163 uint8_t id; 164 vec<uint8_t> data; 165 }; 166 167 enum WifiRatePreamble : uint32_t { 168 OFDM = 0, 169 CCK = 1, 170 HT = 2, 171 VHT = 3, 172 RESERVED = 4 173 }; 174 175 /** 176 * Number of spatial streams in VHT/HT. 177 */ 178 enum WifiRateNss : uint32_t { 179 NSS_1x1 = 0, 180 NSS_2x2 = 1, 181 NSS_3x3 = 2, 182 NSS_4x4 = 3 183 }; 184 185 /** 186 * Wifi rate info. 187 */ 188 struct WifiRateInfo { 189 /** 190 * Preamble used for RTT measurements. 191 */ 192 WifiRatePreamble preamble; 193 /** 194 * Number of spatial streams. 195 */ 196 WifiRateNss nss; 197 /** 198 * Bandwidth of channel. 199 */ 200 WifiChannelWidthInMhz bw; 201 /** 202 * OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps. 203 * HT/VHT it would be mcs index. 204 */ 205 uint8_t rateMcsIdx; 206 /** 207 * Bitrate in units of 100 Kbps. 208 */ 209 uint32_t bitRateInKbps; 210 }; 211 212 /** 213 * Wifi bands defined in 80211 spec. 214 */ 215 enum WifiBand : uint32_t { 216 BAND_UNSPECIFIED = 0, 217 /** 218 * 2.4 GHz. 219 */ 220 BAND_24GHZ = 1, 221 /** 222 * 5 GHz without DFS. 223 */ 224 BAND_5GHZ = 2, 225 /** 226 * 5 GHz DFS only. 227 */ 228 BAND_5GHZ_DFS = 4, 229 /** 230 * 5 GHz with DFS. 231 */ 232 BAND_5GHZ_WITH_DFS = 6, 233 /** 234 * 2.4 GHz + 5 GHz; no DFS. 235 */ 236 BAND_24GHZ_5GHZ = 3, 237 /** 238 * 2.4 GHz + 5 GHz with DFS 239 */ 240 BAND_24GHZ_5GHZ_WITH_DFS = 7 241 }; 242 243 /** 244 * STA specific types. 245 * TODO(b/32159498): Move to a separate sta_types.hal. 246 */ 247 /** 248 * Parameters to specify the APF capabilities of this iface. 249 */ 250 struct StaApfPacketFilterCapabilities { 251 /** 252 * Version of the packet filter interpreter supported 253 */ 254 uint32_t version; 255 /** 256 * Maximum size of the filter bytecodes in byte for an iface. 257 */ 258 uint32_t maxLength; 259 }; 260 261 /** 262 * Parameters to specify the Background Scan capabilities of this iface. 263 */ 264 struct StaBackgroundScanCapabilities { 265 /** 266 * Maximum number of byte available for cached scan results 267 */ 268 uint32_t maxCacheSize; 269 /** 270 * Maximum number of buckets that can be supplied for a scan 271 */ 272 uint32_t maxBuckets; 273 /** 274 * Maximum number of APs that must be stored for each scan. 275 */ 276 uint32_t maxApCachePerScan; 277 /** 278 * Max reporting number of scans threshold that can be specified in the scan 279 * parameters. 280 */ 281 int32_t maxReportingThreshold; 282 }; 283 284 /** 285 * Mask of event reporting schemes that can be specified in background scan 286 * requests. 287 */ 288 enum StaBackgroundScanBucketEventReportSchemeMask : uint32_t { 289 /** 290 * Report a scan completion event after scan. If this is not set then scan 291 * completion events must be reported if report_threshold_percent or 292 * report_threshold_num_scans is reached. 293 */ 294 EACH_SCAN = 1 << 0, 295 /** 296 * Forward scan results (beacons/probe responses + IEs) in real time to HAL, 297 * in addition to completion events. 298 * Note: To keep backward compatibility, fire completion events regardless 299 * of REPORT_EVENTS_EACH_SCAN. 300 */ 301 FULL_RESULTS = 1 << 1, 302 /** 303 * Controls if scans for this bucket must be placed in the results buffer. 304 */ 305 NO_BATCH = 1 << 2, 306 }; 307 308 /** 309 * Max limits for background scan. 310 */ 311 enum StaScanLimits : uint32_t { 312 MAX_CHANNELS = 16, 313 MAX_BUCKETS = 16, 314 MAX_AP_CACHE_PER_SCAN = 32 315 }; 316 317 /** 318 * Background Scan parameters per bucket that can be specified in background 319 * scan requests. 320 */ 321 struct StaBackgroundScanBucketParameters { 322 /** 323 * Bucket index. This index is used to report results in 324 * |StaScanData.bucketsScanned|. 325 */ 326 uint32_t bucketIdx; 327 /** 328 * Bands to scan or |BAND_UNSPECIFIED| if frequencies list must be used 329 * instead. 330 */ 331 WifiBand band; 332 /** 333 * Channel frequencies (in Mhz) to scan if |band| is set to 334 * |BAND_UNSPECIFIED|. 335 * Max length: |StaScanLimits.MAX_CHANNELS|. 336 */ 337 vec<WifiChannelInMhz> frequencies; 338 /** 339 * Period at which this bucket must be scanned (in milliseconds). Must be an integer 340 * multiple of the |basePeriodInMs| specified in the BackgroundScanParameters. 341 */ 342 uint32_t periodInMs; 343 /** 344 * Bitset of |StaBackgroundScanBucketEventReportSchemeMask| values controlling 345 * when events for this bucket must be reported. 346 */ 347 bitfield<StaBackgroundScanBucketEventReportSchemeMask> eventReportScheme; 348 /** 349 * For exponential back off. If |exponentialMaxPeriodInMs| is non zero or 350 * different than period, then this bucket is an exponential backoff bucket 351 * and the scan period must grow exponentially as per formula: 352 * actual_period(N) = period * (base ^ (N/step_count)) 353 * to this maximum period (in milliseconds). 354 */ 355 uint32_t exponentialMaxPeriodInMs; 356 /** 357 * For exponential back off. multiplier: new_period=old_period * base 358 */ 359 uint32_t exponentialBase; 360 /** 361 * For exponential back off. Number of scans to perform for a given 362 * period. 363 */ 364 uint32_t exponentialStepCount; 365 }; 366 367 /** 368 * Background Scan parameters that can be specified in background scan 369 * requests. 370 */ 371 struct StaBackgroundScanParameters { 372 /** 373 * GCD of all bucket periods (in milliseconds). 374 */ 375 uint32_t basePeriodInMs; 376 /** 377 * Maximum number of APs that must be stored for each scan. If the maximum 378 * is reached the highest RSSI results must be returned. 379 * Max length: |StaScanLimits.MAX_AP_CACHE_PER_SCAN|. 380 */ 381 uint32_t maxApPerScan; 382 /** 383 * % cache buffer filled threshold at which the host must be notified of 384 * batched scan results. 385 */ 386 uint32_t reportThresholdPercent; 387 /** 388 * Threshold at which the AP must be woken up, in number of scans. 389 */ 390 uint32_t reportThresholdNumScans; 391 /** 392 * List of buckets to be scheduled. 393 * Max length: |StaScanLimits.MAX_BUCKETS|. 394 */ 395 vec<StaBackgroundScanBucketParameters> buckets; 396 }; 397 398 /** 399 * Packet stats for different traffic categories. 400 */ 401 struct StaLinkLayerIfacePacketStats { 402 /** 403 * Number of received unicast data packets. 404 */ 405 uint64_t rxMpdu; 406 /** 407 * Number of successfully transmitted unicast data pkts (ACK rcvd). 408 */ 409 uint64_t txMpdu; 410 /** 411 * Number of transmitted unicast data pkt losses (no ACK). 412 */ 413 uint64_t lostMpdu; 414 /** 415 * Number of transmitted unicast data retry pkts. 416 */ 417 uint64_t retries; 418 }; 419 420 /** 421 * Iface statistics for the current connection. 422 */ 423 struct StaLinkLayerIfaceStats { 424 /** 425 * Number beacons received from the connected AP. 426 */ 427 uint32_t beaconRx; 428 /** 429 * Access Point Beacon and Management frames RSSI (averaged). 430 */ 431 int32_t avgRssiMgmt; 432 /** 433 * WME Best Effort Access Category packet counters. 434 */ 435 StaLinkLayerIfacePacketStats wmeBePktStats; 436 /** 437 * WME Background Access Category packet counters. 438 */ 439 StaLinkLayerIfacePacketStats wmeBkPktStats; 440 /** 441 * WME Video Access Category packet counters. 442 */ 443 StaLinkLayerIfacePacketStats wmeViPktStats; 444 /** 445 * WME Voice Access Category packet counters. 446 */ 447 StaLinkLayerIfacePacketStats wmeVoPktStats; 448 }; 449 450 /** 451 * Cumulative radio statistics since collection was enabled. 452 */ 453 struct StaLinkLayerRadioStats { 454 /** 455 * Time for which the radio is awake. 456 */ 457 uint32_t onTimeInMs; 458 /** 459 * Total time for which the radio is in active transmission. 460 */ 461 uint32_t txTimeInMs; 462 /** 463 * Time for which the radio is in active tranmission per tx level. 464 */ 465 vec<uint32_t> txTimeInMsPerLevel; 466 /** 467 * Time for which the radio is in active receive. 468 */ 469 uint32_t rxTimeInMs; 470 /** 471 * Total time for which the radio is awake due to scan. 472 */ 473 uint32_t onTimeInMsForScan; 474 }; 475 476 /** 477 * Link layer stats retrieved via |getLinkLayerStats|. 478 */ 479 struct StaLinkLayerStats { 480 StaLinkLayerIfaceStats iface; 481 vec<StaLinkLayerRadioStats> radios; 482 /** 483 * TimeStamp for each stats sample. 484 * This is the absolute milliseconds from boot when these stats were 485 * sampled. 486 */ 487 TimeStampInMs timeStampInMs; 488 }; 489 490 /** 491 * Structure describing all the information about a single access point seen 492 * during the scan. 493 */ 494 struct StaScanResult { 495 TimeStampInUs timeStampInUs; 496 vec<uint8_t> ssid; 497 Bssid bssid; 498 Rssi rssi; 499 WifiChannelInMhz frequency; 500 uint16_t beaconPeriodInMs; 501 uint16_t capability; 502 vec<WifiInformationElement> informationElements; 503 }; 504 505 /** 506 * Mask of flags set in the |ScanData| instance. 507 */ 508 enum StaScanDataFlagMask : int32_t { 509 /** 510 * Indicates that a scan was interrupted/did not occur so results may be 511 * incomplete. 512 */ 513 INTERRUPTED = 1 << 0, 514 }; 515 516 /** 517 * Structure describing all the information about all the access points seen during 518 * the scan. 519 */ 520 struct StaScanData { 521 /** 522 * Bitset containing |ScanDataFlagMask| values. 523 */ 524 bitfield<StaScanDataFlagMask> flags; 525 /** 526 * Bitset where each bit indicates if the bucket with that index (starting at 527 * 0) was scanned. 528 */ 529 uint32_t bucketsScanned; 530 /** 531 * List of scan results. 532 */ 533 vec<StaScanResult> results; 534 }; 535 536 /** 537 * Structure describing the roaming control capabilities supported. 538 */ 539 struct StaRoamingCapabilities { 540 /** 541 * Maximum number of BSSID's that may be blacklisted. 542 */ 543 uint32_t maxBlacklistSize; 544 /** 545 * Maximum number of SSID's that may be whitelisted. 546 */ 547 uint32_t maxWhitelistSize; 548 }; 549 550 /** 551 * Structure describing the roaming control configuration. 552 */ 553 struct StaRoamingConfig { 554 /** 555 * List of BSSID's that are blacklisted for roaming. 556 */ 557 vec<Bssid> bssidBlacklist; 558 /** 559 * List of SSID's that are whitelisted for roaming. 560 */ 561 vec<Ssid> ssidWhitelist; 562 }; 563 564 /** 565 * Enum describing the various states to set the roaming 566 * control to. 567 */ 568 enum StaRoamingState : uint8_t { 569 /** 570 * Driver/Firmware must not perform any roaming. 571 */ 572 DISABLED = 0, 573 /** 574 * Driver/Firmware is allowed to perform roaming respecting 575 * the |StaRoamingConfig| parameters set using |configureRoaming|. 576 */ 577 ENABLED = 1 578 }; 579 580 /** 581 * NAN specific types. 582 * TODO(b/32159498): Move to a separate nan_types.hal. 583 * 584 * References to "NAN Spec" are to the Wi-Fi Alliance "Wi-Fi Neighbor Awareness 585 * Networking (NAN) Technical Specification". 586 */ 587 588 /** 589 * Size limits for parameters used in the NAN interface. 590 */ 591 enum NanParamSizeLimits : uint32_t { 592 /** Minimum length of Passphrase argument for data-path configuration */ 593 MIN_PASSPHRASE_LENGTH = 8, 594 595 /** Maximum length of Passphrase argument for data-path configuration */ 596 MAX_PASSPHRASE_LENGTH = 63, 597 }; 598 599 /** 600 * A unique short handle provided by the client to identify individual invocations of 601 * certain API's like |IWifiNanIface.*|. 602 */ 603 typedef uint16_t CommandIdShort; 604 605 /** 606 * NAN API response codes used in request notifications and events. 607 */ 608 enum NanStatusType : uint32_t { 609 SUCCESS = 0, 610 /** NAN Discovery Engine/Host driver failures */ 611 INTERNAL_FAILURE = 1, 612 /** NAN OTA failures */ 613 PROTOCOL_FAILURE = 2, 614 /** The publish/subscribe discovery session id is invalid */ 615 INVALID_SESSION_ID = 3, 616 /** Out of resources to fufill request */ 617 NO_RESOURCES_AVAILABLE = 4, 618 /** Invalid arguments passed */ 619 INVALID_ARGS = 5, 620 /** Invalid peer id */ 621 INVALID_PEER_ID = 6, 622 /** Invalid NAN data-path (ndp) id */ 623 INVALID_NDP_ID = 7, 624 /** Attempting to enable NAN when not available, e.g. wifi is disabled */ 625 NAN_NOT_ALLOWED = 8, 626 /** Over the air ACK not received */ 627 NO_OTA_ACK = 9, 628 /** Attempting to enable NAN when already enabled */ 629 ALREADY_ENABLED = 10, 630 /** Can't queue tx followup message foor transmission */ 631 FOLLOWUP_TX_QUEUE_FULL = 11, 632 /** Unsupported concurrency of NAN and another feature - NAN disabled */ 633 UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12 634 }; 635 636 /** 637 * The discovery bands supported by NAN. 638 */ 639 enum NanBandIndex : uint32_t { 640 NAN_BAND_24GHZ = 0, 641 NAN_BAND_5GHZ 642 }; 643 644 /** 645 * The status information returned in NAN notifications. 646 */ 647 struct WifiNanStatus { 648 /** 649 * Status of the command request. 650 */ 651 NanStatusType status; 652 /** 653 * Further description of the issue causing a failure. 654 */ 655 string description; 656 }; 657 658 /** 659 * NAN Match indication type: control how often to trigger |IWifiNanIfaceEventCallback.eventMatch| 660 * for a single discovery session - i.e. continuously discovering the same publisher with no new 661 * data. 662 */ 663 enum NanMatchAlg : uint32_t { 664 MATCH_ONCE = 0, // Only trigger |IWifiNanIfaceEventCallback.eventMatch| once 665 MATCH_CONTINUOUS, // Trigger |IWifiNanIfaceEventCallback.eventMatch| every time 666 MATCH_NEVER, // Never trigger |IWifiNanIfaceEventCallback.eventMatch| 667 }; 668 669 /** 670 * NAN publish discovery session types. 671 */ 672 enum NanPublishType : uint32_t { 673 UNSOLICITED = 0, // Publish session broadcasts discovery packets 674 SOLICITED, // Publish session silent, responds to active subscribes queries 675 UNSOLICITED_SOLICITED, // Both 676 }; 677 678 /** 679 * NAN transmit type used in |NanPublishType.SOLICITED| or |NanPublishType.UNSOLICITED_SOLICITED| 680 * publish discovery sessions. Describes the addressing of the packet responding to an ACTIVE 681 * subscribe query. 682 */ 683 enum NanTxType : uint32_t { 684 BROADCAST = 0, // Respond with a broadcast packet 685 UNICAST, // Respond with a unicast packet 686 }; 687 688 /** 689 * NAN subscribe discovery session types. 690 */ 691 enum NanSubscribeType : uint32_t { 692 PASSIVE = 0, // Subscribe session scans for |NanPublishType.UNSOLICITED| publish sessions. 693 ACTIVE, // Subscribe session probes for |NanPublishType.SOLICITED| publish sessions. 694 }; 695 696 /** 697 * NAN Service Response Filter Attribute Bit. 698 */ 699 enum NanSrfType : uint32_t { 700 BLOOM_FILTER = 0, // Use a Bloom filter. 701 PARTIAL_MAC_ADDR, // Use a list of MAC addresses. 702 }; 703 704 /** 705 * NAN DP (data-path) channel config options. 706 */ 707 enum NanDataPathChannelCfg : uint32_t { 708 CHANNEL_NOT_REQUESTED = 0, // No channel request is specified. 709 REQUEST_CHANNEL_SETUP, // Channel request is specified - but may be overridden by firmware. 710 FORCE_CHANNEL_SETUP, // Channel request is specified and must be respected. If the firmware 711 // cannot honor the request then the data-path request is rejected. 712 }; 713 714 /** 715 * NAN DP (data-path) security configuration options. 716 */ 717 enum NanDataPathSecurityType : uint32_t { 718 OPEN, // no security 719 PMK, // security: PMK 720 PASSPHRASE, // security: passphrase 721 }; 722 723 /** 724 * NAN band-specific configuration. 725 */ 726 struct NanBandSpecificConfig { 727 /** 728 * RSSI values controlling clustering behavior per spec. RSSI values are specified without a sign, 729 * e.g. a value of -65dBm would be specified as 65. 730 */ 731 uint8_t rssiClose; // NAN Spec: RSSI_close 732 uint8_t rssiMiddle; // NAN Spec: RSSI_middle 733 /** 734 * RSSI value determining whether discovery is near (used if enabled in discovery by 735 * |NanDiscoveryCommonConfig.useRssiThreshold|). 736 * RSSI values are specified without a sign, e.g. a value of -65dBm would be specified as 65. 737 * NAN Spec: RSSI_close_proximity 738 */ 739 uint8_t rssiCloseProximity; 740 /** 741 * Dwell time of each discovery channel in milliseconds. If set to 0 then the firmware determines 742 * the dwell time to use. 743 */ 744 uint8_t dwellTimeMs; 745 /** 746 * Scan period of each discovery channel in seconds. If set to 0 then the firmware determines 747 * the scan period to use. 748 */ 749 uint16_t scanPeriodSec; 750 /** 751 * Specifies the discovery window interval for Sync beacons and SDF's. 752 * Valid values of DW Interval are: 1, 2, 3, 4 and 5 corresponding to 1, 2, 4, 8, and 16 DWs. 753 * Value of 0: 754 * - reserved in 2.4GHz band 755 * - no wakeup at all in 5GHz band 756 * The publish/subscribe period values don't override this device level configurations if 757 * it is specified. 758 * Configuration is only used only if |validDiscoveryWindowIntervalVal| is set to true. 759 * NAN Spec: Device Capability Attribute / 2.4 GHz DW, Device Capability Attribute / 5 GHz DW 760 */ 761 bool validDiscoveryWindowIntervalVal; 762 uint8_t discoveryWindowIntervalVal; 763 }; 764 765 /** 766 * Debug configuration parameters. Many of these allow non-standard-compliant operation and are 767 * not intended for normal operational mode. 768 */ 769 struct NanDebugConfig { 770 /** 771 * Specification of the lower 2 bytes of the cluster ID. The cluster ID is 50-60-9a-01-00-00 to 772 * 50-60-9a-01-FF-FF. Configuration of the bottom and top values of the range (which defaults to 773 * 0x0000 and 0xFFFF respectively). 774 * Configuration is only used if |validClusterIdVals| is set to true. 775 */ 776 bool validClusterIdVals; 777 uint16_t clusterIdBottomRangeVal; 778 uint16_t clusterIdTopRangeVal; 779 /** 780 * NAN management interface address, if specified (|validIntfAddrVal| is true) then overrides any 781 * other configuration (specifically the default randomization configured by 782 * |NanConfigRequest.macAddressRandomizationIntervalSec|). 783 */ 784 bool validIntfAddrVal; 785 MacAddress intfAddrVal; 786 /** 787 * Combination of the 24 bit Organizationally Unique ID (OUI) and the 8 bit OUI Type. 788 * Used if |validOuiVal| is set to true. 789 */ 790 bool validOuiVal; 791 uint32_t ouiVal; 792 /** 793 * Force the Random Factor to the specified value for all transmitted Sync/Discovery beacons. 794 * Used if |validRandomFactorForceVal| is set to true. 795 * NAN Spec: Master Indication Attribute / Random Factor 796 */ 797 bool validRandomFactorForceVal; 798 uint8_t randomFactorForceVal; 799 /** 800 * Forces the hop-count for all transmitted Sync and Discovery Beacons NO matter the real 801 * hop-count being received over the air. Used if the |validHopCountForceVal}| flag is set to 802 * true. 803 * NAN Spec: Cluster Attribute / Anchor Master Information / Hop Count to Anchor Master 804 */ 805 bool validHopCountForceVal; 806 uint8_t hopCountForceVal; 807 /** 808 * Frequency in MHz to of the discovery channel in the specified band. Indexed by |NanBandIndex|. 809 * Used if the |validDiscoveryChannelVal| is set to true. 810 */ 811 bool validDiscoveryChannelVal; 812 WifiChannelInMhz[2] discoveryChannelMhzVal; 813 /** 814 * Specifies whether sync/discovery beacons are transmitted in the specified band. Indexed by 815 * |NanBandIndex|. Used if the |validUseBeaconsInBandVal| is set to true. 816 */ 817 bool validUseBeaconsInBandVal; 818 bool[2] useBeaconsInBandVal; 819 /** 820 * Specifies whether SDF (service discovery frames) are transmitted in the specified band. Indexed 821 * by |NanBandIndex|. Used if the |validUseSdfInBandVal| is set to true. 822 */ 823 bool validUseSdfInBandVal; 824 bool[2] useSdfInBandVal; 825 }; 826 827 /** 828 * Configuration parameters of NAN: used when enabling and re-configuring a NAN cluster. 829 */ 830 struct NanConfigRequest { 831 /** 832 * Master preference of this device. 833 * NAN Spec: Master Indication Attribute / Master Preference 834 */ 835 uint8_t masterPref; 836 /** 837 * Controls whether or not the |IWifiNanIfaceEventCallback.eventClusterEvent| will be delivered 838 * for |NanClusterEventType.DISCOVERY_MAC_ADDRESS_CHANGED|. 839 */ 840 bool disableDiscoveryAddressChangeIndication; 841 /** 842 * Controls whether or not the |IWifiNanIfaceEventCallback.eventClusterEvent| will be delivered 843 * for |NanClusterEventType.STARTED_CLUSTER|. 844 */ 845 bool disableStartedClusterIndication; 846 /** 847 * Controls whether or not the |IWifiNanIfaceEventCallback.eventClusterEvent| will be delivered 848 * for |NanClusterEventType.JOINED_CLUSTER|. 849 */ 850 bool disableJoinedClusterIndication; 851 /** 852 * Control whether publish service IDs are included in Sync/Discovery beacons. 853 * NAN Spec: Service ID List Attribute 854 */ 855 bool includePublishServiceIdsInBeacon; 856 /** 857 * If |includePublishServiceIdsInBeacon| is true then specifies the number of publish service IDs 858 * to include in the Sync/Discovery beacons: 859 * Value = 0: include as many service IDs as will fit into the maximum allowed beacon frame size. 860 * Value must fit within 7 bits - i.e. <= 127. 861 */ 862 uint8_t numberOfPublishServiceIdsInBeacon; 863 /** 864 * Control whether subscribe service IDs are included in Sync/Discovery beacons. 865 * Spec: Subscribe Service ID List Attribute 866 */ 867 bool includeSubscribeServiceIdsInBeacon; 868 /** 869 * If |includeSubscribeServiceIdsInBeacon| is true then specifies the number of subscribe service 870 * IDs to include in the Sync/Discovery beacons: 871 * Value = 0: include as many service IDs as will fit into the maximum allowed beacon frame size. 872 * Value must fit within 7 bits - i.e. <= 127. 873 */ 874 uint8_t numberOfSubscribeServiceIdsInBeacon; 875 /** 876 * Number of samples used to calculate RSSI. 877 */ 878 uint16_t rssiWindowSize; 879 /** 880 * Specifies the interval in seconds that the NAN management interface MAC address is randomized. 881 * A value of 0 is used to disable the MAC address randomization 882 */ 883 uint32_t macAddressRandomizationIntervalSec; 884 /** 885 * Additional configuration provided per band: indexed by |NanBandIndex|. 886 */ 887 NanBandSpecificConfig[2] bandSpecificConfig; 888 }; 889 890 /** 891 * Enable requests for NAN: start-up configuration |IWifiNanIface.enableRequest|. 892 */ 893 struct NanEnableRequest { 894 /** 895 * Enable operation in a specific band: indexed by |NanBandIndex|. 896 */ 897 bool[2] operateInBand; 898 /** 899 * Specify extent of cluster by specifying the max hop count. 900 */ 901 uint8_t hopCountMax; 902 /** 903 * Configurations of NAN cluster operation. Can also be modified at run-time using 904 * |IWifiNanIface.configRequest|. 905 */ 906 NanConfigRequest configParams; 907 /** 908 * Non-standard configurations of NAN cluster operation - useful for debugging operations. 909 */ 910 NanDebugConfig debugConfigs; 911 }; 912 913 /** 914 * Cipher suite flags. 915 */ 916 enum NanCipherSuiteType : uint32_t { 917 NONE = 0, // No (open) security 918 SHARED_KEY_128_MASK = 1 << 0, // NCS-SK-128 919 SHARED_KEY_256_MASK = 1 << 1 // NCS-SK-256 920 }; 921 922 /** 923 * Ranging in the context of discovery sessions indication controls. Controls the frequency of 924 * ranging-driven |IWifiNanIfaceEventCallback.eventMatch|. 925 */ 926 enum NanRangingIndication : uint32_t { 927 CONTINUOUS_INDICATION_MASK = 1 << 0, // trigger event on every RTT measurement 928 INGRESS_MET_MASK = 1 << 1, // trigger event only when ingress conditions met 929 EGRESS_MET_MASK = 1 << 2 // trigger event only when egress conditions met 930 }; 931 932 /** 933 * Configuration of NAN data-path security. 934 */ 935 struct NanDataPathSecurityConfig { 936 /** 937 * Security configuration of the data-path (NDP). Security is required if not equal to 938 * |NanDataPathSecurityType.OPEN|. 939 * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Security Required 940 */ 941 NanDataPathSecurityType securityType; 942 /** 943 * Cipher type for data-paths. If |securityType| is |NanDataPathSecurityType.OPEN| then must 944 * be set to |NanCipherSuiteType.NONE|, otherwise a non-|NanCipherSuiteType.NONE| cipher suite 945 * must be specified. 946 */ 947 NanCipherSuiteType cipherType; 948 /** 949 * Optional Pairwise Master Key (PMK). Must be specified (and is only used) if |securityType| is 950 * set to |NanDataPathSecurityType.PMK|. 951 * Ref: IEEE 802.11i 952 */ 953 uint8_t[32] pmk; 954 /** 955 * Optional Passphrase. Must be specified (and is only used) if |securityType| is set to 956 * |NanDataPathSecurityType.PASSPHRASE|. 957 * Min length: |MIN_PASSPHRASE_LENGTH| 958 * Max length: |MAX_PASSPHRASE_LENGTH| 959 * NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites 960 */ 961 vec<uint8_t> passphrase; 962 }; 963 964 /** 965 * Configurations of NAN discovery sessions: common to publish and subscribe discovery. 966 */ 967 struct NanDiscoveryCommonConfig { 968 /** 969 * The ID of the discovery session being configured. A value of 0 specifies a request to create 970 * a new discovery session. The new discovery session ID is returned with 971 * |IWifiNanIfaceEventCallback.notifyStartPublishResponse| or 972 * |IWifiNanIfaceEventCallback.notifyStartSubscribeResponse|. 973 * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID 974 */ 975 uint8_t sessionId; 976 /** 977 * The lifetime of the discovery session in seconds. A value of 0 means run forever or until 978 * canceled using |IWifiIface.stopPublishRequest| or |IWifiIface.stopSubscribeRequest|. 979 */ 980 uint16_t ttlSec; 981 /** 982 * Indicates the interval between two Discovery Windows in which the device supporting the 983 * service is awake to transmit or receive the Service Discovery frames. Valid values of Awake 984 * DW Interval are: 1, 2, 4, 8 and 16. A value of 0 will default to 1. Does not override 985 * |NanBandSpecificConfig.discoveryWindowIntervalVal| configurations if those are specified. 986 */ 987 uint16_t discoveryWindowPeriod; 988 /** 989 * The lifetime of the discovery session in number of transmitted SDF discovery packets. A value 990 * of 0 means forever or until canceled using |IWifiIface.stopPublishRequest| or 991 * |IWifiIface.stopSubscribeRequest|. 992 */ 993 uint8_t discoveryCount; 994 /** 995 * UTF-8 encoded string identifying the service. 996 * Max length: |NanCapabilities.maxServiceNameLen|. 997 * NAN Spec: The only acceptable single-byte UTF-8 symbols for a Service Name are alphanumeric 998 * values (A-Z, a-z, 0-9), the hyphen ('-'), and the period ('.'). All valid multi-byte UTF-8 999 * characters are acceptable in a Service Name. 1000 */ 1001 vec<uint8_t> serviceName; 1002 /** 1003 * Specifies how often to trigger |IWifiNanIfaceEventCallback.eventMatch| when continuously 1004 * discovering the same discovery session (with no changes). 1005 */ 1006 NanMatchAlg discoveryMatchIndicator; 1007 /** 1008 * Arbitrary information communicated in discovery packets - there is no semantic meaning to these 1009 * bytes. They are passed-through from publisher to subscriber as-is with no parsing. 1010 * Max length: |NanCapabilities.maxServiceSpecificInfoLen|. 1011 * NAN Spec: Service Descriptor Attribute (SDA) / Service Info 1012 */ 1013 vec<uint8_t> serviceSpecificInfo; 1014 /** 1015 * Arbitrary information communicated in discovery packets - there is no semantic meaning to these 1016 * bytes. They are passed-through from publisher to subscriber as-is with no parsing. 1017 * Max length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|. 1018 * Spec: Service Descriptor Extension Attribute (SDEA) / Service Info 1019 */ 1020 vec<uint8_t> extendedServiceSpecificInfo; 1021 /** 1022 * Ordered sequence of <length, value> pairs (|length| uses 1 byte and contains the number of 1023 * bytes in the |value| field) which specify further match criteria (beyond the service name). 1024 * The match behavior is specified in details in the NAN spec. 1025 * Publisher: used in SOLICITED or SOLICITED_UNSOLICITED sessions. 1026 * Subscriber: used in ACTIVE or PASSIVE sessions. 1027 * Max length: |NanCapabilities.maxMatchFilterLen|. 1028 * NAN Spec: matching_filter_rx 1029 */ 1030 vec<uint8_t> rxMatchFilter; 1031 /** 1032 * Ordered sequence of <length, value> pairs (|length| uses 1 byte and contains the number of 1033 * bytes in the |value| field) which specify further match criteria (beyond the service name). 1034 * The match behavior is specified in details in the NAN spec. 1035 * Publisher: used if provided. 1036 * Subscriber: used (if provided) only in ACTIVE sessions. 1037 * Max length: |NanCapabilities.maxMatchFilterLen|. 1038 * NAN Spec: matching_filter_tx and Service Descriptor Attribute (SDA) / Matching Filter 1039 */ 1040 vec<uint8_t> txMatchFilter; 1041 /** 1042 * Specifies whether or not the discovery session uses the 1043 * |NanBandSpecificConfig.rssiCloseProximity| value (configured in enable/configure requests) to 1044 * filter out matched discovered peers. 1045 * NAN Spec: Service Descriptor Attribute / Service Control / Discovery Range Limited. 1046 */ 1047 bool useRssiThreshold; 1048 /** 1049 * Controls whether or not the |IWifiNanIfaceEventCallback.eventPublishTerminated| (for publish 1050 * discovery sessions) or |IWifiNanIfaceEventCallback.eventSubscribeTerminated| (for subscribe 1051 * discovery sessions) will be delivered. 1052 */ 1053 bool disableDiscoveryTerminationIndication; 1054 /** 1055 * Controls whether or not the |IWifiNanIfaceEventCallback.eventMatchExpired| will be delivered. 1056 */ 1057 bool disableMatchExpirationIndication; 1058 /** 1059 * Controls whether or not the |IWifiNanIfaceEventCallback.eventFollowupReceived| will be 1060 * delivered. 1061 */ 1062 bool disableFollowupReceivedIndication; 1063 /** 1064 * Security configuration of data-paths created in the context of this discovery session. Security 1065 * parameters can be overridden during the actual construction of the data-path - allowing 1066 * individual data-paths to have unique PMKs or Passphrases. 1067 */ 1068 NanDataPathSecurityConfig securityConfig; 1069 /** 1070 * Specifies whether or not there is a ranging requirement in this discovery session. 1071 * Ranging is only performed if all other match criteria with the peer are met. Ranging must 1072 * be performed if both peers in the discovery session (publisher and subscriber) set this 1073 * flag to true. Otherwise, if either peer sets this flag to false, ranging must not be performed 1074 * and must not impact discovery decisions. 1075 * Note: specifying that ranging is required also implies that this device must automatically 1076 * accept ranging requests from peers. 1077 * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Ranging Require. 1078 */ 1079 bool rangingRequired; 1080 /** 1081 * Interval in msec between two ranging measurements. Only relevant if |rangingRequired| is true. 1082 * If the Awake DW interval specified either in |discoveryWindowPeriod| or in 1083 * |NanBandSpecificConfig.discoveryWindowIntervalVal| is larger than the ranging interval then 1084 * priority is given to Awake DW interval. 1085 */ 1086 uint32_t rangingIntervalMsec; 1087 /** 1088 * The type of ranging feedback to be provided by discovery session matches 1089 * |IWifiNanIfaceEventCallback.eventMatch|. Only relevant if |rangingRequired| is true. 1090 */ 1091 bitfield<NanRangingIndication> configRangingIndications; 1092 /** 1093 * The ingress and egress distance in cm. If ranging is enabled (|rangingEnabled| is true) then 1094 * |configRangingIndications| is used to determine whether ingress and/or egress (or neither) 1095 * are used to determine whether a match has occurred. 1096 * NAN Spec: Service Discovery Extension Attribute (SDEA) / Ingress & Egress Range Limit 1097 */ 1098 uint16_t distanceIngressCm; 1099 uint16_t distanceEgressCm; 1100 }; 1101 1102 /** 1103 * Publish request: specifies a publish discovery operation. 1104 */ 1105 struct NanPublishRequest { 1106 /** 1107 * Common configuration of discovery sessions. 1108 */ 1109 NanDiscoveryCommonConfig baseConfigs; 1110 /** 1111 * The type of the publish discovery session. 1112 */ 1113 NanPublishType publishType; 1114 /** 1115 * For publishType of |NanPublishType.SOLICITED| or |NanPublishType.UNSOLICITED_SOLICITED| 1116 * specifies the type of transmission used for responding to the probing subscribe discovery 1117 * peer. 1118 */ 1119 NanTxType txType; 1120 /** 1121 * Specifies whether data-path requests |IWifiNanIfaceEventCallback.eventDataPathRequest| (in 1122 * the context of this discovery session) are automatically accepted (if true) - in which case 1123 * the Responder must not call the |IWifiNanIface.respondToDataPathIndicationRequest| method and 1124 * the device must automatically accept the data-path request and complete the negotiation. 1125 */ 1126 bool autoAcceptDataPathRequests; 1127 }; 1128 1129 /** 1130 * Subscribe request: specifies a subscribe discovery operation. 1131 */ 1132 struct NanSubscribeRequest { 1133 /** 1134 * Common configuration of discovery sessions. 1135 */ 1136 NanDiscoveryCommonConfig baseConfigs; 1137 /** 1138 * The type of the subscribe discovery session. 1139 */ 1140 NanSubscribeType subscribeType; 1141 /** 1142 * For |NanSubscribeType.ACTIVE| subscribe discovery sessions specify how the Service Response 1143 * Filter (SRF) attribute is populated. Relevant only if |shouldUseSrf| is set to true. 1144 * NAN Spec: Service Descriptor Attribute (SDA) / Service Response Filter / SRF Control / SRF Type 1145 */ 1146 NanSrfType srfType; 1147 /** 1148 * Configure whether inclusion of an address in |intfAddr| indicates that those devices should 1149 * respond or the reverse. Relevant only if |shouldUseSrf| is set to true and |srfType| is set to 1150 * |NanSrfType.PARTIAL_MAC_ADDR|. 1151 * NAN Spec: Service Descriptor Attribute (SDA) / Service Response Filter / SRF Control / Include 1152 */ 1153 bool srfRespondIfInAddressSet; 1154 /** 1155 * Control whether the Service Response Filter (SRF) is used. 1156 * NAN Spec: Service Descriptor Attribute (SDA) / Service Control / 1157 * Service Response Filter Present 1158 */ 1159 bool shouldUseSrf; 1160 /** 1161 * Control whether the presence of |NanDiscoveryCommonConfig.serviceSpecificInfo| data is needed 1162 * in the publisher in order to trigger service discovery, i.e. a 1163 * |IWifiNanIfaceEventCallback.eventMatch|. The test is for presence of data - not for the 1164 * specific contents of the data. 1165 */ 1166 bool isSsiRequiredForMatch; 1167 /** 1168 * NAN Interface Addresses constituting the Service Response Filter (SRF). 1169 * Max length (number of addresses): |NanCapabilities.maxSubscribeInterfaceAddresses|. 1170 * NAN Spec: Service Descriptor Attribute (SDA) / Service Response Filter / Address Set 1171 */ 1172 vec<MacAddress> intfAddr; 1173 }; 1174 1175 /** 1176 * Transmit follow up message request. 1177 */ 1178 struct NanTransmitFollowupRequest { 1179 /** 1180 * ID of an active publish or subscribe discovery session. Follow-up message is transmitted in the 1181 * context of the discovery session. 1182 * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID 1183 */ 1184 uint8_t discoverySessionId; 1185 /** 1186 * ID of the peer. Obtained as part of an earlier |IWifiNanIfaceEventCallback.eventMatch| or 1187 * |IWifiNanIfaceEventCallback.eventFollowupReceived|. 1188 */ 1189 uint32_t peerId; 1190 /** 1191 * MAC address of the peer. Obtained as part of an earlier |IWifiNanIfaceEventCallback.eventMatch| 1192 * or |IWifiNanIfaceEventCallback.eventFollowupReceived|. 1193 */ 1194 MacAddress addr; 1195 /** 1196 * Should the follow-up message be transmitted with a high priority. 1197 */ 1198 bool isHighPriority; 1199 /** 1200 * Should the follow-up message be transmitted in a discovery window (true) or a further 1201 * availability window (false). 1202 */ 1203 bool shouldUseDiscoveryWindow; 1204 /** 1205 * Arbitrary information communicated to the peer - there is no semantic meaning to these 1206 * bytes. They are passed-through from sender to receiver as-is with no parsing. 1207 * Max length: |NanCapabilities.maxServiceSpecificInfoLen|. 1208 * NAN Spec: Service Descriptor Attribute (SDA) / Service Info 1209 */ 1210 vec<uint8_t> serviceSpecificInfo; 1211 /** 1212 * Arbitrary information communicated in discovery packets - there is no semantic meaning to these 1213 * bytes. They are passed-through from publisher to subscriber as-is with no parsing. 1214 * Max length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|. 1215 * Spec: Service Descriptor Extension Attribute (SDEA) / Service Info 1216 */ 1217 vec<uint8_t> extendedServiceSpecificInfo; 1218 /** 1219 * Disable |IWifiNanIfaceEventCallback.eventTransmitFollowup| - i.e. do not get indication on 1220 * whether the follow-up was transmitted and received successfully. 1221 */ 1222 bool disableFollowupResultIndication; 1223 }; 1224 1225 /** 1226 * Data Path Initiator requesting a data-path. 1227 */ 1228 struct NanInitiateDataPathRequest { 1229 /** 1230 * ID of the peer. Obtained as part of an earlier |IWifiNanIfaceEventCallback.eventMatch| or 1231 * |IWifiNanIfaceEventCallback.eventFollowupReceived|. 1232 */ 1233 uint32_t peerId; 1234 /** 1235 * NAN management interface MAC address of the peer. Obtained as part of an earlier 1236 * |IWifiNanIfaceEventCallback.eventMatch| or |IWifiNanIfaceEventCallback.eventFollowupReceived|. 1237 */ 1238 MacAddress peerDiscMacAddr; 1239 /** 1240 * Config flag for channel request. 1241 */ 1242 NanDataPathChannelCfg channelRequestType; 1243 /** 1244 * Channel frequency in MHz to start data-path. Not relevant if |channelRequestType| is 1245 * |NanDataPathChannelCfg.CHANNEL_NOT_REQUESTED|. 1246 */ 1247 WifiChannelInMhz channel; 1248 /** 1249 * NAN data interface name on which this data-path session is to be initiated. 1250 * This must be an interface created using |IWifiNanIface.createDataInterfaceRequest|. 1251 */ 1252 string ifaceName; 1253 /** 1254 * Security configuration of the requested data-path. 1255 */ 1256 NanDataPathSecurityConfig securityConfig; 1257 /** 1258 * Arbitrary information communicated to the peer as part of the data-path setup process - there 1259 * is no semantic meaning to these bytes. They are passed-through from sender to receiver as-is 1260 * with no parsing. 1261 * Max length: |NanCapabilities.maxAppInfoLen|. 1262 * NAN Spec: Data Path Attributes / NDP Attribute / NDP Specific Info 1263 */ 1264 vec<uint8_t> appInfo; 1265 /** 1266 * A service name to be used with |passphrase| to construct a Pairwise Master Key (PMK) for the 1267 * data-path. Only relevant when a data-path is requested which is not associated with a NAN 1268 * discovery session - e.g. using out-of-band discovery. 1269 * Constraints: same as |NanDiscoveryCommonConfig.serviceName| 1270 * NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites 1271 */ 1272 vec<uint8_t> serviceNameOutOfBand; 1273 }; 1274 1275 /** 1276 * Response to a data-path request from a peer. 1277 */ 1278 struct NanRespondToDataPathIndicationRequest { 1279 /** 1280 * Accept (true) or reject (false) the request. 1281 * NAN Spec: Data Path Attributes / NDP Attribute / Type and Status 1282 */ 1283 bool acceptRequest; 1284 /** 1285 * ID of the data-path (NDP) for which we're responding - obtained as part of the request in 1286 * |IWifiNanIfaceEventCallback.eventDataPathRequest|. 1287 */ 1288 uint32_t ndpInstanceId; 1289 /** 1290 * NAN data interface name on which this data-path session is to be started. 1291 * This must be an interface created using |IWifiNanIface.createDataInterfaceRequest|. 1292 */ 1293 string ifaceName; 1294 /** 1295 * Security configuration of the requested data-path. 1296 */ 1297 NanDataPathSecurityConfig securityConfig; 1298 /** 1299 * Arbitrary information communicated to the peer as part of the data-path setup process - there 1300 * is no semantic meaning to these bytes. They are passed-through from sender to receiver as-is 1301 * with no parsing. 1302 * Max length: |NanCapabilities.maxAppInfoLen|. 1303 * NAN Spec: Data Path Attributes / NDP Attribute / NDP Specific Info 1304 */ 1305 vec<uint8_t> appInfo; 1306 /** 1307 * A service name to be used with |passphrase| to construct a Pairwise Master Key (PMK) for the 1308 * data-path. Only relevant when a data-path is requested which is not associated with a NAN 1309 * discovery session - e.g. using out-of-band discovery. 1310 * Constraints: same as |NanDiscoveryCommonConfig.serviceName| 1311 * NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites 1312 */ 1313 vec<uint8_t> serviceNameOutOfBand; 1314 }; 1315 1316 /** 1317 * NDP Capabilities response. 1318 */ 1319 struct NanCapabilities { 1320 /** 1321 * Maximum number of clusters which the device can join concurrently. 1322 */ 1323 uint32_t maxConcurrentClusters; 1324 /** 1325 * Maximum number of concurrent publish discovery sessions. 1326 */ 1327 uint32_t maxPublishes; 1328 /** 1329 * Maximum number of concurrent subscribe discovery sessions. 1330 */ 1331 uint32_t maxSubscribes; 1332 /** 1333 * Maximum length (in bytes) of service name. 1334 */ 1335 uint32_t maxServiceNameLen; 1336 /** 1337 * Maximum length (in bytes) of individual match filters. 1338 */ 1339 uint32_t maxMatchFilterLen; 1340 /** 1341 * Maximum length (in bytes) of aggregate match filters across all active sessions. 1342 */ 1343 uint32_t maxTotalMatchFilterLen; 1344 /** 1345 * Maximum length (in bytes) of the service specific info field. 1346 */ 1347 uint32_t maxServiceSpecificInfoLen; 1348 /** 1349 * Maximum length (in bytes) of the extended service specific info field. 1350 */ 1351 uint32_t maxExtendedServiceSpecificInfoLen; 1352 /** 1353 * Maximum number of data interfaces (NDI) which can be created concurrently on the device. 1354 */ 1355 uint32_t maxNdiInterfaces; 1356 /** 1357 * Maximum number of data paths (NDP) which can be created concurrently on each individual 1358 * data interface (NDI). 1359 */ 1360 uint32_t maxNdpSessions; 1361 /** 1362 * Maximum length (in bytes) of application info field (used in data-path negotiations). 1363 */ 1364 uint32_t maxAppInfoLen; 1365 /** 1366 * Maximum number of transmitted followup messages which can be queued by the firmware. 1367 */ 1368 uint32_t maxQueuedTransmitFollowupMsgs; 1369 /** 1370 * Maximum number MAC interface addresses which can be specified to a subscribe discovery session. 1371 */ 1372 uint32_t maxSubscribeInterfaceAddresses; 1373 /** 1374 * The set of supported Cipher suites. The |NanCipherSuiteType| bit fields are used. 1375 */ 1376 bitfield<NanCipherSuiteType> supportedCipherSuites; 1377 }; 1378 1379 /** 1380 * Match indication structure 1381 */ 1382 struct NanMatchInd { 1383 /** 1384 * Publish or subscribe discovery session ID of an existing discovery session. 1385 * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID 1386 */ 1387 uint8_t discoverySessionId; 1388 /** 1389 * A unique ID of the peer. Can be subsequently used in |IWifiNanIface.transmitFollowupRequest| or 1390 * to set up a data-path. 1391 */ 1392 uint32_t peerId; 1393 /** 1394 * The NAN Discovery (management) MAC address of the peer. 1395 */ 1396 MacAddress addr; 1397 /** 1398 * The arbitrary information contained in the |NanDiscoveryCommonConfig.serviceSpecificInfo| of 1399 * the peer's discovery session configuration. 1400 * Max length: |NanCapabilities.maxServiceSpecificInfoLen|. 1401 * NAN Spec: Service Descriptor Attribute (SDA) / Service Info 1402 */ 1403 vec<uint8_t> serviceSpecificInfo; 1404 /** 1405 * Arbitrary information communicated in discovery packets - there is no semantic meaning to these 1406 * bytes. They are passed-through from publisher to subscriber as-is with no parsing. 1407 * Max length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|. 1408 * Spec: Service Descriptor Extension Attribute (SDEA) / Service Info 1409 */ 1410 vec<uint8_t> extendedServiceSpecificInfo; 1411 /** 1412 * The match filter from the discovery packet (publish or subscribe) which caused service 1413 * discovery. Matches the peer's |NanDiscoveryCommonConfig.txMatchFilter|. 1414 * Max length: |NanCapabilities.maxMatchFilterLen|. 1415 * NAN Spec: Service Descriptor Attribute (SDA) / Matching Filter 1416 */ 1417 vec<uint8_t> matchFilter; 1418 /** 1419 * Indicates the type of discovery: true if match occurred on a Beacon frame, false if the match 1420 * occurred on a Service Discovery Frames (SDF). 1421 */ 1422 bool matchOccuredInBeaconFlag; 1423 /** 1424 * Flag to indicate firmware is out of resource and that it can no longer track this Service Name. 1425 * Indicates that while |IWifiNanIfaceEventCallback.eventMatch| will be received, the 1426 * |NanDiscoveryCommonConfig.discoveryMatchIndicator| configuration will not be honored. 1427 */ 1428 bool outOfResourceFlag; 1429 /** 1430 * If RSSI filtering was enabled using |NanDiscoveryCommonConfig.useRssiThreshold| in discovery 1431 * session setup then this field contains the received RSSI value. It will contain 0 if RSSI 1432 * filtering was not enabled. 1433 * RSSI values are returned without sign, e.g. -70dBm will be returned as 70. 1434 */ 1435 uint8_t rssiValue; 1436 /** 1437 * Cipher type for data-paths constructed in the context of this discovery session. Valid if 1438 * |peerRequiresSecurityEnabledInNdp| is true. 1439 */ 1440 NanCipherSuiteType peerCipherType; 1441 /** 1442 * Indicates whether or not the peer requires security enabled in any data-path (NDP) constructed 1443 * in the context of this discovery session. The |cipherType| specifies the cipher type for such 1444 * data-paths. 1445 * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Security Required 1446 */ 1447 bool peerRequiresSecurityEnabledInNdp; 1448 /** 1449 * Indicates whether or not the peer requires (and hence allows) ranging in the context of this 1450 * discovery session. 1451 * Note that ranging is only performed if all other match criteria with the peer are met. 1452 * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Ranging Require. 1453 */ 1454 bool peerRequiresRanging; 1455 /** 1456 * Ranging indication supersedes the NanMatchAlg specification. 1457 * Ex: If NanMatchAlg is MATCH_ONCE, but ranging indications is continuous then continuous 1458 * match notifications will be received (with ranging information). 1459 * Ranging indication data is provided if Ranging required is enabled in the discovery 1460 * specification and: 1461 * 1) continuous ranging specified. 1462 * 2) ingress/egress specified and: 1463 * - notify once for ingress >= ingress_distance and egress <= egress_distance, 1464 * - same for ingress_egress_both 1465 * If the Awake DW intervals are larger than the ranging intervals then priority is given to the 1466 * device DW intervals. 1467 * 1468 * If ranging was required and executed contains the distance to the peer in CM. The 1469 * |rangingIndicationType| field specifies the event which triggered ranging. 1470 */ 1471 uint32_t rangingMeasurementInCm; 1472 /** 1473 * The ranging event(s) which triggered the ranging. E.g. can indicate that continuous ranging was 1474 * requested, or else that an ingress event occurred. 1475 */ 1476 bitfield<NanRangingIndication> rangingIndicationType; 1477 }; 1478 1479 /** 1480 * Followup message received from peer indication structure. 1481 */ 1482 struct NanFollowupReceivedInd { 1483 /** 1484 * Discovery session (publish or subscribe) ID of a previously created discovery session. The 1485 * message is received in the context of this discovery session. 1486 * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID 1487 */ 1488 uint8_t discoverySessionId; 1489 /** 1490 * A unique ID of the peer. Can be subsequently used in |IWifiNanIface.transmitFollowupRequest| or 1491 * to set up a data-path. 1492 */ 1493 uint32_t peerId; 1494 /** 1495 * The NAN Discovery (management) MAC address of the peer. 1496 */ 1497 MacAddress addr; 1498 /** 1499 * Indicates whether received in a further availability window (FAW) if true, or in a discovery 1500 * window (DW) if false. 1501 */ 1502 bool receivedInFaw; 1503 /** 1504 * Received message from the peer - there is no semantic meaning to these bytes. They are 1505 * passed-through from sender to receiver as-is with no parsing. 1506 * Max length: |NanCapabilities.maxServiceSpecificInfoLen|. 1507 * NAN Spec: Service Descriptor Attribute (SDA) / Service Info 1508 */ 1509 vec<uint8_t> serviceSpecificInfo; 1510 /** 1511 * Arbitrary information communicated in discovery packets - there is no semantic meaning to these 1512 * bytes. They are passed-through from publisher to subscriber as-is with no parsing. 1513 * Max length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|. 1514 * Spec: Service Descriptor Extension Attribute (SDEA) / Service Info 1515 */ 1516 vec<uint8_t> extendedServiceSpecificInfo; 1517 }; 1518 1519 /** 1520 * Event types for a cluster event indication. 1521 */ 1522 enum NanClusterEventType : uint32_t { 1523 /** 1524 * Management/discovery interface MAC address has changed (e.g. due to randomization or at 1525 * startup). 1526 */ 1527 DISCOVERY_MAC_ADDRESS_CHANGED = 0, 1528 /** 1529 * A new cluster has been formed by this device. 1530 */ 1531 STARTED_CLUSTER, 1532 /** 1533 * This device has joined an existing cluster. 1534 */ 1535 JOINED_CLUSTER, 1536 }; 1537 1538 /** 1539 * Cluster event indication structure: triggered on events impacting how this device is 1540 * visible to peers - cluster forming, joining a new cluster, or changing of the MAC address. 1541 */ 1542 struct NanClusterEventInd { 1543 /** 1544 * Event type causing the cluster event indication to be triggered. 1545 */ 1546 NanClusterEventType eventType; 1547 /** 1548 * MAC Address associated with the corresponding event. 1549 */ 1550 MacAddress addr; 1551 }; 1552 1553 /** 1554 * NAN Data path request Indication Message structure. 1555 * Event indication received by an intended Responder when a Nan Data request initiated by an 1556 * Initiator. 1557 */ 1558 struct NanDataPathRequestInd { 1559 /** 1560 * ID of an active publish or subscribe discovery session - the data-path request is in the 1561 * context of this discovery session. 1562 * NAN Spec: Data Path Attributes / NDP Attribute / Publish ID 1563 */ 1564 uint8_t discoverySessionId; 1565 /** 1566 * MAC address of the Initiator peer. This is the MAC address of the peer's management/discovery 1567 * NAN interface. 1568 */ 1569 MacAddress peerDiscMacAddr; 1570 /** 1571 * ID of the data-path - used to identify the data-path in further negotiation/APIs. 1572 */ 1573 uint32_t ndpInstanceId; 1574 /** 1575 * Specifies whether or not security is required by the peer for the data-path being created. 1576 * NAN Spec: Data Path Attributes / NDP Attribute / NDP Control / Security Present 1577 */ 1578 bool securityRequired; 1579 /** 1580 * Arbitrary information communicated from the peer as part of the data-path setup process - there 1581 * is no semantic meaning to these bytes. They are passed-through from sender to receiver as-is 1582 * with no parsing. 1583 * Max length: |NanCapabilities.maxAppInfoLen|. 1584 * NAN Spec: Data Path Attributes / NDP Attribute / NDP Specific Info 1585 */ 1586 vec<uint8_t> appInfo; 1587 }; 1588 1589 /** 1590 * NAN Data path confirmation Indication structure. 1591 * Event indication is received on both initiator and responder side when negotiation for a 1592 * data-path finish: on success or failure. 1593 */ 1594 struct NanDataPathConfirmInd { 1595 /** 1596 * ID of the data-path. 1597 */ 1598 uint32_t ndpInstanceId; 1599 /** 1600 * Indicates whether the data-path setup succeeded (true) or failed (false). 1601 */ 1602 bool dataPathSetupSuccess; 1603 /** 1604 * MAC address of the peer's data-interface (not it's management/discovery interface). 1605 */ 1606 MacAddress peerNdiMacAddr; 1607 /** 1608 * Arbitrary information communicated from the peer as part of the data-path setup process - there 1609 * is no semantic meaning to these bytes. They are passed-through from sender to receiver as-is 1610 * with no parsing. 1611 * Max length: |NanCapabilities.maxAppInfoLen|. 1612 * NAN Spec: Data Path Attributes / NDP Attribute / NDP Specific Info 1613 */ 1614 vec<uint8_t> appInfo; 1615 /** 1616 * Failure reason if |dataPathSetupSuccess| is false. 1617 */ 1618 WifiNanStatus status; 1619 }; 1620 1621 /** 1622 * RTT specific types. 1623 * TODO(b/32159498): Move to a separate rtt_types.hal. 1624 */ 1625 /** 1626 * Ranging status. 1627 */ 1628 enum RttStatus : uint32_t { 1629 SUCCESS = 0, 1630 /** General failure status */ 1631 FAILURE = 1, 1632 /** Target STA does not respond to request */ 1633 FAIL_NO_RSP = 2, 1634 /** Request rejected. Applies to 2-sided RTT only */ 1635 FAIL_REJECTED = 3, 1636 FAIL_NOT_SCHEDULED_YET = 4, 1637 /** Timing measurement times out */ 1638 FAIL_TM_TIMEOUT = 5, 1639 /** Target on different channel, cannot range */ 1640 FAIL_AP_ON_DIFF_CHANNEL = 6, 1641 /** Ranging not supported */ 1642 FAIL_NO_CAPABILITY = 7, 1643 /** Request aborted for unknown reason */ 1644 ABORTED = 8, 1645 /** Invalid T1-T4 timestamp */ 1646 FAIL_INVALID_TS = 9, 1647 /** 11mc protocol failed */ 1648 FAIL_PROTOCOL = 10, 1649 /** Request could not be scheduled */ 1650 FAIL_SCHEDULE = 11, 1651 /** Responder cannot collaborate at time of request */ 1652 FAIL_BUSY_TRY_LATER = 12, 1653 /** Bad request args */ 1654 INVALID_REQ = 13, 1655 /** WiFi not enabled. */ 1656 NO_WIFI = 14, 1657 /** Responder overrides param info, cannot range with new params */ 1658 FAIL_FTM_PARAM_OVERRIDE = 15, 1659 }; 1660 1661 /** 1662 * RTT peer types. 1663 */ 1664 enum RttPeerType : uint32_t { 1665 AP = 0x1, 1666 STA = 0x2, 1667 P2P_GO = 0x3, 1668 P2P_CLIENT = 0x4, 1669 NAN = 0x5, 1670 }; 1671 1672 /** 1673 * RTT Measurement Bandwidth. 1674 */ 1675 enum RttBw : uint32_t { 1676 BW_5MHZ = 0x01, 1677 BW_10MHZ = 0x02, 1678 BW_20MHZ = 0x04, 1679 BW_40MHZ = 0x08, 1680 BW_80MHZ = 0x10, 1681 BW_160MHZ = 0x20, 1682 }; 1683 1684 /** 1685 * RTT Measurement Preamble. 1686 */ 1687 enum RttPreamble : uint32_t { 1688 LEGACY = 0x1, 1689 HT = 0x2, 1690 VHT = 0x4, 1691 }; 1692 1693 /** 1694 * RTT Types. 1695 */ 1696 enum RttType : uint32_t { 1697 ONE_SIDED = 0x1, 1698 TWO_SIDED = 0x2, 1699 }; 1700 1701 /** 1702 * RTT configuration. 1703 */ 1704 struct RttConfig { 1705 /** 1706 * Peer device mac address. 1707 */ 1708 MacAddress addr; 1709 /** 1710 * 1-sided or 2-sided RTT. 1711 */ 1712 RttType type; 1713 /** 1714 * Optional - peer device hint (STA, P2P, AP). 1715 */ 1716 RttPeerType peer; 1717 /** 1718 * Required for STA-AP mode, optional for P2P, NBD etc. 1719 */ 1720 WifiChannelInfo channel; 1721 /** 1722 * Time interval between bursts (units: 100 ms). 1723 * Applies to 1-sided and 2-sided RTT multi-burst requests. 1724 * Range: 0-31, 0: no preference by initiator (2-sided RTT). 1725 */ 1726 uint32_t burstPeriod; 1727 /** 1728 * Total number of RTT bursts to be executed. It will be 1729 * specified in the same way as the parameter "Number of 1730 * Burst Exponent" found in the FTM frame format. It 1731 * applies to both: 1-sided RTT and 2-sided RTT. Valid 1732 * values are 0 to 15 as defined in 802.11mc std. 1733 * 0 means single shot 1734 * The implication of this parameter on the maximum 1735 * number of RTT results is the following: 1736 * for 1-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst) 1737 * for 2-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst - 1) 1738 */ 1739 uint32_t numBurst; 1740 /** 1741 * Num of frames per burst. 1742 * Minimum value = 1, Maximum value = 31 1743 * For 2-sided this equals the number of FTM frames 1744 * to be attempted in a single burst. This also 1745 * equals the number of FTM frames that the 1746 * initiator will request that the responder send 1747 * in a single frame. 1748 */ 1749 uint32_t numFramesPerBurst; 1750 /** 1751 * Number of retries for a failed RTT frame. 1752 * Applies to 1-sided RTT only. Minimum value = 0, Maximum value = 3 1753 */ 1754 uint32_t numRetriesPerRttFrame; 1755 /** Following fields are only valid for 2-side RTT. */ 1756 /** 1757 * Maximum number of retries that the initiator can 1758 * retry an FTMR frame. 1759 * Minimum value = 0, Maximum value = 3 1760 */ 1761 uint32_t numRetriesPerFtmr; 1762 /** 1763 * Whether to request location civic info or not. 1764 */ 1765 bool mustRequestLci; 1766 /** 1767 * Whether to request location civic records or not. 1768 */ 1769 bool mustRequestLcr; 1770 /** 1771 * Applies to 1-sided and 2-sided RTT. Valid values will 1772 * be 2-11 and 15 as specified by the 802.11mc std for 1773 * the FTM parameter burst duration. In a multi-burst 1774 * request, if responder overrides with larger value, 1775 * the initiator will return failure. In a single-burst 1776 * request if responder overrides with larger value, 1777 * the initiator will sent TMR_STOP to terminate RTT 1778 * at the end of the burst_duration it requested. 1779 */ 1780 uint32_t burstDuration; 1781 /** 1782 * RTT preamble to be used in the RTT frames. 1783 */ 1784 RttPreamble preamble; 1785 /** 1786 * RTT BW to be used in the RTT frames. 1787 */ 1788 RttBw bw; 1789 }; 1790 1791 /** 1792 * RTT results. 1793 */ 1794 struct RttResult { 1795 /** 1796 * Peer device mac address. 1797 */ 1798 MacAddress addr; 1799 /** 1800 * Burst number in a multi-burst request. 1801 */ 1802 uint32_t burstNum; 1803 /** 1804 * Total RTT measurement frames attempted. 1805 */ 1806 uint32_t measurementNumber; 1807 /** 1808 * Total successful RTT measurement frames. 1809 */ 1810 uint32_t successNumber; 1811 /** 1812 * Maximum number of "FTM frames per burst" supported by 1813 * the responder STA. Applies to 2-sided RTT only. 1814 * If reponder overrides with larger value: 1815 * - for single-burst request initiator will truncate the 1816 * larger value and send a TMR_STOP after receiving as 1817 * many frames as originally requested. 1818 * - for multi-burst request, initiator will return 1819 * failure right away. 1820 */ 1821 uint8_t numberPerBurstPeer; 1822 /** 1823 * Ranging status. 1824 */ 1825 RttStatus status; 1826 /** 1827 * When status == RTT_STATUS_FAIL_BUSY_TRY_LATER, 1828 * this will be the time provided by the responder as to 1829 * when the request can be tried again. Applies to 2-sided 1830 * RTT only. In sec, 1-31sec. 1831 */ 1832 uint8_t retryAfterDuration; 1833 /** 1834 * RTT type. 1835 */ 1836 RttType type; 1837 /** 1838 * Average rssi in 0.5 dB steps e.g. 143 implies -71.5 dB. 1839 */ 1840 Rssi rssi; 1841 /** 1842 * Rssi spread in 0.5 dB steps e.g. 5 implies 2.5 dB spread (optional). 1843 */ 1844 Rssi rssiSpread; 1845 /** 1846 * 1-sided RTT: TX rate of RTT frame. 1847 * 2-sided RTT: TX rate of initiator's Ack in response to FTM frame. 1848 */ 1849 WifiRateInfo txRate; 1850 /** 1851 * 1-sided RTT: TX rate of Ack from other side. 1852 * 2-sided RTT: TX rate of FTM frame coming from responder. 1853 */ 1854 WifiRateInfo rxRate; 1855 /** 1856 * Round trip time in picoseconds 1857 */ 1858 TimeSpanInPs rtt; 1859 /** 1860 * Rtt standard deviation in picoseconds. 1861 */ 1862 TimeSpanInPs rttSd; 1863 /** 1864 * Difference between max and min rtt times recorded in picoseconds. 1865 */ 1866 TimeSpanInPs rttSpread; 1867 /** 1868 * Distance in mm (optional). 1869 */ 1870 int32_t distanceInMm; 1871 /** 1872 * Standard deviation in mm (optional). 1873 */ 1874 int32_t distanceSdInMm; 1875 /** 1876 * Difference between max and min distance recorded in mm (optional). 1877 */ 1878 int32_t distanceSpreadInMm; 1879 /** 1880 * Time of the measurement (in microseconds since boot). 1881 */ 1882 TimeStampInUs timeStampInUs; 1883 /** 1884 * in ms, actual time taken by the FW to finish one burst 1885 * measurement. Applies to 1-sided and 2-sided RTT. 1886 */ 1887 uint32_t burstDurationInMs; 1888 /** 1889 * Number of bursts allowed by the responder. Applies 1890 * to 2-sided RTT only. 1891 */ 1892 uint32_t negotiatedBurstNum; 1893 /** 1894 * for 11mc only. 1895 */ 1896 WifiInformationElement lci; 1897 /** 1898 * for 11mc only. 1899 */ 1900 WifiInformationElement lcr; 1901 }; 1902 1903 /** 1904 * RTT Capabilities. 1905 */ 1906 struct RttCapabilities { 1907 /** 1908 * if 1-sided rtt data collection is supported. 1909 */ 1910 bool rttOneSidedSupported; 1911 /** 1912 * if ftm rtt data collection is supported. 1913 */ 1914 bool rttFtmSupported; 1915 /** 1916 * if initiator supports LCI request. Applies to 2-sided RTT. 1917 */ 1918 bool lciSupported; 1919 /** 1920 * if initiator supports LCR request. Applies to 2-sided RTT. 1921 */ 1922 bool lcrSupported; 1923 /** 1924 * if 11mc responder mode is supported. 1925 */ 1926 bool responderSupported; 1927 /** 1928 * Bit mask indicates what preamble is supported by initiator. 1929 * Combination of |RttPreamble| values. 1930 */ 1931 bitfield<RttPreamble> preambleSupport; 1932 /** 1933 * Bit mask indicates what BW is supported by initiator. 1934 * Combination of |RttBw| values. 1935 */ 1936 bitfield<RttBw> bwSupport; 1937 /** 1938 * Draft 11mc spec version supported by chip. 1939 * For instance, version 4.0 must be 40 and version 4.3 must be 43 etc. 1940 */ 1941 uint8_t mcVersion; 1942 }; 1943 1944 /** 1945 * Structs for setting LCI/LCR information to be provided to a requestor. 1946 */ 1947 enum RttMotionPattern : uint32_t { 1948 /** 1949 * Not expected to change location. 1950 */ 1951 NOT_EXPECTED = 0, 1952 /** 1953 * Expected to change location. 1954 */ 1955 EXPECTED = 1, 1956 /** 1957 * Movement pattern unknown. 1958 */ 1959 UNKNOWN = 2, 1960 }; 1961 1962 /** 1963 * Movement pattern unknown. 1964 */ 1965 struct RttLciInformation { 1966 /** 1967 * latitude in degrees * 2^25 , 2's complement. 1968 */ 1969 int64_t latitude; 1970 /** 1971 * longitude in degrees * 2^25 , 2's complement. 1972 */ 1973 int64_t longitude; 1974 /** 1975 * Altitude in units of 1/256 m. 1976 */ 1977 int32_t altitude; 1978 /** 1979 * As defined in Section 2.3.2 of IETF RFC 6225. 1980 */ 1981 uint8_t latitudeUnc; 1982 /** 1983 * As defined in Section 2.3.2 of IETF RFC 6225. 1984 */ 1985 uint8_t longitudeUnc; 1986 /** 1987 * As defined in Section 2.4.5 from IETF RFC 6225. 1988 */ 1989 uint8_t altitudeUnc; 1990 /** Following element for configuring the Z subelement. */ 1991 /** 1992 * Motion pattern type. 1993 */ 1994 RttMotionPattern motionPattern; 1995 /** 1996 * Floor in units of 1/16th of floor. 0x80000000 if unknown. 1997 */ 1998 int32_t floor; 1999 /** 2000 * in units of 1/64 m. 2001 */ 2002 int32_t heightAboveFloor; 2003 /** 2004 * in units of 1/64 m. 0 if unknown 2005 */ 2006 int32_t heightUnc; 2007 }; 2008 2009 struct RttLcrInformation { 2010 /** 2011 * Country code symbol. 2012 */ 2013 int8_t[2] countryCode; 2014 /** 2015 * Civic info to be copied in FTM frame. 2016 */ 2017 string civicInfo; 2018 }; 2019 2020 /*** 2021 * RTT Responder information 2022 */ 2023 struct RttResponder { 2024 WifiChannelInfo channel; 2025 RttPreamble preamble; 2026 }; 2027 2028 /** 2029 * Debug data specific types. 2030 * TODO(b/32159498): Move to a separate debug_types.hal. 2031 */ 2032 typedef uint32_t WifiRingBufferId; 2033 2034 /** 2035 * Flags describing each debug ring buffer. 2036 */ 2037 enum WifiDebugRingBufferFlags : uint32_t { 2038 HAS_BINARY_ENTRIES = 1 << 0, 2039 HAS_ASCII_ENTRIES = 1 << 1, 2040 HAS_PER_PACKET_ENTRIES = 1 << 2, 2041 }; 2042 2043 /** 2044 * Struct describing each debug ring buffer supported by 2045 * the device. 2046 */ 2047 struct WifiDebugRingBufferStatus { 2048 /** 2049 * Name of this debug ring buffer. 2050 */ 2051 string ringName; 2052 /** 2053 * Combination of |WifiDebugRingBufferFlags| values. 2054 */ 2055 uint32_t flags; 2056 /** 2057 * Unique integer representing the ring. 2058 */ 2059 WifiRingBufferId ringId; 2060 /** 2061 * Total memory size allocated for the buffer. 2062 */ 2063 uint32_t sizeInBytes; 2064 /** 2065 * Amount of free space in the buffer. 2066 */ 2067 uint32_t freeSizeInBytes; 2068 /** 2069 * Verbose level for ring buffer. 2070 */ 2071 uint32_t verboseLevel; 2072 }; 2073 2074 /** 2075 * Verbose logging level to set for each debug ring buffer supported 2076 * by the device. 2077 */ 2078 enum WifiDebugRingBufferVerboseLevel : uint32_t { 2079 /** 2080 * Level 0 corresponds to no collection, and it makes log handler 2081 * stop by no more events from driver. 2082 */ 2083 NONE = 0, 2084 /** 2085 * Level 1 correspond to normal log level, with minimal user impact. 2086 * This is the default value. 2087 */ 2088 DEFAULT = 1, 2089 /** 2090 * Level 2 is enabled when user is lazily trying to reproduce a problem, 2091 * wifi performances and power can be impacted but device should not 2092 * otherwise be significantly impacted. 2093 */ 2094 VERBOSE = 2, 2095 /** 2096 * Level 3 is used when trying to actively debug a problem. 2097 * This will cause sever performance degradation. 2098 */ 2099 EXCESSIVE = 3 2100 }; 2101 2102 /** 2103 * Enum describing the fate of the TX packets. 2104 */ 2105 enum WifiDebugTxPacketFate : uint32_t { 2106 /** 2107 * Sent over air and ACKed. 2108 */ 2109 ACKED, 2110 /** 2111 * Sent over air but not ACKed. (Normal for broadcast/multicast.) 2112 */ 2113 SENT, 2114 /** 2115 * Queued within firmware, but not yet sent over air. 2116 */ 2117 FW_QUEUED, 2118 /** 2119 * Dropped by firmware as invalid. E.g. bad source address, bad checksum, 2120 * or invalid for current state. 2121 */ 2122 FW_DROP_INVALID, 2123 /** 2124 * Dropped by firmware due to lack of buffer space. 2125 */ 2126 FW_DROP_NOBUFS, 2127 /** 2128 * Dropped by firmware for any other reason. Includes frames that were sent 2129 * by driver to firmware, but unaccounted for by firmware. 2130 */ 2131 FW_DROP_OTHER, 2132 /** 2133 * Queued within driver, not yet sent to firmware. 2134 */ 2135 DRV_QUEUED, 2136 /** 2137 * Dropped by driver as invalid. E.g. bad source address, or invalid for 2138 * current state. 2139 */ 2140 DRV_DROP_INVALID, 2141 /** 2142 * Dropped by driver due to lack of buffer space. 2143 */ 2144 DRV_DROP_NOBUFS, 2145 /** 2146 * Dropped by driver for any other reason. 2147 */ 2148 DRV_DROP_OTHER, 2149 }; 2150 2151 /** 2152 * Enum describing the fate of the TX packets. 2153 */ 2154 enum WifiDebugRxPacketFate : uint32_t { 2155 /** 2156 * Valid and delivered to network stack (e.g., netif_rx()). 2157 */ 2158 SUCCESS, 2159 /** 2160 * Queued within firmware, but not yet sent to driver. 2161 */ 2162 FW_QUEUED, 2163 /** 2164 * Dropped by firmware due to host-programmable filters. 2165 */ 2166 FW_DROP_FILTER, 2167 /** 2168 * Dropped by firmware as invalid. E.g. bad checksum, decrypt failed, 2169 * or invalid for current state. 2170 */ 2171 FW_DROP_INVALID, 2172 /** 2173 * Dropped by firmware due to lack of buffer space. 2174 */ 2175 FW_DROP_NOBUFS, 2176 /** 2177 * Dropped by firmware for any other reason. 2178 */ 2179 FW_DROP_OTHER, 2180 /** 2181 * Queued within driver, not yet delivered to network stack. 2182 */ 2183 DRV_QUEUED, 2184 /** 2185 * Dropped by driver due to filter rules. 2186 */ 2187 DRV_DROP_FILTER, 2188 /** 2189 * Dropped by driver as invalid. E.g. not permitted in current state. 2190 */ 2191 DRV_DROP_INVALID, 2192 /** 2193 * Dropped by driver due to lack of buffer space. 2194 */ 2195 DRV_DROP_NOBUFS, 2196 /** 2197 * Dropped by driver for any other reason. 2198 */ 2199 DRV_DROP_OTHER, 2200 }; 2201 2202 /** 2203 * Type of frame transmitted/received. 2204 */ 2205 enum WifiDebugPacketFateFrameType : uint32_t { 2206 UNKNOWN, 2207 ETHERNET_II, 2208 MGMT_80211, 2209 }; 2210 2211 /** 2212 * Information regarding the frame transmitted/received. 2213 */ 2214 struct WifiDebugPacketFateFrameInfo { 2215 /** 2216 * The type of MAC-layer frame that this frame_info holds. 2217 * - For data frames, use FRAME_TYPE_ETHERNET_II. 2218 * - For management frames, use FRAME_TYPE_80211_MGMT. 2219 * - If the type of the frame is unknown, use FRAME_TYPE_UNKNOWN. 2220 */ 2221 WifiDebugPacketFateFrameType frameType; 2222 /** 2223 * The number of bytes included in |frameContent|. 2224 * If the frame contents are missing (e.g. RX frame dropped in firmware), 2225 * |frameLen| must be set to 0. 2226 */ 2227 uint64_t frameLen; 2228 /** 2229 * Host clock when this frame was received by the driver (either outbound 2230 * from the host network stack, or inbound from the firmware). 2231 * - The timestamp must be taken from a clock which includes time the host 2232 * spent suspended (e.g. ktime_get_boottime()). 2233 * - If no host timestamp is available (e.g. RX frame was dropped in firmware), 2234 * this field must be set to 0. 2235 */ 2236 TimeStampInUs driverTimestampUsec; 2237 /** 2238 * Firmware clock when this frame was received by the firmware 2239 * (either outbound from the host, or inbound from a remote station). 2240 * - The timestamp must be taken from a clock which includes time firmware 2241 * spent suspended (if applicable). 2242 * - If no firmware timestamp is available (e.g. TX frame was dropped by 2243 * driver), this field must be set to 0. 2244 * - Consumers of |frameInfo| must not assume any synchronization between 2245 * driver and firmware clocks. 2246 */ 2247 TimeStampInUs firmwareTimestampUsec; 2248 /** 2249 * Actual frame content. This is the raw bytes of the corresponding packet. 2250 * - Should be provided for TX frames originated by the host. 2251 * - Should be provided for RX frames received by the driver. 2252 * - Optionally provided for TX frames originated by firmware. 2253 * (At discretion of HAL implementation.) 2254 * - Optionally provided for RX frames dropped in firmware. 2255 * (At discretion of HAL implementation.) 2256 * - If frame content is not provided, |frameLen| must be set to 0. 2257 */ 2258 vec<uint8_t> frameContent; 2259 }; 2260 2261 /** 2262 * Struct describing packet fate report for each Tx frame. 2263 */ 2264 struct WifiDebugTxPacketFateReport { 2265 WifiDebugTxPacketFate fate; 2266 WifiDebugPacketFateFrameInfo frameInfo; 2267 }; 2268 2269 /** 2270 * Struct describing packet fate report for each Rx frame. 2271 */ 2272 struct WifiDebugRxPacketFateReport { 2273 WifiDebugRxPacketFate fate; 2274 WifiDebugPacketFateFrameInfo frameInfo; 2275 }; 2276 2277 /** 2278 * Struct capturing the count of all rx packets that caused 2279 * host wakeup. 2280 */ 2281 struct WifiDebugHostWakeReasonRxPacketDetails { 2282 /** 2283 * Total rx unicast packet which woke up host. 2284 */ 2285 uint32_t rxUnicastCnt; 2286 /** 2287 * Total rx multicast packet which woke up host. 2288 */ 2289 uint32_t rxMulticastCnt; 2290 /** 2291 * Total rx broadcast packet which woke up host. 2292 */ 2293 uint32_t rxBroadcastCnt; 2294 }; 2295 2296 /** 2297 * Struct capturing the count of all rx multicast packets that caused 2298 * host wakeup. 2299 */ 2300 struct WifiDebugHostWakeReasonRxMulticastPacketDetails { 2301 /** 2302 * Rx wake packet was ipv4 multicast. 2303 */ 2304 uint32_t ipv4RxMulticastAddrCnt; 2305 /** 2306 * Rx wake packet was ipv6 multicast. 2307 */ 2308 uint32_t ipv6RxMulticastAddrCnt; 2309 /** 2310 * Rx wake packet was non-ipv4 and non-ipv6. 2311 */ 2312 uint32_t otherRxMulticastAddrCnt; 2313 }; 2314 2315 /** 2316 * Struct capturing the count of all rx ICMP packets that caused 2317 * host wakeup. 2318 */ 2319 struct WifiDebugHostWakeReasonRxIcmpPacketDetails { 2320 /** 2321 * Wake icmp packet count. 2322 */ 2323 uint32_t icmpPkt; 2324 /** 2325 * Wake icmp6 packet count. 2326 */ 2327 uint32_t icmp6Pkt; 2328 /** 2329 * Wake icmp6 RA packet count. 2330 */ 2331 uint32_t icmp6Ra; 2332 /** 2333 * Wake icmp6 NA packet count. 2334 */ 2335 uint32_t icmp6Na; 2336 /** 2337 * Wake icmp6 NS packet count. 2338 */ 2339 uint32_t icmp6Ns; 2340 }; 2341 2342 /** 2343 * Structure capturing the count of all the wireless related host wakeup. 2344 * This is used to capture all the reasons why the host processor 2345 * (WLAN driver) was woken up by the WLAN firmware. 2346 * These stats may be used to debug any power issues caused due to frequent 2347 * wakeup of the host processor by the WLAN firmware. 2348 */ 2349 struct WifiDebugHostWakeReasonStats { 2350 /** 2351 * Total count of cmd/event wakes. 2352 * These must account for all wakeups due to WLAN management 2353 * commands/events received over the air. 2354 */ 2355 uint32_t totalCmdEventWakeCnt; 2356 /** 2357 * Vector of wake counts per cmd/event type. 2358 * The number of command types and their meaning is only understood by the 2359 * vendor. 2360 */ 2361 vec<uint32_t> cmdEventWakeCntPerType; 2362 /** 2363 * Total count of drive/fw wakes. 2364 * These must account for all wakeups due to local driver/firmware 2365 * interactions. These include all vendor implementation specific 2366 * interactions like any heart-beat monitoring, Bus management, etc. 2367 */ 2368 uint32_t totalDriverFwLocalWakeCnt; 2369 /** 2370 * Vector of wake counts per driver/firmware interaction type. 2371 * The number of command types and their meaning is only understood by the 2372 * vendor. 2373 */ 2374 vec<uint32_t> driverFwLocalWakeCntPerType; 2375 /** 2376 * Total data rx packets, that woke up host. 2377 */ 2378 uint32_t totalRxPacketWakeCnt; 2379 WifiDebugHostWakeReasonRxPacketDetails rxPktWakeDetails; 2380 WifiDebugHostWakeReasonRxMulticastPacketDetails rxMulticastPkWakeDetails; 2381 WifiDebugHostWakeReasonRxIcmpPacketDetails rxIcmpPkWakeDetails; 2382 }; 2383