Made to Order Software Corporation Logo

LLChatLib: LLAres Class Reference

LLAres Class Reference

Asynchronous address resolver. More...

#include <llares.h>

List of all members.

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...

Public Member Functions

void cancel ()
void getHostByName (const char *name, HostResponder *resp, int family=PF_INET)
void getHostByName (const std::string &name, HostResponder *resp, int family=AF_INET)
void getNameInfo (const struct sockaddr &sa, socklen_t salen, int flags, NameInfoResponder *resp)
void getSrvRecords (const std::string &name, SrvResponder *resp)
bool process (U64 timeoutUsecs=0)
bool processAll ()
void rewriteURI (const std::string &uri, UriRewriteResponder *resp)
void search (const std::string &query, LLResType type, QueryResponder *resp)

Static Public Member Functions

static int expandName (const char *encoded, const char *abuf, size_t alen, std::string &s)
static const char * strerror (int code)

Detailed Description

Asynchronous address resolver.


Member Function Documentation

void LLAres::cancel (  ) 

Cancel all outstanding requests. The error methods of the corresponding responders will be called, with ARES_ETIMEOUT.

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.

Parameters:
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
Returns:
ARES_SUCCESS on success, otherwise an error indicator
void LLAres::getHostByName ( const char *  name,
HostResponder resp,
int  family = PF_INET 
)

Look up the address of a host.

Parameters:
name name of host to look up
resp responder to call with result
family AF_INET for IPv4 addresses, AF_INET6 for IPv6
void LLAres::getHostByName ( const std::string &  name,
HostResponder resp,
int  family = AF_INET 
) [inline]

Look up the address of a host.

Parameters:
name name of host to look up
resp responder to call with result
family AF_INET for IPv4 addresses, AF_INET6 for IPv6
void LLAres::getNameInfo ( const struct sockaddr &  sa,
socklen_t  salen,
int  flags,
NameInfoResponder resp 
)

Look up the name associated with a socket address.

Parameters:
sa socket address to look up
salen size of socket address
flags flags to use
resp responder to call with result
void LLAres::getSrvRecords ( const std::string &  name,
SrvResponder resp 
)

Look up SRV (service location) records for a service name.

Parameters:
name service name (e.g. "_https._tcp.login.agni.lindenlab.com")
resp responder to call with result

Here is the call graph for this function:

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.

Parameters:
timeoutUsecs number of microseconds to block before timing out
Returns:
whether any responses were processed

Here is the call graph for this function:

bool LLAres::processAll (  ) 

Process all outstanding queries, blocking the calling thread until all have either been responded to or timed out.

Returns:
whether any responses were processed

Here is the call graph for this function:

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.

Parameters:
uri URI to rewrite
resp responder to call with result

Here is the call graph for this function:

void LLAres::search ( const std::string &  query,
LLResType  type,
QueryResponder resp 
)

Start a custom search.

Parameters:
query query to make
type type of query to perform
resp responder to call with result
const char * LLAres::strerror ( int  code  )  [static]

Return a string describing an error code.


The documentation for this class was generated from the following files:
  • /home/doug/src/oss/slitechat/trunk/LLChatLib/llmessage/llares.h
  • /home/doug/src/oss/slitechat/trunk/LLChatLib/llmessage/llares.cpp
Generated on Thu Sep 23 17:18:38 2010 for LLChatLib by  doxygen 1.6.3