diff options
author | Hung-ying Tyan <tyanh@google.com> | 2009-06-19 19:45:38 +0800 |
---|---|---|
committer | Hung-ying Tyan <tyanh@google.com> | 2009-06-26 03:02:22 +0800 |
commit | d3aba7f7b67c758b2b325276538da6e1350cce69 (patch) | |
tree | 9149e225ffb40e6a65e94ee60339c8fee4159598 /vpn | |
parent | eaa89f74c04c0f10d5f3f8190b457087537bff2e (diff) | |
download | frameworks_base-d3aba7f7b67c758b2b325276538da6e1350cce69.zip frameworks_base-d3aba7f7b67c758b2b325276538da6e1350cce69.tar.gz frameworks_base-d3aba7f7b67c758b2b325276538da6e1350cce69.tar.bz2 |
Add PPTP, L2TP/IPSec preshared key and other fixes.
* Changes
+ Add PptpProfile.java, PptpService.java.
+ Add L2tpIpsecPskProfile.java
+ Add PPTP and L2TP_IPSEC_PSK entries in VpnType.java.
+ Add the secret option to L2tpProfile.java and have L2tpIpsecProfile
extend it.
+ Add MtpdHelper to send common PPP options.
+ Add getGatewayIp() to VpnService().
+ Revise VpnService.reallyGetHostIp().
Patch Set 6, 7, 8:
+ Add L2TP secret flag in L2tpProfile.
Patch Set 9:
+ Add description to VpnType.
Patch Set 11:
+ Pass ipparam to mtpd.
Patch Set 12:
+ Add L2TP secret support
+ Fix string constants
Diffstat (limited to 'vpn')
-rw-r--r-- | vpn/java/android/net/vpn/IVpnService.aidl | 2 | ||||
-rw-r--r-- | vpn/java/android/net/vpn/L2tpIpsecProfile.java | 17 | ||||
-rw-r--r-- | vpn/java/android/net/vpn/L2tpIpsecPskProfile.java | 54 | ||||
-rw-r--r-- | vpn/java/android/net/vpn/L2tpProfile.java | 40 | ||||
-rw-r--r-- | vpn/java/android/net/vpn/PptpProfile.java | 30 | ||||
-rw-r--r-- | vpn/java/android/net/vpn/VpnManager.java | 2 | ||||
-rw-r--r-- | vpn/java/android/net/vpn/VpnProfile.aidl | 2 | ||||
-rw-r--r-- | vpn/java/android/net/vpn/VpnProfile.java | 2 | ||||
-rw-r--r-- | vpn/java/android/net/vpn/VpnState.java | 2 | ||||
-rw-r--r-- | vpn/java/android/net/vpn/VpnType.java | 19 |
10 files changed, 146 insertions, 24 deletions
diff --git a/vpn/java/android/net/vpn/IVpnService.aidl b/vpn/java/android/net/vpn/IVpnService.aidl index 0e658df..fedccb0 100644 --- a/vpn/java/android/net/vpn/IVpnService.aidl +++ b/vpn/java/android/net/vpn/IVpnService.aidl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/L2tpIpsecProfile.java b/vpn/java/android/net/vpn/L2tpIpsecProfile.java index 181619d..4ae2dec 100644 --- a/vpn/java/android/net/vpn/L2tpIpsecProfile.java +++ b/vpn/java/android/net/vpn/L2tpIpsecProfile.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,15 +19,14 @@ package android.net.vpn; import android.os.Parcel; /** - * The profile for L2TP-over-IPSec type of VPN. + * The profile for certificate-based L2TP-over-IPSec type of VPN. * {@hide} */ -public class L2tpIpsecProfile extends VpnProfile { +public class L2tpIpsecProfile extends L2tpProfile { private static final long serialVersionUID = 1L; private String mUserCertificate; private String mCaCertificate; - private String mUserkey; @Override public VpnType getType() { @@ -50,20 +49,11 @@ public class L2tpIpsecProfile extends VpnProfile { return mUserCertificate; } - public void setUserkey(String name) { - mUserkey = name; - } - - public String getUserkey() { - return mUserkey; - } - @Override protected void readFromParcel(Parcel in) { super.readFromParcel(in); mCaCertificate = in.readString(); mUserCertificate = in.readString(); - mUserkey = in.readString(); } @Override @@ -71,6 +61,5 @@ public class L2tpIpsecProfile extends VpnProfile { super.writeToParcel(parcel, flags); parcel.writeString(mCaCertificate); parcel.writeString(mUserCertificate); - parcel.writeString(mUserkey); } } diff --git a/vpn/java/android/net/vpn/L2tpIpsecPskProfile.java b/vpn/java/android/net/vpn/L2tpIpsecPskProfile.java new file mode 100644 index 0000000..7a03018 --- /dev/null +++ b/vpn/java/android/net/vpn/L2tpIpsecPskProfile.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2009, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.net.vpn; + +import android.os.Parcel; + +/** + * The profile for pre-shared-key-based L2TP-over-IPSec type of VPN. + * {@hide} + */ +public class L2tpIpsecPskProfile extends L2tpProfile { + private static final long serialVersionUID = 1L; + + private String mPresharedKey; + + @Override + public VpnType getType() { + return VpnType.L2TP_IPSEC_PSK; + } + + public void setPresharedKey(String key) { + mPresharedKey = key; + } + + public String getPresharedKey() { + return mPresharedKey; + } + + @Override + protected void readFromParcel(Parcel in) { + super.readFromParcel(in); + mPresharedKey = in.readString(); + } + + @Override + public void writeToParcel(Parcel parcel, int flags) { + super.writeToParcel(parcel, flags); + parcel.writeString(mPresharedKey); + } +} diff --git a/vpn/java/android/net/vpn/L2tpProfile.java b/vpn/java/android/net/vpn/L2tpProfile.java index 59d4981..dbba0c5 100644 --- a/vpn/java/android/net/vpn/L2tpProfile.java +++ b/vpn/java/android/net/vpn/L2tpProfile.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package android.net.vpn; +import android.os.Parcel; + /** * The profile for L2TP type of VPN. * {@hide} @@ -23,8 +25,44 @@ package android.net.vpn; public class L2tpProfile extends VpnProfile { private static final long serialVersionUID = 1L; + private boolean mSecret; + private String mSecretString; + @Override public VpnType getType() { return VpnType.L2TP; } + + /** + * Enables/disables the secret for authenticating tunnel connection. + */ + public void setSecretEnabled(boolean enabled) { + mSecret = enabled; + } + + public boolean isSecretEnabled() { + return mSecret; + } + + public void setSecretString(String secret) { + mSecretString = secret; + } + + public String getSecretString() { + return mSecretString; + } + + @Override + protected void readFromParcel(Parcel in) { + super.readFromParcel(in); + mSecret = in.readInt() > 0; + mSecretString = in.readString(); + } + + @Override + public void writeToParcel(Parcel parcel, int flags) { + super.writeToParcel(parcel, flags); + parcel.writeInt(mSecret ? 1 : 0); + parcel.writeString(mSecretString); + } } diff --git a/vpn/java/android/net/vpn/PptpProfile.java b/vpn/java/android/net/vpn/PptpProfile.java new file mode 100644 index 0000000..c68bb71 --- /dev/null +++ b/vpn/java/android/net/vpn/PptpProfile.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.net.vpn; + +/** + * The profile for PPTP type of VPN. + * {@hide} + */ +public class PptpProfile extends VpnProfile { + private static final long serialVersionUID = 1L; + + @Override + public VpnType getType() { + return VpnType.PPTP; + } +} diff --git a/vpn/java/android/net/vpn/VpnManager.java b/vpn/java/android/net/vpn/VpnManager.java index 98795bd..dc70b26 100644 --- a/vpn/java/android/net/vpn/VpnManager.java +++ b/vpn/java/android/net/vpn/VpnManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/VpnProfile.aidl b/vpn/java/android/net/vpn/VpnProfile.aidl index ad34bfc..edeaef0 100644 --- a/vpn/java/android/net/vpn/VpnProfile.aidl +++ b/vpn/java/android/net/vpn/VpnProfile.aidl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/VpnProfile.java b/vpn/java/android/net/vpn/VpnProfile.java index 9e24da4..bd6c809 100644 --- a/vpn/java/android/net/vpn/VpnProfile.java +++ b/vpn/java/android/net/vpn/VpnProfile.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/VpnState.java b/vpn/java/android/net/vpn/VpnState.java index 977d938..ebd9364 100644 --- a/vpn/java/android/net/vpn/VpnState.java +++ b/vpn/java/android/net/vpn/VpnState.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/VpnType.java b/vpn/java/android/net/vpn/VpnType.java index 91b0ea2..c7df943 100644 --- a/vpn/java/android/net/vpn/VpnType.java +++ b/vpn/java/android/net/vpn/VpnType.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +21,21 @@ package android.net.vpn; * {@hide} */ public enum VpnType { - L2TP_IPSEC("L2TP/IPSec", L2tpIpsecProfile.class), - L2TP("L2TP", L2tpProfile.class); + PPTP("PPTP", "", PptpProfile.class), + L2TP("L2TP", "", L2tpProfile.class), + L2TP_IPSEC_PSK("L2TP/IPSec PSK", "Pre-shared key based L2TP/IPSec VPN", + L2tpIpsecPskProfile.class), + L2TP_IPSEC("L2TP/IPSec CRT", "Certificate based L2TP/IPSec VPN", + L2tpIpsecProfile.class); private String mDisplayName; + private String mDescription; private Class<? extends VpnProfile> mClass; - VpnType(String displayName, Class<? extends VpnProfile> klass) { + VpnType(String displayName, String description, + Class<? extends VpnProfile> klass) { mDisplayName = displayName; + mDescription = description; mClass = klass; } @@ -36,6 +43,10 @@ public enum VpnType { return mDisplayName; } + public String getDescription() { + return mDescription; + } + public Class<? extends VpnProfile> getProfileClass() { return mClass; } |