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 20 import android.net.InterfaceConfiguration; 21 import android.net.INetworkManagementEventObserver; 22 import android.net.NetworkStats; 23 import android.net.RouteInfo; 24 import android.net.wifi.WifiConfiguration; 25 26 /** 27 * @hide 28 */ 29 interface INetworkManagementService 30 { 31 /** 32 ** GENERAL 33 **/ 34 35 /** 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 /** 46 * Returns a list of currently known network interfaces 47 */ 48 String[] listInterfaces(); 49 50 /** 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 /** 62 * Clear all IP addresses on the specified interface 63 */ 64 void clearInterfaceAddresses(String iface); 65 66 /** 67 * Set interface down 68 */ 69 void setInterfaceDown(String iface); 70 71 /** 72 * Set interface up 73 */ 74 void setInterfaceUp(String iface); 75 76 /** 77 * Set interface IPv6 privacy extensions 78 */ 79 void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable); 80 81 /** 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 /** 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 /** 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 /** 120 * Shuts down the service 121 */ 122 void shutdown(); 123 124 /** 125 ** TETHERING RELATED 126 **/ 127 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 140 * arg is a set of start end pairs defining the ranges. 141 */ 142 void startTethering(in String[] dhcpRanges); 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 * Start bluetooth reverse tethering services 156 */ 157 void startReverseTethering(in String iface); 158 159 /** 160 * Stop currently running bluetooth reserse tethering services 161 */ 162 void stopReverseTethering(); 163 164 /** 165 * Tethers the specified interface 166 */ 167 void tetherInterface(String iface); 168 169 /** 170 * Untethers the specified interface 171 */ 172 void untetherInterface(String iface); 173 174 /** 175 * Returns a list of currently tethered interfaces 176 */ 177 String[] listTetheredInterfaces(); 178 179 /** 180 * Sets the list of DNS forwarders (in order of priority) 181 */ 182 void setDnsForwarders(in String[] dns); 183 184 /** 185 * Returns the list of DNS fowarders (in order of priority) 186 */ 187 String[] getDnsForwarders(); 188 189 /** 190 * Enables Network Address Translation between two interfaces. 191 * The address and netmask of the external interface is used for 192 * the NAT'ed network. 193 */ 194 void enableNat(String internalInterface, String externalInterface); 195 196 /** 197 * Disables Network Address Translation between two interfaces. 198 */ 199 void disableNat(String internalInterface, String externalInterface); 200 201 /** 202 ** PPPD 203 **/ 204 205 /** 206 * Returns the list of currently known TTY devices on the system 207 */ 208 String[] listTtys(); 209 210 /** 211 * Attaches a PPP server daemon to the specified TTY with the specified 212 * local/remote addresses. 213 */ 214 void attachPppd(String tty, String localAddr, String remoteAddr, String dns1Addr, 215 String dns2Addr); 216 217 /** 218 * Detaches a PPP server daemon from the specified TTY. 219 */ 220 void detachPppd(String tty); 221 222 /** 223 * Load firmware for operation in the given mode. Currently the three 224 * modes supported are "AP", "STA" and "P2P". 225 */ 226 void wifiFirmwareReload(String wlanIface, String mode); 227 228 /** 229 * Start Wifi Access Point 230 */ 231 void startAccessPoint(in WifiConfiguration wifiConfig, String iface); 232 233 /** 234 * Stop Wifi Access Point 235 */ 236 void stopAccessPoint(String iface); 237 238 /** 239 * Set Access Point config 240 */ 241 void setAccessPoint(in WifiConfiguration wifiConfig, String iface); 242 243 /** 244 ** DATA USAGE RELATED 245 **/ 246 247 /** 248 * Return global network statistics summarized at an interface level, 249 * without any UID-level granularity. 250 */ 251 NetworkStats getNetworkStatsSummaryDev(); 252 NetworkStats getNetworkStatsSummaryXt(); 253 254 /** 255 * Return detailed network statistics with UID-level granularity, 256 * including interface and tag details. 257 */ 258 NetworkStats getNetworkStatsDetail(); 259 260 /** 261 * Return detailed network statistics for the requested UID, 262 * including interface and tag details. 263 */ 264 NetworkStats getNetworkStatsUidDetail(int uid); 265 266 /** 267 * Return summary of network statistics for the requested pairs of 268 * tethering interfaces. Even indexes are remote interface, and odd 269 * indexes are corresponding local interfaces. 270 */ 271 NetworkStats getNetworkStatsTethering(in String[] ifacePairs); 272 273 /** 274 * Set quota for an interface. 275 */ 276 void setInterfaceQuota(String iface, long quotaBytes); 277 278 /** 279 * Remove quota for an interface. 280 */ 281 void removeInterfaceQuota(String iface); 282 283 /** 284 * Set alert for an interface; requires that iface already has quota. 285 */ 286 void setInterfaceAlert(String iface, long alertBytes); 287 288 /** 289 * Remove alert for an interface. 290 */ 291 void removeInterfaceAlert(String iface); 292 293 /** 294 * Set alert across all interfaces. 295 */ 296 void setGlobalAlert(long alertBytes); 297 298 /** 299 * Control network activity of a UID over interfaces with a quota limit. 300 */ 301 void setUidNetworkRules(int uid, boolean rejectOnQuotaInterfaces); 302 303 /** 304 * Return status of bandwidth control module. 305 */ 306 boolean isBandwidthControlEnabled(); 307 308 /** 309 * Configures bandwidth throttling on an interface. 310 */ 311 void setInterfaceThrottle(String iface, int rxKbps, int txKbps); 312 313 /** 314 * Returns the currently configured RX throttle values 315 * for the specified interface 316 */ 317 int getInterfaceRxThrottle(String iface); 318 319 /** 320 * Returns the currently configured TX throttle values 321 * for the specified interface 322 */ 323 int getInterfaceTxThrottle(String iface); 324 325 /** 326 * Sets idletimer for an interface. 327 * 328 * This either initializes a new idletimer or increases its 329 * reference-counting if an idletimer already exists for given 330 * {@code iface}. 331 * 332 * {@code label} usually represents the network type of {@code iface}. 333 * Caller should ensure that {@code label} for an {@code iface} remains the 334 * same for all calls to addIdleTimer. 335 * 336 * Every {@code addIdleTimer} should be paired with a 337 * {@link removeIdleTimer} to cleanup when the network disconnects. 338 */ 339 void addIdleTimer(String iface, int timeout, String label); 340 341 /** 342 * Removes idletimer for an interface. 343 */ 344 void removeIdleTimer(String iface); 345 346 /** 347 * Sets the name of the default interface in the DNS resolver. 348 */ 349 void setDefaultInterfaceForDns(String iface); 350 351 /** 352 * Bind name servers to an interface in the DNS resolver. 353 */ 354 void setDnsServersForInterface(String iface, in String[] servers); 355 356 /** 357 * Flush the DNS cache associated with the default interface. 358 */ 359 void flushDefaultDnsCache(); 360 361 /** 362 * Flush the DNS cache associated with the specified interface. 363 */ 364 void flushInterfaceDnsCache(String iface); 365 366 void setFirewallEnabled(boolean enabled); 367 boolean isFirewallEnabled(); 368 void setFirewallInterfaceRule(String iface, boolean allow); 369 void setFirewallEgressSourceRule(String addr, boolean allow); 370 void setFirewallEgressDestRule(String addr, int port, boolean allow); 371 void setFirewallUidRule(int uid, boolean allow); 372 } 373