1#![allow(deprecated)]
6
7use crate::{ffi,Device,Object};
8use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
9use std::{boxed::Box as Box_};
10
11glib::wrapper! {
12 #[doc(alias = "NMDeviceMacsec")]
344 pub struct DeviceMacsec(Object<ffi::NMDeviceMacsec, ffi::NMDeviceMacsecClass>) @extends Device, Object;
345
346 match fn {
347 type_ => || ffi::nm_device_macsec_get_type(),
348 }
349}
350
351impl DeviceMacsec {
352 pub fn builder() -> DeviceMacsecBuilder {
357 DeviceMacsecBuilder::new()
358 }
359
360
361 #[doc(alias = "nm_device_macsec_get_cipher_suite")]
367 #[doc(alias = "get_cipher_suite")]
368 #[doc(alias = "cipher-suite")]
369 pub fn cipher_suite(&self) -> u64 {
370 unsafe {
371 ffi::nm_device_macsec_get_cipher_suite(self.to_glib_none().0)
372 }
373 }
374
375 #[doc(alias = "nm_device_macsec_get_encoding_sa")]
382 #[doc(alias = "get_encoding_sa")]
383 #[doc(alias = "encoding-sa")]
384 pub fn encoding_sa(&self) -> u8 {
385 unsafe {
386 ffi::nm_device_macsec_get_encoding_sa(self.to_glib_none().0)
387 }
388 }
389
390 #[doc(alias = "nm_device_macsec_get_encrypt")]
396 #[doc(alias = "get_encrypt")]
397 #[doc(alias = "encrypt")]
398 pub fn is_encrypt(&self) -> bool {
399 unsafe {
400 from_glib(ffi::nm_device_macsec_get_encrypt(self.to_glib_none().0))
401 }
402 }
403
404 #[doc(alias = "nm_device_macsec_get_es")]
411 #[doc(alias = "get_es")]
412 #[doc(alias = "es")]
413 pub fn is_es(&self) -> bool {
414 unsafe {
415 from_glib(ffi::nm_device_macsec_get_es(self.to_glib_none().0))
416 }
417 }
418
419 #[cfg_attr(feature = "v1_24", deprecated = "Since 1.24")]
430 #[allow(deprecated)]
431 #[doc(alias = "nm_device_macsec_get_hw_address")]
432 #[doc(alias = "get_hw_address")]
433 pub fn hw_address(&self) -> glib::GString {
434 unsafe {
435 from_glib_none(ffi::nm_device_macsec_get_hw_address(self.to_glib_none().0))
436 }
437 }
438
439 #[doc(alias = "nm_device_macsec_get_icv_length")]
445 #[doc(alias = "get_icv_length")]
446 #[doc(alias = "icv-length")]
447 pub fn icv_length(&self) -> u8 {
448 unsafe {
449 ffi::nm_device_macsec_get_icv_length(self.to_glib_none().0)
450 }
451 }
452
453 #[doc(alias = "nm_device_macsec_get_include_sci")]
460 #[doc(alias = "get_include_sci")]
461 #[doc(alias = "include-sci")]
462 pub fn is_include_sci(&self) -> bool {
463 unsafe {
464 from_glib(ffi::nm_device_macsec_get_include_sci(self.to_glib_none().0))
465 }
466 }
467
468 #[cfg(feature = "v1_42")]
473 #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
474 #[doc(alias = "nm_device_macsec_get_parent")]
475 #[doc(alias = "get_parent")]
476 pub fn parent(&self) -> Device {
477 unsafe {
478 from_glib_none(ffi::nm_device_macsec_get_parent(self.to_glib_none().0))
479 }
480 }
481
482 #[doc(alias = "nm_device_macsec_get_protect")]
488 #[doc(alias = "get_protect")]
489 #[doc(alias = "protect")]
490 pub fn is_protect(&self) -> bool {
491 unsafe {
492 from_glib(ffi::nm_device_macsec_get_protect(self.to_glib_none().0))
493 }
494 }
495
496 #[doc(alias = "nm_device_macsec_get_replay_protect")]
502 #[doc(alias = "get_replay_protect")]
503 #[doc(alias = "replay-protect")]
504 pub fn is_replay_protect(&self) -> bool {
505 unsafe {
506 from_glib(ffi::nm_device_macsec_get_replay_protect(self.to_glib_none().0))
507 }
508 }
509
510 #[doc(alias = "nm_device_macsec_get_scb")]
517 #[doc(alias = "get_scb")]
518 #[doc(alias = "scb")]
519 pub fn is_scb(&self) -> bool {
520 unsafe {
521 from_glib(ffi::nm_device_macsec_get_scb(self.to_glib_none().0))
522 }
523 }
524
525 #[doc(alias = "nm_device_macsec_get_sci")]
531 #[doc(alias = "get_sci")]
532 pub fn sci(&self) -> u64 {
533 unsafe {
534 ffi::nm_device_macsec_get_sci(self.to_glib_none().0)
535 }
536 }
537
538 #[doc(alias = "nm_device_macsec_get_validation")]
545 #[doc(alias = "get_validation")]
546 pub fn validation(&self) -> glib::GString {
547 unsafe {
548 from_glib_none(ffi::nm_device_macsec_get_validation(self.to_glib_none().0))
549 }
550 }
551
552 #[doc(alias = "nm_device_macsec_get_window")]
558 #[doc(alias = "get_window")]
559 pub fn window(&self) -> u32 {
560 unsafe {
561 ffi::nm_device_macsec_get_window(self.to_glib_none().0)
562 }
563 }
564
565 #[cfg(not(feature = "v1_42"))]
566 #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_42"))))]
567 pub fn parent(&self) -> Option<Device> {
568 ObjectExt::property(self, "parent")
569 }
570
571 #[cfg(feature = "v1_6")]
572 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
573 #[doc(alias = "cipher-suite")]
574 pub fn connect_cipher_suite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
575 unsafe extern "C" fn notify_cipher_suite_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
576 let f: &F = &*(f as *const F);
577 f(&from_glib_borrow(this))
578 }
579 unsafe {
580 let f: Box_<F> = Box_::new(f);
581 connect_raw(self.as_ptr() as *mut _, c"notify::cipher-suite".as_ptr() as *const _,
582 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_cipher_suite_trampoline::<F> as *const ())), Box_::into_raw(f))
583 }
584 }
585
586 #[cfg(feature = "v1_6")]
587 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
588 #[doc(alias = "encoding-sa")]
589 pub fn connect_encoding_sa_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
590 unsafe extern "C" fn notify_encoding_sa_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
591 let f: &F = &*(f as *const F);
592 f(&from_glib_borrow(this))
593 }
594 unsafe {
595 let f: Box_<F> = Box_::new(f);
596 connect_raw(self.as_ptr() as *mut _, c"notify::encoding-sa".as_ptr() as *const _,
597 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_encoding_sa_trampoline::<F> as *const ())), Box_::into_raw(f))
598 }
599 }
600
601 #[cfg(feature = "v1_6")]
602 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
603 #[doc(alias = "encrypt")]
604 pub fn connect_encrypt_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
605 unsafe extern "C" fn notify_encrypt_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
606 let f: &F = &*(f as *const F);
607 f(&from_glib_borrow(this))
608 }
609 unsafe {
610 let f: Box_<F> = Box_::new(f);
611 connect_raw(self.as_ptr() as *mut _, c"notify::encrypt".as_ptr() as *const _,
612 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_encrypt_trampoline::<F> as *const ())), Box_::into_raw(f))
613 }
614 }
615
616 #[cfg(feature = "v1_6")]
617 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
618 #[doc(alias = "es")]
619 pub fn connect_es_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
620 unsafe extern "C" fn notify_es_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
621 let f: &F = &*(f as *const F);
622 f(&from_glib_borrow(this))
623 }
624 unsafe {
625 let f: Box_<F> = Box_::new(f);
626 connect_raw(self.as_ptr() as *mut _, c"notify::es".as_ptr() as *const _,
627 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_es_trampoline::<F> as *const ())), Box_::into_raw(f))
628 }
629 }
630
631 #[cfg(feature = "v1_6")]
632 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
633 #[doc(alias = "icv-length")]
634 pub fn connect_icv_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
635 unsafe extern "C" fn notify_icv_length_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
636 let f: &F = &*(f as *const F);
637 f(&from_glib_borrow(this))
638 }
639 unsafe {
640 let f: Box_<F> = Box_::new(f);
641 connect_raw(self.as_ptr() as *mut _, c"notify::icv-length".as_ptr() as *const _,
642 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_icv_length_trampoline::<F> as *const ())), Box_::into_raw(f))
643 }
644 }
645
646 #[cfg(feature = "v1_6")]
647 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
648 #[doc(alias = "include-sci")]
649 pub fn connect_include_sci_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
650 unsafe extern "C" fn notify_include_sci_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
651 let f: &F = &*(f as *const F);
652 f(&from_glib_borrow(this))
653 }
654 unsafe {
655 let f: Box_<F> = Box_::new(f);
656 connect_raw(self.as_ptr() as *mut _, c"notify::include-sci".as_ptr() as *const _,
657 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_include_sci_trampoline::<F> as *const ())), Box_::into_raw(f))
658 }
659 }
660
661 #[cfg(feature = "v1_6")]
662 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
663 #[doc(alias = "parent")]
664 pub fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
665 unsafe extern "C" fn notify_parent_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
666 let f: &F = &*(f as *const F);
667 f(&from_glib_borrow(this))
668 }
669 unsafe {
670 let f: Box_<F> = Box_::new(f);
671 connect_raw(self.as_ptr() as *mut _, c"notify::parent".as_ptr() as *const _,
672 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_parent_trampoline::<F> as *const ())), Box_::into_raw(f))
673 }
674 }
675
676 #[cfg(feature = "v1_6")]
677 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
678 #[doc(alias = "protect")]
679 pub fn connect_protect_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
680 unsafe extern "C" fn notify_protect_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
681 let f: &F = &*(f as *const F);
682 f(&from_glib_borrow(this))
683 }
684 unsafe {
685 let f: Box_<F> = Box_::new(f);
686 connect_raw(self.as_ptr() as *mut _, c"notify::protect".as_ptr() as *const _,
687 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_protect_trampoline::<F> as *const ())), Box_::into_raw(f))
688 }
689 }
690
691 #[cfg(feature = "v1_6")]
692 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
693 #[doc(alias = "replay-protect")]
694 pub fn connect_replay_protect_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
695 unsafe extern "C" fn notify_replay_protect_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
696 let f: &F = &*(f as *const F);
697 f(&from_glib_borrow(this))
698 }
699 unsafe {
700 let f: Box_<F> = Box_::new(f);
701 connect_raw(self.as_ptr() as *mut _, c"notify::replay-protect".as_ptr() as *const _,
702 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_replay_protect_trampoline::<F> as *const ())), Box_::into_raw(f))
703 }
704 }
705
706 #[cfg(feature = "v1_6")]
707 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
708 #[doc(alias = "scb")]
709 pub fn connect_scb_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
710 unsafe extern "C" fn notify_scb_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
711 let f: &F = &*(f as *const F);
712 f(&from_glib_borrow(this))
713 }
714 unsafe {
715 let f: Box_<F> = Box_::new(f);
716 connect_raw(self.as_ptr() as *mut _, c"notify::scb".as_ptr() as *const _,
717 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_scb_trampoline::<F> as *const ())), Box_::into_raw(f))
718 }
719 }
720
721 #[cfg(feature = "v1_6")]
722 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
723 #[doc(alias = "sci")]
724 pub fn connect_sci_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
725 unsafe extern "C" fn notify_sci_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
726 let f: &F = &*(f as *const F);
727 f(&from_glib_borrow(this))
728 }
729 unsafe {
730 let f: Box_<F> = Box_::new(f);
731 connect_raw(self.as_ptr() as *mut _, c"notify::sci".as_ptr() as *const _,
732 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_sci_trampoline::<F> as *const ())), Box_::into_raw(f))
733 }
734 }
735
736 #[cfg(feature = "v1_6")]
737 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
738 #[doc(alias = "validation")]
739 pub fn connect_validation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
740 unsafe extern "C" fn notify_validation_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
741 let f: &F = &*(f as *const F);
742 f(&from_glib_borrow(this))
743 }
744 unsafe {
745 let f: Box_<F> = Box_::new(f);
746 connect_raw(self.as_ptr() as *mut _, c"notify::validation".as_ptr() as *const _,
747 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_validation_trampoline::<F> as *const ())), Box_::into_raw(f))
748 }
749 }
750
751 #[cfg(feature = "v1_6")]
752 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
753 #[doc(alias = "window")]
754 pub fn connect_window_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
755 unsafe extern "C" fn notify_window_trampoline<F: Fn(&DeviceMacsec) + 'static>(this: *mut ffi::NMDeviceMacsec, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
756 let f: &F = &*(f as *const F);
757 f(&from_glib_borrow(this))
758 }
759 unsafe {
760 let f: Box_<F> = Box_::new(f);
761 connect_raw(self.as_ptr() as *mut _, c"notify::window".as_ptr() as *const _,
762 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_window_trampoline::<F> as *const ())), Box_::into_raw(f))
763 }
764 }
765}
766
767#[must_use = "The builder must be built to be used"]
772pub struct DeviceMacsecBuilder {
773 builder: glib::object::ObjectBuilder<'static, DeviceMacsec>,
774 }
775
776 impl DeviceMacsecBuilder {
777 fn new() -> Self {
778 Self { builder: glib::object::Object::builder() }
779 }
780
781 pub fn autoconnect(self, autoconnect: bool) -> Self {
785 Self { builder: self.builder.property("autoconnect", autoconnect), }
786 }
787
788 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
791 pub fn build(self) -> DeviceMacsec {
792assert_initialized_main_thread!();
793 self.builder.build() }
794}