capsules_extra::net::udp

Module udp_send

Source
Expand description

Definition and implementation for a virtualized UDP sending interface.

The UDPSender trait provides an interface for kernel capsules to send a UDP packet, and the UDPSendClient trait is implemented by upper layer clients to allow them to receive send_done callbacks once transmission has completed.

In order to virtualize between both apps and kernel capsules, this file uses a MuxUdpSender which treats the userspace UDP driver as a kernel capsule with a special capability that allows it to bind to arbitrary ports. Therefore the correctness of port binding / packet transmission/delivery is also dependent on the port binding logic in the driver being correct.

The MuxUdpSender acts as a FIFO queue for transmitted packets, with each capsule being allowed a single outstanding / unsent packet at a time.

Because the userspace driver is viewed by the MuxUdpSender as being a single capsule, the userspace driver must queue app packets on its own, as it can only pass a single packet to the MuxUdpSender queue at a time.

Structs§

  • This is a specific instantiation of the UDPSender trait. Note that this struct contains a reference to an IP6Sender which it forwards packets to (and receives callbacks from).

Traits§

  • The send_done function in this trait is invoked after the UDPSender has completed sending the requested packet. Note that the UDPSender::set_client method must be called to set the client.
  • This trait represents the bulk of the UDP functionality.