pub struct NlSocket { /* private fields */ }
Expand description
Low level access to a netlink socket.
Implementations§
Source§impl NlSocket
impl NlSocket
Sourcepub fn new(proto: NlFamily) -> Result<Self, Error>
pub fn new(proto: NlFamily) -> Result<Self, Error>
Wrapper around socket()
syscall filling in the
netlink-specific information.
Sourcepub fn connect(
proto: NlFamily,
pid: Option<u32>,
groups: &[u32],
) -> Result<Self, Error>
pub fn connect( proto: NlFamily, pid: Option<u32>, groups: &[u32], ) -> Result<Self, Error>
Equivalent of socket
and bind
calls.
Sourcepub fn nonblock(&self) -> Result<(), Error>
pub fn nonblock(&self) -> Result<(), Error>
Set underlying socket file descriptor to be non blocking.
Sourcepub fn is_blocking(&self) -> Result<bool, Error>
pub fn is_blocking(&self) -> Result<bool, Error>
Determines if underlying file descriptor is blocking.
Sourcepub fn bind(&self, pid: Option<u32>, groups: &[u32]) -> Result<(), Error>
pub fn bind(&self, pid: Option<u32>, groups: &[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.
Sourcepub fn add_mcast_membership(&self, groups: &[u32]) -> Result<(), Error>
pub fn add_mcast_membership(&self, groups: &[u32]) -> Result<(), Error>
Join multicast groups for a socket.
Sourcepub fn drop_mcast_membership(&self, groups: &[u32]) -> Result<(), Error>
pub fn drop_mcast_membership(&self, groups: &[u32]) -> Result<(), Error>
Leave multicast groups for a socket.
Sourcepub fn list_mcast_membership(&self) -> Result<NetlinkBitArray, Error>
pub fn list_mcast_membership(&self) -> Result<NetlinkBitArray, Error>
List joined groups for a socket.
Sourcepub fn send<B>(&self, buf: B, flags: i32) -> Result<size_t, Error>
pub fn send<B>(&self, buf: B, flags: i32) -> Result<size_t, Error>
Send message encoded as byte slice to the netlink ID
specified in the netlink header
Nlmsghdr
.
Trait Implementations§
Source§impl From<NlSocketHandle> for NlSocket
impl From<NlSocketHandle> for NlSocket
Source§fn from(s: NlSocketHandle) -> Self
fn from(s: NlSocketHandle) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for NlSocket
impl RefUnwindSafe for NlSocket
impl Send for NlSocket
impl Sync for NlSocket
impl Unpin for NlSocket
impl UnwindSafe for NlSocket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more