nm_rs/auto/
lldp_neighbor.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};
7#[cfg(feature = "v1_2")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
9use glib::{translate::*};
10
11glib::wrapper! {
12    /// Supported attributes are:
13    ///
14    /// - #NM_LLDP_ATTR_CHASSIS_ID_TYPE (type: 'u')
15    /// - #NM_LLDP_ATTR_CHASSIS_ID (type: 's')
16    /// - #NM_LLDP_ATTR_DESTINATION (type: 's')
17    /// - #NM_LLDP_ATTR_IEEE_802_1_PPVID (type: 'u'). This attribute only reports the first PPVID
18    ///   and therefore it is deprecated in favor of NM_LLDP_ATTR_IEEE_802_1_PPVIDS which reports
19    ///   all the PPVID.
20    /// - #NM_LLDP_ATTR_IEEE_802_1_PPVID_FLAGS (type: 'u'). This attribute only reports the first PPVID
21    ///   and therefore it is deprecated in favor of NM_LLDP_ATTR_IEEE_802_1_PPVIDS which reports
22    ///   all the PPVID.
23    /// - #NM_LLDP_ATTR_IEEE_802_1_PPVIDS (type: 'aa{sv}')
24    ///
25    ///   An array of dictionaries where each element has keys:
26    ///   - flags (type: 'u')
27    ///   - ppvid (type: 'u')
28    /// - #NM_LLDP_ATTR_IEEE_802_1_PVID (type: 'u')
29    /// - #NM_LLDP_ATTR_IEEE_802_1_VID (type: 'u'). This attribute only reports the first VLAN
30    ///   and therefore it is deprecated in favor of NM_LLDP_ATTR_IEEE_802_1_VLANS which reports
31    ///   all the VLANs.
32    /// - #NM_LLDP_ATTR_IEEE_802_1_VLAN_NAME (type: 's'). This attribute only reports the first VLAN
33    ///   and therefore it is deprecated in favor of NM_LLDP_ATTR_IEEE_802_1_VLANS which reports
34    ///   all the VLANs.
35    /// - #NM_LLDP_ATTR_IEEE_802_1_VLANS (type: 'aa{sv}')
36    ///
37    ///   An array of dictionaries where each element has keys:
38    ///   - name (type: 's')
39    ///   - vid (type: 'u')
40    /// - #NM_LLDP_ATTR_IEEE_802_3_MAC_PHY_CONF (type: 'a{sv}')
41    ///
42    ///   Dictionary where each element has keys:
43    ///   - autoneg (type: 'u')
44    ///   - operational-mau-type (type: 'u')
45    ///   - pmd-autoneg-cap (type: 'u')
46    /// - #NM_LLDP_ATTR_IEEE_802_3_MAX_FRAME_SIZE (type: 'u')
47    /// - #NM_LLDP_ATTR_IEEE_802_3_POWER_VIA_MDI (type: 'a{sv}')
48    ///
49    ///   Dictionary where each element has keys:
50    ///   - mdi-power-support (type: 'u')
51    ///   - power-class (type: 'u')
52    ///   - pse-power-pair (type: 'u')
53    /// - #NM_LLDP_ATTR_MANAGEMENT_ADDRESSES (type: 'aa{sv}')
54    ///
55    ///   An array of dictionaries where each element has keys:
56    ///   - address (type: 'ay')
57    ///   - address-subtype (type: 'u')
58    ///   - interface-number (type: 'u')
59    ///   - interface-number-subtype (type: 'u')
60    ///   - object-id (type: 'ay')
61    /// - #NM_LLDP_ATTR_PORT_DESCRIPTION (type: 's')
62    /// - #NM_LLDP_ATTR_PORT_ID_TYPE (type: 'u')
63    /// - #NM_LLDP_ATTR_PORT_ID (type: 's')
64    /// - #NM_LLDP_ATTR_RAW (type: 'ay')
65    /// - #NM_LLDP_ATTR_SYSTEM_CAPABILITIES (type: 'u')
66    /// - #NM_LLDP_ATTR_SYSTEM_DESCRIPTION (type: 's')
67    /// - #NM_LLDP_ATTR_SYSTEM_NAME (type: 's')
68    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
69    pub struct LldpNeighbor(Shared<ffi::NMLldpNeighbor>);
70
71    match fn {
72        ref => |ptr| ffi::nm_lldp_neighbor_ref(ptr),
73        unref => |ptr| ffi::nm_lldp_neighbor_unref(ptr),
74        type_ => || ffi::nm_lldp_neighbor_get_type(),
75    }
76}
77
78impl LldpNeighbor {
79    /// Creates a new #NMLldpNeighbor object.
80    ///
81    /// Note that #NMLldpNeighbor has no public API for mutating
82    /// an instance. Also, libnm will not internally mutate a
83    /// once exposed object. They are guaranteed to be immutable.
84    ///
85    /// Since 1.32, ref-counting of #NMLldpNeighbor is thread-safe.
86    ///
87    /// This function is not useful, as there is no public API to
88    /// actually modify the (empty) instance.
89    ///
90    /// # Returns
91    ///
92    /// the new #NMLldpNeighbor object.
93    #[cfg(feature = "v1_2")]
94    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
95    #[doc(alias = "nm_lldp_neighbor_new")]
96    pub fn new() -> LldpNeighbor {
97        assert_initialized_main_thread!();
98        unsafe {
99            from_glib_full(ffi::nm_lldp_neighbor_new())
100        }
101    }
102
103    /// Gets an array of attribute names available for @self.
104    ///
105    /// # Returns
106    ///
107    /// a [`None`]-terminated array of attribute names.
108    #[cfg(feature = "v1_2")]
109    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
110    #[doc(alias = "nm_lldp_neighbor_get_attr_names")]
111    #[doc(alias = "get_attr_names")]
112    pub fn attr_names(&self) -> Vec<glib::GString> {
113        unsafe {
114            FromGlibPtrContainer::from_glib_full(ffi::nm_lldp_neighbor_get_attr_names(self.to_glib_none().0))
115        }
116    }
117
118    /// Gets the string value of attribute with name @name on @self
119    /// ## `name`
120    /// the attribute name
121    ///
122    /// # Returns
123    ///
124    /// [`true`] if a string attribute with name @name was found, [`false`] otherwise
125    ///
126    /// ## `out_value`
127    /// on return, the
128    ///   attribute value
129    #[cfg(feature = "v1_2")]
130    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
131    #[doc(alias = "nm_lldp_neighbor_get_attr_string_value")]
132    #[doc(alias = "get_attr_string_value")]
133    pub fn attr_string_value(&self, name: &str) -> Option<Option<glib::GString>> {
134        unsafe {
135            let mut out_value = std::ptr::null();
136            let ret = from_glib(ffi::nm_lldp_neighbor_get_attr_string_value(self.to_glib_none().0, name.to_glib_none().0, &mut out_value));
137            if ret { Some(from_glib_none(out_value)) } else { None }
138        }
139    }
140
141    //#[cfg(feature = "v1_2")]
142    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
143    //#[doc(alias = "nm_lldp_neighbor_get_attr_type")]
144    //#[doc(alias = "get_attr_type")]
145    //pub fn attr_type(&self, name: &str) -> /*Ignored*/glib::VariantType {
146    //    unsafe { TODO: call ffi:nm_lldp_neighbor_get_attr_type() }
147    //}
148
149    /// Gets the uint32 value of attribute with name @name on @self
150    /// ## `name`
151    /// the attribute name
152    ///
153    /// # Returns
154    ///
155    /// [`true`] if a uint32 attribute with name @name was found, [`false`] otherwise
156    ///
157    /// ## `out_value`
158    /// on return, the attribute value
159    #[cfg(feature = "v1_2")]
160    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
161    #[doc(alias = "nm_lldp_neighbor_get_attr_uint_value")]
162    #[doc(alias = "get_attr_uint_value")]
163    pub fn attr_uint_value(&self, name: &str) -> Option<u32> {
164        unsafe {
165            let mut out_value = std::mem::MaybeUninit::uninit();
166            let ret = from_glib(ffi::nm_lldp_neighbor_get_attr_uint_value(self.to_glib_none().0, name.to_glib_none().0, out_value.as_mut_ptr()));
167            if ret { Some(out_value.assume_init()) } else { None }
168        }
169    }
170
171    //#[cfg(feature = "v1_18")]
172    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
173    //#[doc(alias = "nm_lldp_neighbor_get_attr_value")]
174    //#[doc(alias = "get_attr_value")]
175    //pub fn attr_value(&self, name: &str) -> /*Ignored*/glib::Variant {
176    //    unsafe { TODO: call ffi:nm_lldp_neighbor_get_attr_value() }
177    //}
178}
179
180#[cfg(feature = "v1_2")]
181#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
182impl Default for LldpNeighbor {
183                     fn default() -> Self {
184                         Self::new()
185                     }
186                 }