pub trait DeviceLayerEventDispatcher: DeviceLayerTypes + ReceiveQueueBindingsContext<LoopbackDeviceId<Self>> + TransmitQueueBindingsContext<EthernetDeviceId<Self>> + TransmitQueueBindingsContext<LoopbackDeviceId<Self>> + TransmitQueueBindingsContext<PureIpDeviceId<Self>> + Sized {
    type DequeueContext;

    // Required methods
    fn send_ethernet_frame(
        &mut self,
        device: &EthernetDeviceId<Self>,
        frame: Buf<Vec<u8>>,
        dequeue_context: Option<&mut Self::DequeueContext>,
    ) -> Result<(), DeviceSendFrameError>;
    fn send_ip_packet(
        &mut self,
        device: &PureIpDeviceId<Self>,
        packet: Buf<Vec<u8>>,
        ip_version: IpVersion,
        dequeue_context: Option<&mut Self::DequeueContext>,
    ) -> Result<(), DeviceSendFrameError>;
}
Expand description

An event dispatcher for the device layer.

Required Associated Types§

source

type DequeueContext

The transmit queue dequeueing context used by bindings.

DequeueContext is a passthrough type from bindings (i.e. entirely opaque to core) when using TransmitQueueApi to trigger the transmit queue to send frames to the underlying devices.

Required Methods§

source

fn send_ethernet_frame( &mut self, device: &EthernetDeviceId<Self>, frame: Buf<Vec<u8>>, dequeue_context: Option<&mut Self::DequeueContext>, ) -> Result<(), DeviceSendFrameError>

Send a frame to an Ethernet device driver.

See DeviceSendFrameError for the ways this call may fail; all other errors are silently ignored and reported as success. Implementations are expected to gracefully handle non-conformant but correctable input, e.g. by padding too-small frames.

dequeue_context is Some iff this is called from the context of operating the transmit queue via TransmitQueueApi.

source

fn send_ip_packet( &mut self, device: &PureIpDeviceId<Self>, packet: Buf<Vec<u8>>, ip_version: IpVersion, dequeue_context: Option<&mut Self::DequeueContext>, ) -> Result<(), DeviceSendFrameError>

Send an IP packet to an IP device driver.

See DeviceSendFrameError for the ways this call may fail; all other errors are silently ignored and reported as success. Implementations are expected to gracefully handle non-conformant but correctable input, e.g. by padding too-small frames.

dequeue_context is Some iff this is called from the context of operating the transmit queue via TransmitQueueApi.

Object Safety§

This trait is not object safe.

Implementors§