pub struct UdpPortManager { /* private fields */ }
Expand description
Maps bound ports to userspace port bindings.
Implementations§
Source§impl UdpPortManager
impl UdpPortManager
pub fn new( _cap: &dyn CreatePortTableCapability, used_kernel_ports: &'static mut [Option<SocketBindingEntry>], udp_vis: &'static UdpVisibilityCapability, ) -> UdpPortManager
pub fn set_user_ports( &self, user_ports_ref: &'static dyn PortQuery, _driver_cap: &dyn UdpDriverCapability, )
Sourcepub fn create_socket(&'static self) -> Result<UdpSocket, Result<(), ErrorCode>>
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.
Sourcepub fn is_bound(&self, port: u16) -> Result<bool, ()>
pub fn is_bound(&self, port: u16) -> Result<bool, ()>
Check if a given port is already bound, by either an app or capsule.
Sourcepub fn bind(
&self,
socket: UdpSocket,
port: u16,
net_cap: &'static NetworkCapability,
) -> Result<(UdpPortBindingTx, UdpPortBindingRx), UdpSocket>
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.
Sourcepub fn unbind(
&'static self,
sender_binding: UdpPortBindingTx,
receiver_binding: UdpPortBindingRx,
) -> Result<UdpSocket, (UdpPortBindingTx, UdpPortBindingRx)>
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§
Auto Trait Implementations§
impl !Freeze for UdpPortManager
impl !RefUnwindSafe for UdpPortManager
impl !Send for UdpPortManager
impl !Sync for UdpPortManager
impl Unpin for UdpPortManager
impl !UnwindSafe for UdpPortManager
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