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