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/. */
10 #include "mozilla/Atomics.h"
11 #include "mozilla/Maybe.h"
13 #include "nsIDNSListener.h"
14 #include "nsIObserver.h"
15 #include "nsWeakReference.h"
22 class ODoHService
: public nsIDNSListener
,
24 public nsSupportsWeakReference
{
26 NS_DECL_THREADSAFE_ISUPPORTS
27 NS_DECL_NSIDNSLISTENER
34 const Maybe
<nsTArray
<ObliviousDoHConfig
>>& ODoHConfigs();
35 void AppendPendingODoHRequest(ODoH
* aRequest
);
36 void GetRequestURI(nsACString
& aResult
);
37 nsresult
UpdateODoHConfig();
40 virtual ~ODoHService();
41 nsresult
ReadPrefs(const char* aName
);
42 void OnODoHPrefsChange();
43 // Send a DNS query to reterive the ODoHConfig.
44 void BuildODoHRequestURI();
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
;
59 } // namespace mozilla