blob: c82f3cb77e7f07dca2d4289b10dd02c1774cc731 [file] [log] [blame]
// 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.internal;
using zx;
enum SupportedPhy {
DSSS = 1;
CCK = 2;
OFDM = 3;
HT = 4;
VHT = 5;
};
enum MacRole {
CLIENT = 1;
AP = 2;
MESH = 3;
};
/// IEEE Std 802.11-206 Section 9.4.1.4 Capability Information Field
enum Capability : 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;
};
struct ChannelList {
uint16 base_freq;
vector<uint8>:200 channels;
};
// IEEE Std 802.11-2016 defines 12 values in dot11SupportedDataRatesRxTable
const uint8 MAX_NUM_RATES = 12;
// BandInfo groups capabilities defined per band.
// This grouping is the industry's de factor standard.
struct BandInfo {
fuchsia.wlan.common.Band band_id;
fuchsia.wlan.internal.HtCapabilities? ht_caps;
fuchsia.wlan.internal.VhtCapabilities? vht_caps;
vector<uint8>:MAX_NUM_RATES rates;
ChannelList supported_channels;
};
struct PhyInfo {
// 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.
uint16 id;
// The topological path of the phy in the device tree.
string? dev_path;
vector<MacRole>:8 supported_mac_roles;
};
struct QueryResponse {
int32 status;
PhyInfo info;
};
resource struct CreateIfaceRequest {
MacRole role;
// TODO(fxbug.dev/29547): Make `sme_channel` mandatory once all drivers support the channel.
zx.handle:CHANNEL? sme_channel;
bytes:6? init_mac_addr;
};
struct CreateIfaceResponse {
int32 status;
uint16 iface_id;
};
struct DestroyIfaceRequest {
uint16 id;
};
struct DestroyIfaceResponse {
int32 status;
};
/// The country code for a target WLAN PHY device.
/// alpha2 is ISO 3166-1 code to indicate a country. eg. AF for Afghanistan.
struct CountryCode {
array<byte>:2 alpha2;
};
protocol Phy {
Query() -> (QueryResponse resp);
CreateIface(CreateIfaceRequest req) -> (CreateIfaceResponse resp);
DestroyIface(DestroyIfaceRequest req) -> (DestroyIfaceResponse resp);
SetCountry(CountryCode req) -> (int32 status);
GetCountry() -> (CountryCode resp) error int32;
ClearCountry() -> (int32 status);
};
// 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.
[ForDeprecatedCBindings]
protocol Connector {
Connect(request<Phy> request);
};