1 /* //device/java/android/android/os/INetworkManagementService.aidl
3 ** Copyright 2007, The Android Open Source Project
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
9 ** http://www.apache.org/licenses/LICENSE-2.0
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.
20 import android.net.InterfaceConfiguration;
21 import android.net.INetworkManagementEventObserver;
22 import android.net.Network;
23 import android.net.NetworkStats;
24 import android.net.RouteInfo;
25 import android.net.UidRange;
26 import android.net.wifi.WifiConfiguration;
27 import android.os.INetworkActivityListener;
32 interface INetworkManagementService
39 * Register an observer to receive events
41 void registerObserver(INetworkManagementEventObserver obs);
44 * Unregister an observer from receiving events.
46 void unregisterObserver(INetworkManagementEventObserver obs);
49 * Returns a list of currently known network interfaces
51 String[] listInterfaces();
54 * Retrieves the specified interface config
57 InterfaceConfiguration getInterfaceConfig(String iface);
60 * Sets the configuration of the specified interface
62 void setInterfaceConfig(String iface, in InterfaceConfiguration cfg);
65 * Clear all IP addresses on the specified interface
67 void clearInterfaceAddresses(String iface);
72 void setInterfaceDown(String iface);
77 void setInterfaceUp(String iface);
80 * Set interface IPv6 privacy extensions
82 void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable);
85 * Disable IPv6 on an interface
87 void disableIpv6(String iface);
90 * Enable IPv6 on an interface
92 void enableIpv6(String iface);
95 * Enables or enables IPv6 ND offload.
97 void setInterfaceIpv6NdOffload(String iface, boolean enable);
100 * Add the specified route to the interface.
102 void addRoute(int netId, in RouteInfo route);
105 * Remove the specified route from the interface.
107 void removeRoute(int netId, in RouteInfo route);
110 * Set the specified MTU size
112 void setMtu(String iface, int mtu);
115 * Shuts down the service
124 * Returns true if IP forwarding is enabled
126 boolean getIpForwardingEnabled();
129 * Enables/Disables IP Forwarding
131 void setIpForwardingEnabled(boolean enabled);
134 * Start tethering services with the specified dhcp server range
135 * arg is a set of start end pairs defining the ranges.
137 void startTethering(in String[] dhcpRanges);
140 * Stop currently running tethering services
142 void stopTethering();
145 * Returns true if tethering services are started
147 boolean isTetheringStarted();
150 * Tethers the specified interface
152 void tetherInterface(String iface);
155 * Untethers the specified interface
157 void untetherInterface(String iface);
160 * Returns a list of currently tethered interfaces
162 String[] listTetheredInterfaces();
165 * Sets the list of DNS forwarders (in order of priority)
167 void setDnsForwarders(in Network network, in String[] dns);
170 * Returns the list of DNS forwarders (in order of priority)
172 String[] getDnsForwarders();
175 * Enables unidirectional packet forwarding from {@code fromIface} to
178 void startInterfaceForwarding(String fromIface, String toIface);
181 * Disables unidirectional packet forwarding from {@code fromIface} to
184 void stopInterfaceForwarding(String fromIface, String toIface);
187 * Enables Network Address Translation between two interfaces.
188 * The address and netmask of the external interface is used for
189 * the NAT'ed network.
191 void enableNat(String internalInterface, String externalInterface);
194 * Disables Network Address Translation between two interfaces.
196 void disableNat(String internalInterface, String externalInterface);
203 * Returns the list of currently known TTY devices on the system
208 * Attaches a PPP server daemon to the specified TTY with the specified
209 * local/remote addresses.
211 void attachPppd(String tty, String localAddr, String remoteAddr, String dns1Addr,
215 * Detaches a PPP server daemon from the specified TTY.
217 void detachPppd(String tty);
220 * Load firmware for operation in the given mode. Currently the three
221 * modes supported are "AP", "STA" and "P2P".
223 void wifiFirmwareReload(String wlanIface, String mode);
226 * Start Wifi Access Point
228 void startAccessPoint(in WifiConfiguration wifiConfig, String iface);
231 * Stop Wifi Access Point
233 void stopAccessPoint(String iface);
236 * Set Access Point config
238 void setAccessPoint(in WifiConfiguration wifiConfig, String iface);
241 ** DATA USAGE RELATED
245 * Return global network statistics summarized at an interface level,
246 * without any UID-level granularity.
248 NetworkStats getNetworkStatsSummaryDev();
249 NetworkStats getNetworkStatsSummaryXt();
252 * Return detailed network statistics with UID-level granularity,
253 * including interface and tag details.
255 NetworkStats getNetworkStatsDetail();
258 * Return detailed network statistics for the requested UID,
259 * including interface and tag details.
261 NetworkStats getNetworkStatsUidDetail(int uid);
264 * Return summary of network statistics all tethering interfaces.
266 NetworkStats getNetworkStatsTethering();
269 * Set quota for an interface.
271 void setInterfaceQuota(String iface, long quotaBytes);
274 * Remove quota for an interface.
276 void removeInterfaceQuota(String iface);
279 * Set alert for an interface; requires that iface already has quota.
281 void setInterfaceAlert(String iface, long alertBytes);
284 * Remove alert for an interface.
286 void removeInterfaceAlert(String iface);
289 * Set alert across all interfaces.
291 void setGlobalAlert(long alertBytes);
294 * Control network activity of a UID over interfaces with a quota limit.
296 void setUidMeteredNetworkBlacklist(int uid, boolean enable);
297 void setUidMeteredNetworkWhitelist(int uid, boolean enable);
298 boolean setDataSaverModeEnabled(boolean enable);
300 void setUidCleartextNetworkPolicy(int uid, int policy);
303 * Return status of bandwidth control module.
305 boolean isBandwidthControlEnabled();
308 * Sets idletimer for an interface.
310 * This either initializes a new idletimer or increases its
311 * reference-counting if an idletimer already exists for given
314 * {@code type} is the type of the interface, such as TYPE_MOBILE.
316 * Every {@code addIdleTimer} should be paired with a
317 * {@link removeIdleTimer} to cleanup when the network disconnects.
319 void addIdleTimer(String iface, int timeout, int type);
322 * Removes idletimer for an interface.
324 void removeIdleTimer(String iface);
327 * Configure name servers, search paths, and resolver parameters for the given network.
329 void setDnsConfigurationForNetwork(int netId, in String[] servers, String domains);
332 * Bind name servers to a network in the DNS resolver.
334 void setDnsServersForNetwork(int netId, in String[] servers, String domains);
336 void setFirewallEnabled(boolean enabled);
337 boolean isFirewallEnabled();
338 void setFirewallInterfaceRule(String iface, boolean allow);
339 void setFirewallEgressSourceRule(String addr, boolean allow);
340 void setFirewallEgressDestRule(String addr, int port, boolean allow);
341 void setFirewallUidRule(int chain, int uid, int rule);
342 void setFirewallUidRules(int chain, in int[] uids, in int[] rules);
343 void setFirewallChainEnabled(int chain, boolean enable);
346 * Set all packets from users in ranges to go through VPN specified by netId.
348 void addVpnUidRanges(int netId, in UidRange[] ranges);
351 * Clears the special VPN rules for users in ranges and VPN specified by netId.
353 void removeVpnUidRanges(int netId, in UidRange[] ranges);
356 * Start the clatd (464xlat) service on the given interface.
358 void startClatd(String interfaceName);
361 * Stop the clatd (464xlat) service on the given interface.
363 void stopClatd(String interfaceName);
366 * Determine whether the clatd (464xlat) service has been started on the given interface.
368 boolean isClatdStarted(String interfaceName);
371 * Start listening for mobile activity state changes.
373 void registerNetworkActivityListener(INetworkActivityListener listener);
376 * Stop listening for mobile activity state changes.
378 void unregisterNetworkActivityListener(INetworkActivityListener listener);
381 * Check whether the mobile radio is currently active.
383 boolean isNetworkActive();
386 * Setup a new physical network.
387 * @param permission null if no permissions required to access this network. PERMISSION_NETWORK
388 * or PERMISSION_SYSTEM to set respective permission.
390 void createPhysicalNetwork(int netId, String permission);
395 void createVirtualNetwork(int netId, boolean hasDNS, boolean secure);
400 void removeNetwork(int netId);
403 * Add an interface to a network.
405 void addInterfaceToNetwork(String iface, int netId);
408 * Remove an Interface from a network.
410 void removeInterfaceFromNetwork(String iface, int netId);
412 void addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid);
414 void setDefaultNetId(int netId);
415 void clearDefaultNetId();
418 * Set permission for a network.
419 * @param permission null to clear permissions. PERMISSION_NETWORK or PERMISSION_SYSTEM to set
422 void setNetworkPermission(int netId, String permission);
424 void setPermission(String permission, in int[] uids);
425 void clearPermission(in int[] uids);
428 * Allow UID to call protect().
430 void allowProtect(int uid);
433 * Deny UID from calling protect().
435 void denyProtect(int uid);
437 void addInterfaceToLocalNetwork(String iface, in List<RouteInfo> routes);
438 void removeInterfaceFromLocalNetwork(String iface);
440 void setAllowOnlyVpnForUids(boolean enable, in UidRange[] uidRanges);