San Mehat | 873f214 | 2010-01-14 10:25:07 -0800 | [diff] [blame] | 1 | /* //device/java/android/android/os/INetworkManagementService.aidl |
| 2 | ** |
| 3 | ** Copyright 2007, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | package android.os; |
| 19 | |
San Mehat | ed4fc8a | 2010-01-22 12:28:36 -0800 | [diff] [blame] | 20 | import android.net.InterfaceConfiguration; |
San Mehat | 4d02d00 | 2010-01-22 16:07:46 -0800 | [diff] [blame] | 21 | import android.net.INetworkManagementEventObserver; |
Jeff Sharkey | 9a13f36 | 2011-04-26 16:25:36 -0700 | [diff] [blame] | 22 | import android.net.NetworkStats; |
Robert Greenwalt | 59b1a4e | 2011-05-10 15:05:02 -0700 | [diff] [blame] | 23 | import android.net.RouteInfo; |
Irfan Sheriff | 9ab518ad | 2010-03-12 15:48:17 -0800 | [diff] [blame] | 24 | import android.net.wifi.WifiConfiguration; |
San Mehat | ed4fc8a | 2010-01-22 12:28:36 -0800 | [diff] [blame] | 25 | |
San Mehat | 873f214 | 2010-01-14 10:25:07 -0800 | [diff] [blame] | 26 | /** |
| 27 | * @hide |
| 28 | */ |
| 29 | interface INetworkManagementService |
| 30 | { |
| 31 | /** |
| 32 | ** GENERAL |
| 33 | **/ |
| 34 | |
| 35 | /** |
San Mehat | 4d02d00 | 2010-01-22 16:07:46 -0800 | [diff] [blame] | 36 | * Register an observer to receive events |
| 37 | */ |
| 38 | void registerObserver(INetworkManagementEventObserver obs); |
| 39 | |
| 40 | /** |
| 41 | * Unregister an observer from receiving events. |
| 42 | */ |
| 43 | void unregisterObserver(INetworkManagementEventObserver obs); |
| 44 | |
| 45 | /** |
San Mehat | 873f214 | 2010-01-14 10:25:07 -0800 | [diff] [blame] | 46 | * Returns a list of currently known network interfaces |
| 47 | */ |
| 48 | String[] listInterfaces(); |
| 49 | |
| 50 | /** |
San Mehat | ed4fc8a | 2010-01-22 12:28:36 -0800 | [diff] [blame] | 51 | * Retrieves the specified interface config |
| 52 | * |
| 53 | */ |
| 54 | InterfaceConfiguration getInterfaceConfig(String iface); |
| 55 | |
| 56 | /** |
| 57 | * Sets the configuration of the specified interface |
| 58 | */ |
| 59 | void setInterfaceConfig(String iface, in InterfaceConfiguration cfg); |
| 60 | |
| 61 | /** |
Irfan Sheriff | f560061 | 2011-06-16 10:26:28 -0700 | [diff] [blame] | 62 | * Clear all IP addresses on the specified interface |
| 63 | */ |
| 64 | void clearInterfaceAddresses(String iface); |
| 65 | |
| 66 | /** |
Irfan Sheriff | 7244c97 | 2011-08-05 20:40:45 -0700 | [diff] [blame] | 67 | * Set interface down |
| 68 | */ |
| 69 | void setInterfaceDown(String iface); |
| 70 | |
| 71 | /** |
| 72 | * Set interface up |
| 73 | */ |
| 74 | void setInterfaceUp(String iface); |
| 75 | |
| 76 | /** |
Irfan Sheriff | 7329361 | 2011-09-14 12:31:56 -0700 | [diff] [blame] | 77 | * Set interface IPv6 privacy extensions |
| 78 | */ |
| 79 | void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable); |
| 80 | |
| 81 | /** |
repo sync | 7960d9f | 2011-09-29 12:40:02 -0700 | [diff] [blame] | 82 | * Disable IPv6 on an interface |
| 83 | */ |
| 84 | void disableIpv6(String iface); |
| 85 | |
| 86 | /** |
| 87 | * Enable IPv6 on an interface |
| 88 | */ |
| 89 | void enableIpv6(String iface); |
| 90 | |
| 91 | /** |
Robert Greenwalt | 59b1a4e | 2011-05-10 15:05:02 -0700 | [diff] [blame] | 92 | * Retrieves the network routes currently configured on the specified |
| 93 | * interface |
| 94 | */ |
| 95 | RouteInfo[] getRoutes(String iface); |
| 96 | |
| 97 | /** |
| 98 | * Add the specified route to the interface. |
| 99 | */ |
| 100 | void addRoute(String iface, in RouteInfo route); |
| 101 | |
| 102 | /** |
| 103 | * Remove the specified route from the interface. |
| 104 | */ |
| 105 | void removeRoute(String iface, in RouteInfo route); |
| 106 | |
| 107 | /** |
Robert Greenwalt | 3b28e9a | 2011-11-02 14:37:19 -0700 | [diff] [blame] | 108 | * Add the specified route to a secondary interface |
| 109 | * This will go into a special route table to be accessed |
| 110 | * via ip rules |
| 111 | */ |
| 112 | void addSecondaryRoute(String iface, in RouteInfo route); |
| 113 | |
| 114 | /** |
| 115 | * Remove the specified secondary route. |
| 116 | */ |
| 117 | void removeSecondaryRoute(String iface, in RouteInfo route); |
| 118 | |
| 119 | /** |
San Mehat | 873f214 | 2010-01-14 10:25:07 -0800 | [diff] [blame] | 120 | * Shuts down the service |
| 121 | */ |
| 122 | void shutdown(); |
| 123 | |
| 124 | /** |
| 125 | ** TETHERING RELATED |
| 126 | **/ |
| 127 | |
San Mehat | 873f214 | 2010-01-14 10:25:07 -0800 | [diff] [blame] | 128 | /** |
| 129 | * Returns true if IP forwarding is enabled |
| 130 | */ |
| 131 | boolean getIpForwardingEnabled(); |
| 132 | |
| 133 | /** |
| 134 | * Enables/Disables IP Forwarding |
| 135 | */ |
| 136 | void setIpForwardingEnabled(boolean enabled); |
| 137 | |
| 138 | /** |
| 139 | * Start tethering services with the specified dhcp server range |
Robert Greenwalt | bfb7bfa | 2010-03-24 16:03:21 -0700 | [diff] [blame] | 140 | * arg is a set of start end pairs defining the ranges. |
San Mehat | 873f214 | 2010-01-14 10:25:07 -0800 | [diff] [blame] | 141 | */ |
Robert Greenwalt | bfb7bfa | 2010-03-24 16:03:21 -0700 | [diff] [blame] | 142 | void startTethering(in String[] dhcpRanges); |
San Mehat | 873f214 | 2010-01-14 10:25:07 -0800 | [diff] [blame] | 143 | |
| 144 | /** |
| 145 | * Stop currently running tethering services |
| 146 | */ |
| 147 | void stopTethering(); |
| 148 | |
| 149 | /** |
| 150 | * Returns true if tethering services are started |
| 151 | */ |
| 152 | boolean isTetheringStarted(); |
| 153 | |
| 154 | /** |
| 155 | * Tethers the specified interface |
| 156 | */ |
| 157 | void tetherInterface(String iface); |
| 158 | |
| 159 | /** |
| 160 | * Untethers the specified interface |
| 161 | */ |
| 162 | void untetherInterface(String iface); |
| 163 | |
| 164 | /** |
| 165 | * Returns a list of currently tethered interfaces |
| 166 | */ |
| 167 | String[] listTetheredInterfaces(); |
| 168 | |
| 169 | /** |
| 170 | * Sets the list of DNS forwarders (in order of priority) |
| 171 | */ |
| 172 | void setDnsForwarders(in String[] dns); |
| 173 | |
| 174 | /** |
| 175 | * Returns the list of DNS fowarders (in order of priority) |
| 176 | */ |
| 177 | String[] getDnsForwarders(); |
| 178 | |
| 179 | /** |
| 180 | * Enables Network Address Translation between two interfaces. |
| 181 | * The address and netmask of the external interface is used for |
| 182 | * the NAT'ed network. |
| 183 | */ |
| 184 | void enableNat(String internalInterface, String externalInterface); |
| 185 | |
| 186 | /** |
| 187 | * Disables Network Address Translation between two interfaces. |
| 188 | */ |
| 189 | void disableNat(String internalInterface, String externalInterface); |
San Mehat | 72759df | 2010-01-19 13:50:37 -0800 | [diff] [blame] | 190 | |
| 191 | /** |
| 192 | ** PPPD |
| 193 | **/ |
| 194 | |
| 195 | /** |
| 196 | * Returns the list of currently known TTY devices on the system |
| 197 | */ |
| 198 | String[] listTtys(); |
| 199 | |
| 200 | /** |
| 201 | * Attaches a PPP server daemon to the specified TTY with the specified |
| 202 | * local/remote addresses. |
| 203 | */ |
Robert Greenwalt | d0e18ff | 2010-01-26 11:40:34 -0800 | [diff] [blame] | 204 | void attachPppd(String tty, String localAddr, String remoteAddr, String dns1Addr, |
| 205 | String dns2Addr); |
San Mehat | 72759df | 2010-01-19 13:50:37 -0800 | [diff] [blame] | 206 | |
| 207 | /** |
| 208 | * Detaches a PPP server daemon from the specified TTY. |
| 209 | */ |
| 210 | void detachPppd(String tty); |
| 211 | |
Robert Greenwalt | ce1200d | 2010-02-18 11:25:54 -0800 | [diff] [blame] | 212 | /** |
Irfan Sheriff | cb30b22 | 2011-07-29 20:54:52 -0700 | [diff] [blame] | 213 | * Load firmware for operation in the given mode. Currently the three |
| 214 | * modes supported are "AP", "STA" and "P2P". |
| 215 | */ |
| 216 | void wifiFirmwareReload(String wlanIface, String mode); |
| 217 | |
| 218 | /** |
Irfan Sheriff | 5321aef | 2010-02-12 12:35:59 -0800 | [diff] [blame] | 219 | * Start Wifi Access Point |
| 220 | */ |
Irfan Sheriff | 9054275 | 2012-06-19 15:44:35 -0700 | [diff] [blame] | 221 | void startAccessPoint(in WifiConfiguration wifiConfig, String iface); |
Irfan Sheriff | 5321aef | 2010-02-12 12:35:59 -0800 | [diff] [blame] | 222 | |
| 223 | /** |
| 224 | * Stop Wifi Access Point |
| 225 | */ |
Irfan Sheriff | 9054275 | 2012-06-19 15:44:35 -0700 | [diff] [blame] | 226 | void stopAccessPoint(String iface); |
Irfan Sheriff | 5321aef | 2010-02-12 12:35:59 -0800 | [diff] [blame] | 227 | |
Irfan Sheriff | c2f54c2 | 2010-03-18 14:02:22 -0700 | [diff] [blame] | 228 | /** |
| 229 | * Set Access Point config |
| 230 | */ |
Irfan Sheriff | 9054275 | 2012-06-19 15:44:35 -0700 | [diff] [blame] | 231 | void setAccessPoint(in WifiConfiguration wifiConfig, String iface); |
San Mehat | 91cac64 | 2010-03-31 14:31:36 -0700 | [diff] [blame] | 232 | |
| 233 | /** |
Jeff Sharkey | 9a13f36 | 2011-04-26 16:25:36 -0700 | [diff] [blame] | 234 | ** DATA USAGE RELATED |
| 235 | **/ |
San Mehat | 91cac64 | 2010-03-31 14:31:36 -0700 | [diff] [blame] | 236 | |
| 237 | /** |
Jeff Sharkey | 9a13f36 | 2011-04-26 16:25:36 -0700 | [diff] [blame] | 238 | * Return global network statistics summarized at an interface level, |
| 239 | * without any UID-level granularity. |
San Mehat | 91cac64 | 2010-03-31 14:31:36 -0700 | [diff] [blame] | 240 | */ |
Jeff Sharkey | e8914c3 | 2012-05-01 16:26:09 -0700 | [diff] [blame] | 241 | NetworkStats getNetworkStatsSummaryDev(); |
| 242 | NetworkStats getNetworkStatsSummaryXt(); |
San Mehat | 91cac64 | 2010-03-31 14:31:36 -0700 | [diff] [blame] | 243 | |
| 244 | /** |
Jeff Sharkey | 9a13f36 | 2011-04-26 16:25:36 -0700 | [diff] [blame] | 245 | * Return detailed network statistics with UID-level granularity, |
| 246 | * including interface and tag details. |
| 247 | */ |
| 248 | NetworkStats getNetworkStatsDetail(); |
| 249 | |
| 250 | /** |
Jeff Sharkey | eedcb95 | 2011-05-17 14:55:15 -0700 | [diff] [blame] | 251 | * Return detailed network statistics for the requested UID, |
| 252 | * including interface and tag details. |
| 253 | */ |
| 254 | NetworkStats getNetworkStatsUidDetail(int uid); |
| 255 | |
| 256 | /** |
Jeff Sharkey | cdd02c5d | 2011-09-16 01:52:49 -0700 | [diff] [blame] | 257 | * Return summary of network statistics for the requested pairs of |
| 258 | * tethering interfaces. Even indexes are remote interface, and odd |
| 259 | * indexes are corresponding local interfaces. |
| 260 | */ |
| 261 | NetworkStats getNetworkStatsTethering(in String[] ifacePairs); |
| 262 | |
| 263 | /** |
Jeff Sharkey | b3f19ca | 2011-06-29 23:54:13 -0700 | [diff] [blame] | 264 | * Set quota for an interface. |
Ashish Sharma | 50fd36d | 2011-06-15 19:34:53 -0700 | [diff] [blame] | 265 | */ |
Jeff Sharkey | 41ff7ec | 2011-07-25 15:21:22 -0700 | [diff] [blame] | 266 | void setInterfaceQuota(String iface, long quotaBytes); |
Jeff Sharkey | b3f19ca | 2011-06-29 23:54:13 -0700 | [diff] [blame] | 267 | |
| 268 | /** |
| 269 | * Remove quota for an interface. |
| 270 | */ |
| 271 | void removeInterfaceQuota(String iface); |
Ashish Sharma | 50fd36d | 2011-06-15 19:34:53 -0700 | [diff] [blame] | 272 | |
| 273 | /** |
Jeff Sharkey | 41ff7ec | 2011-07-25 15:21:22 -0700 | [diff] [blame] | 274 | * Set alert for an interface; requires that iface already has quota. |
| 275 | */ |
| 276 | void setInterfaceAlert(String iface, long alertBytes); |
| 277 | |
| 278 | /** |
| 279 | * Remove alert for an interface. |
| 280 | */ |
| 281 | void removeInterfaceAlert(String iface); |
| 282 | |
| 283 | /** |
| 284 | * Set alert across all interfaces. |
| 285 | */ |
| 286 | void setGlobalAlert(long alertBytes); |
| 287 | |
| 288 | /** |
Ashish Sharma | 50fd36d | 2011-06-15 19:34:53 -0700 | [diff] [blame] | 289 | * Control network activity of a UID over interfaces with a quota limit. |
| 290 | */ |
| 291 | void setUidNetworkRules(int uid, boolean rejectOnQuotaInterfaces); |
| 292 | |
| 293 | /** |
Jeff Sharkey | 63d27a9 | 2011-08-03 17:04:22 -0700 | [diff] [blame] | 294 | * Return status of bandwidth control module. |
| 295 | */ |
| 296 | boolean isBandwidthControlEnabled(); |
| 297 | |
| 298 | /** |
Haoyu Bai | 0412423 | 2012-06-28 15:26:19 -0700 | [diff] [blame] | 299 | * Sets idletimer for an interface. |
| 300 | * |
| 301 | * This either initializes a new idletimer or increases its |
| 302 | * reference-counting if an idletimer already exists for given |
| 303 | * {@code iface}. |
| 304 | * |
| 305 | * {@code label} usually represents the network type of {@code iface}. |
| 306 | * Caller should ensure that {@code label} for an {@code iface} remains the |
| 307 | * same for all calls to addIdleTimer. |
| 308 | * |
| 309 | * Every {@code addIdleTimer} should be paired with a |
| 310 | * {@link removeIdleTimer} to cleanup when the network disconnects. |
| 311 | */ |
| 312 | void addIdleTimer(String iface, int timeout, String label); |
| 313 | |
| 314 | /** |
| 315 | * Removes idletimer for an interface. |
| 316 | */ |
| 317 | void removeIdleTimer(String iface); |
| 318 | |
| 319 | /** |
Mattias Falk | 7475c0c | 2011-04-04 16:10:36 +0200 | [diff] [blame] | 320 | * Sets the name of the default interface in the DNS resolver. |
| 321 | */ |
| 322 | void setDefaultInterfaceForDns(String iface); |
| 323 | |
| 324 | /** |
| 325 | * Bind name servers to an interface in the DNS resolver. |
| 326 | */ |
Robert Greenwalt | 8058f62 | 2012-11-09 10:52:27 -0800 | [diff] [blame] | 327 | void setDnsServersForInterface(String iface, in String[] servers, String domains); |
Mattias Falk | 7475c0c | 2011-04-04 16:10:36 +0200 | [diff] [blame] | 328 | |
| 329 | /** |
Robert Greenwalt | 572b704 | 2011-07-25 17:00:13 -0700 | [diff] [blame] | 330 | * Flush the DNS cache associated with the default interface. |
Mattias Falk | 7475c0c | 2011-04-04 16:10:36 +0200 | [diff] [blame] | 331 | */ |
| 332 | void flushDefaultDnsCache(); |
| 333 | |
| 334 | /** |
Robert Greenwalt | 572b704 | 2011-07-25 17:00:13 -0700 | [diff] [blame] | 335 | * Flush the DNS cache associated with the specified interface. |
Mattias Falk | 7475c0c | 2011-04-04 16:10:36 +0200 | [diff] [blame] | 336 | */ |
| 337 | void flushInterfaceDnsCache(String iface); |
Jeff Sharkey | c268f0b | 2012-08-24 10:25:31 -0700 | [diff] [blame] | 338 | |
| 339 | void setFirewallEnabled(boolean enabled); |
| 340 | boolean isFirewallEnabled(); |
Jeff Sharkey | 2c09298 | 2012-08-24 11:44:40 -0700 | [diff] [blame] | 341 | void setFirewallInterfaceRule(String iface, boolean allow); |
| 342 | void setFirewallEgressSourceRule(String addr, boolean allow); |
| 343 | void setFirewallEgressDestRule(String addr, int port, boolean allow); |
| 344 | void setFirewallUidRule(int uid, boolean allow); |
Mattias Falk | 8b47b36 | 2011-08-23 14:15:13 +0200 | [diff] [blame] | 345 | |
| 346 | /** |
| 347 | * Set a process (pid) to use the name servers associated with the specified interface. |
| 348 | */ |
| 349 | void setDnsInterfaceForPid(String iface, int pid); |
| 350 | |
| 351 | /** |
| 352 | * Clear a process (pid) from being associated with an interface. |
| 353 | */ |
| 354 | void clearDnsInterfaceForPid(int pid); |
Lorenzo Colitti | 7975184 | 2013-02-28 16:16:03 +0900 | [diff] [blame] | 355 | |
| 356 | /** |
| 357 | * Start the clatd (464xlat) service |
| 358 | */ |
| 359 | void startClatd(String interfaceName); |
| 360 | |
| 361 | /** |
| 362 | * Stop the clatd (464xlat) service |
| 363 | */ |
| 364 | void stopClatd(); |
| 365 | |
| 366 | /** |
| 367 | * Determine whether the clatd (464xlat) service has been started |
| 368 | */ |
| 369 | boolean isClatdStarted(); |
San Mehat | 873f214 | 2010-01-14 10:25:07 -0800 | [diff] [blame] | 370 | } |