1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 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/. */
7 #ifndef NSANDROIDNETWORKLINKSERVICE_H_
8 #define NSANDROIDNETWORKLINKSERVICE_H_
10 #include "nsINetworkLinkService.h"
11 #include "nsIObserver.h"
12 #include "../netlink/NetlinkService.h"
14 class nsAndroidNetworkLinkService
15 : public nsINetworkLinkService
,
17 public mozilla::net::NetlinkServiceListener
{
19 NS_DECL_THREADSAFE_ISUPPORTS
20 NS_DECL_NSINETWORKLINKSERVICE
23 nsAndroidNetworkLinkService();
27 void OnNetworkChanged() override
;
28 void OnNetworkIDChanged() override
;
29 void OnLinkUp() override
;
30 void OnLinkDown() override
;
31 void OnLinkStatusKnown() override
;
32 void OnDnsSuffixListUpdated() override
;
35 virtual ~nsAndroidNetworkLinkService() = default;
37 // Called when xpcom-shutdown-threads is received.
40 // Sends the network event.
41 void NotifyObservers(const char* aTopic
, const char* aData
);
43 mozilla::Atomic
<bool, mozilla::Relaxed
> mStatusIsKnown
;
45 RefPtr
<mozilla::net::NetlinkService
> mNetlinkSvc
;
48 #endif /* NSANDROIDNETWORKLINKSERVICE_H_ */