nm_rs/auto/
team_link_watcher.rs1use crate::{ffi};
7#[cfg(feature = "v1_12")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
9use crate::{TeamLinkWatcherArpPingFlags};
10#[cfg(feature = "v1_12")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
12use glib::{translate::*};
13
14glib::wrapper! {
15 #[derive(Debug, PartialOrd, Ord, Hash)]
16 pub struct TeamLinkWatcher(Shared<ffi::NMTeamLinkWatcher>);
17
18 match fn {
19 ref => |ptr| ffi::nm_team_link_watcher_ref(ptr),
20 unref => |ptr| ffi::nm_team_link_watcher_unref(ptr),
21 type_ => || ffi::nm_team_link_watcher_get_type(),
22 }
23}
24
25impl TeamLinkWatcher {
26 #[cfg(feature = "v1_12")]
46 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
47 #[doc(alias = "nm_team_link_watcher_new_arp_ping")]
48 pub fn new_arp_ping(init_wait: i32, interval: i32, missed_max: i32, target_host: &str, source_host: &str, flags: TeamLinkWatcherArpPingFlags) -> Result<TeamLinkWatcher, glib::Error> {
49 assert_initialized_main_thread!();
50 unsafe {
51 let mut error = std::ptr::null_mut();
52 let ret = ffi::nm_team_link_watcher_new_arp_ping(init_wait, interval, missed_max, target_host.to_glib_none().0, source_host.to_glib_none().0, flags.into_glib(), &mut error);
53 if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
54 }
55 }
56
57 #[cfg(feature = "v1_16")]
79 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
80 #[doc(alias = "nm_team_link_watcher_new_arp_ping2")]
81 pub fn new_arp_ping2(init_wait: i32, interval: i32, missed_max: i32, vlanid: i32, target_host: &str, source_host: &str, flags: TeamLinkWatcherArpPingFlags) -> Result<TeamLinkWatcher, glib::Error> {
82 assert_initialized_main_thread!();
83 unsafe {
84 let mut error = std::ptr::null_mut();
85 let ret = ffi::nm_team_link_watcher_new_arp_ping2(init_wait, interval, missed_max, vlanid, target_host.to_glib_none().0, source_host.to_glib_none().0, flags.into_glib(), &mut error);
86 if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
87 }
88 }
89
90 #[cfg(feature = "v1_12")]
100 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
101 #[doc(alias = "nm_team_link_watcher_new_ethtool")]
102 pub fn new_ethtool(delay_up: i32, delay_down: i32) -> Result<TeamLinkWatcher, glib::Error> {
103 assert_initialized_main_thread!();
104 unsafe {
105 let mut error = std::ptr::null_mut();
106 let ret = ffi::nm_team_link_watcher_new_ethtool(delay_up, delay_down, &mut error);
107 if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
108 }
109 }
110
111 #[cfg(feature = "v1_12")]
126 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
127 #[doc(alias = "nm_team_link_watcher_new_nsna_ping")]
128 pub fn new_nsna_ping(init_wait: i32, interval: i32, missed_max: i32, target_host: &str) -> Result<TeamLinkWatcher, glib::Error> {
129 assert_initialized_main_thread!();
130 unsafe {
131 let mut error = std::ptr::null_mut();
132 let ret = ffi::nm_team_link_watcher_new_nsna_ping(init_wait, interval, missed_max, target_host.to_glib_none().0, &mut error);
133 if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
134 }
135 }
136
137 #[cfg(feature = "v1_12")]
143 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
144 #[doc(alias = "nm_team_link_watcher_dup")]
145#[must_use]
146 pub fn dup(&self) -> TeamLinkWatcher {
147 unsafe {
148 from_glib_full(ffi::nm_team_link_watcher_dup(self.to_glib_none().0))
149 }
150 }
151
152 #[cfg(feature = "v1_12")]
153 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
154 #[doc(alias = "nm_team_link_watcher_equal")]
155 fn equal(&self, other: &TeamLinkWatcher) -> bool {
156 unsafe {
157 from_glib(ffi::nm_team_link_watcher_equal(self.to_glib_none().0, other.to_glib_none().0))
158 }
159 }
160
161 #[cfg(feature = "v1_12")]
164 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
165 #[doc(alias = "nm_team_link_watcher_get_delay_down")]
166 #[doc(alias = "get_delay_down")]
167 pub fn delay_down(&self) -> i32 {
168 unsafe {
169 ffi::nm_team_link_watcher_get_delay_down(self.to_glib_none().0)
170 }
171 }
172
173 #[cfg(feature = "v1_12")]
176 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
177 #[doc(alias = "nm_team_link_watcher_get_delay_up")]
178 #[doc(alias = "get_delay_up")]
179 pub fn delay_up(&self) -> i32 {
180 unsafe {
181 ffi::nm_team_link_watcher_get_delay_up(self.to_glib_none().0)
182 }
183 }
184
185 #[cfg(feature = "v1_12")]
187 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
188 #[doc(alias = "nm_team_link_watcher_get_flags")]
189 #[doc(alias = "get_flags")]
190 pub fn flags(&self) -> TeamLinkWatcherArpPingFlags {
191 unsafe {
192 from_glib(ffi::nm_team_link_watcher_get_flags(self.to_glib_none().0))
193 }
194 }
195
196 #[cfg(feature = "v1_12")]
199 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
200 #[doc(alias = "nm_team_link_watcher_get_init_wait")]
201 #[doc(alias = "get_init_wait")]
202 pub fn init_wait(&self) -> i32 {
203 unsafe {
204 ffi::nm_team_link_watcher_get_init_wait(self.to_glib_none().0)
205 }
206 }
207
208 #[cfg(feature = "v1_12")]
211 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
212 #[doc(alias = "nm_team_link_watcher_get_interval")]
213 #[doc(alias = "get_interval")]
214 pub fn interval(&self) -> i32 {
215 unsafe {
216 ffi::nm_team_link_watcher_get_interval(self.to_glib_none().0)
217 }
218 }
219
220 #[cfg(feature = "v1_12")]
222 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
223 #[doc(alias = "nm_team_link_watcher_get_missed_max")]
224 #[doc(alias = "get_missed_max")]
225 pub fn missed_max(&self) -> i32 {
226 unsafe {
227 ffi::nm_team_link_watcher_get_missed_max(self.to_glib_none().0)
228 }
229 }
230
231 #[cfg(feature = "v1_12")]
233 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
234 #[doc(alias = "nm_team_link_watcher_get_name")]
235 #[doc(alias = "get_name")]
236 pub fn name(&self) -> glib::GString {
237 unsafe {
238 from_glib_none(ffi::nm_team_link_watcher_get_name(self.to_glib_none().0))
239 }
240 }
241
242 #[cfg(feature = "v1_12")]
244 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
245 #[doc(alias = "nm_team_link_watcher_get_source_host")]
246 #[doc(alias = "get_source_host")]
247 pub fn source_host(&self) -> glib::GString {
248 unsafe {
249 from_glib_none(ffi::nm_team_link_watcher_get_source_host(self.to_glib_none().0))
250 }
251 }
252
253 #[cfg(feature = "v1_12")]
256 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
257 #[doc(alias = "nm_team_link_watcher_get_target_host")]
258 #[doc(alias = "get_target_host")]
259 pub fn target_host(&self) -> glib::GString {
260 unsafe {
261 from_glib_none(ffi::nm_team_link_watcher_get_target_host(self.to_glib_none().0))
262 }
263 }
264
265 #[cfg(feature = "v1_16")]
267 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
268 #[doc(alias = "nm_team_link_watcher_get_vlanid")]
269 #[doc(alias = "get_vlanid")]
270 pub fn vlanid(&self) -> i32 {
271 unsafe {
272 ffi::nm_team_link_watcher_get_vlanid(self.to_glib_none().0)
273 }
274 }
275}
276
277#[cfg(feature = "v1_12")]
278#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
279impl PartialEq for TeamLinkWatcher {
280 #[inline]
281 fn eq(&self, other: &Self) -> bool {
282 self.equal(other)
283 }
284}
285#[cfg(feature = "v1_12")]
286#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
287
288impl Eq for TeamLinkWatcher {}
289
290#[cfg(feature = "v1_12")]
291#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
292impl std::fmt::Display for TeamLinkWatcher {
293 #[inline]
294 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
295 f.write_str(&self.name())
296 }
297}