gecko/dom/system/gonk/nsINetworkService.idl

345 lines
10 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 nsINetworkInterface;
[scriptable, function, uuid(91824160-fb25-11e1-a21f-0800200c9a66)]
interface nsIWifiTetheringCallback : nsISupports
{
/**
* Callback function used to report status to WifiManager.
*
* @param error
* An error message if the operation wasn't successful,
* or `null` if it was.
*/
void wifiTetheringEnabledChange(in jsval error);
};
[scriptable, function, uuid(9c128e68-5e4b-4626-bb88-84ec54cce5d8)]
interface nsINetworkStatsCallback : nsISupports
{
void networkStatsAvailable(in boolean success,
in unsigned long rxBytes,
in unsigned long txBytes,
in unsigned long long timestamp);
};
[scriptable, function, uuid(0706bfa2-ac2d-11e2-9a8d-7b6d988d4767)]
interface nsINetworkUsageAlarmCallback : nsISupports
{
void networkUsageAlarmResult(in jsval error);
};
[scriptable, function, uuid(9ede8720-f8bc-11e2-b778-0800200c9a66)]
interface nsIWifiOperationModeCallback : nsISupports
{
/**
* Callback function used to report result to WifiManager.
*
* @param error
* An error message if the operation wasn't successful,
* or `null` if it was.
*/
void wifiOperationModeResult(in jsval error);
};
[scriptable, function, uuid(097878b0-19fc-11e3-8ffd-0800200c9a66)]
interface nsISetDhcpServerCallback : nsISupports
{
/**
* Callback function used to report the DHCP server set result
*
* @param error
* An error message if the operation wasn't successful,
* or `null` if it was.
*/
void dhcpServerResult(in jsval error);
};
[scriptable, function, uuid(32407c50-46c7-11e3-8f96-0800200c9a66)]
interface nsIUsbTetheringCallback : nsISupports
{
/**
* Callback function used to report status of enabling usb tethering.
*
* @param error
* An error message if the operation wasn't successful,
* or `null` if it was.
*/
void usbTetheringEnabledChange(in jsval error);
};
[scriptable, function, uuid(055fd560-46ad-11e3-8f96-0800200c9a66)]
interface nsIEnableUsbRndisCallback : nsISupports
{
/**
* Callback function used to report the status of enabling/disabling usb rndis.
*
* @param success
* Boolean to indicate the operation is successful or not.
* @param enable
* Boolean to indicate if we are enabling or disabling usb rndis.
*/
void enableUsbRndisResult(in boolean success, in boolean enable);
};
[scriptable, function, uuid(4f08cc30-46ad-11e3-8f96-0800200c9a66)]
interface nsIUpdateUpStreamCallback : nsISupports
{
/**
* Callback function used to report the result of updating upstream.
*
* @param success
* Boolean to indicate the operation is successful or not.
* @param externalIfname
* The external interface name.
*/
void updateUpStreamResult(in boolean success, in DOMString externalIfname);
};
/**
* Provide network services.
*/
[scriptable, uuid(ddb38428-0cf2-4c6a-a3c9-5e2f00fc54db)]
interface nsINetworkService : nsISupports
{
/**
* Enable or disable Wifi Tethering
*
* @param enabled
* Boolean that indicates whether tethering should be enabled (true) or disabled (false).
* @param config
* The Wifi Tethering configuration from settings db.
* @param callback
* Callback function used to report status to WifiManager.
*/
void setWifiTethering(in boolean enabled,
in jsval config,
in nsIWifiTetheringCallback callback);
/**
* Enable or disable DHCP server
*
* @param enabled
* Boolean that indicates enabling or disabling DHCP server.
*
* @param config
* Config used to enable the DHCP server. It contains
* .startIp start of the ip lease range (string)
* .endIp end of the ip lease range (string)
* .serverIp ip of the DHCP server (string)
* .maskLength the length of the subnet mask
* .ifname the interface name
*
* As for disabling the DHCP server, put this value |null|.
*
* @param callback
* Callback function used to report status.
*/
void setDhcpServer(in boolean enabled,
in jsval config,
in nsISetDhcpServerCallback callback);
/**
* Retrieve network interface stats.
*
* @param networkName
* Select the Network interface to request estats.
*
* @param callback
* Callback to notify result and provide stats, connectionType
* and the date when stats are retrieved
*/
void getNetworkInterfaceStats(in DOMString networkName, in nsINetworkStatsCallback callback);
/**
* Set Alarm of usage per interface
*
* @param networkName
* Select the Network interface to set an alarm.
*
* @param threshold
* Amount of data that will trigger the alarm.
*
* @param callback
* Callback to notify the result.
*
* @return false if there is no interface registered for the networkType param.
*/
boolean setNetworkInterfaceAlarm(in DOMString networkName,
in long threshold,
in nsINetworkUsageAlarmCallback callback);
/**
* Reload Wifi firmware to specific operation mode.
*
* @param interfaceName
* Wifi Network interface name.
*
* @param mode
* AP - Access pointer mode.
* P2P - Peer to peer connection mode.
* STA - Station mode.
*
* @param callback
* Callback to notify Wifi firmware reload result.
*/
void setWifiOperationMode(in DOMString interfaceName,
in DOMString mode,
in nsIWifiOperationModeCallback callback);
/**
* Set http proxy for specific network
*
* @param networkInterface
* The network interface which contains the http proxy host/port
* we want to set.
*/
void setNetworkProxy(in nsINetworkInterface networkInterface);
/**
* Set USB tethering.
*
* @param enabled
* Boolean to indicate we are going to enable or disable usb tethering.
* @param config
* The usb tethering configuration.
* @param callback
* Callback function used to report the result enabling/disabling usb tethering.
*/
void setUSBTethering(in boolean enabled,
in jsval config,
in nsIUsbTetheringCallback callback);
/**
* Reset routing table.
*
* @param networkInterface
* The network interface we want remove from the routing table.
*/
void resetRoutingTable(in nsINetworkInterface networkInterface);
/**
* Set DNS.
*
* @param networkInterface
* The network interface which contains the DNS we want to set.
*/
void setDNS(in nsINetworkInterface networkInterface);
/**
* Set default route and DNS.
*
* @param networkInterface
* The network interface we want to set to the default route and dns.
* @param oldInterface
* The previous network interface.
*/
void setDefaultRouteAndDNS(in nsINetworkInterface networkInterface,
in nsINetworkInterface oldInterface);
/**
* Remove default route.
*
* @param networkInterface
* The network interface we want remove from the default route.
*/
void removeDefaultRoute(in nsINetworkInterface networkInterface);
/**
* Add host route.
*
* @param interfaceName
* Network interface name for the output of the host route.
* @param gateway
* Gateway ip for the output of the host route.
* @param host
* Host ip we want to add route for.
*
* @return A deferred promise that resolves on success or rejects with a
* specified reason otherwise.
*/
jsval addHostRoute(in DOMString interfaceName, in DOMString gateway,
in DOMString host);
/**
* Remove host route.
*
* @param interfaceName
* Network interface name for the output of the host route.
* @param gateway
* Gateway ip for the output of the host route.
* @param host
* Host ip we want to remove route for.
*
* @return A deferred promise that resolves on success or rejects with a
* specified reason otherwise.
*/
jsval removeHostRoute(in DOMString interfaceName, in DOMString gateway,
in DOMString host);
/**
* Remove all host routes.
*
* @param interfaceName
* The interface name we want remove from the routing table.
*/
void removeHostRoutes(in DOMString interfaceName);
/**
* Add route to secondary routing table.
*
* @param interfaceName
* The network interface for this route.
* @param route
* The route info should have the following fields:
* .ip: destination ip address
* .prefix: destination prefix
* .gateway: gateway ip address
*/
void addSecondaryRoute(in DOMString interfaceName, in jsval route);
/**
* Remove route from secondary routing table.
*
* @param interfaceName
* The network interface for the route we want to remove.
* @param route
* The route info should have the following fields:
* .ip: destination ip address
* .prefix: destination prefix
* .gateway: gateway ip address
*/
void removeSecondaryRoute(in DOMString interfaceName, in jsval route);
/**
* Enable or disable usb rndis.
*
* @param enable
* Boolean to indicate we want enable or disable usb rndis.
* @param callback
* Callback function to report the result.
*/
void enableUsbRndis(in boolean enable,
in nsIEnableUsbRndisCallback callback);
/**
* Update upstream.
*
* @param previous
* The previous internal and external interface.
* @param current
* The current internal and external interface.
* @param callback
* Callback function to report the result.
*/
void updateUpStream(in jsval previous,
in jsval current,
in nsIUpdateUpStreamCallback callback);
};