INetworkManagementService.aidl revision f336d722c773855402d91a227fc290eafca23335
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.LinkAddress;
23import android.net.NetworkStats;
24import android.net.RouteInfo;
25import android.net.wifi.WifiConfiguration;
26
27/**
28 * @hide
29 */
30interface INetworkManagementService
31{
32    /**
33     ** GENERAL
34     **/
35
36    /**
37     * Register an observer to receive events
38     */
39    void registerObserver(INetworkManagementEventObserver obs);
40
41    /**
42     * Unregister an observer from receiving events.
43     */
44    void unregisterObserver(INetworkManagementEventObserver obs);
45
46    /**
47     * Returns a list of currently known network interfaces
48     */
49    String[] listInterfaces();
50
51    /**
52     * Retrieves the specified interface config
53     *
54     */
55    InterfaceConfiguration getInterfaceConfig(String iface);
56
57    /**
58     * Sets the configuration of the specified interface
59     */
60    void setInterfaceConfig(String iface, in InterfaceConfiguration cfg);
61
62    /**
63     * Clear all IP addresses on the specified interface
64     */
65    void clearInterfaceAddresses(String iface);
66
67    /**
68     * Set interface down
69     */
70    void setInterfaceDown(String iface);
71
72    /**
73     * Set interface up
74     */
75    void setInterfaceUp(String iface);
76
77    /**
78     * Set interface IPv6 privacy extensions
79     */
80    void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable);
81
82    /**
83     * Disable IPv6 on an interface
84     */
85    void disableIpv6(String iface);
86
87    /**
88     * Enable IPv6 on an interface
89     */
90    void enableIpv6(String iface);
91
92    /**
93     * Retrieves the network routes currently configured on the specified
94     * interface
95     */
96    RouteInfo[] getRoutes(String iface);
97
98    /**
99     * Add the specified route to the interface.
100     */
101    void addRoute(String iface, in RouteInfo route);
102
103    /**
104     * Remove the specified route from the interface.
105     */
106    void removeRoute(String iface, in RouteInfo route);
107
108    /**
109     * Add the specified route to a secondary interface
110     * This will go into a special route table to be accessed
111     * via ip rules
112     */
113    void addSecondaryRoute(String iface, in RouteInfo route);
114
115    /**
116     * Remove the specified secondary route.
117     */
118    void removeSecondaryRoute(String iface, in RouteInfo route);
119
120    /**
121     * Shuts down the service
122     */
123    void shutdown();
124
125    /**
126     ** TETHERING RELATED
127     **/
128
129    /**
130     * Returns true if IP forwarding is enabled
131     */
132    boolean getIpForwardingEnabled();
133
134    /**
135     * Enables/Disables IP Forwarding
136     */
137    void setIpForwardingEnabled(boolean enabled);
138
139    /**
140     * Start tethering services with the specified dhcp server range
141     * arg is a set of start end pairs defining the ranges.
142     */
143    void startTethering(in String[] dhcpRanges);
144
145    /**
146     * Stop currently running tethering services
147     */
148    void stopTethering();
149
150    /**
151     * Returns true if tethering services are started
152     */
153    boolean isTetheringStarted();
154
155    /**
156     * Tethers the specified interface
157     */
158    void tetherInterface(String iface);
159
160    /**
161     * Untethers the specified interface
162     */
163    void untetherInterface(String iface);
164
165    /**
166     * Returns a list of currently tethered interfaces
167     */
168    String[] listTetheredInterfaces();
169
170    /**
171     * Sets the list of DNS forwarders (in order of priority)
172     */
173    void setDnsForwarders(in String[] dns);
174
175    /**
176     * Returns the list of DNS fowarders (in order of priority)
177     */
178    String[] getDnsForwarders();
179
180    /**
181     *  Enables Network Address Translation between two interfaces.
182     *  The address and netmask of the external interface is used for
183     *  the NAT'ed network.
184     */
185    void enableNat(String internalInterface, String externalInterface);
186
187    /**
188     *  Disables Network Address Translation between two interfaces.
189     */
190    void disableNat(String internalInterface, String externalInterface);
191
192    /**
193     ** PPPD
194     **/
195
196    /**
197     * Returns the list of currently known TTY devices on the system
198     */
199    String[] listTtys();
200
201    /**
202     * Attaches a PPP server daemon to the specified TTY with the specified
203     * local/remote addresses.
204     */
205    void attachPppd(String tty, String localAddr, String remoteAddr, String dns1Addr,
206            String dns2Addr);
207
208    /**
209     * Detaches a PPP server daemon from the specified TTY.
210     */
211    void detachPppd(String tty);
212
213    /**
214     * Load firmware for operation in the given mode. Currently the three
215     * modes supported are "AP", "STA" and "P2P".
216     */
217    void wifiFirmwareReload(String wlanIface, String mode);
218
219    /**
220     * Start Wifi Access Point
221     */
222    void startAccessPoint(in WifiConfiguration wifiConfig, String iface);
223
224    /**
225     * Stop Wifi Access Point
226     */
227    void stopAccessPoint(String iface);
228
229    /**
230     * Set Access Point config
231     */
232    void setAccessPoint(in WifiConfiguration wifiConfig, String iface);
233
234    /**
235     ** DATA USAGE RELATED
236     **/
237
238    /**
239     * Return global network statistics summarized at an interface level,
240     * without any UID-level granularity.
241     */
242    NetworkStats getNetworkStatsSummaryDev();
243    NetworkStats getNetworkStatsSummaryXt();
244
245    /**
246     * Return detailed network statistics with UID-level granularity,
247     * including interface and tag details.
248     */
249    NetworkStats getNetworkStatsDetail();
250
251    /**
252     * Return detailed network statistics for the requested UID,
253     * including interface and tag details.
254     */
255    NetworkStats getNetworkStatsUidDetail(int uid);
256
257    /**
258     * Return summary of network statistics for the requested pairs of
259     * tethering interfaces.  Even indexes are remote interface, and odd
260     * indexes are corresponding local interfaces.
261     */
262    NetworkStats getNetworkStatsTethering(in String[] ifacePairs);
263
264    /**
265     * Set quota for an interface.
266     */
267    void setInterfaceQuota(String iface, long quotaBytes);
268
269    /**
270     * Remove quota for an interface.
271     */
272    void removeInterfaceQuota(String iface);
273
274    /**
275     * Set alert for an interface; requires that iface already has quota.
276     */
277    void setInterfaceAlert(String iface, long alertBytes);
278
279    /**
280     * Remove alert for an interface.
281     */
282    void removeInterfaceAlert(String iface);
283
284    /**
285     * Set alert across all interfaces.
286     */
287    void setGlobalAlert(long alertBytes);
288
289    /**
290     * Control network activity of a UID over interfaces with a quota limit.
291     */
292    void setUidNetworkRules(int uid, boolean rejectOnQuotaInterfaces);
293
294    /**
295     * Return status of bandwidth control module.
296     */
297    boolean isBandwidthControlEnabled();
298
299    /**
300     * Sets idletimer for an interface.
301     *
302     * This either initializes a new idletimer or increases its
303     * reference-counting if an idletimer already exists for given
304     * {@code iface}.
305     *
306     * {@code label} usually represents the network type of {@code iface}.
307     * Caller should ensure that {@code label} for an {@code iface} remains the
308     * same for all calls to addIdleTimer.
309     *
310     * Every {@code addIdleTimer} should be paired with a
311     * {@link removeIdleTimer} to cleanup when the network disconnects.
312     */
313    void addIdleTimer(String iface, int timeout, String label);
314
315    /**
316     * Removes idletimer for an interface.
317     */
318    void removeIdleTimer(String iface);
319
320    /**
321     * Sets the name of the default interface in the DNS resolver.
322     */
323    void setDefaultInterfaceForDns(String iface);
324
325    /**
326     * Bind name servers to an interface in the DNS resolver.
327     */
328    void setDnsServersForInterface(String iface, in String[] servers, String domains);
329
330    /**
331     * Flush the DNS cache associated with the default interface.
332     */
333    void flushDefaultDnsCache();
334
335    /**
336     * Flush the DNS cache associated with the specified interface.
337     */
338    void flushInterfaceDnsCache(String iface);
339
340    void setFirewallEnabled(boolean enabled);
341    boolean isFirewallEnabled();
342    void setFirewallInterfaceRule(String iface, boolean allow);
343    void setFirewallEgressSourceRule(String addr, boolean allow);
344    void setFirewallEgressDestRule(String addr, int port, boolean allow);
345    void setFirewallUidRule(int uid, boolean allow);
346
347    /**
348     * Set all packets from users [uid_start,uid_end] to go through interface iface
349     * iface must already be set for marked forwarding by {@link setMarkedForwarding}
350     */
351    void setUidRangeRoute(String iface, int uid_start, int uid_end);
352
353    /**
354     * Clears the special routing rules for users [uid_start,uid_end]
355     */
356    void clearUidRangeRoute(String iface, int uid_start, int uid_end);
357
358    /**
359     * Setup an interface for routing packets marked by {@link setUidRangeRoute}
360     *
361     * This sets up a dedicated routing table for packets marked for {@code iface} and adds
362     * source-NAT rules so that the marked packets have the correct source address.
363     */
364    void setMarkedForwarding(String iface);
365
366    /**
367     * Removes marked forwarding for an interface
368     */
369    void clearMarkedForwarding(String iface);
370
371    /**
372     * Get the SO_MARK associated with routing packets for user {@code uid}
373     */
374    int getMarkForUid(int uid);
375
376    /**
377     * Get the SO_MARK associated with protecting packets from VPN routing rules
378     */
379    int getMarkForProtect();
380
381    /**
382     * Route all traffic in {@code route} to {@code iface} setup for marked forwarding
383     */
384    void setMarkedForwardingRoute(String iface, in RouteInfo route);
385
386    /**
387     * Clear routes set by {@link setMarkedForwardingRoute}
388     */
389    void clearMarkedForwardingRoute(String iface, in RouteInfo route);
390
391    /**
392     * Exempts {@code host} from the routing set up by {@link setMarkedForwardingRoute}
393     * All connects to {@code host} will use the global routing table
394     */
395    void setHostExemption(in LinkAddress host);
396
397    /**
398     * Clears an exemption set by {@link setHostExemption}
399     */
400    void clearHostExemption(in LinkAddress host);
401
402    /**
403     * Set a process (pid) to use the name servers associated with the specified interface.
404     */
405    void setDnsInterfaceForPid(String iface, int pid);
406
407    /**
408     * Clear a process (pid) from being associated with an interface.
409     */
410    void clearDnsInterfaceForPid(int pid);
411
412    /**
413    * Set a range of user ids to use the name servers associated with the specified interface.
414    */
415    void setDnsInterfaceForUidRange(String iface, int uid_start, int uid_end);
416
417    /**
418    * Clear a user range from being associated with an interface.
419    */
420    void clearDnsInterfaceForUidRange(int uid_start, int uid_end);
421
422    /**
423    * Clear the mappings from pid to Dns interface and from uid range to Dns interface.
424    */
425    void clearDnsInterfaceMaps();
426
427    /**
428     * Start the clatd (464xlat) service
429     */
430    void startClatd(String interfaceName);
431
432    /**
433     * Stop the clatd (464xlat) service
434     */
435    void stopClatd();
436
437    /**
438     * Determine whether the clatd (464xlat) service has been started
439     */
440    boolean isClatdStarted();
441}
442