Struct smoltcp::socket::RawSocket
[−]
[src]
pub struct RawSocket<'a, 'b: 'a> { /* fields omitted */ }
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]
fn new(
ip_version: IpVersion,
ip_protocol: IpProtocol,
rx_buffer: SocketBuffer<'a, 'b>,
tx_buffer: SocketBuffer<'a, 'b>
) -> Socket<'a, 'b>
[src]
ip_version: IpVersion,
ip_protocol: IpProtocol,
rx_buffer: SocketBuffer<'a, 'b>,
tx_buffer: SocketBuffer<'a, 'b>
) -> Socket<'a, 'b>
Create a raw IP socket bound to the given IP version and datagram protocol, with the given buffers.
fn debug_id(&self) -> usize
[src]
Return the debug identifier.
fn set_debug_id(&mut self, id: usize)
[src]
Set the debug identifier.
The debug identifier is a number printed in socket trace messages. It could as well be used by the user code.
fn ip_version(&self) -> IpVersion
[src]
Return the IP version the socket is bound to.
fn ip_protocol(&self) -> IpProtocol
[src]
Return the IP protocol the socket is bound to.
fn can_send(&self) -> bool
[src]
Check whether the transmit buffer is full.
fn can_recv(&self) -> bool
[src]
Check whether the receive buffer is not empty.
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 size is greater than
the transmit packet buffer size.
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.
fn send_slice(&mut self, data: &[u8]) -> Result<()>
[src]
Enqueue a packet to send, and fill it from a slice.
See also send.
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.
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.