diff options
| author | Sreeram Ramachandran <sreeram@google.com> | 2014-07-09 23:21:25 -0700 |
|---|---|---|
| committer | Sreeram Ramachandran <sreeram@google.com> | 2014-07-10 17:53:18 +0000 |
| commit | 81c295e1c843612408d0de26fe383cebc0a80313 (patch) | |
| tree | a48dc45bc5dd31dcc76d7ad49dc26a6d2e6cf843 /core/java/android/net/VpnService.java | |
| parent | 266f677f1babbbaa01cb9d3221377db22f01bc9b (diff) | |
Allow VPNs to dynamically add/remove IP addresses on their tun interface.
New API with stub implementation to be filled out later.
Bug: 15409819
Change-Id: Ic0d2d459953eac86832905115a0d413b9b0b2660
Diffstat (limited to 'core/java/android/net/VpnService.java')
| -rw-r--r-- | core/java/android/net/VpnService.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java index 7385dff3ff80..1bd560751f42 100644 --- a/core/java/android/net/VpnService.java +++ b/core/java/android/net/VpnService.java @@ -202,6 +202,44 @@ public class VpnService extends Service { } /** + * Adds a network address to the VPN interface. + * + * Both IPv4 and IPv6 addresses are supported. The VPN must already be established. Fails if the + * address is already in use or cannot be assigned to the interface for any other reason. + * + * @throws {@link IllegalArgumentException} if the address is invalid. + * + * @param address The IP address (IPv4 or IPv6) to assign to the VPN interface. + * @param prefixLength The prefix length of the address. + * + * @return {@code true} on success. + * @see Builder#addAddress + */ + public boolean addAddress(InetAddress address, int prefixLength) { + // TODO + return true; + } + + /** + * Removes a network address from the VPN interface. + * + * Both IPv4 and IPv6 addresses are supported. The VPN must already be established. Fails if the + * address is not assigned to the VPN interface, or if it is the only address assigned (thus + * cannot be removed), or if the address cannot be removed for any other reason. + * + * @throws {@link IllegalArgumentException} if the address is invalid. + * + * @param address The IP address (IPv4 or IPv6) to assign to the VPN interface. + * @param prefixLength The prefix length of the address. + * + * @return {@code true} on success. + */ + public boolean removeAddress(InetAddress address, int prefixLength) { + // TODO + return true; + } + + /** * Return the communication interface to the service. This method returns * {@code null} on {@link Intent}s other than {@link #SERVICE_INTERFACE} * action. Applications overriding this method must identify the intent |
