RAVENNAKIT
Loading...
Searching...
No Matches
rav::NetworkInterfaceConfig Class Reference

#include <network_interface_config.hpp>

Public Member Functions

void set_interface (const size_t rank, const NetworkInterface::Identifier &identifier)
 Sets a network interface by its rank.
const NetworkInterface::Identifier * get_interface_for_rank (const size_t rank) const
 Gets a network interface by its rank.
ip_address_v4 get_interface_ipv4_address (const size_t rank) const
std::vector< ip_address_v4 > get_interface_ipv4_addresses () const
bool empty () const
 Checks if the configuration is empty.
std::string to_string () const
template<size_t N>
std::array< ip_address_v4, N > get_array_of_interface_addresses () const

Public Attributes

std::vector< NetworkInterface::Identifier > interfaces

Friends

bool operator== (const NetworkInterfaceConfig &lhs, const NetworkInterfaceConfig &rhs)
bool operator!= (const NetworkInterfaceConfig &lhs, const NetworkInterfaceConfig &rhs)

Detailed Description

Definition at line 37 of file network_interface_config.hpp.

Member Function Documentation

◆ empty()

bool rav::NetworkInterfaceConfig::empty ( ) const
inlinenodiscard

Checks if the configuration is empty.

Returns
True if there are no interfaces configured, false otherwise.

Definition at line 107 of file network_interface_config.hpp.

◆ get_array_of_interface_addresses()

template<size_t N>
std::array< ip_address_v4, N > rav::NetworkInterfaceConfig::get_array_of_interface_addresses ( ) const
inline
Template Parameters
NThe size of the array.
Returns
An array of addresses of the interfaces, ordered by rank.

Definition at line 135 of file network_interface_config.hpp.

◆ get_interface_for_rank()

const NetworkInterface::Identifier * rav::NetworkInterfaceConfig::get_interface_for_rank ( const size_t rank) const
inlinenodiscard

Gets a network interface by its rank.

Parameters
rankThe rank (index) of the network interface.
Returns
A pointer to the network interface identifier if found, or nullptr if not found.

Definition at line 66 of file network_interface_config.hpp.

◆ get_interface_ipv4_address()

ip_address_v4 rav::NetworkInterfaceConfig::get_interface_ipv4_address ( const size_t rank) const
inlinenodiscard
Returns
The first IPv4 address of one of the network interfaces. The address will be unspecified if the interface is not found or if it has no IPv4 address.

Definition at line 77 of file network_interface_config.hpp.

◆ get_interface_ipv4_addresses()

std::vector< ip_address_v4 > rav::NetworkInterfaceConfig::get_interface_ipv4_addresses ( ) const
inlinenodiscard
Returns
A vector of all network interfaces and their first IPv4 address. The address will be unspecified if the interface has no IPv4 address or is not set.

Definition at line 92 of file network_interface_config.hpp.

◆ set_interface()

void rav::NetworkInterfaceConfig::set_interface ( const size_t rank,
const NetworkInterface::Identifier & identifier )
inline

Sets a network interface by its rank.

Parameters
rankThe rank (index) of the network interface.
identifierThe identifier of the network interface. Pas an empty identifier to clear the interface.

Definition at line 54 of file network_interface_config.hpp.

◆ to_string()

std::string rav::NetworkInterfaceConfig::to_string ( ) const
inlinenodiscard
Returns
A string representation of the network interface configuration.

Definition at line 114 of file network_interface_config.hpp.

◆ operator!=

bool operator!= ( const NetworkInterfaceConfig & lhs,
const NetworkInterfaceConfig & rhs )
friend

Definition at line 45 of file network_interface_config.hpp.

◆ operator==

bool operator== ( const NetworkInterfaceConfig & lhs,
const NetworkInterfaceConfig & rhs )
friend

Definition at line 41 of file network_interface_config.hpp.

Member Data Documentation

◆ interfaces

std::vector<NetworkInterface::Identifier> rav::NetworkInterfaceConfig::interfaces

Definition at line 39 of file network_interface_config.hpp.


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