Back out Bug 450717
[wine-gecko.git] / netwerk / system / win32 / nsNotifyAddrListener.h
blobc2a3b2dad495252497fedb2a5579610333bc065b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim:set et sw=4 ts=4: */
3 /* ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License
7 * Version 1.1 (the "License"); you may not use this file except in
8 * compliance with the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is written by Juan Lang.
18 * The Initial Developer of the Original Code is
19 * Juan Lang.
20 * Portions created by the Initial Developer are Copyright (C) 2003,2006
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
38 #ifndef NSNOTIFYADDRLISTENER_H_
39 #define NSNOTIFYADDRLISTENER_H_
41 #include <windows.h>
42 #include "nsINetworkLinkService.h"
43 #include "nsIRunnable.h"
44 #include "nsIObserver.h"
45 #include "nsThreadUtils.h"
46 #include "nsCOMPtr.h"
48 class nsNotifyAddrListener : public nsINetworkLinkService,
49 public nsIRunnable,
50 public nsIObserver
52 public:
53 NS_DECL_ISUPPORTS
54 NS_DECL_NSINETWORKLINKSERVICE
55 NS_DECL_NSIRUNNABLE
56 NS_DECL_NSIOBSERVER
58 nsNotifyAddrListener();
59 virtual ~nsNotifyAddrListener();
61 nsresult Init(void);
63 protected:
64 class ChangeEvent : public nsRunnable {
65 public:
66 NS_DECL_NSIRUNNABLE
67 ChangeEvent(nsINetworkLinkService *aService, const char *aEventID)
68 : mService(aService), mEventID(aEventID) {
70 private:
71 nsCOMPtr<nsINetworkLinkService> mService;
72 const char *mEventID;
75 PRPackedBool mLinkUp;
76 PRPackedBool mStatusKnown;
78 nsresult Shutdown(void);
79 nsresult SendEventToUI(const char *aEventID);
81 DWORD GetOperationalStatus(DWORD aAdapterIndex);
82 DWORD CheckIPAddrTable(void);
83 DWORD CheckAdaptersInfo(void);
84 DWORD CheckAdaptersAddresses(void);
85 void CheckLinkStatus(void);
87 nsCOMPtr<nsIThread> mThread;
89 OSVERSIONINFO mOSVerInfo;
90 HANDLE mShutdownEvent;
93 #endif /* NSNOTIFYADDRLISTENER_H_ */