Struct capsules_extra::net::udp::udp_port_table::UdpPortManager

source ·
pub struct UdpPortManager { /* private fields */ }
Expand description

The UdpPortManager maintains a reference to the port_array, which manages what ports are bound at any given moment, and user_ports, which provides a handle to userspace port bindings in the UDP driver.

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>,

§

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>,

§

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.