2012-04-20 01:33:25 +04: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"
|
|
|
|
|
2015-07-29 09:00:00 +03:00
|
|
|
interface nsINetworkInfo;
|
|
|
|
interface nsINetworkInterface;
|
2012-04-20 01:33:25 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Manage network interfaces.
|
|
|
|
*/
|
2016-02-19 11:06:29 +03:00
|
|
|
[scriptable, uuid(1ba9346b-53b5-4660-9dc6-58f0b258d0a6)]
|
2012-04-20 01:33:25 +04: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-27 04:01:00 +04:00
|
|
|
* Throws if there's already an interface registered with the same network id.
|
2012-04-20 01:33:25 +04:00
|
|
|
*
|
|
|
|
* @param network
|
|
|
|
* Network interface to register.
|
|
|
|
*/
|
|
|
|
void registerNetworkInterface(in nsINetworkInterface network);
|
|
|
|
|
2014-07-29 12:44:24 +04: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-20 01:33:25 +04: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);
|
|
|
|
|
|
|
|
/**
|
2015-07-29 09:00:00 +03:00
|
|
|
* Object containing all known network information, keyed by their
|
2014-05-27 04:01:00 +04: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-20 01:33:25 +04:00
|
|
|
*/
|
2015-07-29 09:00:00 +03:00
|
|
|
readonly attribute jsval allNetworkInfo;
|
2012-04-20 01:33:25 +04:00
|
|
|
|
2016-02-19 11:06:29 +03:00
|
|
|
/**
|
|
|
|
* Priority list of network types. An array of
|
|
|
|
* nsINetworkInterface::NETWORK_TYPE_* constants.
|
|
|
|
*
|
|
|
|
* The piror position of the type indicates the higher priority. The priority
|
|
|
|
* is used to determine route when there are multiple connected networks.
|
|
|
|
*/
|
|
|
|
attribute jsval networkTypePriorityList;
|
|
|
|
|
2012-04-20 01:33:25 +04:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
/**
|
2015-07-29 09:00:00 +03:00
|
|
|
* The network information of the network interface handling all network
|
|
|
|
* traffic.
|
2012-04-20 01:33:25 +04:00
|
|
|
*
|
|
|
|
* When this changes, the 'network-active-changed' observer
|
|
|
|
* notification is dispatched.
|
|
|
|
*/
|
2015-07-29 09:00:00 +03:00
|
|
|
readonly attribute nsINetworkInfo activeNetworkInfo;
|
2012-04-20 01:33:25 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
2014-08-15 12:23:44 +04:00
|
|
|
/**
|
|
|
|
* Add host route to the specified network into routing table.
|
|
|
|
*
|
|
|
|
* @param network
|
2015-07-29 09:00:00 +03:00
|
|
|
* The network information for the host to be routed to.
|
2014-08-15 12:23:44 +04:00
|
|
|
* @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.
|
|
|
|
*/
|
2015-07-29 09:00:00 +03:00
|
|
|
jsval addHostRoute(in nsINetworkInfo network,
|
2014-08-15 12:23:44 +04:00
|
|
|
in DOMString host);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove host route to the specified network from routing table.
|
|
|
|
*
|
|
|
|
* @param network
|
2015-07-29 09:00:00 +03:00
|
|
|
* The network information for the routing to be removed from.
|
2014-08-15 12:23:44 +04:00
|
|
|
* @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.
|
|
|
|
*/
|
2015-07-29 09:00:00 +03:00
|
|
|
jsval removeHostRoute(in nsINetworkInfo network,
|
2014-08-15 12:23:44 +04:00
|
|
|
in DOMString host);
|
2012-04-20 01:33:25 +04:00
|
|
|
};
|