Class with network related helper functions.
More...
#include <Net.h>
|
static bool | isIp (const std::string &ipAddress) |
| Checks is a string is a valid IPv4 or IPv6 address. More...
|
|
static std::string | getMyIpAddress (const std::string &interfaceName="") |
| Tries to automatically determine the computers IPv4 address. More...
|
|
static std::string | getMyIp6Address (std::string interfaceName="") |
| Tries to automatically determine the computers IPv6 address. More...
|
|
static std::string | resolveHostname (std::string &hostname) |
| Tries to get the IP address for a hostname. More...
|
|
static RouteInfoList | getRoutes () |
| Returns a list of all defined network routes. More...
|
|
static std::vector< uint8_t > | getMacAddress (bool allowLocallyAdministered, const std::string &interface="") |
|
Class with network related helper functions.
§ RouteInfoList
§ Net()
§ ~Net()
virtual BaseLib::Net::~Net |
( |
| ) |
|
|
virtual |
Destructor.
Does nothing.
§ getMacAddress()
std::vector< uint8_t > BaseLib::Net::getMacAddress |
( |
bool |
allowLocallyAdministered, |
|
|
const std::string & |
interface = "" |
|
) |
| |
|
static |
§ getMyIp6Address()
std::string BaseLib::Net::getMyIp6Address |
( |
std::string |
interfaceName = "" | ) |
|
|
static |
Tries to automatically determine the computers IPv6 address.
- Parameters
-
interfaceName | If specified, the IP address of this interface is returned. |
- Returns
- Returns the computers IPv6 address.
§ getMyIpAddress()
std::string BaseLib::Net::getMyIpAddress |
( |
const std::string & |
interfaceName = "" | ) |
|
|
static |
Tries to automatically determine the computers IPv4 address.
- Parameters
-
interfaceName | If specified, the IP address of this interface is returned. |
- Returns
- Returns the computers IPv4 address.
§ getRoutes()
Returns a list of all defined network routes.
- Returns
- The returned routes of type RouteInfoList.
§ isIp()
bool BaseLib::Net::isIp |
( |
const std::string & |
ipAddress | ) |
|
|
static |
Checks is a string is a valid IPv4 or IPv6 address.
- Returns
- Returns true if the string is an IP address.
§ resolveHostname()
std::string BaseLib::Net::resolveHostname |
( |
std::string & |
hostname | ) |
|
|
static |
Tries to get the IP address for a hostname.
- Parameters
-
hostname | The hostname to get the IP address for. It is ok to pass an IP address as hostname. |
- Returns
- Returns the IP address or an empty String on error.
The documentation for this class was generated from the following files: