dom/system/gonk/nsINetworkService.idl

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:43fde0fe901e
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/. */
4
5 #include "nsISupports.idl"
6
7 interface nsINetworkInterface;
8
9 [scriptable, function, uuid(91824160-fb25-11e1-a21f-0800200c9a66)]
10 interface nsIWifiTetheringCallback : nsISupports
11 {
12 /**
13 * Callback function used to report status to WifiManager.
14 *
15 * @param error
16 * An error message if the operation wasn't successful,
17 * or `null` if it was.
18 */
19 void wifiTetheringEnabledChange(in jsval error);
20 };
21
22 [scriptable, function, uuid(e079aa2a-ec0a-4bbd-b1a4-d81a9faae464)]
23 interface nsINetworkStatsCallback : nsISupports
24 {
25 void networkStatsAvailable(in boolean success,
26 in unsigned long rxBytes,
27 in unsigned long txBytes,
28 in jsval date);
29 };
30
31 [scriptable, function, uuid(0706bfa2-ac2d-11e2-9a8d-7b6d988d4767)]
32 interface nsINetworkUsageAlarmCallback : nsISupports
33 {
34 void networkUsageAlarmResult(in jsval error);
35 };
36
37 [scriptable, function, uuid(9ede8720-f8bc-11e2-b778-0800200c9a66)]
38 interface nsIWifiOperationModeCallback : nsISupports
39 {
40 /**
41 * Callback function used to report result to WifiManager.
42 *
43 * @param error
44 * An error message if the operation wasn't successful,
45 * or `null` if it was.
46 */
47 void wifiOperationModeResult(in jsval error);
48 };
49
50 [scriptable, function, uuid(097878b0-19fc-11e3-8ffd-0800200c9a66)]
51 interface nsISetDhcpServerCallback : nsISupports
52 {
53 /**
54 * Callback function used to report the DHCP server set result
55 *
56 * @param error
57 * An error message if the operation wasn't successful,
58 * or `null` if it was.
59 */
60 void dhcpServerResult(in jsval error);
61 };
62
63 [scriptable, function, uuid(32407c50-46c7-11e3-8f96-0800200c9a66)]
64 interface nsIUsbTetheringCallback : nsISupports
65 {
66 /**
67 * Callback function used to report status of enabling usb tethering.
68 *
69 * @param error
70 * An error message if the operation wasn't successful,
71 * or `null` if it was.
72 */
73 void usbTetheringEnabledChange(in jsval error);
74 };
75
76 [scriptable, function, uuid(055fd560-46ad-11e3-8f96-0800200c9a66)]
77 interface nsIEnableUsbRndisCallback : nsISupports
78 {
79 /**
80 * Callback function used to report the status of enabling/disabling usb rndis.
81 *
82 * @param success
83 * Boolean to indicate the operation is successful or not.
84 * @param enable
85 * Boolean to indicate if we are enabling or disabling usb rndis.
86 */
87 void enableUsbRndisResult(in boolean success, in boolean enable);
88 };
89
90 [scriptable, function, uuid(4f08cc30-46ad-11e3-8f96-0800200c9a66)]
91 interface nsIUpdateUpStreamCallback : nsISupports
92 {
93 /**
94 * Callback function used to report the result of updating upstream.
95 *
96 * @param success
97 * Boolean to indicate the operation is successful or not.
98 * @param externalIfname
99 * The external interface name.
100 */
101 void updateUpStreamResult(in boolean success, in DOMString externalIfname);
102 };
103
104 /**
105 * Provide network services.
106 */
107 [scriptable, uuid(f96461fa-e844-45d2-a6c3-8cd23ab0916b)]
108 interface nsINetworkService : nsISupports
109 {
110 /**
111 * Enable or disable Wifi Tethering
112 *
113 * @param enabled
114 * Boolean that indicates whether tethering should be enabled (true) or disabled (false).
115 * @param config
116 * The Wifi Tethering configuration from settings db.
117 * @param callback
118 * Callback function used to report status to WifiManager.
119 */
120 void setWifiTethering(in boolean enabled,
121 in jsval config,
122 in nsIWifiTetheringCallback callback);
123
124 /**
125 * Enable or disable DHCP server
126 *
127 * @param enabled
128 * Boolean that indicates enabling or disabling DHCP server.
129 *
130 * @param config
131 * Config used to enable the DHCP server. It contains
132 * .startIp start of the ip lease range (string)
133 * .endIp end of the ip lease range (string)
134 * .serverIp ip of the DHCP server (string)
135 * .maskLength the length of the subnet mask
136 * .ifname the interface name
137 *
138 * As for disabling the DHCP server, put this value |null|.
139 *
140 * @param callback
141 * Callback function used to report status.
142 */
143 void setDhcpServer(in boolean enabled,
144 in jsval config,
145 in nsISetDhcpServerCallback callback);
146
147
148 /**
149 * Retrieve network interface stats.
150 *
151 * @param networkName
152 * Select the Network interface to request estats.
153 *
154 * @param callback
155 * Callback to notify result and provide stats, connectionType
156 * and the date when stats are retrieved
157 */
158 void getNetworkInterfaceStats(in DOMString networkName, in nsINetworkStatsCallback callback);
159
160 /**
161 * Set Alarm of usage per interface
162 *
163 * @param networkName
164 * Select the Network interface to set an alarm.
165 *
166 * @param threshold
167 * Amount of data that will trigger the alarm.
168 *
169 * @param callback
170 * Callback to notify the result.
171 *
172 * @return false if there is no interface registered for the networkType param.
173 */
174 boolean setNetworkInterfaceAlarm(in DOMString networkName,
175 in long threshold,
176 in nsINetworkUsageAlarmCallback callback);
177
178 /**
179 * Reload Wifi firmware to specific operation mode.
180 *
181 * @param interfaceName
182 * Wifi Network interface name.
183 *
184 * @param mode
185 * AP - Access pointer mode.
186 * P2P - Peer to peer connection mode.
187 * STA - Station mode.
188 *
189 * @param callback
190 * Callback to notify Wifi firmware reload result.
191 */
192 void setWifiOperationMode(in DOMString interfaceName,
193 in DOMString mode,
194 in nsIWifiOperationModeCallback callback);
195
196 /**
197 * Set http proxy for specific network
198 *
199 * @param networkInterface
200 * The network interface which contains the http proxy host/port
201 * we want to set.
202 */
203 void setNetworkProxy(in nsINetworkInterface networkInterface);
204
205 /**
206 * Set USB tethering.
207 *
208 * @param enabled
209 * Boolean to indicate we are going to enable or disable usb tethering.
210 * @param config
211 * The usb tethering configuration.
212 * @param callback
213 * Callback function used to report the result enabling/disabling usb tethering.
214 */
215 void setUSBTethering(in boolean enabled,
216 in jsval config,
217 in nsIUsbTetheringCallback callback);
218
219 /**
220 * Reset routing table.
221 *
222 * @param networkInterface
223 * The network interface we want remove from the routing table.
224 */
225 void resetRoutingTable(in nsINetworkInterface networkInterface);
226
227 /**
228 * Set DNS.
229 *
230 * @param networkInterface
231 * The network interface which contains the DNS we want to set.
232 */
233 void setDNS(in nsINetworkInterface networkInterface);
234
235 /**
236 * Set default route and DNS.
237 *
238 * @param networkInterface
239 * The network interface we want to set to the default route and dns.
240 * @param oldInterface
241 * The previous network interface.
242 */
243 void setDefaultRouteAndDNS(in nsINetworkInterface networkInterface,
244 in nsINetworkInterface oldInterface);
245
246 /**
247 * Remove default route.
248 *
249 * @param networkInterface
250 * The network interface we want remove from the default route.
251 */
252 void removeDefaultRoute(in nsINetworkInterface networkInterface);
253
254 /**
255 * Add host route.
256 *
257 * @param networkInterface
258 * The network interface we want to add to the host route.
259 */
260 void addHostRoute(in nsINetworkInterface networkInterface);
261
262 /**
263 * Remove host route.
264 *
265 * @param network
266 * The network interface we want to remove from the host route.
267 */
268 void removeHostRoute(in nsINetworkInterface network);
269
270 /**
271 * Remove all host routes.
272 *
273 * @param interfaceName
274 * The interface name we want remove from the routing table.
275 */
276 void removeHostRoutes(in DOMString interfaceName);
277
278 /**
279 * Add host route with resolve.
280 *
281 * @param network
282 * The network interface we want to add to the host route.
283 * @param hosts
284 * The array of host names we want to add.
285 */
286 void addHostRouteWithResolve(in nsINetworkInterface network, in jsval hosts);
287
288 /**
289 * Remove host route with resolve.
290 *
291 * @param network
292 * The network interface we want to remove from the host route.
293 * @param hosts
294 * The array of host names we want to remove.
295 */
296 void removeHostRouteWithResolve(in nsINetworkInterface network, in jsval hosts);
297
298 /**
299 * Add route to secondary routing table.
300 *
301 * @param interfaceName
302 * The network interface for this route.
303 * @param route
304 * The route info should have the following fields:
305 * .ip: destination ip address
306 * .prefix: destination prefix
307 * .gateway: gateway ip address
308 */
309 void addSecondaryRoute(in DOMString interfaceName, in jsval route);
310
311 /**
312 * Remove route from secondary routing table.
313 *
314 * @param interfaceName
315 * The network interface for the route we want to remove.
316 * @param route
317 * The route info should have the following fields:
318 * .ip: destination ip address
319 * .prefix: destination prefix
320 * .gateway: gateway ip address
321 */
322 void removeSecondaryRoute(in DOMString interfaceName, in jsval route);
323
324 /**
325 * Enable or disable usb rndis.
326 *
327 * @param enable
328 * Boolean to indicate we want enable or disable usb rndis.
329 * @param callback
330 * Callback function to report the result.
331 */
332 void enableUsbRndis(in boolean enable,
333 in nsIEnableUsbRndisCallback callback);
334
335 /**
336 * Update upstream.
337 *
338 * @param previous
339 * The previous internal and external interface.
340 * @param current
341 * The current internal and external interface.
342 * @param callback
343 * Callback function to report the result.
344 */
345 void updateUpStream(in jsval previous,
346 in jsval current,
347 in nsIUpdateUpStreamCallback callback);
348 };

mercurial