openvpn3_rs/proxy/
configuration.rs

1//! # DBus interface proxy for: `net.openvpn.v3.configuration`
2//!
3//! This code was generated by `zbus-xmlgen` `3.1.0` from DBus introspection data.
4//! Source: `net.openvpn.v3.configuration.xml`.
5
6use crate::log::constants::{LogGroup, LogLevel};
7
8use super::configuration_node::{ConfigurationNodeProxy, ConfigurationNodeProxyBlocking};
9
10use zbus::{dbus_proxy, fdo};
11
12/// Configuration Service
13///
14/// Stores VPN configuration profiles in a format used by the OpenVPN 3 Core library.
15///
16/// [OpenVPN Documentation](https://github.com/OpenVPN/openvpn3-linux/blob/master/docs/dbus/dbus-service-net.openvpn.v3.configuration.md)
17#[dbus_proxy(
18    interface = "net.openvpn.v3.configuration",
19    default_service = "net.openvpn.v3.configuration",
20    default_path = "/net/openvpn/v3/configuration"
21)]
22trait Configuration {
23    /// FetchAvailableConfigs method
24    ///
25    /// This method will return an array of object paths to configuration objects the caller is granted access to.
26    fn fetch_available_configs(&self) -> zbus::Result<Vec<zbus::zvariant::OwnedObjectPath>>;
27
28    /// Import method
29    ///
30    /// This method imports a configuration profile. The configuration must be represented as a string blob containing everything.
31    ///
32    /// # Arguments
33    ///
34    /// * `name` - User friendly name of the profile. To be used in user front-ends.
35    /// * `config_str` - Content of config file. All files must be embedded inline.
36    /// * `single_use` - If set to true, it will be removed from memory on first use.
37    /// * `persistent` - If set to true, the configuration will be saved to disk.
38    ///
39    /// # Returns
40    ///
41    /// A unique D-Bus object path for the imported VPN configuration profile
42    #[dbus_proxy(object = "ConfigurationNode")]
43    fn import(&self, name: &str, config_str: &str, single_use: bool, persistent: bool);
44
45    /// LookupConfigName method
46    ///
47    /// This method will return an array of object paths to configuration objects the caller is granted access with the configuration name provided to the method.
48    ///
49    /// # Arguments
50    ///
51    /// * `config_name` - String containing the configuration name for the configuration path lookup.
52    ///
53    /// # Returns
54    ///
55    /// An array of object paths to accessible configuration objects
56    fn lookup_config_name(
57        &self,
58        config_name: &str,
59    ) -> zbus::Result<Vec<zbus::zvariant::OwnedObjectPath>>;
60
61    /// TransferOwnership method
62    ///
63    /// This method transfers the ownership of a configuration profile to the given UID value.
64    /// This feature is by design restricted to the root account only and is only expected to be used by `openvpn3-autoload` and similar tools.
65    ///
66    /// # Arguments
67    ///
68    /// * `path` - Configuration object path where to modify the owner property.
69    /// * `new_owner_uid` - UID value of the new owner of the configuration profile.
70    fn transfer_ownership(
71        &self,
72        path: &zbus::zvariant::ObjectPath<'_>,
73        new_owner_uid: u32,
74    ) -> fdo::Result<()>;
75
76    /// Log signal
77    ///
78    /// Whenever the configuration manager wants to log something, it issues a Log signal which carries a log group, log verbosity level and a string with the log message itself.
79    /// See the separate [logging documentation](https://github.com/OpenVPN/openvpn3-linux/blob/master/docs/dbus/dbus-logging.md) for details on this signal.
80    #[dbus_proxy(signal)]
81    fn log(&self, group: LogGroup, level: LogLevel, message: &str) -> fdo::Result<()>;
82
83    /// Version of the currently running service.
84    #[dbus_proxy(property, name = "version")]
85    fn version(&self) -> zbus::Result<String>;
86}