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