Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* vim:set et sw=4 ts=4: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | #ifndef NSNOTIFYADDRLISTENER_H_ |
michael@0 | 7 | #define NSNOTIFYADDRLISTENER_H_ |
michael@0 | 8 | |
michael@0 | 9 | #include <windows.h> |
michael@0 | 10 | #include <winsock2.h> |
michael@0 | 11 | #include <iptypes.h> |
michael@0 | 12 | #include "nsINetworkLinkService.h" |
michael@0 | 13 | #include "nsIRunnable.h" |
michael@0 | 14 | #include "nsIObserver.h" |
michael@0 | 15 | #include "nsThreadUtils.h" |
michael@0 | 16 | #include "nsCOMPtr.h" |
michael@0 | 17 | |
michael@0 | 18 | class nsNotifyAddrListener : public nsINetworkLinkService, |
michael@0 | 19 | public nsIRunnable, |
michael@0 | 20 | public nsIObserver |
michael@0 | 21 | { |
michael@0 | 22 | public: |
michael@0 | 23 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 24 | NS_DECL_NSINETWORKLINKSERVICE |
michael@0 | 25 | NS_DECL_NSIRUNNABLE |
michael@0 | 26 | NS_DECL_NSIOBSERVER |
michael@0 | 27 | |
michael@0 | 28 | nsNotifyAddrListener(); |
michael@0 | 29 | virtual ~nsNotifyAddrListener(); |
michael@0 | 30 | |
michael@0 | 31 | nsresult Init(void); |
michael@0 | 32 | |
michael@0 | 33 | protected: |
michael@0 | 34 | class ChangeEvent : public nsRunnable { |
michael@0 | 35 | public: |
michael@0 | 36 | NS_DECL_NSIRUNNABLE |
michael@0 | 37 | ChangeEvent(nsINetworkLinkService *aService, const char *aEventID) |
michael@0 | 38 | : mService(aService), mEventID(aEventID) { |
michael@0 | 39 | } |
michael@0 | 40 | private: |
michael@0 | 41 | nsCOMPtr<nsINetworkLinkService> mService; |
michael@0 | 42 | const char *mEventID; |
michael@0 | 43 | }; |
michael@0 | 44 | |
michael@0 | 45 | bool mLinkUp; |
michael@0 | 46 | bool mStatusKnown; |
michael@0 | 47 | bool mCheckAttempted; |
michael@0 | 48 | |
michael@0 | 49 | nsresult Shutdown(void); |
michael@0 | 50 | nsresult SendEventToUI(const char *aEventID); |
michael@0 | 51 | |
michael@0 | 52 | DWORD CheckAdaptersAddresses(void); |
michael@0 | 53 | bool CheckIsGateway(PIP_ADAPTER_ADDRESSES aAdapter); |
michael@0 | 54 | bool CheckICSStatus(PWCHAR aAdapterName); |
michael@0 | 55 | void CheckLinkStatus(void); |
michael@0 | 56 | |
michael@0 | 57 | nsCOMPtr<nsIThread> mThread; |
michael@0 | 58 | |
michael@0 | 59 | HANDLE mShutdownEvent; |
michael@0 | 60 | }; |
michael@0 | 61 | |
michael@0 | 62 | #endif /* NSNOTIFYADDRLISTENER_H_ */ |