Struct ipcon_sys::ipcon::Ipcon

source ·
pub struct Ipcon { /* private fields */ }
Expand description

IPCON peer.

Implementations§

source§

impl Ipcon

source

pub fn to_handler(u: usize) -> *mut c_void

source

pub unsafe fn from_handler(h: *mut c_void) -> usize

source

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.
source

pub fn get_read_fd(&self) -> Result<i32, IpconError>

Retrieve netlink socket file descriptor of message receiving interface.

source

pub fn get_write_fd(&self) -> Result<i32, IpconError>

Retrieve netlink socket file descriptor of message sending interface.

source

pub fn get_ctrl_fd(&self) -> Result<i32, IpconError>

Retrieve netlink socket file descriptor of control interface.

source

pub fn is_peer_present(&self, peer: &str) -> bool

Inquiry whether a peer is present.

source

pub fn is_group_present(&self, peer: &str, group: &str) -> bool

Inquiry whether the group of a peer is present.

source

pub fn receive_msg(&self) -> Result<IpconMsg, IpconError>

Receive IPCON message. This function will fail if the peer doesn’t enable IPF_RCV_IF.

source

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.

source

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.

source

pub fn register_group(&self, group: &str) -> Result<(), IpconError>

Register a multicast group.

source

pub fn unregister_group(&self, group: &str) -> Result<(), IpconError>

Unregister a multicast group.

source

pub fn join_group(&self, peer: &str, group: &str) -> Result<(), IpconError>

Subscribe a multicast group of a peer.

source

pub fn leave_group(&self, peer: &str, group: &str) -> Result<(), IpconError>

Unsubscribe a multicast group of a peer.

source

pub fn send_multicast( &self, group: &str, buf: &[u8], sync: bool ) -> Result<(), IpconError>

Send multicast messages to an owned group.

source

pub fn send_multicast_by_ref( &self, group: &str, buf: &[u8], sync: bool ) -> Result<(), IpconError>

Send multicast messages to an owned group.

source

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.

source

pub fn receive_msg_nonblock(&self) -> Result<IpconMsg, IpconError>

Receiving message without block. This is same to receive_msg_timeout(0, 0);

Trait Implementations§

source§

impl Drop for Ipcon

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more