5 #ifndef CVMFS_NETWORK_DNS_H_
6 #define CVMFS_NETWORK_DNS_H_
18 #include "gtest/gtest_prod.h"
56 texts[1] =
"invalid resolver addresses";
57 texts[2] =
"DNS query timeout";
58 texts[3] =
"invalid host name to resolve";
59 texts[4] =
"unknown host name";
60 texts[5] =
"malformed DNS request";
61 texts[6] =
"no IP address for host";
62 texts[7] =
"internal error, not yet resolved";
63 texts[8] =
"unknown name resolving error";
71 std::string
RewriteUrl(
const std::string &url,
const std::string &ip);
72 std::string
StripIp(
const std::string &decorated_ip);
197 void ResolveMany(
const std::vector<std::string> &names,
198 std::vector<Host> *hosts);
221 virtual void DoResolve(
const std::vector<std::string> &names,
222 const std::vector<bool> &skip,
223 std::vector<std::vector<std::string> > *ipv4_addresses,
224 std::vector<std::vector<std::string> > *ipv6_addresses,
225 std::vector<Failures> *failures,
226 std::vector<unsigned> *ttls,
227 std::vector<std::string> *fqdns) = 0;
309 virtual void DoResolve(
const std::vector<std::string> &names,
310 const std::vector<bool> &skip,
311 std::vector<std::vector<std::string> > *ipv4_addresses,
312 std::vector<std::vector<std::string> > *ipv6_addresses,
313 std::vector<Failures> *failures,
314 std::vector<unsigned> *ttls,
315 std::vector<std::string> *fqdns);
348 virtual void DoResolve(
const std::vector<std::string> &names,
349 const std::vector<bool> &skip,
350 std::vector<std::vector<std::string> > *ipv4_addresses,
351 std::vector<std::vector<std::string> > *ipv6_addresses,
352 std::vector<Failures> *failures,
353 std::vector<unsigned> *ttls,
354 std::vector<std::string> *fqdns);
397 virtual void DoResolve(
const std::vector<std::string> &names,
398 const std::vector<bool> &skip,
399 std::vector<std::vector<std::string> > *ipv4_addresses,
400 std::vector<std::vector<std::string> > *ipv6_addresses,
401 std::vector<Failures> *failures,
402 std::vector<unsigned> *ttls,
403 std::vector<std::string> *fqdns);
413 #endif // CVMFS_NETWORK_DNS_H_
static const int kHostnameMaxLength
virtual bool SetSearchDomains(const std::vector< std::string > &domains)
unsigned throttle() const
const char * Code2Ascii(const Failures error)
FRIEND_TEST(T_Dns, HostEquivalent)
virtual void SetSystemResolvers()
void ResolveMany(const std::vector< std::string > &names, std::vector< Host > *hosts)
Resolver returned a negative reply.
HostfileResolver * hostfile_resolver_
static NormalResolver * Create(const bool ipv4_only, const unsigned retries, const unsigned timeout_ms)
void CopyFrom(const Host &other)
void set_min_ttl(unsigned seconds)
CaresResolver * cares_resolver_
bool IsIpv4Address(const std::string &address)
const std::set< std::string > & ipv6_addresses() const
virtual bool SetSearchDomains(const std::vector< std::string > &domains)
std::vector< std::string > ipv4_addresses
virtual bool SetResolvers(const std::vector< std::string > &resolvers)=0
Resolver returned a positive reply but without IPs.
bool IsIpv6Address(const std::string &address)
std::set< std::string > ipv6_addresses_
static const unsigned kDefaultMaxTtl
const std::string & name() const
virtual void SetSystemResolvers()
CaresResolver(const bool ipv4_only, const unsigned retries, const unsigned timeout_ms)
Resolver(const bool ipv4_only, const unsigned retries, const unsigned timeout_ms)
virtual void SetSystemResolvers()=0
static const int kIpMaxLength
const std::set< std::string > & ipv4_addresses() const
static HostfileResolver * Create(const std::string &path, bool ipv4_only)
string StripIp(const string &decorated_ip)
void set_max_ttl(unsigned seconds)
virtual ~NormalResolver()
const std::set< std::string > & ViewBestAddresses(IpPreference preference) const
Host & operator=(const Host &other)
std::vector< std::string > system_resolvers_
virtual void SetSystemSearchDomains()
virtual void SetSystemResolvers()
std::vector< std::string > domains_
const std::vector< std::string > & resolvers() const
std::string AddDefaultScheme(const std::string &proxy)
std::map< std::string, HostEntry > host_map_
HostfileResolver(const bool ipv4_only)
virtual bool SetSearchDomains(const std::vector< std::string > &domains)
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)
bool IsEquivalent(const Host &other) const
virtual bool SetResolvers(const std::vector< std::string > &resolvers)
void set_throttle(const unsigned throttle)
virtual bool SetSearchDomains(const std::vector< std::string > &domains)=0
std::string ExtractPort(const std::string &url)
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)
std::string ExtractHost(const std::string &url)
FRIEND_TEST(T_Dns, NormalResolverConstruct)
virtual ~HostfileResolver()
Host Resolve(const std::string &name)
std::vector< std::string > resolvers_
static CaresResolver * Create(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)=0
static const unsigned kDefaultMinTtl
virtual void SetSystemSearchDomains()=0
static Host ExtendDeadline(const Host &original, unsigned seconds_from_now)
std::vector< std::string > system_domains_
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)
virtual void SetSystemSearchDomains()
std::set< std::string > ipv4_addresses_
virtual void SetSystemSearchDomains()
virtual bool SetResolvers(const std::vector< std::string > &)
const std::vector< std::string > & domains() const
static const unsigned kMaxAddresses
std::vector< std::string > ipv6_addresses
static atomic_int64 global_id_
virtual bool SetResolvers(const std::vector< std::string > &resolvers)
string RewriteUrl(const string &url, const string &ip)
unsigned timeout_ms() const