Merge mozilla-beta to b2g34. a=merge
[gecko.git] / netwerk / dns / nsDNSService2.h
blob3db214d0e22f24ac3745219b97ec8ed0d27d8fb7
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim: set sw=4 ts=8 et 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 nsDNSService2_h__
8 #define nsDNSService2_h__
10 #include "nsPIDNSService.h"
11 #include "nsIIDNService.h"
12 #include "nsIMemoryReporter.h"
13 #include "nsIObserver.h"
14 #include "nsHostResolver.h"
15 #include "nsAutoPtr.h"
16 #include "nsString.h"
17 #include "nsTHashtable.h"
18 #include "nsHashKeys.h"
19 #include "nsIObserverService.h"
20 #include "nsProxyRelease.h"
21 #include "mozilla/Mutex.h"
22 #include "mozilla/Attributes.h"
24 class nsDNSService MOZ_FINAL : public nsPIDNSService
25 , public nsIObserver
26 , public nsIMemoryReporter
28 public:
29 NS_DECL_THREADSAFE_ISUPPORTS
30 NS_DECL_NSPIDNSSERVICE
31 NS_DECL_NSIDNSSERVICE
32 NS_DECL_NSIOBSERVER
33 NS_DECL_NSIMEMORYREPORTER
35 nsDNSService();
37 static nsIDNSService* GetXPCOMSingleton();
39 size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
41 private:
42 ~nsDNSService();
44 static nsDNSService* GetSingleton();
46 uint16_t GetAFForLookup(const nsACString &host, uint32_t flags);
48 nsRefPtr<nsHostResolver> mResolver;
49 nsCOMPtr<nsIIDNService> mIDN;
51 // mLock protects access to mResolver and mIPv4OnlyDomains
52 mozilla::Mutex mLock;
54 // mIPv4OnlyDomains is a comma-separated list of domains for which only
55 // IPv4 DNS lookups are performed. This allows the user to disable IPv6 on
56 // a per-domain basis and work around broken DNS servers. See bug 68796.
57 nsAdoptingCString mIPv4OnlyDomains;
58 bool mDisableIPv6;
59 bool mDisablePrefetch;
60 bool mFirstTime;
61 bool mOffline;
62 bool mNotifyResolution;
63 nsMainThreadPtrHandle<nsIObserverService> mObserverService;
64 nsTHashtable<nsCStringHashKey> mLocalDomains;
67 #endif //nsDNSService2_h__