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