Bumping manifests a=b2g-bump
[gecko.git] / netwerk / dns / GetAddrInfo.h
blob57c008dd506c27a869cabcea9525a8cd9a49c507
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef netwerk_dns_GetAddrInfo_h
8 #define netwerk_dns_GetAddrInfo_h
10 #include "nsError.h"
11 #include "nscore.h"
13 #if defined(XP_WIN)
14 #define DNSQUERY_AVAILABLE 1
15 #define TTL_AVAILABLE 1
16 #else
17 #define DNSQUERY_AVAILABLE 0
18 #define TTL_AVAILABLE 0
19 #endif
21 namespace mozilla {
22 namespace net {
24 class AddrInfo;
26 /**
27 * Look up a host by name. Mostly equivalent to getaddrinfo(host, NULL, ...) of
28 * RFC 3493.
30 * @param aHost[in] Character string defining the host name of interest
31 * @param aAddressFamily[in] May be AF_INET, AF_INET6, or AF_UNSPEC.
32 * @param aFlags[in] May be either PR_AI_ADDRCONFIG or
33 * PR_AI_ADDRCONFIG | PR_AI_NOCANONNAME. Include PR_AI_NOCANONNAME to
34 * suppress the determination of the canonical name corresponding to
35 * hostname (PR_AI_NOCANONNAME will be ignored if the TTL is retrieved).
36 * @param aAddrInfo[out] Will point to the results of the host lookup, or be
37 * null if the lookup failed.
38 * @param aGetTtl[in] If true, and TTL_AVAILABLE is truthy, the TTL will be
39 * retrieved if DNS provides the answers..
41 nsresult
42 GetAddrInfo(const char* aHost, uint16_t aAddressFamily, uint16_t aFlags,
43 const char* aNetworkInterface, AddrInfo** aAddrInfo, bool aGetTtl);
45 /**
46 * Initialize the GetAddrInfo module.
48 * GetAddrInfoShutdown() should be called for every time this function is
49 * called.
51 nsresult
52 GetAddrInfoInit();
54 /**
55 * Shutdown the GetAddrInfo module.
57 * This function should be called for every time GetAddrInfoInit() is called.
58 * An assertion may throw (but is not guarenteed) if this function is called
59 * too many times.
61 nsresult
62 GetAddrInfoShutdown();
64 } // namespace net
65 } // namespace mozilla
67 #endif // netwerk_dns_GetAddrInfo_h