|
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/. */ |
|
6 |
|
7 #ifndef nsDNSService2_h__ |
|
8 #define nsDNSService2_h__ |
|
9 |
|
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" |
|
23 |
|
24 class nsDNSService MOZ_FINAL : public nsPIDNSService |
|
25 , public nsIObserver |
|
26 , public nsIMemoryReporter |
|
27 { |
|
28 public: |
|
29 NS_DECL_THREADSAFE_ISUPPORTS |
|
30 NS_DECL_NSPIDNSSERVICE |
|
31 NS_DECL_NSIDNSSERVICE |
|
32 NS_DECL_NSIOBSERVER |
|
33 NS_DECL_NSIMEMORYREPORTER |
|
34 |
|
35 nsDNSService(); |
|
36 ~nsDNSService(); |
|
37 |
|
38 static nsIDNSService* GetXPCOMSingleton(); |
|
39 |
|
40 size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const; |
|
41 |
|
42 private: |
|
43 static nsDNSService* GetSingleton(); |
|
44 |
|
45 uint16_t GetAFForLookup(const nsACString &host, uint32_t flags); |
|
46 |
|
47 nsRefPtr<nsHostResolver> mResolver; |
|
48 nsCOMPtr<nsIIDNService> mIDN; |
|
49 |
|
50 // mLock protects access to mResolver and mIPv4OnlyDomains |
|
51 mozilla::Mutex mLock; |
|
52 |
|
53 // mIPv4OnlyDomains is a comma-separated list of domains for which only |
|
54 // IPv4 DNS lookups are performed. This allows the user to disable IPv6 on |
|
55 // a per-domain basis and work around broken DNS servers. See bug 68796. |
|
56 nsAdoptingCString mIPv4OnlyDomains; |
|
57 bool mDisableIPv6; |
|
58 bool mDisablePrefetch; |
|
59 bool mFirstTime; |
|
60 bool mDisableDNS; |
|
61 bool mOffline; |
|
62 bool mNotifyResolution; |
|
63 nsMainThreadPtrHandle<nsIObserverService> mObserverService; |
|
64 nsTHashtable<nsCStringHashKey> mLocalDomains; |
|
65 }; |
|
66 |
|
67 #endif //nsDNSService2_h__ |