EtcPal  HEAD (unstable)
ETC Platform Abstraction Layer (EtcPal)
View other versions:
NetintInfo Class Reference

Overview

A wrapper class for the EtcPal netint info type.

Public Member Functions

constexpr NetintInfo (const EtcPalNetintInfo &c_info) noexcept
 Construct netint info copied from an instance of the C EtcPalNetintInfo type.
 
NetintInfooperator= (const EtcPalNetintInfo &c_info) noexcept
 Assign an instance of the C EtcPalNetintInfo type to an instance of this class.
 
constexpr const EtcPalNetintInfoget () const noexcept
 Get a const reference to the underlying C type.
 
constexpr NetintIndex index () const noexcept
 Get the OS-specific network interface number. More...
 
constexpr IpAddr addr () const noexcept
 Get the interface ip address.
 
constexpr IpAddr mask () const noexcept
 Get the subnet mask for this interface.
 
constexpr MacAddr mac () const noexcept
 Get the adapter MAC address.
 
std::string id () const noexcept
 Get the system name for the interface. More...
 
std::string friendly_name () const noexcept
 Get a user-friendly name for the interface. More...
 
constexpr bool is_default () const noexcept
 Determine whether this is the default network interface. More...
 
constexpr bool IsValid () const noexcept
 Determine whether this netint info is valid.
 
constexpr operator NetintIndex () const noexcept
 Enables implicit conversion to the interface index.
 

Member Function Documentation

◆ friendly_name()

std::string friendly_name ( ) const
inlinenoexcept

Get a user-friendly name for the interface.

On some systems, this is the same as the id field. Others allow users to create and change a friendly name for network interfaces that's different than the system name. This field should be used when printing the adapter list in a UI.

◆ id()

std::string id ( ) const
inlinenoexcept

Get the system name for the interface.

This name can be used as a primary key to identify a single network adapter. It will not change unless the adapter is removed or reconfigured. Since interfaces can have multiple IPv4 and IPv6 addresses assigned simultaneously, there can be a one-to-many relationship between physical network interfaces and EtcPalNetintInfo structures on the same system, all of which have the same value for this field.

◆ index()

constexpr NetintIndex index ( ) const
constexprnoexcept

Get the OS-specific network interface number.

Since interfaces can have multiple IPv4 and IPv6 addresses assigned simultaneously, there can be a one-to-many relationship between physical network interfaces and etcpal::NetintInfo descriptions on the same system, all of which will have the same value for this field. It is also used for IPv6, multicast and IP-version-neutral APIs. See Network Interface Indexes for more information.

◆ is_default()

constexpr bool is_default ( ) const
constexprnoexcept

Determine whether this is the default network interface.

The default network interface is defined as the network interface chosen for the default IP route on a system.

Returns
True if this is the default network interface, false otherwise.

The documentation for this class was generated from the following file: