pub struct Ipcon { /* private fields */ }Expand description
IPCON peer.
Implementations
sourceimpl Ipcon
impl Ipcon
pub fn to_handler(u: usize) -> *mut c_void
sourcepub fn new(peer_name: Option<&str>, flag: Option<IpconFlag>) -> Option<Ipcon>
pub fn new(peer_name: Option<&str>, flag: Option<IpconFlag>) -> Option<Ipcon>
Create an IPEON peer. If the name is ommited, 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 considerred to be interested by the peer. If this flag is enabled, all notification will be deliveried by IPCON kernel module. - IPF_SND_IF
Use message sending interface. - IPF_RCV_IF
Use message receiving interface. - IPF_DEFULT
This is same to IPF_RCV_IF | IPF_SND_IF.
sourcepub fn get_read_fd(&self) -> Option<i32>
pub fn get_read_fd(&self) -> Option<i32>
Retrieve netlink socket file descriptor of message receiving interface.
sourcepub fn get_write_fd(&self) -> Option<i32>
pub fn get_write_fd(&self) -> Option<i32>
Retrieve netlink socket file descriptor of message sending interface.
sourcepub fn get_ctrl_fd(&self) -> Option<i32>
pub fn get_ctrl_fd(&self) -> Option<i32>
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>
pub fn receive_msg(&self) -> Result<IpconMsg>
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: Bytes) -> Result<()>
pub fn send_unicast_msg(&self, peer: &str, buf: Bytes) -> Result<()>
Send an unicast IPCON message to a speicific 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: &Bytes) -> Result<()>
pub fn send_unicast_msg_by_ref(&self, peer: &str, buf: &Bytes) -> Result<()>
Send an unicast IPCON message to a speicific peer. This function will fail if the peer doesn’t enable IPF_SND_IF.
sourcepub fn register_group(&self, group: &str) -> Result<()>
pub fn register_group(&self, group: &str) -> Result<()>
Register a multicast group.
sourcepub fn unregister_group(&self, group: &str) -> Result<()>
pub fn unregister_group(&self, group: &str) -> Result<()>
Unregister a multicast group.
sourcepub fn join_group(&self, peer: &str, group: &str) -> Result<()>
pub fn join_group(&self, peer: &str, group: &str) -> Result<()>
Subscribe a multicast group of a peer.
sourcepub fn leave_group(&self, peer: &str, group: &str) -> Result<()>
pub fn leave_group(&self, peer: &str, group: &str) -> Result<()>
Unsubscribe a multicast group of a peer.
sourcepub fn send_multicast(&self, group: &str, buf: Bytes, sync: bool) -> Result<()>
pub fn send_multicast(&self, group: &str, buf: Bytes, sync: bool) -> Result<()>
Send multicast messages to an owned group.
sourcepub fn send_multicast_by_ref(
&self,
group: &str,
buf: &Bytes,
sync: bool
) -> Result<()>
pub fn send_multicast_by_ref(
&self,
group: &str,
buf: &Bytes,
sync: bool
) -> Result<()>
Send multicast messages to an owned group.
sourcepub fn receive_msg_timeout(&self, tv_sec: u32, tv_usec: u32) -> Result<IpconMsg>
pub fn receive_msg_timeout(&self, tv_sec: u32, tv_usec: u32) -> Result<IpconMsg>
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>
pub fn receive_msg_nonblock(&self) -> Result<IpconMsg>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more