[][src]Struct smoltcp::iface::EthernetInterface

pub struct EthernetInterface<'b, 'c, 'e, DeviceT: for<'d> Device<'d>> { /* 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<'b, 'c, 'e, DeviceT> Interface<'b, 'c, 'e, DeviceT> where
    DeviceT: for<'d> Device<'d>, 
[src]

pub fn ethernet_addr(&self) -> EthernetAddress[src]

Get the Ethernet address of the interface.

pub fn set_ethernet_addr(&mut self, addr: EthernetAddress)[src]

Set the Ethernet address of the interface.

Panics

This function panics if the address is not unicast.

pub fn device(&self) -> &DeviceT[src]

Get a reference to the inner device.

pub fn device_mut(&mut self) -> &mut DeviceT[src]

Get a mutable reference to the inner device.

There are no invariants imposed on the device by the interface itself. Furthermore the trait implementations, required for references of all lifetimes, guarantees that the mutable reference can not invalidate the device as such. For some devices, such access may still allow modifications with adverse effects on the usability as a phy device. You should not use them this way.

pub fn join_multicast_group<T: Into<IpAddress>>(
    &mut self,
    addr: T,
    _timestamp: Instant
) -> Result<bool>
[src]

Add an address to a list of subscribed multicast IP addresses.

Returns Ok(announce_sent) if the address was added successfully, where annouce_sent indicates whether an initial immediate announcement has been sent.

pub fn leave_multicast_group<T: Into<IpAddress>>(
    &mut self,
    addr: T,
    _timestamp: Instant
) -> Result<bool>
[src]

Remove an address from the subscribed multicast IP addresses.

Returns Ok(leave_sent) if the address was removed successfully, where leave_sent indicates whether an immediate leave packet has been sent.

pub fn has_multicast_group<T: Into<IpAddress>>(&self, addr: T) -> bool[src]

Check whether the interface listens to given destination multicast IP address.

pub fn ip_addrs(&self) -> &[IpCidr][src]

Get the IP addresses of the interface.

pub fn ipv4_addr(&self) -> Option<Ipv4Address>[src]

Get the first IPv4 address if present.

pub fn update_ip_addrs<F: FnOnce(&mut ManagedSlice<'c, IpCidr>)>(
    &mut self,
    f: F
)
[src]

Update the IP addresses of the interface.

Panics

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

pub fn has_ip_addr<T: Into<IpAddress>>(&self, addr: T) -> bool[src]

Check whether the interface has the given IP address assigned.

pub fn ipv4_address(&self) -> Option<Ipv4Address>[src]

Get the first IPv4 address of the interface.

pub fn routes(&self) -> &Routes<'e>[src]

pub fn routes_mut(&mut self) -> &mut Routes<'e>[src]

pub fn poll(
    &mut self,
    sockets: &mut SocketSet,
    timestamp: Instant
) -> Result<bool>
[src]

Transmit packets queued in the given sockets, and receive packets queued in the device.

This function returns a boolean value indicating whether any packets were processed or emitted, and thus, whether the readiness of any socket might have changed.

Errors

This method will routinely return errors in response to normal network activity as well as certain boundary conditions such as buffer exhaustion. These errors are provided as an aid for troubleshooting, and are meant to be logged and ignored.

As a special case, Err(Error::Unrecognized) is returned in response to packets containing any unsupported protocol, option, or form, which is a very common occurrence and on a production system it should not even be logged.

pub fn poll_at(
    &self,
    sockets: &SocketSet,
    timestamp: Instant
) -> Option<Instant>
[src]

Return a soft deadline for calling poll the next time. The Instant returned is the time at which you should call poll next. It is harmless (but wastes energy) to call it before the Instant, and potentially harmful (impacting quality of service) to call it after the Instant

pub fn poll_delay(
    &self,
    sockets: &SocketSet,
    timestamp: Instant
) -> Option<Duration>
[src]

Return an advisory wait time for calling poll the next time. The Duration returned is the time left to wait before calling poll next. It is harmless (but wastes energy) to call it before the Duration has passed, and potentially harmful (impacting quality of service) to call it after the Duration has passed.

Auto Trait Implementations

impl<'b, 'c, 'e, DeviceT> RefUnwindSafe for Interface<'b, 'c, 'e, DeviceT> where
    DeviceT: RefUnwindSafe

impl<'b, 'c, 'e, DeviceT> Send for Interface<'b, 'c, 'e, DeviceT> where
    DeviceT: Send

impl<'b, 'c, 'e, DeviceT> Sync for Interface<'b, 'c, 'e, DeviceT> where
    DeviceT: Sync

impl<'b, 'c, 'e, DeviceT> Unpin for Interface<'b, 'c, 'e, DeviceT> where
    DeviceT: Unpin

impl<'b, 'c, 'e, DeviceT> !UnwindSafe for Interface<'b, 'c, 'e, DeviceT>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.