pub struct Ipcon { /* private fields */ }Expand description
IPCON peer.
Implementations§
source§impl Ipcon
impl Ipcon
pub fn to_handler(u: usize) -> *mut c_void
sourcepub fn new(
peer_name: Option<&str>,
flag: Option<IpconFlag>
) -> Result<Ipcon, IpconError>
pub fn new(
peer_name: Option<&str>,
flag: Option<IpconFlag>
) -> Result<Ipcon, IpconError>
Create an IPCON peer. If the name is omitted, an anonymous will be created. Following flags can be specified with bitwise OR (|).
- IPF_DISABLE_KEVENT_FILTER
By default, IPCON kernel module will only delivery the add/remove notification of peers and groups which are considered to be interested by the peer. If this flag is enabled, all notification will be delivered by IPCON kernel module. - IPF_SND_IF
Use message sending interface. - IPF_RCV_IF
Use message receiving interface. - IPF_DEFAULT
This is same to IPF_RCV_IF | IPF_SND_IF.
sourcepub fn get_read_fd(&self) -> Result<i32, IpconError>
pub fn get_read_fd(&self) -> Result<i32, IpconError>
Retrieve netlink socket file descriptor of message receiving interface.
sourcepub fn get_write_fd(&self) -> Result<i32, IpconError>
pub fn get_write_fd(&self) -> Result<i32, IpconError>
Retrieve netlink socket file descriptor of message sending interface.
sourcepub fn get_ctrl_fd(&self) -> Result<i32, IpconError>
pub fn get_ctrl_fd(&self) -> Result<i32, IpconError>
Retrieve netlink socket file descriptor of control interface.
sourcepub fn is_peer_present(&self, peer: &str) -> bool
pub fn is_peer_present(&self, peer: &str) -> bool
Inquiry whether a peer is present.
sourcepub fn is_group_present(&self, peer: &str, group: &str) -> bool
pub fn is_group_present(&self, peer: &str, group: &str) -> bool
Inquiry whether the group of a peer is present.
sourcepub fn receive_msg(&self) -> Result<IpconMsg, IpconError>
pub fn receive_msg(&self) -> Result<IpconMsg, IpconError>
Receive IPCON message. This function will fail if the peer doesn’t enable IPF_RCV_IF.
sourcepub fn send_unicast_msg(&self, peer: &str, buf: &[u8]) -> Result<(), IpconError>
pub fn send_unicast_msg(&self, peer: &str, buf: &[u8]) -> Result<(), IpconError>
Send an unicast IPCON message to a specific peer. This function will fail if the peer doesn’t enable IPF_SND_IF.
sourcepub fn send_unicast_msg_by_ref(
&self,
peer: &str,
buf: &[u8]
) -> Result<(), IpconError>
pub fn send_unicast_msg_by_ref(
&self,
peer: &str,
buf: &[u8]
) -> Result<(), IpconError>
Send an unicast IPCON message to a specific peer. This function will fail if the peer doesn’t enable IPF_SND_IF.
sourcepub fn register_group(&self, group: &str) -> Result<(), IpconError>
pub fn register_group(&self, group: &str) -> Result<(), IpconError>
Register a multicast group.
sourcepub fn unregister_group(&self, group: &str) -> Result<(), IpconError>
pub fn unregister_group(&self, group: &str) -> Result<(), IpconError>
Unregister a multicast group.
sourcepub fn join_group(&self, peer: &str, group: &str) -> Result<(), IpconError>
pub fn join_group(&self, peer: &str, group: &str) -> Result<(), IpconError>
Subscribe a multicast group of a peer.
sourcepub fn leave_group(&self, peer: &str, group: &str) -> Result<(), IpconError>
pub fn leave_group(&self, peer: &str, group: &str) -> Result<(), IpconError>
Unsubscribe a multicast group of a peer.
sourcepub fn send_multicast(
&self,
group: &str,
buf: &[u8],
sync: bool
) -> Result<(), IpconError>
pub fn send_multicast(
&self,
group: &str,
buf: &[u8],
sync: bool
) -> Result<(), IpconError>
Send multicast messages to an owned group.
sourcepub fn send_multicast_by_ref(
&self,
group: &str,
buf: &[u8],
sync: bool
) -> Result<(), IpconError>
pub fn send_multicast_by_ref(
&self,
group: &str,
buf: &[u8],
sync: bool
) -> Result<(), IpconError>
Send multicast messages to an owned group.
sourcepub fn receive_msg_timeout(
&self,
tv_sec: u32,
tv_usec: u32
) -> Result<IpconMsg, IpconError>
pub fn receive_msg_timeout(
&self,
tv_sec: u32,
tv_usec: u32
) -> Result<IpconMsg, IpconError>
Receiving message with timeout. receive_msg() will block until a message come. receive_msg_timeout() adds a timeout to it.The timeout is specified with seconds and microseconds.
sourcepub fn receive_msg_nonblock(&self) -> Result<IpconMsg, IpconError>
pub fn receive_msg_nonblock(&self) -> Result<IpconMsg, IpconError>
Receiving message without block. This is same to receive_msg_timeout(0, 0);
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Ipcon
impl Send for Ipcon
impl Sync for Ipcon
impl Unpin for Ipcon
impl UnwindSafe for Ipcon
Blanket Implementations§
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more