[−][src]Struct smoltcp::socket::RawSocket
A raw IP socket.
A raw socket is bound to a specific IP protocol, and owns transmit and receive packet buffers.
Methods
impl<'a, 'b> RawSocket<'a, 'b>
[src]
pub fn new(
ip_version: IpVersion,
ip_protocol: IpProtocol,
rx_buffer: RawSocketBuffer<'a, 'b>,
tx_buffer: RawSocketBuffer<'a, 'b>
) -> RawSocket<'a, 'b>
[src]
ip_version: IpVersion,
ip_protocol: IpProtocol,
rx_buffer: RawSocketBuffer<'a, 'b>,
tx_buffer: RawSocketBuffer<'a, 'b>
) -> RawSocket<'a, 'b>
Create a raw IP socket bound to the given IP version and datagram protocol, with the given buffers.
pub fn handle(&self) -> SocketHandle
[src]
Return the socket handle.
pub fn ip_version(&self) -> IpVersion
[src]
Return the IP version the socket is bound to.
pub fn ip_protocol(&self) -> IpProtocol
[src]
Return the IP protocol the socket is bound to.
pub fn can_send(&self) -> bool
[src]
Check whether the transmit buffer is full.
pub fn can_recv(&self) -> bool
[src]
Check whether the receive buffer is not empty.
pub fn packet_recv_capacity(&self) -> usize
[src]
Return the maximum number packets the socket can receive.
pub fn packet_send_capacity(&self) -> usize
[src]
Return the maximum number packets the socket can transmit.
pub fn payload_recv_capacity(&self) -> usize
[src]
Return the maximum number of bytes inside the recv buffer.
pub fn payload_send_capacity(&self) -> usize
[src]
Return the maximum number of bytes inside the transmit buffer.
pub fn send(&mut self, size: usize) -> Result<&mut [u8]>
[src]
Enqueue a packet to send, and return a pointer to its payload.
This function returns Err(Error::Exhausted)
if the transmit buffer is full,
and Err(Error::Truncated)
if there is not enough transmit buffer capacity
to ever send this packet.
If the buffer is filled in a way that does not match the socket's IP version or protocol, the packet will be silently dropped.
Note: The IP header is parsed and reserialized, and may not match the header actually transmitted bit for bit.
pub fn send_slice(&mut self, data: &[u8]) -> Result<()>
[src]
Enqueue a packet to send, and fill it from a slice.
See also send.
pub fn recv(&mut self) -> Result<&[u8]>
[src]
Dequeue a packet, and return a pointer to the payload.
This function returns Err(Error::Exhausted)
if the receive buffer is empty.
Note: The IP header is parsed and reserialized, and may not match the header actually received bit for bit.
pub fn recv_slice(&mut self, data: &mut [u8]) -> Result<usize>
[src]
Dequeue a packet, and copy the payload into the given slice.
See also recv.
Trait Implementations
impl<'a, 'b> AnySocket<'a, 'b> for RawSocket<'a, 'b>
[src]
impl<'a, 'b: 'a> Debug for RawSocket<'a, 'b>
[src]
impl<'a, 'b> Into<Socket<'a, 'b>> for RawSocket<'a, 'b>
[src]
Auto Trait Implementations
impl<'a, 'b> RefUnwindSafe for RawSocket<'a, 'b>
impl<'a, 'b> Send for RawSocket<'a, 'b>
impl<'a, 'b> Sync for RawSocket<'a, 'b>
impl<'a, 'b> Unpin for RawSocket<'a, 'b>
impl<'a, 'b> !UnwindSafe for RawSocket<'a, 'b>
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>,