INetworkManagementService.aidl revision 17e6183b85ba3038acb935aaa01415058b2e6ddd
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.Network;
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     * Enables or enables IPv6 ND offload.
96     */
97    void setInterfaceIpv6NdOffload(String iface, boolean enable);
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 Network network, in String[] dns);
168
169    /**
170     * Returns the list of DNS forwarders (in order of priority)
171     */
172    String[] getDnsForwarders();
173
174    /**
175     * Enables unidirectional packet forwarding from {@code fromIface} to
176     * {@code toIface}.
177     */
178    void startInterfaceForwarding(String fromIface, String toIface);
179
180    /**
181     * Disables unidirectional packet forwarding from {@code fromIface} to
182     * {@code toIface}.
183     */
184    void stopInterfaceForwarding(String fromIface, String toIface);
185
186    /**
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.
190     */
191    void enableNat(String internalInterface, String externalInterface);
192
193    /**
194     *  Disables Network Address Translation between two interfaces.
195     */
196    void disableNat(String internalInterface, String externalInterface);
197
198    /**
199     ** PPPD
200     **/
201
202    /**
203     * Returns the list of currently known TTY devices on the system
204     */
205    String[] listTtys();
206
207    /**
208     * Attaches a PPP server daemon to the specified TTY with the specified
209     * local/remote addresses.
210     */
211    void attachPppd(String tty, String localAddr, String remoteAddr, String dns1Addr,
212            String dns2Addr);
213
214    /**
215     * Detaches a PPP server daemon from the specified TTY.
216     */
217    void detachPppd(String tty);
218
219    /**
220     * Load firmware for operation in the given mode. Currently the three
221     * modes supported are "AP", "STA" and "P2P".
222     */
223    void wifiFirmwareReload(String wlanIface, String mode);
224
225    /**
226     * Start Wifi Access Point
227     */
228    void startAccessPoint(in WifiConfiguration wifiConfig, String iface);
229
230    /**
231     * Stop Wifi Access Point
232     */
233    void stopAccessPoint(String iface);
234
235    /**
236     * Set Access Point config
237     */
238    void setAccessPoint(in WifiConfiguration wifiConfig, String iface);
239
240    /**
241     ** DATA USAGE RELATED
242     **/
243
244    /**
245     * Return global network statistics summarized at an interface level,
246     * without any UID-level granularity.
247     */
248    NetworkStats getNetworkStatsSummaryDev();
249    NetworkStats getNetworkStatsSummaryXt();
250
251    /**
252     * Return detailed network statistics with UID-level granularity,
253     * including interface and tag details.
254     */
255    NetworkStats getNetworkStatsDetail();
256
257    /**
258     * Return detailed network statistics for the requested UID,
259     * including interface and tag details.
260     */
261    NetworkStats getNetworkStatsUidDetail(int uid);
262
263    /**
264     * Return summary of network statistics all tethering interfaces.
265     */
266    NetworkStats getNetworkStatsTethering();
267
268    /**
269     * Set quota for an interface.
270     */
271    void setInterfaceQuota(String iface, long quotaBytes);
272
273    /**
274     * Remove quota for an interface.
275     */
276    void removeInterfaceQuota(String iface);
277
278    /**
279     * Set alert for an interface; requires that iface already has quota.
280     */
281    void setInterfaceAlert(String iface, long alertBytes);
282
283    /**
284     * Remove alert for an interface.
285     */
286    void removeInterfaceAlert(String iface);
287
288    /**
289     * Set alert across all interfaces.
290     */
291    void setGlobalAlert(long alertBytes);
292
293    /**
294     * Control network activity of a UID over interfaces with a quota limit.
295     */
296    void setUidMeteredNetworkBlacklist(int uid, boolean enable);
297    void setUidMeteredNetworkWhitelist(int uid, boolean enable);
298    boolean setDataSaverModeEnabled(boolean enable);
299
300    void setUidCleartextNetworkPolicy(int uid, int policy);
301
302    /**
303     * Return status of bandwidth control module.
304     */
305    boolean isBandwidthControlEnabled();
306
307    /**
308     * Sets idletimer for an interface.
309     *
310     * This either initializes a new idletimer or increases its
311     * reference-counting if an idletimer already exists for given
312     * {@code iface}.
313     *
314     * {@code type} is the type of the interface, such as TYPE_MOBILE.
315     *
316     * Every {@code addIdleTimer} should be paired with a
317     * {@link removeIdleTimer} to cleanup when the network disconnects.
318     */
319    void addIdleTimer(String iface, int timeout, int type);
320
321    /**
322     * Removes idletimer for an interface.
323     */
324    void removeIdleTimer(String iface);
325
326    /**
327     * Configure name servers, search paths, and resolver parameters for the given network.
328     */
329    void setDnsConfigurationForNetwork(int netId, in String[] servers, String domains);
330
331    /**
332     * Bind name servers to a network in the DNS resolver.
333     */
334    void setDnsServersForNetwork(int netId, in String[] servers, String domains);
335
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);
344
345    /**
346     * Set all packets from users in ranges to go through VPN specified by netId.
347     */
348    void addVpnUidRanges(int netId, in UidRange[] ranges);
349
350    /**
351     * Clears the special VPN rules for users in ranges and VPN specified by netId.
352     */
353    void removeVpnUidRanges(int netId, in UidRange[] ranges);
354
355    /**
356     * Start the clatd (464xlat) service on the given interface.
357     */
358    void startClatd(String interfaceName);
359
360    /**
361     * Stop the clatd (464xlat) service on the given interface.
362     */
363    void stopClatd(String interfaceName);
364
365    /**
366     * Determine whether the clatd (464xlat) service has been started on the given interface.
367     */
368    boolean isClatdStarted(String interfaceName);
369
370    /**
371     * Start listening for mobile activity state changes.
372     */
373    void registerNetworkActivityListener(INetworkActivityListener listener);
374
375    /**
376     * Stop listening for mobile activity state changes.
377     */
378    void unregisterNetworkActivityListener(INetworkActivityListener listener);
379
380    /**
381     * Check whether the mobile radio is currently active.
382     */
383    boolean isNetworkActive();
384
385    /**
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.
389     */
390    void createPhysicalNetwork(int netId, String permission);
391
392    /**
393     * Setup a new VPN.
394     */
395    void createVirtualNetwork(int netId, boolean hasDNS, boolean secure);
396
397    /**
398     * Remove a network.
399     */
400    void removeNetwork(int netId);
401
402    /**
403     * Add an interface to a network.
404     */
405    void addInterfaceToNetwork(String iface, int netId);
406
407    /**
408     * Remove an Interface from a network.
409     */
410    void removeInterfaceFromNetwork(String iface, int netId);
411
412    void addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid);
413
414    void setDefaultNetId(int netId);
415    void clearDefaultNetId();
416
417    /**
418     * Set permission for a network.
419     * @param permission null to clear permissions. PERMISSION_NETWORK or PERMISSION_SYSTEM to set
420     *                   permission.
421     */
422    void setNetworkPermission(int netId, String permission);
423
424    void setPermission(String permission, in int[] uids);
425    void clearPermission(in int[] uids);
426
427    /**
428     * Allow UID to call protect().
429     */
430    void allowProtect(int uid);
431
432    /**
433     * Deny UID from calling protect().
434     */
435    void denyProtect(int uid);
436
437    void addInterfaceToLocalNetwork(String iface, in List<RouteInfo> routes);
438    void removeInterfaceFromLocalNetwork(String iface);
439
440    void setAllowOnlyVpnForUids(boolean enable, in UidRange[] uidRanges);
441}
442