Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsISupports.idl"
7 interface nsIWifiTetheringCallback;
9 /**
10 * Information about networks that is exposed to network manager API consumers.
11 */
12 [scriptable, uuid(cb62ae03-6bda-43ff-9560-916d60203d33)]
13 interface nsINetworkInterface : nsISupports
14 {
15 const long NETWORK_STATE_UNKNOWN = -1;
16 const long NETWORK_STATE_CONNECTING = 0;
17 const long NETWORK_STATE_CONNECTED = 1;
18 const long NETWORK_STATE_DISCONNECTING = 2;
19 const long NETWORK_STATE_DISCONNECTED = 3;
21 /**
22 * Current network state, one of the NETWORK_STATE_* constants.
23 *
24 * When this changes, network interface implementations notify the
25 * 'network-interface-state-changed' observer notification.
26 */
27 readonly attribute long state;
29 const long NETWORK_TYPE_UNKNOWN = -1;
30 const long NETWORK_TYPE_WIFI = 0;
31 const long NETWORK_TYPE_MOBILE = 1;
32 const long NETWORK_TYPE_MOBILE_MMS = 2;
33 const long NETWORK_TYPE_MOBILE_SUPL = 3;
34 const long NETWORK_TYPE_WIFI_P2P = 4;
35 const long NETWORK_TYPE_MOBILE_IMS = 5;
36 const long NETWORK_TYPE_MOBILE_DUN = 6;
38 /**
39 * Network type. One of the NETWORK_TYPE_* constants.
40 */
41 readonly attribute long type;
43 /**
44 * Name of the network interface. This identifier is unique.
45 */
46 readonly attribute DOMString name;
48 /**
49 * The host name of the http proxy server.
50 */
51 readonly attribute DOMString httpProxyHost;
53 /*
54 * The port number of the http proxy server.
55 */
56 readonly attribute long httpProxyPort;
58 /**
59 * Get the list of ip addresses and prefix lengths, ip address could be IPv4
60 * or IPv6, typically 1 IPv4 or 1 IPv6 or one of each.
61 *
62 * @param ips
63 * The list of ip addresses retrieved.
64 * @param prefixLengths
65 * The list of prefix lengths retrieved.
66 *
67 * @returns the length of the lists.
68 */
69 void getAddresses([array, size_is(count)] out wstring ips,
70 [array, size_is(count)] out unsigned long prefixLengths,
71 [retval] out unsigned long count);
73 /**
74 * Get the list of gateways, could be IPv4 or IPv6, typically 1 IPv4 or 1
75 * IPv6 or one of each.
76 *
77 * @param count
78 * The length of the list of gateways
79 *
80 * @returns the list of gateways.
81 */
82 void getGateways([optional] out unsigned long count,
83 [array, size_is(count), retval] out wstring gateways);
85 /**
86 * Get the list of dnses, could be IPv4 or IPv6.
87 *
88 * @param count
89 * The length of the list of dnses.
90 *
91 * @returns the list of dnses.
92 */
93 void getDnses([optional] out unsigned long count,
94 [array, size_is(count), retval] out wstring dnses);
95 };
97 /**
98 * Manage network interfaces.
99 */
100 [scriptable, uuid(3ea50550-4b3c-11e3-8f96-0800200c9a66)]
101 interface nsINetworkManager : nsISupports
102 {
103 /**
104 * Register the given network interface with the network manager.
105 *
106 * Consumers will be notified with the 'network-interface-registered'
107 * observer notification.
108 *
109 * Throws if there's already an interface registered that has the same
110 * name.
111 *
112 * @param network
113 * Network interface to register.
114 */
115 void registerNetworkInterface(in nsINetworkInterface network);
117 /**
118 * Unregister the given network interface from the network manager.
119 *
120 * Consumers will be notified with the 'network-interface-unregistered'
121 * observer notification.
122 *
123 * Throws an exception if the specified network interface object isn't
124 * registered.
125 *
126 * @param network
127 * Network interface to unregister.
128 */
129 void unregisterNetworkInterface(in nsINetworkInterface network);
131 /**
132 * Object containing all known network connections, keyed by their
133 * interface name.
134 */
135 readonly attribute jsval networkInterfaces;
137 /**
138 * The preferred network type. One of the
139 * nsINetworkInterface::NETWORK_TYPE_* constants.
140 *
141 * This attribute is used for setting default route to favor
142 * interfaces with given type. This can be overriden by calling
143 * overrideDefaultRoute().
144 */
145 attribute long preferredNetworkType;
147 /**
148 * The network interface handling all data traffic.
149 *
150 * When this changes, the 'network-active-changed' observer
151 * notification is dispatched.
152 */
153 readonly attribute nsINetworkInterface active;
155 /**
156 * Override the default behaviour for preferredNetworkType and route
157 * all network traffic through the the specified interface.
158 *
159 * Consumers can observe changes to the active network by subscribing to
160 * the 'network-active-changed' observer notification.
161 *
162 * @param network
163 * Network to route all network traffic to. If this is null,
164 * a previous override is canceled.
165 */
166 long overrideActive(in nsINetworkInterface network);
168 /**
169 * Enable or disable Wifi Tethering
170 *
171 * @param enabled
172 * Boolean that indicates whether tethering should be enabled (true) or disabled (false).
173 * @param network
174 * The Wifi network interface with at least name of network interface.
175 * @param config
176 * The Wifi Tethering configuration from settings db.
177 * @param callback
178 * Callback function used to report status to WifiManager.
179 */
180 void setWifiTethering(in boolean enabled,
181 in nsINetworkInterface networkInterface,
182 in jsval config,
183 in nsIWifiTetheringCallback callback);
184 };