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