31 lines
792 B
Rust
31 lines
792 B
Rust
pub trait Connects {
|
|
fn connect_to_network(
|
|
&self,
|
|
iface: &NetworkInterface,
|
|
net: &Network,
|
|
psk: Option<&str>,
|
|
) -> Result<bool, String>;
|
|
}
|
|
pub trait ListsNetworks {
|
|
fn list_networks(&self, iface: &NetworkInterface) -> Result<Vec<Network>, String>;
|
|
}
|
|
pub trait ListsNetworkInterfaces {
|
|
fn list_network_interfaces(&self) -> Result<Vec<NetworkInterface>, String>;
|
|
}
|
|
pub trait Connector: Connects + ListsNetworks + ListsNetworkInterfaces {}
|
|
|
|
#[derive(Debug, Default)]
|
|
pub struct Network {
|
|
pub ssid: String,
|
|
pub bssid: Option<String>,
|
|
pub channel: Option<u8>,
|
|
pub rssi: Option<i8>,
|
|
}
|
|
|
|
#[derive(Debug, Default)]
|
|
pub struct NetworkInterface {
|
|
pub enabled: bool,
|
|
pub machine_name: String,
|
|
pub human_name: Option<String>,
|
|
}
|