- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
GNet::ResolverInfo Class Reference

A class that holds a host/service name pair and optionally the results of a name-to-address lookup, ie. More...

`#include <gresolverinfo.h>`

## Public Member Functions
| ResolverInfo (const std::string &host, const std::string &service)
| Constructor. More...
| ResolverInfo (const std::string &host_and_service)
| Implicit constructor. Throws if an invalid format. More...
std::string | host () const
| Returns the remote host name, as passed in to the constructor. More...
std::string | service () const
| Returns the remote service name, as passed in to the constructor. More...
void | update (const Address &address, const std::string &canonical_name)
| Updates the address and canonical name, typically after doing a name lookup on host() and service(). More...
bool | hasAddress () const
| Returns true after update() has been called. More...
Address | address () const
| Returns the remote address. More...
std::string | name () const
| Returns the remote canonical name. More...
std::string | str () const
| Returns a string representation of the host and service names that can be passed to the Resolver's resolveReq() method. More...
std::string | displayString (bool simple=false) const
| Returns a string representation for logging and debug. More...
G::DateTime::EpochTime | updateTime () const
| Returns the time of the last update(). More...
bool | socks () const
| Returns true if using socks. More...
unsigned int | socksFarPort () const
| Returns the port number for the socks far server. More...
std::string | socksFarHost () const
| Returns the port for the socks far server. More...

## Detailed Description

A class that holds a host/service name pair and optionally the results of a name-to-address lookup, ie.

the remote address and canonical host name. The actual name lookup is done externally, and the results are deposited into the ResolverInfo object with update().

This class can be used to minimise the amount of name lookup performed when the same host/service name is used repeatedly. See GNet::ClientPtr for an example of this.

Definition at line 48 of file gresolverinfo.h.

## Constructor & Destructor Documentation

GNet::ResolverInfo::ResolverInfo | ( | const std::string & | host,
|  | const std::string & | service
| ) |  |

Constructor.

Definition at line 67 of file gresolverinfo.cpp.

GNet::ResolverInfo::ResolverInfo | ( | const std::string & | host_and_service | ) |

Implicit constructor. Throws if an invalid format.

Definition at line 55 of file gresolverinfo.cpp.

## Member Function Documentation

GNet::Address GNet::ResolverInfo::address | ( |  | ) | const

Returns the remote address.

Definition at line 93 of file gresolverinfo.cpp.

std::string GNet::ResolverInfo::displayString | ( | bool | simple = `false` | ) | const

Returns a string representation for logging and debug.

Definition at line 116 of file gresolverinfo.cpp.

Referenced by GSmtp::RequestClient::RequestClient(), GSmtp::SpamClient::SpamClient(), and GNet::SimpleClient::updateResolverInfo().

bool GNet::ResolverInfo::hasAddress | ( |  | ) | const

Returns true after update() has been called.

Definition at line 88 of file gresolverinfo.cpp.

Referenced by GNet::SimpleClient::updateResolverInfo().

std::string GNet::ResolverInfo::host | ( |  | ) | const

Returns the remote host name, as passed in to the constructor.

Definition at line 78 of file gresolverinfo.cpp.

Referenced by GNet::Resolver::resolve(), and GNet::SimpleClient::updateResolverInfo().

std::string GNet::ResolverInfo::name | ( |  | ) | const

Returns the remote canonical name.

Returns the empty string if not available.

Definition at line 106 of file gresolverinfo.cpp.

std::string GNet::ResolverInfo::service | ( |  | ) | const

Returns the remote service name, as passed in to the constructor.

Definition at line 83 of file gresolverinfo.cpp.

Referenced by GNet::Resolver::resolve(), and GNet::SimpleClient::updateResolverInfo().

bool GNet::ResolverInfo::socks | ( |  | ) | const

Returns true if using socks.

Definition at line 138 of file gresolverinfo.cpp.

std::string GNet::ResolverInfo::socksFarHost | ( |  | ) | const

Returns the port for the socks far server.

Definition at line 148 of file gresolverinfo.cpp.

unsigned int GNet::ResolverInfo::socksFarPort | ( |  | ) | const

Returns the port number for the socks far server.

Definition at line 143 of file gresolverinfo.cpp.

std::string GNet::ResolverInfo::str | ( |  | ) | const

Returns a string representation of the host and service names that can be passed to the Resolver's resolveReq() method.

Definition at line 111 of file gresolverinfo.cpp.

void GNet::ResolverInfo::update | ( | const Address & | address,
|  | const std::string & | canonical_name
| ) |  |

Updates the address and canonical name, typically after doing a name lookup on host() and service().

Definition at line 98 of file gresolverinfo.cpp.

References G::DateTime::now().

G::DateTime::EpochTime GNet::ResolverInfo::updateTime | ( |  | ) | const

Returns the time of the last update().

Used in cacheing. Returns zero if not update()d.

Definition at line 133 of file gresolverinfo.cpp.

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

- gresolverinfo.h
- gresolverinfo.cpp