pub struct NetworkStack<'a, Device, Clock>{ /* private fields */ }
Expand description
Network abstraction layer for smoltcp.
Implementations§
Source§impl<'a, Device, Clock> NetworkStack<'a, Device, Clock>
impl<'a, Device, Clock> NetworkStack<'a, Device, Clock>
Sourcepub fn new(
stack: Interface,
device: Device,
sockets: SocketSet<'a>,
clock: Clock,
) -> Self
pub fn new( stack: Interface, device: Device, sockets: SocketSet<'a>, clock: Clock, ) -> Self
Construct a new network stack.
§Note
This implementation only supports up to 16 usable sockets.
Any handles provided to this function must not be used after constructing the network stack.
This implementation currently only supports IPv4.
§Args
stack
- The ethernet interface to construct the network stack from.clock
- A clock to use for determining network time.
§Returns
A embedded_nal compatible network stack.
Sourcepub fn seed_random_port(&mut self, seed: &[u8])
pub fn seed_random_port(&mut self, seed: &[u8])
Seed the TCP port randomizer.
§Args
seed
- A seed of random data to use for randomizing local TCP port selection.
Sourcepub fn poll(&mut self) -> Result<bool, Error>
pub fn poll(&mut self) -> Result<bool, Error>
Poll the network stack for potential updates.
§Returns
A boolean indicating if the network stack updated in any way.
Sourcepub fn close_sockets(&mut self)
pub fn close_sockets(&mut self)
Force-close all sockets.
Sourcepub fn handle_link_reset(&mut self)
pub fn handle_link_reset(&mut self)
Handle a disconnection of the physical interface.
Sourcepub fn interface_mut(&mut self) -> &mut Interface
pub fn interface_mut(&mut self) -> &mut Interface
Mutably access the underlying network interface.
§Note
Modification of the underlying network interface may unintentionally interfere with operation of this library (e.g. through reset, modification of IP addresses, etc.). Mutable access to the interface should be done with care.