[−][src]Struct neli::socket::NlSocketHandle
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]
proto: NlFamily,
pid: Option<u32>,
groups: U32Bitmask
) -> Result<Self, Error>
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]
&mut self,
family_name: &str,
mcast_name: &str
) -> Result<u32, NlError>
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]
T: Nl + NlType + Debug,
P: Nl + Debug,
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]
T: Nl + NlType + Debug,
P: Nl + Debug,
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]
T: Nl + NlType + Debug,
P: Nl + Debug,
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]
&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>;
P: Nl + Debug,
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]
pub fn from(s: NlSocketHandle) -> Self
[src]
impl FromRawFd for NlSocketHandle
[src]
pub unsafe fn from_raw_fd(fd: RawFd) -> Self
[src]
impl IntoRawFd for NlSocketHandle
[src]
pub fn into_raw_fd(self) -> RawFd
[src]
Auto Trait Implementations
impl !RefUnwindSafe for NlSocketHandle
impl Send for NlSocketHandle
impl !Sync for NlSocketHandle
impl Unpin for NlSocketHandle
impl UnwindSafe for NlSocketHandle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,