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