nm-rs 0.1.3

Rust bindings for the libnm library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir
// from gtk-girs (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{ffi,Setting};
#[cfg(feature = "v1_6")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
use crate::{SettingMacsecMode,SettingMacsecValidation,SettingSecretFlags};
#[cfg(feature = "v1_46")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
use crate::{SettingMacsecOffload};
use glib::{prelude::*};
#[cfg(feature = "v1_6")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
use glib::{signal::{connect_raw, SignalHandlerId},translate::*};
#[cfg(feature = "v1_6")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
use std::{boxed::Box as Box_};

glib::wrapper! {
    /// MACSec Settings
    ///
    /// ## Properties
    ///
    ///
    /// #### `encrypt`
    ///  Whether the transmitted traffic must be encrypted.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `mka-cak`
    ///  The pre-shared CAK (Connectivity Association Key) for MACsec
    /// Key Agreement. Must be a string of 32 hexadecimal characters.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `mka-cak-flags`
    ///  Flags indicating how to handle the #NMSettingMacsec:mka-cak
    /// property.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `mka-ckn`
    ///  The pre-shared CKN (Connectivity-association Key Name) for
    /// MACsec Key Agreement. Must be a string of hexadecimal characters
    /// with a even length between 2 and 64.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `mode`
    ///  Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key
    /// Agreement) is obtained.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `offload`
    ///  Specifies the MACsec offload mode.
    ///
    /// [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off] disables MACsec offload.
    ///
    /// [`SettingMacsecOffload::Phy`][crate::SettingMacsecOffload::Phy] and [`SettingMacsecOffload::Mac`][crate::SettingMacsecOffload::Mac] request offload
    /// respectively to the PHY or to the MAC; if the selected mode is not available, the
    /// connection will fail.
    ///
    /// [`SettingMacsecOffload::Default`][crate::SettingMacsecOffload::Default] uses the global default value specified in
    /// NetworkManager configuration; if no global default is defined, the built-in
    /// default is [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off].
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `parent`
    ///  If given, specifies the parent interface name or parent connection UUID
    /// from which this MACSEC interface should be created.  If this property is
    /// not specified, the connection must contain an #NMSettingWired setting
    /// with a #NMSettingWired:mac-address property.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `port`
    ///  The port component of the SCI (Secure Channel Identifier), between 1 and 65534.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `send-sci`
    ///  Specifies whether the SCI (Secure Channel Identifier) is included
    /// in every packet.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `validation`
    ///  Specifies the validation mode for incoming frames.
    ///
    /// Readable | Writeable
    /// <details><summary><h4>Setting</h4></summary>
    ///
    ///
    /// #### `name`
    ///  The setting's name, which uniquely identifies the setting within the
    /// connection.  Each setting type has a name unique to that type, for
    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
    ///
    /// Readable
    /// </details>
    ///
    /// # Implements
    ///
    /// [`SettingExt`][trait@crate::prelude::SettingExt]
    #[doc(alias = "NMSettingMacsec")]
    pub struct SettingMacsec(Object<ffi::NMSettingMacsec, ffi::NMSettingMacsecClass>) @extends Setting;

    match fn {
        type_ => || ffi::nm_setting_macsec_get_type(),
    }
}

impl SettingMacsec {
    /// Creates a new #NMSettingMacsec object with default values.
    ///
    /// # Returns
    ///
    /// the new empty #NMSettingMacsec object
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "nm_setting_macsec_new")]
    pub fn new() -> SettingMacsec {
        assert_initialized_main_thread!();
        unsafe {
            Setting::from_glib_full(ffi::nm_setting_macsec_new()).unsafe_cast()
        }
    }

            // rustdoc-stripper-ignore-next
            /// Creates a new builder-pattern struct instance to construct [`SettingMacsec`] objects.
            ///
            /// This method returns an instance of [`SettingMacsecBuilder`](crate::builders::SettingMacsecBuilder) which can be used to create [`SettingMacsec`] objects.
            pub fn builder() -> SettingMacsecBuilder {
                SettingMacsecBuilder::new()
            }
        

    ///
    /// # Returns
    ///
    /// the #NMSettingMacsec:encrypt property of the setting
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "nm_setting_macsec_get_encrypt")]
    #[doc(alias = "get_encrypt")]
    #[doc(alias = "encrypt")]
    pub fn is_encrypt(&self) -> bool {
        unsafe {
            from_glib(ffi::nm_setting_macsec_get_encrypt(self.to_glib_none().0))
        }
    }

    ///
    /// # Returns
    ///
    /// the #NMSettingMacsec:mka-cak property of the setting
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "nm_setting_macsec_get_mka_cak")]
    #[doc(alias = "get_mka_cak")]
    #[doc(alias = "mka-cak")]
    pub fn mka_cak(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nm_setting_macsec_get_mka_cak(self.to_glib_none().0))
        }
    }

    ///
    /// # Returns
    ///
    /// the #NMSettingSecretFlags pertaining to the #NMSettingMacsec:mka-cak
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "nm_setting_macsec_get_mka_cak_flags")]
    #[doc(alias = "get_mka_cak_flags")]
    #[doc(alias = "mka-cak-flags")]
    pub fn mka_cak_flags(&self) -> SettingSecretFlags {
        unsafe {
            from_glib(ffi::nm_setting_macsec_get_mka_cak_flags(self.to_glib_none().0))
        }
    }

    ///
    /// # Returns
    ///
    /// the #NMSettingMacsec:mka-ckn property of the setting
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "nm_setting_macsec_get_mka_ckn")]
    #[doc(alias = "get_mka_ckn")]
    #[doc(alias = "mka-ckn")]
    pub fn mka_ckn(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nm_setting_macsec_get_mka_ckn(self.to_glib_none().0))
        }
    }

    ///
    /// # Returns
    ///
    /// the #NMSettingMacsec:mode property of the setting
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "nm_setting_macsec_get_mode")]
    #[doc(alias = "get_mode")]
    pub fn mode(&self) -> SettingMacsecMode {
        unsafe {
            from_glib(ffi::nm_setting_macsec_get_mode(self.to_glib_none().0))
        }
    }

    ///
    /// # Returns
    ///
    /// the #NMSettingMacsec:offload property of the setting
    #[cfg(feature = "v1_46")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
    #[doc(alias = "nm_setting_macsec_get_offload")]
    #[doc(alias = "get_offload")]
    pub fn offload(&self) -> SettingMacsecOffload {
        unsafe {
            from_glib(ffi::nm_setting_macsec_get_offload(self.to_glib_none().0))
        }
    }

    ///
    /// # Returns
    ///
    /// the #NMSettingMacsec:parent property of the setting
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "nm_setting_macsec_get_parent")]
    #[doc(alias = "get_parent")]
    pub fn parent(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nm_setting_macsec_get_parent(self.to_glib_none().0))
        }
    }

    ///
    /// # Returns
    ///
    /// the #NMSettingMacsec:port property of the setting
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "nm_setting_macsec_get_port")]
    #[doc(alias = "get_port")]
    pub fn port(&self) -> i32 {
        unsafe {
            ffi::nm_setting_macsec_get_port(self.to_glib_none().0)
        }
    }

    ///
    /// # Returns
    ///
    /// the #NMSettingMacsec:send-sci property of the setting
    #[cfg(feature = "v1_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
    #[doc(alias = "nm_setting_macsec_get_send_sci")]
    #[doc(alias = "get_send_sci")]
    #[doc(alias = "send-sci")]
    pub fn is_send_sci(&self) -> bool {
        unsafe {
            from_glib(ffi::nm_setting_macsec_get_send_sci(self.to_glib_none().0))
        }
    }

    ///
    /// # Returns
    ///
    /// the #NMSettingMacsec:validation property of the setting
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "nm_setting_macsec_get_validation")]
    #[doc(alias = "get_validation")]
    pub fn validation(&self) -> SettingMacsecValidation {
        unsafe {
            from_glib(ffi::nm_setting_macsec_get_validation(self.to_glib_none().0))
        }
    }

    /// Whether the transmitted traffic must be encrypted.
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn set_encrypt(&self, encrypt: bool) {
        ObjectExt::set_property(self,"encrypt", encrypt)
    }

    /// The pre-shared CAK (Connectivity Association Key) for MACsec
    /// Key Agreement. Must be a string of 32 hexadecimal characters.
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "mka-cak")]
    pub fn set_mka_cak(&self, mka_cak: Option<&str>) {
        ObjectExt::set_property(self,"mka-cak", mka_cak)
    }

    /// Flags indicating how to handle the #NMSettingMacsec:mka-cak
    /// property.
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "mka-cak-flags")]
    pub fn set_mka_cak_flags(&self, mka_cak_flags: SettingSecretFlags) {
        ObjectExt::set_property(self,"mka-cak-flags", mka_cak_flags)
    }

    /// The pre-shared CKN (Connectivity-association Key Name) for
    /// MACsec Key Agreement. Must be a string of hexadecimal characters
    /// with a even length between 2 and 64.
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "mka-ckn")]
    pub fn set_mka_ckn(&self, mka_ckn: Option<&str>) {
        ObjectExt::set_property(self,"mka-ckn", mka_ckn)
    }

    /// Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key
    /// Agreement) is obtained.
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn set_mode(&self, mode: i32) {
        ObjectExt::set_property(self,"mode", mode)
    }

    /// Specifies the MACsec offload mode.
    ///
    /// [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off] disables MACsec offload.
    ///
    /// [`SettingMacsecOffload::Phy`][crate::SettingMacsecOffload::Phy] and [`SettingMacsecOffload::Mac`][crate::SettingMacsecOffload::Mac] request offload
    /// respectively to the PHY or to the MAC; if the selected mode is not available, the
    /// connection will fail.
    ///
    /// [`SettingMacsecOffload::Default`][crate::SettingMacsecOffload::Default] uses the global default value specified in
    /// NetworkManager configuration; if no global default is defined, the built-in
    /// default is [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off].
    #[cfg(feature = "v1_46")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
    pub fn set_offload(&self, offload: i32) {
        ObjectExt::set_property(self,"offload", offload)
    }

    /// If given, specifies the parent interface name or parent connection UUID
    /// from which this MACSEC interface should be created.  If this property is
    /// not specified, the connection must contain an #NMSettingWired setting
    /// with a #NMSettingWired:mac-address property.
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn set_parent(&self, parent: Option<&str>) {
        ObjectExt::set_property(self,"parent", parent)
    }

    /// The port component of the SCI (Secure Channel Identifier), between 1 and 65534.
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn set_port(&self, port: i32) {
        ObjectExt::set_property(self,"port", port)
    }

    /// Specifies whether the SCI (Secure Channel Identifier) is included
    /// in every packet.
    #[cfg(feature = "v1_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
    #[doc(alias = "send-sci")]
    pub fn set_send_sci(&self, send_sci: bool) {
        ObjectExt::set_property(self,"send-sci", send_sci)
    }

    /// Specifies the validation mode for incoming frames.
    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn set_validation(&self, validation: i32) {
        ObjectExt::set_property(self,"validation", validation)
    }

    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "encrypt")]
    pub fn connect_encrypt_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_encrypt_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::encrypt".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_encrypt_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "mka-cak")]
    pub fn connect_mka_cak_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        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) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::mka-cak".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mka_cak_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "mka-cak-flags")]
    pub fn connect_mka_cak_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        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) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::mka-cak-flags".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mka_cak_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "mka-ckn")]
    pub fn connect_mka_ckn_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        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) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::mka-ckn".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mka_ckn_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "mode")]
    pub fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_mode_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::mode".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mode_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[cfg(feature = "v1_46")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
    #[doc(alias = "offload")]
    pub fn connect_offload_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_offload_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::offload".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_offload_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "parent")]
    pub fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_parent_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::parent".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_parent_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "port")]
    pub fn connect_port_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_port_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::port".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_port_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[cfg(feature = "v1_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
    #[doc(alias = "send-sci")]
    pub fn connect_send_sci_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        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) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::send-sci".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_send_sci_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    #[doc(alias = "validation")]
    pub fn connect_validation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_validation_trampoline<F: Fn(&SettingMacsec) + 'static>(this: *mut ffi::NMSettingMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::validation".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_validation_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }
}

#[cfg(feature = "v1_6")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
impl Default for SettingMacsec {
                     fn default() -> Self {
                         Self::new()
                     }
                 }

// rustdoc-stripper-ignore-next
        /// A [builder-pattern] type to construct [`SettingMacsec`] objects.
        ///
        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct SettingMacsecBuilder {
            builder: glib::object::ObjectBuilder<'static, SettingMacsec>,
        }

        impl SettingMacsecBuilder {
        fn new() -> Self {
            Self { builder: glib::object::Object::builder() }
        }

                            /// Whether the transmitted traffic must be encrypted.
                            #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn encrypt(self, encrypt: bool) -> Self {
                            Self { builder: self.builder.property("encrypt", encrypt), }
                        }

                            /// The pre-shared CAK (Connectivity Association Key) for MACsec
                            /// Key Agreement. Must be a string of 32 hexadecimal characters.
                            #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn mka_cak(self, mka_cak: impl Into<glib::GString>) -> Self {
                            Self { builder: self.builder.property("mka-cak", mka_cak.into()), }
                        }

                            /// Flags indicating how to handle the #NMSettingMacsec:mka-cak
                            /// property.
                            #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn mka_cak_flags(self, mka_cak_flags: SettingSecretFlags) -> Self {
                            Self { builder: self.builder.property("mka-cak-flags", mka_cak_flags), }
                        }

                            /// The pre-shared CKN (Connectivity-association Key Name) for
                            /// MACsec Key Agreement. Must be a string of hexadecimal characters
                            /// with a even length between 2 and 64.
                            #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn mka_ckn(self, mka_ckn: impl Into<glib::GString>) -> Self {
                            Self { builder: self.builder.property("mka-ckn", mka_ckn.into()), }
                        }

                            /// Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key
                            /// Agreement) is obtained.
                            #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn mode(self, mode: i32) -> Self {
                            Self { builder: self.builder.property("mode", mode), }
                        }

                            /// Specifies the MACsec offload mode.
                            ///
                            /// [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off] disables MACsec offload.
                            ///
                            /// [`SettingMacsecOffload::Phy`][crate::SettingMacsecOffload::Phy] and [`SettingMacsecOffload::Mac`][crate::SettingMacsecOffload::Mac] request offload
                            /// respectively to the PHY or to the MAC; if the selected mode is not available, the
                            /// connection will fail.
                            ///
                            /// [`SettingMacsecOffload::Default`][crate::SettingMacsecOffload::Default] uses the global default value specified in
                            /// NetworkManager configuration; if no global default is defined, the built-in
                            /// default is [`SettingMacsecOffload::Off`][crate::SettingMacsecOffload::Off].
                            #[cfg(feature = "v1_46")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
    pub fn offload(self, offload: i32) -> Self {
                            Self { builder: self.builder.property("offload", offload), }
                        }

                            /// If given, specifies the parent interface name or parent connection UUID
                            /// from which this MACSEC interface should be created.  If this property is
                            /// not specified, the connection must contain an #NMSettingWired setting
                            /// with a #NMSettingWired:mac-address property.
                            #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn parent(self, parent: impl Into<glib::GString>) -> Self {
                            Self { builder: self.builder.property("parent", parent.into()), }
                        }

                            /// The port component of the SCI (Secure Channel Identifier), between 1 and 65534.
                            #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn port(self, port: i32) -> Self {
                            Self { builder: self.builder.property("port", port), }
                        }

                            /// Specifies whether the SCI (Secure Channel Identifier) is included
                            /// in every packet.
                            #[cfg(feature = "v1_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
    pub fn send_sci(self, send_sci: bool) -> Self {
                            Self { builder: self.builder.property("send-sci", send_sci), }
                        }

                            /// Specifies the validation mode for incoming frames.
                            #[cfg(feature = "v1_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
    pub fn validation(self, validation: i32) -> Self {
                            Self { builder: self.builder.property("validation", validation), }
                        }

    // rustdoc-stripper-ignore-next
    /// Build the [`SettingMacsec`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> SettingMacsec {
assert_initialized_main_thread!();
    self.builder.build() }
}