blob: 0b548d57c47ebfe4b69dfc1f8c24ab071eb3478e [file] [log] [blame]
San Mehat873f2142010-01-14 10:25:07 -08001/* //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
San Mehated4fc8a2010-01-22 12:28:36 -080020import android.net.InterfaceConfiguration;
Erik Kline4e37b702016-07-05 11:34:21 +090021import android.net.INetd;
San Mehat4d02d002010-01-22 16:07:46 -080022import android.net.INetworkManagementEventObserver;
Lorenzo Colittib57edc52014-08-22 17:10:50 -070023import android.net.Network;
Jeff Sharkey9a13f362011-04-26 16:25:36 -070024import android.net.NetworkStats;
Robert Greenwalt59b1a4e2011-05-10 15:05:02 -070025import android.net.RouteInfo;
Paul Jensen6bc2c2c2014-05-07 15:27:40 -040026import android.net.UidRange;
Irfan Sheriff9ab518ad2010-03-12 15:48:17 -080027import android.net.wifi.WifiConfiguration;
Dianne Hackborn77b987f2014-02-26 16:20:52 -080028import android.os.INetworkActivityListener;
San Mehated4fc8a2010-01-22 12:28:36 -080029
San Mehat873f2142010-01-14 10:25:07 -080030/**
31 * @hide
32 */
33interface INetworkManagementService
34{
35 /**
36 ** GENERAL
37 **/
38
39 /**
Erik Kline4e37b702016-07-05 11:34:21 +090040 * Register an observer to receive events.
San Mehat4d02d002010-01-22 16:07:46 -080041 */
42 void registerObserver(INetworkManagementEventObserver obs);
43
44 /**
45 * Unregister an observer from receiving events.
46 */
47 void unregisterObserver(INetworkManagementEventObserver obs);
48
49 /**
Erik Kline4e37b702016-07-05 11:34:21 +090050 * Retrieve an INetd to talk to netd.
51 */
52 INetd getNetdService();
53
54 /**
San Mehat873f2142010-01-14 10:25:07 -080055 * Returns a list of currently known network interfaces
56 */
57 String[] listInterfaces();
58
59 /**
San Mehated4fc8a2010-01-22 12:28:36 -080060 * Retrieves the specified interface config
61 *
62 */
63 InterfaceConfiguration getInterfaceConfig(String iface);
64
65 /**
66 * Sets the configuration of the specified interface
67 */
68 void setInterfaceConfig(String iface, in InterfaceConfiguration cfg);
69
70 /**
Irfan Sherifff5600612011-06-16 10:26:28 -070071 * Clear all IP addresses on the specified interface
72 */
73 void clearInterfaceAddresses(String iface);
74
75 /**
Irfan Sheriff7244c972011-08-05 20:40:45 -070076 * Set interface down
77 */
78 void setInterfaceDown(String iface);
79
80 /**
81 * Set interface up
82 */
83 void setInterfaceUp(String iface);
84
85 /**
Irfan Sheriff73293612011-09-14 12:31:56 -070086 * Set interface IPv6 privacy extensions
87 */
88 void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable);
89
90 /**
repo sync7960d9f2011-09-29 12:40:02 -070091 * Disable IPv6 on an interface
92 */
93 void disableIpv6(String iface);
94
95 /**
96 * Enable IPv6 on an interface
97 */
98 void enableIpv6(String iface);
99
100 /**
Lorenzo Colittie21a26b2014-10-28 15:24:03 +0900101 * Enables or enables IPv6 ND offload.
102 */
103 void setInterfaceIpv6NdOffload(String iface, boolean enable);
104
105 /**
Robert Greenwalt59b1a4e2011-05-10 15:05:02 -0700106 * Add the specified route to the interface.
107 */
Sreeram Ramachandranb2829fa2014-04-15 19:07:12 -0700108 void addRoute(int netId, in RouteInfo route);
Robert Greenwalt59b1a4e2011-05-10 15:05:02 -0700109
110 /**
111 * Remove the specified route from the interface.
112 */
Sreeram Ramachandranb2829fa2014-04-15 19:07:12 -0700113 void removeRoute(int netId, in RouteInfo route);
Robert Greenwalt3b28e9a2011-11-02 14:37:19 -0700114
115 /**
sy.yun9d9b74a2013-09-02 05:24:09 +0900116 * Set the specified MTU size
117 */
118 void setMtu(String iface, int mtu);
119
120 /**
San Mehat873f2142010-01-14 10:25:07 -0800121 * Shuts down the service
122 */
123 void shutdown();
124
125 /**
126 ** TETHERING RELATED
127 **/
128
San Mehat873f2142010-01-14 10:25:07 -0800129 /**
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
Robert Greenwaltbfb7bfa2010-03-24 16:03:21 -0700141 * arg is a set of start end pairs defining the ranges.
San Mehat873f2142010-01-14 10:25:07 -0800142 */
Robert Greenwaltbfb7bfa2010-03-24 16:03:21 -0700143 void startTethering(in String[] dhcpRanges);
San Mehat873f2142010-01-14 10:25:07 -0800144
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 */
Lorenzo Colittib57edc52014-08-22 17:10:50 -0700173 void setDnsForwarders(in Network network, in String[] dns);
San Mehat873f2142010-01-14 10:25:07 -0800174
175 /**
Lorenzo Colittib57edc52014-08-22 17:10:50 -0700176 * Returns the list of DNS forwarders (in order of priority)
San Mehat873f2142010-01-14 10:25:07 -0800177 */
178 String[] getDnsForwarders();
179
180 /**
Lorenzo Colitti35e36db2015-02-26 01:25:36 +0900181 * Enables unidirectional packet forwarding from {@code fromIface} to
182 * {@code toIface}.
183 */
184 void startInterfaceForwarding(String fromIface, String toIface);
185
186 /**
187 * Disables unidirectional packet forwarding from {@code fromIface} to
188 * {@code toIface}.
189 */
190 void stopInterfaceForwarding(String fromIface, String toIface);
191
192 /**
San Mehat873f2142010-01-14 10:25:07 -0800193 * Enables Network Address Translation between two interfaces.
194 * The address and netmask of the external interface is used for
195 * the NAT'ed network.
196 */
197 void enableNat(String internalInterface, String externalInterface);
198
199 /**
200 * Disables Network Address Translation between two interfaces.
201 */
202 void disableNat(String internalInterface, String externalInterface);
San Mehat72759df2010-01-19 13:50:37 -0800203
204 /**
205 ** PPPD
206 **/
207
208 /**
209 * Returns the list of currently known TTY devices on the system
210 */
211 String[] listTtys();
212
213 /**
214 * Attaches a PPP server daemon to the specified TTY with the specified
215 * local/remote addresses.
216 */
Robert Greenwaltd0e18ff2010-01-26 11:40:34 -0800217 void attachPppd(String tty, String localAddr, String remoteAddr, String dns1Addr,
218 String dns2Addr);
San Mehat72759df2010-01-19 13:50:37 -0800219
220 /**
221 * Detaches a PPP server daemon from the specified TTY.
222 */
223 void detachPppd(String tty);
224
Robert Greenwaltce1200d2010-02-18 11:25:54 -0800225 /**
Irfan Sheriffcb30b222011-07-29 20:54:52 -0700226 * Load firmware for operation in the given mode. Currently the three
227 * modes supported are "AP", "STA" and "P2P".
228 */
229 void wifiFirmwareReload(String wlanIface, String mode);
230
231 /**
Irfan Sheriff5321aef2010-02-12 12:35:59 -0800232 * Start Wifi Access Point
233 */
Irfan Sheriff90542752012-06-19 15:44:35 -0700234 void startAccessPoint(in WifiConfiguration wifiConfig, String iface);
Irfan Sheriff5321aef2010-02-12 12:35:59 -0800235
236 /**
237 * Stop Wifi Access Point
238 */
Irfan Sheriff90542752012-06-19 15:44:35 -0700239 void stopAccessPoint(String iface);
Irfan Sheriff5321aef2010-02-12 12:35:59 -0800240
Irfan Sheriffc2f54c22010-03-18 14:02:22 -0700241 /**
242 * Set Access Point config
243 */
Irfan Sheriff90542752012-06-19 15:44:35 -0700244 void setAccessPoint(in WifiConfiguration wifiConfig, String iface);
San Mehat91cac642010-03-31 14:31:36 -0700245
246 /**
Jeff Sharkey9a13f362011-04-26 16:25:36 -0700247 ** DATA USAGE RELATED
248 **/
San Mehat91cac642010-03-31 14:31:36 -0700249
250 /**
Jeff Sharkey9a13f362011-04-26 16:25:36 -0700251 * Return global network statistics summarized at an interface level,
252 * without any UID-level granularity.
San Mehat91cac642010-03-31 14:31:36 -0700253 */
Jeff Sharkeye8914c32012-05-01 16:26:09 -0700254 NetworkStats getNetworkStatsSummaryDev();
255 NetworkStats getNetworkStatsSummaryXt();
San Mehat91cac642010-03-31 14:31:36 -0700256
257 /**
Jeff Sharkey9a13f362011-04-26 16:25:36 -0700258 * Return detailed network statistics with UID-level granularity,
259 * including interface and tag details.
260 */
261 NetworkStats getNetworkStatsDetail();
262
263 /**
Jeff Sharkeyeedcb952011-05-17 14:55:15 -0700264 * Return detailed network statistics for the requested UID,
265 * including interface and tag details.
266 */
267 NetworkStats getNetworkStatsUidDetail(int uid);
268
269 /**
Jeff Sharkeye4984be2013-09-10 21:03:27 -0700270 * Return summary of network statistics all tethering interfaces.
Jeff Sharkeycdd02c5d2011-09-16 01:52:49 -0700271 */
Jeff Sharkeye4984be2013-09-10 21:03:27 -0700272 NetworkStats getNetworkStatsTethering();
Jeff Sharkeycdd02c5d2011-09-16 01:52:49 -0700273
274 /**
Jeff Sharkeyb3f19ca2011-06-29 23:54:13 -0700275 * Set quota for an interface.
Ashish Sharma50fd36d2011-06-15 19:34:53 -0700276 */
Jeff Sharkey41ff7ec2011-07-25 15:21:22 -0700277 void setInterfaceQuota(String iface, long quotaBytes);
Jeff Sharkeyb3f19ca2011-06-29 23:54:13 -0700278
279 /**
280 * Remove quota for an interface.
281 */
282 void removeInterfaceQuota(String iface);
Ashish Sharma50fd36d2011-06-15 19:34:53 -0700283
284 /**
Jeff Sharkey41ff7ec2011-07-25 15:21:22 -0700285 * Set alert for an interface; requires that iface already has quota.
286 */
287 void setInterfaceAlert(String iface, long alertBytes);
288
289 /**
290 * Remove alert for an interface.
291 */
292 void removeInterfaceAlert(String iface);
293
294 /**
295 * Set alert across all interfaces.
296 */
297 void setGlobalAlert(long alertBytes);
298
299 /**
Ashish Sharma50fd36d2011-06-15 19:34:53 -0700300 * Control network activity of a UID over interfaces with a quota limit.
301 */
Felipe Leme65be3022016-03-22 14:53:13 -0700302 void setUidMeteredNetworkBlacklist(int uid, boolean enable);
303 void setUidMeteredNetworkWhitelist(int uid, boolean enable);
304 boolean setDataSaverModeEnabled(boolean enable);
Ashish Sharma50fd36d2011-06-15 19:34:53 -0700305
Jeff Sharkey605eb792014-11-04 13:34:06 -0800306 void setUidCleartextNetworkPolicy(int uid, int policy);
307
Ashish Sharma50fd36d2011-06-15 19:34:53 -0700308 /**
Jeff Sharkey63d27a92011-08-03 17:04:22 -0700309 * Return status of bandwidth control module.
310 */
311 boolean isBandwidthControlEnabled();
312
313 /**
Haoyu Bai04124232012-06-28 15:26:19 -0700314 * Sets idletimer for an interface.
315 *
316 * This either initializes a new idletimer or increases its
317 * reference-counting if an idletimer already exists for given
318 * {@code iface}.
319 *
Dianne Hackborn77b987f2014-02-26 16:20:52 -0800320 * {@code type} is the type of the interface, such as TYPE_MOBILE.
Haoyu Bai04124232012-06-28 15:26:19 -0700321 *
322 * Every {@code addIdleTimer} should be paired with a
323 * {@link removeIdleTimer} to cleanup when the network disconnects.
324 */
Dianne Hackborn77b987f2014-02-26 16:20:52 -0800325 void addIdleTimer(String iface, int timeout, int type);
Haoyu Bai04124232012-06-28 15:26:19 -0700326
327 /**
328 * Removes idletimer for an interface.
329 */
330 void removeIdleTimer(String iface);
331
332 /**
Pierre Imai8e48e672016-04-21 13:30:43 +0900333 * Configure name servers, search paths, and resolver parameters for the given network.
334 */
335 void setDnsConfigurationForNetwork(int netId, in String[] servers, String domains);
336
337 /**
Paul Jensen13e817d2014-04-10 14:16:37 -0400338 * Bind name servers to a network in the DNS resolver.
Mattias Falk7475c0c2011-04-04 16:10:36 +0200339 */
Paul Jensen13e817d2014-04-10 14:16:37 -0400340 void setDnsServersForNetwork(int netId, in String[] servers, String domains);
Mattias Falk7475c0c2011-04-04 16:10:36 +0200341
Jeff Sharkeyc268f0b2012-08-24 10:25:31 -0700342 void setFirewallEnabled(boolean enabled);
343 boolean isFirewallEnabled();
Jeff Sharkey2c092982012-08-24 11:44:40 -0700344 void setFirewallInterfaceRule(String iface, boolean allow);
345 void setFirewallEgressSourceRule(String addr, boolean allow);
346 void setFirewallEgressDestRule(String addr, int port, boolean allow);
Xiaohui Chenb41c9f72015-06-17 15:55:37 -0700347 void setFirewallUidRule(int chain, int uid, int rule);
348 void setFirewallUidRules(int chain, in int[] uids, in int[] rules);
349 void setFirewallChainEnabled(int chain, boolean enable);
Mattias Falk8b47b362011-08-23 14:15:13 +0200350
351 /**
Paul Jensen6bc2c2c2014-05-07 15:27:40 -0400352 * Set all packets from users in ranges to go through VPN specified by netId.
Chad Brubaker3277620a2013-06-12 13:37:30 -0700353 */
Paul Jensen6bc2c2c2014-05-07 15:27:40 -0400354 void addVpnUidRanges(int netId, in UidRange[] ranges);
Chad Brubaker3277620a2013-06-12 13:37:30 -0700355
356 /**
Paul Jensen6bc2c2c2014-05-07 15:27:40 -0400357 * Clears the special VPN rules for users in ranges and VPN specified by netId.
Chad Brubaker3277620a2013-06-12 13:37:30 -0700358 */
Paul Jensen6bc2c2c2014-05-07 15:27:40 -0400359 void removeVpnUidRanges(int netId, in UidRange[] ranges);
Chad Brubaker3277620a2013-06-12 13:37:30 -0700360
361 /**
Lorenzo Colitti95439462014-10-09 13:44:48 +0900362 * Start the clatd (464xlat) service on the given interface.
Lorenzo Colitti79751842013-02-28 16:16:03 +0900363 */
364 void startClatd(String interfaceName);
365
366 /**
Lorenzo Colitti95439462014-10-09 13:44:48 +0900367 * Stop the clatd (464xlat) service on the given interface.
Lorenzo Colitti79751842013-02-28 16:16:03 +0900368 */
Lorenzo Colitti95439462014-10-09 13:44:48 +0900369 void stopClatd(String interfaceName);
Lorenzo Colitti79751842013-02-28 16:16:03 +0900370
371 /**
Lorenzo Colitti95439462014-10-09 13:44:48 +0900372 * Determine whether the clatd (464xlat) service has been started on the given interface.
Lorenzo Colitti79751842013-02-28 16:16:03 +0900373 */
Lorenzo Colitti95439462014-10-09 13:44:48 +0900374 boolean isClatdStarted(String interfaceName);
Dianne Hackborn77b987f2014-02-26 16:20:52 -0800375
376 /**
377 * Start listening for mobile activity state changes.
378 */
379 void registerNetworkActivityListener(INetworkActivityListener listener);
380
381 /**
382 * Stop listening for mobile activity state changes.
383 */
384 void unregisterNetworkActivityListener(INetworkActivityListener listener);
385
386 /**
387 * Check whether the mobile radio is currently active.
388 */
389 boolean isNetworkActive();
Robert Greenwalt9ba9c582014-03-19 17:56:12 -0700390
391 /**
Paul Jensen6bc2c2c2014-05-07 15:27:40 -0400392 * Setup a new physical network.
Paul Jensen487ffe72015-07-24 15:57:11 -0400393 * @param permission null if no permissions required to access this network. PERMISSION_NETWORK
394 * or PERMISSION_SYSTEM to set respective permission.
Robert Greenwalt9ba9c582014-03-19 17:56:12 -0700395 */
Paul Jensen487ffe72015-07-24 15:57:11 -0400396 void createPhysicalNetwork(int netId, String permission);
Paul Jensen6bc2c2c2014-05-07 15:27:40 -0400397
398 /**
399 * Setup a new VPN.
400 */
Sreeram Ramachandran8cd33ed2014-07-23 15:23:15 -0700401 void createVirtualNetwork(int netId, boolean hasDNS, boolean secure);
Robert Greenwalt9ba9c582014-03-19 17:56:12 -0700402
403 /**
Paul Jensen992f2522014-04-28 10:33:11 -0400404 * Remove a network.
Robert Greenwalt9ba9c582014-03-19 17:56:12 -0700405 */
406 void removeNetwork(int netId);
Robert Greenwalt568891d2014-04-04 13:38:00 -0700407
Paul Jensen992f2522014-04-28 10:33:11 -0400408 /**
409 * Add an interface to a network.
410 */
411 void addInterfaceToNetwork(String iface, int netId);
412
413 /**
414 * Remove an Interface from a network.
415 */
416 void removeInterfaceFromNetwork(String iface, int netId);
417
Robert Greenwalt913c8952014-04-07 17:36:35 -0700418 void addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid);
Robert Greenwalt568891d2014-04-04 13:38:00 -0700419
Sreeram Ramachandranf047f2a2014-04-15 16:04:26 -0700420 void setDefaultNetId(int netId);
Robert Greenwalt568891d2014-04-04 13:38:00 -0700421 void clearDefaultNetId();
422
Paul Jensen487ffe72015-07-24 15:57:11 -0400423 /**
424 * Set permission for a network.
425 * @param permission null to clear permissions. PERMISSION_NETWORK or PERMISSION_SYSTEM to set
426 * permission.
427 */
428 void setNetworkPermission(int netId, String permission);
429
Sreeram Ramachandrane4a05af2014-09-24 09:16:19 -0700430 void setPermission(String permission, in int[] uids);
Robert Greenwalt568891d2014-04-04 13:38:00 -0700431 void clearPermission(in int[] uids);
Paul Jensen6bc2c2c2014-05-07 15:27:40 -0400432
433 /**
434 * Allow UID to call protect().
435 */
436 void allowProtect(int uid);
437
438 /**
439 * Deny UID from calling protect().
440 */
441 void denyProtect(int uid);
Sreeram Ramachandrana77760d2014-07-17 17:09:07 -0700442
443 void addInterfaceToLocalNetwork(String iface, in List<RouteInfo> routes);
444 void removeInterfaceFromLocalNetwork(String iface);
Erik Kline6599ee82016-07-17 21:28:39 +0900445 int removeRoutesFromLocalNetwork(in List<RouteInfo> routes);
Robin Lee17e61832016-05-09 13:46:28 +0100446
447 void setAllowOnlyVpnForUids(boolean enable, in UidRange[] uidRanges);
San Mehat873f2142010-01-14 10:25:07 -0800448}