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