use std::collections::HashMap;
use zvariant::{OwnedObjectPath, OwnedValue};
#[non_exhaustive]
#[derive(Debug, Clone)]
pub struct SavedConnection {
pub path: OwnedObjectPath,
pub uuid: String,
pub id: String,
pub connection_type: String,
pub interface_name: Option<String>,
pub autoconnect: bool,
pub autoconnect_priority: i32,
pub timestamp_unix: u64,
pub permissions: Vec<String>,
pub unsaved: bool,
pub filename: Option<String>,
pub summary: SettingsSummary,
}
#[non_exhaustive]
#[derive(Debug, Clone)]
pub struct SavedConnectionBrief {
pub path: OwnedObjectPath,
pub uuid: String,
pub id: String,
pub connection_type: String,
}
#[non_exhaustive]
#[derive(Debug, Default, Clone)]
pub struct SettingsPatch {
pub autoconnect: Option<bool>,
pub autoconnect_priority: Option<i32>,
pub id: Option<String>,
pub interface_name: Option<Option<String>>,
pub raw_overlay: Option<HashMap<String, HashMap<String, OwnedValue>>>,
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
pub struct VpnSecretFlags(pub u32);
impl VpnSecretFlags {
pub const AGENT_OWNED: u32 = 0x1;
#[must_use]
pub fn agent_owned(self) -> bool {
self.0 & Self::AGENT_OWNED != 0
}
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum WifiKeyMgmt {
None,
Wep,
WpaPsk,
WpaEap,
Sae,
Owe,
OweTransitionMode,
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct WifiSecuritySummary {
pub key_mgmt: WifiKeyMgmt,
pub has_psk_field: bool,
pub psk_agent_owned: bool,
pub eap_methods: Vec<String>,
}
#[non_exhaustive]
#[derive(Debug, Clone)]
pub enum SettingsSummary {
Wifi {
ssid: String,
mode: Option<String>,
security: Option<WifiSecuritySummary>,
band: Option<String>,
channel: Option<u32>,
bssid: Option<String>,
hidden: bool,
mac_randomization: Option<String>,
},
Ethernet {
mac_address: Option<String>,
auto_negotiate: Option<bool>,
speed_mbps: Option<u32>,
mtu: Option<u32>,
},
Vpn {
service_type: String,
user_name: Option<String>,
password_flags: VpnSecretFlags,
data_keys: Vec<String>,
persistent: bool,
},
WireGuard {
listen_port: Option<u16>,
mtu: Option<u32>,
fwmark: Option<u32>,
peer_count: usize,
first_peer_endpoint: Option<String>,
},
Gsm {
apn: Option<String>,
user_name: Option<String>,
password_flags: u32,
pin_flags: u32,
},
Cdma {
number: Option<String>,
user_name: Option<String>,
password_flags: u32,
},
Bluetooth {
bdaddr: String,
bt_type: String,
},
Other {
sections: Vec<String>,
},
}