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
// 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};
#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
use glib::{translate::*};
glib::wrapper! {
/// Supported attributes are:
///
/// - #NM_LLDP_ATTR_CHASSIS_ID_TYPE (type: 'u')
/// - #NM_LLDP_ATTR_CHASSIS_ID (type: 's')
/// - #NM_LLDP_ATTR_DESTINATION (type: 's')
/// - #NM_LLDP_ATTR_IEEE_802_1_PPVID (type: 'u'). This attribute only reports the first PPVID
/// and therefore it is deprecated in favor of NM_LLDP_ATTR_IEEE_802_1_PPVIDS which reports
/// all the PPVID.
/// - #NM_LLDP_ATTR_IEEE_802_1_PPVID_FLAGS (type: 'u'). This attribute only reports the first PPVID
/// and therefore it is deprecated in favor of NM_LLDP_ATTR_IEEE_802_1_PPVIDS which reports
/// all the PPVID.
/// - #NM_LLDP_ATTR_IEEE_802_1_PPVIDS (type: 'aa{sv}')
///
/// An array of dictionaries where each element has keys:
/// - flags (type: 'u')
/// - ppvid (type: 'u')
/// - #NM_LLDP_ATTR_IEEE_802_1_PVID (type: 'u')
/// - #NM_LLDP_ATTR_IEEE_802_1_VID (type: 'u'). This attribute only reports the first VLAN
/// and therefore it is deprecated in favor of NM_LLDP_ATTR_IEEE_802_1_VLANS which reports
/// all the VLANs.
/// - #NM_LLDP_ATTR_IEEE_802_1_VLAN_NAME (type: 's'). This attribute only reports the first VLAN
/// and therefore it is deprecated in favor of NM_LLDP_ATTR_IEEE_802_1_VLANS which reports
/// all the VLANs.
/// - #NM_LLDP_ATTR_IEEE_802_1_VLANS (type: 'aa{sv}')
///
/// An array of dictionaries where each element has keys:
/// - name (type: 's')
/// - vid (type: 'u')
/// - #NM_LLDP_ATTR_IEEE_802_3_MAC_PHY_CONF (type: 'a{sv}')
///
/// Dictionary where each element has keys:
/// - autoneg (type: 'u')
/// - operational-mau-type (type: 'u')
/// - pmd-autoneg-cap (type: 'u')
/// - #NM_LLDP_ATTR_IEEE_802_3_MAX_FRAME_SIZE (type: 'u')
/// - #NM_LLDP_ATTR_IEEE_802_3_POWER_VIA_MDI (type: 'a{sv}')
///
/// Dictionary where each element has keys:
/// - mdi-power-support (type: 'u')
/// - power-class (type: 'u')
/// - pse-power-pair (type: 'u')
/// - #NM_LLDP_ATTR_MANAGEMENT_ADDRESSES (type: 'aa{sv}')
///
/// An array of dictionaries where each element has keys:
/// - address (type: 'ay')
/// - address-subtype (type: 'u')
/// - interface-number (type: 'u')
/// - interface-number-subtype (type: 'u')
/// - object-id (type: 'ay')
/// - #NM_LLDP_ATTR_PORT_DESCRIPTION (type: 's')
/// - #NM_LLDP_ATTR_PORT_ID_TYPE (type: 'u')
/// - #NM_LLDP_ATTR_PORT_ID (type: 's')
/// - #NM_LLDP_ATTR_RAW (type: 'ay')
/// - #NM_LLDP_ATTR_SYSTEM_CAPABILITIES (type: 'u')
/// - #NM_LLDP_ATTR_SYSTEM_DESCRIPTION (type: 's')
/// - #NM_LLDP_ATTR_SYSTEM_NAME (type: 's')
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct LldpNeighbor(Shared<ffi::NMLldpNeighbor>);
match fn {
ref => |ptr| ffi::nm_lldp_neighbor_ref(ptr),
unref => |ptr| ffi::nm_lldp_neighbor_unref(ptr),
type_ => || ffi::nm_lldp_neighbor_get_type(),
}
}
impl LldpNeighbor {
/// Creates a new #NMLldpNeighbor object.
///
/// Note that #NMLldpNeighbor has no public API for mutating
/// an instance. Also, libnm will not internally mutate a
/// once exposed object. They are guaranteed to be immutable.
///
/// Since 1.32, ref-counting of #NMLldpNeighbor is thread-safe.
///
/// This function is not useful, as there is no public API to
/// actually modify the (empty) instance.
///
/// # Returns
///
/// the new #NMLldpNeighbor object.
#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
#[doc(alias = "nm_lldp_neighbor_new")]
pub fn new() -> LldpNeighbor {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::nm_lldp_neighbor_new())
}
}
/// Gets an array of attribute names available for @self.
///
/// # Returns
///
/// a [`None`]-terminated array of attribute names.
#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
#[doc(alias = "nm_lldp_neighbor_get_attr_names")]
#[doc(alias = "get_attr_names")]
pub fn attr_names(&self) -> Vec<glib::GString> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::nm_lldp_neighbor_get_attr_names(self.to_glib_none().0))
}
}
/// Gets the string value of attribute with name @name on @self
/// ## `name`
/// the attribute name
///
/// # Returns
///
/// [`true`] if a string attribute with name @name was found, [`false`] otherwise
///
/// ## `out_value`
/// on return, the
/// attribute value
#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
#[doc(alias = "nm_lldp_neighbor_get_attr_string_value")]
#[doc(alias = "get_attr_string_value")]
pub fn attr_string_value(&self, name: &str) -> Option<Option<glib::GString>> {
unsafe {
let mut out_value = std::ptr::null();
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));
if ret { Some(from_glib_none(out_value)) } else { None }
}
}
//#[cfg(feature = "v1_2")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
//#[doc(alias = "nm_lldp_neighbor_get_attr_type")]
//#[doc(alias = "get_attr_type")]
//pub fn attr_type(&self, name: &str) -> /*Ignored*/glib::VariantType {
// unsafe { TODO: call ffi:nm_lldp_neighbor_get_attr_type() }
//}
/// Gets the uint32 value of attribute with name @name on @self
/// ## `name`
/// the attribute name
///
/// # Returns
///
/// [`true`] if a uint32 attribute with name @name was found, [`false`] otherwise
///
/// ## `out_value`
/// on return, the attribute value
#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
#[doc(alias = "nm_lldp_neighbor_get_attr_uint_value")]
#[doc(alias = "get_attr_uint_value")]
pub fn attr_uint_value(&self, name: &str) -> Option<u32> {
unsafe {
let mut out_value = std::mem::MaybeUninit::uninit();
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()));
if ret { Some(out_value.assume_init()) } else { None }
}
}
//#[cfg(feature = "v1_18")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
//#[doc(alias = "nm_lldp_neighbor_get_attr_value")]
//#[doc(alias = "get_attr_value")]
//pub fn attr_value(&self, name: &str) -> /*Ignored*/glib::Variant {
// unsafe { TODO: call ffi:nm_lldp_neighbor_get_attr_value() }
//}
}
#[cfg(feature = "v1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
impl Default for LldpNeighbor {
fn default() -> Self {
Self::new()
}
}