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
%{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
* isLinkUp is still true, but the network setup is modified.
69
* linkStatusKnown is true.
70
*/
71
#define NS_NETWORK_LINK_DATA_CHANGED "changed"
72
/**
73
* linkStatusKnown is now false.
74
*/
75
#define NS_NETWORK_LINK_DATA_UNKNOWN "unknown"
76
77
/**
78
* We send notifications through nsIObserverService with topic
79
* NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type
80
* changes. We pass one of the valid connection type constants
81
* below as the aData parameter of the notification.
82
*/
83
#define NS_NETWORK_LINK_TYPE_TOPIC "network:link-type-changed"
84
85
/** We were unable to determine the network connection type */
86
#define NS_NETWORK_LINK_TYPE_UNKNOWN "unknown"
87
88
/** A standard wired ethernet connection */
89
#define NS_NETWORK_LINK_TYPE_ETHERNET "ethernet"
90
91
/** A connection via a USB port */
92
#define NS_NETWORK_LINK_TYPE_USB "usb"
93
94
/** A connection via a WiFi access point (IEEE802.11) */
95
#define NS_NETWORK_LINK_TYPE_WIFI "wifi"
96
97
/** A connection via WiMax (IEEE802.16) */
98
#define NS_NETWORK_LINK_TYPE_WIMAX "wimax"
99
100
/** A '2G' mobile connection (e.g. GSM, GPRS, EDGE) */
101
#define NS_NETWORK_LINK_TYPE_2G "2g"
102
103
/** A '3G' mobile connection (e.g. UMTS, CDMA) */
104
#define NS_NETWORK_LINK_TYPE_3G "3g"
105
106
/** A '4G' mobile connection (e.g. LTE, UMB) */
107
#define NS_NETWORK_LINK_TYPE_4G "4g"
108
%}