| // Copyright 2018 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.device; |
| |
| using fuchsia.wlan.common; |
| using fuchsia.wlan.ieee80211 as ieee80211; |
| using zx; |
| |
| /// IEEE Std 802.11-206 Section 9.4.1.4 Capability Information Field |
| type Capability = strict enum : uint32 { |
| SHORT_PREAMBLE = 0x0020; |
| SPECTRUM_MGMT = 0x0100; |
| QOS = 0x0200; |
| SHORT_SLOT_TIME = 0x0400; |
| RADIO_MSMT = 0x01000; |
| |
| // TODO(https://fxbug.dev/42132496): Move SIMULTANEOUS_CLIENT_AP to a different Fuchsia specific capability enum. |
| // This enum should only be used for IEEE 802.11 fields. This type should also be reduced |
| // to uint16_t once this is done. |
| SIMULTANEOUS_CLIENT_AP = 0x10000; |
| }; |
| |
| |
| // IEEE Std 802.11-2016 defines 12 values in dot11SupportedDataRatesRxTable |
| const MAX_NUM_RATES uint8 = 12; |
| |
| // BandInfo groups capabilities defined per band. |
| // This grouping is the industry's de factor standard. |
| type BandInfo = struct { |
| band fuchsia.wlan.common.WlanBand; |
| ht_caps box<ieee80211.HtCapabilities>; |
| vht_caps box<ieee80211.VhtCapabilities>; |
| rates vector<uint8>:MAX_NUM_RATES; |
| operating_channels vector<uint8>:ieee80211.MAX_UNIQUE_CHANNEL_NUMBERS; |
| }; |
| |
| type CreateIfaceRequest = resource struct { |
| role fuchsia.wlan.common.WlanMacRole; |
| // TODO(https://fxbug.dev/42104310): Make `mlme_channel` mandatory once all drivers support the channel. |
| mlme_channel zx.Handle:<CHANNEL, optional>; |
| init_sta_addr ieee80211.MacAddr; |
| }; |
| |
| type DestroyIfaceRequest = struct { |
| id uint16; |
| }; |
| |
| /// The country code for a target WLAN PHY device. |
| /// alpha2 is ISO 3166-1 code to indicate a country. eg. AF for Afghanistan. |
| type CountryCode = struct { |
| alpha2 array<byte, 2>; |
| }; |
| |
| closed protocol Phy { |
| strict GetSupportedMacRoles() -> (struct { |
| supported_mac_roles |
| vector<fuchsia.wlan.common.WlanMacRole>:fuchsia.wlan.common.MAX_SUPPORTED_MAC_ROLES; |
| }) error zx.Status; |
| strict CreateIface(resource struct { |
| req CreateIfaceRequest; |
| }) -> (struct { |
| iface_id uint16; |
| }) error zx.Status; |
| |
| strict DestroyIface(struct { |
| req DestroyIfaceRequest; |
| }) -> () error zx.Status; |
| |
| strict SetCountry(struct { |
| req CountryCode; |
| }) -> (struct { |
| status int32; |
| }); |
| |
| strict GetCountry() -> (struct { |
| resp CountryCode; |
| }) error int32; |
| |
| strict ClearCountry() -> (struct { |
| status int32; |
| }); |
| |
| strict SetPowerSaveMode(struct { |
| req fuchsia.wlan.common.PowerSaveType; |
| }) -> (struct { |
| status int32; |
| }); |
| |
| strict GetPowerSaveMode() -> (struct { |
| resp fuchsia.wlan.common.PowerSaveType; |
| }) error int32; |
| }; |
| |
| // Temporary interface for bridging between the devhost-owned channel model and |
| // the driver-owned channel model of connection management. |
| /// This protocol is used to connect to the real Phy protocol underlying this device. |
| closed protocol Connector { |
| strict Connect(resource struct { |
| request server_end:Phy; |
| }); |
| }; |