Open Lighting Architecture  Latest Git
Classes | Typedefs | Functions
ola::network Namespace Reference

Detailed Description

Code for network communication.

Classes

class  AdvancedTCPConnector
 Attempts to open a TCP connection until a failure limit is reached. More...
 
class  FakeInterfacePicker
 
class  GenericSocketAddress
 a Generic Socket Address More...
 
class  GenericTCPSocketFactory
 
class  HealthCheckedConnection
 
class  Interface
 
class  InterfaceBuilder
 
struct  InterfaceIndexOrdering
 
class  InterfacePicker
 Given some initial parameters, find the best network interface to use. More...
 
class  IPV4Address
 Represents a IPv4 Address. More...
 
class  IPV4SocketAddress
 An IPv4 SocketAddress. More...
 
class  MACAddress
 Represents a MAC Address. More...
 
class  PendingTCPConnection
 
class  PosixInterfacePicker
 
class  SocketAddress
 The base SocketAddress. More...
 
class  SocketCloser
 Automatically close a socket when it goes out of scope. More...
 
class  TCPAcceptingSocket
 
class  TCPConnector
 An class which manages non-blocking TCP connects. More...
 
class  TCPSocket
 
class  TCPSocketFactoryInterface
 
class  UDPSocket
 
class  UDPSocketInterface
 The interface for UDPSockets. More...
 
class  WindowsInterfacePicker
 

Typedefs

typedef GenericTCPSocketFactory< TCPSocketTCPSocketFactory
 

Functions

bool IPV4StringToAddress (const string &address, struct in_addr *addr)
 
bool StringToEther (const string &address, ether_addr *target)
 
unsigned int SockAddrLen (const struct sockaddr &sa)
 
uint16_t NetworkToHost (uint16_t value)
 16-bit unsigned network to host conversion.
 
uint32_t NetworkToHost (uint32_t value)
 32-bit unsigned network to host conversion.
 
int16_t NetworkToHost (int16_t value)
 16-bit signed network to host conversion.
 
int32_t NetworkToHost (int32_t value)
 32-bit signed network to host conversion.
 
uint16_t HostToNetwork (uint16_t value)
 16-bit unsigned host to network conversion.
 
int16_t HostToNetwork (int16_t value)
 16-bit signed host to network conversion.
 
uint32_t HostToNetwork (uint32_t value)
 32-bit unsigned host to network conversion.
 
int32_t HostToNetwork (int32_t value)
 32-bit signed host to network conversion.
 
uint16_t HostToLittleEndian (uint16_t value)
 16-bit unsigned host to little endian conversion.
 
int16_t HostToLittleEndian (int16_t value)
 16-bit signed host to little endian conversion.
 
uint32_t HostToLittleEndian (uint32_t value)
 32-bit unsigned host to little endian conversion.
 
int32_t HostToLittleEndian (int32_t value)
 32-bit signed host to little endian conversion.
 
uint16_t LittleEndianToHost (uint16_t value)
 16-bit unsigned little endian to host conversion.
 
int16_t LittleEndianToHost (int16_t value)
 16-bit signed little endian to host conversion.
 
uint32_t LittleEndianToHost (uint32_t value)
 32-bit unsigned little endian to host conversion.
 
int32_t LittleEndianToHost (int32_t value)
 32-bit signed little endian to host conversion.
 
string HostnameFromFQDN (const string &fqdn)
 
string DomainNameFromFQDN (const string &fqdn)
 
string DomainName ()
 
string FQDN ()
 
string FullHostname ()
 
string Hostname ()
 
bool NameServers (vector< IPV4Address > *name_servers)
 
bool DefaultRoute (int32_t *if_index, IPV4Address *default_gateway)
 
GenericSocketAddress GetLocalAddress (int sd)
 
GenericSocketAddress GetPeerAddress (int sd)
 
void DeleteConnection (PendingTCPConnection *connection)
 
uint8_t NetworkToHost (uint8_t value)
 8-bit unsigned network to host conversion.
 
int8_t NetworkToHost (int8_t value)
 8-bit signed network to host conversion.
 
uint8_t HostToNetwork (uint8_t value)
 8-bit unsigned host to network conversion.
 
int8_t HostToNetwork (int8_t value)
 8-bit signed host to network conversion.
 
uint8_t HostToLittleEndian (uint8_t value)
 8-bit unsigned host to little endian conversion.
 
int8_t HostToLittleEndian (int8_t value)
 8-bit signed host to little endian conversion.
 
uint8_t LittleEndianToHost (uint8_t value)
 8-bit unsigned little endian to host conversion.
 
int8_t LittleEndianToHost (int8_t value)
 8-bit signed little endian to host conversion.
 

Function Documentation

◆ DefaultRoute()

bool ola::network::DefaultRoute ( int32_t *  if_index,
ola::network::IPV4Address default_gateway 
)

Get the default route.

Parameters
[out]if_indexa pointer to an int32 which is updated with the interface to use for the default route.
[out]default_gatewaya pointer to an IPV4Address which is updated with the default gateway.
Returns
true if a default route was found, false if there was an error fetching the routing table.
Note
if the routing table was read correctly but there was no default route, if_index will be ola::network::Interface::DEFAULT_INDEX and default_gateway will be the wildcard address. The latter can be tested for with default_gateway.IsWildcard().

◆ DomainName()

std::string ola::network::DomainName ( )

Return the machine's domain name as a string.

◆ DomainNameFromFQDN()

std::string ola::network::DomainNameFromFQDN ( const std::string &  fqdn)

Convert a FQDN to a domain

Parameters
fqdna fully qualified domain name
Returns
the domain part of the FQDN

◆ FQDN()

std::string ola::network::FQDN ( )

Return the machine's fully qualified domain name (FQDN)

◆ FullHostname()

std::string ola::network::FullHostname ( )

Return the machine's full hostname (FQDN)

Deprecated:
use ola::network::FQDN() instead (17 Nov 2013)

◆ GetLocalAddress()

GenericSocketAddress ola::network::GetLocalAddress ( int  sd)

Wrapper around getsockname(). The caller should check IsValid() on the GenericSocketAddress before using.

◆ GetPeerAddress()

GenericSocketAddress ola::network::GetPeerAddress ( int  sd)

Wrapper around getpeername(). The caller should check IsValid() on the GenericSocketAddress before using.

◆ Hostname()

std::string ola::network::Hostname ( )

Return the machine's hostname

◆ HostnameFromFQDN()

std::string ola::network::HostnameFromFQDN ( const std::string &  fqdn)

Convert a FQDN to a hostname

Parameters
fqdna fully qualified domain name
Returns
the hostname part of the FQDN

◆ NameServers()

bool ola::network::NameServers ( std::vector< ola::network::IPV4Address > *  name_servers)

Get a vector of name server IP addresses.

Parameters
[out]name_serversa pointer to a vector of name servers to populate
Returns
true on success, false otherwise

◆ SockAddrLen()

unsigned int ola::network::SockAddrLen ( const struct sockaddr &  sa)

Return the length of a sockaddr

◆ StringToEther()

bool ola::network::StringToEther ( const string &  address,
ether_addr *  target 
)

Convert a string to a ether_addr struct

Parameters
addressa string in the form 'nn:nn:nn:nn:nn:nn' or 'nn.nn.nn.nn.nn.nn'
targeta pointer to a ether_addr struct
Returns
true if it worked, false otherwise

ether_aton_r doesn't exist on Mac, so can't use it (also it might not handle dots as well as colons as separators)