nm_rs/auto/
team_link_watcher.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_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    /// Creates a new arp_ping #NMTeamLinkWatcher object
27    /// ## `init_wait`
28    /// init_wait value
29    /// ## `interval`
30    /// interval value
31    /// ## `missed_max`
32    /// missed_max value
33    /// ## `target_host`
34    /// the host name or the ip address that will be used as destination
35    ///   address in the arp request
36    /// ## `source_host`
37    /// the host name or the ip address that will be used as source
38    ///   address in the arp request
39    /// ## `flags`
40    /// the watcher #NMTeamLinkWatcherArpPingFlags
41    ///
42    /// # Returns
43    ///
44    /// the new #NMTeamLinkWatcher object, or [`None`] on error
45    #[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    /// Creates a new arp_ping #NMTeamLinkWatcher object
58    /// ## `init_wait`
59    /// init_wait value
60    /// ## `interval`
61    /// interval value
62    /// ## `missed_max`
63    /// missed_max value
64    /// ## `vlanid`
65    /// vlanid value
66    /// ## `target_host`
67    /// the host name or the ip address that will be used as destination
68    ///   address in the arp request
69    /// ## `source_host`
70    /// the host name or the ip address that will be used as source
71    ///   address in the arp request
72    /// ## `flags`
73    /// the watcher #NMTeamLinkWatcherArpPingFlags
74    ///
75    /// # Returns
76    ///
77    /// the new #NMTeamLinkWatcher object, or [`None`] on error
78    #[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    /// Creates a new ethtool #NMTeamLinkWatcher object
91    /// ## `delay_up`
92    /// delay_up value
93    /// ## `delay_down`
94    /// delay_down value
95    ///
96    /// # Returns
97    ///
98    /// the new #NMTeamLinkWatcher object
99    #[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    /// Creates a new nsna_ping #NMTeamLinkWatcher object
112    /// ## `init_wait`
113    /// init_wait value
114    /// ## `interval`
115    /// interval value
116    /// ## `missed_max`
117    /// missed_max value
118    /// ## `target_host`
119    /// the host name or the ipv6 address that will be used as
120    ///   target address in the NS packet
121    ///
122    /// # Returns
123    ///
124    /// the new #NMTeamLinkWatcher object, or [`None`] on error
125    #[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    /// Creates a copy of @self
138    ///
139    /// # Returns
140    ///
141    /// a copy of @self
142    #[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    /// Gets the delay_down interval (in milliseconds) that elapses between the link
162    /// going down and the runner being notified about it.
163    #[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    /// Gets the delay_up interval (in milliseconds) that elapses between the link
174    /// coming up and the runner being notified about it.
175    #[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    /// Gets the arp ping watcher flags.
186    #[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    /// Gets the init_wait interval (in milliseconds) that the team port should
197    /// wait before sending the first packet to the target host.
198    #[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    /// Gets the interval (in milliseconds) that the team port should wait between
209    /// sending two check packets to the target host.
210    #[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    /// Gets the number of missed replies after which the link is considered down.
221    #[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    /// Gets the name of the link watcher to be used.
232    #[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    /// Gets the ip address to be used as source for the link probing packets.
243    #[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    /// Gets the host name/ip address to be used as destination for the link probing
254    /// packets.
255    #[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    /// Gets the VLAN tag ID to be used to outgoing link probes
266    #[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}