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>where
B: AsRef<[u8]>,
pub fn send<B>(&self, buf: B, flags: i32) -> Result<size_t, Error>where
B: AsRef<[u8]>,
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.