blob: 9ebce141c79e0ae8e7cb2d91938c619921b11daa [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.sme;
using fuchsia.wlan.common;
using fuchsia.wlan.mesh;
struct BssInfo {
array<uint8>:6 bssid;
vector<uint8>:32 ssid;
int8 rx_dbm;
uint8 channel;
bool protected;
bool compatible;
};
struct EssInfo {
BssInfo best_bss;
};
enum ScanErrorCode {
NOT_SUPPORTED = 1;
INTERNAL_ERROR = 2;
};
struct ScanError {
ScanErrorCode code;
string message;
};
protocol ScanTransaction {
// Can be called several times to deliver incremental scan results
-> OnResult(vector<EssInfo> aps);
-> OnFinished();
-> OnError(ScanError error);
};
struct ScanRequest {
uint8 timeout; // seconds
fuchsia.wlan.common.ScanType scan_type;
};
enum ConnectResultCode {
// Connected successfully
SUCCESS = 0;
// The request was superseded by another connect or disconnect command
CANCELED = 1;
// Failed to join for some reason
FAILED = 2;
// Failed to join due to bad credentials
BAD_CREDENTIALS = 3;
// TODO(hahnr): Add result code for attempting to join an incompatible network
};
protocol ConnectTransaction {
// Could add more events here to notify the client of the progress
-> OnFinished(ConnectResultCode code);
};
struct RadioConfig {
bool override_phy;
fuchsia.wlan.common.PHY phy;
bool override_cbw;
fuchsia.wlan.common.CBW cbw;
bool override_primary_chan;
uint8 primary_chan;
};
/// Empty struct used as credential value for open networks.
struct Empty {};
/// Information required to connect to a protected network.
xunion Credential {
/// The network does not use credentials (open networks).
Empty none;
/// Plaintext password (handled as binary data).
bytes password;
/// Hash representation of the network passphrase (handled as binary data).
bytes psk;
};
struct ConnectRequest {
vector<uint8>:32 ssid;
Credential credential;
RadioConfig radio_cfg;
fuchsia.wlan.common.ScanType scan_type;
};
struct ClientStatusResponse {
BssInfo? connected_to;
// If non-empty, this is the SSID we are currently trying to connect to
vector<uint8>:32 connecting_to_ssid;
};
protocol ClientSme {
Scan(ScanRequest req, request<ScanTransaction> txn);
Connect(ConnectRequest req, request<ConnectTransaction>? txn);
Disconnect() -> ();
Status() -> (ClientStatusResponse resp);
};
struct ApConfig {
vector<uint8>:32 ssid;
vector<uint8>:64 password;
RadioConfig radio_cfg;
};
enum StartApResultCode {
// TODO(porce): Fix naming style.
SUCCESS = 0;
ALREADY_STARTED = 1;
INTERNAL_ERROR = 2;
CANCELED = 3;
TIMED_OUT = 4;
PREVIOUS_START_IN_PROGRESS = 5;
INVALID_ARGUMENTS = 6;
DFS_UNSUPPORTED = 7;
};
protocol ApSme {
Start(ApConfig config) -> (StartApResultCode code);
Stop() -> ();
};
struct MeshConfig {
vector<uint8>:32 mesh_id;
uint8 channel;
};
enum JoinMeshResultCode {
SUCCESS = 0;
CANCELED = 1;
INTERNAL_ERROR = 2;
INVALID_ARGUMENTS = 3;
DFS_UNSUPPORTED = 4;
};
enum LeaveMeshResultCode {
SUCCESS = 0;
INTERNAL_ERROR = 1;
};
enum GetMeshPathTableResultCode {
SUCCESS = 0;
INTERNAL_ERROR = 1;
};
protocol MeshSme {
Join(MeshConfig config) -> (JoinMeshResultCode code);
Leave() -> (LeaveMeshResultCode code);
GetMeshPathTable() -> (GetMeshPathTableResultCode code, fuchsia.wlan.mesh.MeshPathTable path);
};