Bug 1688832: part 5) Add `static` `AccessibleCaretManager::GetSelection`, `::GetFrame...
[gecko.git] / netwerk / dns / ODoHService.h
blob0bee7243cbde1a22110fdcc1f67129aae8f6225a
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef ODoHService_h_
7 #define ODoHService_h_
9 #include "DNS.h"
10 #include "mozilla/Atomics.h"
11 #include "mozilla/Maybe.h"
12 #include "nsString.h"
13 #include "nsIDNSListener.h"
14 #include "nsIObserver.h"
15 #include "nsWeakReference.h"
17 namespace mozilla {
18 namespace net {
20 class ODoH;
22 class ODoHService : public nsIDNSListener,
23 public nsIObserver,
24 public nsSupportsWeakReference {
25 public:
26 NS_DECL_THREADSAFE_ISUPPORTS
27 NS_DECL_NSIDNSLISTENER
28 NS_DECL_NSIOBSERVER
30 ODoHService();
31 bool Init();
32 bool Enabled() const;
34 const Maybe<nsTArray<ObliviousDoHConfig>>& ODoHConfigs();
35 void AppendPendingODoHRequest(ODoH* aRequest);
36 void GetRequestURI(nsACString& aResult);
37 nsresult UpdateODoHConfig();
39 private:
40 virtual ~ODoHService();
41 nsresult ReadPrefs(const char* aName);
42 void OnODoHPrefsChange();
43 // Send a DNS query to reterive the ODoHConfig.
44 void BuildODoHRequestURI();
46 Mutex mLock;
47 Atomic<bool, Relaxed> mQueryODoHConfigInProgress;
48 nsCString mODoHProxyURI;
49 nsCString mODoHTargetHost;
50 nsCString mODoHTargetPath;
51 nsCString mODoHRequestURI;
52 Maybe<nsTArray<ObliviousDoHConfig>> mODoHConfigs;
53 nsTArray<RefPtr<ODoH>> mPendingRequests;
56 extern ODoHService* gODoHService;
58 } // namespace net
59 } // namespace mozilla
61 #endif