2012-04-19 14:33:25 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2013-11-15 01:35:33 -08:00
|
|
|
interface nsIWifiTetheringCallback;
|
|
|
|
|
2012-04-19 14:33:25 -07:00
|
|
|
/**
|
|
|
|
* Information about networks that is exposed to network manager API consumers.
|
|
|
|
*/
|
2014-07-09 22:28:51 -07:00
|
|
|
[scriptable, uuid(cb62ae03-6bda-43ff-9560-916d60203d33)]
|
2012-04-19 14:33:25 -07:00
|
|
|
interface nsINetworkInterface : nsISupports
|
|
|
|
{
|
|
|
|
const long NETWORK_STATE_UNKNOWN = -1;
|
|
|
|
const long NETWORK_STATE_CONNECTING = 0;
|
|
|
|
const long NETWORK_STATE_CONNECTED = 1;
|
2012-08-28 07:37:43 -07:00
|
|
|
const long NETWORK_STATE_DISCONNECTING = 2;
|
|
|
|
const long NETWORK_STATE_DISCONNECTED = 3;
|
2012-04-19 14:33:25 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Current network state, one of the NETWORK_STATE_* constants.
|
|
|
|
*
|
2014-07-29 01:44:24 -07:00
|
|
|
* When this changes, network interface implementations notify with
|
|
|
|
* updateNetworkInterface() API.
|
2012-04-19 14:33:25 -07:00
|
|
|
*/
|
|
|
|
readonly attribute long state;
|
|
|
|
|
2013-08-28 23:15:08 -07:00
|
|
|
const long NETWORK_TYPE_UNKNOWN = -1;
|
2012-04-19 14:33:25 -07:00
|
|
|
const long NETWORK_TYPE_WIFI = 0;
|
|
|
|
const long NETWORK_TYPE_MOBILE = 1;
|
|
|
|
const long NETWORK_TYPE_MOBILE_MMS = 2;
|
2012-08-30 09:57:33 -07:00
|
|
|
const long NETWORK_TYPE_MOBILE_SUPL = 3;
|
2014-01-14 02:23:42 -08:00
|
|
|
const long NETWORK_TYPE_WIFI_P2P = 4;
|
2014-02-25 08:07:00 -08:00
|
|
|
const long NETWORK_TYPE_MOBILE_IMS = 5;
|
2014-02-28 02:04:55 -08:00
|
|
|
const long NETWORK_TYPE_MOBILE_DUN = 6;
|
2012-04-19 14:33:25 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Network type. One of the NETWORK_TYPE_* constants.
|
|
|
|
*/
|
|
|
|
readonly attribute long type;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Name of the network interface. This identifier is unique.
|
|
|
|
*/
|
|
|
|
readonly attribute DOMString name;
|
|
|
|
|
2012-08-13 18:54:42 -07:00
|
|
|
/**
|
2014-03-29 00:18:17 -07:00
|
|
|
* The host name of the http proxy server.
|
2012-08-13 18:54:42 -07:00
|
|
|
*/
|
2014-03-29 00:18:17 -07:00
|
|
|
readonly attribute DOMString httpProxyHost;
|
2012-08-13 18:54:42 -07:00
|
|
|
|
2014-03-29 00:18:17 -07:00
|
|
|
/*
|
|
|
|
* The port number of the http proxy server.
|
2012-08-13 18:54:42 -07:00
|
|
|
*/
|
2014-03-29 00:18:17 -07:00
|
|
|
readonly attribute long httpProxyPort;
|
2012-08-13 18:54:42 -07:00
|
|
|
|
|
|
|
/**
|
2014-03-29 00:18:17 -07:00
|
|
|
* Get the list of ip addresses and prefix lengths, ip address could be IPv4
|
|
|
|
* or IPv6, typically 1 IPv4 or 1 IPv6 or one of each.
|
|
|
|
*
|
|
|
|
* @param ips
|
|
|
|
* The list of ip addresses retrieved.
|
|
|
|
* @param prefixLengths
|
|
|
|
* The list of prefix lengths retrieved.
|
|
|
|
*
|
|
|
|
* @returns the length of the lists.
|
2012-08-13 18:54:42 -07:00
|
|
|
*/
|
2014-03-29 00:18:17 -07:00
|
|
|
void getAddresses([array, size_is(count)] out wstring ips,
|
|
|
|
[array, size_is(count)] out unsigned long prefixLengths,
|
|
|
|
[retval] out unsigned long count);
|
2012-08-13 18:54:42 -07:00
|
|
|
|
|
|
|
/**
|
2014-03-29 00:18:17 -07:00
|
|
|
* Get the list of gateways, could be IPv4 or IPv6, typically 1 IPv4 or 1
|
|
|
|
* IPv6 or one of each.
|
|
|
|
*
|
|
|
|
* @param count
|
|
|
|
* The length of the list of gateways
|
|
|
|
*
|
|
|
|
* @returns the list of gateways.
|
2012-08-13 18:54:42 -07:00
|
|
|
*/
|
2014-03-29 00:18:17 -07:00
|
|
|
void getGateways([optional] out unsigned long count,
|
|
|
|
[array, size_is(count), retval] out wstring gateways);
|
2012-08-13 18:54:42 -07:00
|
|
|
|
2012-08-01 07:55:43 -07:00
|
|
|
/**
|
2014-03-29 00:18:17 -07:00
|
|
|
* Get the list of dnses, could be IPv4 or IPv6.
|
|
|
|
*
|
|
|
|
* @param count
|
|
|
|
* The length of the list of dnses.
|
|
|
|
*
|
|
|
|
* @returns the list of dnses.
|
2012-08-01 07:55:43 -07:00
|
|
|
*/
|
2014-03-29 00:18:17 -07:00
|
|
|
void getDnses([optional] out unsigned long count,
|
|
|
|
[array, size_is(count), retval] out wstring dnses);
|
2012-04-19 14:33:25 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Manage network interfaces.
|
|
|
|
*/
|
2014-08-15 01:23:44 -07:00
|
|
|
[scriptable, uuid(19822018-2454-11e4-baa7-2b5894f0af6f)]
|
2012-04-19 14:33:25 -07:00
|
|
|
interface nsINetworkManager : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Register the given network interface with the network manager.
|
|
|
|
*
|
|
|
|
* Consumers will be notified with the 'network-interface-registered'
|
|
|
|
* observer notification.
|
|
|
|
*
|
2014-05-26 17:01:00 -07:00
|
|
|
* Throws if there's already an interface registered with the same network id.
|
2012-04-19 14:33:25 -07:00
|
|
|
*
|
|
|
|
* @param network
|
|
|
|
* Network interface to register.
|
|
|
|
*/
|
|
|
|
void registerNetworkInterface(in nsINetworkInterface network);
|
|
|
|
|
2014-07-29 01:44:24 -07:00
|
|
|
/**
|
|
|
|
* Update the routes and DNSes according the state of the given network.
|
|
|
|
*
|
|
|
|
* Consumers will be notified with the 'network-connection-state-changed'
|
|
|
|
* observer notification.
|
|
|
|
*
|
|
|
|
* Throws an exception if the specified network interface object isn't
|
|
|
|
* registered.
|
|
|
|
*
|
|
|
|
* @param network
|
|
|
|
* Network interface to update.
|
|
|
|
*/
|
|
|
|
void updateNetworkInterface(in nsINetworkInterface network);
|
|
|
|
|
2012-04-19 14:33:25 -07:00
|
|
|
/**
|
|
|
|
* Unregister the given network interface from the network manager.
|
|
|
|
*
|
|
|
|
* Consumers will be notified with the 'network-interface-unregistered'
|
|
|
|
* observer notification.
|
|
|
|
*
|
|
|
|
* Throws an exception if the specified network interface object isn't
|
|
|
|
* registered.
|
|
|
|
*
|
|
|
|
* @param network
|
|
|
|
* Network interface to unregister.
|
|
|
|
*/
|
|
|
|
void unregisterNetworkInterface(in nsINetworkInterface network);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Object containing all known network connections, keyed by their
|
2014-05-26 17:01:00 -07:00
|
|
|
* network id. Network id is composed of a sub-id + '-' + network
|
|
|
|
* type. For mobile network types, sub-id is 'ril' + service id; for
|
|
|
|
* non-mobile network types, sub-id is always 'device'.
|
2012-04-19 14:33:25 -07:00
|
|
|
*/
|
|
|
|
readonly attribute jsval networkInterfaces;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The preferred network type. One of the
|
|
|
|
* nsINetworkInterface::NETWORK_TYPE_* constants.
|
|
|
|
*
|
|
|
|
* This attribute is used for setting default route to favor
|
|
|
|
* interfaces with given type. This can be overriden by calling
|
|
|
|
* overrideDefaultRoute().
|
|
|
|
*/
|
|
|
|
attribute long preferredNetworkType;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The network interface handling all data traffic.
|
|
|
|
*
|
|
|
|
* When this changes, the 'network-active-changed' observer
|
|
|
|
* notification is dispatched.
|
|
|
|
*/
|
|
|
|
readonly attribute nsINetworkInterface active;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Override the default behaviour for preferredNetworkType and route
|
|
|
|
* all network traffic through the the specified interface.
|
|
|
|
*
|
|
|
|
* Consumers can observe changes to the active network by subscribing to
|
|
|
|
* the 'network-active-changed' observer notification.
|
|
|
|
*
|
|
|
|
* @param network
|
|
|
|
* Network to route all network traffic to. If this is null,
|
|
|
|
* a previous override is canceled.
|
|
|
|
*/
|
|
|
|
long overrideActive(in nsINetworkInterface network);
|
|
|
|
|
2012-09-13 00:18:48 -07:00
|
|
|
/**
|
|
|
|
* Enable or disable Wifi Tethering
|
|
|
|
*
|
|
|
|
* @param enabled
|
|
|
|
* Boolean that indicates whether tethering should be enabled (true) or disabled (false).
|
|
|
|
* @param network
|
|
|
|
* The Wifi network interface with at least name of network interface.
|
2013-05-16 04:39:58 -07:00
|
|
|
* @param config
|
|
|
|
* The Wifi Tethering configuration from settings db.
|
2012-09-13 00:18:48 -07:00
|
|
|
* @param callback
|
|
|
|
* Callback function used to report status to WifiManager.
|
|
|
|
*/
|
|
|
|
void setWifiTethering(in boolean enabled,
|
|
|
|
in nsINetworkInterface networkInterface,
|
2013-05-16 04:39:58 -07:00
|
|
|
in jsval config,
|
2012-09-13 00:18:48 -07:00
|
|
|
in nsIWifiTetheringCallback callback);
|
2014-08-15 01:23:44 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add host route to the specified network into routing table.
|
|
|
|
*
|
|
|
|
* @param network
|
|
|
|
* The network interface where the host to be routed to.
|
|
|
|
* @param host
|
|
|
|
* The host to be added.
|
|
|
|
* The host will be resolved in advance if it's not an ip-address.
|
|
|
|
*
|
|
|
|
* @return a Promise
|
|
|
|
* resolved if added; rejected, otherwise.
|
|
|
|
*/
|
|
|
|
jsval addHostRoute(in nsINetworkInterface network,
|
|
|
|
in DOMString host);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove host route to the specified network from routing table.
|
|
|
|
*
|
|
|
|
* @param network
|
|
|
|
* The network interface where the routing to be removed from.
|
|
|
|
* @param host
|
|
|
|
* The host routed to the network.
|
|
|
|
* The host will be resolved in advance if it's not an ip-address.
|
|
|
|
*
|
|
|
|
* @return a Promise
|
|
|
|
* resolved if removed; rejected, otherwise.
|
|
|
|
*/
|
|
|
|
jsval removeHostRoute(in nsINetworkInterface network,
|
|
|
|
in DOMString host);
|
2012-04-19 14:33:25 -07:00
|
|
|
};
|