Open Lighting Architecture  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions
ola::network Namespace Reference

Detailed Description

Code for network communication.

Classes

class  FakeInterfacePicker
class  PosixInterfacePicker
class  WindowsInterfacePicker
class  AdvancedTCPConnector
class  HealthCheckedConnection
class  Interface
class  InterfaceBuilder
struct  InterfaceIndexOrdering
class  InterfacePicker
 Given some intial parameters, find the best network interface to use. More...
class  IPV4Address
 Represents a IPv4 Address. More...
class  MACAddress
 Represents a MAC Address. More...
class  UDPSocketInterface
class  UDPSocket
class  SocketAddress
 The base SocketAddress. More...
class  IPV4SocketAddress
 An IPv4 SocketAddress. More...
class  GenericSocketAddress
 a Generic Socket Address More...
class  SocketCloser
 Automatically close a socket when it goes out of scope. More...
class  TCPConnector
class  TCPSocket
class  TCPAcceptingSocket
class  TCPSocketFactoryInterface
class  GenericTCPSocketFactory

Typedefs

typedef
GenericTCPSocketFactory
< TCPSocket
TCPSocketFactory

Functions

bool StringToEther (const string &address, ether_addr *target)
unsigned int SockAddrLen (const struct sockaddr &sa)
bool StringToAddress (const string &address, struct in_addr *addr)
string AddressToString (const struct in_addr &addr)
bool IsBigEndian ()
uint8_t NetworkToHost (uint8_t value)
uint16_t NetworkToHost (uint16_t value)
uint32_t NetworkToHost (uint32_t value)
int8_t NetworkToHost (int8_t value)
int16_t NetworkToHost (int16_t value)
int32_t NetworkToHost (int32_t value)
uint8_t HostToNetwork (uint8_t value)
int8_t HostToNetwork (int8_t value)
uint16_t HostToNetwork (uint16_t value)
int16_t HostToNetwork (int16_t value)
uint32_t HostToNetwork (uint32_t value)
int32_t HostToNetwork (int32_t value)
uint8_t HostToLittleEndian (uint8_t value)
int8_t HostToLittleEndian (int8_t value)
uint16_t HostToLittleEndian (uint16_t value)
int16_t HostToLittleEndian (int16_t value)
uint32_t _ByteSwap (uint32_t value)
uint32_t HostToLittleEndian (uint32_t value)
int32_t HostToLittleEndian (int32_t value)
uint8_t LittleEndianToHost (uint8_t value)
int8_t LittleEndianToHost (int8_t value)
uint16_t LittleEndianToHost (uint16_t value)
int16_t LittleEndianToHost (int16_t value)
uint32_t LittleEndianToHost (uint32_t value)
int32_t LittleEndianToHost (int32_t value)
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)
bool StringToAddress (const std::string &address, struct in_addr *addr)
std::string HostnameFromFQDN (const std::string &fqdn)
std::string DomainNameFromFQDN (const std::string &fqdn)
bool NameServers (std::vector< ola::network::IPV4Address > *name_servers)

Function Documentation

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().
std::string ola::network::DomainName ( )

Return the machine's domain name as a string.

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
std::string ola::network::FQDN ( )

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

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

Return the machine's full hostname (FQDN)

Deprecated:
use FQDN() instead (17 Nov 2013)
GenericSocketAddress ola::network::GetLocalAddress ( int  sd)

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

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

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

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

Return the machine's hostname

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
uint16_t ola::network::HostToNetwork ( uint16_t  value)

Convert a uint16_t from host to network byte order

uint32_t ola::network::HostToNetwork ( uint32_t  value)

Convert a uint32_t from host to network byte order

bool ola::network::IsBigEndian ( )
Returns
true if we're big endian, false otherwise.
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
uint16_t ola::network::NetworkToHost ( uint16_t  value)

Convert a uint16_t from network to host byte order

uint32_t ola::network::NetworkToHost ( uint32_t  value)

Convert a uint32_t from network to host byte order

int16_t ola::network::NetworkToHost ( int16_t  value)

Convert a uint16_t from network to host byte order

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

Return the length of a sockaddr

bool ola::network::StringToAddress ( const std::string &  address,
struct in_addr *  addr 
)

Convert a string to a struct in_addr

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 (it also might not handle dots as well as colons as seperators)