pub struct InterfaceBuilder<'a, DeviceT: for<'d> Device<'d>> { /* private fields */ }
Expand description

A builder structure used for creating a network interface.

Implementations§

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.

Set the IP addresses the interface will use. See also ip_addrs.

Panics

This function panics if any of the addresses are not unicast.

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.

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:

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.