summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/VpnProfile.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-04-23 00:07:02 +0200
committerArne Schwabe <arne@rfc2549.org>2012-04-23 00:07:02 +0200
commit58e2574f6a27930679f976278ad9c3dbc8d4ef2a (patch)
treeed66e30a6d1acf1fcb68672cb636507e0bd89d2a /src/de/blinkt/openvpn/VpnProfile.java
parent488a41cc60636298581c2b44b4706b259fc98a36 (diff)
Doing progress on the Preference dialog chaos
Diffstat (limited to 'src/de/blinkt/openvpn/VpnProfile.java')
-rw-r--r--src/de/blinkt/openvpn/VpnProfile.java106
1 files changed, 105 insertions, 1 deletions
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java
index 8d5fbe32..0eddabaa 100644
--- a/src/de/blinkt/openvpn/VpnProfile.java
+++ b/src/de/blinkt/openvpn/VpnProfile.java
@@ -1,10 +1,114 @@
package de.blinkt.openvpn;
-public class VpnProfile {
+import java.io.Serializable;
+import java.util.UUID;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class VpnProfile implements Parcelable, Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7085688938959334563L;
static final int TYPE_CERTIFICATES=0;
static final int TYPE_PKCS12=1;
static final int TYPE_KEYSTORE=2;
public static final int TYPE_USERPASS = 3;
public static final int TYPE_STATICKEYS = 4;
+
+ // Keep in order of parceling
+ // Public attributes, since I got mad with getter/setter
+ // set members to default values
+ private UUID mUuid;
+ public int mAuthenticationType = TYPE_KEYSTORE ;
+ public String mName;
+ public String mAlias;
+ public String mClientCertFilename;
+ public int mTLSAuthDirection=2;
+ public String mTLSAuthFilename;
+ public String mClientKeyFilename;
+ public String mCaFilename;
+ public boolean mUseLzo=true;
+ public String mServerPort= "1194" ;
+ public boolean mUseUdp = true;
+ public String mPKCS12Filename;
+ public String mPKCS12Password;
+ public boolean mUseTLSAuth = false;
+ public String mServerName = "openvpn.blinkt.de" ;
+
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeInt(mAuthenticationType);
+ out.writeLong(mUuid.getMostSignificantBits());
+ out.writeLong(mUuid.getLeastSignificantBits());
+ out.writeString(mName);
+ out.writeString(mAlias);
+ out.writeString(mClientCertFilename);
+ out.writeInt(mTLSAuthDirection);
+ out.writeString(mTLSAuthFilename);
+ out.writeString(mClientKeyFilename);
+ out.writeString(mCaFilename);
+ out.writeValue(mUseLzo);
+ out.writeString(mServerPort);
+ out.writeValue(mUseUdp);
+ out.writeString(mPKCS12Filename);
+ out.writeString(mPKCS12Password);
+ out.writeValue(mUseTLSAuth);
+ out.writeString(mServerName);
+ }
+
+ private VpnProfile(Parcel in) {
+ mAuthenticationType = in.readInt();
+ mUuid = new UUID(in.readLong(), in.readLong());
+ mName = in.readString();
+ mAlias = in.readString();
+ mClientCertFilename = in.readString();
+ mTLSAuthDirection = in.readInt();
+ mTLSAuthFilename = in.readString();
+ mClientKeyFilename = in.readString();
+ mCaFilename = in.readString();
+ mUseLzo = (Boolean) in.readValue(null);
+ mServerPort = in.readString();
+ mUseUdp = (Boolean) in.readValue(null);
+ mPKCS12Filename = in.readString();
+ mPKCS12Password = in.readString();
+ mUseTLSAuth = (Boolean) in.readValue(null);
+ mServerName = in.readString();
+ }
+
+ public static final Parcelable.Creator<VpnProfile> CREATOR
+ = new Parcelable.Creator<VpnProfile>() {
+ public VpnProfile createFromParcel(Parcel in) {
+ return new VpnProfile(in);
+ }
+
+ public VpnProfile[] newArray(int size) {
+ return new VpnProfile[size];
+ }
+ };
+
+ public VpnProfile(String name) {
+ mUuid = UUID.randomUUID();
+ mName = name;
+ }
+
+ public UUID getUUID() {
+ return mUuid;
+
+ }
+
+ public String getName() {
+ // TODO Auto-generated method stub
+ return mName;
+ }
+
+
+
+
}