1/* 2 * Copyright 2022 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.6; 18 19import @1.0::MacAddress; 20import @1.0::NanCipherSuiteType; 21import @1.0::NanDataPathChannelCfg; 22import @1.0::NanDataPathConfirmInd; 23import @1.0::NanDataPathSecurityConfig; 24import @1.0::NanDataPathSecurityType; 25import @1.0::NanDiscoveryCommonConfig; 26import @1.0::NanInitiateDataPathRequest; 27import @1.0::NanMatchAlg; 28import @1.0::NanRangingIndication; 29import @1.0::NanRespondToDataPathIndicationRequest; 30import @1.0::NanPublishType; 31import @1.0::NanTxType; 32import @1.0::Rssi; 33import @1.0::RttBw; 34import @1.0::RttPeerType; 35import @1.0::RttStatus; 36import @1.0::RttType; 37import @1.0::StaLinkLayerIfaceStats; 38import @1.0::StaLinkLayerRadioStats; 39import @1.0::TimeSpanInPs; 40import @1.0::TimeStampInUs; 41import @1.0::TimeStampInMs; 42import @1.0::WifiChannelInMhz; 43import @1.0::WifiChannelWidthInMhz; 44import @1.0::WifiInformationElement; 45import @1.0::WifiRateNss; 46import @1.4::RttPreamble; 47import @1.4::WifiRatePreamble; 48import @1.5::NanConfigRequestSupplemental; 49import @1.5::WifiBand; 50import @1.5::StaLinkLayerIfaceContentionTimeStats; 51import @1.5::WifiIfaceMode; 52 53/** 54 * Channel operating width in Mhz. 55 */ 56enum WifiChannelWidthInMhz : @1.0::WifiChannelWidthInMhz { 57 /** 58 * 320 MHz 59 */ 60 WIDTH_320 = 7, 61}; 62 63/** 64 * RTT Measurement Bandwidth. 65 */ 66enum RttBw : @1.0::RttBw { 67 BW_320MHZ = 0x40, 68}; 69 70/** 71 * RTT Measurement Preamble. 72 */ 73enum RttPreamble : @1.4::RttPreamble { 74 /** 75 * Preamble type for 11be 76 */ 77 EHT = 0x10, 78}; 79 80/** 81 * Wifi Rate Preamble 82 */ 83enum WifiRatePreamble : @1.4::WifiRatePreamble { 84 /** 85 * Preamble type for 11be 86 */ 87 EHT = 6, 88}; 89 90/** 91 * Antenna configuration 92 */ 93enum WifiAntennaMode : uint32_t { 94 WIFI_ANTENNA_MODE_UNSPECIFIED = 0, 95 WIFI_ANTENNA_MODE_1X1 = 1, 96 WIFI_ANTENNA_MODE_2X2 = 2, 97 WIFI_ANTENNA_MODE_3X3 = 3, 98 WIFI_ANTENNA_MODE_4X4 = 4, 99}; 100 101/** 102 * Channel information. 103 */ 104struct WifiChannelInfo { 105 /** 106 * Channel width (20, 40, 80, 80+80, 160, 320). 107 */ 108 WifiChannelWidthInMhz width; 109 110 /** 111 * Primary 20 MHz channel. 112 */ 113 WifiChannelInMhz centerFreq; 114 115 /** 116 * Center frequency (MHz) first segment. 117 */ 118 WifiChannelInMhz centerFreq0; 119 120 /** 121 * Center frequency (MHz) second segment. 122 */ 123 WifiChannelInMhz centerFreq1; 124}; 125 126/** 127 * RTT configuration. 128 */ 129struct RttConfig { 130 /** 131 * Peer device mac address. 132 */ 133 MacAddress addr; 134 135 /** 136 * 1-sided or 2-sided RTT. 137 */ 138 RttType type; 139 140 /** 141 * Optional - peer device hint (STA, P2P, AP). 142 */ 143 RttPeerType peer; 144 145 /** 146 * Required for STA-AP mode, optional for P2P, NBD etc. 147 */ 148 WifiChannelInfo channel; 149 150 /** 151 * Time interval between bursts (units: 100 ms). 152 * Applies to 1-sided and 2-sided RTT multi-burst requests. 153 * Range: 0-31, 0: no preference by initiator (2-sided RTT). 154 */ 155 uint32_t burstPeriod; 156 157 /** 158 * Total number of RTT bursts to be executed. It will be 159 * specified in the same way as the parameter "Number of 160 * Burst Exponent" found in the FTM frame format. It 161 * applies to both: 1-sided RTT and 2-sided RTT. Valid 162 * values are 0 to 15 as defined in 802.11mc std. 163 * 0 means single shot 164 * The implication of this parameter on the maximum 165 * number of RTT results is the following: 166 * for 1-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst) 167 * for 2-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst - 1) 168 */ 169 uint32_t numBurst; 170 171 /** 172 * Num of frames per burst. 173 * Minimum value = 1, Maximum value = 31 174 * For 2-sided this equals the number of FTM frames 175 * to be attempted in a single burst. This also 176 * equals the number of FTM frames that the 177 * initiator will request that the responder send 178 * in a single frame. 179 */ 180 uint32_t numFramesPerBurst; 181 182 /** 183 * Number of retries for a failed RTT frame. 184 * Applies to 1-sided RTT only. Minimum value = 0, Maximum value = 3 185 */ 186 uint32_t numRetriesPerRttFrame; 187 188 /** 189 * Following fields are only valid for 2-side RTT. 190 * 191 * 192 * Maximum number of retries that the initiator can 193 * retry an FTMR frame. 194 * Minimum value = 0, Maximum value = 3 195 */ 196 uint32_t numRetriesPerFtmr; 197 198 /** 199 * Whether to request location civic info or not. 200 */ 201 bool mustRequestLci; 202 203 /** 204 * Whether to request location civic records or not. 205 */ 206 bool mustRequestLcr; 207 208 /** 209 * Applies to 1-sided and 2-sided RTT. Valid values will 210 * be 2-11 and 15 as specified by the 802.11mc std for 211 * the FTM parameter burst duration. In a multi-burst 212 * request, if responder overrides with larger value, 213 * the initiator will return failure. In a single-burst 214 * request if responder overrides with larger value, 215 * the initiator will sent TMR_STOP to terminate RTT 216 * at the end of the burst_duration it requested. 217 */ 218 uint32_t burstDuration; 219 220 /** 221 * RTT preamble to be used in the RTT frames. 222 */ 223 RttPreamble preamble; 224 225 /** 226 * RTT BW to be used in the RTT frames. 227 */ 228 RttBw bw; 229}; 230 231/** 232 * RTT Responder information 233 */ 234struct RttResponder { 235 WifiChannelInfo channel; 236 237 RttPreamble preamble; 238}; 239 240struct WifiChannelStats { 241 /** 242 * Channel information. 243 */ 244 WifiChannelInfo channel; 245 246 /** 247 * Total time for which the radio is awake on this channel. 248 */ 249 uint32_t onTimeInMs; 250 251 /** 252 * Total time for which CCA is held busy on this channel. 253 */ 254 uint32_t ccaBusyTimeInMs; 255}; 256 257struct StaLinkLayerRadioStats { 258 /** 259 * Baseline information as defined in HAL 1.0. 260 */ 261 @1.0::StaLinkLayerRadioStats V1_0; 262 263 /** 264 * Total time for which the radio is awake due to NAN scan since boot or crash. 265 */ 266 uint32_t onTimeInMsForNanScan; 267 268 /** 269 * Total time for which the radio is awake due to background scan since boot or crash. 270 */ 271 uint32_t onTimeInMsForBgScan; 272 273 /** 274 * Total time for which the radio is awake due to roam scan since boot or crash. 275 */ 276 uint32_t onTimeInMsForRoamScan; 277 278 /** 279 * Total time for which the radio is awake due to PNO scan since boot or crash. 280 */ 281 uint32_t onTimeInMsForPnoScan; 282 283 /** 284 * Total time for which the radio is awake due to Hotspot 2.0 scans and GAS exchange since boot 285 * or crash. 286 */ 287 uint32_t onTimeInMsForHs20Scan; 288 289 /** 290 * List of channel stats associated with this radio 291 */ 292 vec<WifiChannelStats> channelStats; 293 294 /** 295 * Radio ID: An implementation specific value identifying the radio interface for which the 296 * stats are produced. Framework must not interpret this value. It must use this value for 297 * persistently identifying the statistics between calls, 298 * e.g. if the HAL provides them in different order. 299 */ 300 int32_t radioId; 301}; 302 303/** 304 * Per peer statistics. The types of peer include the Access Point (AP), the Tunneled Direct Link 305 * Setup (TDLS), the Group Owner (GO), the Neighbor Awareness Networking (NAN), etc. 306 */ 307struct StaPeerInfo { 308 /** 309 * Station count: The total number of stations currently associated with the peer. 310 */ 311 uint16_t staCount; 312 313 /** 314 * Channel utilization: The percentage of time (normalized to 255, i.e., x% corresponds to 315 * (int) x * 255 / 100) that the medium is sensed as busy measured by either physical or 316 * virtual carrier sense (CS) mechanism. 317 */ 318 uint16_t chanUtil; 319 320 /** 321 * Per rate statistics 322 */ 323 vec<StaRateStat> rateStats; 324}; 325 326/** 327 * Iface statistics for the current connection. 328 */ 329struct StaLinkLayerIfaceStats { 330 /** 331 * Baseline information as defined in HAL 1.0. 332 */ 333 @1.0::StaLinkLayerIfaceStats V1_0; 334 335 /** 336 * Duty cycle for the iface. 337 * if this iface is being served using time slicing on a radio with one or more ifaces 338 * (i.e MCC), then the duty cycle assigned to this iface in %. 339 * If not using time slicing (i.e SCC or DBS), set to 100. 340 */ 341 uint8_t timeSliceDutyCycleInPercent; 342 343 /** 344 * WME Best Effort (BE) Access Category (AC) contention time statistics. 345 */ 346 StaLinkLayerIfaceContentionTimeStats wmeBeContentionTimeStats; 347 348 /** 349 * WME Background (BK) Access Category (AC) contention time statistics. 350 */ 351 StaLinkLayerIfaceContentionTimeStats wmeBkContentionTimeStats; 352 353 /** 354 * WME Video (VI) Access Category (AC) contention time statistics. 355 */ 356 StaLinkLayerIfaceContentionTimeStats wmeViContentionTimeStats; 357 358 /** 359 * WME Voice (VO) Access Category (AC) contention time statistics. 360 */ 361 StaLinkLayerIfaceContentionTimeStats wmeVoContentionTimeStats; 362 363 /** 364 * Per peer statistics. 365 */ 366 vec<StaPeerInfo> peers; 367}; 368 369/** 370 * Link layer stats retrieved via |getLinkLayerStats|. 371 */ 372struct StaLinkLayerStats { 373 StaLinkLayerIfaceStats iface; 374 375 vec<StaLinkLayerRadioStats> radios; 376 377 /** 378 * TimeStamp for each stats sample. 379 * This is the absolute milliseconds from boot when these stats were 380 * sampled. 381 */ 382 TimeStampInMs timeStampInMs; 383}; 384 385/** 386 * Wifi rate info. 387 */ 388struct WifiRateInfo { 389 /** 390 * Preamble used for RTT measurements. 391 */ 392 WifiRatePreamble preamble; 393 394 /** 395 * Number of spatial streams. 396 */ 397 WifiRateNss nss; 398 399 /** 400 * Bandwidth of channel. 401 */ 402 WifiChannelWidthInMhz bw; 403 404 /** 405 * OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps. 406 * HT/VHT/HE/EHT it would be mcs index. 407 */ 408 uint8_t rateMcsIdx; 409 410 /** 411 * Bitrate in units of 100 Kbps. 412 */ 413 uint32_t bitRateInKbps; 414}; 415 416/** 417 * Per rate statistics. The rate is characterized by the combination of preamble, number of spatial 418 * streams, transmission bandwidth, and modulation and coding scheme (MCS). 419 */ 420struct StaRateStat { 421 /** 422 * Wifi rate information: preamble, number of spatial streams, bandwidth, MCS, etc. 423 */ 424 WifiRateInfo rateInfo; 425 426 /** 427 * Number of successfully transmitted data packets (ACK received) 428 */ 429 uint32_t txMpdu; 430 431 /** 432 * Number of received data packets 433 */ 434 uint32_t rxMpdu; 435 436 /** 437 * Number of data packet losses (no ACK) 438 */ 439 uint32_t mpduLost; 440 441 /** 442 * Number of data packet retries 443 */ 444 uint32_t retries; 445}; 446 447/** 448 * RTT results. 449 */ 450struct RttResult { 451 /** 452 * Peer device mac address. 453 */ 454 MacAddress addr; 455 456 /** 457 * Burst number in a multi-burst request. 458 */ 459 uint32_t burstNum; 460 461 /** 462 * Total RTT measurement frames attempted. 463 */ 464 uint32_t measurementNumber; 465 466 /** 467 * Total successful RTT measurement frames. 468 */ 469 uint32_t successNumber; 470 471 /** 472 * Maximum number of "FTM frames per burst" supported by 473 * the responder STA. Applies to 2-sided RTT only. 474 * If reponder overrides with larger value: 475 * - for single-burst request initiator will truncate the 476 * larger value and send a TMR_STOP after receiving as 477 * many frames as originally requested. 478 * - for multi-burst request, initiator will return 479 * failure right away. 480 */ 481 uint8_t numberPerBurstPeer; 482 483 /** 484 * Ranging status. 485 */ 486 RttStatus status; 487 488 /** 489 * When status == RTT_STATUS_FAIL_BUSY_TRY_LATER, 490 * this will be the time provided by the responder as to 491 * when the request can be tried again. Applies to 2-sided 492 * RTT only. In sec, 1-31sec. 493 */ 494 uint8_t retryAfterDuration; 495 496 /** 497 * RTT type. 498 */ 499 RttType type; 500 501 /** 502 * Average rssi in 0.5 dB steps e.g. 143 implies -71.5 dB. 503 */ 504 Rssi rssi; 505 506 /** 507 * Rssi spread in 0.5 dB steps e.g. 5 implies 2.5 dB spread (optional). 508 */ 509 Rssi rssiSpread; 510 511 /** 512 * 1-sided RTT: TX rate of RTT frame. 513 * 2-sided RTT: TX rate of initiator's Ack in response to FTM frame. 514 */ 515 WifiRateInfo txRate; 516 517 /** 518 * 1-sided RTT: TX rate of Ack from other side. 519 * 2-sided RTT: TX rate of FTM frame coming from responder. 520 */ 521 WifiRateInfo rxRate; 522 523 /** 524 * Round trip time in picoseconds 525 */ 526 TimeSpanInPs rtt; 527 528 /** 529 * Rtt standard deviation in picoseconds. 530 */ 531 TimeSpanInPs rttSd; 532 533 /** 534 * Difference between max and min rtt times recorded in picoseconds. 535 */ 536 TimeSpanInPs rttSpread; 537 538 /** 539 * Distance in mm (optional). 540 */ 541 int32_t distanceInMm; 542 543 /** 544 * Standard deviation in mm (optional). 545 */ 546 int32_t distanceSdInMm; 547 548 /** 549 * Difference between max and min distance recorded in mm (optional). 550 */ 551 int32_t distanceSpreadInMm; 552 553 /** 554 * Time of the measurement (in microseconds since boot). 555 */ 556 TimeStampInUs timeStampInUs; 557 558 /** 559 * in ms, actual time taken by the FW to finish one burst 560 * measurement. Applies to 1-sided and 2-sided RTT. 561 */ 562 uint32_t burstDurationInMs; 563 564 /** 565 * Number of bursts allowed by the responder. Applies 566 * to 2-sided RTT only. 567 */ 568 uint32_t negotiatedBurstNum; 569 570 /** 571 * for 11mc only. 572 */ 573 WifiInformationElement lci; 574 575 /** 576 * for 11mc only. 577 */ 578 WifiInformationElement lcr; 579}; 580 581/** 582 * NAN data path channel information provided to the framework. 583 */ 584struct NanDataPathChannelInfo { 585 /** 586 * Channel frequency in MHz. 587 */ 588 WifiChannelInMhz channelFreq; 589 590 /** 591 * Channel bandwidth in MHz. 592 */ 593 WifiChannelWidthInMhz channelBandwidth; 594 595 /** 596 * Number of spatial streams used in the channel. 597 */ 598 uint32_t numSpatialStreams; 599}; 600 601/** 602 * NAN Data path confirmation Indication structure. 603 * Event indication is received on both initiator and responder side when negotiation for a 604 * data-path finish: on success or failure. 605 */ 606struct NanDataPathConfirmInd { 607 /** 608 * Baseline information as defined in HAL 1.0. 609 */ 610 @1.0::NanDataPathConfirmInd V1_0; 611 612 /** 613 * The channel(s) on which the NDP is scheduled to operate. 614 * Updates to the operational channels are provided using the |eventDataPathScheduleUpdate| 615 * event. 616 */ 617 vec<NanDataPathChannelInfo> channelInfo; 618}; 619 620/** 621 * NAN data path channel information update indication structure. 622 * Event indication is received by all NDP owners whenever the channels on which the NDP operates 623 * are updated. 624 * Note: multiple NDPs may share the same schedule, the indication specifies all NDPs to which it 625 * applies. 626 */ 627struct NanDataPathScheduleUpdateInd { 628 /** 629 * The discovery address (NMI) of the peer to which the NDP is connected. 630 */ 631 MacAddress peerDiscoveryAddress; 632 633 /** 634 * The updated channel(s) information. 635 */ 636 vec<NanDataPathChannelInfo> channelInfo; 637 638 /** 639 * The list of NDPs to which this update applies. 640 */ 641 vec<uint32_t> ndpInstanceIds; 642}; 643 644/** 645 * Wifi usable channel information. 646 */ 647struct WifiUsableChannel { 648 /** 649 * Wifi channel freqeuncy in MHz. 650 */ 651 WifiChannelInMhz channel; 652 653 /** 654 * Wifi channel bandwidth in MHz. 655 */ 656 WifiChannelWidthInMhz channelBandwidth; 657 658 /** 659 * Iface modes feasible on this channel. 660 */ 661 bitfield<WifiIfaceMode> ifaceModeMask; 662}; 663 664/** 665 * RTT Capabilities. 666 */ 667struct RttCapabilities { 668 /** 669 * if 1-sided rtt data collection is supported. 670 */ 671 bool rttOneSidedSupported; 672 673 /** 674 * if ftm rtt data collection is supported. 675 */ 676 bool rttFtmSupported; 677 678 /** 679 * if initiator supports LCI request. Applies to 2-sided RTT. 680 */ 681 bool lciSupported; 682 683 /** 684 * if initiator supports LCR request. Applies to 2-sided RTT. 685 */ 686 bool lcrSupported; 687 688 /** 689 * if 11mc responder mode is supported. 690 */ 691 bool responderSupported; 692 693 /** 694 * Bit mask indicates what preamble is supported by initiator. 695 * Combination of |RttPreamble| values. 696 */ 697 bitfield<RttPreamble> preambleSupport; 698 699 /** 700 * Bit mask indicates what BW is supported by initiator. 701 * Combination of |RttBw| values. 702 */ 703 bitfield<RttBw> bwSupport; 704 705 /** 706 * Draft 11mc spec version supported by chip. 707 * For instance, version 4.0 must be 40 and version 4.3 must be 43 etc. 708 */ 709 uint8_t mcVersion; 710}; 711 712/** 713 * Cipher suite flags. 714 */ 715enum NanCipherSuiteType : @1.0::NanCipherSuiteType { 716 /** 717 * NCS-PK-128 718 */ 719 PUBLIC_KEY_128_MASK = 1 << 2, 720 /** 721 * NCS-PK-256 722 */ 723 PUBLIC_KEY_256_MASK = 1 << 3, 724}; 725 726/** 727 * NAN configuration request parameters added in the 1.2 HAL. These are supplemental to previous 728 * versions. 729 */ 730struct NanConfigRequestSupplemental { 731 /** 732 * Baseline information as defined in HAL 1.5. 733 */ 734 @1.5::NanConfigRequestSupplemental V1_5; 735 736 /** 737 * Controls NAN instant communication mode operate on which channel 738 */ 739 uint32_t instantModeChannel; 740}; 741 742/** 743 * Configuration of NAN data-path security. 744 */ 745struct NanDataPathSecurityConfig { 746 /** 747 * Security configuration of the data-path (NDP). Security is enabled if not equal to 748 * |NanDataPathSecurityType.OPEN|. 749 * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Security Required 750 */ 751 NanDataPathSecurityType securityType; 752 753 /** 754 * Cipher type for data-paths. If |securityType| is |NanDataPathSecurityType.OPEN| then must 755 * be set to |NanCipherSuiteType.NONE|, otherwise a non-|NanCipherSuiteType.NONE| cipher suite 756 * must be specified. 757 */ 758 NanCipherSuiteType cipherType; 759 760 /** 761 * Optional Pairwise Master Key (PMK). Must be specified (and is only used) if |securityType| is 762 * set to |NanDataPathSecurityType.PMK|. 763 * Ref: IEEE 802.11i 764 */ 765 uint8_t[32] pmk; 766 767 /** 768 * Optional Passphrase. Must be specified (and is only used) if |securityType| is set to 769 * |NanDataPathSecurityType.PASSPHRASE|. 770 * Min length: |MIN_PASSPHRASE_LENGTH| 771 * Max length: |MAX_PASSPHRASE_LENGTH| 772 * NAN Spec: Appendix: Mapping passphrase to PMK for NCS-SK Cipher Suites 773 */ 774 vec<uint8_t> passphrase; 775 776 /** 777 * Security Context Identifier attribute contains PMKID shall be included in NDP setup and 778 * response messages. Security Context Identifier, Identifies the Security Context. When 779 * security is enabled this field contains the 16 octet PMKID identifying the PMK used for 780 * setting up the Secure Data Path. 781 */ 782 uint8_t[16] scid; 783}; 784 785/** 786 * Response to a data-path request from a peer. 787 */ 788struct NanRespondToDataPathIndicationRequest { 789 /** 790 * Accept (true) or reject (false) the request. 791 * NAN Spec: Data Path Attributes / NDP Attribute / Type and Status 792 */ 793 bool acceptRequest; 794 795 /** 796 * ID of the data-path (NDP) for which we're responding - obtained as part of the request in 797 * |IWifiNanIfaceEventCallback.eventDataPathRequest|. 798 */ 799 uint32_t ndpInstanceId; 800 801 /** 802 * NAN data interface name on which this data-path session is to be started. 803 * This must be an interface created using |IWifiNanIface.createDataInterfaceRequest|. 804 */ 805 string ifaceName; 806 807 /** 808 * Security configuration of the requested data-path. 809 */ 810 NanDataPathSecurityConfig securityConfig; 811 812 /** 813 * Arbitrary information communicated to the peer as part of the data-path setup process - there 814 * is no semantic meaning to these bytes. They are passed-through from sender to receiver as-is 815 * with no parsing. 816 * Max length: |NanCapabilities.maxAppInfoLen|. 817 * NAN Spec: Data Path Attributes / NDP Attribute / NDP Specific Info 818 */ 819 vec<uint8_t> appInfo; 820 821 /** 822 * A service name to be used with |passphrase| to construct a Pairwise Master Key (PMK) for the 823 * data-path. Only relevant when a data-path is requested which is not associated with a NAN 824 * discovery session - e.g. using out-of-band discovery. 825 * Constraints: same as |NanDiscoveryCommonConfig.serviceName| 826 * NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites 827 */ 828 vec<uint8_t> serviceNameOutOfBand; 829}; 830 831/** 832 * Data Path Initiator requesting a data-path. 833 */ 834struct NanInitiateDataPathRequest { 835 /** 836 * ID of the peer. Obtained as part of an earlier |IWifiNanIfaceEventCallback.eventMatch| or 837 * |IWifiNanIfaceEventCallback.eventFollowupReceived|. 838 */ 839 uint32_t peerId; 840 841 /** 842 * NAN management interface MAC address of the peer. Obtained as part of an earlier 843 * |IWifiNanIfaceEventCallback.eventMatch| or |IWifiNanIfaceEventCallback.eventFollowupReceived|. 844 */ 845 MacAddress peerDiscMacAddr; 846 847 /** 848 * Config flag for channel request. 849 */ 850 NanDataPathChannelCfg channelRequestType; 851 852 /** 853 * Channel frequency in MHz to start data-path. Not relevant if |channelRequestType| is 854 * |NanDataPathChannelCfg.CHANNEL_NOT_REQUESTED|. 855 */ 856 WifiChannelInMhz channel; 857 858 /** 859 * NAN data interface name on which this data-path session is to be initiated. 860 * This must be an interface created using |IWifiNanIface.createDataInterfaceRequest|. 861 */ 862 string ifaceName; 863 864 /** 865 * Security configuration of the requested data-path. 866 */ 867 NanDataPathSecurityConfig securityConfig; 868 869 /** 870 * Arbitrary information communicated to the peer as part of the data-path setup process - there 871 * is no semantic meaning to these bytes. They are passed-through from sender to receiver as-is 872 * with no parsing. 873 * Max length: |NanCapabilities.maxAppInfoLen|. 874 * NAN Spec: Data Path Attributes / NDP Attribute / NDP Specific Info 875 */ 876 vec<uint8_t> appInfo; 877 878 /** 879 * A service name to be used with |passphrase| to construct a Pairwise Master Key (PMK) for the 880 * data-path. Only relevant when a data-path is requested which is not associated with a NAN 881 * discovery session - e.g. using out-of-band discovery. 882 * Constraints: same as |NanDiscoveryCommonConfig.serviceName| 883 * NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites 884 */ 885 vec<uint8_t> serviceNameOutOfBand; 886}; 887 888/** 889 * Configurations of NAN discovery sessions: common to publish and subscribe discovery. 890 */ 891struct NanDiscoveryCommonConfig { 892 /** 893 * The ID of the discovery session being configured. A value of 0 specifies a request to create 894 * a new discovery session. The new discovery session ID is returned with 895 * |IWifiNanIfaceEventCallback.notifyStartPublishResponse| or 896 * |IWifiNanIfaceEventCallback.notifyStartSubscribeResponse|. 897 * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID 898 */ 899 uint8_t sessionId; 900 901 /** 902 * The lifetime of the discovery session in seconds. A value of 0 means run forever or until 903 * canceled using |IWifiIface.stopPublishRequest| or |IWifiIface.stopSubscribeRequest|. 904 */ 905 uint16_t ttlSec; 906 907 /** 908 * Indicates the interval between two Discovery Windows in which the device supporting the 909 * service is awake to transmit or receive the Service Discovery frames. Valid values of Awake 910 * DW Interval are: 1, 2, 4, 8 and 16. A value of 0 will default to 1. Does not override 911 * |NanBandSpecificConfig.discoveryWindowIntervalVal| configurations if those are specified. 912 */ 913 uint16_t discoveryWindowPeriod; 914 915 /** 916 * The lifetime of the discovery session in number of transmitted SDF discovery packets. A value 917 * of 0 means forever or until canceled using |IWifiIface.stopPublishRequest| or 918 * |IWifiIface.stopSubscribeRequest|. 919 */ 920 uint8_t discoveryCount; 921 922 /** 923 * UTF-8 encoded string identifying the service. 924 * Max length: |NanCapabilities.maxServiceNameLen|. 925 * NAN Spec: The only acceptable single-byte UTF-8 symbols for a Service Name are alphanumeric 926 * values (A-Z, a-z, 0-9), the hyphen ('-'), and the period ('.'). All valid multi-byte UTF-8 927 * characters are acceptable in a Service Name. 928 */ 929 vec<uint8_t> serviceName; 930 931 /** 932 * Specifies how often to trigger |IWifiNanIfaceEventCallback.eventMatch| when continuously 933 * discovering the same discovery session (with no changes). 934 */ 935 NanMatchAlg discoveryMatchIndicator; 936 937 /** 938 * Arbitrary information communicated in discovery packets - there is no semantic meaning to these 939 * bytes. They are passed-through from publisher to subscriber as-is with no parsing. 940 * Max length: |NanCapabilities.maxServiceSpecificInfoLen|. 941 * NAN Spec: Service Descriptor Attribute (SDA) / Service Info 942 */ 943 vec<uint8_t> serviceSpecificInfo; 944 945 /** 946 * Arbitrary information communicated in discovery packets - there is no semantic meaning to these 947 * bytes. They are passed-through from publisher to subscriber as-is with no parsing. 948 * Max length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|. 949 * Spec: Service Descriptor Extension Attribute (SDEA) / Service Info 950 */ 951 vec<uint8_t> extendedServiceSpecificInfo; 952 953 /** 954 * Ordered sequence of <length, value> pairs (|length| uses 1 byte and contains the number of 955 * bytes in the |value| field) which specify further match criteria (beyond the service name). 956 * The match behavior is specified in details in the NAN spec. 957 * Publisher: used in SOLICITED or SOLICITED_UNSOLICITED sessions. 958 * Subscriber: used in ACTIVE or PASSIVE sessions. 959 * Max length: |NanCapabilities.maxMatchFilterLen|. 960 * NAN Spec: matching_filter_rx 961 */ 962 vec<uint8_t> rxMatchFilter; 963 964 /** 965 * Ordered sequence of <length, value> pairs (|length| uses 1 byte and contains the number of 966 * bytes in the |value| field) which specify further match criteria (beyond the service name). 967 * The match behavior is specified in details in the NAN spec. 968 * Publisher: used if provided. 969 * Subscriber: used (if provided) only in ACTIVE sessions. 970 * Max length: |NanCapabilities.maxMatchFilterLen|. 971 * NAN Spec: matching_filter_tx and Service Descriptor Attribute (SDA) / Matching Filter 972 */ 973 vec<uint8_t> txMatchFilter; 974 975 /** 976 * Specifies whether or not the discovery session uses the 977 * |NanBandSpecificConfig.rssiCloseProximity| value (configured in enable/configure requests) to 978 * filter out matched discovered peers. 979 * NAN Spec: Service Descriptor Attribute / Service Control / Discovery Range Limited. 980 */ 981 bool useRssiThreshold; 982 983 /** 984 * Controls whether or not the |IWifiNanIfaceEventCallback.eventPublishTerminated| (for publish 985 * discovery sessions) or |IWifiNanIfaceEventCallback.eventSubscribeTerminated| (for subscribe 986 * discovery sessions) will be delivered. 987 */ 988 bool disableDiscoveryTerminationIndication; 989 990 /** 991 * Controls whether or not the |IWifiNanIfaceEventCallback.eventMatchExpired| will be delivered. 992 */ 993 bool disableMatchExpirationIndication; 994 995 /** 996 * Controls whether or not the |IWifiNanIfaceEventCallback.eventFollowupReceived| will be 997 * delivered. 998 */ 999 bool disableFollowupReceivedIndication; 1000 1001 /** 1002 * Security configuration of data-paths created in the context of this discovery session. Security 1003 * parameters can be overridden during the actual construction of the data-path - allowing 1004 * individual data-paths to have unique PMKs or Passphrases. 1005 */ 1006 NanDataPathSecurityConfig securityConfig; 1007 1008 /** 1009 * Specifies whether or not there is a ranging requirement in this discovery session. 1010 * Ranging is only performed if all other match criteria with the peer are met. Ranging must 1011 * be performed if both peers in the discovery session (publisher and subscriber) set this 1012 * flag to true. Otherwise, if either peer sets this flag to false, ranging must not be performed 1013 * and must not impact discovery decisions. 1014 * Note: specifying that ranging is required also implies that this device must automatically 1015 * accept ranging requests from peers. 1016 * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Ranging Require. 1017 */ 1018 bool rangingRequired; 1019 1020 /** 1021 * Interval in msec between two ranging measurements. Only relevant if |rangingRequired| is true. 1022 * If the Awake DW interval specified either in |discoveryWindowPeriod| or in 1023 * |NanBandSpecificConfig.discoveryWindowIntervalVal| is larger than the ranging interval then 1024 * priority is given to Awake DW interval. 1025 */ 1026 uint32_t rangingIntervalMsec; 1027 1028 /** 1029 * The type of ranging feedback to be provided by discovery session matches 1030 * |IWifiNanIfaceEventCallback.eventMatch|. Only relevant if |rangingRequired| is true. 1031 */ 1032 bitfield<NanRangingIndication> configRangingIndications; 1033 1034 /** 1035 * The ingress and egress distance in cm. If ranging is enabled (|rangingEnabled| is true) then 1036 * |configRangingIndications| is used to determine whether ingress and/or egress (or neither) 1037 * are used to determine whether a match has occurred. 1038 * NAN Spec: Service Discovery Extension Attribute (SDEA) / Ingress & Egress Range Limit 1039 */ 1040 uint16_t distanceIngressCm; 1041 1042 uint16_t distanceEgressCm; 1043}; 1044 1045/** 1046 * Publish request: specifies a publish discovery operation. 1047 */ 1048struct NanPublishRequest { 1049 /** 1050 * Common configuration of discovery sessions. 1051 */ 1052 NanDiscoveryCommonConfig baseConfigs; 1053 1054 /** 1055 * The type of the publish discovery session. 1056 */ 1057 NanPublishType publishType; 1058 1059 /** 1060 * For publishType of |NanPublishType.SOLICITED| or |NanPublishType.UNSOLICITED_SOLICITED| 1061 * specifies the type of transmission used for responding to the probing subscribe discovery 1062 * peer. 1063 */ 1064 NanTxType txType; 1065 1066 /** 1067 * Specifies whether data-path requests |IWifiNanIfaceEventCallback.eventDataPathRequest| (in 1068 * the context of this discovery session) are automatically accepted (if true) - in which case 1069 * the Responder must not call the |IWifiNanIface.respondToDataPathIndicationRequest| method and 1070 * the device must automatically accept the data-path request and complete the negotiation. 1071 */ 1072 bool autoAcceptDataPathRequests; 1073}; 1074 1075/** 1076 * Match indication structure 1077 */ 1078struct NanMatchInd { 1079 /** 1080 * Publish or subscribe discovery session ID of an existing discovery session. 1081 * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID 1082 */ 1083 uint8_t discoverySessionId; 1084 1085 /** 1086 * A unique ID of the peer. Can be subsequently used in |IWifiNanIface.transmitFollowupRequest| or 1087 * to set up a data-path. 1088 */ 1089 uint32_t peerId; 1090 1091 /** 1092 * The NAN Discovery (management) MAC address of the peer. 1093 */ 1094 MacAddress addr; 1095 1096 /** 1097 * The arbitrary information contained in the |NanDiscoveryCommonConfig.serviceSpecificInfo| of 1098 * the peer's discovery session configuration. 1099 * Max length: |NanCapabilities.maxServiceSpecificInfoLen|. 1100 * NAN Spec: Service Descriptor Attribute (SDA) / Service Info 1101 */ 1102 vec<uint8_t> serviceSpecificInfo; 1103 1104 /** 1105 * Arbitrary information communicated in discovery packets - there is no semantic meaning to these 1106 * bytes. They are passed-through from publisher to subscriber as-is with no parsing. 1107 * Max length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|. 1108 * Spec: Service Descriptor Extension Attribute (SDEA) / Service Info 1109 */ 1110 vec<uint8_t> extendedServiceSpecificInfo; 1111 1112 /** 1113 * The match filter from the discovery packet (publish or subscribe) which caused service 1114 * discovery. Matches the |NanDiscoveryCommonConfig.txMatchFilter| of the peer's Unsolicited 1115 * publish message or of the local device's Active subscribe message. 1116 * Max length: |NanCapabilities.maxMatchFilterLen|. 1117 * NAN Spec: Service Descriptor Attribute (SDA) / Matching Filter 1118 */ 1119 vec<uint8_t> matchFilter; 1120 1121 /** 1122 * Indicates the type of discovery: true if match occurred on a Beacon frame, false if the match 1123 * occurred on a Service Discovery Frames (SDF). 1124 */ 1125 bool matchOccuredInBeaconFlag; 1126 1127 /** 1128 * Flag to indicate firmware is out of resource and that it can no longer track this Service Name. 1129 * Indicates that while |IWifiNanIfaceEventCallback.eventMatch| will be received, the 1130 * |NanDiscoveryCommonConfig.discoveryMatchIndicator| configuration will not be honored. 1131 */ 1132 bool outOfResourceFlag; 1133 1134 /** 1135 * If RSSI filtering was enabled using |NanDiscoveryCommonConfig.useRssiThreshold| in discovery 1136 * session setup then this field contains the received RSSI value. It will contain 0 if RSSI 1137 * filtering was not enabled. 1138 * RSSI values are returned without sign, e.g. -70dBm will be returned as 70. 1139 */ 1140 uint8_t rssiValue; 1141 1142 /** 1143 * Cipher type for data-paths constructed in the context of this discovery session. Valid if 1144 * |peerRequiresSecurityEnabledInNdp| is true. 1145 */ 1146 NanCipherSuiteType peerCipherType; 1147 1148 /** 1149 * Indicates whether or not the peer requires security enabled in any data-path (NDP) constructed 1150 * in the context of this discovery session. The |cipherType| specifies the cipher type for such 1151 * data-paths. 1152 * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Security Required 1153 */ 1154 bool peerRequiresSecurityEnabledInNdp; 1155 1156 /** 1157 * Indicates whether or not the peer requires (and hence allows) ranging in the context of this 1158 * discovery session. 1159 * Note that ranging is only performed if all other match criteria with the peer are met. 1160 * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Ranging Require. 1161 */ 1162 bool peerRequiresRanging; 1163 1164 /** 1165 * Ranging indication supersedes the NanMatchAlg specification. 1166 * Ex: If NanMatchAlg is MATCH_ONCE, but ranging indications is continuous then continuous 1167 * match notifications will be received (with ranging information). 1168 * Ranging indication data is provided if Ranging required is enabled in the discovery 1169 * specification and: 1170 * 1) continuous ranging specified. 1171 * 2) ingress/egress specified and: 1172 * - notify once for ingress >= ingress_distance and egress <= egress_distance, 1173 * - same for ingress_egress_both 1174 * If the Awake DW intervals are larger than the ranging intervals then priority is given to the 1175 * device DW intervals. 1176 * 1177 * If ranging was required and executed contains the distance to the peer in MM. The 1178 * |rangingIndicationType| field specifies the event which triggered ranging. 1179 */ 1180 uint32_t rangingMeasurementInMm; 1181 1182 /** 1183 * The ranging event(s) which triggered the ranging. E.g. can indicate that continuous ranging was 1184 * requested, or else that an ingress event occurred. 1185 */ 1186 bitfield<NanRangingIndication> rangingIndicationType; 1187 1188 /** 1189 * Security Context Identifier attribute contains PMKID shall be included in NDP setup and 1190 * response messages. Security Context Identifier, Identifies the Security Context. For NAN 1191 * Shared Key Cipher Suite, this field contains the 16 octet PMKID identifying the PMK used for 1192 * setting up the Secure Data Path. 1193 */ 1194 vec<uint8_t> scid; 1195}; 1196 1197/** 1198 * NDP Capabilities response. 1199 */ 1200struct NanCapabilities { 1201 /** 1202 * Maximum number of clusters which the device can join concurrently. 1203 */ 1204 uint32_t maxConcurrentClusters; 1205 1206 /** 1207 * Maximum number of concurrent publish discovery sessions. 1208 */ 1209 uint32_t maxPublishes; 1210 1211 /** 1212 * Maximum number of concurrent subscribe discovery sessions. 1213 */ 1214 uint32_t maxSubscribes; 1215 1216 /** 1217 * Maximum length (in bytes) of service name. 1218 */ 1219 uint32_t maxServiceNameLen; 1220 1221 /** 1222 * Maximum length (in bytes) of individual match filters. 1223 */ 1224 uint32_t maxMatchFilterLen; 1225 1226 /** 1227 * Maximum length (in bytes) of aggregate match filters across all active sessions. 1228 */ 1229 uint32_t maxTotalMatchFilterLen; 1230 1231 /** 1232 * Maximum length (in bytes) of the service specific info field. 1233 */ 1234 uint32_t maxServiceSpecificInfoLen; 1235 1236 /** 1237 * Maximum length (in bytes) of the extended service specific info field. 1238 */ 1239 uint32_t maxExtendedServiceSpecificInfoLen; 1240 1241 /** 1242 * Maximum number of data interfaces (NDI) which can be created concurrently on the device. 1243 */ 1244 uint32_t maxNdiInterfaces; 1245 1246 /** 1247 * Maximum number of data paths (NDP) which can be created concurrently on the device, across all 1248 * data interfaces (NDI). 1249 */ 1250 uint32_t maxNdpSessions; 1251 1252 /** 1253 * Maximum length (in bytes) of application info field (used in data-path negotiations). 1254 */ 1255 uint32_t maxAppInfoLen; 1256 1257 /** 1258 * Maximum number of transmitted followup messages which can be queued by the firmware. 1259 */ 1260 uint32_t maxQueuedTransmitFollowupMsgs; 1261 1262 /** 1263 * Maximum number MAC interface addresses which can be specified to a subscribe discovery session. 1264 */ 1265 uint32_t maxSubscribeInterfaceAddresses; 1266 1267 /** 1268 * The set of supported Cipher suites. The |NanCipherSuiteType| bit fields are used. 1269 */ 1270 bitfield<NanCipherSuiteType> supportedCipherSuites; 1271 1272 /** 1273 * Flag to indicate id instant communication mode is supported. 1274 */ 1275 bool instantCommunicationModeSupportFlag; 1276}; 1277 1278/** 1279 * Wifi radio configuration 1280 */ 1281struct WifiRadioConfiguration { 1282 /** 1283 * Band on which this radio chain is operating. 1284 * Valid values of bandInfo are: BAND_24GHZ, BAND_5GHZ, BAND_6GHZ and 1285 * BAND_60GHZ. 1286 * 1287 */ 1288 WifiBand bandInfo; 1289 1290 /** 1291 * Wifi Antenna configuration. 1292 */ 1293 WifiAntennaMode antennaMode; 1294}; 1295 1296/** 1297 * Wifi radio combination 1298 */ 1299struct WifiRadioCombination { 1300 /** 1301 * A list of radio configurations in this combination. 1302 */ 1303 vec<WifiRadioConfiguration> radioConfigurations; 1304}; 1305 1306/** 1307 * Wifi radio combinations matrix retrieved via |getSupportedRadioCombinationsMatrix|. 1308 */ 1309struct WifiRadioCombinationMatrix { 1310 /** 1311 * A list of all the possible radio combinations that the chip can operate. 1312 */ 1313 vec<WifiRadioCombination> radioCombinations; 1314}; 1315 1316/** 1317 * List of interface concurrency types, used in reporting device concurrency capabilities. 1318 */ 1319enum IfaceConcurrencyType : uint32_t { 1320 /** 1321 * Concurrency type for station mode. 1322 */ 1323 STA, 1324 /** 1325 * Concurrency type of single-port AP mode. 1326 */ 1327 AP, 1328 /** 1329 * Concurrency type of two-port bridged AP mode. 1330 */ 1331 AP_BRIDGED, 1332 /** 1333 * Concurrency type of peer-to-peer mode. 1334 */ 1335 P2P, 1336 /** 1337 * Concurrency type of neighborhood area network mode. 1338 */ 1339 NAN, 1340}; 1341