passcod_networkmanager/configs/
ip6.rs

1use crate::dbus_api::DBusAccessor;
2use crate::errors::Error;
3use crate::gen::OrgFreedesktopNetworkManagerIP6Config;
4
5type Ip6Address = Vec<u8>;
6type Ip6Route = Vec<u8>;
7type Ip6Prefix = u32;
8type Ip6Gateway = Vec<u8>;
9type Ip6NextHop = Vec<u8>;
10type Ip6Metric = u32;
11type Ip6AddressProperty = (Ip6Address, Ip6Prefix, Ip6Gateway);
12type Ip6RouteProperty = (Ip6Route, Ip6Prefix, Ip6NextHop, Ip6Metric);
13
14type HashMapDBusVariant =
15    std::collections::HashMap<String, dbus::arg::Variant<Box<dyn dbus::arg::RefArg + 'static>>>;
16
17#[derive(Clone, Debug)]
18pub struct Ip6Config {
19    dbus_accessor: DBusAccessor,
20}
21
22impl Ip6Config {
23    pub(crate) fn new(dbus_accessor: DBusAccessor) -> Self {
24        Ip6Config { dbus_accessor }
25    }
26
27    pub fn addresses(&self) -> Result<Vec<Ip6AddressProperty>, Error> {
28        Ok(proxy!(self).addresses()?)
29    }
30    pub fn address_data(&self) -> Result<Vec<HashMapDBusVariant>, Error> {
31        Ok(proxy!(self).address_data()?)
32    }
33    pub fn gateway(&self) -> Result<String, Error> {
34        Ok(proxy!(self).gateway()?)
35    }
36    pub fn routes(&self) -> Result<Vec<Ip6RouteProperty>, Error> {
37        Ok(proxy!(self).routes()?)
38    }
39    pub fn route_data(&self) -> Result<Vec<HashMapDBusVariant>, Error> {
40        Ok(proxy!(self).route_data()?)
41    }
42    pub fn nameservers(&self) -> Result<Vec<Ip6Address>, Error> {
43        Ok(proxy!(self).nameservers()?)
44    }
45    pub fn domains(&self) -> Result<Vec<String>, Error> {
46        Ok(proxy!(self).domains()?)
47    }
48    pub fn searches(&self) -> Result<Vec<String>, Error> {
49        Ok(proxy!(self).searches()?)
50    }
51    pub fn dns_options(&self) -> Result<Vec<String>, Error> {
52        Ok(proxy!(self).dns_options()?)
53    }
54    pub fn dns_priority(&self) -> Result<i32, Error> {
55        Ok(proxy!(self).dns_priority()?)
56    }
57}