michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim:set et sw=4 ts=4: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef NSNOTIFYADDRLISTENER_H_ michael@0: #define NSNOTIFYADDRLISTENER_H_ michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: #include "nsINetworkLinkService.h" michael@0: #include "nsIRunnable.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsThreadUtils.h" michael@0: #include "nsCOMPtr.h" michael@0: michael@0: class nsNotifyAddrListener : public nsINetworkLinkService, michael@0: public nsIRunnable, michael@0: public nsIObserver michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSINETWORKLINKSERVICE michael@0: NS_DECL_NSIRUNNABLE michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: nsNotifyAddrListener(); michael@0: virtual ~nsNotifyAddrListener(); michael@0: michael@0: nsresult Init(void); michael@0: michael@0: protected: michael@0: class ChangeEvent : public nsRunnable { michael@0: public: michael@0: NS_DECL_NSIRUNNABLE michael@0: ChangeEvent(nsINetworkLinkService *aService, const char *aEventID) michael@0: : mService(aService), mEventID(aEventID) { michael@0: } michael@0: private: michael@0: nsCOMPtr mService; michael@0: const char *mEventID; michael@0: }; michael@0: michael@0: bool mLinkUp; michael@0: bool mStatusKnown; michael@0: bool mCheckAttempted; michael@0: michael@0: nsresult Shutdown(void); michael@0: nsresult SendEventToUI(const char *aEventID); michael@0: michael@0: DWORD CheckAdaptersAddresses(void); michael@0: bool CheckIsGateway(PIP_ADAPTER_ADDRESSES aAdapter); michael@0: bool CheckICSStatus(PWCHAR aAdapterName); michael@0: void CheckLinkStatus(void); michael@0: michael@0: nsCOMPtr mThread; michael@0: michael@0: HANDLE mShutdownEvent; michael@0: }; michael@0: michael@0: #endif /* NSNOTIFYADDRLISTENER_H_ */