blob: 3731da70f819e632e8dbe752a22f0c2ba05fa7e0 [file] [log] [blame]
// 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.sme;
using fuchsia.wlan.common.security;
using fuchsia.wlan.common;
using fuchsia.wlan.ieee80211 as ieee80211;
using fuchsia.wlan.internal;
using fuchsia.wlan.mesh;
using fuchsia.wlan.stats;
using zx;
/// Security protection which should mirror the Protection enum defined in wlan lib common
type Protection = strict enum {
UNKNOWN = 0;
OPEN = 1;
WEP = 2;
WPA1 = 3;
WPA1_WPA2_PERSONAL_TKIP_ONLY = 4;
WPA2_PERSONAL_TKIP_ONLY = 5;
WPA1_WPA2_PERSONAL = 6;
WPA2_PERSONAL = 7;
WPA2_WPA3_PERSONAL = 8;
WPA3_PERSONAL = 9;
WPA2_ENTERPRISE = 10;
WPA3_ENTERPRISE = 11;
};
type UserDisconnectReason = strict enum {
UNKNOWN = 0;
FAILED_TO_CONNECT = 1;
FIDL_CONNECT_REQUEST = 2;
FIDL_STOP_CLIENT_CONNECTIONS_REQUEST = 3;
PROACTIVE_NETWORK_SWITCH = 4;
DISCONNECT_DETECTED_FROM_SME = 5;
REGULATORY_REGION_CHANGE = 6;
STARTUP = 7;
NETWORK_UNSAVED = 8;
NETWORK_CONFIG_UPDATED = 9;
// The following reasons should only be used for development and testing.
WLANSTACK_UNIT_TESTING = 124;
WLAN_SME_UNIT_TESTING = 125;
WLAN_SERVICE_UTIL_TESTING = 126;
WLAN_DEV_TOOL = 127;
};
type DisconnectCause = struct {
mlme_event_name DisconnectMlmeEventName;
reason_code ieee80211.ReasonCode;
};
type DisconnectMlmeEventName = strict enum {
DEAUTHENTICATE_INDICATION = 1;
DISASSOCIATE_INDICATION = 2;
};
type DisconnectSource = strict union {
1: ap DisconnectCause;
2: user UserDisconnectReason;
3: mlme DisconnectCause;
};
type ScanResult = struct {
compatible bool;
// Time of the scan result relative to when the system was powered on.
// See https://fuchsia.dev/fuchsia-src/concepts/time/language_support#monotonic_time
timestamp_nanos zx.time;
bss_description fuchsia.wlan.internal.BssDescription;
};
type ScanErrorCode = strict enum {
NOT_SUPPORTED = 1;
INTERNAL_ERROR = 2;
INTERNAL_MLME_ERROR = 3;
SHOULD_WAIT = 4;
CANCELED_BY_DRIVER_OR_FIRMWARE = 5;
};
type ScanError = struct {
code ScanErrorCode;
message string;
};
protocol ScanTransaction {
// Can be called several times to deliver incremental scan results
-> OnResult(struct {
aps vector<ScanResult>;
});
-> OnFinished();
-> OnError(struct {
error ScanError;
});
};
type ScanRequest = strict union {
1: active ActiveScanRequest;
2: passive PassiveScanRequest;
};
type PassiveScanRequest = struct {};
type ActiveScanRequest = struct {
/// List of SSIDs to scan for. An empty list of ssids is the same as specifying
/// a list containing only the wildcard SSID.
///
/// There is no limit on the number of SSIDs specified, but a large number of
/// SSIDs may result in extended scan times or the error ZX_ERR_INVALID_ARGS to be
/// returned.
ssids vector<ieee80211.Ssid>:MAX;
// TODO(fxbug.dev/89348): SME should instead require the higher layer to specify
// which channels to scan and return an error if the list is empty.
/// Channels to scan on. Leave empty for all supported channels.
channels vector<uint8>:500;
};
type ConnectResult = struct {
code ieee80211.StatusCode;
/// `is_credential_rejected` is true if connect failure is likely due to wrong credential.
/// Policy uses this to determine whether to retry with the same password.
is_credential_rejected bool;
/// If `is_reconnect` is false, the result comes from the initial connection request.
/// If it's true, the result comes from an SME-initiated reconnection.
is_reconnect bool;
};
type DisconnectInfo = struct {
/// Whether SME is attempting to reconnect by itself
is_sme_reconnecting bool;
/// Where the disconnect originated and associated reason
disconnect_source DisconnectSource;
};
protocol ConnectTransaction {
/// Return the result of the initial connection request or later SME-initiated reconnection.
-> OnConnectResult(struct {
result ConnectResult;
});
/// Notify that the client has disconnected. If DisconnectInfo indicates that SME is
/// attempting to reconnect by itself, there's not need for caller to intervene for now.
-> OnDisconnect(struct {
info DisconnectInfo;
});
/// Give an update of the latest signal report.
-> OnSignalReport(struct {
ind fuchsia.wlan.internal.SignalReportIndication;
});
/// Give an update of the channel switching.
-> OnChannelSwitched(struct {
info fuchsia.wlan.internal.ChannelSwitchInfo;
});
};
type RadioConfig = struct {
phy fuchsia.wlan.common.WlanPhyType;
channel fuchsia.wlan.common.WlanChannel;
};
/// Empty struct used for union variants with no associated data.
type Empty = struct {};
type ConnectRequest = struct {
ssid ieee80211.Ssid;
bss_description fuchsia.wlan.internal.BssDescription;
/// Informs SME whether multiple candidates were available, for metrics.
multiple_bss_candidates bool;
/// Authentication method.
///
/// Describes how SME authenticates when connecting to the target network.
authentication fuchsia.wlan.common.security.Authentication;
/// Deprecated. SME makes internal decision on whether to perform a passive or active
/// scan during connect. Setting this field will not affect anything for FullMAC, but
/// currently SoftMAC still honor this argument.
deprecated_scan_type fuchsia.wlan.common.ScanType;
};
type ServingApInfo = struct {
bssid ieee80211.MacAddr;
ssid ieee80211.Ssid;
rssi_dbm int8;
snr_db int8;
channel fuchsia.wlan.common.WlanChannel;
protection Protection;
};
type ClientStatusResponse = strict union {
1: connected ServingApInfo;
2: connecting ieee80211.Ssid;
3: idle Empty;
};
protocol ClientSme {
Scan(resource struct {
req ScanRequest;
txn server_end:ScanTransaction;
});
Connect(resource struct {
req ConnectRequest;
txn server_end:<ConnectTransaction, optional>;
});
Disconnect(struct {
reason UserDisconnectReason;
}) -> ();
Status() -> (struct {
resp ClientStatusResponse;
});
WmmStatus() -> (struct {
resp fuchsia.wlan.internal.WmmStatusResponse;
}) error int32;
};
type ApConfig = struct {
ssid ieee80211.Ssid;
password vector<uint8>:64;
radio_cfg RadioConfig;
};
type StartApResultCode = strict enum {
SUCCESS = 0;
ALREADY_STARTED = 1;
INTERNAL_ERROR = 2;
CANCELED = 3;
TIMED_OUT = 4;
PREVIOUS_START_IN_PROGRESS = 5;
INVALID_ARGUMENTS = 6;
};
type StopApResultCode = strict enum {
SUCCESS = 0;
INTERNAL_ERROR = 1;
TIMED_OUT = 2;
};
type Ap = struct {
ssid ieee80211.Ssid;
channel uint8;
num_clients uint16;
};
type ApStatusResponse = struct {
running_ap box<Ap>;
};
protocol ApSme {
Start(struct {
config ApConfig;
}) -> (struct {
code StartApResultCode;
});
Stop() -> (struct {
code StopApResultCode;
});
Status() -> (struct {
resp ApStatusResponse;
});
};
type MeshConfig = struct {
mesh_id vector<uint8>:32;
channel uint8;
};
type JoinMeshResultCode = strict enum {
SUCCESS = 0;
CANCELED = 1;
INTERNAL_ERROR = 2;
INVALID_ARGUMENTS = 3;
DFS_UNSUPPORTED = 4;
};
type LeaveMeshResultCode = strict enum {
SUCCESS = 0;
INTERNAL_ERROR = 1;
};
type GetMeshPathTableResultCode = strict enum {
SUCCESS = 0;
INTERNAL_ERROR = 1;
};
protocol MeshSme {
Join(struct {
config MeshConfig;
}) -> (struct {
code JoinMeshResultCode;
});
Leave() -> (struct {
code LeaveMeshResultCode;
});
GetMeshPathTable() -> (struct {
code GetMeshPathTableResultCode;
path fuchsia.wlan.mesh.MeshPathTable;
});
};
protocol Telemetry {
GetCounterStats() -> (struct {
stats fuchsia.wlan.stats.IfaceCounterStats;
}) error zx.status;
GetHistogramStats() -> (struct {
stats fuchsia.wlan.stats.IfaceHistogramStats;
}) error zx.status;
};
protocol GenericSme {
GetClientSme() -> (resource struct {
sme client_end:ClientSme;
}) error zx.status;
GetApSme() -> (resource struct {
sme client_end:ApSme;
}) error zx.status;
GetSmeTelemetry() -> (resource struct {
sme client_end:Telemetry;
}) error zx.status;
};