INetworkManagementService.aidl revision 03666c705ddabe0e7c5869ab69c2ca8b964164e9
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.NetworkStats; 23import android.net.RouteInfo; 24import android.net.UidRange; 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 void setFirewallEnabled(boolean enabled); 316 boolean isFirewallEnabled(); 317 void setFirewallInterfaceRule(String iface, boolean allow); 318 void setFirewallEgressSourceRule(String addr, boolean allow); 319 void setFirewallEgressDestRule(String addr, int port, boolean allow); 320 void setFirewallUidRule(int uid, boolean allow); 321 322 /** 323 * Set all packets from users in ranges to go through VPN specified by netId. 324 */ 325 void addVpnUidRanges(int netId, in UidRange[] ranges); 326 327 /** 328 * Clears the special VPN rules for users in ranges and VPN specified by netId. 329 */ 330 void removeVpnUidRanges(int netId, in UidRange[] ranges); 331 332 /** 333 * Start the clatd (464xlat) service 334 */ 335 void startClatd(String interfaceName); 336 337 /** 338 * Stop the clatd (464xlat) service 339 */ 340 void stopClatd(); 341 342 /** 343 * Determine whether the clatd (464xlat) service has been started 344 */ 345 boolean isClatdStarted(); 346 347 /** 348 * Start listening for mobile activity state changes. 349 */ 350 void registerNetworkActivityListener(INetworkActivityListener listener); 351 352 /** 353 * Stop listening for mobile activity state changes. 354 */ 355 void unregisterNetworkActivityListener(INetworkActivityListener listener); 356 357 /** 358 * Check whether the mobile radio is currently active. 359 */ 360 boolean isNetworkActive(); 361 362 /** 363 * Setup a new physical network. 364 */ 365 void createPhysicalNetwork(int netId); 366 367 /** 368 * Setup a new VPN. 369 */ 370 void createVirtualNetwork(int netId, boolean hasDNS); 371 372 /** 373 * Remove a network. 374 */ 375 void removeNetwork(int netId); 376 377 /** 378 * Add an interface to a network. 379 */ 380 void addInterfaceToNetwork(String iface, int netId); 381 382 /** 383 * Remove an Interface from a network. 384 */ 385 void removeInterfaceFromNetwork(String iface, int netId); 386 387 void addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid); 388 389 void setDefaultNetId(int netId); 390 void clearDefaultNetId(); 391 392 void setPermission(boolean internal, boolean changeNetState, in int[] uids); 393 void clearPermission(in int[] uids); 394 395 /** 396 * Allow UID to call protect(). 397 */ 398 void allowProtect(int uid); 399 400 /** 401 * Deny UID from calling protect(). 402 */ 403 void denyProtect(int uid); 404 405 void addInterfaceToLocalNetwork(String iface, in List<RouteInfo> routes); 406 void removeInterfaceFromLocalNetwork(String iface); 407} 408