| // Copyright 2021 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.wlan.internal; |
| |
| using fuchsia.wlan.common; |
| |
| @namespaced |
| const MAC_ADDR_BYTE_LEN uint8 = 6; |
| |
| // TODO(fxbug.dev/80232): This type should really be `bits`, but since the `bits` |
| // type is not supported in Banjo bindings it can't be. |
| alias BssTypeSelector = uint8; |
| @namespaced |
| const BSS_TYPE_SELECTOR_INFRASTRUCTURE BssTypeSelector = 0b0001; |
| @namespaced |
| const BSS_TYPE_SELECTOR_INDEPENDENT BssTypeSelector = 0b0010; |
| @namespaced |
| const BSS_TYPE_SELECTOR_MESH BssTypeSelector = 0b0100; |
| @namespaced |
| const BSS_TYPE_SELECTOR_PERSONAL BssTypeSelector = 0b1000; |
| @namespaced |
| const BSS_TYPE_SELECTOR_ANY BssTypeSelector = 0b1111; |
| |
| type BssType = strict enum { |
| // The UNKNOWN value is added to this type instead of created a new |
| // enum like `DetectedBssType` so that language bindings can avoid the use |
| // of verbose constants like DETECTED_BSS_TYPE_INFRASTRUCTURE. The tradeoff |
| // is to handle UNKNOWN when specifying the BSS type of a new AP. |
| UNKNOWN = 0; |
| |
| INFRASTRUCTURE = 1; |
| INDEPENDENT = 2; |
| MESH = 3; |
| PERSONAL = 4; |
| }; |
| |
| type BssConfig = struct { |
| bssid array<uint8, MAC_ADDR_BYTE_LEN>; |
| bss_type BssType; |
| remote bool; |
| }; |
| |
| // IEEE Std 802.11-2016, 9.4.1.4 |
| alias CapabilityInfo = uint16; |
| |
| // IEEE Std 802.11-2016 9.4.2.56 |
| @namespaced |
| const HT_CAP_LEN uint8 = 26; |
| |
| // IEEE Std 802.11-2016 9.4.2.57 |
| @namespaced |
| const HT_OP_LEN uint8 = 22; |
| |
| // IEEE Std 802.11-2016 9.5.2.158 |
| @namespaced |
| const VHT_CAP_LEN uint8 = 12; |
| |
| // IEEE Std 802.11-2016 9.5.2.159 |
| @namespaced |
| const VHT_OP_LEN uint8 = 5; |
| |
| // IEEE Std 802.11-2016 defines 12 values in dot11SupportedDataRatesRxTable and |
| // 2 values for BSS Membership Selector in Table 9-78. Only these 14 values are valid. |
| // But in fxbug.dev/41022, some of these values may be duplicated in both SupportedRates(SR) and |
| // ExtendedSupportedRates(ESR). Since the SR element allows 8 bytes, and assuming the ESR element |
| // duplicates all the values in the SR element plus contains all the remaining valid values, the |
| // maximum is set to 8 + 14 = 22. |
| @namespaced |
| const RATES_MAX_LEN uint8 = 22; |
| |
| // IEEE Std 802.11-2016 9.4.2.56 |
| type HtCapabilities = struct { |
| bytes array<uint8, HT_CAP_LEN>; |
| }; |
| |
| // IEEE Std 802.11-2016 9.4.2.57 |
| type HtOperation = struct { |
| bytes array<uint8, HT_OP_LEN>; |
| }; |
| |
| // IEEE Std 802.11-2016 9.5.2.158 |
| type VhtCapabilities = struct { |
| bytes array<uint8, VHT_CAP_LEN>; |
| }; |
| |
| // IEEE Std 802.11-2016 9.5.2.159 |
| type VhtOperation = struct { |
| bytes array<uint8, VHT_OP_LEN>; |
| }; |
| |
| // IEEE Std 802.11-2016 6.3.3.3.2 |
| type BssDescription = struct { |
| bssid array<uint8, MAC_ADDR_BYTE_LEN>; |
| |
| bss_type BssType; |
| beacon_period uint16; // in TU |
| timestamp uint64; |
| local_time uint64; |
| |
| capability_info CapabilityInfo; |
| |
| /// All info elements present in the beacon or probe response frame. |
| ies bytes; |
| |
| // List up non-standard, Fuchsia only parameters |
| channel fuchsia.wlan.common.WlanChannel; |
| // The running average of received signal strength indicator in units of dBm. This value is |
| // updated periodically when the client is associated to an AP. |
| rssi_dbm int8; // dBm |
| // The running average of snr in units of dB. This value is updated periodically when the |
| // client is associated to an AP. |
| snr_db int8; |
| }; |
| |
| type WmmStatusResponse = struct { |
| apsd bool; |
| ac_be_params WmmAcParams; |
| ac_bk_params WmmAcParams; |
| ac_vi_params WmmAcParams; |
| ac_vo_params WmmAcParams; |
| }; |
| |
| /// WFA WMM v1.2, 2.2.2 |
| type WmmAcParams = struct { |
| /// Lower bound of contention window in exponential form |
| /// `cw_min = 2^(ecw_min) - 1`. The unit for contention window is "slot time", which |
| /// is different for each standard (e.g. 9 microseconds, 13 microseconds, etc.) |
| ecw_min uint8; |
| /// Upper bound of contention window in exponential form |
| /// `cw_max = 2^(ecw_max) - 1`. The unit for contention window is "slot time", which |
| /// is different for each standard (e.g. 9 microseconds, 13 microseconds, etc.) |
| ecw_max uint8; |
| /// Arbitration Interframe Spacing Number (control wait time between sending each frame) |
| aifsn uint8; |
| /// TXOP limit in unit of 32 microseconds |
| txop_limit uint16; |
| /// Whether admission control is mandatory |
| acm bool; |
| }; |