pub trait DeviceLayerEventDispatcher: DeviceLayerTypes + Sized {
// Required methods
fn wake_rx_task(&mut self, device: &LoopbackDeviceId<Self>);
fn wake_tx_task(&mut self, device: &DeviceId<Self>);
fn send_frame(
&mut self,
device: &EthernetDeviceId<Self>,
frame: Buf<Vec<u8>>
) -> Result<(), DeviceSendFrameError<Buf<Vec<u8>>>>;
}
Expand description
An event dispatcher for the device layer.
See the EventDispatcher
trait in the crate root for more details.
Required Methods§
sourcefn wake_rx_task(&mut self, device: &LoopbackDeviceId<Self>)
fn wake_rx_task(&mut self, device: &LoopbackDeviceId<Self>)
Signals to the dispatcher that RX frames are available and ready to be
handled by handle_queued_rx_packets
.
Implementations must make sure that handle_queued_rx_packets
is
scheduled to be called as soon as possible so that enqueued RX frames
are promptly handled.
sourcefn wake_tx_task(&mut self, device: &DeviceId<Self>)
fn wake_tx_task(&mut self, device: &DeviceId<Self>)
Signals to the dispatcher that TX frames are available and ready to be
sent by transmit_queued_tx_frames
.
Implementations must make sure that transmit_queued_tx_frames
is
scheduled to be called as soon as possible so that enqueued TX frames
are promptly sent.
sourcefn send_frame(
&mut self,
device: &EthernetDeviceId<Self>,
frame: Buf<Vec<u8>>
) -> Result<(), DeviceSendFrameError<Buf<Vec<u8>>>>
fn send_frame( &mut self, device: &EthernetDeviceId<Self>, frame: Buf<Vec<u8>> ) -> Result<(), DeviceSendFrameError<Buf<Vec<u8>>>>
Send a frame to a device driver.
If there was an MTU error while attempting to serialize the frame, the
original buffer is returned in the Err
variant. All other errors (for
example, errors in allocating a buffer) 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.