A list of network interfaces with some convenience functions to operate on them.
More...
#include <network_interface_list.hpp>
A list of network interfaces with some convenience functions to operate on them.
Definition at line 36 of file network_interface_list.hpp.
◆ NetworkInterfaceList() [1/2]
| rav::NetworkInterfaceList::NetworkInterfaceList |
( |
| ) |
|
|
default |
◆ NetworkInterfaceList() [2/2]
| rav::NetworkInterfaceList::NetworkInterfaceList |
( |
std::vector< NetworkInterface > | interfaces | ) |
|
|
explicit |
Constructor that takes a vector of network interfaces.
- Parameters
-
| interfaces | The vector of network interfaces. |
◆ find_by_address()
| const NetworkInterface * rav::NetworkInterfaceList::find_by_address |
( |
const boost::asio::ip::address & | address | ) |
const |
|
nodiscard |
Finds a network interface by the given address.
- Parameters
-
| address | The address to search for. |
- Returns
- The network interface if found, otherwise nullptr.
◆ find_by_string()
| const NetworkInterface * rav::NetworkInterfaceList::find_by_string |
( |
const std::string_view & | search_string | ) |
const |
|
nodiscard |
Finds a network interface by the given string.
The string can be the identifier, display name, description, MAC or an ip address. It's meant as convenience function for the user. The search is case-insensitive.
- Parameters
-
| search_string | The string to search for. |
- Returns
- The network interface if found, otherwise nullptr.
◆ find_by_type()
Finds a network interface by the given type.
- Parameters
-
| type | The type of the interface to search for. |
- Returns
- A pointer to a network interface if found, otherwise nullptr.
◆ get_interface()
Gets a network interface by the given identifier.
- Parameters
-
| identifier | The string to search for. |
- Returns
- The network interface if found, otherwise nullptr.
◆ get_interface_identifiers()
- Returns
- The list of network interface identifiers.
◆ get_interfaces()
| const std::vector< NetworkInterface > & rav::NetworkInterfaceList::get_interfaces |
( |
| ) |
const |
|
nodiscard |
- Returns
- The list of network interfaces.
◆ get_system_interfaces()
| const NetworkInterfaceList & rav::NetworkInterfaceList::get_system_interfaces |
( |
bool | force_refresh = false | ) |
|
|
static |
Retrieves the list of network interfaces on the system.
This is a static function that returns a singleton instance of the NetworkInterfaceList. This will return an updated list when the ttl has expired or if the force_refresh parameter is set to true.
- Exceptions
-
| std::runtime_error | if the list cannot be retrieved. |
- Parameters
-
| force_refresh | If true, the list is refreshed even if the ttl has not expired. |
- Returns
- The list of network interfaces on the system.
The documentation for this class was generated from the following file: