CernVM-FS
2.12.0
|
#include <dns.h>
Public Member Functions | |
Host () | |
Host (const Host &other) | |
Host & | operator= (const Host &other) |
bool | IsEquivalent (const Host &other) const |
bool | IsExpired () const |
bool | IsValid () const |
time_t | deadline () const |
int64_t | id () const |
bool | HasIpv4 () const |
bool | HasIpv6 () const |
const std::set< std::string > & | ipv4_addresses () const |
const std::set< std::string > & | ipv6_addresses () const |
const std::set< std::string > & | ViewBestAddresses (IpPreference preference) const |
const std::string & | name () const |
Failures | status () const |
Static Public Member Functions | |
static Host | ExtendDeadline (const Host &original, unsigned seconds_from_now) |
Private Member Functions | |
FRIEND_TEST (T_Dns, HostEquivalent) | |
FRIEND_TEST (T_Dns, HostExpired) | |
FRIEND_TEST (T_Dns, HostValid) | |
FRIEND_TEST (T_Dns, HostExtendDeadline) | |
FRIEND_TEST (T_Dns, HostBestAddresses) | |
void | CopyFrom (const Host &other) |
Private Attributes | |
time_t | deadline_ |
int64_t | id_ |
std::set< std::string > | ipv4_addresses_ |
std::set< std::string > | ipv6_addresses_ |
std::string | name_ |
Failures | status_ |
Static Private Attributes | |
static atomic_int64 | global_id_ = 0 |
Friends | |
class | Resolver |
Stores the resolved IPv4 and IPv6 addresses of a host name including their time to live. Data in these objects are immutable. They are created by a a Resolver. Once the TTL has expired, they become invalid and a new Host object should be fetched from a resolver.
A host object can be copied into a new object with an extended deadline. This is useful if an attempt to resolve a name fails where it previously succeeded. In this case, the extended deadline can be used to delay another name resolution attempt for some grace period.
For successful name resolution, the name is the fully qualified domain name, even if a short name was given to the resolver.
dns::Host::Host | ( | ) |
dns::Host::Host | ( | const Host & | other | ) |
|
private |
Definition at line 217 of file dns.cc.
Referenced by Host(), and operator=().
Creates a copy of the original host with a new ID and sets a new dealine given in seconds from the current time.
Definition at line 231 of file dns.cc.
Referenced by download::DownloadManager::SetProxyChain(), and download::DownloadManager::ValidateProxyIpsUnlocked().
|
private |
|
private |
|
private |
|
private |
|
private |
|
inline |
Definition at line 108 of file dns.h.
Referenced by download::DownloadManager::ValidateProxyIpsUnlocked().
|
inline |
Definition at line 111 of file dns.h.
Referenced by s3fanout::S3FanoutManager::InitializeDnsSettings().
|
inline |
bool dns::Host::IsEquivalent | ( | const Host & | other | ) | const |
Compares the name and the resolved addresses independent of deadlines. Used to decide if the current proxy list needs to be changed after re-resolving a host name.
Definition at line 269 of file dns.cc.
Referenced by download::DownloadManager::ValidateProxyIpsUnlocked().
bool dns::Host::IsExpired | ( | ) | const |
Compares the TTL from a provious call to time() with the current time.
Definition at line 280 of file dns.cc.
Referenced by IsValid(), and download::DownloadManager::ValidateProxyIpsUnlocked().
bool dns::Host::IsValid | ( | ) | const |
|
inline |
Definition at line 118 of file dns.h.
Referenced by download::DownloadManager::UpdateProxiesUnlocked(), and download::DownloadManager::ValidateProxyIpsUnlocked().
|
inline |
Definition at line 119 of file dns.h.
Referenced by download::DownloadManager::SetUrlOptions(), and download::DownloadManager::ValidateProxyIpsUnlocked().
const set< string > & dns::Host::ViewBestAddresses | ( | IpPreference | preference | ) | const |
Definition at line 205 of file dns.cc.
Referenced by download::DownloadManager::SetProxyChain(), and download::DownloadManager::ValidateProxyIpsUnlocked().
|
private |
When the name resolution becomes outdated, in UTC seconds since UNIX epoch. Once the deadline is passed, IsValid returns false.
Definition at line 135 of file dns.h.
Referenced by CopyFrom(), deadline(), ExtendDeadline(), IsExpired(), and dns::Resolver::ResolveMany().
|
staticprivate |
|
private |
The unique id of this instance of Host.
Definition at line 140 of file dns.h.
Referenced by CopyFrom(), ExtendDeadline(), and id().
|
private |
ASCII representation of IPv4 addresses (a.b.c.d), so that they can be readily used by curl.
Definition at line 146 of file dns.h.
Referenced by CopyFrom(), HasIpv4(), ipv4_addresses(), IsEquivalent(), IsValid(), and dns::Resolver::ResolveMany().
|
private |
ASCII representation of IPv6 addresses in the form "[a:b:c:d:e:f:g:h]", so that they can be readily used by curl.
Definition at line 152 of file dns.h.
Referenced by CopyFrom(), HasIpv6(), ipv6_addresses(), IsEquivalent(), IsValid(), and dns::Resolver::ResolveMany().
|
private |
The host name either fully qualified or within the search domain.
Definition at line 157 of file dns.h.
Referenced by CopyFrom(), IsEquivalent(), name(), and dns::Resolver::ResolveMany().
|
private |
Error code of the name resolution that led to this object.
Definition at line 162 of file dns.h.
Referenced by CopyFrom(), IsEquivalent(), IsValid(), dns::Resolver::ResolveMany(), and status().