gecko-dev/netwerk/dns/GetAddrInfo.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 строки
1.9 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef netwerk_dns_GetAddrInfo_h
#define netwerk_dns_GetAddrInfo_h
#include "nsError.h"
#include "nscore.h"
#if defined(XP_WIN)
# define DNSQUERY_AVAILABLE 1
#else
bug 1434852 - introducing TRR (DOH); r=mcmanus,valentin Provides an optional resolver mechanism for Firefox that allows running together with or instead of the native resolver. TRR offers resolving of host names using a dedicated DNS-over-HTTPS server (HTTPS is required, HTTP/2 is preferable). DNS-over-HTTPS (DOH) allows DNS resolves with enhanced privacy, secure transfers and improved performance. To keep the failure rate at a minimum, the TRR system manages a dynamic persistent blacklist for host names that can't be resolved with DOH but works with the native resolver. Blacklisted entries will not be retried over DOH for a couple of days. "localhost" and names in the ".local" TLD will not be resolved via DOH. TRR is preffed OFF by default and you need to set a URI for an available DOH server to be able to use it. Since the URI for DOH is set with a name itself, it may have to use the native resolver for bootstrapping. (Optionally, the user can set the IP address of the DOH server in a pref to avoid the required initial native resolve.) When TRR starts up, it will first verify that it works by checking a "confirmation" domain name. This confirmation domain is a pref by default set to "example.com". TRR will also by default await the captive-portal detection to raise its green flag before getting activated. All prefs for TRR are under the "network.trr" hierarchy. The DNS-over-HTTPS spec: https://tools.ietf.org/html/draft-ietf-doh-dns-over-https-03 MozReview-Commit-ID: GuuU6vjTjlm --HG-- extra : rebase_source : 53fcca757334090ac05fec540ef29d109d5ceed3
2018-02-01 12:20:49 +03:00
# undef DNSQUERY_AVAILABLE
#endif
namespace mozilla {
namespace net {
class AddrInfo;
/**
* Look up a host by name. Mostly equivalent to getaddrinfo(host, NULL, ...) of
* RFC 3493.
*
* @param aHost[in] Character string defining the host name of interest
* @param aAddressFamily[in] May be AF_INET, AF_INET6, or AF_UNSPEC.
* @param aFlags[in] May be either PR_AI_ADDRCONFIG or
* PR_AI_ADDRCONFIG | PR_AI_NOCANONNAME. Include PR_AI_NOCANONNAME to
* suppress the determination of the canonical name corresponding to
* hostname (PR_AI_NOCANONNAME will be ignored if the TTL is retrieved).
* @param aAddrInfo[out] Will point to the results of the host lookup, or be
* null if the lookup failed.
bug 1434852 - introducing TRR (DOH); r=mcmanus,valentin Provides an optional resolver mechanism for Firefox that allows running together with or instead of the native resolver. TRR offers resolving of host names using a dedicated DNS-over-HTTPS server (HTTPS is required, HTTP/2 is preferable). DNS-over-HTTPS (DOH) allows DNS resolves with enhanced privacy, secure transfers and improved performance. To keep the failure rate at a minimum, the TRR system manages a dynamic persistent blacklist for host names that can't be resolved with DOH but works with the native resolver. Blacklisted entries will not be retried over DOH for a couple of days. "localhost" and names in the ".local" TLD will not be resolved via DOH. TRR is preffed OFF by default and you need to set a URI for an available DOH server to be able to use it. Since the URI for DOH is set with a name itself, it may have to use the native resolver for bootstrapping. (Optionally, the user can set the IP address of the DOH server in a pref to avoid the required initial native resolve.) When TRR starts up, it will first verify that it works by checking a "confirmation" domain name. This confirmation domain is a pref by default set to "example.com". TRR will also by default await the captive-portal detection to raise its green flag before getting activated. All prefs for TRR are under the "network.trr" hierarchy. The DNS-over-HTTPS spec: https://tools.ietf.org/html/draft-ietf-doh-dns-over-https-03 MozReview-Commit-ID: GuuU6vjTjlm --HG-- extra : rebase_source : 53fcca757334090ac05fec540ef29d109d5ceed3
2018-02-01 12:20:49 +03:00
* @param aGetTtl[in] If true, the TTL will be retrieved if DNS provides the
* answers..
*/
nsresult GetAddrInfo(const nsACString& aHost, uint16_t aAddressFamily,
uint16_t aFlags, AddrInfo** aAddrInfo, bool aGetTtl);
/**
* Initialize the GetAddrInfo module.
*
* GetAddrInfoShutdown() should be called for every time this function is
* called.
*/
nsresult GetAddrInfoInit();
/**
* Shutdown the GetAddrInfo module.
*
* This function should be called for every time GetAddrInfoInit() is called.
* An assertion may throw (but is not guarenteed) if this function is called
* too many times.
*/
nsresult GetAddrInfoShutdown();
} // namespace net
} // namespace mozilla
#endif // netwerk_dns_GetAddrInfo_h