netstack3_core::device

Trait DeviceLayerEventDispatcher

Source
pub trait DeviceLayerEventDispatcher:
    Sized
    + DeviceLayerTypes
    + ReceiveQueueBindingsContext<BaseDeviceId<LoopbackDevice, Self>>
    + TransmitQueueBindingsContext<BaseDeviceId<EthernetLinkDevice, Self>>
    + TransmitQueueBindingsContext<BaseDeviceId<LoopbackDevice, Self>>
    + TransmitQueueBindingsContext<BaseDeviceId<PureIpDevice, Self>> {
    type DequeueContext;

    // Required methods
    fn send_ethernet_frame(
        &mut self,
        device: &BaseDeviceId<EthernetLinkDevice, Self>,
        frame: Buf<Vec<u8>>,
        dequeue_context: Option<&mut Self::DequeueContext>,
    ) -> Result<(), DeviceSendFrameError>;
    fn send_ip_packet(
        &mut self,
        device: &BaseDeviceId<PureIpDevice, 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: &BaseDeviceId<EthernetLinkDevice, 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: &BaseDeviceId<PureIpDevice, 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§