[−][src]Struct neli::socket::NlSocket
Handle for the socket file descriptor
Methods
impl NlSocket
[src]
pub fn new(proto: NlFamily, track_seq: bool) -> Result<Self, Error>
[src]
Wrapper around socket()
syscall filling in the netlink-specific information
pub fn increment_seq(&mut self)
[src]
Manually increment sequence number
pub fn block(&mut self) -> Result<&mut Self, Error>
[src]
Set underlying socket file descriptor to be blocking
pub fn nonblock(&mut self) -> Result<&mut Self, 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 - Stream
feature will throw an
error if this function returns false
pub fn bind(
&mut self,
pid: Option<u32>,
groups: Option<Vec<u32>>
) -> Result<(), Error>
[src]
&mut self,
pid: Option<u32>,
groups: Option<Vec<u32>>
) -> Result<(), Error>
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.
The pid parameter sets PID checking.
None
means checking is off.Some(0)
turns checking on, but takes the PID from the first received message.Some(pid)
uses the given PID.
pub fn set_mcast_groups(&mut self, groups: Vec<u32>) -> Result<(), Error>
[src]
Set multicast groups for socket
pub fn send<B>(&self, buf: B, flags: i32) -> Result<size_t, Error> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
Send message encoded as byte slice to the netlink ID specified in the netlink header
(neli::nl::Nlmsghdr
)
pub fn recv<B>(&self, buf: B, flags: i32) -> Result<size_t, Error> where
B: AsMut<[u8]>,
[src]
B: AsMut<[u8]>,
Receive message encoded as byte slice from the netlink socket
pub fn connect(
proto: NlFamily,
pid: Option<u32>,
groups: Option<Vec<u32>>,
track_seq: bool
) -> Result<Self, Error>
[src]
proto: NlFamily,
pid: Option<u32>,
groups: Option<Vec<u32>>,
track_seq: bool
) -> Result<Self, Error>
Equivalent of socket
and bind
calls.
pub fn resolve_genl_family(&mut self, family_name: &str) -> Result<u16, NlError>
[src]
Convenience function for resolving a &str
containing the multicast group name to a
numeric 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 netlink ID
pub fn send_nl<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_nl<T, P>(
&mut self,
buf_sz: Option<usize>
) -> Result<Nlmsghdr<T, P>, NlError> where
T: Nl + NlType + Debug,
P: Nl + Debug,
[src]
&mut self,
buf_sz: Option<usize>
) -> Result<Nlmsghdr<T, P>, NlError> where
T: Nl + NlType + Debug,
P: Nl + Debug,
Convenience function to begin receiving a stream of Nlmsghdr
structs
pub fn recv_ack(&mut self) -> Result<(), NlError>
[src]
Consume an ACK and return an error if an ACK is not found
pub fn iter<T, P>(&mut self) -> NlMessageIter<T, P> where
T: NlType,
P: Nl,
[src]
T: NlType,
P: Nl,
Return an iterator object
Trait Implementations
impl AsRawFd for NlSocket
[src]
impl Drop for NlSocket
[src]
impl FromRawFd for NlSocket
[src]
unsafe fn from_raw_fd(fd: RawFd) -> Self
[src]
impl IntoRawFd for NlSocket
[src]
fn into_raw_fd(self) -> RawFd
[src]
Auto Trait Implementations
impl RefUnwindSafe for NlSocket
impl Send for NlSocket
impl Sync for NlSocket
impl Unpin for NlSocket
impl UnwindSafe for NlSocket
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,
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.
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>,