nl::Inet::InterfaceAddressIterator

#include <src/inet/InetInterface.h>

Iterator for the list of system network interface IP addresses.

Summary

Use objects of this class to iterate the list of system network interface interface IP addresses.

On LwIP systems, it is recommended that the LwIP stack lock be acquired and not released over the entire lifetime of an object of this class.

Inheritance

Inherits from: nl::Inet::InterfaceIteratorBasis

Constructors and Destructors

InterfaceAddressIterator(void)
Conventional default constructor.
~InterfaceAddressIterator(void)
Non-virtual destructor.

Public functions

GetAddress(void)
Extract the current interface IP address.
GetIPv6PrefixLength(void)
uint8_t
Extract the length of the subnet prefix for the current network interface IPv6 address.
Next(void)
bool
Advance the cursor to the next network interface IP address.

Public functions

GetAddress

IPAddress GetAddress(
  void
)

Extract the current interface IP address.

On LwIP, this method must be called with the LwIP stack lock acquired.

Details
Returns
The current interface IP address, or IPAddress::Any if advanced beyond the end of the list.

GetIPv6PrefixLength

uint8_t GetIPv6PrefixLength(
  void
)

Extract the length of the subnet prefix for the current network interface IPv6 address.

On LwIP, this method simply returns the hard-coded constant 64.

Details
Returns
length of the subnet prefix for the current IPv6 address, or zero if the current address is IPv4 or the iterator has advanced beyond the end of the list.

Note Well: the standard subnet prefix on all links other than PPP links is 64 bits. On PPP links and some non-broadcast multipoint access links, the convention is either 127 bits or 128 bits, but it might be something else. On most platforms, the system's interface address structure can represent arbitrary prefix lengths between 0 and 128.

InterfaceAddressIterator

 InterfaceAddressIterator(
  void
)

Conventional default constructor.

Starts the cursor at the first network interface. On some platforms, this constructor may allocate resources recycled by the destructor.

On LwIP, this constructor must be called with the LwIP stack lock acquired.

Next

bool Next(
  void
)

Advance the cursor to the next network interface IP address.

Advances the internal cursor either to the next network interface address or to the distinguished position corresponding to no further interface addresses.

Details
Returns
false if advanced beyond the end, else true.

On LwIP, this method must be called with the LwIP stack lock acquired.

~InterfaceAddressIterator

 ~InterfaceAddressIterator(
  void
)

Non-virtual destructor.

Recycles any resources allocated by the constructor.

On LwIP, this destructor must be called with the LwIP stack lock acquired.