1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef NetworkConnectivityService_h_
6 #define NetworkConnectivityService_h_
8 #include "nsINetworkConnectivityService.h"
13 class NetworkConnectivityService
: public nsINetworkConnectivityService
,
15 public nsIDNSListener
,
16 public nsIStreamListener
{
19 NS_DECL_NSINETWORKCONNECTIVITYSERVICE
21 NS_DECL_NSIDNSLISTENER
22 NS_DECL_NSISTREAMLISTENER
23 NS_DECL_NSIREQUESTOBSERVER
26 static already_AddRefed
<NetworkConnectivityService
> GetSingleton();
29 NetworkConnectivityService() = default;
30 virtual ~NetworkConnectivityService() = default;
32 // Calls all the check methods
35 // Will be set to OK if the DNS request returned in IP of this type,
36 // NOT_AVAILABLE if that type of resolution is not available
37 // UNKNOWN if the check wasn't performed
38 ConnectivityState mDNSv4
= nsINetworkConnectivityService::UNKNOWN
;
39 ConnectivityState mDNSv6
= nsINetworkConnectivityService::UNKNOWN
;
41 ConnectivityState mIPv4
= nsINetworkConnectivityService::UNKNOWN
;
42 ConnectivityState mIPv6
= nsINetworkConnectivityService::UNKNOWN
;
44 nsCOMPtr
<nsICancelable
> mDNSv4Request
;
45 nsCOMPtr
<nsICancelable
> mDNSv6Request
;
47 nsCOMPtr
<nsIChannel
> mIPv4Channel
;
48 nsCOMPtr
<nsIChannel
> mIPv6Channel
;
52 } // namespace mozilla
54 #endif // NetworkConnectivityService_h_