pub struct Socket(/* private fields */);
Implementations§
Source§impl Socket
impl Socket
pub fn new(protocol: Protocol) -> Result<Self>
pub fn bind(&mut self, addr: &SocketAddr) -> Result<()>
pub fn bind_auto(&mut self) -> Result<SocketAddr>
pub fn get_address(&self, addr: &mut SocketAddr) -> Result<()>
pub fn set_non_blocking(&self, non_blocking: bool) -> Result<()>
pub fn connect(&self, remote_addr: &SocketAddr) -> Result<()>
pub fn recv_from( &self, buf: &mut [u8], flags: c_int, ) -> Result<(usize, SocketAddr)>
pub fn recv(&self, buf: &mut [u8], flags: c_int) -> Result<usize>
pub fn send_to( &self, buf: &[u8], addr: &SocketAddr, flags: c_int, ) -> Result<usize>
pub fn send(&self, buf: &[u8], flags: c_int) -> Result<usize>
pub fn set_pktinfo(&mut self, value: bool) -> Result<()>
pub fn get_pktinfo(&self) -> Result<bool>
pub fn add_membership(&mut self, group: u32) -> Result<()>
pub fn drop_membership(&mut self, group: u32) -> Result<()>
pub fn list_membership(&self) -> Vec<u32>
Sourcepub fn set_broadcast_error(&mut self, value: bool) -> Result<()>
pub fn set_broadcast_error(&mut self, value: bool) -> Result<()>
NETLINK_BROADCAST_ERROR
(since Linux 2.6.30). When not set, netlink_broadcast()
only
reports ESRCH
errors and silently ignore NOBUFS
errors.
pub fn get_broadcast_error(&self) -> Result<bool>
Sourcepub fn set_no_enobufs(&mut self, value: bool) -> Result<()>
pub fn set_no_enobufs(&mut self, value: bool) -> Result<()>
NETLINK_NO_ENOBUFS
(since Linux 2.6.30). This flag can be used by unicast and broadcast
listeners to avoid receiving ENOBUFS
errors.
pub fn get_no_enobufs(&self) -> Result<bool>
Sourcepub fn set_listen_all_namespaces(&mut self, value: bool) -> Result<()>
pub fn set_listen_all_namespaces(&mut self, value: bool) -> Result<()>
NETLINK_LISTEN_ALL_NSID
(since Linux 4.2). When set, this socket will receive netlink
notifications from all network namespaces that have an nsid assigned into the network
namespace where the socket has been opened. The nsid is sent to user space via an ancillary
data.
pub fn get_listen_all_namespaces(&self) -> Result<bool>
Sourcepub fn set_cap_ack(&mut self, value: bool) -> Result<()>
pub fn set_cap_ack(&mut self, value: bool) -> Result<()>
NETLINK_CAP_ACK
(since Linux 4.2). The kernel may fail to allocate the necessary room
for the acknowledgment message back to user space. This option trims off the payload of
the original netlink message. The netlink message header is still included, so the user can
guess from the sequence number which message triggered the acknowledgment.
pub fn get_cap_ack(&self) -> Result<bool>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Socket
impl RefUnwindSafe for Socket
impl Send for Socket
impl Sync for Socket
impl Unpin for Socket
impl UnwindSafe for Socket
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)