pub struct UDPDriver<'a> { /* private fields */ }
Implementations§
Source§impl<'a> UDPDriver<'a>
impl<'a> UDPDriver<'a>
pub fn new( sender: &'a dyn UDPSender<'a>, grant: Grant<App, UpcallCount<{ upcall::COUNT }>, AllowRoCount<{ ro_allow::COUNT }>, AllowRwCount<{ rw_allow::COUNT }>>, interface_list: &'static [IPAddr], max_tx_pyld_len: usize, port_table: &'static UdpPortManager, kernel_buffer: SubSliceMut<'static, u8>, driver_send_cap: &'static dyn UdpDriverCapability, net_cap: &'static NetworkCapability, ) -> UDPDriver<'a>
Trait Implementations§
Source§impl SyscallDriver for UDPDriver<'_>
impl SyscallDriver for UDPDriver<'_>
Source§fn command(
&self,
command_num: usize,
arg1: usize,
_: usize,
processid: ProcessId,
) -> CommandReturn
fn command( &self, command_num: usize, arg1: usize, _: usize, processid: ProcessId, ) -> CommandReturn
UDP control
§command_num
0
: Driver existence check.1
: Get the interface list app_cfg (out): 16 *n
bytes: the list of interface IPv6 addresses, length limited byapp_cfg
length. Returns INVAL if the cfg buffer is the wrong size, or not available.2
: Transmit payload. Returns BUSY is this process already has a pending tx. Returns INVAL if no valid buffer has been loaded into the write buffer, or if the config buffer is the wrong length, or if the destination and source port/address pairs cannot be parsed. Otherwise, returns the result of do_next_tx_immediate(). Notably, a successful transmit can produce two different success values. If success is returned, this simply means that the packet was queued. In this case, the app still still needs to wait for a callback to check if any errors occurred before the packet was passed to the radio. However, if Success_U32 is returned with value 1, this means the the packet was successfully passed the radio without any errors, which tells the userland application that it does not need to wait for a callback to check if any errors occurred while the packet was being passed down to the radio. Any successful return value indicates that the app should wait for a send_done() callback before attempting to queue another packet. Currently, only will transmit if the app has bound to the port passed in the tx_cfg buf as the source address. If no port is bound, returns RESERVE, if it tries to send on a port other than the port which is bound, returns INVALID. Notably, the currently transmit implementation allows for starvation - an an app with a lower app id can send constantly and starve an app with a later ID.3
: Bind to the address in rx_cfg. Returns Ok(()) if that addr/port combo is free, returns INVAL if the address requested is not a local interface, or if the port requested is 0. Returns BUSY if that port is already bound to by another app. This command should be called after allow() is called on the rx_cfg buffer, and before subscribe() is used to set up the recv callback. Additionally, apps can only send on ports after they have bound to said port. If this command is called and the address in rx_cfg is 0::0 : 0, this command will reset the option containing the bound port to None. Notably, the current implementation of this only allows for each app to bind to a single port at a time, as such an implementation conserves memory (and is similar to the approach applied by TinyOS and Riot). /// -4
: Returns the maximum payload that can be transmitted by apps using this driver. This represents the size of the payload buffer in the kernel. Apps can use this syscall to ensure they do not attempt to send too-large messages.
Source§fn allocate_grant(&self, processid: ProcessId) -> Result<(), Error>
fn allocate_grant(&self, processid: ProcessId) -> Result<(), Error>
Request to allocate a capsule’s grant for a specific process. Read more
Source§fn allow_userspace_readable(
&self,
app: ProcessId,
which: usize,
slice: ReadWriteProcessBuffer,
) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>
fn allow_userspace_readable( &self, app: ProcessId, which: usize, slice: ReadWriteProcessBuffer, ) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>
System call for a process to pass a buffer (a
UserspaceReadableProcessBuffer
) to the kernel that the kernel can
either read or write. The kernel calls this method only after it checks
that the entire buffer is within memory the process can both read and
write. Read moreSource§impl UDPRecvClient for UDPDriver<'_>
impl UDPRecvClient for UDPDriver<'_>
Auto Trait Implementations§
impl<'a> !Freeze for UDPDriver<'a>
impl<'a> !RefUnwindSafe for UDPDriver<'a>
impl<'a> !Send for UDPDriver<'a>
impl<'a> !Sync for UDPDriver<'a>
impl<'a> Unpin for UDPDriver<'a>
impl<'a> !UnwindSafe for UDPDriver<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more