Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CNetworkBase Class Referenceabstract

#include <Network.h>

Inheritance diagram for CNetworkBase:
CNetworkAndroid CNetworkIOS CNetworkPosix CNetworkWin10 CNetworkWin32 CNetworkFreebsd CNetworkLinux CNetworkMacOS

Public Types

enum  EMESSAGE { SERVICES_UP , SERVICES_DOWN }
 

Public Member Functions

 CNetworkBase ()
 
virtual ~CNetworkBase ()
 
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.
 
static std::string GetMaskByPrefixLength (uint8_t prefixLength)
 convert prefix length of IPv4 address to IP mask representation
 

Public Attributes

std::unique_ptr< CNetworkServicesm_services
 

Member Enumeration Documentation

◆ EMESSAGE

Enumerator
SERVICES_UP 
SERVICES_DOWN 

Constructor & Destructor Documentation

◆ CNetworkBase()

CNetworkBase::CNetworkBase ( )

◆ ~CNetworkBase()

CNetworkBase::~CNetworkBase ( )
virtual

Member Function Documentation

◆ GetFirstConnectedInterface()

CNetworkInterface * CNetworkBase::GetFirstConnectedInterface ( void )
virtual

◆ GetHostName()

bool CNetworkBase::GetHostName ( std::string & hostname)
virtual

Reimplemented in CNetworkAndroid.

◆ GetInterfaceList()

virtual std::vector< CNetworkInterface * > & CNetworkBase::GetInterfaceList ( void )
pure virtual

◆ 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

◆ GetNameServers()

virtual std::vector< std::string > CNetworkBase::GetNameServers ( void )
pure virtual

◆ GetNetwork()

std::unique_ptr< CNetworkBase > CNetworkBase::GetNetwork ( )
static

◆ GetServices()

CNetworkServices & CNetworkBase::GetServices ( )
inline

◆ HasInterfaceForIP()

bool CNetworkBase::HasInterfaceForIP ( unsigned long address)

◆ IsAvailable()

bool CNetworkBase::IsAvailable ( void )

◆ IsConnected()

bool CNetworkBase::IsConnected ( void )

◆ IsLocalHost()

bool CNetworkBase::IsLocalHost ( const std::string & hostname)

◆ NetworkMessage()

void CNetworkBase::NetworkMessage ( EMESSAGE message,
int param )

◆ ParseHex()

int CNetworkBase::ParseHex ( char * str,
unsigned char * addr )
static

◆ PingHost() [1/2]

virtual bool CNetworkBase::PingHost ( unsigned long host,
unsigned int timeout_ms = 2000 )
pure virtual

◆ PingHost() [2/2]

bool CNetworkBase::PingHost ( unsigned long host,
unsigned short port,
unsigned int timeout_ms = 2000,
bool readability_check = false )

◆ WaitForNet()

void CNetworkBase::WaitForNet ( )

◆ WakeOnLan()

bool CNetworkBase::WakeOnLan ( const char * mac)

Member Data Documentation

◆ m_services

std::unique_ptr<CNetworkServices> CNetworkBase::m_services

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