Line data Source code
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 "mozilla/Mutex.h"
20 : #include "mozilla/Attributes.h"
21 :
22 0 : class nsDNSService final : public nsPIDNSService
23 : , public nsIObserver
24 : , public nsIMemoryReporter
25 : {
26 : public:
27 : NS_DECL_THREADSAFE_ISUPPORTS
28 : NS_DECL_NSPIDNSSERVICE
29 : NS_DECL_NSIDNSSERVICE
30 : NS_DECL_NSIOBSERVER
31 : NS_DECL_NSIMEMORYREPORTER
32 :
33 : nsDNSService();
34 :
35 : static nsIDNSService* GetXPCOMSingleton();
36 :
37 : size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
38 :
39 : bool GetOffline() const;
40 :
41 : private:
42 : ~nsDNSService();
43 :
44 : static nsDNSService* GetSingleton();
45 :
46 : uint16_t GetAFForLookup(const nsACString &host, uint32_t flags);
47 :
48 : nsresult PreprocessHostname(bool aLocalDomain,
49 : const nsACString &aInput,
50 : nsIIDNService *aIDN,
51 : nsACString &aACE);
52 :
53 : RefPtr<nsHostResolver> mResolver;
54 : nsCOMPtr<nsIIDNService> mIDN;
55 :
56 : // mLock protects access to mResolver and mIPv4OnlyDomains
57 : mozilla::Mutex mLock;
58 :
59 : // mIPv4OnlyDomains is a comma-separated list of domains for which only
60 : // IPv4 DNS lookups are performed. This allows the user to disable IPv6 on
61 : // a per-domain basis and work around broken DNS servers. See bug 68796.
62 : nsAdoptingCString mIPv4OnlyDomains;
63 : nsAdoptingCString mForceResolve;
64 : bool mDisableIPv6;
65 : bool mDisablePrefetch;
66 : bool mBlockDotOnion;
67 : bool mFirstTime;
68 : bool mNotifyResolution;
69 : bool mOfflineLocalhost;
70 : bool mForceResolveOn;
71 : nsTHashtable<nsCStringHashKey> mLocalDomains;
72 : };
73 :
74 : #endif //nsDNSService2_h__
|