Struct smoltcp::iface::EthernetInterface
[−]
[src]
pub struct EthernetInterface<'a, 'b, 'c, DeviceT: Device + 'a> { /* fields omitted */ }
An Ethernet network interface.
The network interface logically owns a number of other data structures; to avoid
a dependency on heap allocation, it instead owns a BorrowMut<[T]>
, which can be
a &mut [T]
, or Vec<T>
if a heap is available.
Methods
impl<'a, 'b, 'c, DeviceT: Device + 'a> Interface<'a, 'b, 'c, DeviceT>
[src]
fn new<DeviceMT, ArpCacheMT, ProtocolAddrsMT>(
device: DeviceMT,
arp_cache: ArpCacheMT,
hardware_addr: EthernetAddress,
protocol_addrs: ProtocolAddrsMT
) -> Interface<'a, 'b, 'c, DeviceT> where
DeviceMT: Into<Managed<'a, DeviceT>>,
ArpCacheMT: Into<Managed<'b, ArpCache>>,
ProtocolAddrsMT: Into<ManagedSlice<'c, IpAddress>>,
[src]
device: DeviceMT,
arp_cache: ArpCacheMT,
hardware_addr: EthernetAddress,
protocol_addrs: ProtocolAddrsMT
) -> Interface<'a, 'b, 'c, DeviceT> where
DeviceMT: Into<Managed<'a, DeviceT>>,
ArpCacheMT: Into<Managed<'b, ArpCache>>,
ProtocolAddrsMT: Into<ManagedSlice<'c, IpAddress>>,
Create a network interface using the provided network device.
Panics
See the restrictions on set_hardware_addr and set_protocol_addrs functions.
fn hardware_addr(&self) -> EthernetAddress
[src]
Get the hardware address of the interface.
fn set_hardware_addr(&mut self, addr: EthernetAddress)
[src]
Set the hardware address of the interface.
Panics
This function panics if the address is not unicast.
fn protocol_addrs(&self) -> &[IpAddress]
[src]
Get the protocol addresses of the interface.
fn update_protocol_addrs<F: FnOnce(&mut ManagedSlice<'c, IpAddress>)>(
&mut self,
f: F
)
[src]
&mut self,
f: F
)
Update the protocol addresses of the interface.
Panics
This function panics if any of the addresses is not unicast.
fn has_protocol_addr<T: Into<IpAddress>>(&self, addr: T) -> bool
[src]
Check whether the interface has the given protocol address assigned.
fn poll(
&mut self,
sockets: &mut SocketSet,
timestamp: u64
) -> Result<Option<u64>>
[src]
&mut self,
sockets: &mut SocketSet,
timestamp: u64
) -> Result<Option<u64>>
Transmit packets queued in the given sockets, and receive packets queued in the device.
The timestamp must be a number of milliseconds, monotonically increasing since an arbitrary moment in time, such as system startup.
This function returns a soft deadline for calling it the next time.
That is, if iface.poll(&mut sockets, 1000)
returns Ok(Some(2000))
,
it harmless (but wastes energy) to call it 500 ms later, and potentially
harmful (impacting quality of service) to call it 1500 ms later.