pub struct MctpSocket(/* private fields */);
Expand description
MCTP socket object.
Implementations§
Source§impl MctpSocket
impl MctpSocket
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new MCTP socket. This can then be used for send/receive operations.
Sourcepub fn recvfrom(&self, buf: &mut [u8]) -> Result<(usize, MctpSockAddr)>
pub fn recvfrom(&self, buf: &mut [u8]) -> Result<(usize, MctpSockAddr)>
Blocking receive from a socket, into buf
, returning a length
and source address
Essentially a wrapper around libc::recvfrom, using MCTP-specific addressing.
Sourcepub fn sendto(&self, buf: &[u8], addr: &MctpSockAddr) -> Result<usize>
pub fn sendto(&self, buf: &[u8], addr: &MctpSockAddr) -> Result<usize>
Blocking send to a socket, given a buffer and address, returning the number of bytes sent.
Essentially a wrapper around libc::sendto.
Sourcepub fn bind(&self, addr: &MctpSockAddr) -> Result<()>
pub fn bind(&self, addr: &MctpSockAddr) -> Result<()>
Bind the socket to a local address.
Sourcepub fn set_read_timeout(&self, dur: Option<Duration>) -> Result<()>
pub fn set_read_timeout(&self, dur: Option<Duration>) -> Result<()>
Set the read timeout.
A valid of None
will have no timeout.
Sourcepub fn read_timeout(&self) -> Result<Option<Duration>>
pub fn read_timeout(&self) -> Result<Option<Duration>>
Retrieves the read timeout
A value of None
indicates no timeout.
Trait Implementations§
Source§impl AsRawFd for MctpSocket
impl AsRawFd for MctpSocket
Auto Trait Implementations§
impl Freeze for MctpSocket
impl RefUnwindSafe for MctpSocket
impl Send for MctpSocket
impl Sync for MctpSocket
impl Unpin for MctpSocket
impl UnwindSafe for MctpSocket
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