blob: 38429ee3c63050ab943aa4e214364b9975efb349 [file] [log] [blame]
// Copyright 2023 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.wlanix;
using fuchsia.wlan.ieee80211;
using zx;
/// Protocol used to proxy Wlanix requests from Starnix into Fuchsia.
@discoverable
open protocol Wlanix {
/// Register the channel to make WiFi request to.
flexible GetWifi(resource table {
1: wifi server_end:Wifi;
});
flexible GetSupplicant(resource table {
1: supplicant server_end:Supplicant;
});
flexible GetNl80211(resource table {
1: nl80211 server_end:Nl80211;
});
};
open protocol Wifi {
/// Register a callback to be notified of future events (such when WiFi has
/// started or stopped)
flexible RegisterEventCallback(resource table {
1: callback client_end:WifiEventCallback;
});
/// Start WiFi. If this operation is not successful, return an error status.
/// If this operation is successful, the `started` state is now true and all
/// registered callbacks will be notified with an `OnStart` event.
flexible Start() -> () error zx.Status;
/// Stop WiFi. If this operation is not successful, return an error status.
/// If this operation is successful, the `started` state is now false and all
/// registered callbacks will be notified with an `OnStop` event.
flexible Stop() -> () error zx.Status;
/// Return a boolean based on whether WiFi is `started` or not.
flexible GetState() -> (table {
1: is_started bool;
});
/// Get the IDs of all the WiFi chips on the device.
flexible GetChipIds() -> (table {
1: chip_ids vector<uint32>:MAX;
});
/// Register the channel to make request to the `WifiChip` with the given
/// `chip_id`
flexible GetChip(resource table {
1: chip_id uint32;
2: chip server_end:WifiChip;
}) -> () error zx.Status;
};
open protocol WifiEventCallback {
flexible OnStart();
flexible OnStop();
};
type ChipMode = table {
1: id uint32;
2: available_combinations vector<ChipConcurrencyCombination>:MAX;
};
type ChipConcurrencyCombination = table {
1: limits vector<ChipConcurrencyCombinationLimit>:MAX;
};
type ChipConcurrencyCombinationLimit = table {
1: types vector<IfaceConcurrencyType>:MAX;
2: max_ifaces uint32;
};
type IfaceConcurrencyType = flexible enum {
STA = 1;
AP = 2;
AP_BRIDGED = 3;
P2P = 4;
NAN_IFACE = 5;
};
open protocol WifiChip {
/// Request the chip to create a STA iface.
flexible CreateStaIface(resource table {
1: iface server_end:WifiStaIface;
}) -> () error zx.Status;
/// Get the names of all active ifaces.
flexible GetStaIfaceNames() -> (table {
1: iface_names vector<string:16>:MAX;
});
/// Request a new connection to an existing iface.
flexible GetStaIface(resource table {
1: iface_name string:16;
2: iface server_end:WifiStaIface;
}) -> () error zx.Status;
/// Request the destruction of a STA iface on the chip.
flexible RemoveStaIface(resource table {
1: iface_name string:16;
}) -> () error zx.Status;
/// Get a set of operation modes that the chip supports.
/// This combination encodes what iface types and how many can be created,
/// and which ones can run concurrently.
flexible GetAvailableModes() -> (table {
1: chip_modes vector<ChipMode>:MAX;
});
/// Get the ID of the current chip.
flexible GetId() -> (table {
1: id uint32;
});
/// Get the current mode that the chip is in.
flexible GetMode() -> (table {
1: mode uint32;
});
/// Get capabilities supported by this chip.
flexible GetCapabilities() -> (table {
1: capabilities_mask uint32;
});
};
open protocol WifiStaIface {
/// Get the name of this iface.
flexible GetName() -> (table {
1: iface_name string:16;
});
};
open protocol Supplicant {
flexible AddStaInterface(resource table {
1: iface server_end:SupplicantStaIface;
2: iface_name string:16;
});
};
open protocol SupplicantStaIface {
flexible RegisterCallback(resource table {
1: callback client_end:SupplicantStaIfaceCallback;
});
flexible AddNetwork(resource table {
1: network server_end:SupplicantStaNetwork;
});
flexible Disconnect() -> ();
};
open protocol SupplicantStaIfaceCallback {
flexible OnStateChanged(table {
1: new_state StaIfaceCallbackState;
2: bssid fuchsia.wlan.ieee80211.MacAddr;
3: id uint32;
4: ssid fuchsia.wlan.ieee80211.Ssid;
});
flexible OnDisconnected(table {
1: bssid fuchsia.wlan.ieee80211.MacAddr;
2: locally_generated bool;
3: reason_code fuchsia.wlan.ieee80211.ReasonCode;
});
flexible OnAssociationRejected(table {
1: ssid fuchsia.wlan.ieee80211.Ssid;
2: bssid fuchsia.wlan.ieee80211.MacAddr;
3: status_code fuchsia.wlan.ieee80211.StatusCode;
4: timed_out bool;
});
};
type StaIfaceCallbackState = flexible enum : uint32 {
DISCONNECTED = 0;
IFACE_DISABLED = 1;
INACTIVE = 2;
SCANNING = 3;
AUTHENTICATING = 4;
ASSOCIATING = 5;
ASSOCIATED = 6;
FOURWAY_HANDSHAKE = 7;
GROUP_HANDSHAKE = 8;
COMPLETED = 9;
};
open protocol SupplicantStaNetwork {
flexible SetBssid(table {
1: bssid fuchsia.wlan.ieee80211.MacAddr;
});
flexible ClearBssid();
flexible SetSsid(table {
1: ssid fuchsia.wlan.ieee80211.Ssid;
});
flexible SetPskPassphrase(table {
1: passphrase vector<uint8>:MAX;
});
flexible Select() -> () error zx.Status;
};
type Nl80211MessageType = flexible enum {
DONE = 1;
ERROR = 2;
ACK = 3;
NO_OP = 4;
OVERRUN = 5;
MESSAGE = 6;
};
type Nl80211Message = table {
1: message_type Nl80211MessageType;
2: payload vector<uint8>:MAX;
};
open protocol Nl80211 {
flexible GetMulticast(resource table {
1: group string:32;
2: multicast client_end:Nl80211Multicast;
});
flexible Message(resource table {
1: message Nl80211Message;
}) -> (resource table {
1: responses vector<Nl80211Message>:MAX;
}) error zx.Status;
};
open protocol Nl80211Multicast {
flexible Message(resource table {
1: message Nl80211Message;
});
};