kodi
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CNetworkBase Class Referenceabstract
Inheritance diagram for CNetworkBase:
Inheritance graph
[legend]

Public Types

enum  EMESSAGE { SERVICES_UP, SERVICES_DOWN }
 

Public Member Functions

CNetworkServicesGetServices ()
 
virtual bool GetHostName (std::string &hostname)
 
virtual std::vector< CNetworkInterface * > & GetInterfaceList (void)=0
 
virtual CNetworkInterfaceGetFirstConnectedInterface (void)
 
bool HasInterfaceForIP (unsigned long address)
 
bool IsAvailable (void)
 
bool IsConnected (void)
 
bool WakeOnLan (const char *mac)
 
bool PingHost (unsigned long host, unsigned short port, unsigned int timeout_ms=2000, bool readability_check=false)
 
virtual bool PingHost (unsigned long host, unsigned int timeout_ms=2000)=0
 
virtual std::vector< std::string > GetNameServers (void)=0
 
void NetworkMessage (EMESSAGE message, int param)
 
bool IsLocalHost (const std::string &hostname)
 
void WaitForNet ()
 

Static Public Member Functions

static std::unique_ptr< CNetworkBaseGetNetwork ()
 
static int ParseHex (char *str, unsigned char *addr)
 
static std::string GetIpStr (const sockaddr *sa)
 IPv6/IPv4 compatible conversion of host IP address. More...
 
static std::string GetMaskByPrefixLength (uint8_t prefixLength)
 convert prefix length of IPv4 address to IP mask representation More...
 

Public Attributes

std::unique_ptr< CNetworkServicesm_services
 

Member Function Documentation

◆ GetIpStr()

std::string CNetworkBase::GetIpStr ( const sockaddr *  sa)
static

IPv6/IPv4 compatible conversion of host IP address.

Parameters
structsockaddr
Returns
Function converts binary structure sockaddr to std::string. It can read sockaddr_in and sockaddr_in6, cast as (sockaddr*). IPv4 address is returned in the format x.x.x.x (where x is 0-255), IPv6 address is returned in it's canonised form. On error (or no IPv6/v4 valid input) empty string is returned.

◆ GetMaskByPrefixLength()

std::string CNetworkBase::GetMaskByPrefixLength ( uint8_t  prefixLength)
static

convert prefix length of IPv4 address to IP mask representation

Parameters
prefixlength
Returns

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