nm_rs/auto/
setting_ip_tunnel.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
6use crate::{ffi,Setting};
7#[cfg(feature = "v1_2")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
9use crate::{IPTunnelMode};
10#[cfg(feature = "v1_12")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
12use crate::{IPTunnelFlags};
13use glib::{prelude::*};
14#[cfg(feature = "v1_2")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
16use glib::{signal::{connect_raw, SignalHandlerId},translate::*};
17#[cfg(feature = "v1_2")]
18#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
19use std::{boxed::Box as Box_};
20
21glib::wrapper! {
22    /// IP Tunneling Settings
23    ///
24    /// ## Properties
25    ///
26    ///
27    /// #### `encapsulation-limit`
28    ///  How many additional levels of encapsulation are permitted to be prepended
29    /// to packets. This property applies only to IPv6 tunnels. To disable this option,
30    /// add [`IPTunnelFlags::IP6_IGN_ENCAP_LIMIT`][crate::IPTunnelFlags::IP6_IGN_ENCAP_LIMIT] to ip-tunnel flags.
31    ///
32    /// Readable | Writeable
33    ///
34    ///
35    /// #### `flags`
36    ///  Tunnel flags. Currently, the following values are supported:
37    /// [`IPTunnelFlags::IP6_IGN_ENCAP_LIMIT`][crate::IPTunnelFlags::IP6_IGN_ENCAP_LIMIT], [`IPTunnelFlags::IP6_USE_ORIG_TCLASS`][crate::IPTunnelFlags::IP6_USE_ORIG_TCLASS],
38    /// [`IPTunnelFlags::IP6_USE_ORIG_FLOWLABEL`][crate::IPTunnelFlags::IP6_USE_ORIG_FLOWLABEL], [`IPTunnelFlags::IP6_MIP6_DEV`][crate::IPTunnelFlags::IP6_MIP6_DEV],
39    /// [`IPTunnelFlags::IP6_RCV_DSCP_COPY`][crate::IPTunnelFlags::IP6_RCV_DSCP_COPY], [`IPTunnelFlags::IP6_USE_ORIG_FWMARK`][crate::IPTunnelFlags::IP6_USE_ORIG_FWMARK].
40    /// They are valid only for IPv6 tunnels.
41    ///
42    /// Readable | Writeable
43    ///
44    ///
45    /// #### `flow-label`
46    ///  The flow label to assign to tunnel packets. This property applies only to
47    /// IPv6 tunnels.
48    ///
49    /// Readable | Writeable
50    ///
51    ///
52    /// #### `fwmark`
53    ///  The fwmark value to assign to tunnel packets. This property can be set
54    /// to a non zero value only on VTI and VTI6 tunnels.
55    ///
56    /// Readable | Writeable
57    ///
58    ///
59    /// #### `input-key`
60    ///  The key used for tunnel input packets; the property is valid only for
61    /// certain tunnel modes (GRE, IP6GRE). If empty, no key is used.
62    ///
63    /// Readable | Writeable
64    ///
65    ///
66    /// #### `local`
67    ///  The local endpoint of the tunnel; the value can be empty, otherwise it
68    /// must contain an IPv4 or IPv6 address.
69    ///
70    /// Readable | Writeable
71    ///
72    ///
73    /// #### `mode`
74    ///  The tunneling mode. Valid values: [`IPTunnelMode::Ipip`][crate::IPTunnelMode::Ipip],
75    /// [`IPTunnelMode::Gre`][crate::IPTunnelMode::Gre], [`IPTunnelMode::Sit`][crate::IPTunnelMode::Sit], [`IPTunnelMode::Isatap`][crate::IPTunnelMode::Isatap],
76    /// [`IPTunnelMode::Vti`][crate::IPTunnelMode::Vti], [`IPTunnelMode::Ip6ip6`][crate::IPTunnelMode::Ip6ip6], [`IPTunnelMode::Ipip6`][crate::IPTunnelMode::Ipip6],
77    /// [`IPTunnelMode::Ip6gre`][crate::IPTunnelMode::Ip6gre], [`IPTunnelMode::Vti6`][crate::IPTunnelMode::Vti6], [`IPTunnelMode::Gretap`][crate::IPTunnelMode::Gretap]
78    /// and [`IPTunnelMode::Ip6gretap`][crate::IPTunnelMode::Ip6gretap]
79    ///
80    /// Readable | Writeable
81    ///
82    ///
83    /// #### `mtu`
84    ///  If non-zero, only transmit packets of the specified size or smaller,
85    /// breaking larger packets up into multiple fragments.
86    ///
87    /// Readable | Writeable
88    ///
89    ///
90    /// #### `output-key`
91    ///  The key used for tunnel output packets; the property is valid only for
92    /// certain tunnel modes (GRE, IP6GRE). If empty, no key is used.
93    ///
94    /// Readable | Writeable
95    ///
96    ///
97    /// #### `parent`
98    ///  If given, specifies the parent interface name or parent connection UUID
99    /// the new device will be bound to so that tunneled packets will only be
100    /// routed via that interface.
101    ///
102    /// Readable | Writeable
103    ///
104    ///
105    /// #### `path-mtu-discovery`
106    ///  Whether to enable Path MTU Discovery on this tunnel.
107    ///
108    /// Readable | Writeable
109    ///
110    ///
111    /// #### `remote`
112    ///  The remote endpoint of the tunnel; the value must contain an IPv4 or IPv6
113    /// address.
114    ///
115    /// Readable | Writeable
116    ///
117    ///
118    /// #### `tos`
119    ///  The type of service (IPv4) or traffic class (IPv6) field to be set on
120    /// tunneled packets.
121    ///
122    /// Readable | Writeable
123    ///
124    ///
125    /// #### `ttl`
126    ///  The TTL to assign to tunneled packets. 0 is a special value meaning that
127    /// packets inherit the TTL value.
128    ///
129    /// Readable | Writeable
130    /// <details><summary><h4>Setting</h4></summary>
131    ///
132    ///
133    /// #### `name`
134    ///  The setting's name, which uniquely identifies the setting within the
135    /// connection.  Each setting type has a name unique to that type, for
136    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
137    ///
138    /// Readable
139    /// </details>
140    ///
141    /// # Implements
142    ///
143    /// [`SettingExt`][trait@crate::prelude::SettingExt]
144    #[doc(alias = "NMSettingIPTunnel")]
145    pub struct SettingIPTunnel(Object<ffi::NMSettingIPTunnel, ffi::NMSettingIPTunnelClass>) @extends Setting;
146
147    match fn {
148        type_ => || ffi::nm_setting_ip_tunnel_get_type(),
149    }
150}
151
152impl SettingIPTunnel {
153    /// Creates a new #NMSettingIPTunnel object with default values.
154    ///
155    /// # Returns
156    ///
157    /// the new empty #NMSettingIPTunnel object
158    #[cfg(feature = "v1_2")]
159    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
160    #[doc(alias = "nm_setting_ip_tunnel_new")]
161    pub fn new() -> SettingIPTunnel {
162        assert_initialized_main_thread!();
163        unsafe {
164            Setting::from_glib_full(ffi::nm_setting_ip_tunnel_new()).unsafe_cast()
165        }
166    }
167
168            // rustdoc-stripper-ignore-next
169            /// Creates a new builder-pattern struct instance to construct [`SettingIPTunnel`] objects.
170            ///
171            /// This method returns an instance of [`SettingIPTunnelBuilder`](crate::builders::SettingIPTunnelBuilder) which can be used to create [`SettingIPTunnel`] objects.
172            pub fn builder() -> SettingIPTunnelBuilder {
173                SettingIPTunnelBuilder::new()
174            }
175        
176
177    /// Returns the #NMSettingIPTunnel:encapsulation-limit property of the setting.
178    ///
179    /// # Returns
180    ///
181    /// the encapsulation limit value
182    #[cfg(feature = "v1_42")]
183    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
184    #[doc(alias = "nm_setting_ip_tunnel_get_encapsulation_limit")]
185    #[doc(alias = "get_encapsulation_limit")]
186    #[doc(alias = "encapsulation-limit")]
187    pub fn encapsulation_limit(&self) -> u32 {
188        unsafe {
189            ffi::nm_setting_ip_tunnel_get_encapsulation_limit(self.to_glib_none().0)
190        }
191    }
192
193    /// Returns the #NMSettingIPTunnel:flags property of the setting.
194    ///
195    /// # Returns
196    ///
197    /// the tunnel flags
198    #[cfg(feature = "v1_12")]
199    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
200    #[doc(alias = "nm_setting_ip_tunnel_get_flags")]
201    #[doc(alias = "get_flags")]
202    pub fn flags(&self) -> IPTunnelFlags {
203        unsafe {
204            from_glib(ffi::nm_setting_ip_tunnel_get_flags(self.to_glib_none().0))
205        }
206    }
207
208    /// Returns the #NMSettingIPTunnel:flow-label property of the setting.
209    ///
210    /// # Returns
211    ///
212    /// the flow label value
213    #[cfg(feature = "v1_42")]
214    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
215    #[doc(alias = "nm_setting_ip_tunnel_get_flow_label")]
216    #[doc(alias = "get_flow_label")]
217    #[doc(alias = "flow-label")]
218    pub fn flow_label(&self) -> u32 {
219        unsafe {
220            ffi::nm_setting_ip_tunnel_get_flow_label(self.to_glib_none().0)
221        }
222    }
223
224    /// Returns the #NMSettingIPTunnel:fwmark property of the setting.
225    ///
226    /// # Returns
227    ///
228    /// the fwmark value
229    #[cfg(feature = "v1_42")]
230    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
231    #[doc(alias = "nm_setting_ip_tunnel_get_fwmark")]
232    #[doc(alias = "get_fwmark")]
233    pub fn fwmark(&self) -> u32 {
234        unsafe {
235            ffi::nm_setting_ip_tunnel_get_fwmark(self.to_glib_none().0)
236        }
237    }
238
239    /// Returns the #NMSettingIPTunnel:input-key property of the setting.
240    ///
241    /// # Returns
242    ///
243    /// the input key
244    #[cfg(feature = "v1_2")]
245    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
246    #[doc(alias = "nm_setting_ip_tunnel_get_input_key")]
247    #[doc(alias = "get_input_key")]
248    #[doc(alias = "input-key")]
249    pub fn input_key(&self) -> glib::GString {
250        unsafe {
251            from_glib_none(ffi::nm_setting_ip_tunnel_get_input_key(self.to_glib_none().0))
252        }
253    }
254
255    /// Returns the #NMSettingIPTunnel:local property of the setting.
256    ///
257    /// # Returns
258    ///
259    /// the local endpoint
260    #[cfg(feature = "v1_2")]
261    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
262    #[doc(alias = "nm_setting_ip_tunnel_get_local")]
263    #[doc(alias = "get_local")]
264    pub fn local(&self) -> glib::GString {
265        unsafe {
266            from_glib_none(ffi::nm_setting_ip_tunnel_get_local(self.to_glib_none().0))
267        }
268    }
269
270    /// Returns the #NMSettingIPTunnel:mode property of the setting.
271    ///
272    /// # Returns
273    ///
274    /// the tunnel mode
275    #[cfg(feature = "v1_2")]
276    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
277    #[doc(alias = "nm_setting_ip_tunnel_get_mode")]
278    #[doc(alias = "get_mode")]
279    pub fn mode(&self) -> IPTunnelMode {
280        unsafe {
281            from_glib(ffi::nm_setting_ip_tunnel_get_mode(self.to_glib_none().0))
282        }
283    }
284
285    /// Returns the #NMSettingIPTunnel:mtu property of the setting.
286    ///
287    /// # Returns
288    ///
289    /// the MTU
290    #[cfg(feature = "v1_2")]
291    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
292    #[doc(alias = "nm_setting_ip_tunnel_get_mtu")]
293    #[doc(alias = "get_mtu")]
294    pub fn mtu(&self) -> u32 {
295        unsafe {
296            ffi::nm_setting_ip_tunnel_get_mtu(self.to_glib_none().0)
297        }
298    }
299
300    /// Returns the #NMSettingIPTunnel:output-key property of the setting.
301    ///
302    /// # Returns
303    ///
304    /// the output key
305    #[cfg(feature = "v1_2")]
306    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
307    #[doc(alias = "nm_setting_ip_tunnel_get_output_key")]
308    #[doc(alias = "get_output_key")]
309    #[doc(alias = "output-key")]
310    pub fn output_key(&self) -> glib::GString {
311        unsafe {
312            from_glib_none(ffi::nm_setting_ip_tunnel_get_output_key(self.to_glib_none().0))
313        }
314    }
315
316    /// Returns the #NMSettingIPTunnel:parent property of the setting
317    ///
318    /// # Returns
319    ///
320    /// the parent device
321    #[cfg(feature = "v1_2")]
322    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
323    #[doc(alias = "nm_setting_ip_tunnel_get_parent")]
324    #[doc(alias = "get_parent")]
325    pub fn parent(&self) -> glib::GString {
326        unsafe {
327            from_glib_none(ffi::nm_setting_ip_tunnel_get_parent(self.to_glib_none().0))
328        }
329    }
330
331    /// Returns the #NMSettingIPTunnel:path-mtu-discovery property of the setting.
332    ///
333    /// # Returns
334    ///
335    /// whether path MTU discovery is enabled
336    #[cfg(feature = "v1_2")]
337    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
338    #[doc(alias = "nm_setting_ip_tunnel_get_path_mtu_discovery")]
339    #[doc(alias = "get_path_mtu_discovery")]
340    #[doc(alias = "path-mtu-discovery")]
341    pub fn is_path_mtu_discovery(&self) -> bool {
342        unsafe {
343            from_glib(ffi::nm_setting_ip_tunnel_get_path_mtu_discovery(self.to_glib_none().0))
344        }
345    }
346
347    /// Returns the #NMSettingIPTunnel:remote property of the setting.
348    ///
349    /// # Returns
350    ///
351    /// the remote endpoint
352    #[cfg(feature = "v1_2")]
353    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
354    #[doc(alias = "nm_setting_ip_tunnel_get_remote")]
355    #[doc(alias = "get_remote")]
356    pub fn remote(&self) -> glib::GString {
357        unsafe {
358            from_glib_none(ffi::nm_setting_ip_tunnel_get_remote(self.to_glib_none().0))
359        }
360    }
361
362    /// Returns the #NMSettingIPTunnel:tos property of the setting.
363    ///
364    /// # Returns
365    ///
366    /// the TOS value
367    #[cfg(feature = "v1_2")]
368    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
369    #[doc(alias = "nm_setting_ip_tunnel_get_tos")]
370    #[doc(alias = "get_tos")]
371    pub fn tos(&self) -> u32 {
372        unsafe {
373            ffi::nm_setting_ip_tunnel_get_tos(self.to_glib_none().0)
374        }
375    }
376
377    /// Returns the #NMSettingIPTunnel:ttl property of the setting.
378    ///
379    /// # Returns
380    ///
381    /// the Time-to-live value
382    #[cfg(feature = "v1_2")]
383    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
384    #[doc(alias = "nm_setting_ip_tunnel_get_ttl")]
385    #[doc(alias = "get_ttl")]
386    pub fn ttl(&self) -> u32 {
387        unsafe {
388            ffi::nm_setting_ip_tunnel_get_ttl(self.to_glib_none().0)
389        }
390    }
391
392    #[cfg(not(feature = "v1_42"))]
393    #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_42"))))]
394    #[doc(alias = "encapsulation-limit")]
395    pub fn encapsulation_limit(&self) -> u32 {
396        ObjectExt::property(self, "encapsulation-limit")
397    }
398
399    /// How many additional levels of encapsulation are permitted to be prepended
400    /// to packets. This property applies only to IPv6 tunnels. To disable this option,
401    /// add [`IPTunnelFlags::IP6_IGN_ENCAP_LIMIT`][crate::IPTunnelFlags::IP6_IGN_ENCAP_LIMIT] to ip-tunnel flags.
402    #[cfg(feature = "v1_2")]
403    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
404    #[doc(alias = "encapsulation-limit")]
405    pub fn set_encapsulation_limit(&self, encapsulation_limit: u32) {
406        ObjectExt::set_property(self,"encapsulation-limit", encapsulation_limit)
407    }
408
409    /// Tunnel flags. Currently, the following values are supported:
410    /// [`IPTunnelFlags::IP6_IGN_ENCAP_LIMIT`][crate::IPTunnelFlags::IP6_IGN_ENCAP_LIMIT], [`IPTunnelFlags::IP6_USE_ORIG_TCLASS`][crate::IPTunnelFlags::IP6_USE_ORIG_TCLASS],
411    /// [`IPTunnelFlags::IP6_USE_ORIG_FLOWLABEL`][crate::IPTunnelFlags::IP6_USE_ORIG_FLOWLABEL], [`IPTunnelFlags::IP6_MIP6_DEV`][crate::IPTunnelFlags::IP6_MIP6_DEV],
412    /// [`IPTunnelFlags::IP6_RCV_DSCP_COPY`][crate::IPTunnelFlags::IP6_RCV_DSCP_COPY], [`IPTunnelFlags::IP6_USE_ORIG_FWMARK`][crate::IPTunnelFlags::IP6_USE_ORIG_FWMARK].
413    /// They are valid only for IPv6 tunnels.
414    #[cfg(feature = "v1_12")]
415    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
416    pub fn set_flags(&self, flags: u32) {
417        ObjectExt::set_property(self,"flags", flags)
418    }
419
420    #[cfg(not(feature = "v1_42"))]
421    #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_42"))))]
422    #[doc(alias = "flow-label")]
423    pub fn flow_label(&self) -> u32 {
424        ObjectExt::property(self, "flow-label")
425    }
426
427    /// The flow label to assign to tunnel packets. This property applies only to
428    /// IPv6 tunnels.
429    #[cfg(feature = "v1_2")]
430    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
431    #[doc(alias = "flow-label")]
432    pub fn set_flow_label(&self, flow_label: u32) {
433        ObjectExt::set_property(self,"flow-label", flow_label)
434    }
435
436    /// The fwmark value to assign to tunnel packets. This property can be set
437    /// to a non zero value only on VTI and VTI6 tunnels.
438    #[cfg(feature = "v1_42")]
439    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
440    pub fn set_fwmark(&self, fwmark: u32) {
441        ObjectExt::set_property(self,"fwmark", fwmark)
442    }
443
444    /// The key used for tunnel input packets; the property is valid only for
445    /// certain tunnel modes (GRE, IP6GRE). If empty, no key is used.
446    #[cfg(feature = "v1_2")]
447    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
448    #[doc(alias = "input-key")]
449    pub fn set_input_key(&self, input_key: Option<&str>) {
450        ObjectExt::set_property(self,"input-key", input_key)
451    }
452
453    /// The local endpoint of the tunnel; the value can be empty, otherwise it
454    /// must contain an IPv4 or IPv6 address.
455    #[cfg(feature = "v1_2")]
456    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
457    pub fn set_local(&self, local: Option<&str>) {
458        ObjectExt::set_property(self,"local", local)
459    }
460
461    /// The tunneling mode. Valid values: [`IPTunnelMode::Ipip`][crate::IPTunnelMode::Ipip],
462    /// [`IPTunnelMode::Gre`][crate::IPTunnelMode::Gre], [`IPTunnelMode::Sit`][crate::IPTunnelMode::Sit], [`IPTunnelMode::Isatap`][crate::IPTunnelMode::Isatap],
463    /// [`IPTunnelMode::Vti`][crate::IPTunnelMode::Vti], [`IPTunnelMode::Ip6ip6`][crate::IPTunnelMode::Ip6ip6], [`IPTunnelMode::Ipip6`][crate::IPTunnelMode::Ipip6],
464    /// [`IPTunnelMode::Ip6gre`][crate::IPTunnelMode::Ip6gre], [`IPTunnelMode::Vti6`][crate::IPTunnelMode::Vti6], [`IPTunnelMode::Gretap`][crate::IPTunnelMode::Gretap]
465    /// and [`IPTunnelMode::Ip6gretap`][crate::IPTunnelMode::Ip6gretap]
466    #[cfg(feature = "v1_2")]
467    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
468    pub fn set_mode(&self, mode: u32) {
469        ObjectExt::set_property(self,"mode", mode)
470    }
471
472    /// If non-zero, only transmit packets of the specified size or smaller,
473    /// breaking larger packets up into multiple fragments.
474    #[cfg(feature = "v1_2")]
475    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
476    pub fn set_mtu(&self, mtu: u32) {
477        ObjectExt::set_property(self,"mtu", mtu)
478    }
479
480    /// The key used for tunnel output packets; the property is valid only for
481    /// certain tunnel modes (GRE, IP6GRE). If empty, no key is used.
482    #[cfg(feature = "v1_2")]
483    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
484    #[doc(alias = "output-key")]
485    pub fn set_output_key(&self, output_key: Option<&str>) {
486        ObjectExt::set_property(self,"output-key", output_key)
487    }
488
489    /// If given, specifies the parent interface name or parent connection UUID
490    /// the new device will be bound to so that tunneled packets will only be
491    /// routed via that interface.
492    #[cfg(feature = "v1_2")]
493    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
494    pub fn set_parent(&self, parent: Option<&str>) {
495        ObjectExt::set_property(self,"parent", parent)
496    }
497
498    /// Whether to enable Path MTU Discovery on this tunnel.
499    #[cfg(feature = "v1_2")]
500    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
501    #[doc(alias = "path-mtu-discovery")]
502    pub fn set_path_mtu_discovery(&self, path_mtu_discovery: bool) {
503        ObjectExt::set_property(self,"path-mtu-discovery", path_mtu_discovery)
504    }
505
506    /// The remote endpoint of the tunnel; the value must contain an IPv4 or IPv6
507    /// address.
508    #[cfg(feature = "v1_2")]
509    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
510    pub fn set_remote(&self, remote: Option<&str>) {
511        ObjectExt::set_property(self,"remote", remote)
512    }
513
514    /// The type of service (IPv4) or traffic class (IPv6) field to be set on
515    /// tunneled packets.
516    #[cfg(feature = "v1_2")]
517    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
518    pub fn set_tos(&self, tos: u32) {
519        ObjectExt::set_property(self,"tos", tos)
520    }
521
522    /// The TTL to assign to tunneled packets. 0 is a special value meaning that
523    /// packets inherit the TTL value.
524    #[cfg(feature = "v1_2")]
525    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
526    pub fn set_ttl(&self, ttl: u32) {
527        ObjectExt::set_property(self,"ttl", ttl)
528    }
529
530    #[cfg(feature = "v1_2")]
531    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
532    #[doc(alias = "encapsulation-limit")]
533    pub fn connect_encapsulation_limit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
534        unsafe extern "C" fn notify_encapsulation_limit_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
535            let f: &F = &*(f as *const F);
536            f(&from_glib_borrow(this))
537        }
538        unsafe {
539            let f: Box_<F> = Box_::new(f);
540            connect_raw(self.as_ptr() as *mut _, c"notify::encapsulation-limit".as_ptr() as *const _,
541                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_encapsulation_limit_trampoline::<F> as *const ())), Box_::into_raw(f))
542        }
543    }
544
545    #[cfg(feature = "v1_12")]
546    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
547    #[doc(alias = "flags")]
548    pub fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
549        unsafe extern "C" fn notify_flags_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
550            let f: &F = &*(f as *const F);
551            f(&from_glib_borrow(this))
552        }
553        unsafe {
554            let f: Box_<F> = Box_::new(f);
555            connect_raw(self.as_ptr() as *mut _, c"notify::flags".as_ptr() as *const _,
556                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
557        }
558    }
559
560    #[cfg(feature = "v1_2")]
561    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
562    #[doc(alias = "flow-label")]
563    pub fn connect_flow_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
564        unsafe extern "C" fn notify_flow_label_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
565            let f: &F = &*(f as *const F);
566            f(&from_glib_borrow(this))
567        }
568        unsafe {
569            let f: Box_<F> = Box_::new(f);
570            connect_raw(self.as_ptr() as *mut _, c"notify::flow-label".as_ptr() as *const _,
571                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_flow_label_trampoline::<F> as *const ())), Box_::into_raw(f))
572        }
573    }
574
575    #[cfg(feature = "v1_42")]
576    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
577    #[doc(alias = "fwmark")]
578    pub fn connect_fwmark_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
579        unsafe extern "C" fn notify_fwmark_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
580            let f: &F = &*(f as *const F);
581            f(&from_glib_borrow(this))
582        }
583        unsafe {
584            let f: Box_<F> = Box_::new(f);
585            connect_raw(self.as_ptr() as *mut _, c"notify::fwmark".as_ptr() as *const _,
586                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_fwmark_trampoline::<F> as *const ())), Box_::into_raw(f))
587        }
588    }
589
590    #[cfg(feature = "v1_2")]
591    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
592    #[doc(alias = "input-key")]
593    pub fn connect_input_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
594        unsafe extern "C" fn notify_input_key_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
595            let f: &F = &*(f as *const F);
596            f(&from_glib_borrow(this))
597        }
598        unsafe {
599            let f: Box_<F> = Box_::new(f);
600            connect_raw(self.as_ptr() as *mut _, c"notify::input-key".as_ptr() as *const _,
601                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_input_key_trampoline::<F> as *const ())), Box_::into_raw(f))
602        }
603    }
604
605    #[cfg(feature = "v1_2")]
606    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
607    #[doc(alias = "local")]
608    pub fn connect_local_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
609        unsafe extern "C" fn notify_local_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
610            let f: &F = &*(f as *const F);
611            f(&from_glib_borrow(this))
612        }
613        unsafe {
614            let f: Box_<F> = Box_::new(f);
615            connect_raw(self.as_ptr() as *mut _, c"notify::local".as_ptr() as *const _,
616                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_local_trampoline::<F> as *const ())), Box_::into_raw(f))
617        }
618    }
619
620    #[cfg(feature = "v1_2")]
621    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
622    #[doc(alias = "mode")]
623    pub fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
624        unsafe extern "C" fn notify_mode_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
625            let f: &F = &*(f as *const F);
626            f(&from_glib_borrow(this))
627        }
628        unsafe {
629            let f: Box_<F> = Box_::new(f);
630            connect_raw(self.as_ptr() as *mut _, c"notify::mode".as_ptr() as *const _,
631                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mode_trampoline::<F> as *const ())), Box_::into_raw(f))
632        }
633    }
634
635    #[cfg(feature = "v1_2")]
636    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
637    #[doc(alias = "mtu")]
638    pub fn connect_mtu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
639        unsafe extern "C" fn notify_mtu_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
640            let f: &F = &*(f as *const F);
641            f(&from_glib_borrow(this))
642        }
643        unsafe {
644            let f: Box_<F> = Box_::new(f);
645            connect_raw(self.as_ptr() as *mut _, c"notify::mtu".as_ptr() as *const _,
646                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mtu_trampoline::<F> as *const ())), Box_::into_raw(f))
647        }
648    }
649
650    #[cfg(feature = "v1_2")]
651    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
652    #[doc(alias = "output-key")]
653    pub fn connect_output_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
654        unsafe extern "C" fn notify_output_key_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
655            let f: &F = &*(f as *const F);
656            f(&from_glib_borrow(this))
657        }
658        unsafe {
659            let f: Box_<F> = Box_::new(f);
660            connect_raw(self.as_ptr() as *mut _, c"notify::output-key".as_ptr() as *const _,
661                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_output_key_trampoline::<F> as *const ())), Box_::into_raw(f))
662        }
663    }
664
665    #[cfg(feature = "v1_2")]
666    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
667    #[doc(alias = "parent")]
668    pub fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
669        unsafe extern "C" fn notify_parent_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
670            let f: &F = &*(f as *const F);
671            f(&from_glib_borrow(this))
672        }
673        unsafe {
674            let f: Box_<F> = Box_::new(f);
675            connect_raw(self.as_ptr() as *mut _, c"notify::parent".as_ptr() as *const _,
676                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_parent_trampoline::<F> as *const ())), Box_::into_raw(f))
677        }
678    }
679
680    #[cfg(feature = "v1_2")]
681    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
682    #[doc(alias = "path-mtu-discovery")]
683    pub fn connect_path_mtu_discovery_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
684        unsafe extern "C" fn notify_path_mtu_discovery_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
685            let f: &F = &*(f as *const F);
686            f(&from_glib_borrow(this))
687        }
688        unsafe {
689            let f: Box_<F> = Box_::new(f);
690            connect_raw(self.as_ptr() as *mut _, c"notify::path-mtu-discovery".as_ptr() as *const _,
691                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_path_mtu_discovery_trampoline::<F> as *const ())), Box_::into_raw(f))
692        }
693    }
694
695    #[cfg(feature = "v1_2")]
696    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
697    #[doc(alias = "remote")]
698    pub fn connect_remote_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
699        unsafe extern "C" fn notify_remote_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
700            let f: &F = &*(f as *const F);
701            f(&from_glib_borrow(this))
702        }
703        unsafe {
704            let f: Box_<F> = Box_::new(f);
705            connect_raw(self.as_ptr() as *mut _, c"notify::remote".as_ptr() as *const _,
706                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_remote_trampoline::<F> as *const ())), Box_::into_raw(f))
707        }
708    }
709
710    #[cfg(feature = "v1_2")]
711    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
712    #[doc(alias = "tos")]
713    pub fn connect_tos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
714        unsafe extern "C" fn notify_tos_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
715            let f: &F = &*(f as *const F);
716            f(&from_glib_borrow(this))
717        }
718        unsafe {
719            let f: Box_<F> = Box_::new(f);
720            connect_raw(self.as_ptr() as *mut _, c"notify::tos".as_ptr() as *const _,
721                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_tos_trampoline::<F> as *const ())), Box_::into_raw(f))
722        }
723    }
724
725    #[cfg(feature = "v1_2")]
726    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
727    #[doc(alias = "ttl")]
728    pub fn connect_ttl_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
729        unsafe extern "C" fn notify_ttl_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
730            let f: &F = &*(f as *const F);
731            f(&from_glib_borrow(this))
732        }
733        unsafe {
734            let f: Box_<F> = Box_::new(f);
735            connect_raw(self.as_ptr() as *mut _, c"notify::ttl".as_ptr() as *const _,
736                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ttl_trampoline::<F> as *const ())), Box_::into_raw(f))
737        }
738    }
739}
740
741#[cfg(feature = "v1_2")]
742#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
743impl Default for SettingIPTunnel {
744                     fn default() -> Self {
745                         Self::new()
746                     }
747                 }
748
749// rustdoc-stripper-ignore-next
750        /// A [builder-pattern] type to construct [`SettingIPTunnel`] objects.
751        ///
752        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
753#[must_use = "The builder must be built to be used"]
754pub struct SettingIPTunnelBuilder {
755            builder: glib::object::ObjectBuilder<'static, SettingIPTunnel>,
756        }
757
758        impl SettingIPTunnelBuilder {
759        fn new() -> Self {
760            Self { builder: glib::object::Object::builder() }
761        }
762
763                            /// How many additional levels of encapsulation are permitted to be prepended
764                            /// to packets. This property applies only to IPv6 tunnels. To disable this option,
765                            /// add [`IPTunnelFlags::IP6_IGN_ENCAP_LIMIT`][crate::IPTunnelFlags::IP6_IGN_ENCAP_LIMIT] to ip-tunnel flags.
766                            #[cfg(feature = "v1_2")]
767    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
768    pub fn encapsulation_limit(self, encapsulation_limit: u32) -> Self {
769                            Self { builder: self.builder.property("encapsulation-limit", encapsulation_limit), }
770                        }
771
772                            /// Tunnel flags. Currently, the following values are supported:
773                            /// [`IPTunnelFlags::IP6_IGN_ENCAP_LIMIT`][crate::IPTunnelFlags::IP6_IGN_ENCAP_LIMIT], [`IPTunnelFlags::IP6_USE_ORIG_TCLASS`][crate::IPTunnelFlags::IP6_USE_ORIG_TCLASS],
774                            /// [`IPTunnelFlags::IP6_USE_ORIG_FLOWLABEL`][crate::IPTunnelFlags::IP6_USE_ORIG_FLOWLABEL], [`IPTunnelFlags::IP6_MIP6_DEV`][crate::IPTunnelFlags::IP6_MIP6_DEV],
775                            /// [`IPTunnelFlags::IP6_RCV_DSCP_COPY`][crate::IPTunnelFlags::IP6_RCV_DSCP_COPY], [`IPTunnelFlags::IP6_USE_ORIG_FWMARK`][crate::IPTunnelFlags::IP6_USE_ORIG_FWMARK].
776                            /// They are valid only for IPv6 tunnels.
777                            #[cfg(feature = "v1_12")]
778    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
779    pub fn flags(self, flags: u32) -> Self {
780                            Self { builder: self.builder.property("flags", flags), }
781                        }
782
783                            /// The flow label to assign to tunnel packets. This property applies only to
784                            /// IPv6 tunnels.
785                            #[cfg(feature = "v1_2")]
786    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
787    pub fn flow_label(self, flow_label: u32) -> Self {
788                            Self { builder: self.builder.property("flow-label", flow_label), }
789                        }
790
791                            /// The fwmark value to assign to tunnel packets. This property can be set
792                            /// to a non zero value only on VTI and VTI6 tunnels.
793                            #[cfg(feature = "v1_42")]
794    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
795    pub fn fwmark(self, fwmark: u32) -> Self {
796                            Self { builder: self.builder.property("fwmark", fwmark), }
797                        }
798
799                            /// The key used for tunnel input packets; the property is valid only for
800                            /// certain tunnel modes (GRE, IP6GRE). If empty, no key is used.
801                            #[cfg(feature = "v1_2")]
802    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
803    pub fn input_key(self, input_key: impl Into<glib::GString>) -> Self {
804                            Self { builder: self.builder.property("input-key", input_key.into()), }
805                        }
806
807                            /// The local endpoint of the tunnel; the value can be empty, otherwise it
808                            /// must contain an IPv4 or IPv6 address.
809                            #[cfg(feature = "v1_2")]
810    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
811    pub fn local(self, local: impl Into<glib::GString>) -> Self {
812                            Self { builder: self.builder.property("local", local.into()), }
813                        }
814
815                            /// The tunneling mode. Valid values: [`IPTunnelMode::Ipip`][crate::IPTunnelMode::Ipip],
816                            /// [`IPTunnelMode::Gre`][crate::IPTunnelMode::Gre], [`IPTunnelMode::Sit`][crate::IPTunnelMode::Sit], [`IPTunnelMode::Isatap`][crate::IPTunnelMode::Isatap],
817                            /// [`IPTunnelMode::Vti`][crate::IPTunnelMode::Vti], [`IPTunnelMode::Ip6ip6`][crate::IPTunnelMode::Ip6ip6], [`IPTunnelMode::Ipip6`][crate::IPTunnelMode::Ipip6],
818                            /// [`IPTunnelMode::Ip6gre`][crate::IPTunnelMode::Ip6gre], [`IPTunnelMode::Vti6`][crate::IPTunnelMode::Vti6], [`IPTunnelMode::Gretap`][crate::IPTunnelMode::Gretap]
819                            /// and [`IPTunnelMode::Ip6gretap`][crate::IPTunnelMode::Ip6gretap]
820                            #[cfg(feature = "v1_2")]
821    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
822    pub fn mode(self, mode: u32) -> Self {
823                            Self { builder: self.builder.property("mode", mode), }
824                        }
825
826                            /// If non-zero, only transmit packets of the specified size or smaller,
827                            /// breaking larger packets up into multiple fragments.
828                            #[cfg(feature = "v1_2")]
829    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
830    pub fn mtu(self, mtu: u32) -> Self {
831                            Self { builder: self.builder.property("mtu", mtu), }
832                        }
833
834                            /// The key used for tunnel output packets; the property is valid only for
835                            /// certain tunnel modes (GRE, IP6GRE). If empty, no key is used.
836                            #[cfg(feature = "v1_2")]
837    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
838    pub fn output_key(self, output_key: impl Into<glib::GString>) -> Self {
839                            Self { builder: self.builder.property("output-key", output_key.into()), }
840                        }
841
842                            /// If given, specifies the parent interface name or parent connection UUID
843                            /// the new device will be bound to so that tunneled packets will only be
844                            /// routed via that interface.
845                            #[cfg(feature = "v1_2")]
846    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
847    pub fn parent(self, parent: impl Into<glib::GString>) -> Self {
848                            Self { builder: self.builder.property("parent", parent.into()), }
849                        }
850
851                            /// Whether to enable Path MTU Discovery on this tunnel.
852                            #[cfg(feature = "v1_2")]
853    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
854    pub fn path_mtu_discovery(self, path_mtu_discovery: bool) -> Self {
855                            Self { builder: self.builder.property("path-mtu-discovery", path_mtu_discovery), }
856                        }
857
858                            /// The remote endpoint of the tunnel; the value must contain an IPv4 or IPv6
859                            /// address.
860                            #[cfg(feature = "v1_2")]
861    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
862    pub fn remote(self, remote: impl Into<glib::GString>) -> Self {
863                            Self { builder: self.builder.property("remote", remote.into()), }
864                        }
865
866                            /// The type of service (IPv4) or traffic class (IPv6) field to be set on
867                            /// tunneled packets.
868                            #[cfg(feature = "v1_2")]
869    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
870    pub fn tos(self, tos: u32) -> Self {
871                            Self { builder: self.builder.property("tos", tos), }
872                        }
873
874                            /// The TTL to assign to tunneled packets. 0 is a special value meaning that
875                            /// packets inherit the TTL value.
876                            #[cfg(feature = "v1_2")]
877    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
878    pub fn ttl(self, ttl: u32) -> Self {
879                            Self { builder: self.builder.property("ttl", ttl), }
880                        }
881
882    // rustdoc-stripper-ignore-next
883    /// Build the [`SettingIPTunnel`].
884    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
885    pub fn build(self) -> SettingIPTunnel {
886assert_initialized_main_thread!();
887    self.builder.build() }
888}