Trait virtual_net::VirtualRawSocket
source · pub trait VirtualRawSocket: VirtualSocket + Debug + Send + Sync + 'static {
// Required methods
fn poll_send(
&mut self,
cx: &mut Context<'_>,
data: &[u8]
) -> Poll<Result<usize>>;
fn try_send(&mut self, data: &[u8]) -> Result<usize>;
fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>;
fn try_flush(&mut self) -> Result<()>;
fn poll_recv(
&mut self,
cx: &mut Context<'_>,
buf: &mut [MaybeUninit<u8>]
) -> Poll<Result<usize>>;
fn try_recv(&mut self, buf: &mut [MaybeUninit<u8>]) -> Result<usize>;
fn set_promiscuous(&mut self, promiscuous: bool) -> Result<()>;
fn promiscuous(&self) -> Result<bool>;
}
Required Methods§
sourcefn poll_send(
&mut self,
cx: &mut Context<'_>,
data: &[u8]
) -> Poll<Result<usize>>
fn poll_send( &mut self, cx: &mut Context<'_>, data: &[u8] ) -> Poll<Result<usize>>
Sends out a datagram or stream of bytes on this socket
sourcefn try_send(&mut self, data: &[u8]) -> Result<usize>
fn try_send(&mut self, data: &[u8]) -> Result<usize>
Sends out a datagram or stream of bytes on this socket
sourcefn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
Attempts to flush the object, ensuring that any buffered data reach their destination.
sourcefn try_flush(&mut self) -> Result<()>
fn try_flush(&mut self) -> Result<()>
Attempts to flush the object, ensuring that any buffered data reach their destination.
sourcefn poll_recv(
&mut self,
cx: &mut Context<'_>,
buf: &mut [MaybeUninit<u8>]
) -> Poll<Result<usize>>
fn poll_recv( &mut self, cx: &mut Context<'_>, buf: &mut [MaybeUninit<u8>] ) -> Poll<Result<usize>>
Recv a packet from the socket
sourcefn try_recv(&mut self, buf: &mut [MaybeUninit<u8>]) -> Result<usize>
fn try_recv(&mut self, buf: &mut [MaybeUninit<u8>]) -> Result<usize>
Recv a packet from the socket
sourcefn set_promiscuous(&mut self, promiscuous: bool) -> Result<()>
fn set_promiscuous(&mut self, promiscuous: bool) -> Result<()>
Tells the raw socket and its backing switch that all packets should be received by this socket even if they are not destined for this device
sourcefn promiscuous(&self) -> Result<bool>
fn promiscuous(&self) -> Result<bool>
Returns if the socket is running in promiscuous mode whereby it will receive all packets even if they are not destined for the local interface