tenfourfox/dom/system/gonk/nsINetworkManager.idl
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

127 lines
3.9 KiB
Plaintext

/* 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"
interface nsINetworkInfo;
interface nsINetworkInterface;
/**
* Manage network interfaces.
*/
[scriptable, uuid(e5ffe335-078e-4b25-87f1-02429bd2e458)]
interface nsINetworkManager : nsISupports
{
/**
* Register the given network interface with the network manager.
*
* Consumers will be notified with the 'network-interface-registered'
* observer notification.
*
* Throws if there's already an interface registered with the same network id.
*
* @param network
* Network interface to register.
*/
void registerNetworkInterface(in nsINetworkInterface network);
/**
* 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);
/**
* 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 information, keyed by their
* 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'.
*/
readonly attribute jsval allNetworkInfo;
/**
* 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 information of the network interface handling all network
* traffic.
*
* When this changes, the 'network-active-changed' observer
* notification is dispatched.
*/
readonly attribute nsINetworkInfo activeNetworkInfo;
/**
* 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);
/**
* Add host route to the specified network into routing table.
*
* @param network
* The network information for 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 nsINetworkInfo network,
in DOMString host);
/**
* Remove host route to the specified network from routing table.
*
* @param network
* The network information for 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 nsINetworkInfo network,
in DOMString host);
};