CernVM-FS
2.12.0
|
Namespaces | |
anonymous_namespace{dns.cc} | |
Classes | |
class | Host |
class | Resolver |
class | CaresResolver |
class | HostfileResolver |
class | NormalResolver |
Enumerations | |
enum | Failures { kFailOk = 0, kFailInvalidResolvers, kFailTimeout, kFailInvalidHost, kFailUnknownHost, kFailMalformed, kFailNoAddress, kFailNotYetResolved, kFailOther, kFailNumEntries } |
enum | IpPreference { kIpPreferSystem = 0, kIpPreferV4, kIpPreferV6 } |
Functions | |
static void | PinpointHostSubstr (const std::string &url, unsigned *pos_begin, unsigned *pos_end) |
std::string | ExtractHost (const std::string &url) |
std::string | ExtractPort (const std::string &url) |
string | RewriteUrl (const string &url, const string &ip) |
string | StripIp (const string &decorated_ip) |
std::string | AddDefaultScheme (const std::string &proxy) |
static Failures | CaresExtractIpv4 (const unsigned char *abuf, int alen, vector< string > *addresses, unsigned *ttl, string *fqdn) |
static Failures | CaresExtractIpv6 (const unsigned char *abuf, int alen, vector< string > *addresses, unsigned *ttl, string *fqdn) |
static void | CallbackCares (void *arg, int status, int timeouts_ms, unsigned char *abuf, int alen) |
static bool | SortNameLength (const string &a, const string &b) |
const char * | Code2Ascii (const Failures error) |
std::string | RewriteUrl (const std::string &url, const std::string &ip) |
std::string | StripIp (const std::string &decorated_ip) |
This file is part of the CernVM File System.
enum dns::Failures |
Possible errors when trying to resolve a host name.
Enumerator | |
---|---|
kFailOk | |
kFailInvalidResolvers | |
kFailTimeout | |
kFailInvalidHost | |
kFailUnknownHost |
Resolver returned a negative reply. |
kFailMalformed | |
kFailNoAddress |
Resolver returned a positive reply but without IPs. |
kFailNotYetResolved | |
kFailOther | |
kFailNumEntries |
enum dns::IpPreference |
std::string dns::AddDefaultScheme | ( | const std::string & | proxy | ) |
Adds http:// if it is missing from proxy
Definition at line 187 of file dns.cc.
Referenced by download::DownloadManager::SetProxyChain().
|
static |
Called when a DNS query returns or times out. Sets the return status and the IP addresses (if successful) in the QueryInfo object.
Definition at line 564 of file dns.cc.
Referenced by dns::CaresResolver::DoResolve().
|
static |
Extracts IPv4 addresses from an A record return in c-ares. TTLs are merged to a single one, representing the minimum.
Definition at line 617 of file dns.cc.
Referenced by CallbackCares().
|
static |
Definition at line 668 of file dns.cc.
Referenced by CallbackCares().
|
inline |
Definition at line 53 of file dns.h.
Referenced by dns::Resolver::ResolveMany(), download::DownloadManager::SetProxyChain(), and download::DownloadManager::ValidateProxyIpsUnlocked().
std::string dns::ExtractHost | ( | const std::string & | url | ) |
Returns the host name from a string in the format http://<hostname>:<port>[/path] or an empty string if url doesn't match the format.
Definition at line 110 of file dns.cc.
Referenced by download::DownloadManager::GeoSortServers(), s3fanout::S3FanoutManager::InitializeDnsSettings(), download::DownloadManager::ProbeGeo(), and download::DownloadManager::SetProxyChain().
std::string dns::ExtractPort | ( | const std::string & | url | ) |
Returns the port from a string in the format http://<hostname>:<port>/path or an empty string if url doesn't match the format.
Definition at line 125 of file dns.cc.
Referenced by s3fanout::S3FanoutManager::InitializeDnsSettings().
|
static |
Sets pos_begin and pos_end to the first/last character of the host name in a string like http://<hostname>:<port>. Works also if the host name is an IPv4/6 address. Sets pos_begin and pos_end to 0 if url doesn't match the format.
Definition at line 53 of file dns.cc.
Referenced by ExtractHost(), ExtractPort(), and RewriteUrl().
std::string dns::RewriteUrl | ( | const std::string & | url, |
const std::string & | ip | ||
) |
string dns::RewriteUrl | ( | const string & | url, |
const string & | ip | ||
) |
Replaces the host name in the url with the given IP address. If it is an IPv6 address, it has to be in brackets. If the input is not a valid URL, it is returned unmodified.
Definition at line 156 of file dns.cc.
Referenced by download::DownloadManager::SetProxyChain(), and download::DownloadManager::ValidateProxyIpsUnlocked().
|
static |
Used to process longer domain names before shorter ones, in order to get the correct fully qualified domain name. Reversed return value in order to sort in descending order.
Definition at line 1082 of file dns.cc.
Referenced by dns::HostfileResolver::DoResolve().
std::string dns::StripIp | ( | const std::string & | decorated_ip | ) |