openvpn3_rs/proxy/configuration_node.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.node.xml`.
5
6use zbus::{dbus_proxy, fdo};
7
8/// Configuration Object
9#[dbus_proxy(
10 interface = "net.openvpn.v3.configuration",
11 default_service = "net.openvpn.v3.configuration",
12 default_path = "/net/openvpn/v3/configuration"
13)]
14trait ConfigurationNode {
15 /// AccessGrant method
16 ///
17 /// By default, only the user ID (UID) who imported the configuration have access to it. This method used to grant other users access to the configuration.
18 ///
19 /// # Arguments
20 ///
21 /// * `uid` - The UID to the user account which is granted access.
22 fn access_grant(&self, uid: u32) -> fdo::Result<()>;
23
24 /// AccessRevoke method
25 ///
26 /// This revokes access to a configuration object for a specific user. Please note that the owner (the user which imported the configuration) cannot have its access revoked.
27 ///
28 /// # Arguments
29 ///
30 /// * `uid` - The UID to the user account which gets the access revoked.
31 fn access_revoke(&self, uid: u32) -> fdo::Result<()>;
32
33 /// Fetch method
34 ///
35 /// This method will return a string of the stored configuration profile as it is stored. This should be contain the same information which was imported. It will not necessarily be an identical copy of what was imported, as it has been processed during the import.
36 ///
37 /// # Returns
38 /// The configuration file as a plain string blob.
39 fn fetch(&self) -> zbus::Result<String>;
40
41 /// FetchJSON method
42 ///
43 /// This is a variant of Fetch, which returns the configuration profile formatted as a JSON string blob. The intention of this is for user front-ends to have a simple API to retrieve the complete configuration profile in a format which can easily be parsed and presented in a user interface.
44 ///
45 /// # Returns
46 ///
47 /// The configuration file as a JSON formatted string blob.
48 #[dbus_proxy(name = "FetchJSON")]
49 fn fetch_json(&self) -> zbus::Result<String>;
50
51 /// Remove method
52 ///
53 /// Removes a VPN profile from the configuration manager. If the configuration is persistent, it will be removed from the disk as well. This method takes no arguments and does not return anything on success. If an error occurs, a D-Bus error is returned.
54 fn remove(&self) -> fdo::Result<()>;
55
56 /// Seal method
57 ///
58 /// This method makes the configuration read-only. That means it can no longer be manipulated, nor removed.
59 fn seal(&self) -> fdo::Result<()>;
60
61 /// SetOption method
62 ///
63 /// This method allows manipulation of a stored configuration. This is targeted at user front-ends to be able to easily manipulate imported configuration files.
64 ///
65 /// ** WARNING: ** This method is currently not implemented!
66 ///
67 /// # Arguments
68 ///
69 /// * `option` - String containing the name of the option to be modified.
70 /// * `value` - String containing the new value of the option.
71 fn set_option(&self, option: &str, value: &str) -> fdo::Result<()>;
72
73 /// SetOverride method
74 ///
75 /// Modifies an override parameter in the configuration profile.
76 ///
77 /// # Arguments
78 ///
79 /// * `name` - Property name to modify.
80 /// * `value` - The new value the property should have. The data type ov must match the data type of the property in the D-Bus object.
81 fn set_override(&self, name: &str, value: &zbus::zvariant::Value<'_>) -> fdo::Result<()>;
82
83 /// UnsetOverride method
84 ///
85 /// Unset an override setting.
86 ///
87 /// # Arguments
88 ///
89 /// * `name` - Override property name to remove.
90 fn unset_override(&self, name: &str) -> fdo::Result<()>;
91
92 /// An array of UID values granted access.
93 #[dbus_proxy(property, name = "acl")]
94 fn acl(&self) -> zbus::Result<Vec<u32>>;
95
96 /// If set to true, the VPN tunnel will make use of the kernel accelerated Data Channel Offload (DCO) feature (requires kernel support).
97 #[dbus_proxy(property, name = "dco")]
98 fn dco(&self) -> zbus::Result<bool>;
99 fn set_dco(&self, value: bool) -> fdo::Result<()>;
100
101 /// Unix Epoch timestamp of the import time.
102 #[dbus_proxy(property, name = "import_timestamp")]
103 fn import_timestamp(&self) -> zbus::Result<u64>;
104
105 /// Unix Epoch timestamp of the last time it Fetch was called.
106 ///
107 /// It will track/count `Fetch` usage only if the calling user is `openvpn`.
108 #[dbus_proxy(property, name = "last_used_timestamp")]
109 fn last_used_timestamp(&self) -> zbus::Result<u64>;
110
111 /// If set to true, only the owner and openvpn user can retrieve the configuration file. Other users granted access can only use this profile to start a new tunnel.
112 #[dbus_proxy(property, name = "locked_down")]
113 fn locked_down(&self) -> zbus::Result<bool>;
114 fn set_locked_down(&self, value: bool) -> fdo::Result<()>;
115
116 /// Contains the user friendly name of the configuration profile
117 #[dbus_proxy(property, name = "name")]
118 fn name(&self) -> zbus::Result<String>;
119 fn set_name(&self, value: &str) -> fdo::Result<()>;
120
121 /// Contains all the override settings enabled. This is stored as a key/value based dictionary, where value can be any arbitrary data type.
122 #[dbus_proxy(property, name = "overrides")]
123 fn overrides(
124 &self,
125 ) -> zbus::Result<std::collections::HashMap<String, zbus::zvariant::OwnedValue>>;
126
127 /// The UID value of the user which did the import.
128 #[dbus_proxy(property, name = "owner")]
129 fn owner(&self) -> zbus::Result<u32>;
130
131 /// If set to true, this configuration will be saved to disk by the configuration manager. The location of the file storage is managed by the configuration manager itself and the configuration manager will load persistent profiles each time it starts.
132 #[dbus_proxy(property, name = "persistent")]
133 fn persistent(&self) -> zbus::Result<bool>;
134
135 /// If set to true, access control is disabled. But only owner may change this property, modify the ACL or delete the configuration.
136 #[dbus_proxy(property, name = "public_access")]
137 fn public_access(&self) -> zbus::Result<bool>;
138 fn set_public_access(&self, value: bool) -> fdo::Result<()>;
139
140 /// If set to true, the configuration have been sealed and can no longer be modified.
141 #[dbus_proxy(property, name = "readonly")]
142 fn readonly(&self) -> zbus::Result<bool>;
143
144 /// If set to true, this configuration profile will be automatically removed after the first `Fetch` call. This is intended to be used by command line clients providing a similar user experience as the OpenVPN 2.x versions provides.
145 #[dbus_proxy(property, name = "single_use")]
146 fn single_use(&self) -> zbus::Result<bool>;
147
148 /// If set to true, another user granted access to this profile will transfer the VPN session ownership back to the profile owner at start up.
149 #[dbus_proxy(property, name = "transfer_owner_session")]
150 fn transfer_owner_session(&self) -> zbus::Result<bool>;
151 fn set_transfer_owner_session(&self, value: bool) -> fdo::Result<()>;
152
153 /// Number of times Fetch has been called.
154 ///
155 /// It will track/count `Fetch` usage only if the calling user is `openvpn`.
156 #[dbus_proxy(property, name = "used_count")]
157 fn used_count(&self) -> zbus::Result<u32>;
158
159 /// Contains an indication if the configuration profile is considered functional for a VPN session.
160 #[dbus_proxy(property, name = "valid")]
161 fn valid(&self) -> zbus::Result<bool>;
162}