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_ethernet_frame(
&mut self,
device: &EthernetDeviceId<Self>,
frame: Buf<Vec<u8>>
) -> Result<(), DeviceSendFrameError<Buf<Vec<u8>>>>;
fn send_ip_packet(
&mut self,
device: &PureIpDeviceId<Self>,
packet: Buf<Vec<u8>>,
ip_version: IpVersion
) -> 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_ethernet_frame(
&mut self,
device: &EthernetDeviceId<Self>,
frame: Buf<Vec<u8>>
) -> Result<(), DeviceSendFrameError<Buf<Vec<u8>>>>
fn send_ethernet_frame( &mut self, device: &EthernetDeviceId<Self>, frame: Buf<Vec<u8>> ) -> Result<(), DeviceSendFrameError<Buf<Vec<u8>>>>
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.
sourcefn send_ip_packet(
&mut self,
device: &PureIpDeviceId<Self>,
packet: Buf<Vec<u8>>,
ip_version: IpVersion
) -> Result<(), DeviceSendFrameError<Buf<Vec<u8>>>>
fn send_ip_packet( &mut self, device: &PureIpDeviceId<Self>, packet: Buf<Vec<u8>>, ip_version: IpVersion ) -> Result<(), DeviceSendFrameError<Buf<Vec<u8>>>>
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.