• 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.Network;
23 import android.net.NetworkStats;
24 import android.net.RouteInfo;
25 import android.net.UidRange;
26 import android.net.wifi.WifiConfiguration;
27 import android.os.INetworkActivityListener;
28 
29 /**
30  * @hide
31  */
32 interface INetworkManagementService
33 {
34     /**
35      ** GENERAL
36      **/
37 
38     /**
39      * Register an observer to receive events
40      */
registerObserver(INetworkManagementEventObserver obs)41     void registerObserver(INetworkManagementEventObserver obs);
42 
43     /**
44      * Unregister an observer from receiving events.
45      */
unregisterObserver(INetworkManagementEventObserver obs)46     void unregisterObserver(INetworkManagementEventObserver obs);
47 
48     /**
49      * Returns a list of currently known network interfaces
50      */
listInterfaces()51     String[] listInterfaces();
52 
53     /**
54      * Retrieves the specified interface config
55      *
56      */
getInterfaceConfig(String iface)57     InterfaceConfiguration getInterfaceConfig(String iface);
58 
59     /**
60      * Sets the configuration of the specified interface
61      */
setInterfaceConfig(String iface, in InterfaceConfiguration cfg)62     void setInterfaceConfig(String iface, in InterfaceConfiguration cfg);
63 
64     /**
65      * Clear all IP addresses on the specified interface
66      */
clearInterfaceAddresses(String iface)67     void clearInterfaceAddresses(String iface);
68 
69     /**
70      * Set interface down
71      */
setInterfaceDown(String iface)72     void setInterfaceDown(String iface);
73 
74     /**
75      * Set interface up
76      */
setInterfaceUp(String iface)77     void setInterfaceUp(String iface);
78 
79     /**
80      * Set interface IPv6 privacy extensions
81      */
setInterfaceIpv6PrivacyExtensions(String iface, boolean enable)82     void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable);
83 
84     /**
85      * Disable IPv6 on an interface
86      */
disableIpv6(String iface)87     void disableIpv6(String iface);
88 
89     /**
90      * Enable IPv6 on an interface
91      */
enableIpv6(String iface)92     void enableIpv6(String iface);
93 
94     /**
95      * Enables or enables IPv6 ND offload.
96      */
setInterfaceIpv6NdOffload(String iface, boolean enable)97     void setInterfaceIpv6NdOffload(String iface, boolean enable);
98 
99     /**
100      * Add the specified route to the interface.
101      */
addRoute(int netId, in RouteInfo route)102     void addRoute(int netId, in RouteInfo route);
103 
104     /**
105      * Remove the specified route from the interface.
106      */
removeRoute(int netId, in RouteInfo route)107     void removeRoute(int netId, in RouteInfo route);
108 
109     /**
110      * Set the specified MTU size
111      */
setMtu(String iface, int mtu)112     void setMtu(String iface, int mtu);
113 
114     /**
115      * Shuts down the service
116      */
shutdown()117     void shutdown();
118 
119     /**
120      ** TETHERING RELATED
121      **/
122 
123     /**
124      * Returns true if IP forwarding is enabled
125      */
getIpForwardingEnabled()126     boolean getIpForwardingEnabled();
127 
128     /**
129      * Enables/Disables IP Forwarding
130      */
setIpForwardingEnabled(boolean enabled)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      */
startTethering(in String[] dhcpRanges)137     void startTethering(in String[] dhcpRanges);
138 
139     /**
140      * Stop currently running tethering services
141      */
stopTethering()142     void stopTethering();
143 
144     /**
145      * Returns true if tethering services are started
146      */
isTetheringStarted()147     boolean isTetheringStarted();
148 
149     /**
150      * Tethers the specified interface
151      */
tetherInterface(String iface)152     void tetherInterface(String iface);
153 
154     /**
155      * Untethers the specified interface
156      */
untetherInterface(String iface)157     void untetherInterface(String iface);
158 
159     /**
160      * Returns a list of currently tethered interfaces
161      */
listTetheredInterfaces()162     String[] listTetheredInterfaces();
163 
164     /**
165      * Sets the list of DNS forwarders (in order of priority)
166      */
setDnsForwarders(in Network network, in String[] dns)167     void setDnsForwarders(in Network network, in String[] dns);
168 
169     /**
170      * Returns the list of DNS forwarders (in order of priority)
171      */
getDnsForwarders()172     String[] getDnsForwarders();
173 
174     /**
175      * Enables unidirectional packet forwarding from {@code fromIface} to
176      * {@code toIface}.
177      */
startInterfaceForwarding(String fromIface, String toIface)178     void startInterfaceForwarding(String fromIface, String toIface);
179 
180     /**
181      * Disables unidirectional packet forwarding from {@code fromIface} to
182      * {@code toIface}.
183      */
stopInterfaceForwarding(String fromIface, String toIface)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      */
enableNat(String internalInterface, String externalInterface)191     void enableNat(String internalInterface, String externalInterface);
192 
193     /**
194      *  Disables Network Address Translation between two interfaces.
195      */
disableNat(String internalInterface, String externalInterface)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      */
listTtys()205     String[] listTtys();
206 
207     /**
208      * Attaches a PPP server daemon to the specified TTY with the specified
209      * local/remote addresses.
210      */
attachPppd(String tty, String localAddr, String remoteAddr, String dns1Addr, String dns2Addr)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      */
detachPppd(String tty)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      */
wifiFirmwareReload(String wlanIface, String mode)223     void wifiFirmwareReload(String wlanIface, String mode);
224 
225     /**
226      * Start Wifi Access Point
227      */
startAccessPoint(in WifiConfiguration wifiConfig, String iface)228     void startAccessPoint(in WifiConfiguration wifiConfig, String iface);
229 
230     /**
231      * Stop Wifi Access Point
232      */
stopAccessPoint(String iface)233     void stopAccessPoint(String iface);
234 
235     /**
236      * Set Access Point config
237      */
setAccessPoint(in WifiConfiguration wifiConfig, String iface)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      */
getNetworkStatsSummaryDev()248     NetworkStats getNetworkStatsSummaryDev();
getNetworkStatsSummaryXt()249     NetworkStats getNetworkStatsSummaryXt();
250 
251     /**
252      * Return detailed network statistics with UID-level granularity,
253      * including interface and tag details.
254      */
getNetworkStatsDetail()255     NetworkStats getNetworkStatsDetail();
256 
257     /**
258      * Return detailed network statistics for the requested UID,
259      * including interface and tag details.
260      */
getNetworkStatsUidDetail(int uid)261     NetworkStats getNetworkStatsUidDetail(int uid);
262 
263     /**
264      * Return summary of network statistics all tethering interfaces.
265      */
getNetworkStatsTethering()266     NetworkStats getNetworkStatsTethering();
267 
268     /**
269      * Set quota for an interface.
270      */
setInterfaceQuota(String iface, long quotaBytes)271     void setInterfaceQuota(String iface, long quotaBytes);
272 
273     /**
274      * Remove quota for an interface.
275      */
removeInterfaceQuota(String iface)276     void removeInterfaceQuota(String iface);
277 
278     /**
279      * Set alert for an interface; requires that iface already has quota.
280      */
setInterfaceAlert(String iface, long alertBytes)281     void setInterfaceAlert(String iface, long alertBytes);
282 
283     /**
284      * Remove alert for an interface.
285      */
removeInterfaceAlert(String iface)286     void removeInterfaceAlert(String iface);
287 
288     /**
289      * Set alert across all interfaces.
290      */
setGlobalAlert(long alertBytes)291     void setGlobalAlert(long alertBytes);
292 
293     /**
294      * Control network activity of a UID over interfaces with a quota limit.
295      */
setUidMeteredNetworkBlacklist(int uid, boolean enable)296     void setUidMeteredNetworkBlacklist(int uid, boolean enable);
setUidMeteredNetworkWhitelist(int uid, boolean enable)297     void setUidMeteredNetworkWhitelist(int uid, boolean enable);
setDataSaverModeEnabled(boolean enable)298     boolean setDataSaverModeEnabled(boolean enable);
299 
setUidCleartextNetworkPolicy(int uid, int policy)300     void setUidCleartextNetworkPolicy(int uid, int policy);
301 
302     /**
303      * Return status of bandwidth control module.
304      */
isBandwidthControlEnabled()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      */
addIdleTimer(String iface, int timeout, int type)319     void addIdleTimer(String iface, int timeout, int type);
320 
321     /**
322      * Removes idletimer for an interface.
323      */
removeIdleTimer(String iface)324     void removeIdleTimer(String iface);
325 
326     /**
327      * Configure name servers, search paths, and resolver parameters for the given network.
328      */
setDnsConfigurationForNetwork(int netId, in String[] servers, String domains)329     void setDnsConfigurationForNetwork(int netId, in String[] servers, String domains);
330 
331     /**
332      * Bind name servers to a network in the DNS resolver.
333      */
setDnsServersForNetwork(int netId, in String[] servers, String domains)334     void setDnsServersForNetwork(int netId, in String[] servers, String domains);
335 
setFirewallEnabled(boolean enabled)336     void setFirewallEnabled(boolean enabled);
isFirewallEnabled()337     boolean isFirewallEnabled();
setFirewallInterfaceRule(String iface, boolean allow)338     void setFirewallInterfaceRule(String iface, boolean allow);
setFirewallEgressSourceRule(String addr, boolean allow)339     void setFirewallEgressSourceRule(String addr, boolean allow);
setFirewallEgressDestRule(String addr, int port, boolean allow)340     void setFirewallEgressDestRule(String addr, int port, boolean allow);
setFirewallUidRule(int chain, int uid, int rule)341     void setFirewallUidRule(int chain, int uid, int rule);
setFirewallUidRules(int chain, in int[] uids, in int[] rules)342     void setFirewallUidRules(int chain, in int[] uids, in int[] rules);
setFirewallChainEnabled(int chain, boolean enable)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      */
addVpnUidRanges(int netId, in UidRange[] ranges)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      */
removeVpnUidRanges(int netId, in UidRange[] ranges)353     void removeVpnUidRanges(int netId, in UidRange[] ranges);
354 
355     /**
356      * Start the clatd (464xlat) service on the given interface.
357      */
startClatd(String interfaceName)358     void startClatd(String interfaceName);
359 
360     /**
361      * Stop the clatd (464xlat) service on the given interface.
362      */
stopClatd(String interfaceName)363     void stopClatd(String interfaceName);
364 
365     /**
366      * Determine whether the clatd (464xlat) service has been started on the given interface.
367      */
isClatdStarted(String interfaceName)368     boolean isClatdStarted(String interfaceName);
369 
370     /**
371      * Start listening for mobile activity state changes.
372      */
registerNetworkActivityListener(INetworkActivityListener listener)373     void registerNetworkActivityListener(INetworkActivityListener listener);
374 
375     /**
376      * Stop listening for mobile activity state changes.
377      */
unregisterNetworkActivityListener(INetworkActivityListener listener)378     void unregisterNetworkActivityListener(INetworkActivityListener listener);
379 
380     /**
381      * Check whether the mobile radio is currently active.
382      */
isNetworkActive()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      */
createPhysicalNetwork(int netId, String permission)390     void createPhysicalNetwork(int netId, String permission);
391 
392     /**
393      * Setup a new VPN.
394      */
createVirtualNetwork(int netId, boolean hasDNS, boolean secure)395     void createVirtualNetwork(int netId, boolean hasDNS, boolean secure);
396 
397     /**
398      * Remove a network.
399      */
removeNetwork(int netId)400     void removeNetwork(int netId);
401 
402     /**
403      * Add an interface to a network.
404      */
addInterfaceToNetwork(String iface, int netId)405     void addInterfaceToNetwork(String iface, int netId);
406 
407     /**
408      * Remove an Interface from a network.
409      */
removeInterfaceFromNetwork(String iface, int netId)410     void removeInterfaceFromNetwork(String iface, int netId);
411 
addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid)412     void addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid);
413 
setDefaultNetId(int netId)414     void setDefaultNetId(int netId);
clearDefaultNetId()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      */
setNetworkPermission(int netId, String permission)422     void setNetworkPermission(int netId, String permission);
423 
setPermission(String permission, in int[] uids)424     void setPermission(String permission, in int[] uids);
clearPermission(in int[] uids)425     void clearPermission(in int[] uids);
426 
427     /**
428      * Allow UID to call protect().
429      */
allowProtect(int uid)430     void allowProtect(int uid);
431 
432     /**
433      * Deny UID from calling protect().
434      */
denyProtect(int uid)435     void denyProtect(int uid);
436 
addInterfaceToLocalNetwork(String iface, in List<RouteInfo> routes)437     void addInterfaceToLocalNetwork(String iface, in List<RouteInfo> routes);
removeInterfaceFromLocalNetwork(String iface)438     void removeInterfaceFromLocalNetwork(String iface);
439 
setAllowOnlyVpnForUids(boolean enable, in UidRange[] uidRanges)440     void setAllowOnlyVpnForUids(boolean enable, in UidRange[] uidRanges);
441 }
442