[][src]Trait smoltcp::phy::Device

pub trait Device<'a> {
    type RxToken: RxToken + 'a;
    type TxToken: TxToken + 'a;
    pub fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)>;
pub fn transmit(&'a mut self) -> Option<Self::TxToken>;
pub fn capabilities(&self) -> DeviceCapabilities; }

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

pub fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)>[src]

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.

pub fn transmit(&'a mut self) -> Option<Self::TxToken>[src]

Construct a transmit token.

pub fn capabilities(&self) -> DeviceCapabilities[src]

Get a description of device capabilities.

Loading content...

Implementors

impl<'a> Device<'a> for Loopback[src]

type RxToken = RxToken

type TxToken = TxToken<'a>

impl<'a> Device<'a> for RawSocket[src]

type RxToken = RxToken

type TxToken = TxToken

impl<'a> Device<'a> for TapInterface[src]

type RxToken = RxToken

type TxToken = TxToken

impl<'a, D> Device<'a> for FaultInjector<D> where
    D: for<'b> Device<'b>, 
[src]

type RxToken = RxToken<'a, <D as Device<'a>>::RxToken>

type TxToken = TxToken<'a, <D as Device<'a>>::TxToken>

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]

type RxToken = RxToken<'a, <D as Device<'a>>::RxToken, FRx>

type TxToken = TxToken<'a, <D as Device<'a>>::TxToken, FTx>

impl<'a, D, P> Device<'a> for Tracer<D, P> where
    D: for<'b> Device<'b>,
    P: PrettyPrint + 'a, 
[src]

type RxToken = RxToken<<D as Device<'a>>::RxToken, P>

type TxToken = TxToken<<D as Device<'a>>::TxToken, P>

impl<'a, D, S> Device<'a> for PcapWriter<D, S> where
    D: for<'b> Device<'b>,
    S: PcapSink + Clone + 'a, 
[src]

type RxToken = RxToken<<D as Device<'a>>::RxToken, S>

type TxToken = TxToken<<D as Device<'a>>::TxToken, S>

Loading content...