| // 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 fuchsia.wlan.internal; |
| using zx; |
| |
| type SupportedPhy = strict enum { |
| DSSS = 1; |
| CCK = 2; |
| OFDM = 3; |
| HT = 4; |
| VHT = 5; |
| }; |
| |
| type MacRole = strict enum { |
| CLIENT = 1; |
| AP = 2; |
| MESH = 3; |
| }; |
| |
| /// 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(fxbug.dev/54923): 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; |
| }; |
| |
| |
| type ChannelList = struct { |
| base_freq uint16; |
| channels vector<uint8>:200; |
| }; |
| |
| // 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_id fuchsia.wlan.common.Band; |
| ht_caps box<fuchsia.wlan.internal.HtCapabilities>; |
| vht_caps box<fuchsia.wlan.internal.VhtCapabilities>; |
| rates vector<uint8>:MAX_NUM_RATES; |
| supported_channels ChannelList; |
| }; |
| |
| type PhyInfo = struct { |
| // The following fields are not set by the phy itself, but by the service that monitors them. |
| // The phy id. This is not a stable identifier, but will not change while this phy's device node |
| // remains. |
| id uint16; |
| // The topological path of the phy in the device tree. |
| dev_path string:optional; |
| |
| supported_mac_roles vector<MacRole>:8; |
| }; |
| |
| type QueryResponse = struct { |
| status int32; |
| info PhyInfo; |
| }; |
| |
| type CreateIfaceRequest = resource struct { |
| role MacRole; |
| // TODO(fxbug.dev/29547): Make `mlme_channel` mandatory once all drivers support the channel. |
| mlme_channel zx.handle:<CHANNEL, optional>; |
| init_sta_addr ieee80211.MacAddr; |
| }; |
| |
| type CreateIfaceResponse = struct { |
| status int32; |
| iface_id uint16; |
| }; |
| |
| type DestroyIfaceRequest = struct { |
| id uint16; |
| }; |
| |
| type DestroyIfaceResponse = struct { |
| status int32; |
| }; |
| |
| /// 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>; |
| }; |
| |
| protocol Phy { |
| Query() -> (struct { |
| resp QueryResponse; |
| }); |
| CreateIface(resource struct { |
| req CreateIfaceRequest; |
| }) -> (struct { |
| resp CreateIfaceResponse; |
| }); |
| DestroyIface(struct { |
| req DestroyIfaceRequest; |
| }) -> (struct { |
| resp DestroyIfaceResponse; |
| }); |
| SetCountry(struct { |
| req CountryCode; |
| }) -> (struct { |
| status int32; |
| }); |
| GetCountry() -> (struct { |
| resp CountryCode; |
| }) error int32; |
| ClearCountry() -> (struct { |
| status int32; |
| }); |
| SetPsMode(struct { |
| req fuchsia.wlan.common.PowerSaveType; |
| }) -> (struct { |
| status int32; |
| }); |
| GetPsMode() -> (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. |
| @for_deprecated_c_bindings |
| protocol Connector { |
| Connect(resource struct { |
| request server_end:Phy; |
| }); |
| }; |