capsules_extra::net::udp::udp_port_table

Struct UdpPortManager

Source
pub struct UdpPortManager { /* private fields */ }
Expand description

Maps bound ports to userspace port bindings.

Implementations§

Source§

impl UdpPortManager

Source

pub fn new( _cap: &dyn CreatePortTableCapability, used_kernel_ports: &'static mut [Option<SocketBindingEntry>], udp_vis: &'static UdpVisibilityCapability, ) -> UdpPortManager

Source

pub fn set_user_ports( &self, user_ports_ref: &'static dyn PortQuery, _driver_cap: &dyn UdpDriverCapability, )

Source

pub fn create_socket(&'static self) -> Result<UdpSocket, Result<(), ErrorCode>>

Called by capsules that would like to eventually be able to bind to a UDP port. This call will succeed unless MAX_NUM_BOUND_PORTS capsules have already bound to a port.

Source

pub fn is_bound(&self, port: u16) -> Result<bool, ()>

Check if a given port is already bound, by either an app or capsule.

Source

pub fn bind( &self, socket: UdpSocket, port: u16, net_cap: &'static NetworkCapability, ) -> Result<(UdpPortBindingTx, UdpPortBindingRx), UdpSocket>

Called by capsules that have already reserved a socket to attempt to bind to a UDP port. The socket is passed by value. On success, bindings is returned. On failure, the same UdpSocket is returned.

Source

pub fn unbind( &'static self, sender_binding: UdpPortBindingTx, receiver_binding: UdpPortBindingRx, ) -> Result<UdpSocket, (UdpPortBindingTx, UdpPortBindingRx)>

Disassociate the port from the given binding. Return the socket associated with the passed bindings. On Err, return the passed bindings.

Trait Implementations§

Source§

impl Debug for UdpPortManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.