Source code

Revision control

Other Tools

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(103e5293-77b3-4b70-af59-6e9e4a1f994a)]
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
* A string uniquely identifying the current active network interfaces.
51
* Empty when there are no active network interfaces.
52
*/
53
readonly attribute ACString networkID;
54
55
/**
56
* The list of DNS suffixes for the currently active network interfaces.
57
*/
58
readonly attribute Array<ACString> dnsSuffixList;
59
};
60
61
%{C++
62
/**
63
* We send notifications through nsIObserverService with topic
64
* NS_NETWORK_LINK_TOPIC whenever one of isLinkUp or linkStatusKnown
65
* changes. We pass one of the NS_NETWORK_LINK_DATA_ constants below
66
* as the aData parameter of the notification.
67
*/
68
#define NS_NETWORK_LINK_TOPIC "network:link-status-changed"
69
70
/**
71
* isLinkUp is now true, linkStatusKnown is true.
72
*/
73
#define NS_NETWORK_LINK_DATA_UP "up"
74
/**
75
* isLinkUp is now false, linkStatusKnown is true.
76
*/
77
#define NS_NETWORK_LINK_DATA_DOWN "down"
78
/**
79
* isLinkUp is still true, but the network setup is modified.
80
* linkStatusKnown is true.
81
*/
82
#define NS_NETWORK_LINK_DATA_CHANGED "changed"
83
/**
84
* linkStatusKnown is now false.
85
*/
86
#define NS_NETWORK_LINK_DATA_UNKNOWN "unknown"
87
88
/**
89
* network ID has changed.
90
*/
91
#define NS_NETWORK_ID_CHANGED_TOPIC "network:networkid-changed"
92
93
/**
94
* We send notifications through nsIObserverService with topic
95
* NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type
96
* changes. We pass one of the valid connection type constants
97
* below as the aData parameter of the notification.
98
*/
99
#define NS_NETWORK_LINK_TYPE_TOPIC "network:link-type-changed"
100
101
/** We were unable to determine the network connection type */
102
#define NS_NETWORK_LINK_TYPE_UNKNOWN "unknown"
103
104
/** A standard wired ethernet connection */
105
#define NS_NETWORK_LINK_TYPE_ETHERNET "ethernet"
106
107
/** A connection via a USB port */
108
#define NS_NETWORK_LINK_TYPE_USB "usb"
109
110
/** A connection via a WiFi access point (IEEE802.11) */
111
#define NS_NETWORK_LINK_TYPE_WIFI "wifi"
112
113
/** A connection via WiMax (IEEE802.16) */
114
#define NS_NETWORK_LINK_TYPE_WIMAX "wimax"
115
116
/** A '2G' mobile connection (e.g. GSM, GPRS, EDGE) */
117
#define NS_NETWORK_LINK_TYPE_2G "2g"
118
119
/** A '3G' mobile connection (e.g. UMTS, CDMA) */
120
#define NS_NETWORK_LINK_TYPE_3G "3g"
121
122
/** A '4G' mobile connection (e.g. LTE, UMB) */
123
#define NS_NETWORK_LINK_TYPE_4G "4g"
124
%}