michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsINetworkInterface; michael@0: michael@0: [scriptable, function, uuid(91824160-fb25-11e1-a21f-0800200c9a66)] michael@0: interface nsIWifiTetheringCallback : nsISupports michael@0: { michael@0: /** michael@0: * Callback function used to report status to WifiManager. michael@0: * michael@0: * @param error michael@0: * An error message if the operation wasn't successful, michael@0: * or `null` if it was. michael@0: */ michael@0: void wifiTetheringEnabledChange(in jsval error); michael@0: }; michael@0: michael@0: [scriptable, function, uuid(e079aa2a-ec0a-4bbd-b1a4-d81a9faae464)] michael@0: interface nsINetworkStatsCallback : nsISupports michael@0: { michael@0: void networkStatsAvailable(in boolean success, michael@0: in unsigned long rxBytes, michael@0: in unsigned long txBytes, michael@0: in jsval date); michael@0: }; michael@0: michael@0: [scriptable, function, uuid(0706bfa2-ac2d-11e2-9a8d-7b6d988d4767)] michael@0: interface nsINetworkUsageAlarmCallback : nsISupports michael@0: { michael@0: void networkUsageAlarmResult(in jsval error); michael@0: }; michael@0: michael@0: [scriptable, function, uuid(9ede8720-f8bc-11e2-b778-0800200c9a66)] michael@0: interface nsIWifiOperationModeCallback : nsISupports michael@0: { michael@0: /** michael@0: * Callback function used to report result to WifiManager. michael@0: * michael@0: * @param error michael@0: * An error message if the operation wasn't successful, michael@0: * or `null` if it was. michael@0: */ michael@0: void wifiOperationModeResult(in jsval error); michael@0: }; michael@0: michael@0: [scriptable, function, uuid(097878b0-19fc-11e3-8ffd-0800200c9a66)] michael@0: interface nsISetDhcpServerCallback : nsISupports michael@0: { michael@0: /** michael@0: * Callback function used to report the DHCP server set result michael@0: * michael@0: * @param error michael@0: * An error message if the operation wasn't successful, michael@0: * or `null` if it was. michael@0: */ michael@0: void dhcpServerResult(in jsval error); michael@0: }; michael@0: michael@0: [scriptable, function, uuid(32407c50-46c7-11e3-8f96-0800200c9a66)] michael@0: interface nsIUsbTetheringCallback : nsISupports michael@0: { michael@0: /** michael@0: * Callback function used to report status of enabling usb tethering. michael@0: * michael@0: * @param error michael@0: * An error message if the operation wasn't successful, michael@0: * or `null` if it was. michael@0: */ michael@0: void usbTetheringEnabledChange(in jsval error); michael@0: }; michael@0: michael@0: [scriptable, function, uuid(055fd560-46ad-11e3-8f96-0800200c9a66)] michael@0: interface nsIEnableUsbRndisCallback : nsISupports michael@0: { michael@0: /** michael@0: * Callback function used to report the status of enabling/disabling usb rndis. michael@0: * michael@0: * @param success michael@0: * Boolean to indicate the operation is successful or not. michael@0: * @param enable michael@0: * Boolean to indicate if we are enabling or disabling usb rndis. michael@0: */ michael@0: void enableUsbRndisResult(in boolean success, in boolean enable); michael@0: }; michael@0: michael@0: [scriptable, function, uuid(4f08cc30-46ad-11e3-8f96-0800200c9a66)] michael@0: interface nsIUpdateUpStreamCallback : nsISupports michael@0: { michael@0: /** michael@0: * Callback function used to report the result of updating upstream. michael@0: * michael@0: * @param success michael@0: * Boolean to indicate the operation is successful or not. michael@0: * @param externalIfname michael@0: * The external interface name. michael@0: */ michael@0: void updateUpStreamResult(in boolean success, in DOMString externalIfname); michael@0: }; michael@0: michael@0: /** michael@0: * Provide network services. michael@0: */ michael@0: [scriptable, uuid(f96461fa-e844-45d2-a6c3-8cd23ab0916b)] michael@0: interface nsINetworkService : nsISupports michael@0: { michael@0: /** michael@0: * Enable or disable Wifi Tethering michael@0: * michael@0: * @param enabled michael@0: * Boolean that indicates whether tethering should be enabled (true) or disabled (false). michael@0: * @param config michael@0: * The Wifi Tethering configuration from settings db. michael@0: * @param callback michael@0: * Callback function used to report status to WifiManager. michael@0: */ michael@0: void setWifiTethering(in boolean enabled, michael@0: in jsval config, michael@0: in nsIWifiTetheringCallback callback); michael@0: michael@0: /** michael@0: * Enable or disable DHCP server michael@0: * michael@0: * @param enabled michael@0: * Boolean that indicates enabling or disabling DHCP server. michael@0: * michael@0: * @param config michael@0: * Config used to enable the DHCP server. It contains michael@0: * .startIp start of the ip lease range (string) michael@0: * .endIp end of the ip lease range (string) michael@0: * .serverIp ip of the DHCP server (string) michael@0: * .maskLength the length of the subnet mask michael@0: * .ifname the interface name michael@0: * michael@0: * As for disabling the DHCP server, put this value |null|. michael@0: * michael@0: * @param callback michael@0: * Callback function used to report status. michael@0: */ michael@0: void setDhcpServer(in boolean enabled, michael@0: in jsval config, michael@0: in nsISetDhcpServerCallback callback); michael@0: michael@0: michael@0: /** michael@0: * Retrieve network interface stats. michael@0: * michael@0: * @param networkName michael@0: * Select the Network interface to request estats. michael@0: * michael@0: * @param callback michael@0: * Callback to notify result and provide stats, connectionType michael@0: * and the date when stats are retrieved michael@0: */ michael@0: void getNetworkInterfaceStats(in DOMString networkName, in nsINetworkStatsCallback callback); michael@0: michael@0: /** michael@0: * Set Alarm of usage per interface michael@0: * michael@0: * @param networkName michael@0: * Select the Network interface to set an alarm. michael@0: * michael@0: * @param threshold michael@0: * Amount of data that will trigger the alarm. michael@0: * michael@0: * @param callback michael@0: * Callback to notify the result. michael@0: * michael@0: * @return false if there is no interface registered for the networkType param. michael@0: */ michael@0: boolean setNetworkInterfaceAlarm(in DOMString networkName, michael@0: in long threshold, michael@0: in nsINetworkUsageAlarmCallback callback); michael@0: michael@0: /** michael@0: * Reload Wifi firmware to specific operation mode. michael@0: * michael@0: * @param interfaceName michael@0: * Wifi Network interface name. michael@0: * michael@0: * @param mode michael@0: * AP - Access pointer mode. michael@0: * P2P - Peer to peer connection mode. michael@0: * STA - Station mode. michael@0: * michael@0: * @param callback michael@0: * Callback to notify Wifi firmware reload result. michael@0: */ michael@0: void setWifiOperationMode(in DOMString interfaceName, michael@0: in DOMString mode, michael@0: in nsIWifiOperationModeCallback callback); michael@0: michael@0: /** michael@0: * Set http proxy for specific network michael@0: * michael@0: * @param networkInterface michael@0: * The network interface which contains the http proxy host/port michael@0: * we want to set. michael@0: */ michael@0: void setNetworkProxy(in nsINetworkInterface networkInterface); michael@0: michael@0: /** michael@0: * Set USB tethering. michael@0: * michael@0: * @param enabled michael@0: * Boolean to indicate we are going to enable or disable usb tethering. michael@0: * @param config michael@0: * The usb tethering configuration. michael@0: * @param callback michael@0: * Callback function used to report the result enabling/disabling usb tethering. michael@0: */ michael@0: void setUSBTethering(in boolean enabled, michael@0: in jsval config, michael@0: in nsIUsbTetheringCallback callback); michael@0: michael@0: /** michael@0: * Reset routing table. michael@0: * michael@0: * @param networkInterface michael@0: * The network interface we want remove from the routing table. michael@0: */ michael@0: void resetRoutingTable(in nsINetworkInterface networkInterface); michael@0: michael@0: /** michael@0: * Set DNS. michael@0: * michael@0: * @param networkInterface michael@0: * The network interface which contains the DNS we want to set. michael@0: */ michael@0: void setDNS(in nsINetworkInterface networkInterface); michael@0: michael@0: /** michael@0: * Set default route and DNS. michael@0: * michael@0: * @param networkInterface michael@0: * The network interface we want to set to the default route and dns. michael@0: * @param oldInterface michael@0: * The previous network interface. michael@0: */ michael@0: void setDefaultRouteAndDNS(in nsINetworkInterface networkInterface, michael@0: in nsINetworkInterface oldInterface); michael@0: michael@0: /** michael@0: * Remove default route. michael@0: * michael@0: * @param networkInterface michael@0: * The network interface we want remove from the default route. michael@0: */ michael@0: void removeDefaultRoute(in nsINetworkInterface networkInterface); michael@0: michael@0: /** michael@0: * Add host route. michael@0: * michael@0: * @param networkInterface michael@0: * The network interface we want to add to the host route. michael@0: */ michael@0: void addHostRoute(in nsINetworkInterface networkInterface); michael@0: michael@0: /** michael@0: * Remove host route. michael@0: * michael@0: * @param network michael@0: * The network interface we want to remove from the host route. michael@0: */ michael@0: void removeHostRoute(in nsINetworkInterface network); michael@0: michael@0: /** michael@0: * Remove all host routes. michael@0: * michael@0: * @param interfaceName michael@0: * The interface name we want remove from the routing table. michael@0: */ michael@0: void removeHostRoutes(in DOMString interfaceName); michael@0: michael@0: /** michael@0: * Add host route with resolve. michael@0: * michael@0: * @param network michael@0: * The network interface we want to add to the host route. michael@0: * @param hosts michael@0: * The array of host names we want to add. michael@0: */ michael@0: void addHostRouteWithResolve(in nsINetworkInterface network, in jsval hosts); michael@0: michael@0: /** michael@0: * Remove host route with resolve. michael@0: * michael@0: * @param network michael@0: * The network interface we want to remove from the host route. michael@0: * @param hosts michael@0: * The array of host names we want to remove. michael@0: */ michael@0: void removeHostRouteWithResolve(in nsINetworkInterface network, in jsval hosts); michael@0: michael@0: /** michael@0: * Add route to secondary routing table. michael@0: * michael@0: * @param interfaceName michael@0: * The network interface for this route. michael@0: * @param route michael@0: * The route info should have the following fields: michael@0: * .ip: destination ip address michael@0: * .prefix: destination prefix michael@0: * .gateway: gateway ip address michael@0: */ michael@0: void addSecondaryRoute(in DOMString interfaceName, in jsval route); michael@0: michael@0: /** michael@0: * Remove route from secondary routing table. michael@0: * michael@0: * @param interfaceName michael@0: * The network interface for the route we want to remove. michael@0: * @param route michael@0: * The route info should have the following fields: michael@0: * .ip: destination ip address michael@0: * .prefix: destination prefix michael@0: * .gateway: gateway ip address michael@0: */ michael@0: void removeSecondaryRoute(in DOMString interfaceName, in jsval route); michael@0: michael@0: /** michael@0: * Enable or disable usb rndis. michael@0: * michael@0: * @param enable michael@0: * Boolean to indicate we want enable or disable usb rndis. michael@0: * @param callback michael@0: * Callback function to report the result. michael@0: */ michael@0: void enableUsbRndis(in boolean enable, michael@0: in nsIEnableUsbRndisCallback callback); michael@0: michael@0: /** michael@0: * Update upstream. michael@0: * michael@0: * @param previous michael@0: * The previous internal and external interface. michael@0: * @param current michael@0: * The current internal and external interface. michael@0: * @param callback michael@0: * Callback function to report the result. michael@0: */ michael@0: void updateUpStream(in jsval previous, michael@0: in jsval current, michael@0: in nsIUpdateUpStreamCallback callback); michael@0: };