INetworkManagementService.aidl revision e4a05afe85f15472325db9c535ef81f409fb6070
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     * Retrieves the network routes currently configured on the specified
96     * interface
97     */
98    RouteInfo[] getRoutes(String iface);
99
100    /**
101     * Add the specified route to the interface.
102     */
103    void addRoute(int netId, in RouteInfo route);
104
105    /**
106     * Remove the specified route from the interface.
107     */
108    void removeRoute(int netId, in RouteInfo route);
109
110    /**
111     * Set the specified MTU size
112     */
113    void setMtu(String iface, int mtu);
114
115    /**
116     * Shuts down the service
117     */
118    void shutdown();
119
120    /**
121     ** TETHERING RELATED
122     **/
123
124    /**
125     * Returns true if IP forwarding is enabled
126     */
127    boolean getIpForwardingEnabled();
128
129    /**
130     * Enables/Disables IP Forwarding
131     */
132    void setIpForwardingEnabled(boolean enabled);
133
134    /**
135     * Start tethering services with the specified dhcp server range
136     * arg is a set of start end pairs defining the ranges.
137     */
138    void startTethering(in String[] dhcpRanges);
139
140    /**
141     * Stop currently running tethering services
142     */
143    void stopTethering();
144
145    /**
146     * Returns true if tethering services are started
147     */
148    boolean isTetheringStarted();
149
150    /**
151     * Tethers the specified interface
152     */
153    void tetherInterface(String iface);
154
155    /**
156     * Untethers the specified interface
157     */
158    void untetherInterface(String iface);
159
160    /**
161     * Returns a list of currently tethered interfaces
162     */
163    String[] listTetheredInterfaces();
164
165    /**
166     * Sets the list of DNS forwarders (in order of priority)
167     */
168    void setDnsForwarders(in Network network, in String[] dns);
169
170    /**
171     * Returns the list of DNS forwarders (in order of priority)
172     */
173    String[] getDnsForwarders();
174
175    /**
176     *  Enables Network Address Translation between two interfaces.
177     *  The address and netmask of the external interface is used for
178     *  the NAT'ed network.
179     */
180    void enableNat(String internalInterface, String externalInterface);
181
182    /**
183     *  Disables Network Address Translation between two interfaces.
184     */
185    void disableNat(String internalInterface, String externalInterface);
186
187    /**
188     ** PPPD
189     **/
190
191    /**
192     * Returns the list of currently known TTY devices on the system
193     */
194    String[] listTtys();
195
196    /**
197     * Attaches a PPP server daemon to the specified TTY with the specified
198     * local/remote addresses.
199     */
200    void attachPppd(String tty, String localAddr, String remoteAddr, String dns1Addr,
201            String dns2Addr);
202
203    /**
204     * Detaches a PPP server daemon from the specified TTY.
205     */
206    void detachPppd(String tty);
207
208    /**
209     * Load firmware for operation in the given mode. Currently the three
210     * modes supported are "AP", "STA" and "P2P".
211     */
212    void wifiFirmwareReload(String wlanIface, String mode);
213
214    /**
215     * Start Wifi Access Point
216     */
217    void startAccessPoint(in WifiConfiguration wifiConfig, String iface);
218
219    /**
220     * Stop Wifi Access Point
221     */
222    void stopAccessPoint(String iface);
223
224    /**
225     * Set Access Point config
226     */
227    void setAccessPoint(in WifiConfiguration wifiConfig, String iface);
228
229    /**
230     ** DATA USAGE RELATED
231     **/
232
233    /**
234     * Return global network statistics summarized at an interface level,
235     * without any UID-level granularity.
236     */
237    NetworkStats getNetworkStatsSummaryDev();
238    NetworkStats getNetworkStatsSummaryXt();
239
240    /**
241     * Return detailed network statistics with UID-level granularity,
242     * including interface and tag details.
243     */
244    NetworkStats getNetworkStatsDetail();
245
246    /**
247     * Return detailed network statistics for the requested UID,
248     * including interface and tag details.
249     */
250    NetworkStats getNetworkStatsUidDetail(int uid);
251
252    /**
253     * Return summary of network statistics all tethering interfaces.
254     */
255    NetworkStats getNetworkStatsTethering();
256
257    /**
258     * Set quota for an interface.
259     */
260    void setInterfaceQuota(String iface, long quotaBytes);
261
262    /**
263     * Remove quota for an interface.
264     */
265    void removeInterfaceQuota(String iface);
266
267    /**
268     * Set alert for an interface; requires that iface already has quota.
269     */
270    void setInterfaceAlert(String iface, long alertBytes);
271
272    /**
273     * Remove alert for an interface.
274     */
275    void removeInterfaceAlert(String iface);
276
277    /**
278     * Set alert across all interfaces.
279     */
280    void setGlobalAlert(long alertBytes);
281
282    /**
283     * Control network activity of a UID over interfaces with a quota limit.
284     */
285    void setUidNetworkRules(int uid, boolean rejectOnQuotaInterfaces);
286
287    /**
288     * Return status of bandwidth control module.
289     */
290    boolean isBandwidthControlEnabled();
291
292    /**
293     * Sets idletimer for an interface.
294     *
295     * This either initializes a new idletimer or increases its
296     * reference-counting if an idletimer already exists for given
297     * {@code iface}.
298     *
299     * {@code type} is the type of the interface, such as TYPE_MOBILE.
300     *
301     * Every {@code addIdleTimer} should be paired with a
302     * {@link removeIdleTimer} to cleanup when the network disconnects.
303     */
304    void addIdleTimer(String iface, int timeout, int type);
305
306    /**
307     * Removes idletimer for an interface.
308     */
309    void removeIdleTimer(String iface);
310
311    /**
312     * Bind name servers to a network in the DNS resolver.
313     */
314    void setDnsServersForNetwork(int netId, in String[] servers, String domains);
315
316    /**
317     * Flush the DNS cache associated with the specified network.
318     */
319    void flushNetworkDnsCache(int netId);
320
321    void setFirewallEnabled(boolean enabled);
322    boolean isFirewallEnabled();
323    void setFirewallInterfaceRule(String iface, boolean allow);
324    void setFirewallEgressSourceRule(String addr, boolean allow);
325    void setFirewallEgressDestRule(String addr, int port, boolean allow);
326    void setFirewallUidRule(int uid, boolean allow);
327
328    /**
329     * Set all packets from users in ranges to go through VPN specified by netId.
330     */
331    void addVpnUidRanges(int netId, in UidRange[] ranges);
332
333    /**
334     * Clears the special VPN rules for users in ranges and VPN specified by netId.
335     */
336    void removeVpnUidRanges(int netId, in UidRange[] ranges);
337
338    /**
339     * Start the clatd (464xlat) service
340     */
341    void startClatd(String interfaceName);
342
343    /**
344     * Stop the clatd (464xlat) service
345     */
346    void stopClatd();
347
348    /**
349     * Determine whether the clatd (464xlat) service has been started
350     */
351    boolean isClatdStarted();
352
353    /**
354     * Start listening for mobile activity state changes.
355     */
356    void registerNetworkActivityListener(INetworkActivityListener listener);
357
358    /**
359     * Stop listening for mobile activity state changes.
360     */
361    void unregisterNetworkActivityListener(INetworkActivityListener listener);
362
363    /**
364     * Check whether the mobile radio is currently active.
365     */
366    boolean isNetworkActive();
367
368    /**
369     * Setup a new physical network.
370     */
371    void createPhysicalNetwork(int netId);
372
373    /**
374     * Setup a new VPN.
375     */
376    void createVirtualNetwork(int netId, boolean hasDNS, boolean secure);
377
378    /**
379     * Remove a network.
380     */
381    void removeNetwork(int netId);
382
383    /**
384     * Add an interface to a network.
385     */
386    void addInterfaceToNetwork(String iface, int netId);
387
388    /**
389     * Remove an Interface from a network.
390     */
391    void removeInterfaceFromNetwork(String iface, int netId);
392
393    void addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid);
394
395    void setDefaultNetId(int netId);
396    void clearDefaultNetId();
397
398    void setPermission(String permission, in int[] uids);
399    void clearPermission(in int[] uids);
400
401    /**
402     * Allow UID to call protect().
403     */
404    void allowProtect(int uid);
405
406    /**
407     * Deny UID from calling protect().
408     */
409    void denyProtect(int uid);
410
411    void addInterfaceToLocalNetwork(String iface, in List<RouteInfo> routes);
412    void removeInterfaceFromLocalNetwork(String iface);
413}
414