Ocean
Ocean::Network::Resolver Class Reference

This class implements an address resolver. More...

Inheritance diagram for Ocean::Network::Resolver:

Public Types

typedef std::vector< Address4Addresses4
 Definition of a vector holding addresses. More...
 
typedef std::unordered_set< Address4, Address4AddressSet4
 Definition of an unordered set holding addresses. More...
 

Public Member Functions

Addresses4 localAddresses () const
 Returns all current local addresses. More...
 
void addLocalAddress (const Address4 &localAddress)
 Adds an explicit local address. More...
 

Static Public Member Functions

static Address4 resolveFirstIp4 (const std::string &host)
 Resolves a given host name to it's first found ip4 address. More...
 
static Addresses4 resolveIp4 (const std::string &host)
 Resolves a given host name to all possible ip4 addresses. More...
 
static std::string resolve (const Address4 &address)
 Resolves a given address to it's host name. More...
 
- Static Public Member Functions inherited from Ocean::Singleton< Resolver >
static Resolver & get ()
 Returns a reference to the unique object. More...
 

Protected Member Functions

 Resolver ()
 Creates a new resolver object. More...
 
- Protected Member Functions inherited from Ocean::Singleton< Resolver >
 Singleton ()=default
 Default constructor. More...
 

Protected Attributes

AddressSet4 explicitLocalAddresses_
 The local addresses explicitly set. More...
 
Lock lock_
 The resolver's lock. More...
 

Friends

class Singleton< Resolver >
 

Detailed Description

This class implements an address resolver.

Member Typedef Documentation

◆ Addresses4

Definition of a vector holding addresses.

◆ AddressSet4

Definition of an unordered set holding addresses.

Constructor & Destructor Documentation

◆ Resolver()

Ocean::Network::Resolver::Resolver ( )
protected

Creates a new resolver object.

Member Function Documentation

◆ addLocalAddress()

void Ocean::Network::Resolver::addLocalAddress ( const Address4 localAddress)

Adds an explicit local address.

Parameters
localAddressThe explicit local address to be set, must be valid

◆ localAddresses()

Addresses4 Ocean::Network::Resolver::localAddresses ( ) const

Returns all current local addresses.

Returns
The local addresses of the system, empty if unknown

◆ resolve()

static std::string Ocean::Network::Resolver::resolve ( const Address4 address)
static

Resolves a given address to it's host name.

If the address could not be resolved an empty string is returned.

Parameters
addressAddress4 to resolve
Returns
Resolved host name

◆ resolveFirstIp4()

static Address4 Ocean::Network::Resolver::resolveFirstIp4 ( const std::string &  host)
static

Resolves a given host name to it's first found ip4 address.

Parameters
hostName of the host to resolve
Returns
Resolved address, a zero address is returned if the host could not be resolved

◆ resolveIp4()

static Addresses4 Ocean::Network::Resolver::resolveIp4 ( const std::string &  host)
static

Resolves a given host name to all possible ip4 addresses.

Parameters
hostName of the host to resolve
Returns
Resolved addresses

Friends And Related Function Documentation

◆ Singleton< Resolver >

friend class Singleton< Resolver >
friend

Field Documentation

◆ explicitLocalAddresses_

AddressSet4 Ocean::Network::Resolver::explicitLocalAddresses_
protected

The local addresses explicitly set.

◆ lock_

Lock Ocean::Network::Resolver::lock_
mutableprotected

The resolver's lock.


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