use crate::{ffi};
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
use crate::{TeamLinkWatcherArpPingFlags};
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
use glib::{translate::*};
glib::wrapper! {
#[derive(Debug, PartialOrd, Ord, Hash)]
pub struct TeamLinkWatcher(Shared<ffi::NMTeamLinkWatcher>);
match fn {
ref => |ptr| ffi::nm_team_link_watcher_ref(ptr),
unref => |ptr| ffi::nm_team_link_watcher_unref(ptr),
type_ => || ffi::nm_team_link_watcher_get_type(),
}
}
impl TeamLinkWatcher {
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_new_arp_ping")]
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> {
assert_initialized_main_thread!();
unsafe {
let mut error = std::ptr::null_mut();
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);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "nm_team_link_watcher_new_arp_ping2")]
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> {
assert_initialized_main_thread!();
unsafe {
let mut error = std::ptr::null_mut();
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);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_new_ethtool")]
pub fn new_ethtool(delay_up: i32, delay_down: i32) -> Result<TeamLinkWatcher, glib::Error> {
assert_initialized_main_thread!();
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::nm_team_link_watcher_new_ethtool(delay_up, delay_down, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_new_nsna_ping")]
pub fn new_nsna_ping(init_wait: i32, interval: i32, missed_max: i32, target_host: &str) -> Result<TeamLinkWatcher, glib::Error> {
assert_initialized_main_thread!();
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::nm_team_link_watcher_new_nsna_ping(init_wait, interval, missed_max, target_host.to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_dup")]
#[must_use]
pub fn dup(&self) -> TeamLinkWatcher {
unsafe {
from_glib_full(ffi::nm_team_link_watcher_dup(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_equal")]
fn equal(&self, other: &TeamLinkWatcher) -> bool {
unsafe {
from_glib(ffi::nm_team_link_watcher_equal(self.to_glib_none().0, other.to_glib_none().0))
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_get_delay_down")]
#[doc(alias = "get_delay_down")]
pub fn delay_down(&self) -> i32 {
unsafe {
ffi::nm_team_link_watcher_get_delay_down(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_get_delay_up")]
#[doc(alias = "get_delay_up")]
pub fn delay_up(&self) -> i32 {
unsafe {
ffi::nm_team_link_watcher_get_delay_up(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_get_flags")]
#[doc(alias = "get_flags")]
pub fn flags(&self) -> TeamLinkWatcherArpPingFlags {
unsafe {
from_glib(ffi::nm_team_link_watcher_get_flags(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_get_init_wait")]
#[doc(alias = "get_init_wait")]
pub fn init_wait(&self) -> i32 {
unsafe {
ffi::nm_team_link_watcher_get_init_wait(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_get_interval")]
#[doc(alias = "get_interval")]
pub fn interval(&self) -> i32 {
unsafe {
ffi::nm_team_link_watcher_get_interval(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_get_missed_max")]
#[doc(alias = "get_missed_max")]
pub fn missed_max(&self) -> i32 {
unsafe {
ffi::nm_team_link_watcher_get_missed_max(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_get_name")]
#[doc(alias = "get_name")]
pub fn name(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_team_link_watcher_get_name(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_get_source_host")]
#[doc(alias = "get_source_host")]
pub fn source_host(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_team_link_watcher_get_source_host(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_team_link_watcher_get_target_host")]
#[doc(alias = "get_target_host")]
pub fn target_host(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_team_link_watcher_get_target_host(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "nm_team_link_watcher_get_vlanid")]
#[doc(alias = "get_vlanid")]
pub fn vlanid(&self) -> i32 {
unsafe {
ffi::nm_team_link_watcher_get_vlanid(self.to_glib_none().0)
}
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
impl PartialEq for TeamLinkWatcher {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.equal(other)
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
impl Eq for TeamLinkWatcher {}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
impl std::fmt::Display for TeamLinkWatcher {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(&self.name())
}
}