Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* vim:expandtab:shiftwidth=4:tabstop=4: |
michael@0 | 3 | */ |
michael@0 | 4 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 7 | |
michael@0 | 8 | #include "nsISupports.idl" |
michael@0 | 9 | |
michael@0 | 10 | /** |
michael@0 | 11 | * Network link status monitoring service. |
michael@0 | 12 | */ |
michael@0 | 13 | [scriptable, uuid(f7d3be87-7403-4a1e-b89f-2797776e9b08)] |
michael@0 | 14 | interface nsINetworkLinkService : nsISupports |
michael@0 | 15 | { |
michael@0 | 16 | /* Link type constants */ |
michael@0 | 17 | const unsigned long LINK_TYPE_UNKNOWN = 0; |
michael@0 | 18 | const unsigned long LINK_TYPE_ETHERNET = 1; |
michael@0 | 19 | const unsigned long LINK_TYPE_USB = 2; |
michael@0 | 20 | const unsigned long LINK_TYPE_WIFI = 3; |
michael@0 | 21 | const unsigned long LINK_TYPE_WIMAX = 4; |
michael@0 | 22 | const unsigned long LINK_TYPE_2G = 5; |
michael@0 | 23 | const unsigned long LINK_TYPE_3G = 6; |
michael@0 | 24 | const unsigned long LINK_TYPE_4G = 7; |
michael@0 | 25 | |
michael@0 | 26 | /** |
michael@0 | 27 | * This is set to true when the system is believed to have a usable |
michael@0 | 28 | * network connection. |
michael@0 | 29 | * |
michael@0 | 30 | * The link is only up when network connections can be established. For |
michael@0 | 31 | * example, the link is down during DHCP configuration (unless there |
michael@0 | 32 | * is another usable interface already configured). |
michael@0 | 33 | * |
michael@0 | 34 | * If the link status is not currently known, we generally assume that |
michael@0 | 35 | * it is up. |
michael@0 | 36 | */ |
michael@0 | 37 | readonly attribute boolean isLinkUp; |
michael@0 | 38 | |
michael@0 | 39 | /** |
michael@0 | 40 | * This is set to true when we believe that isLinkUp is accurate. |
michael@0 | 41 | */ |
michael@0 | 42 | readonly attribute boolean linkStatusKnown; |
michael@0 | 43 | |
michael@0 | 44 | /** |
michael@0 | 45 | * The type of network connection. |
michael@0 | 46 | */ |
michael@0 | 47 | readonly attribute unsigned long linkType; |
michael@0 | 48 | }; |
michael@0 | 49 | |
michael@0 | 50 | %{C++ |
michael@0 | 51 | /** |
michael@0 | 52 | * We send notifications through nsIObserverService with topic |
michael@0 | 53 | * NS_NETWORK_LINK_TOPIC whenever one of isLinkUp or linkStatusKnown |
michael@0 | 54 | * changes. We pass one of the NS_NETWORK_LINK_DATA_ constants below |
michael@0 | 55 | * as the aData parameter of the notification. |
michael@0 | 56 | */ |
michael@0 | 57 | #define NS_NETWORK_LINK_TOPIC "network:link-status-changed" |
michael@0 | 58 | |
michael@0 | 59 | /** |
michael@0 | 60 | * isLinkUp is now true, linkStatusKnown is true. |
michael@0 | 61 | */ |
michael@0 | 62 | #define NS_NETWORK_LINK_DATA_UP "up" |
michael@0 | 63 | /** |
michael@0 | 64 | * isLinkUp is now false, linkStatusKnown is true. |
michael@0 | 65 | */ |
michael@0 | 66 | #define NS_NETWORK_LINK_DATA_DOWN "down" |
michael@0 | 67 | /** |
michael@0 | 68 | * linkStatusKnown is now false. |
michael@0 | 69 | */ |
michael@0 | 70 | #define NS_NETWORK_LINK_DATA_UNKNOWN "unknown" |
michael@0 | 71 | |
michael@0 | 72 | /** |
michael@0 | 73 | * We send notifications through nsIObserverService with topic |
michael@0 | 74 | * NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type |
michael@0 | 75 | * changes. We pass one of the valid connection type constants |
michael@0 | 76 | * below as the aData parameter of the notification. |
michael@0 | 77 | */ |
michael@0 | 78 | #define NS_NETWORK_LINK_TYPE_TOPIC "network:link-type-changed" |
michael@0 | 79 | |
michael@0 | 80 | /** We were unable to determine the network connection type */ |
michael@0 | 81 | #define NS_NETWORK_LINK_TYPE_UNKNOWN "unknown" |
michael@0 | 82 | |
michael@0 | 83 | /** A standard wired ethernet connection */ |
michael@0 | 84 | #define NS_NETWORK_LINK_TYPE_ETHERNET "ethernet" |
michael@0 | 85 | |
michael@0 | 86 | /** A connection via a USB port */ |
michael@0 | 87 | #define NS_NETWORK_LINK_TYPE_USB "usb" |
michael@0 | 88 | |
michael@0 | 89 | /** A connection via a WiFi access point (IEEE802.11) */ |
michael@0 | 90 | #define NS_NETWORK_LINK_TYPE_WIFI "wifi" |
michael@0 | 91 | |
michael@0 | 92 | /** A connection via WiMax (IEEE802.16) */ |
michael@0 | 93 | #define NS_NETWORK_LINK_TYPE_WIMAX "wimax" |
michael@0 | 94 | |
michael@0 | 95 | /** A '2G' mobile connection (e.g. GSM, GPRS, EDGE) */ |
michael@0 | 96 | #define NS_NETWORK_LINK_TYPE_2G "2g" |
michael@0 | 97 | |
michael@0 | 98 | /** A '3G' mobile connection (e.g. UMTS, CDMA) */ |
michael@0 | 99 | #define NS_NETWORK_LINK_TYPE_3G "3g" |
michael@0 | 100 | |
michael@0 | 101 | /** A '4G' mobile connection (e.g. LTE, UMB) */ |
michael@0 | 102 | #define NS_NETWORK_LINK_TYPE_4G "4g" |
michael@0 | 103 | %} |