CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dns::CaresResolver Class Reference

#include <dns.h>

Inheritance diagram for dns::CaresResolver:
Collaboration diagram for dns::CaresResolver:

Public Member Functions

virtual ~CaresResolver ()
 
virtual bool SetResolvers (const std::vector< std::string > &resolvers)
 
virtual bool SetSearchDomains (const std::vector< std::string > &domains)
 
virtual void SetSystemResolvers ()
 
virtual void SetSystemSearchDomains ()
 
- Public Member Functions inherited from dns::Resolver
 Resolver (const bool ipv4_only, const unsigned retries, const unsigned timeout_ms)
 
virtual ~Resolver ()
 
Host Resolve (const std::string &name)
 
void ResolveMany (const std::vector< std::string > &names, std::vector< Host > *hosts)
 
const std::vector< std::string > & domains () const
 
bool ipv4_only () const
 
const std::vector< std::string > & resolvers () const
 
unsigned retries () const
 
unsigned timeout_ms () const
 
void set_throttle (const unsigned throttle)
 
unsigned throttle () const
 
void set_min_ttl (unsigned seconds)
 
unsigned min_ttl () const
 
void set_max_ttl (unsigned seconds)
 
unsigned max_ttl () const
 

Static Public Member Functions

static CaresResolverCreate (const bool ipv4_only, const unsigned retries, const unsigned timeout_ms)
 

Static Public Attributes

static const unsigned kMaxAddresses = 16
 
- Static Public Attributes inherited from dns::Resolver
static const unsigned kDefaultMinTtl = 60
 
static const unsigned kDefaultMaxTtl = 84600
 

Protected Member Functions

 CaresResolver (const bool ipv4_only, const unsigned retries, const unsigned timeout_ms)
 
virtual void DoResolve (const std::vector< std::string > &names, const std::vector< bool > &skip, std::vector< std::vector< std::string > > *ipv4_addresses, std::vector< std::vector< std::string > > *ipv6_addresses, std::vector< Failures > *failures, std::vector< unsigned > *ttls, std::vector< std::string > *fqdns)
 
- Protected Member Functions inherited from dns::Resolver
bool IsIpv4Address (const std::string &address)
 
bool IsIpv6Address (const std::string &address)
 

Private Member Functions

void WaitOnCares ()
 

Private Attributes

ares_channel * channel_
 
char * lookup_options_
 
std::vector< std::string > system_resolvers_
 
std::vector< std::string > system_domains_
 

Friends

class NormalResolver
 

Additional Inherited Members

- Protected Attributes inherited from dns::Resolver
std::vector< std::string > domains_
 
bool ipv4_only_
 
std::vector< std::string > resolvers_
 
unsigned retries_
 
unsigned timeout_ms_
 
unsigned throttle_
 
unsigned min_ttl_
 
unsigned max_ttl_
 
Prng prng_
 

Detailed Description

Implementation of the Resolver interface using the c-ares library.

Definition at line 284 of file dns.h.

Constructor & Destructor Documentation

dns::CaresResolver::~CaresResolver ( )
virtual

Definition at line 721 of file dns.cc.

dns::CaresResolver::CaresResolver ( const bool  ipv4_only,
const unsigned  retries,
const unsigned  timeout_ms 
)
protected

Definition at line 710 of file dns.cc.

Referenced by Create().

Here is the caller graph for this function:

Member Function Documentation

CaresResolver * dns::CaresResolver::Create ( const bool  ipv4_only,
const unsigned  retries,
const unsigned  timeout_ms 
)
static

Returns a CaresResolver readily initialized, or NULL if an error occurs.

Definition at line 733 of file dns.cc.

Referenced by dns::NormalResolver::Create(), and s3fanout::S3FanoutManager::S3FanoutManager().

Here is the call graph for this function:

Here is the caller graph for this function:

void dns::CaresResolver::DoResolve ( const std::vector< std::string > &  names,
const std::vector< bool > &  skip,
std::vector< std::vector< std::string > > *  ipv4_addresses,
std::vector< std::vector< std::string > > *  ipv6_addresses,
std::vector< Failures > *  failures,
std::vector< unsigned > *  ttls,
std::vector< std::string > *  fqdns 
)
protectedvirtual

Pushes all the DNS queries into the c-ares channel and waits for the results on the file descriptors.

Implements dns::Resolver.

Definition at line 830 of file dns.cc.

Referenced by dns::NormalResolver::DoResolve().

Here is the call graph for this function:

Here is the caller graph for this function:

bool dns::CaresResolver::SetResolvers ( const std::vector< std::string > &  resolvers)
virtual

A list of new resolvers in the form <IP address>="">[:port].

Implements dns::Resolver.

Definition at line 907 of file dns.cc.

Referenced by dns::NormalResolver::SetResolvers(), and SetSystemResolvers().

Here is the call graph for this function:

Here is the caller graph for this function:

bool dns::CaresResolver::SetSearchDomains ( const std::vector< std::string > &  domains)
virtual

Changes the options of the active channel. This is hacky and deals with c-ares internal data structures because there is no way to do it via public APIs.

Implements dns::Resolver.

Definition at line 923 of file dns.cc.

Referenced by dns::NormalResolver::SetSearchDomains(), and SetSystemSearchDomains().

Here is the call graph for this function:

Here is the caller graph for this function:

void dns::CaresResolver::SetSystemResolvers ( )
virtual

Implements dns::Resolver.

Definition at line 965 of file dns.cc.

Referenced by dns::NormalResolver::SetSystemResolvers().

Here is the call graph for this function:

Here is the caller graph for this function:

void dns::CaresResolver::SetSystemSearchDomains ( )
virtual

Implements dns::Resolver.

Definition at line 971 of file dns.cc.

Referenced by dns::NormalResolver::SetSystemSearchDomains().

Here is the call graph for this function:

Here is the caller graph for this function:

void dns::CaresResolver::WaitOnCares ( )
private

Polls on c-ares sockets and triggers call-backs execution. Might be necessary to call this repeatadly.

Definition at line 981 of file dns.cc.

Referenced by DoResolve().

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class NormalResolver
friend

Definition at line 285 of file dns.h.

Member Data Documentation

ares_channel* dns::CaresResolver::channel_
private

Definition at line 319 of file dns.h.

Referenced by Create(), DoResolve(), SetResolvers(), SetSearchDomains(), WaitOnCares(), and ~CaresResolver().

const unsigned dns::CaresResolver::kMaxAddresses = 16
static

More IP addresses for a single name will be ignored. Due to c-ares exponential backoff, the number of retries should be limited to 2. That results in 2 apptempts with the given timeout and a third one with the timeout doubled.

Definition at line 293 of file dns.h.

Referenced by dns::CaresExtractIpv4(), and dns::CaresExtractIpv6().

char* dns::CaresResolver::lookup_options_
private

Definition at line 320 of file dns.h.

Referenced by Create(), and ~CaresResolver().

std::vector<std::string> dns::CaresResolver::system_domains_
private

Definition at line 322 of file dns.h.

Referenced by Create(), and SetSystemSearchDomains().

std::vector<std::string> dns::CaresResolver::system_resolvers_
private

Definition at line 321 of file dns.h.

Referenced by Create(), and SetSystemResolvers().


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