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