dom/system/gonk/nsINetworkService.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/system/gonk/nsINetworkService.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,348 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +interface nsINetworkInterface;
    1.11 +
    1.12 +[scriptable, function, uuid(91824160-fb25-11e1-a21f-0800200c9a66)]
    1.13 +interface nsIWifiTetheringCallback : nsISupports
    1.14 +{
    1.15 +  /**
    1.16 +   * Callback function used to report status to WifiManager.
    1.17 +   *
    1.18 +   * @param error
    1.19 +   *        An error message if the operation wasn't successful,
    1.20 +   *        or `null` if it was.
    1.21 +   */
    1.22 +  void wifiTetheringEnabledChange(in jsval error);
    1.23 +};
    1.24 +
    1.25 +[scriptable, function, uuid(e079aa2a-ec0a-4bbd-b1a4-d81a9faae464)]
    1.26 +interface nsINetworkStatsCallback : nsISupports
    1.27 +{
    1.28 +  void networkStatsAvailable(in boolean success,
    1.29 +                             in unsigned long rxBytes,
    1.30 +                             in unsigned long txBytes,
    1.31 +                             in jsval date);
    1.32 +};
    1.33 +
    1.34 +[scriptable, function, uuid(0706bfa2-ac2d-11e2-9a8d-7b6d988d4767)]
    1.35 +interface nsINetworkUsageAlarmCallback : nsISupports
    1.36 +{
    1.37 +  void networkUsageAlarmResult(in jsval error);
    1.38 +};
    1.39 +
    1.40 +[scriptable, function, uuid(9ede8720-f8bc-11e2-b778-0800200c9a66)]
    1.41 +interface nsIWifiOperationModeCallback : nsISupports
    1.42 +{
    1.43 +  /**
    1.44 +   * Callback function used to report result to WifiManager.
    1.45 +   *
    1.46 +   * @param error
    1.47 +   *        An error message if the operation wasn't successful,
    1.48 +   *        or `null` if it was.
    1.49 +   */
    1.50 +  void wifiOperationModeResult(in jsval error);
    1.51 +};
    1.52 +
    1.53 +[scriptable, function, uuid(097878b0-19fc-11e3-8ffd-0800200c9a66)]
    1.54 +interface nsISetDhcpServerCallback : nsISupports
    1.55 +{
    1.56 +  /**
    1.57 +   * Callback function used to report the DHCP server set result
    1.58 +   *
    1.59 +   * @param error
    1.60 +   *        An error message if the operation wasn't successful,
    1.61 +   *        or `null` if it was.
    1.62 +   */
    1.63 +  void dhcpServerResult(in jsval error);
    1.64 +};
    1.65 +
    1.66 +[scriptable, function, uuid(32407c50-46c7-11e3-8f96-0800200c9a66)]
    1.67 +interface nsIUsbTetheringCallback : nsISupports
    1.68 +{
    1.69 +  /**
    1.70 +   * Callback function used to report status of enabling usb tethering.
    1.71 +   *
    1.72 +   * @param error
    1.73 +   *        An error message if the operation wasn't successful,
    1.74 +   *        or `null` if it was.
    1.75 +   */
    1.76 +  void usbTetheringEnabledChange(in jsval error);
    1.77 +};
    1.78 +
    1.79 +[scriptable, function, uuid(055fd560-46ad-11e3-8f96-0800200c9a66)]
    1.80 +interface nsIEnableUsbRndisCallback : nsISupports
    1.81 +{
    1.82 +  /**
    1.83 +   * Callback function used to report the status of enabling/disabling usb rndis.
    1.84 +   *
    1.85 +   * @param success
    1.86 +   *        Boolean to indicate the operation is successful or not.
    1.87 +   * @param enable
    1.88 +   *        Boolean to indicate if we are enabling or disabling usb rndis.
    1.89 +   */
    1.90 +  void enableUsbRndisResult(in boolean success, in boolean enable);
    1.91 +};
    1.92 +
    1.93 +[scriptable, function, uuid(4f08cc30-46ad-11e3-8f96-0800200c9a66)]
    1.94 +interface nsIUpdateUpStreamCallback : nsISupports
    1.95 +{
    1.96 +  /**
    1.97 +   * Callback function used to report the result of updating upstream.
    1.98 +   *
    1.99 +   * @param success
   1.100 +   *        Boolean to indicate the operation is successful or not.
   1.101 +   * @param externalIfname
   1.102 +   *        The external interface name.
   1.103 +   */
   1.104 +  void updateUpStreamResult(in boolean success, in DOMString externalIfname);
   1.105 +};
   1.106 +
   1.107 +/**
   1.108 + * Provide network services.
   1.109 + */
   1.110 +[scriptable, uuid(f96461fa-e844-45d2-a6c3-8cd23ab0916b)]
   1.111 +interface nsINetworkService : nsISupports
   1.112 +{
   1.113 +  /**
   1.114 +   * Enable or disable Wifi Tethering
   1.115 +   *
   1.116 +   * @param enabled
   1.117 +   *        Boolean that indicates whether tethering should be enabled (true) or disabled (false).
   1.118 +   * @param config
   1.119 +   *        The Wifi Tethering configuration from settings db.
   1.120 +   * @param callback
   1.121 +   *        Callback function used to report status to WifiManager.
   1.122 +   */
   1.123 +  void setWifiTethering(in boolean enabled,
   1.124 +                        in jsval config,
   1.125 +                        in nsIWifiTetheringCallback callback);
   1.126 +
   1.127 +  /**
   1.128 +   * Enable or disable DHCP server
   1.129 +   *
   1.130 +   * @param enabled
   1.131 +   *        Boolean that indicates enabling or disabling DHCP server.
   1.132 +   *
   1.133 +   * @param config
   1.134 +   *        Config used to enable the DHCP server. It contains
   1.135 +   *        .startIp    start of the ip lease range (string)
   1.136 +   *        .endIp      end of the ip lease range (string)
   1.137 +   *        .serverIp   ip of the DHCP server (string)
   1.138 +   *        .maskLength the length of the subnet mask
   1.139 +   *        .ifname     the interface name
   1.140 +   *
   1.141 +   *        As for disabling the DHCP server, put this value |null|.
   1.142 +   *
   1.143 +   * @param callback
   1.144 +   *        Callback function used to report status.
   1.145 +   */
   1.146 +  void setDhcpServer(in boolean enabled,
   1.147 +                     in jsval config,
   1.148 +                     in nsISetDhcpServerCallback callback);
   1.149 +
   1.150 +
   1.151 +  /**
   1.152 +   * Retrieve network interface stats.
   1.153 +   *
   1.154 +   * @param networkName
   1.155 +   *        Select the Network interface to request estats.
   1.156 +   *
   1.157 +   * @param callback
   1.158 +   *        Callback to notify result and provide stats, connectionType
   1.159 +   *        and the date when stats are retrieved
   1.160 +   */
   1.161 +  void getNetworkInterfaceStats(in DOMString networkName, in nsINetworkStatsCallback callback);
   1.162 +
   1.163 +  /**
   1.164 +   * Set Alarm of usage per interface
   1.165 +   *
   1.166 +   * @param networkName
   1.167 +   *        Select the Network interface to set an alarm.
   1.168 +   *
   1.169 +   * @param threshold
   1.170 +   *        Amount of data that will trigger the alarm.
   1.171 +   *
   1.172 +   * @param callback
   1.173 +   *        Callback to notify the result.
   1.174 +   *
   1.175 +   * @return false if there is no interface registered for the networkType param.
   1.176 +   */
   1.177 +  boolean setNetworkInterfaceAlarm(in DOMString networkName,
   1.178 +                                   in long threshold,
   1.179 +                                   in nsINetworkUsageAlarmCallback callback);
   1.180 +
   1.181 +  /**
   1.182 +   * Reload Wifi firmware to specific operation mode.
   1.183 +   *
   1.184 +   * @param interfaceName
   1.185 +   *        Wifi Network interface name.
   1.186 +   *
   1.187 +   * @param mode
   1.188 +   *        AP  - Access pointer mode.
   1.189 +   *        P2P - Peer to peer connection mode.
   1.190 +   *        STA - Station mode.
   1.191 +   *
   1.192 +   * @param callback
   1.193 +   *        Callback to notify Wifi firmware reload result.
   1.194 +   */
   1.195 +  void setWifiOperationMode(in DOMString interfaceName,
   1.196 +                            in DOMString mode,
   1.197 +                            in nsIWifiOperationModeCallback callback);
   1.198 +
   1.199 +  /**
   1.200 +   * Set http proxy for specific network
   1.201 +   *
   1.202 +   * @param networkInterface
   1.203 +   *        The network interface which contains the http proxy host/port
   1.204 +   *        we want to set.
   1.205 +   */
   1.206 +  void setNetworkProxy(in nsINetworkInterface networkInterface);
   1.207 +
   1.208 +  /**
   1.209 +   * Set USB tethering.
   1.210 +   *
   1.211 +   * @param enabled
   1.212 +   *        Boolean to indicate we are going to enable or disable usb tethering.
   1.213 +   * @param config
   1.214 +   *        The usb tethering configuration.
   1.215 +   * @param callback
   1.216 +   *        Callback function used to report the result enabling/disabling usb tethering.
   1.217 +   */
   1.218 +  void setUSBTethering(in boolean enabled,
   1.219 +                       in jsval config,
   1.220 +                       in nsIUsbTetheringCallback callback);
   1.221 +
   1.222 +  /**
   1.223 +   * Reset routing table.
   1.224 +   *
   1.225 +   * @param networkInterface
   1.226 +   *        The network interface we want remove from the routing table.
   1.227 +   */
   1.228 +  void resetRoutingTable(in nsINetworkInterface networkInterface);
   1.229 +
   1.230 +  /**
   1.231 +   * Set DNS.
   1.232 +   *
   1.233 +   * @param networkInterface
   1.234 +   *        The network interface which contains the DNS we want to set.
   1.235 +   */
   1.236 +  void setDNS(in nsINetworkInterface networkInterface);
   1.237 +
   1.238 +  /**
   1.239 +   * Set default route and DNS.
   1.240 +   *
   1.241 +   * @param networkInterface
   1.242 +   *        The network interface we want to set to the default route and dns.
   1.243 +   * @param oldInterface
   1.244 +   *        The previous network interface.
   1.245 +   */
   1.246 +  void setDefaultRouteAndDNS(in nsINetworkInterface networkInterface,
   1.247 +                             in nsINetworkInterface oldInterface);
   1.248 +
   1.249 +  /**
   1.250 +   * Remove default route.
   1.251 +   *
   1.252 +   * @param networkInterface
   1.253 +   *        The network interface we want remove from the default route.
   1.254 +   */
   1.255 +  void removeDefaultRoute(in nsINetworkInterface networkInterface);
   1.256 +
   1.257 +  /**
   1.258 +   * Add host route.
   1.259 +   *
   1.260 +   * @param networkInterface
   1.261 +   *        The network interface we want to add to the host route.
   1.262 +   */
   1.263 +  void addHostRoute(in nsINetworkInterface networkInterface);
   1.264 +
   1.265 +  /**
   1.266 +   * Remove host route.
   1.267 +   *
   1.268 +   * @param network
   1.269 +   *        The network interface we want to remove from the host route.
   1.270 +   */
   1.271 +  void removeHostRoute(in nsINetworkInterface network);
   1.272 +
   1.273 +  /**
   1.274 +   * Remove all host routes.
   1.275 +   *
   1.276 +   * @param interfaceName
   1.277 +   *        The interface name we want remove from the routing table.
   1.278 +   */
   1.279 +  void removeHostRoutes(in DOMString interfaceName);
   1.280 +
   1.281 +  /**
   1.282 +   * Add host route with resolve.
   1.283 +   *
   1.284 +   * @param network
   1.285 +   *        The network interface we want to add to the host route.
   1.286 +   * @param hosts
   1.287 +   *        The array of host names we want to add.
   1.288 +   */
   1.289 +  void addHostRouteWithResolve(in nsINetworkInterface network, in jsval hosts);
   1.290 +
   1.291 +  /**
   1.292 +   * Remove host route with resolve.
   1.293 +   *
   1.294 +   * @param network
   1.295 +   *        The network interface we want to remove from the host route.
   1.296 +   * @param hosts
   1.297 +   *        The array of host names we want to remove.
   1.298 +   */
   1.299 +  void removeHostRouteWithResolve(in nsINetworkInterface network, in jsval hosts);
   1.300 +
   1.301 +  /**
   1.302 +   * Add route to secondary routing table.
   1.303 +   *
   1.304 +   * @param interfaceName
   1.305 +   *        The network interface for this route.
   1.306 +   * @param route
   1.307 +   *        The route info should have the following fields:
   1.308 +   *        .ip: destination ip address
   1.309 +   *        .prefix: destination prefix
   1.310 +   *        .gateway: gateway ip address
   1.311 +   */
   1.312 +  void addSecondaryRoute(in DOMString interfaceName, in jsval route);
   1.313 +
   1.314 +  /**
   1.315 +   * Remove route from secondary routing table.
   1.316 +   *
   1.317 +   * @param interfaceName
   1.318 +   *        The network interface for the route we want to remove.
   1.319 +   * @param route
   1.320 +   *        The route info should have the following fields:
   1.321 +   *        .ip: destination ip address
   1.322 +   *        .prefix: destination prefix
   1.323 +   *        .gateway: gateway ip address
   1.324 +   */
   1.325 +  void removeSecondaryRoute(in DOMString interfaceName, in jsval route);
   1.326 +
   1.327 +  /**
   1.328 +   * Enable or disable usb rndis.
   1.329 +   *
   1.330 +   * @param enable
   1.331 +   *        Boolean to indicate we want enable or disable usb rndis.
   1.332 +   * @param callback
   1.333 +   *        Callback function to report the result.
   1.334 +   */
   1.335 +  void enableUsbRndis(in boolean enable,
   1.336 +                      in nsIEnableUsbRndisCallback callback);
   1.337 +
   1.338 +  /**
   1.339 +   * Update upstream.
   1.340 +   *
   1.341 +   * @param previous
   1.342 +   *        The previous internal and external interface.
   1.343 +   * @param current
   1.344 +   *        The current internal and external interface.
   1.345 +   * @param callback
   1.346 +   *        Callback function to report the result.
   1.347 +   */
   1.348 +  void updateUpStream(in jsval previous,
   1.349 +                      in jsval current,
   1.350 +                      in nsIUpdateUpStreamCallback callback);
   1.351 +};

mercurial