Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsISupports.idl" |
michael@0 | 6 | |
michael@0 | 7 | interface nsIWifiTetheringCallback; |
michael@0 | 8 | |
michael@0 | 9 | /** |
michael@0 | 10 | * Information about networks that is exposed to network manager API consumers. |
michael@0 | 11 | */ |
michael@0 | 12 | [scriptable, uuid(cb62ae03-6bda-43ff-9560-916d60203d33)] |
michael@0 | 13 | interface nsINetworkInterface : nsISupports |
michael@0 | 14 | { |
michael@0 | 15 | const long NETWORK_STATE_UNKNOWN = -1; |
michael@0 | 16 | const long NETWORK_STATE_CONNECTING = 0; |
michael@0 | 17 | const long NETWORK_STATE_CONNECTED = 1; |
michael@0 | 18 | const long NETWORK_STATE_DISCONNECTING = 2; |
michael@0 | 19 | const long NETWORK_STATE_DISCONNECTED = 3; |
michael@0 | 20 | |
michael@0 | 21 | /** |
michael@0 | 22 | * Current network state, one of the NETWORK_STATE_* constants. |
michael@0 | 23 | * |
michael@0 | 24 | * When this changes, network interface implementations notify the |
michael@0 | 25 | * 'network-interface-state-changed' observer notification. |
michael@0 | 26 | */ |
michael@0 | 27 | readonly attribute long state; |
michael@0 | 28 | |
michael@0 | 29 | const long NETWORK_TYPE_UNKNOWN = -1; |
michael@0 | 30 | const long NETWORK_TYPE_WIFI = 0; |
michael@0 | 31 | const long NETWORK_TYPE_MOBILE = 1; |
michael@0 | 32 | const long NETWORK_TYPE_MOBILE_MMS = 2; |
michael@0 | 33 | const long NETWORK_TYPE_MOBILE_SUPL = 3; |
michael@0 | 34 | const long NETWORK_TYPE_WIFI_P2P = 4; |
michael@0 | 35 | const long NETWORK_TYPE_MOBILE_IMS = 5; |
michael@0 | 36 | const long NETWORK_TYPE_MOBILE_DUN = 6; |
michael@0 | 37 | |
michael@0 | 38 | /** |
michael@0 | 39 | * Network type. One of the NETWORK_TYPE_* constants. |
michael@0 | 40 | */ |
michael@0 | 41 | readonly attribute long type; |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Name of the network interface. This identifier is unique. |
michael@0 | 45 | */ |
michael@0 | 46 | readonly attribute DOMString name; |
michael@0 | 47 | |
michael@0 | 48 | /** |
michael@0 | 49 | * The host name of the http proxy server. |
michael@0 | 50 | */ |
michael@0 | 51 | readonly attribute DOMString httpProxyHost; |
michael@0 | 52 | |
michael@0 | 53 | /* |
michael@0 | 54 | * The port number of the http proxy server. |
michael@0 | 55 | */ |
michael@0 | 56 | readonly attribute long httpProxyPort; |
michael@0 | 57 | |
michael@0 | 58 | /** |
michael@0 | 59 | * Get the list of ip addresses and prefix lengths, ip address could be IPv4 |
michael@0 | 60 | * or IPv6, typically 1 IPv4 or 1 IPv6 or one of each. |
michael@0 | 61 | * |
michael@0 | 62 | * @param ips |
michael@0 | 63 | * The list of ip addresses retrieved. |
michael@0 | 64 | * @param prefixLengths |
michael@0 | 65 | * The list of prefix lengths retrieved. |
michael@0 | 66 | * |
michael@0 | 67 | * @returns the length of the lists. |
michael@0 | 68 | */ |
michael@0 | 69 | void getAddresses([array, size_is(count)] out wstring ips, |
michael@0 | 70 | [array, size_is(count)] out unsigned long prefixLengths, |
michael@0 | 71 | [retval] out unsigned long count); |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * Get the list of gateways, could be IPv4 or IPv6, typically 1 IPv4 or 1 |
michael@0 | 75 | * IPv6 or one of each. |
michael@0 | 76 | * |
michael@0 | 77 | * @param count |
michael@0 | 78 | * The length of the list of gateways |
michael@0 | 79 | * |
michael@0 | 80 | * @returns the list of gateways. |
michael@0 | 81 | */ |
michael@0 | 82 | void getGateways([optional] out unsigned long count, |
michael@0 | 83 | [array, size_is(count), retval] out wstring gateways); |
michael@0 | 84 | |
michael@0 | 85 | /** |
michael@0 | 86 | * Get the list of dnses, could be IPv4 or IPv6. |
michael@0 | 87 | * |
michael@0 | 88 | * @param count |
michael@0 | 89 | * The length of the list of dnses. |
michael@0 | 90 | * |
michael@0 | 91 | * @returns the list of dnses. |
michael@0 | 92 | */ |
michael@0 | 93 | void getDnses([optional] out unsigned long count, |
michael@0 | 94 | [array, size_is(count), retval] out wstring dnses); |
michael@0 | 95 | }; |
michael@0 | 96 | |
michael@0 | 97 | /** |
michael@0 | 98 | * Manage network interfaces. |
michael@0 | 99 | */ |
michael@0 | 100 | [scriptable, uuid(3ea50550-4b3c-11e3-8f96-0800200c9a66)] |
michael@0 | 101 | interface nsINetworkManager : nsISupports |
michael@0 | 102 | { |
michael@0 | 103 | /** |
michael@0 | 104 | * Register the given network interface with the network manager. |
michael@0 | 105 | * |
michael@0 | 106 | * Consumers will be notified with the 'network-interface-registered' |
michael@0 | 107 | * observer notification. |
michael@0 | 108 | * |
michael@0 | 109 | * Throws if there's already an interface registered that has the same |
michael@0 | 110 | * name. |
michael@0 | 111 | * |
michael@0 | 112 | * @param network |
michael@0 | 113 | * Network interface to register. |
michael@0 | 114 | */ |
michael@0 | 115 | void registerNetworkInterface(in nsINetworkInterface network); |
michael@0 | 116 | |
michael@0 | 117 | /** |
michael@0 | 118 | * Unregister the given network interface from the network manager. |
michael@0 | 119 | * |
michael@0 | 120 | * Consumers will be notified with the 'network-interface-unregistered' |
michael@0 | 121 | * observer notification. |
michael@0 | 122 | * |
michael@0 | 123 | * Throws an exception if the specified network interface object isn't |
michael@0 | 124 | * registered. |
michael@0 | 125 | * |
michael@0 | 126 | * @param network |
michael@0 | 127 | * Network interface to unregister. |
michael@0 | 128 | */ |
michael@0 | 129 | void unregisterNetworkInterface(in nsINetworkInterface network); |
michael@0 | 130 | |
michael@0 | 131 | /** |
michael@0 | 132 | * Object containing all known network connections, keyed by their |
michael@0 | 133 | * interface name. |
michael@0 | 134 | */ |
michael@0 | 135 | readonly attribute jsval networkInterfaces; |
michael@0 | 136 | |
michael@0 | 137 | /** |
michael@0 | 138 | * The preferred network type. One of the |
michael@0 | 139 | * nsINetworkInterface::NETWORK_TYPE_* constants. |
michael@0 | 140 | * |
michael@0 | 141 | * This attribute is used for setting default route to favor |
michael@0 | 142 | * interfaces with given type. This can be overriden by calling |
michael@0 | 143 | * overrideDefaultRoute(). |
michael@0 | 144 | */ |
michael@0 | 145 | attribute long preferredNetworkType; |
michael@0 | 146 | |
michael@0 | 147 | /** |
michael@0 | 148 | * The network interface handling all data traffic. |
michael@0 | 149 | * |
michael@0 | 150 | * When this changes, the 'network-active-changed' observer |
michael@0 | 151 | * notification is dispatched. |
michael@0 | 152 | */ |
michael@0 | 153 | readonly attribute nsINetworkInterface active; |
michael@0 | 154 | |
michael@0 | 155 | /** |
michael@0 | 156 | * Override the default behaviour for preferredNetworkType and route |
michael@0 | 157 | * all network traffic through the the specified interface. |
michael@0 | 158 | * |
michael@0 | 159 | * Consumers can observe changes to the active network by subscribing to |
michael@0 | 160 | * the 'network-active-changed' observer notification. |
michael@0 | 161 | * |
michael@0 | 162 | * @param network |
michael@0 | 163 | * Network to route all network traffic to. If this is null, |
michael@0 | 164 | * a previous override is canceled. |
michael@0 | 165 | */ |
michael@0 | 166 | long overrideActive(in nsINetworkInterface network); |
michael@0 | 167 | |
michael@0 | 168 | /** |
michael@0 | 169 | * Enable or disable Wifi Tethering |
michael@0 | 170 | * |
michael@0 | 171 | * @param enabled |
michael@0 | 172 | * Boolean that indicates whether tethering should be enabled (true) or disabled (false). |
michael@0 | 173 | * @param network |
michael@0 | 174 | * The Wifi network interface with at least name of network interface. |
michael@0 | 175 | * @param config |
michael@0 | 176 | * The Wifi Tethering configuration from settings db. |
michael@0 | 177 | * @param callback |
michael@0 | 178 | * Callback function used to report status to WifiManager. |
michael@0 | 179 | */ |
michael@0 | 180 | void setWifiTethering(in boolean enabled, |
michael@0 | 181 | in nsINetworkInterface networkInterface, |
michael@0 | 182 | in jsval config, |
michael@0 | 183 | in nsIWifiTetheringCallback callback); |
michael@0 | 184 | }; |