netwerk/system/win32/nsNotifyAddrListener.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim:set et sw=4 ts=4: */
     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/. */
     6 #ifndef NSNOTIFYADDRLISTENER_H_
     7 #define NSNOTIFYADDRLISTENER_H_
     9 #include <windows.h>
    10 #include <winsock2.h>
    11 #include <iptypes.h>
    12 #include "nsINetworkLinkService.h"
    13 #include "nsIRunnable.h"
    14 #include "nsIObserver.h"
    15 #include "nsThreadUtils.h"
    16 #include "nsCOMPtr.h"
    18 class nsNotifyAddrListener : public nsINetworkLinkService,
    19                              public nsIRunnable,
    20                              public nsIObserver
    21 {
    22 public:
    23     NS_DECL_THREADSAFE_ISUPPORTS
    24     NS_DECL_NSINETWORKLINKSERVICE
    25     NS_DECL_NSIRUNNABLE
    26     NS_DECL_NSIOBSERVER
    28     nsNotifyAddrListener();
    29     virtual ~nsNotifyAddrListener();
    31     nsresult Init(void);
    33 protected:
    34     class ChangeEvent : public nsRunnable {
    35     public:
    36         NS_DECL_NSIRUNNABLE
    37         ChangeEvent(nsINetworkLinkService *aService, const char *aEventID)
    38             : mService(aService), mEventID(aEventID) {
    39         }
    40     private:
    41         nsCOMPtr<nsINetworkLinkService> mService;
    42         const char *mEventID;
    43     };
    45     bool mLinkUp;
    46     bool mStatusKnown;
    47     bool mCheckAttempted;
    49     nsresult Shutdown(void);
    50     nsresult SendEventToUI(const char *aEventID);
    52     DWORD CheckAdaptersAddresses(void);
    53     bool  CheckIsGateway(PIP_ADAPTER_ADDRESSES aAdapter);
    54     bool  CheckICSStatus(PWCHAR aAdapterName);
    55     void  CheckLinkStatus(void);
    57     nsCOMPtr<nsIThread> mThread;
    59     HANDLE        mShutdownEvent;
    60 };
    62 #endif /* NSNOTIFYADDRLISTENER_H_ */

mercurial