1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/system/win32/nsNotifyAddrListener.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* vim:set et sw=4 ts=4: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 +#ifndef NSNOTIFYADDRLISTENER_H_ 1.10 +#define NSNOTIFYADDRLISTENER_H_ 1.11 + 1.12 +#include <windows.h> 1.13 +#include <winsock2.h> 1.14 +#include <iptypes.h> 1.15 +#include "nsINetworkLinkService.h" 1.16 +#include "nsIRunnable.h" 1.17 +#include "nsIObserver.h" 1.18 +#include "nsThreadUtils.h" 1.19 +#include "nsCOMPtr.h" 1.20 + 1.21 +class nsNotifyAddrListener : public nsINetworkLinkService, 1.22 + public nsIRunnable, 1.23 + public nsIObserver 1.24 +{ 1.25 +public: 1.26 + NS_DECL_THREADSAFE_ISUPPORTS 1.27 + NS_DECL_NSINETWORKLINKSERVICE 1.28 + NS_DECL_NSIRUNNABLE 1.29 + NS_DECL_NSIOBSERVER 1.30 + 1.31 + nsNotifyAddrListener(); 1.32 + virtual ~nsNotifyAddrListener(); 1.33 + 1.34 + nsresult Init(void); 1.35 + 1.36 +protected: 1.37 + class ChangeEvent : public nsRunnable { 1.38 + public: 1.39 + NS_DECL_NSIRUNNABLE 1.40 + ChangeEvent(nsINetworkLinkService *aService, const char *aEventID) 1.41 + : mService(aService), mEventID(aEventID) { 1.42 + } 1.43 + private: 1.44 + nsCOMPtr<nsINetworkLinkService> mService; 1.45 + const char *mEventID; 1.46 + }; 1.47 + 1.48 + bool mLinkUp; 1.49 + bool mStatusKnown; 1.50 + bool mCheckAttempted; 1.51 + 1.52 + nsresult Shutdown(void); 1.53 + nsresult SendEventToUI(const char *aEventID); 1.54 + 1.55 + DWORD CheckAdaptersAddresses(void); 1.56 + bool CheckIsGateway(PIP_ADAPTER_ADDRESSES aAdapter); 1.57 + bool CheckICSStatus(PWCHAR aAdapterName); 1.58 + void CheckLinkStatus(void); 1.59 + 1.60 + nsCOMPtr<nsIThread> mThread; 1.61 + 1.62 + HANDLE mShutdownEvent; 1.63 +}; 1.64 + 1.65 +#endif /* NSNOTIFYADDRLISTENER_H_ */