INetworkManagementService.aidl 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. /* //device/java/android/android/os/INetworkManagementService.antlr.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. package android.os;
  18. import android.net.InterfaceConfiguration;
  19. import android.net.INetd;
  20. import android.net.INetworkManagementEventObserver;
  21. import android.net.ITetheringStatsProvider;
  22. import android.net.Network;
  23. import android.net.NetworkStats;
  24. import android.net.RouteInfo;
  25. import android.net.UidRange;
  26. import android.os.INetworkActivityListener;
  27. /**
  28. * @hide
  29. */
  30. interface INetworkManagementService
  31. {
  32. /**
  33. ** GENERAL
  34. **/
  35. /**
  36. * Register an observer to receive events.
  37. */
  38. void registerObserver(INetworkManagementEventObserver obs);
  39. /**
  40. * Unregister an observer from receiving events.
  41. */
  42. void unregisterObserver(INetworkManagementEventObserver obs);
  43. /**
  44. * Retrieve an INetd to talk to netd.
  45. */
  46. INetd getNetdService();
  47. /**
  48. * Returns a list of currently known network interfaces
  49. */
  50. String[] listInterfaces();
  51. /**
  52. * Retrieves the specified interface config
  53. *
  54. */
  55. InterfaceConfiguration getInterfaceConfig(String iface);
  56. /**
  57. * Sets the configuration of the specified interface
  58. */
  59. void setInterfaceConfig(String iface, in InterfaceConfiguration cfg);
  60. /**
  61. * Clear all IP addresses on the specified interface
  62. */
  63. void clearInterfaceAddresses(String iface);
  64. /**
  65. * Set interface down
  66. */
  67. void setInterfaceDown(String iface);
  68. /**
  69. * Set interface up
  70. */
  71. void setInterfaceUp(String iface);
  72. /**
  73. * Set interface IPv6 privacy extensions
  74. */
  75. void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable);
  76. /**
  77. * Disable IPv6 on an interface
  78. */
  79. void disableIpv6(String iface);
  80. /**
  81. * Enable IPv6 on an interface
  82. */
  83. void enableIpv6(String iface);
  84. /**
  85. * Set IPv6 autoconf address generation mode.
  86. * This is a no-op if an unsupported mode is requested.
  87. */
  88. void setIPv6AddrGenMode(String iface, int mode);
  89. /**
  90. * Add the specified route to the interface.
  91. */
  92. void addRoute(int netId, in RouteInfo route);
  93. /**
  94. * Remove the specified route from the interface.
  95. */
  96. void removeRoute(int netId, in RouteInfo route);
  97. /**
  98. * Set the specified MTU size
  99. */
  100. void setMtu(String iface, int mtu);
  101. /**
  102. * Shuts down the service
  103. */
  104. void shutdown();
  105. /**
  106. ** TETHERING RELATED
  107. **/
  108. /**
  109. * Returns true if IP forwarding is enabled
  110. */
  111. boolean getIpForwardingEnabled();
  112. /**
  113. * Enables/Disables IP Forwarding
  114. */
  115. void setIpForwardingEnabled(boolean enabled);
  116. /**
  117. * Start tethering services with the specified dhcp server range
  118. * arg is a set of start end pairs defining the ranges.
  119. */
  120. void startTethering(in String[] dhcpRanges);
  121. /**
  122. * Stop currently running tethering services
  123. */
  124. void stopTethering();
  125. /**
  126. * Returns true if tethering services are started
  127. */
  128. boolean isTetheringStarted();
  129. /**
  130. * Tethers the specified interface
  131. */
  132. void tetherInterface(String iface);
  133. /**
  134. * Untethers the specified interface
  135. */
  136. void untetherInterface(String iface);
  137. /**
  138. * Returns a list of currently tethered interfaces
  139. */
  140. String[] listTetheredInterfaces();
  141. /**
  142. * Sets the list of DNS forwarders (in order of priority)
  143. */
  144. void setDnsForwarders(in Network network, in String[] dns);
  145. /**
  146. * Returns the list of DNS forwarders (in order of priority)
  147. */
  148. String[] getDnsForwarders();
  149. /**
  150. * Enables unidirectional packet forwarding from {@code fromIface} to
  151. * {@code toIface}.
  152. */
  153. void startInterfaceForwarding(String fromIface, String toIface);
  154. /**
  155. * Disables unidirectional packet forwarding from {@code fromIface} to
  156. * {@code toIface}.
  157. */
  158. void stopInterfaceForwarding(String fromIface, String toIface);
  159. /**
  160. * Enables Network Address Translation between two interfaces.
  161. * The address and netmask of the external interface is used for
  162. * the NAT'ed network.
  163. */
  164. void enableNat(String internalInterface, String externalInterface);
  165. /**
  166. * Disables Network Address Translation between two interfaces.
  167. */
  168. void disableNat(String internalInterface, String externalInterface);
  169. /**
  170. * Registers a {@code ITetheringStatsProvider} to provide tethering statistics.
  171. * All registered providers will be called in order, and their results will be added together.
  172. * Netd is always registered as a tethering stats provider.
  173. */
  174. void registerTetheringStatsProvider(ITetheringStatsProvider provider, String name);
  175. /**
  176. * Unregisters a previously-registered {@code ITetheringStatsProvider}.
  177. */
  178. void unregisterTetheringStatsProvider(ITetheringStatsProvider provider);
  179. /**
  180. * Reports that a tethering provider has reached a data limit.
  181. *
  182. * Currently triggers a global alert, which causes NetworkStatsService to poll counters and
  183. * re-evaluate data usage.
  184. *
  185. * This does not take an interface name because:
  186. * 1. The tethering offload stats provider cannot reliably determine the interface on which the
  187. * limit was reached, because the HAL does not provide it.
  188. * 2. Firing an interface-specific alert instead of a global alert isn't really useful since in
  189. * all cases of interest, the system responds to both in the same way - it polls stats, and
  190. * then notifies NetworkPolicyManagerService of the fact.
  191. */
  192. void tetherLimitReached(ITetheringStatsProvider provider);
  193. /**
  194. ** PPPD
  195. **/
  196. /**
  197. * Returns the list of currently known TTY devices on the system
  198. */
  199. String[] listTtys();
  200. /**
  201. * Attaches a PPP server daemon to the specified TTY with the specified
  202. * local/remote addresses.
  203. */
  204. void attachPppd(String tty, String localAddr, String remoteAddr, String dns1Addr,
  205. String dns2Addr);
  206. /**
  207. * Detaches a PPP server daemon from the specified TTY.
  208. */
  209. void detachPppd(String tty);
  210. /**
  211. ** DATA USAGE RELATED
  212. **/
  213. /**
  214. * Return global network statistics summarized at an interface level,
  215. * without any UID-level granularity.
  216. */
  217. NetworkStats getNetworkStatsSummaryDev();
  218. NetworkStats getNetworkStatsSummaryXt();
  219. /**
  220. * Return detailed network statistics with UID-level granularity,
  221. * including interface and tag details.
  222. */
  223. NetworkStats getNetworkStatsDetail();
  224. /**
  225. * Return detailed network statistics for the requested UID and interfaces,
  226. * including interface and tag details.
  227. * @param uid UID to obtain statistics for, or {@link NetworkStats#UID_ALL}.
  228. * @param ifaces Interfaces to obtain statistics for, or {@link NetworkStats#INTERFACES_ALL}.
  229. */
  230. NetworkStats getNetworkStatsUidDetail(int uid, in String[] ifaces);
  231. /**
  232. * Return summary of network statistics all tethering interfaces.
  233. */
  234. NetworkStats getNetworkStatsTethering(int how);
  235. /**
  236. * Set quota for an interface.
  237. */
  238. void setInterfaceQuota(String iface, long quotaBytes);
  239. /**
  240. * Remove quota for an interface.
  241. */
  242. void removeInterfaceQuota(String iface);
  243. /**
  244. * Set alert for an interface; requires that iface already has quota.
  245. */
  246. void setInterfaceAlert(String iface, long alertBytes);
  247. /**
  248. * Remove alert for an interface.
  249. */
  250. void removeInterfaceAlert(String iface);
  251. /**
  252. * Set alert across all interfaces.
  253. */
  254. void setGlobalAlert(long alertBytes);
  255. /**
  256. * Control network activity of a UID over interfaces with a quota limit.
  257. */
  258. void setUidMeteredNetworkBlacklist(int uid, boolean enable);
  259. void setUidMeteredNetworkWhitelist(int uid, boolean enable);
  260. boolean setDataSaverModeEnabled(boolean enable);
  261. void setUidCleartextNetworkPolicy(int uid, int policy);
  262. /**
  263. * Return status of bandwidth control module.
  264. */
  265. boolean isBandwidthControlEnabled();
  266. /**
  267. * Sets idletimer for an interface.
  268. *
  269. * This either initializes a new idletimer or increases its
  270. * reference-counting if an idletimer already exists for given
  271. * {@code iface}.
  272. *
  273. * {@code type} is the type of the interface, such as TYPE_MOBILE.
  274. *
  275. * Every {@code addIdleTimer} should be paired with a
  276. * {@link removeIdleTimer} to cleanup when the network disconnects.
  277. */
  278. void addIdleTimer(String iface, int timeout, int type);
  279. /**
  280. * Removes idletimer for an interface.
  281. */
  282. void removeIdleTimer(String iface);
  283. /**
  284. * Configure name servers, search paths, and resolver parameters for the given network.
  285. */
  286. void setDnsConfigurationForNetwork(int netId, in String[] servers, in String[] domains,
  287. in int[] params, String tlsHostname, in String[] tlsServers);
  288. void setFirewallEnabled(boolean enabled);
  289. boolean isFirewallEnabled();
  290. void setFirewallInterfaceRule(String iface, boolean allow);
  291. void setFirewallUidRule(int chain, int uid, int rule);
  292. void setFirewallUidRules(int chain, in int[] uids, in int[] rules);
  293. void setFirewallChainEnabled(int chain, boolean enable);
  294. /**
  295. * Set all packets from users in ranges to go through VPN specified by netId.
  296. */
  297. void addVpnUidRanges(int netId, in UidRange[] ranges);
  298. /**
  299. * Clears the special VPN rules for users in ranges and VPN specified by netId.
  300. */
  301. void removeVpnUidRanges(int netId, in UidRange[] ranges);
  302. /**
  303. * Start the clatd (464xlat) service on the given interface.
  304. */
  305. void startClatd(String interfaceName);
  306. /**
  307. * Stop the clatd (464xlat) service on the given interface.
  308. */
  309. void stopClatd(String interfaceName);
  310. /**
  311. * Determine whether the clatd (464xlat) service has been started on the given interface.
  312. */
  313. boolean isClatdStarted(String interfaceName);
  314. /**
  315. * Start listening for mobile activity state changes.
  316. */
  317. void registerNetworkActivityListener(INetworkActivityListener listener);
  318. /**
  319. * Stop listening for mobile activity state changes.
  320. */
  321. void unregisterNetworkActivityListener(INetworkActivityListener listener);
  322. /**
  323. * Check whether the mobile radio is currently active.
  324. */
  325. boolean isNetworkActive();
  326. /**
  327. * Setup a new physical network.
  328. * @param permission null if no permissions required to access this network. PERMISSION_NETWORK
  329. * or PERMISSION_SYSTEM to set respective permission.
  330. */
  331. void createPhysicalNetwork(int netId, String permission);
  332. /**
  333. * Setup a new VPN.
  334. */
  335. void createVirtualNetwork(int netId, boolean hasDNS, boolean secure);
  336. /**
  337. * Remove a network.
  338. */
  339. void removeNetwork(int netId);
  340. /**
  341. * Add an interface to a network.
  342. */
  343. void addInterfaceToNetwork(String iface, int netId);
  344. /**
  345. * Remove an Interface from a network.
  346. */
  347. void removeInterfaceFromNetwork(String iface, int netId);
  348. void addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid);
  349. void setDefaultNetId(int netId);
  350. void clearDefaultNetId();
  351. /**
  352. * Set permission for a network.
  353. * @param permission null to clear permissions. PERMISSION_NETWORK or PERMISSION_SYSTEM to set
  354. * permission.
  355. */
  356. void setNetworkPermission(int netId, String permission);
  357. void setPermission(String permission, in int[] uids);
  358. void clearPermission(in int[] uids);
  359. /**
  360. * Allow UID to call protect().
  361. */
  362. void allowProtect(int uid);
  363. /**
  364. * Deny UID from calling protect().
  365. */
  366. void denyProtect(int uid);
  367. void addInterfaceToLocalNetwork(String iface, in List<RouteInfo> routes);
  368. void removeInterfaceFromLocalNetwork(String iface);
  369. int removeRoutesFromLocalNetwork(in List<RouteInfo> routes);
  370. void setAllowOnlyVpnForUids(boolean enable, in UidRange[] uidRanges);
  371. boolean isNetworkRestricted(int uid);
  372. }