1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/system/gonk/nsINetworkManager.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,184 @@ 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 nsIWifiTetheringCallback; 1.11 + 1.12 +/** 1.13 + * Information about networks that is exposed to network manager API consumers. 1.14 + */ 1.15 +[scriptable, uuid(cb62ae03-6bda-43ff-9560-916d60203d33)] 1.16 +interface nsINetworkInterface : nsISupports 1.17 +{ 1.18 + const long NETWORK_STATE_UNKNOWN = -1; 1.19 + const long NETWORK_STATE_CONNECTING = 0; 1.20 + const long NETWORK_STATE_CONNECTED = 1; 1.21 + const long NETWORK_STATE_DISCONNECTING = 2; 1.22 + const long NETWORK_STATE_DISCONNECTED = 3; 1.23 + 1.24 + /** 1.25 + * Current network state, one of the NETWORK_STATE_* constants. 1.26 + * 1.27 + * When this changes, network interface implementations notify the 1.28 + * 'network-interface-state-changed' observer notification. 1.29 + */ 1.30 + readonly attribute long state; 1.31 + 1.32 + const long NETWORK_TYPE_UNKNOWN = -1; 1.33 + const long NETWORK_TYPE_WIFI = 0; 1.34 + const long NETWORK_TYPE_MOBILE = 1; 1.35 + const long NETWORK_TYPE_MOBILE_MMS = 2; 1.36 + const long NETWORK_TYPE_MOBILE_SUPL = 3; 1.37 + const long NETWORK_TYPE_WIFI_P2P = 4; 1.38 + const long NETWORK_TYPE_MOBILE_IMS = 5; 1.39 + const long NETWORK_TYPE_MOBILE_DUN = 6; 1.40 + 1.41 + /** 1.42 + * Network type. One of the NETWORK_TYPE_* constants. 1.43 + */ 1.44 + readonly attribute long type; 1.45 + 1.46 + /** 1.47 + * Name of the network interface. This identifier is unique. 1.48 + */ 1.49 + readonly attribute DOMString name; 1.50 + 1.51 + /** 1.52 + * The host name of the http proxy server. 1.53 + */ 1.54 + readonly attribute DOMString httpProxyHost; 1.55 + 1.56 + /* 1.57 + * The port number of the http proxy server. 1.58 + */ 1.59 + readonly attribute long httpProxyPort; 1.60 + 1.61 + /** 1.62 + * Get the list of ip addresses and prefix lengths, ip address could be IPv4 1.63 + * or IPv6, typically 1 IPv4 or 1 IPv6 or one of each. 1.64 + * 1.65 + * @param ips 1.66 + * The list of ip addresses retrieved. 1.67 + * @param prefixLengths 1.68 + * The list of prefix lengths retrieved. 1.69 + * 1.70 + * @returns the length of the lists. 1.71 + */ 1.72 + void getAddresses([array, size_is(count)] out wstring ips, 1.73 + [array, size_is(count)] out unsigned long prefixLengths, 1.74 + [retval] out unsigned long count); 1.75 + 1.76 + /** 1.77 + * Get the list of gateways, could be IPv4 or IPv6, typically 1 IPv4 or 1 1.78 + * IPv6 or one of each. 1.79 + * 1.80 + * @param count 1.81 + * The length of the list of gateways 1.82 + * 1.83 + * @returns the list of gateways. 1.84 + */ 1.85 + void getGateways([optional] out unsigned long count, 1.86 + [array, size_is(count), retval] out wstring gateways); 1.87 + 1.88 + /** 1.89 + * Get the list of dnses, could be IPv4 or IPv6. 1.90 + * 1.91 + * @param count 1.92 + * The length of the list of dnses. 1.93 + * 1.94 + * @returns the list of dnses. 1.95 + */ 1.96 + void getDnses([optional] out unsigned long count, 1.97 + [array, size_is(count), retval] out wstring dnses); 1.98 +}; 1.99 + 1.100 +/** 1.101 + * Manage network interfaces. 1.102 + */ 1.103 +[scriptable, uuid(3ea50550-4b3c-11e3-8f96-0800200c9a66)] 1.104 +interface nsINetworkManager : nsISupports 1.105 +{ 1.106 + /** 1.107 + * Register the given network interface with the network manager. 1.108 + * 1.109 + * Consumers will be notified with the 'network-interface-registered' 1.110 + * observer notification. 1.111 + * 1.112 + * Throws if there's already an interface registered that has the same 1.113 + * name. 1.114 + * 1.115 + * @param network 1.116 + * Network interface to register. 1.117 + */ 1.118 + void registerNetworkInterface(in nsINetworkInterface network); 1.119 + 1.120 + /** 1.121 + * Unregister the given network interface from the network manager. 1.122 + * 1.123 + * Consumers will be notified with the 'network-interface-unregistered' 1.124 + * observer notification. 1.125 + * 1.126 + * Throws an exception if the specified network interface object isn't 1.127 + * registered. 1.128 + * 1.129 + * @param network 1.130 + * Network interface to unregister. 1.131 + */ 1.132 + void unregisterNetworkInterface(in nsINetworkInterface network); 1.133 + 1.134 + /** 1.135 + * Object containing all known network connections, keyed by their 1.136 + * interface name. 1.137 + */ 1.138 + readonly attribute jsval networkInterfaces; 1.139 + 1.140 + /** 1.141 + * The preferred network type. One of the 1.142 + * nsINetworkInterface::NETWORK_TYPE_* constants. 1.143 + * 1.144 + * This attribute is used for setting default route to favor 1.145 + * interfaces with given type. This can be overriden by calling 1.146 + * overrideDefaultRoute(). 1.147 + */ 1.148 + attribute long preferredNetworkType; 1.149 + 1.150 + /** 1.151 + * The network interface handling all data traffic. 1.152 + * 1.153 + * When this changes, the 'network-active-changed' observer 1.154 + * notification is dispatched. 1.155 + */ 1.156 + readonly attribute nsINetworkInterface active; 1.157 + 1.158 + /** 1.159 + * Override the default behaviour for preferredNetworkType and route 1.160 + * all network traffic through the the specified interface. 1.161 + * 1.162 + * Consumers can observe changes to the active network by subscribing to 1.163 + * the 'network-active-changed' observer notification. 1.164 + * 1.165 + * @param network 1.166 + * Network to route all network traffic to. If this is null, 1.167 + * a previous override is canceled. 1.168 + */ 1.169 + long overrideActive(in nsINetworkInterface network); 1.170 + 1.171 + /** 1.172 + * Enable or disable Wifi Tethering 1.173 + * 1.174 + * @param enabled 1.175 + * Boolean that indicates whether tethering should be enabled (true) or disabled (false). 1.176 + * @param network 1.177 + * The Wifi network interface with at least name of network interface. 1.178 + * @param config 1.179 + * The Wifi Tethering configuration from settings db. 1.180 + * @param callback 1.181 + * Callback function used to report status to WifiManager. 1.182 + */ 1.183 + void setWifiTethering(in boolean enabled, 1.184 + in nsINetworkInterface networkInterface, 1.185 + in jsval config, 1.186 + in nsIWifiTetheringCallback callback); 1.187 +};