#include <llares.h>
Public Member Functions | |
LLAres () | |
~LLAres () | |
void | cancel () |
void | getHostByName (const std::string &name, HostResponder *resp, int family=AF_INET) |
void | getHostByName (const char *name, HostResponder *resp, int family=PF_INET) |
void | getNameInfo (const struct sockaddr &sa, socklen_t salen, int flags, NameInfoResponder *resp) |
void | getSrvRecords (const std::string &name, SrvResponder *resp) |
void | rewriteURI (const std::string &uri, UriRewriteResponder *resp) |
void | search (const std::string &query, LLResType type, QueryResponder *resp) |
bool | process (U64 timeoutUsecs=0) |
bool | processAll () |
Static Public Member Functions | |
static int | expandName (const char *encoded, const char *abuf, size_t alen, std::string &s) |
static int | expandName (const char *encoded, const char *abuf, size_t alen, std::string &s, size_t &enclen) |
static const char * | strerror (int code) |
Protected Attributes | |
ares_channel | chan_ |
Classes | |
class | HostResponder |
Base class for responding to hostname lookups. More... | |
class | NameInfoResponder |
Base class for responding to address lookups. More... | |
class | QueryResponder |
Base class for responding to custom searches. More... | |
class | SrvResponder |
Class for handling SRV query responses. More... | |
class | UriRewriteResponder |
Class for handling URI rewrites based on SRV records. More... |
Definition at line 277 of file llares.h.
LLAres::LLAres | ( | ) |
Definition at line 105 of file llares.cpp.
References chan_.
Referenced by ll_init_ares().
LLAres::~LLAres | ( | ) |
void LLAres::cancel | ( | ) |
Cancel all outstanding requests. The error methods of the corresponding responders will be called, with ARES_ETIMEOUT.
Definition at line 117 of file llares.cpp.
References chan_.
void LLAres::getHostByName | ( | const std::string & | name, | |
HostResponder * | resp, | |||
int | family = AF_INET | |||
) | [inline] |
void LLAres::getHostByName | ( | const char * | name, | |
HostResponder * | resp, | |||
int | family = PF_INET | |||
) |
Look up the address of a host.
name | name of host to look up | |
resp | responder to call with result | |
family | AF_INET for IPv4 addresses, AF_INET6 for IPv6 |
Definition at line 138 of file llares.cpp.
References chan_, host_callback(), and LLAres::HostResponder::hostError().
void LLAres::getNameInfo | ( | const struct sockaddr & | sa, | |
socklen_t | salen, | |||
int | flags, | |||
NameInfoResponder * | resp | |||
) |
Look up the name associated with a socket address.
sa | socket address to look up | |
salen | size of socket address | |
flags | flags to use | |
resp | responder to call with result |
Definition at line 407 of file llares.cpp.
References chan_, nameinfo_callback(), and LLAres::NameInfoResponder::nameInfoError().
void LLAres::getSrvRecords | ( | const std::string & | name, | |
SrvResponder * | resp | |||
) |
Look up SRV (service location) records for a service name.
name | service name (e.g. "_https._tcp.login.agni.lindenlab.com") | |
resp | responder to call with result |
Definition at line 150 of file llares.cpp.
References RES_SRV, and search().
void LLAres::rewriteURI | ( | const std::string & | uri, | |
UriRewriteResponder * | resp | |||
) |
Rewrite a URI, using SRV (service location) records for its protocol if available. If no SRV records are published, the existing URI is handed to the responder.
uri | URI to rewrite | |
resp | responder to call with result |
Definition at line 155 of file llares.cpp.
References LLURI::hostName(), LL_DEBUGS2, LL_ENDL, LLAres::UriRewriteResponder::mUri, RES_SRV, LLURI::scheme(), and search().
Referenced by LLSRV::rewriteURI().
void LLAres::search | ( | const std::string & | query, | |
LLResType | type, | |||
QueryResponder * | resp | |||
) |
Start a custom search.
query | query to make | |
type | type of query to perform | |
resp | responder to call with result |
Definition at line 435 of file llares.cpp.
References chan_, LLAres::QueryResponder::queryError(), and search_callback().
Referenced by getSrvRecords(), and rewriteURI().
bool LLAres::process | ( | U64 | timeoutUsecs = 0 |
) |
Process any outstanding queries. This method takes an optional timeout parameter (specified in microseconds). If provided, it will block the calling thread for that length of time to await possible responses. A timeout of zero will return immediately if there are no responses or timeouts to process.
timeoutUsecs | number of microseconds to block before timing out |
Definition at line 447 of file llares.cpp.
References chan_, gAPRPoolp, i, ll_apr_assert_status(), ll_apr_warn_status(), ll_init_apr(), NULL, and indra::ipc::saranwrap::status().
Referenced by LLAppViewer::mainLoop(), and processAll().
bool LLAres::processAll | ( | ) |
Process all outstanding queries, blocking the calling thread until all have either been responded to or timed out.
Definition at line 536 of file llares.cpp.
References chan_, NULL, and process().
Referenced by LLSRV::rewriteURI().
static int LLAres::expandName | ( | const char * | encoded, | |
const char * | abuf, | |||
size_t | alen, | |||
std::string & | s | |||
) | [inline, static] |
Expand a DNS-encoded compressed string into a normal string.
encoded | the encoded name (null-terminated) | |
abuf | the response buffer in which the string is embedded | |
alen | the length of the response buffer | |
s | the string into which to place the result |
Definition at line 426 of file llares.h.
Referenced by LLHostRecord::parse(), LLQueryResponder::parseRR(), and LLQueryResponder::queryResult().
int LLAres::expandName | ( | const char * | encoded, | |
const char * | abuf, | |||
size_t | alen, | |||
std::string & | s, | |||
size_t & | enclen | |||
) | [static] |
Definition at line 560 of file llares.cpp.
const char * LLAres::strerror | ( | int | code | ) | [static] |
Return a string describing an error code.
Definition at line 578 of file llares.cpp.
Referenced by LLAres::HostResponder::hostError(), LLAres::NameInfoResponder::nameInfoError(), LLAres::QueryResponder::queryError(), and LLAres::SrvResponder::srvError().
ares_channel LLAres::chan_ [protected] |
Definition at line 441 of file llares.h.
Referenced by cancel(), getHostByName(), getNameInfo(), LLAres(), process(), processAll(), search(), and ~LLAres().