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