nm_rs/auto/
setting_macsec.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_6")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
9use crate::{SettingMacsecMode,SettingMacsecValidation,SettingSecretFlags};
10#[cfg(feature = "v1_46")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
12use crate::{SettingMacsecOffload};
13use glib::{prelude::*};
14#[cfg(feature = "v1_6")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
16use glib::{signal::{connect_raw, SignalHandlerId},translate::*};
17#[cfg(feature = "v1_6")]
18#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
19use std::{boxed::Box as Box_};
20
21glib::wrapper! {
22    /// MACSec Settings
23    ///
24    /// ## Properties
25    ///
26    ///
27    /// #### `encrypt`
28    ///  Whether the transmitted traffic must be encrypted.
29    ///
30    /// Readable | Writeable
31    ///
32    ///
33    /// #### `mka-cak`
34    ///  The pre-shared CAK (Connectivity Association Key) for MACsec
35    /// Key Agreement. Must be a string of 32 hexadecimal characters.
36    ///
37    /// Readable | Writeable
38    ///
39    ///
40    /// #### `mka-cak-flags`
41    ///  Flags indicating how to handle the #NMSettingMacsec:mka-cak
42    /// property.
43    ///
44    /// Readable | Writeable
45    ///
46    ///
47    /// #### `mka-ckn`
48    ///  The pre-shared CKN (Connectivity-association Key Name) for
49    /// MACsec Key Agreement. Must be a string of hexadecimal characters
50    /// with a even length between 2 and 64.
51    ///
52    /// Readable | Writeable
53    ///
54    ///
55    /// #### `mode`
56    ///  Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key
57    /// Agreement) is obtained.
58    ///
59    /// Readable | Writeable
60    ///
61    ///
62    /// #### `offload`
63    ///  Specifies the MACsec offload mode.
64    ///
65    /// [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off] disables MACsec offload.
66    ///
67    /// [`SettingMacsecOffload::Phy`][crate::SettingMacsecOffload::Phy] and [`SettingMacsecOffload::Mac`][crate::SettingMacsecOffload::Mac] request offload
68    /// respectively to the PHY or to the MAC; if the selected mode is not available, the
69    /// connection will fail.
70    ///
71    /// [`SettingMacsecOffload::Default`][crate::SettingMacsecOffload::Default] uses the global default value specified in
72    /// NetworkManager configuration; if no global default is defined, the built-in
73    /// default is [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off].
74    ///
75    /// Readable | Writeable
76    ///
77    ///
78    /// #### `parent`
79    ///  If given, specifies the parent interface name or parent connection UUID
80    /// from which this MACSEC interface should be created.  If this property is
81    /// not specified, the connection must contain an #NMSettingWired setting
82    /// with a #NMSettingWired:mac-address property.
83    ///
84    /// Readable | Writeable
85    ///
86    ///
87    /// #### `port`
88    ///  The port component of the SCI (Secure Channel Identifier), between 1 and 65534.
89    ///
90    /// Readable | Writeable
91    ///
92    ///
93    /// #### `send-sci`
94    ///  Specifies whether the SCI (Secure Channel Identifier) is included
95    /// in every packet.
96    ///
97    /// Readable | Writeable
98    ///
99    ///
100    /// #### `validation`
101    ///  Specifies the validation mode for incoming frames.
102    ///
103    /// Readable | Writeable
104    /// <details><summary><h4>Setting</h4></summary>
105    ///
106    ///
107    /// #### `name`
108    ///  The setting's name, which uniquely identifies the setting within the
109    /// connection.  Each setting type has a name unique to that type, for
110    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
111    ///
112    /// Readable
113    /// </details>
114    ///
115    /// # Implements
116    ///
117    /// [`SettingExt`][trait@crate::prelude::SettingExt]
118    #[doc(alias = "NMSettingMacsec")]
119    pub struct SettingMacsec(Object<ffi::NMSettingMacsec, ffi::NMSettingMacsecClass>) @extends Setting;
120
121    match fn {
122        type_ => || ffi::nm_setting_macsec_get_type(),
123    }
124}
125
126impl SettingMacsec {
127    /// Creates a new #NMSettingMacsec object with default values.
128    ///
129    /// # Returns
130    ///
131    /// the new empty #NMSettingMacsec object
132    #[cfg(feature = "v1_6")]
133    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
134    #[doc(alias = "nm_setting_macsec_new")]
135    pub fn new() -> SettingMacsec {
136        assert_initialized_main_thread!();
137        unsafe {
138            Setting::from_glib_full(ffi::nm_setting_macsec_new()).unsafe_cast()
139        }
140    }
141
142            // rustdoc-stripper-ignore-next
143            /// Creates a new builder-pattern struct instance to construct [`SettingMacsec`] objects.
144            ///
145            /// This method returns an instance of [`SettingMacsecBuilder`](crate::builders::SettingMacsecBuilder) which can be used to create [`SettingMacsec`] objects.
146            pub fn builder() -> SettingMacsecBuilder {
147                SettingMacsecBuilder::new()
148            }
149        
150
151    ///
152    /// # Returns
153    ///
154    /// the #NMSettingMacsec:encrypt property of the setting
155    #[cfg(feature = "v1_6")]
156    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
157    #[doc(alias = "nm_setting_macsec_get_encrypt")]
158    #[doc(alias = "get_encrypt")]
159    #[doc(alias = "encrypt")]
160    pub fn is_encrypt(&self) -> bool {
161        unsafe {
162            from_glib(ffi::nm_setting_macsec_get_encrypt(self.to_glib_none().0))
163        }
164    }
165
166    ///
167    /// # Returns
168    ///
169    /// the #NMSettingMacsec:mka-cak property of the setting
170    #[cfg(feature = "v1_6")]
171    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
172    #[doc(alias = "nm_setting_macsec_get_mka_cak")]
173    #[doc(alias = "get_mka_cak")]
174    #[doc(alias = "mka-cak")]
175    pub fn mka_cak(&self) -> glib::GString {
176        unsafe {
177            from_glib_none(ffi::nm_setting_macsec_get_mka_cak(self.to_glib_none().0))
178        }
179    }
180
181    ///
182    /// # Returns
183    ///
184    /// the #NMSettingSecretFlags pertaining to the #NMSettingMacsec:mka-cak
185    #[cfg(feature = "v1_6")]
186    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
187    #[doc(alias = "nm_setting_macsec_get_mka_cak_flags")]
188    #[doc(alias = "get_mka_cak_flags")]
189    #[doc(alias = "mka-cak-flags")]
190    pub fn mka_cak_flags(&self) -> SettingSecretFlags {
191        unsafe {
192            from_glib(ffi::nm_setting_macsec_get_mka_cak_flags(self.to_glib_none().0))
193        }
194    }
195
196    ///
197    /// # Returns
198    ///
199    /// the #NMSettingMacsec:mka-ckn property of the setting
200    #[cfg(feature = "v1_6")]
201    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
202    #[doc(alias = "nm_setting_macsec_get_mka_ckn")]
203    #[doc(alias = "get_mka_ckn")]
204    #[doc(alias = "mka-ckn")]
205    pub fn mka_ckn(&self) -> glib::GString {
206        unsafe {
207            from_glib_none(ffi::nm_setting_macsec_get_mka_ckn(self.to_glib_none().0))
208        }
209    }
210
211    ///
212    /// # Returns
213    ///
214    /// the #NMSettingMacsec:mode property of the setting
215    #[cfg(feature = "v1_6")]
216    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
217    #[doc(alias = "nm_setting_macsec_get_mode")]
218    #[doc(alias = "get_mode")]
219    pub fn mode(&self) -> SettingMacsecMode {
220        unsafe {
221            from_glib(ffi::nm_setting_macsec_get_mode(self.to_glib_none().0))
222        }
223    }
224
225    ///
226    /// # Returns
227    ///
228    /// the #NMSettingMacsec:offload property of the setting
229    #[cfg(feature = "v1_46")]
230    #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
231    #[doc(alias = "nm_setting_macsec_get_offload")]
232    #[doc(alias = "get_offload")]
233    pub fn offload(&self) -> SettingMacsecOffload {
234        unsafe {
235            from_glib(ffi::nm_setting_macsec_get_offload(self.to_glib_none().0))
236        }
237    }
238
239    ///
240    /// # Returns
241    ///
242    /// the #NMSettingMacsec:parent property of the setting
243    #[cfg(feature = "v1_6")]
244    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
245    #[doc(alias = "nm_setting_macsec_get_parent")]
246    #[doc(alias = "get_parent")]
247    pub fn parent(&self) -> glib::GString {
248        unsafe {
249            from_glib_none(ffi::nm_setting_macsec_get_parent(self.to_glib_none().0))
250        }
251    }
252
253    ///
254    /// # Returns
255    ///
256    /// the #NMSettingMacsec:port property of the setting
257    #[cfg(feature = "v1_6")]
258    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
259    #[doc(alias = "nm_setting_macsec_get_port")]
260    #[doc(alias = "get_port")]
261    pub fn port(&self) -> i32 {
262        unsafe {
263            ffi::nm_setting_macsec_get_port(self.to_glib_none().0)
264        }
265    }
266
267    ///
268    /// # Returns
269    ///
270    /// the #NMSettingMacsec:send-sci property of the setting
271    #[cfg(feature = "v1_12")]
272    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
273    #[doc(alias = "nm_setting_macsec_get_send_sci")]
274    #[doc(alias = "get_send_sci")]
275    #[doc(alias = "send-sci")]
276    pub fn is_send_sci(&self) -> bool {
277        unsafe {
278            from_glib(ffi::nm_setting_macsec_get_send_sci(self.to_glib_none().0))
279        }
280    }
281
282    ///
283    /// # Returns
284    ///
285    /// the #NMSettingMacsec:validation property of the setting
286    #[cfg(feature = "v1_6")]
287    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
288    #[doc(alias = "nm_setting_macsec_get_validation")]
289    #[doc(alias = "get_validation")]
290    pub fn validation(&self) -> SettingMacsecValidation {
291        unsafe {
292            from_glib(ffi::nm_setting_macsec_get_validation(self.to_glib_none().0))
293        }
294    }
295
296    /// Whether the transmitted traffic must be encrypted.
297    #[cfg(feature = "v1_6")]
298    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
299    pub fn set_encrypt(&self, encrypt: bool) {
300        ObjectExt::set_property(self,"encrypt", encrypt)
301    }
302
303    /// The pre-shared CAK (Connectivity Association Key) for MACsec
304    /// Key Agreement. Must be a string of 32 hexadecimal characters.
305    #[cfg(feature = "v1_6")]
306    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
307    #[doc(alias = "mka-cak")]
308    pub fn set_mka_cak(&self, mka_cak: Option<&str>) {
309        ObjectExt::set_property(self,"mka-cak", mka_cak)
310    }
311
312    /// Flags indicating how to handle the #NMSettingMacsec:mka-cak
313    /// property.
314    #[cfg(feature = "v1_6")]
315    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
316    #[doc(alias = "mka-cak-flags")]
317    pub fn set_mka_cak_flags(&self, mka_cak_flags: SettingSecretFlags) {
318        ObjectExt::set_property(self,"mka-cak-flags", mka_cak_flags)
319    }
320
321    /// The pre-shared CKN (Connectivity-association Key Name) for
322    /// MACsec Key Agreement. Must be a string of hexadecimal characters
323    /// with a even length between 2 and 64.
324    #[cfg(feature = "v1_6")]
325    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
326    #[doc(alias = "mka-ckn")]
327    pub fn set_mka_ckn(&self, mka_ckn: Option<&str>) {
328        ObjectExt::set_property(self,"mka-ckn", mka_ckn)
329    }
330
331    /// Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key
332    /// Agreement) is obtained.
333    #[cfg(feature = "v1_6")]
334    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
335    pub fn set_mode(&self, mode: i32) {
336        ObjectExt::set_property(self,"mode", mode)
337    }
338
339    /// Specifies the MACsec offload mode.
340    ///
341    /// [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off] disables MACsec offload.
342    ///
343    /// [`SettingMacsecOffload::Phy`][crate::SettingMacsecOffload::Phy] and [`SettingMacsecOffload::Mac`][crate::SettingMacsecOffload::Mac] request offload
344    /// respectively to the PHY or to the MAC; if the selected mode is not available, the
345    /// connection will fail.
346    ///
347    /// [`SettingMacsecOffload::Default`][crate::SettingMacsecOffload::Default] uses the global default value specified in
348    /// NetworkManager configuration; if no global default is defined, the built-in
349    /// default is [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off].
350    #[cfg(feature = "v1_46")]
351    #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
352    pub fn set_offload(&self, offload: i32) {
353        ObjectExt::set_property(self,"offload", offload)
354    }
355
356    /// If given, specifies the parent interface name or parent connection UUID
357    /// from which this MACSEC interface should be created.  If this property is
358    /// not specified, the connection must contain an #NMSettingWired setting
359    /// with a #NMSettingWired:mac-address property.
360    #[cfg(feature = "v1_6")]
361    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
362    pub fn set_parent(&self, parent: Option<&str>) {
363        ObjectExt::set_property(self,"parent", parent)
364    }
365
366    /// The port component of the SCI (Secure Channel Identifier), between 1 and 65534.
367    #[cfg(feature = "v1_6")]
368    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
369    pub fn set_port(&self, port: i32) {
370        ObjectExt::set_property(self,"port", port)
371    }
372
373    /// Specifies whether the SCI (Secure Channel Identifier) is included
374    /// in every packet.
375    #[cfg(feature = "v1_12")]
376    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
377    #[doc(alias = "send-sci")]
378    pub fn set_send_sci(&self, send_sci: bool) {
379        ObjectExt::set_property(self,"send-sci", send_sci)
380    }
381
382    /// Specifies the validation mode for incoming frames.
383    #[cfg(feature = "v1_6")]
384    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
385    pub fn set_validation(&self, validation: i32) {
386        ObjectExt::set_property(self,"validation", validation)
387    }
388
389    #[cfg(feature = "v1_6")]
390    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
391    #[doc(alias = "encrypt")]
392    pub fn connect_encrypt_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
393        unsafe extern "C" fn notify_encrypt_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
394            let f: &F = &*(f as *const F);
395            f(&from_glib_borrow(this))
396        }
397        unsafe {
398            let f: Box_<F> = Box_::new(f);
399            connect_raw(self.as_ptr() as *mut _, c"notify::encrypt".as_ptr() as *const _,
400                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_encrypt_trampoline::<F> as *const ())), Box_::into_raw(f))
401        }
402    }
403
404    #[cfg(feature = "v1_6")]
405    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
406    #[doc(alias = "mka-cak")]
407    pub fn connect_mka_cak_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
408        unsafe extern "C" fn notify_mka_cak_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
409            let f: &F = &*(f as *const F);
410            f(&from_glib_borrow(this))
411        }
412        unsafe {
413            let f: Box_<F> = Box_::new(f);
414            connect_raw(self.as_ptr() as *mut _, c"notify::mka-cak".as_ptr() as *const _,
415                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mka_cak_trampoline::<F> as *const ())), Box_::into_raw(f))
416        }
417    }
418
419    #[cfg(feature = "v1_6")]
420    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
421    #[doc(alias = "mka-cak-flags")]
422    pub fn connect_mka_cak_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
423        unsafe extern "C" fn notify_mka_cak_flags_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
424            let f: &F = &*(f as *const F);
425            f(&from_glib_borrow(this))
426        }
427        unsafe {
428            let f: Box_<F> = Box_::new(f);
429            connect_raw(self.as_ptr() as *mut _, c"notify::mka-cak-flags".as_ptr() as *const _,
430                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mka_cak_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
431        }
432    }
433
434    #[cfg(feature = "v1_6")]
435    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
436    #[doc(alias = "mka-ckn")]
437    pub fn connect_mka_ckn_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
438        unsafe extern "C" fn notify_mka_ckn_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
439            let f: &F = &*(f as *const F);
440            f(&from_glib_borrow(this))
441        }
442        unsafe {
443            let f: Box_<F> = Box_::new(f);
444            connect_raw(self.as_ptr() as *mut _, c"notify::mka-ckn".as_ptr() as *const _,
445                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mka_ckn_trampoline::<F> as *const ())), Box_::into_raw(f))
446        }
447    }
448
449    #[cfg(feature = "v1_6")]
450    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
451    #[doc(alias = "mode")]
452    pub fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
453        unsafe extern "C" fn notify_mode_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
454            let f: &F = &*(f as *const F);
455            f(&from_glib_borrow(this))
456        }
457        unsafe {
458            let f: Box_<F> = Box_::new(f);
459            connect_raw(self.as_ptr() as *mut _, c"notify::mode".as_ptr() as *const _,
460                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mode_trampoline::<F> as *const ())), Box_::into_raw(f))
461        }
462    }
463
464    #[cfg(feature = "v1_46")]
465    #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
466    #[doc(alias = "offload")]
467    pub fn connect_offload_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
468        unsafe extern "C" fn notify_offload_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
469            let f: &F = &*(f as *const F);
470            f(&from_glib_borrow(this))
471        }
472        unsafe {
473            let f: Box_<F> = Box_::new(f);
474            connect_raw(self.as_ptr() as *mut _, c"notify::offload".as_ptr() as *const _,
475                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_offload_trampoline::<F> as *const ())), Box_::into_raw(f))
476        }
477    }
478
479    #[cfg(feature = "v1_6")]
480    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
481    #[doc(alias = "parent")]
482    pub fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
483        unsafe extern "C" fn notify_parent_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
484            let f: &F = &*(f as *const F);
485            f(&from_glib_borrow(this))
486        }
487        unsafe {
488            let f: Box_<F> = Box_::new(f);
489            connect_raw(self.as_ptr() as *mut _, c"notify::parent".as_ptr() as *const _,
490                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_parent_trampoline::<F> as *const ())), Box_::into_raw(f))
491        }
492    }
493
494    #[cfg(feature = "v1_6")]
495    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
496    #[doc(alias = "port")]
497    pub fn connect_port_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
498        unsafe extern "C" fn notify_port_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
499            let f: &F = &*(f as *const F);
500            f(&from_glib_borrow(this))
501        }
502        unsafe {
503            let f: Box_<F> = Box_::new(f);
504            connect_raw(self.as_ptr() as *mut _, c"notify::port".as_ptr() as *const _,
505                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_port_trampoline::<F> as *const ())), Box_::into_raw(f))
506        }
507    }
508
509    #[cfg(feature = "v1_12")]
510    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
511    #[doc(alias = "send-sci")]
512    pub fn connect_send_sci_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
513        unsafe extern "C" fn notify_send_sci_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
514            let f: &F = &*(f as *const F);
515            f(&from_glib_borrow(this))
516        }
517        unsafe {
518            let f: Box_<F> = Box_::new(f);
519            connect_raw(self.as_ptr() as *mut _, c"notify::send-sci".as_ptr() as *const _,
520                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_send_sci_trampoline::<F> as *const ())), Box_::into_raw(f))
521        }
522    }
523
524    #[cfg(feature = "v1_6")]
525    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
526    #[doc(alias = "validation")]
527    pub fn connect_validation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
528        unsafe extern "C" fn notify_validation_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
529            let f: &F = &*(f as *const F);
530            f(&from_glib_borrow(this))
531        }
532        unsafe {
533            let f: Box_<F> = Box_::new(f);
534            connect_raw(self.as_ptr() as *mut _, c"notify::validation".as_ptr() as *const _,
535                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_validation_trampoline::<F> as *const ())), Box_::into_raw(f))
536        }
537    }
538}
539
540#[cfg(feature = "v1_6")]
541#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
542impl Default for SettingMacsec {
543                     fn default() -> Self {
544                         Self::new()
545                     }
546                 }
547
548// rustdoc-stripper-ignore-next
549        /// A [builder-pattern] type to construct [`SettingMacsec`] objects.
550        ///
551        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
552#[must_use = "The builder must be built to be used"]
553pub struct SettingMacsecBuilder {
554            builder: glib::object::ObjectBuilder<'static, SettingMacsec>,
555        }
556
557        impl SettingMacsecBuilder {
558        fn new() -> Self {
559            Self { builder: glib::object::Object::builder() }
560        }
561
562                            /// Whether the transmitted traffic must be encrypted.
563                            #[cfg(feature = "v1_6")]
564    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
565    pub fn encrypt(self, encrypt: bool) -> Self {
566                            Self { builder: self.builder.property("encrypt", encrypt), }
567                        }
568
569                            /// The pre-shared CAK (Connectivity Association Key) for MACsec
570                            /// Key Agreement. Must be a string of 32 hexadecimal characters.
571                            #[cfg(feature = "v1_6")]
572    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
573    pub fn mka_cak(self, mka_cak: impl Into<glib::GString>) -> Self {
574                            Self { builder: self.builder.property("mka-cak", mka_cak.into()), }
575                        }
576
577                            /// Flags indicating how to handle the #NMSettingMacsec:mka-cak
578                            /// property.
579                            #[cfg(feature = "v1_6")]
580    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
581    pub fn mka_cak_flags(self, mka_cak_flags: SettingSecretFlags) -> Self {
582                            Self { builder: self.builder.property("mka-cak-flags", mka_cak_flags), }
583                        }
584
585                            /// The pre-shared CKN (Connectivity-association Key Name) for
586                            /// MACsec Key Agreement. Must be a string of hexadecimal characters
587                            /// with a even length between 2 and 64.
588                            #[cfg(feature = "v1_6")]
589    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
590    pub fn mka_ckn(self, mka_ckn: impl Into<glib::GString>) -> Self {
591                            Self { builder: self.builder.property("mka-ckn", mka_ckn.into()), }
592                        }
593
594                            /// Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key
595                            /// Agreement) is obtained.
596                            #[cfg(feature = "v1_6")]
597    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
598    pub fn mode(self, mode: i32) -> Self {
599                            Self { builder: self.builder.property("mode", mode), }
600                        }
601
602                            /// Specifies the MACsec offload mode.
603                            ///
604                            /// [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off] disables MACsec offload.
605                            ///
606                            /// [`SettingMacsecOffload::Phy`][crate::SettingMacsecOffload::Phy] and [`SettingMacsecOffload::Mac`][crate::SettingMacsecOffload::Mac] request offload
607                            /// respectively to the PHY or to the MAC; if the selected mode is not available, the
608                            /// connection will fail.
609                            ///
610                            /// [`SettingMacsecOffload::Default`][crate::SettingMacsecOffload::Default] uses the global default value specified in
611                            /// NetworkManager configuration; if no global default is defined, the built-in
612                            /// default is [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off].
613                            #[cfg(feature = "v1_46")]
614    #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
615    pub fn offload(self, offload: i32) -> Self {
616                            Self { builder: self.builder.property("offload", offload), }
617                        }
618
619                            /// If given, specifies the parent interface name or parent connection UUID
620                            /// from which this MACSEC interface should be created.  If this property is
621                            /// not specified, the connection must contain an #NMSettingWired setting
622                            /// with a #NMSettingWired:mac-address property.
623                            #[cfg(feature = "v1_6")]
624    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
625    pub fn parent(self, parent: impl Into<glib::GString>) -> Self {
626                            Self { builder: self.builder.property("parent", parent.into()), }
627                        }
628
629                            /// The port component of the SCI (Secure Channel Identifier), between 1 and 65534.
630                            #[cfg(feature = "v1_6")]
631    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
632    pub fn port(self, port: i32) -> Self {
633                            Self { builder: self.builder.property("port", port), }
634                        }
635
636                            /// Specifies whether the SCI (Secure Channel Identifier) is included
637                            /// in every packet.
638                            #[cfg(feature = "v1_12")]
639    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
640    pub fn send_sci(self, send_sci: bool) -> Self {
641                            Self { builder: self.builder.property("send-sci", send_sci), }
642                        }
643
644                            /// Specifies the validation mode for incoming frames.
645                            #[cfg(feature = "v1_6")]
646    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
647    pub fn validation(self, validation: i32) -> Self {
648                            Self { builder: self.builder.property("validation", validation), }
649                        }
650
651    // rustdoc-stripper-ignore-next
652    /// Build the [`SettingMacsec`].
653    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
654    pub fn build(self) -> SettingMacsec {
655assert_initialized_main_thread!();
656    self.builder.build() }
657}