libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
BaseLib::Net Class Reference

Class with network related helper functions. More...

#include <Net.h>

Classes

struct  RouteInfo
 

Public Types

typedef std::vector< std::shared_ptr< RouteInfo > > RouteInfoList
 

Public Member Functions

 Net ()
 
virtual ~Net ()
 Destructor. More...
 

Static Public Member Functions

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="")
 

Detailed Description

Class with network related helper functions.

Member Typedef Documentation

§ RouteInfoList

typedef std::vector<std::shared_ptr<RouteInfo> > BaseLib::Net::RouteInfoList

Constructor & Destructor Documentation

§ Net()

BaseLib::Net::Net ( )

§ ~Net()

virtual BaseLib::Net::~Net ( )
virtual

Destructor.

Does nothing.

Member Function Documentation

§ 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
interfaceNameIf 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
interfaceNameIf specified, the IP address of this interface is returned.
Returns
Returns the computers IPv4 address.

§ getRoutes()

Net::RouteInfoList BaseLib::Net::getRoutes ( )
static

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
hostnameThe 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: