[−][src]Trait smoltcp::phy::Device
An interface for sending and receiving raw network frames.
The interface is based on tokens, which are types that allow to receive/transmit a
single packet. The receive
and transmit
functions only construct such tokens, the
real sending/receiving operation are performed when the tokens are consumed.
Associated Types
Loading content...Required methods
fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)>
Construct a token pair consisting of one receive token and one transmit token.
The additional transmit token makes it possible to generate a reply packet based on the contents of the received packet. For example, this makes it possible to handle arbitrarily large ICMP echo ("ping") requests, where the all received bytes need to be sent back, without heap allocation.
fn transmit(&'a mut self) -> Option<Self::TxToken>
Construct a transmit token.
fn capabilities(&self) -> DeviceCapabilities
Get a description of device capabilities.
Implementors
impl<'a> Device<'a> for Loopback
[src]
type RxToken = RxToken
type TxToken = TxToken<'a>
fn capabilities(&self) -> DeviceCapabilities
[src]
fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)>
[src]
fn transmit(&'a mut self) -> Option<Self::TxToken>
[src]
impl<'a> Device<'a> for RawSocket
[src]
type RxToken = RxToken
type TxToken = TxToken
fn capabilities(&self) -> DeviceCapabilities
[src]
fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)>
[src]
fn transmit(&'a mut self) -> Option<Self::TxToken>
[src]
impl<'a> Device<'a> for TapInterface
[src]
type RxToken = RxToken
type TxToken = TxToken
fn capabilities(&self) -> DeviceCapabilities
[src]
fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)>
[src]
fn transmit(&'a mut self) -> Option<Self::TxToken>
[src]
impl<'a, D> Device<'a> for FaultInjector<D> where
D: for<'b> Device<'b>,
[src]
D: for<'b> Device<'b>,
type RxToken = RxToken<'a, <D as Device<'a>>::RxToken>
type TxToken = TxToken<'a, <D as Device<'a>>::TxToken>
fn capabilities(&self) -> DeviceCapabilities
[src]
fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)>
[src]
fn transmit(&'a mut self) -> Option<Self::TxToken>
[src]
impl<'a, D, FTx, FRx> Device<'a> for FuzzInjector<D, FTx, FRx> where
D: for<'b> Device<'b>,
FTx: Fuzzer + 'a,
FRx: Fuzzer + 'a,
[src]
D: for<'b> Device<'b>,
FTx: Fuzzer + 'a,
FRx: Fuzzer + 'a,
type RxToken = RxToken<'a, <D as Device<'a>>::RxToken, FRx>
type TxToken = TxToken<'a, <D as Device<'a>>::TxToken, FTx>
fn capabilities(&self) -> DeviceCapabilities
[src]
fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)>
[src]
fn transmit(&'a mut self) -> Option<Self::TxToken>
[src]
impl<'a, D, P> Device<'a> for Tracer<D, P> where
D: for<'b> Device<'b>,
P: PrettyPrint + 'a,
[src]
D: for<'b> Device<'b>,
P: PrettyPrint + 'a,
type RxToken = RxToken<<D as Device<'a>>::RxToken, P>
type TxToken = TxToken<<D as Device<'a>>::TxToken, P>
fn capabilities(&self) -> DeviceCapabilities
[src]
fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)>
[src]
fn transmit(&'a mut self) -> Option<Self::TxToken>
[src]
impl<'a, D, S> Device<'a> for PcapWriter<D, S> where
D: for<'b> Device<'b>,
S: PcapSink + Clone + 'a,
[src]
D: for<'b> Device<'b>,
S: PcapSink + Clone + 'a,