[][src]Struct neli::socket::NlSocket

pub struct NlSocket { /* fields omitted */ }

Low level access to a netlink socket.

Implementations

impl NlSocket[src]

pub fn new(proto: NlFamily) -> Result<Self, Error>[src]

Wrapper around socket() syscall filling in the netlink-specific information.

pub fn connect(
    proto: NlFamily,
    pid: Option<u32>,
    groups: U32Bitmask
) -> Result<Self, Error>
[src]

Equivalent of socket and bind calls.

pub fn block(&self) -> Result<(), Error>[src]

Set underlying socket file descriptor to be blocking.

pub fn nonblock(&self) -> Result<(), Error>[src]

Set underlying socket file descriptor to be non blocking.

pub fn is_blocking(&self) -> Result<bool, Error>[src]

Determines if underlying file descriptor is blocking.

pub fn bind(&self, pid: Option<u32>, groups: U32Bitmask) -> Result<(), Error>[src]

Use this function to bind to a netlink ID and subscribe to groups. See netlink(7) man pages for more information on netlink IDs and groups.

pub fn add_mcast_membership(&self, groups: U32Bitmask) -> Result<(), Error>[src]

Join multicast groups for a socket.

pub fn drop_mcast_membership(&self, groups: U32Bitmask) -> Result<(), Error>[src]

Leave multicast groups for a socket.

pub fn list_mcast_membership(&self) -> Result<U32Bitmask, Error>[src]

List joined groups for a socket.

pub fn send<B>(&self, buf: B, flags: i32) -> Result<size_t, Error> where
    B: AsRef<[u8]>, 
[src]

Send message encoded as byte slice to the netlink ID specified in the netlink header Nlmsghdr

pub fn recv<B>(&self, buf: B, flags: i32) -> Result<size_t, Error> where
    B: AsMut<[u8]>, 
[src]

Receive message encoded as byte slice from the netlink socket.

Trait Implementations

impl AsRawFd for NlSocket[src]

impl Drop for NlSocket[src]

pub fn drop(&mut self)[src]

Closes underlying file descriptor to avoid file descriptor leaks.

impl From<NlSocketHandle> for NlSocket[src]

impl FromRawFd for NlSocket[src]

impl IntoRawFd for NlSocket[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.