VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GNet::Resolver Class Reference

A class for synchronous or asynchronous network name to address resolution. More...

#include <gresolver.h>

Classes

struct  Callback
 An interface used for GNet::Resolver callbacks. More...
 

Public Types

typedef std::vector< AddressAddressList
 

Public Member Functions

 Resolver (Callback &)
 Constructor taking a callback interface reference. More...
 
 ~Resolver ()
 Destructor.
 
void start (const Location &)
 Starts asynchronous name-to-address resolution. More...
 
bool busy () const
 Returns true if there is a pending resolve request.
 

Static Public Member Functions

static std::string resolve (Location &)
 Does syncronous name resolution. More...
 
static AddressList resolve (const std::string &host, const std::string &service, int family=AF_UNSPEC, bool dgram=false)
 Does synchronous name resolution returning a list of addresses. More...
 
static bool async ()
 Returns true if the resolver supports asynchronous operation. More...
 

Friends

class GNet::ResolverImp
 

Detailed Description

A class for synchronous or asynchronous network name to address resolution.

The implementation uses getaddrinfo() at its core. Consider using GNet::ResolverService rather than this class.

Definition at line 43 of file gresolver.h.

Constructor & Destructor Documentation

GNet::Resolver::Resolver ( Resolver::Callback callback)
explicit

Constructor taking a callback interface reference.

The callback's onException() method is called if an exception is thrown out of Callback::onResolved() – see GNet::HeapClient.

Definition at line 365 of file gresolver.cpp.

Member Function Documentation

bool GNet::Resolver::async ( )
static

Returns true if the resolver supports asynchronous operation.

If it doesnt then start() will always throw.

Definition at line 441 of file gresolver.cpp.

std::string GNet::Resolver::resolve ( Location location)
static

Does syncronous name resolution.

Fills in the name and address fields of the supplied Location structure. The returned error string is zero length on success.

Definition at line 385 of file gresolver.cpp.

GNet::Resolver::AddressList GNet::Resolver::resolve ( const std::string &  host,
const std::string &  service,
int  family = AF_UNSPEC,
bool  dgram = false 
)
static

Does synchronous name resolution returning a list of addresses.

Errors are not reported. The empty list is returned on error.

Definition at line 406 of file gresolver.cpp.

void GNet::Resolver::start ( const Location location)

Starts asynchronous name-to-address resolution.

Precondition: async() && !busy()

Definition at line 418 of file gresolver.cpp.


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