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 nsIWifiTetheringCallback; michael@0: michael@0: /** michael@0: * Information about networks that is exposed to network manager API consumers. michael@0: */ michael@0: [scriptable, uuid(cb62ae03-6bda-43ff-9560-916d60203d33)] michael@0: interface nsINetworkInterface : nsISupports michael@0: { michael@0: const long NETWORK_STATE_UNKNOWN = -1; michael@0: const long NETWORK_STATE_CONNECTING = 0; michael@0: const long NETWORK_STATE_CONNECTED = 1; michael@0: const long NETWORK_STATE_DISCONNECTING = 2; michael@0: const long NETWORK_STATE_DISCONNECTED = 3; michael@0: michael@0: /** michael@0: * Current network state, one of the NETWORK_STATE_* constants. michael@0: * michael@0: * When this changes, network interface implementations notify the michael@0: * 'network-interface-state-changed' observer notification. michael@0: */ michael@0: readonly attribute long state; michael@0: michael@0: const long NETWORK_TYPE_UNKNOWN = -1; michael@0: const long NETWORK_TYPE_WIFI = 0; michael@0: const long NETWORK_TYPE_MOBILE = 1; michael@0: const long NETWORK_TYPE_MOBILE_MMS = 2; michael@0: const long NETWORK_TYPE_MOBILE_SUPL = 3; michael@0: const long NETWORK_TYPE_WIFI_P2P = 4; michael@0: const long NETWORK_TYPE_MOBILE_IMS = 5; michael@0: const long NETWORK_TYPE_MOBILE_DUN = 6; michael@0: michael@0: /** michael@0: * Network type. One of the NETWORK_TYPE_* constants. michael@0: */ michael@0: readonly attribute long type; michael@0: michael@0: /** michael@0: * Name of the network interface. This identifier is unique. michael@0: */ michael@0: readonly attribute DOMString name; michael@0: michael@0: /** michael@0: * The host name of the http proxy server. michael@0: */ michael@0: readonly attribute DOMString httpProxyHost; michael@0: michael@0: /* michael@0: * The port number of the http proxy server. michael@0: */ michael@0: readonly attribute long httpProxyPort; michael@0: michael@0: /** michael@0: * Get the list of ip addresses and prefix lengths, ip address could be IPv4 michael@0: * or IPv6, typically 1 IPv4 or 1 IPv6 or one of each. michael@0: * michael@0: * @param ips michael@0: * The list of ip addresses retrieved. michael@0: * @param prefixLengths michael@0: * The list of prefix lengths retrieved. michael@0: * michael@0: * @returns the length of the lists. michael@0: */ michael@0: void getAddresses([array, size_is(count)] out wstring ips, michael@0: [array, size_is(count)] out unsigned long prefixLengths, michael@0: [retval] out unsigned long count); michael@0: michael@0: /** michael@0: * Get the list of gateways, could be IPv4 or IPv6, typically 1 IPv4 or 1 michael@0: * IPv6 or one of each. michael@0: * michael@0: * @param count michael@0: * The length of the list of gateways michael@0: * michael@0: * @returns the list of gateways. michael@0: */ michael@0: void getGateways([optional] out unsigned long count, michael@0: [array, size_is(count), retval] out wstring gateways); michael@0: michael@0: /** michael@0: * Get the list of dnses, could be IPv4 or IPv6. michael@0: * michael@0: * @param count michael@0: * The length of the list of dnses. michael@0: * michael@0: * @returns the list of dnses. michael@0: */ michael@0: void getDnses([optional] out unsigned long count, michael@0: [array, size_is(count), retval] out wstring dnses); michael@0: }; michael@0: michael@0: /** michael@0: * Manage network interfaces. michael@0: */ michael@0: [scriptable, uuid(3ea50550-4b3c-11e3-8f96-0800200c9a66)] michael@0: interface nsINetworkManager : nsISupports michael@0: { michael@0: /** michael@0: * Register the given network interface with the network manager. michael@0: * michael@0: * Consumers will be notified with the 'network-interface-registered' michael@0: * observer notification. michael@0: * michael@0: * Throws if there's already an interface registered that has the same michael@0: * name. michael@0: * michael@0: * @param network michael@0: * Network interface to register. michael@0: */ michael@0: void registerNetworkInterface(in nsINetworkInterface network); michael@0: michael@0: /** michael@0: * Unregister the given network interface from the network manager. michael@0: * michael@0: * Consumers will be notified with the 'network-interface-unregistered' michael@0: * observer notification. michael@0: * michael@0: * Throws an exception if the specified network interface object isn't michael@0: * registered. michael@0: * michael@0: * @param network michael@0: * Network interface to unregister. michael@0: */ michael@0: void unregisterNetworkInterface(in nsINetworkInterface network); michael@0: michael@0: /** michael@0: * Object containing all known network connections, keyed by their michael@0: * interface name. michael@0: */ michael@0: readonly attribute jsval networkInterfaces; michael@0: michael@0: /** michael@0: * The preferred network type. One of the michael@0: * nsINetworkInterface::NETWORK_TYPE_* constants. michael@0: * michael@0: * This attribute is used for setting default route to favor michael@0: * interfaces with given type. This can be overriden by calling michael@0: * overrideDefaultRoute(). michael@0: */ michael@0: attribute long preferredNetworkType; michael@0: michael@0: /** michael@0: * The network interface handling all data traffic. michael@0: * michael@0: * When this changes, the 'network-active-changed' observer michael@0: * notification is dispatched. michael@0: */ michael@0: readonly attribute nsINetworkInterface active; michael@0: michael@0: /** michael@0: * Override the default behaviour for preferredNetworkType and route michael@0: * all network traffic through the the specified interface. michael@0: * michael@0: * Consumers can observe changes to the active network by subscribing to michael@0: * the 'network-active-changed' observer notification. michael@0: * michael@0: * @param network michael@0: * Network to route all network traffic to. If this is null, michael@0: * a previous override is canceled. michael@0: */ michael@0: long overrideActive(in nsINetworkInterface network); 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 network michael@0: * The Wifi network interface with at least name of network interface. 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 nsINetworkInterface networkInterface, michael@0: in jsval config, michael@0: in nsIWifiTetheringCallback callback); michael@0: };