[][src]Struct neli::socket::NlSocketHandle

pub struct NlSocketHandle { /* fields omitted */ }

Higher level handle for socket operations.

Implementations

impl NlSocketHandle[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 resolve_genl_family(&mut self, family_name: &str) -> Result<u16, NlError>[src]

Convenience function for resolving a str containing the generic netlink family name to a numeric generic netlink ID.

pub fn resolve_nl_mcast_group(
    &mut self,
    family_name: &str,
    mcast_name: &str
) -> Result<u32, NlError>
[src]

Convenience function for resolving a str containing the multicast group name to a numeric multicast group ID.

pub fn lookup_id(&mut self, id: u32) -> Result<(String, String), NlError>[src]

Look up netlink family and multicast group name by ID.

pub fn send<T, P>(&mut self, msg: Nlmsghdr<T, P>) -> Result<(), NlError> where
    T: Nl + NlType + Debug,
    P: Nl + Debug
[src]

Convenience function to send an Nlmsghdr struct

pub fn recv<T, P>(&mut self) -> Result<Option<Nlmsghdr<T, P>>, NlError> where
    T: Nl + NlType + Debug,
    P: Nl + Debug
[src]

Convenience function to begin receiving a stream of Nlmsghdr structs.

pub fn recv_all<T, P>(&mut self) -> Result<NlBuffer<T, P>, NlError> where
    T: Nl + NlType + Debug,
    P: Nl + Debug
[src]

Parse all Nlmsghdr structs sent in one network packet and return them all in a list.

Failure to parse any packet will cause the entire operation to fail. If an error is detected at the application level, this method will discard any non-error Nlmsghdr structs and only return the error. This method checks for ACKs. For a more granular approach, use either NlSocketHandle::recv or NlSocketHandle::iter.

pub fn iter<P>(
    &mut self,
    iter_indefinitely: bool
) -> NlMessageIter<'_, NlTypeWrapper, P>

Notable traits for NlMessageIter<'a, NlTypeWrapper, P>

impl<'a, P> Iterator for NlMessageIter<'a, NlTypeWrapper, P> where
    P: Nl + Debug
type Item = Result<Nlmsghdr<NlTypeWrapper, P>, NlError>;
where
    P: Nl + Debug
[src]

Return an iterator object

The argument iterate_indefinitely is documented in more detail in NlMessageIter

Trait Implementations

impl AsRawFd for NlSocketHandle[src]

impl From<NlSocketHandle> for NlSocket[src]

impl FromRawFd for NlSocketHandle[src]

impl IntoRawFd for NlSocketHandle[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.