Struct smoltcp::iface::InterfaceBuilder [−][src]
pub struct InterfaceBuilder<'a, DeviceT: for<'d> Device<'d>> { /* fields omitted */ }
Expand description
A builder structure used for creating a network interface.
Implementations
pub fn new<SocketsT>(device: DeviceT, sockets: SocketsT) -> Self where
SocketsT: Into<ManagedSlice<'a, SocketStorage<'a>>>,
pub fn new<SocketsT>(device: DeviceT, sockets: SocketsT) -> Self where
SocketsT: Into<ManagedSlice<'a, SocketStorage<'a>>>,
Create a builder used for creating a network interface using the given device and address.
Examples
use smoltcp::iface::{InterfaceBuilder, NeighborCache};
use smoltcp::wire::{EthernetAddress, IpCidr, IpAddress};
let device = // ...
let hw_addr = // ...
let neighbor_cache = // ...
let ip_addrs = // ...
let iface = InterfaceBuilder::new(device, vec![])
.hardware_addr(hw_addr.into())
.neighbor_cache(neighbor_cache)
.ip_addrs(ip_addrs)
.finalize();
Set the random seed for this interface.
It is strongly recommended that the random seed is different on each boot, to avoid problems with TCP port/sequence collisions.
The seed doesn’t have to be cryptographically secure.
Set the Hardware address the interface will use. See also hardware_addr.
Panics
This function panics if the address is not unicast.
Set the IEEE802.15.4 PAN ID the interface will use.
NOTE: we use the same PAN ID for destination and source.
Enable or disable the AnyIP capability, allowing packets to be received locally on IPv4 addresses other than the interface’s configured ip_addrs. When AnyIP is enabled and a route prefix in routes specifies one of the interface’s ip_addrs as its gateway, the interface will accept packets addressed to that prefix.
IPv6
This option is not available or required for IPv6 as packets sent to the interface are not filtered by IPv6 address.
Set the IP routes the interface will use. See also routes.
pub fn ipv4_multicast_groups<T>(self, ipv4_multicast_groups: T) -> Self where
T: Into<ManagedMap<'a, Ipv4Address, ()>>,
pub fn ipv4_multicast_groups<T>(self, ipv4_multicast_groups: T) -> Self where
T: Into<ManagedMap<'a, Ipv4Address, ()>>,
Provide storage for multicast groups.
Join multicast groups by calling join_multicast_group()
on an Interface
.
Using join_multicast_group()
will send initial membership reports.
A previously destroyed interface can be recreated by reusing the multicast group
storage, i.e. providing a non-empty storage to ipv4_multicast_groups()
.
Note that this way initial membership reports are not sent.
Set the Neighbor Cache the interface will use.
Create a network interface using the previously provided configuration.
Panics
If a required option is not provided, this function will panic. Required options are: