INetworkManagementService.aidl revision 9ba9c58e4a249456794fbfb9989f27bd846d067e
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;
26import android.os.INetworkActivityListener;
27
28/**
29 * @hide
30 */
31interface INetworkManagementService
32{
33    /**
34     ** GENERAL
35     **/
36
37    /**
38     * Register an observer to receive events
39     */
40    void registerObserver(INetworkManagementEventObserver obs);
41
42    /**
43     * Unregister an observer from receiving events.
44     */
45    void unregisterObserver(INetworkManagementEventObserver obs);
46
47    /**
48     * Returns a list of currently known network interfaces
49     */
50    String[] listInterfaces();
51
52    /**
53     * Retrieves the specified interface config
54     *
55     */
56    InterfaceConfiguration getInterfaceConfig(String iface);
57
58    /**
59     * Sets the configuration of the specified interface
60     */
61    void setInterfaceConfig(String iface, in InterfaceConfiguration cfg);
62
63    /**
64     * Clear all IP addresses on the specified interface
65     */
66    void clearInterfaceAddresses(String iface);
67
68    /**
69     * Set interface down
70     */
71    void setInterfaceDown(String iface);
72
73    /**
74     * Set interface up
75     */
76    void setInterfaceUp(String iface);
77
78    /**
79     * Set interface IPv6 privacy extensions
80     */
81    void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable);
82
83    /**
84     * Disable IPv6 on an interface
85     */
86    void disableIpv6(String iface);
87
88    /**
89     * Enable IPv6 on an interface
90     */
91    void enableIpv6(String iface);
92
93    /**
94     * Retrieves the network routes currently configured on the specified
95     * interface
96     */
97    RouteInfo[] getRoutes(String iface);
98
99    /**
100     * Add the specified route to the interface.
101     */
102    void addRoute(String iface, in RouteInfo route);
103
104    /**
105     * Remove the specified route from the interface.
106     */
107    void removeRoute(String iface, in RouteInfo route);
108
109    /**
110     * Add the specified route to a secondary interface
111     * This will go into a special route table to be accessed
112     * via ip rules
113     */
114    void addSecondaryRoute(String iface, in RouteInfo route);
115
116    /**
117     * Remove the specified secondary route.
118     */
119    void removeSecondaryRoute(String iface, in RouteInfo route);
120
121    /**
122     * Set the specified MTU size
123     */
124    void setMtu(String iface, int mtu);
125
126    /**
127     * Shuts down the service
128     */
129    void shutdown();
130
131    /**
132     ** TETHERING RELATED
133     **/
134
135    /**
136     * Returns true if IP forwarding is enabled
137     */
138    boolean getIpForwardingEnabled();
139
140    /**
141     * Enables/Disables IP Forwarding
142     */
143    void setIpForwardingEnabled(boolean enabled);
144
145    /**
146     * Start tethering services with the specified dhcp server range
147     * arg is a set of start end pairs defining the ranges.
148     */
149    void startTethering(in String[] dhcpRanges);
150
151    /**
152     * Stop currently running tethering services
153     */
154    void stopTethering();
155
156    /**
157     * Returns true if tethering services are started
158     */
159    boolean isTetheringStarted();
160
161    /**
162     * Tethers the specified interface
163     */
164    void tetherInterface(String iface);
165
166    /**
167     * Untethers the specified interface
168     */
169    void untetherInterface(String iface);
170
171    /**
172     * Returns a list of currently tethered interfaces
173     */
174    String[] listTetheredInterfaces();
175
176    /**
177     * Sets the list of DNS forwarders (in order of priority)
178     */
179    void setDnsForwarders(in String[] dns);
180
181    /**
182     * Returns the list of DNS fowarders (in order of priority)
183     */
184    String[] getDnsForwarders();
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 setUidNetworkRules(int uid, boolean rejectOnQuotaInterfaces);
297
298    /**
299     * Return status of bandwidth control module.
300     */
301    boolean isBandwidthControlEnabled();
302
303    /**
304     * Sets idletimer for an interface.
305     *
306     * This either initializes a new idletimer or increases its
307     * reference-counting if an idletimer already exists for given
308     * {@code iface}.
309     *
310     * {@code type} is the type of the interface, such as TYPE_MOBILE.
311     *
312     * Every {@code addIdleTimer} should be paired with a
313     * {@link removeIdleTimer} to cleanup when the network disconnects.
314     */
315    void addIdleTimer(String iface, int timeout, int type);
316
317    /**
318     * Removes idletimer for an interface.
319     */
320    void removeIdleTimer(String iface);
321
322    /**
323     * Sets the name of the default interface in the DNS resolver.
324     */
325    void setDefaultInterfaceForDns(String iface);
326
327    /**
328     * Bind name servers to an interface in the DNS resolver.
329     */
330    void setDnsServersForInterface(String iface, in String[] servers, String domains);
331
332    /**
333     * Flush the DNS cache associated with the default interface.
334     */
335    void flushDefaultDnsCache();
336
337    /**
338     * Flush the DNS cache associated with the specified interface.
339     */
340    void flushInterfaceDnsCache(String iface);
341
342    void setFirewallEnabled(boolean enabled);
343    boolean isFirewallEnabled();
344    void setFirewallInterfaceRule(String iface, boolean allow);
345    void setFirewallEgressSourceRule(String addr, boolean allow);
346    void setFirewallEgressDestRule(String addr, int port, boolean allow);
347    void setFirewallUidRule(int uid, boolean allow);
348
349    /**
350     * Set all packets from users [uid_start,uid_end] to go through interface iface
351     * iface must already be set for marked forwarding by {@link setMarkedForwarding}
352     */
353    void setUidRangeRoute(String iface, int uid_start, int uid_end);
354
355    /**
356     * Clears the special routing rules for users [uid_start,uid_end]
357     */
358    void clearUidRangeRoute(String iface, int uid_start, int uid_end);
359
360    /**
361     * Setup an interface for routing packets marked by {@link setUidRangeRoute}
362     *
363     * This sets up a dedicated routing table for packets marked for {@code iface} and adds
364     * source-NAT rules so that the marked packets have the correct source address.
365     */
366    void setMarkedForwarding(String iface);
367
368    /**
369     * Removes marked forwarding for an interface
370     */
371    void clearMarkedForwarding(String iface);
372
373    /**
374     * Get the SO_MARK associated with routing packets for user {@code uid}
375     */
376    int getMarkForUid(int uid);
377
378    /**
379     * Get the SO_MARK associated with protecting packets from VPN routing rules
380     */
381    int getMarkForProtect();
382
383    /**
384     * Route all traffic in {@code route} to {@code iface} setup for marked forwarding
385     */
386    void setMarkedForwardingRoute(String iface, in RouteInfo route);
387
388    /**
389     * Clear routes set by {@link setMarkedForwardingRoute}
390     */
391    void clearMarkedForwardingRoute(String iface, in RouteInfo route);
392
393    /**
394     * Exempts {@code host} from the routing set up by {@link setMarkedForwardingRoute}
395     * All connects to {@code host} will use the global routing table
396     */
397    void setHostExemption(in LinkAddress host);
398
399    /**
400     * Clears an exemption set by {@link setHostExemption}
401     */
402    void clearHostExemption(in LinkAddress host);
403
404    /**
405     * Set a process (pid) to use the name servers associated with the specified interface.
406     */
407    void setDnsInterfaceForPid(String iface, int pid);
408
409    /**
410     * Clear a process (pid) from being associated with an interface.
411     */
412    void clearDnsInterfaceForPid(int pid);
413
414    /**
415    * Set a range of user ids to use the name servers associated with the specified interface.
416    */
417    void setDnsInterfaceForUidRange(String iface, int uid_start, int uid_end);
418
419    /**
420    * Clear a user range from being associated with an interface.
421    */
422    void clearDnsInterfaceForUidRange(String iface, int uid_start, int uid_end);
423
424    /**
425    * Clear the mappings from pid to Dns interface and from uid range to Dns interface.
426    */
427    void clearDnsInterfaceMaps();
428
429    /**
430     * Start the clatd (464xlat) service
431     */
432    void startClatd(String interfaceName);
433
434    /**
435     * Stop the clatd (464xlat) service
436     */
437    void stopClatd();
438
439    /**
440     * Determine whether the clatd (464xlat) service has been started
441     */
442    boolean isClatdStarted();
443
444    /**
445     * Start listening for mobile activity state changes.
446     */
447    void registerNetworkActivityListener(INetworkActivityListener listener);
448
449    /**
450     * Stop listening for mobile activity state changes.
451     */
452    void unregisterNetworkActivityListener(INetworkActivityListener listener);
453
454    /**
455     * Check whether the mobile radio is currently active.
456     */
457    boolean isNetworkActive();
458
459    /**
460     * setup a new network
461     */
462    void createNetwork(int netId, String iface);
463
464    /**
465     * remove a network
466     */
467    void removeNetwork(int netId);
468}
469