nm_rs/auto/
device_ovs_port.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{ffi,Device,Object};
8use glib::{prelude::*};
9#[cfg(feature = "v1_14")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v1_14")))]
11use glib::{translate::*};
12#[cfg(feature = "v1_22")]
13#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
14use glib::{signal::{connect_raw, SignalHandlerId}};
15#[cfg(feature = "v1_22")]
16#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
17use std::{boxed::Box as Box_};
18
19glib::wrapper! {
20    ///
21    ///
22    /// ## Properties
23    ///
24    ///
25    /// #### `slaves`
26    ///  Gets the interfaces currently attached as port to the device.
27    ///
28    /// Readable
29    /// <details><summary><h4>Device</h4></summary>
30    ///
31    ///
32    /// #### `active-connection`
33    ///  The #NMActiveConnection object that "owns" this device during activation.
34    ///
35    /// Readable
36    ///
37    ///
38    /// #### `autoconnect`
39    ///  Whether the device can auto-activate a connection.
40    ///
41    /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
42    ///
43    /// Readable | Writeable
44    ///
45    ///
46    /// #### `available-connections`
47    ///  The available connections of the device
48    ///
49    /// Readable
50    ///
51    ///
52    /// #### `capabilities`
53    ///  The capabilities of the device.
54    ///
55    /// Readable
56    ///
57    ///
58    /// #### `device-type`
59    ///  The numeric type of the device.
60    ///
61    /// Readable
62    ///
63    ///
64    /// #### `dhcp4-config`
65    ///  The IPv4 #NMDhcpConfig of the device.
66    ///
67    /// Readable
68    ///
69    ///
70    /// #### `dhcp6-config`
71    ///  The IPv6 #NMDhcpConfig of the device.
72    ///
73    /// Readable
74    ///
75    ///
76    /// #### `driver`
77    ///  The driver of the device.
78    ///
79    /// Readable
80    ///
81    ///
82    /// #### `driver-version`
83    ///  The version of the device driver.
84    ///
85    /// Readable
86    ///
87    ///
88    /// #### `firmware-missing`
89    ///  When [`true`] indicates the device is likely missing firmware required
90    /// for its operation.
91    ///
92    /// Readable
93    ///
94    ///
95    /// #### `firmware-version`
96    ///  The firmware version of the device.
97    ///
98    /// Readable
99    ///
100    ///
101    /// #### `hw-address`
102    ///  The hardware address of the device.
103    ///
104    /// Readable
105    ///
106    ///
107    /// #### `interface`
108    ///  The interface of the device.
109    ///
110    /// Readable
111    ///
112    ///
113    /// #### `interface-flags`
114    ///  The interface flags.
115    ///
116    /// Readable
117    ///
118    ///
119    /// #### `ip-interface`
120    ///  The IP interface of the device which should be used for all IP-related
121    /// operations like addressing and routing.
122    ///
123    /// Readable
124    ///
125    ///
126    /// #### `ip4-config`
127    ///  The #NMIP4Config of the device.
128    ///
129    /// Readable
130    ///
131    ///
132    /// #### `ip4-connectivity`
133    ///  The IPv4 connectivity state of the device.
134    ///
135    /// Readable
136    ///
137    ///
138    /// #### `ip6-config`
139    ///  The IPv6 #NMIPConfig of the device.
140    ///
141    /// Readable
142    ///
143    ///
144    /// #### `ip6-connectivity`
145    ///  The IPv6 connectivity state of the device.
146    ///
147    /// Readable
148    ///
149    ///
150    /// #### `lldp-neighbors`
151    ///  The LLDP neighbors.
152    ///
153    /// Readable
154    ///
155    ///
156    /// #### `managed`
157    ///  Whether the device is managed by NetworkManager.
158    ///
159    /// Readable
160    ///
161    ///
162    /// #### `metered`
163    ///  Whether the device is metered.
164    ///
165    /// Readable
166    ///
167    ///
168    /// #### `mtu`
169    ///  The MTU of the device.
170    ///
171    /// Readable
172    ///
173    ///
174    /// #### `nm-plugin-missing`
175    ///  When [`true`] indicates that the NetworkManager plugin for the device
176    /// is not installed.
177    ///
178    /// Readable
179    ///
180    ///
181    /// #### `path`
182    ///  The device path as exposed by the udev property ID_PATH.
183    ///
184    /// The string is backslash escaped (C escaping) for invalid
185    /// characters. The escaping can be reverted with g_strcompress(),
186    /// however the result may not be valid UTF-8.
187    ///
188    /// Readable
189    ///
190    ///
191    /// #### `physical-port-id`
192    ///  The physical port ID of the device. (See
193    /// nm_device_get_physical_port_id().)
194    ///
195    /// Readable
196    ///
197    ///
198    /// #### `ports`
199    ///  The port devices of the controller device. For devices that cannot be
200    /// controllers this is likely to be always empty.
201    ///
202    /// Readable
203    ///
204    ///
205    /// #### `product`
206    ///  The product string of the device.
207    ///
208    /// Readable
209    ///
210    ///
211    /// #### `real`
212    ///  Whether the device is real or is a placeholder device that could
213    /// be created automatically by NetworkManager if one of its
214    /// #NMDevice:available-connections was activated.
215    ///
216    /// Readable
217    ///
218    ///
219    /// #### `state`
220    ///  The state of the device.
221    ///
222    /// Readable
223    ///
224    ///
225    /// #### `state-reason`
226    ///  The reason for the device state.
227    ///
228    /// Readable
229    ///
230    ///
231    /// #### `udi`
232    ///  An operating-system specific device hardware identifier; this is not
233    /// unique to a specific hardware device across reboots or hotplugs.  It
234    /// is an opaque string which for some device types (Bluetooth, Modem)
235    /// contains an identifier provided by the underlying hardware service daemon
236    /// such as Bluez or ModemManager, and clients can use this property to
237    /// request more information about the device from those services.
238    ///
239    /// Readable
240    ///
241    ///
242    /// #### `vendor`
243    ///  The vendor string of the device.
244    ///
245    /// Readable
246    /// </details>
247    /// <details><summary><h4>Object</h4></summary>
248    ///
249    ///
250    /// #### `client`
251    ///  The NMClient instance as returned by nm_object_get_client().
252    ///
253    /// When an NMObject gets removed from the NMClient cache,
254    /// the NMObject:path property stays unchanged, but this client
255    /// instance gets reset to [`None`]. You can use this property to
256    /// track removal of the object from the cache.
257    ///
258    /// Readable
259    ///
260    ///
261    /// #### `path`
262    ///  The D-Bus object path.
263    ///
264    /// The D-Bus path of an object instance never changes, even if the object
265    /// gets removed from the cache. To see whether the object is still in the
266    /// cache, check NMObject:client.
267    ///
268    /// Readable
269    /// </details>
270    ///
271    /// # Implements
272    ///
273    /// [`DeviceExt`][trait@crate::prelude::DeviceExt], [`ObjectExt`][trait@crate::prelude::ObjectExt]
274    #[doc(alias = "NMDeviceOvsPort")]
275    pub struct DeviceOvsPort(Object<ffi::NMDeviceOvsPort, ffi::NMDeviceOvsPortClass>) @extends Device, Object;
276
277    match fn {
278        type_ => || ffi::nm_device_ovs_port_get_type(),
279    }
280}
281
282impl DeviceOvsPort {
283            // rustdoc-stripper-ignore-next
284            /// Creates a new builder-pattern struct instance to construct [`DeviceOvsPort`] objects.
285            ///
286            /// This method returns an instance of [`DeviceOvsPortBuilder`](crate::builders::DeviceOvsPortBuilder) which can be used to create [`DeviceOvsPort`] objects.
287            pub fn builder() -> DeviceOvsPortBuilder {
288                DeviceOvsPortBuilder::new()
289            }
290        
291
292    /// Gets the interfaces currently attached as port to @self.
293    ///
294    /// # Deprecated since 1.34
295    ///
296    /// Use nm_device_get_ports() instead.
297    ///
298    /// # Returns
299    ///
300    /// the #GPtrArray containing
301    /// #NMDevices that are ports of @self. This is the internal
302    /// copy used by the device, and must not be modified.
303    #[cfg_attr(feature = "v1_34", deprecated = "Since 1.34")]
304    #[cfg(feature = "v1_14")]
305    #[cfg_attr(docsrs, doc(cfg(feature = "v1_14")))]
306    #[allow(deprecated)]
307    #[doc(alias = "nm_device_ovs_port_get_slaves")]
308    #[doc(alias = "get_slaves")]
309    pub fn slaves(&self) -> Vec<Device> {
310        unsafe {
311            FromGlibPtrContainer::from_glib_none(ffi::nm_device_ovs_port_get_slaves(self.to_glib_none().0))
312        }
313    }
314
315    #[cfg(feature = "v1_22")]
316    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
317    #[doc(alias = "slaves")]
318    pub fn connect_slaves_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
319        unsafe extern "C" fn notify_slaves_trampoline<F: Fn(&DeviceOvsPort) + 'static>(this: *mut ffi::NMDeviceOvsPort, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
320            let f: &F = &*(f as *const F);
321            f(&from_glib_borrow(this))
322        }
323        unsafe {
324            let f: Box_<F> = Box_::new(f);
325            connect_raw(self.as_ptr() as *mut _, c"notify::slaves".as_ptr() as *const _,
326                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_slaves_trampoline::<F> as *const ())), Box_::into_raw(f))
327        }
328    }
329}
330
331// rustdoc-stripper-ignore-next
332        /// A [builder-pattern] type to construct [`DeviceOvsPort`] objects.
333        ///
334        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
335#[must_use = "The builder must be built to be used"]
336pub struct DeviceOvsPortBuilder {
337            builder: glib::object::ObjectBuilder<'static, DeviceOvsPort>,
338        }
339
340        impl DeviceOvsPortBuilder {
341        fn new() -> Self {
342            Self { builder: glib::object::Object::builder() }
343        }
344
345                            /// Whether the device can auto-activate a connection.
346                            ///
347                            /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
348                            pub fn autoconnect(self, autoconnect: bool) -> Self {
349                            Self { builder: self.builder.property("autoconnect", autoconnect), }
350                        }
351
352    // rustdoc-stripper-ignore-next
353    /// Build the [`DeviceOvsPort`].
354    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
355    pub fn build(self) -> DeviceOvsPort {
356assert_initialized_main_thread!();
357    self.builder.build() }
358}