INetworkManagementService.aidl revision 6bc2c2c34f2b23eae79ad733c97a691734055c4f
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 18package android.os; 19 20import android.net.InterfaceConfiguration; 21import android.net.INetworkManagementEventObserver; 22import android.net.LinkAddress; 23import android.net.NetworkStats; 24import android.net.RouteInfo; 25import android.net.UidRange; 26import android.net.wifi.WifiConfiguration; 27import android.os.INetworkActivityListener; 28 29/** 30 * @hide 31 */ 32interface INetworkManagementService 33{ 34 /** 35 ** GENERAL 36 **/ 37 38 /** 39 * Register an observer to receive events 40 */ 41 void registerObserver(INetworkManagementEventObserver obs); 42 43 /** 44 * Unregister an observer from receiving events. 45 */ 46 void unregisterObserver(INetworkManagementEventObserver obs); 47 48 /** 49 * Returns a list of currently known network interfaces 50 */ 51 String[] listInterfaces(); 52 53 /** 54 * Retrieves the specified interface config 55 * 56 */ 57 InterfaceConfiguration getInterfaceConfig(String iface); 58 59 /** 60 * Sets the configuration of the specified interface 61 */ 62 void setInterfaceConfig(String iface, in InterfaceConfiguration cfg); 63 64 /** 65 * Clear all IP addresses on the specified interface 66 */ 67 void clearInterfaceAddresses(String iface); 68 69 /** 70 * Set interface down 71 */ 72 void setInterfaceDown(String iface); 73 74 /** 75 * Set interface up 76 */ 77 void setInterfaceUp(String iface); 78 79 /** 80 * Set interface IPv6 privacy extensions 81 */ 82 void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable); 83 84 /** 85 * Disable IPv6 on an interface 86 */ 87 void disableIpv6(String iface); 88 89 /** 90 * Enable IPv6 on an interface 91 */ 92 void enableIpv6(String iface); 93 94 /** 95 * Retrieves the network routes currently configured on the specified 96 * interface 97 */ 98 RouteInfo[] getRoutes(String iface); 99 100 /** 101 * Add the specified route to the interface. 102 */ 103 void addRoute(int netId, in RouteInfo route); 104 105 /** 106 * Remove the specified route from the interface. 107 */ 108 void removeRoute(int netId, in RouteInfo route); 109 110 /** 111 * Set the specified MTU size 112 */ 113 void setMtu(String iface, int mtu); 114 115 /** 116 * Shuts down the service 117 */ 118 void shutdown(); 119 120 /** 121 ** TETHERING RELATED 122 **/ 123 124 /** 125 * Returns true if IP forwarding is enabled 126 */ 127 boolean getIpForwardingEnabled(); 128 129 /** 130 * Enables/Disables IP Forwarding 131 */ 132 void setIpForwardingEnabled(boolean enabled); 133 134 /** 135 * Start tethering services with the specified dhcp server range 136 * arg is a set of start end pairs defining the ranges. 137 */ 138 void startTethering(in String[] dhcpRanges); 139 140 /** 141 * Stop currently running tethering services 142 */ 143 void stopTethering(); 144 145 /** 146 * Returns true if tethering services are started 147 */ 148 boolean isTetheringStarted(); 149 150 /** 151 * Tethers the specified interface 152 */ 153 void tetherInterface(String iface); 154 155 /** 156 * Untethers the specified interface 157 */ 158 void untetherInterface(String iface); 159 160 /** 161 * Returns a list of currently tethered interfaces 162 */ 163 String[] listTetheredInterfaces(); 164 165 /** 166 * Sets the list of DNS forwarders (in order of priority) 167 */ 168 void setDnsForwarders(in String[] dns); 169 170 /** 171 * Returns the list of DNS fowarders (in order of priority) 172 */ 173 String[] getDnsForwarders(); 174 175 /** 176 * Enables Network Address Translation between two interfaces. 177 * The address and netmask of the external interface is used for 178 * the NAT'ed network. 179 */ 180 void enableNat(String internalInterface, String externalInterface); 181 182 /** 183 * Disables Network Address Translation between two interfaces. 184 */ 185 void disableNat(String internalInterface, String externalInterface); 186 187 /** 188 ** PPPD 189 **/ 190 191 /** 192 * Returns the list of currently known TTY devices on the system 193 */ 194 String[] listTtys(); 195 196 /** 197 * Attaches a PPP server daemon to the specified TTY with the specified 198 * local/remote addresses. 199 */ 200 void attachPppd(String tty, String localAddr, String remoteAddr, String dns1Addr, 201 String dns2Addr); 202 203 /** 204 * Detaches a PPP server daemon from the specified TTY. 205 */ 206 void detachPppd(String tty); 207 208 /** 209 * Load firmware for operation in the given mode. Currently the three 210 * modes supported are "AP", "STA" and "P2P". 211 */ 212 void wifiFirmwareReload(String wlanIface, String mode); 213 214 /** 215 * Start Wifi Access Point 216 */ 217 void startAccessPoint(in WifiConfiguration wifiConfig, String iface); 218 219 /** 220 * Stop Wifi Access Point 221 */ 222 void stopAccessPoint(String iface); 223 224 /** 225 * Set Access Point config 226 */ 227 void setAccessPoint(in WifiConfiguration wifiConfig, String iface); 228 229 /** 230 ** DATA USAGE RELATED 231 **/ 232 233 /** 234 * Return global network statistics summarized at an interface level, 235 * without any UID-level granularity. 236 */ 237 NetworkStats getNetworkStatsSummaryDev(); 238 NetworkStats getNetworkStatsSummaryXt(); 239 240 /** 241 * Return detailed network statistics with UID-level granularity, 242 * including interface and tag details. 243 */ 244 NetworkStats getNetworkStatsDetail(); 245 246 /** 247 * Return detailed network statistics for the requested UID, 248 * including interface and tag details. 249 */ 250 NetworkStats getNetworkStatsUidDetail(int uid); 251 252 /** 253 * Return summary of network statistics all tethering interfaces. 254 */ 255 NetworkStats getNetworkStatsTethering(); 256 257 /** 258 * Set quota for an interface. 259 */ 260 void setInterfaceQuota(String iface, long quotaBytes); 261 262 /** 263 * Remove quota for an interface. 264 */ 265 void removeInterfaceQuota(String iface); 266 267 /** 268 * Set alert for an interface; requires that iface already has quota. 269 */ 270 void setInterfaceAlert(String iface, long alertBytes); 271 272 /** 273 * Remove alert for an interface. 274 */ 275 void removeInterfaceAlert(String iface); 276 277 /** 278 * Set alert across all interfaces. 279 */ 280 void setGlobalAlert(long alertBytes); 281 282 /** 283 * Control network activity of a UID over interfaces with a quota limit. 284 */ 285 void setUidNetworkRules(int uid, boolean rejectOnQuotaInterfaces); 286 287 /** 288 * Return status of bandwidth control module. 289 */ 290 boolean isBandwidthControlEnabled(); 291 292 /** 293 * Sets idletimer for an interface. 294 * 295 * This either initializes a new idletimer or increases its 296 * reference-counting if an idletimer already exists for given 297 * {@code iface}. 298 * 299 * {@code type} is the type of the interface, such as TYPE_MOBILE. 300 * 301 * Every {@code addIdleTimer} should be paired with a 302 * {@link removeIdleTimer} to cleanup when the network disconnects. 303 */ 304 void addIdleTimer(String iface, int timeout, int type); 305 306 /** 307 * Removes idletimer for an interface. 308 */ 309 void removeIdleTimer(String iface); 310 311 /** 312 * Bind name servers to a network in the DNS resolver. 313 */ 314 void setDnsServersForNetwork(int netId, in String[] servers, String domains); 315 316 /** 317 * Flush the DNS cache associated with the specified network. 318 */ 319 void flushNetworkDnsCache(int netId); 320 321 void setFirewallEnabled(boolean enabled); 322 boolean isFirewallEnabled(); 323 void setFirewallInterfaceRule(String iface, boolean allow); 324 void setFirewallEgressSourceRule(String addr, boolean allow); 325 void setFirewallEgressDestRule(String addr, int port, boolean allow); 326 void setFirewallUidRule(int uid, boolean allow); 327 328 /** 329 * Set all packets from users in ranges to go through VPN specified by netId. 330 */ 331 void addVpnUidRanges(int netId, in UidRange[] ranges); 332 333 /** 334 * Clears the special VPN rules for users in ranges and VPN specified by netId. 335 */ 336 void removeVpnUidRanges(int netId, in UidRange[] ranges); 337 338 /** 339 * Get the SO_MARK associated with routing packets for user {@code uid} 340 */ 341 int getMarkForUid(int uid); 342 343 /** 344 * Get the SO_MARK associated with protecting packets from VPN routing rules 345 */ 346 int getMarkForProtect(); 347 348 /** 349 * Route all traffic in {@code route} to {@code iface} setup for marked forwarding 350 */ 351 void setMarkedForwardingRoute(String iface, in RouteInfo route); 352 353 /** 354 * Clear routes set by {@link setMarkedForwardingRoute} 355 */ 356 void clearMarkedForwardingRoute(String iface, in RouteInfo route); 357 358 /** 359 * Exempts {@code host} from the routing set up by {@link setMarkedForwardingRoute} 360 * All connects to {@code host} will use the global routing table 361 */ 362 void setHostExemption(in LinkAddress host); 363 364 /** 365 * Clears an exemption set by {@link setHostExemption} 366 */ 367 void clearHostExemption(in LinkAddress host); 368 369 /** 370 * Start the clatd (464xlat) service 371 */ 372 void startClatd(String interfaceName); 373 374 /** 375 * Stop the clatd (464xlat) service 376 */ 377 void stopClatd(); 378 379 /** 380 * Determine whether the clatd (464xlat) service has been started 381 */ 382 boolean isClatdStarted(); 383 384 /** 385 * Start listening for mobile activity state changes. 386 */ 387 void registerNetworkActivityListener(INetworkActivityListener listener); 388 389 /** 390 * Stop listening for mobile activity state changes. 391 */ 392 void unregisterNetworkActivityListener(INetworkActivityListener listener); 393 394 /** 395 * Check whether the mobile radio is currently active. 396 */ 397 boolean isNetworkActive(); 398 399 /** 400 * Setup a new physical network. 401 */ 402 void createPhysicalNetwork(int netId); 403 404 /** 405 * Setup a new VPN. 406 */ 407 void createVirtualNetwork(int netId, boolean hasDNS); 408 409 /** 410 * Remove a network. 411 */ 412 void removeNetwork(int netId); 413 414 /** 415 * Add an interface to a network. 416 */ 417 void addInterfaceToNetwork(String iface, int netId); 418 419 /** 420 * Remove an Interface from a network. 421 */ 422 void removeInterfaceFromNetwork(String iface, int netId); 423 424 void addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid); 425 void removeLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid); 426 427 void setDefaultNetId(int netId); 428 void clearDefaultNetId(); 429 430 void setPermission(boolean internal, boolean changeNetState, in int[] uids); 431 void clearPermission(in int[] uids); 432 433 /** 434 * Allow UID to call protect(). 435 */ 436 void allowProtect(int uid); 437 438 /** 439 * Deny UID from calling protect(). 440 */ 441 void denyProtect(int uid); 442} 443