android: Add properties for IKE and ESP proposals
authorTobias Brunner <tobias@strongswan.org>
Tue, 14 Nov 2017 09:18:59 +0000 (10:18 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 17 Nov 2017 13:31:06 +0000 (14:31 +0100)
src/frontends/android/app/src/main/java/org/strongswan/android/data/VpnProfile.java
src/frontends/android/app/src/main/java/org/strongswan/android/data/VpnProfileDataSource.java

index 8288684..00cd393 100644 (file)
@@ -34,6 +34,7 @@ public class VpnProfile implements Cloneable
 
        private String mName, mGateway, mUsername, mPassword, mCertificate, mUserCertificate;
        private String mRemoteId, mLocalId, mExcludedSubnets, mIncludedSubnets, mSelectedApps;
+       private String mIkeProposal, mEspProposal;
        private Integer mMTU, mPort, mSplitTunneling, mNATKeepAlive, mFlags;
        private SelectedAppsHandling mSelectedAppsHandling = SelectedAppsHandling.SELECTED_APPS_DISABLE;
        private VpnType mVpnType;
@@ -114,6 +115,26 @@ public class VpnProfile implements Cloneable
                this.mVpnType = type;
        }
 
+       public String getIkeProposal()
+       {
+               return mIkeProposal;
+       }
+
+       public void setIkeProposal(String proposal)
+       {
+               this.mIkeProposal = proposal;
+       }
+
+       public String getEspProposal()
+       {
+               return mEspProposal;
+       }
+
+       public void setEspProposal(String proposal)
+       {
+               this.mEspProposal = proposal;
+       }
+
        public String getUsername()
        {
                return mUsername;
index d31ad3c..2fef577 100644 (file)
@@ -53,6 +53,8 @@ public class VpnProfileDataSource
        public static final String KEY_SELECTED_APPS_LIST = "selected_apps_list";
        public static final String KEY_NAT_KEEPALIVE = "nat_keepalive";
        public static final String KEY_FLAGS = "flags";
+       public static final String KEY_IKE_PROPOSAL = "ike_proposal";
+       public static final String KEY_ESP_PROPOSAL = "esp_proposal";
 
        private DatabaseHelper mDbHelper;
        private SQLiteDatabase mDatabase;
@@ -61,7 +63,7 @@ public class VpnProfileDataSource
        private static final String DATABASE_NAME = "strongswan.db";
        private static final String TABLE_VPNPROFILE = "vpnprofile";
 
-       private static final int DATABASE_VERSION = 14;
+       private static final int DATABASE_VERSION = 15;
 
        public static final DbColumn[] COLUMNS = new DbColumn[] {
                                                                new DbColumn(KEY_ID, "INTEGER PRIMARY KEY AUTOINCREMENT", 1),
@@ -84,6 +86,8 @@ public class VpnProfileDataSource
                                                                new DbColumn(KEY_SELECTED_APPS_LIST, "TEXT", 12),
                                                                new DbColumn(KEY_NAT_KEEPALIVE, "INTEGER", 13),
                                                                new DbColumn(KEY_FLAGS, "INTEGER", 14),
+                                                               new DbColumn(KEY_IKE_PROPOSAL, "TEXT", 15),
+                                                               new DbColumn(KEY_ESP_PROPOSAL, "TEXT", 15),
                                                        };
 
        private static final String[] ALL_COLUMNS = getColumns(DATABASE_VERSION);
@@ -212,6 +216,13 @@ public class VpnProfileDataSource
                                db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_FLAGS +
                                                   " INTEGER;");
                        }
+                       if (oldVersion < 15)
+                       {
+                               db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_IKE_PROPOSAL +
+                                                  " TEXT;");
+                               db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_ESP_PROPOSAL +
+                                                  " TEXT;");
+                       }
                }
 
                private void updateColumns(SQLiteDatabase db, int version)
@@ -393,6 +404,8 @@ public class VpnProfileDataSource
                profile.setSelectedApps(cursor.getString(cursor.getColumnIndex(KEY_SELECTED_APPS_LIST)));
                profile.setNATKeepAlive(getInt(cursor, cursor.getColumnIndex(KEY_NAT_KEEPALIVE)));
                profile.setFlags(getInt(cursor, cursor.getColumnIndex(KEY_FLAGS)));
+               profile.setIkeProposal(cursor.getString(cursor.getColumnIndex(KEY_IKE_PROPOSAL)));
+               profile.setEspProposal(cursor.getString(cursor.getColumnIndex(KEY_ESP_PROPOSAL)));
                return profile;
        }
 
@@ -418,6 +431,8 @@ public class VpnProfileDataSource
                values.put(KEY_SELECTED_APPS_LIST, profile.getSelectedApps());
                values.put(KEY_NAT_KEEPALIVE, profile.getNATKeepAlive());
                values.put(KEY_FLAGS, profile.getFlags());
+               values.put(KEY_IKE_PROPOSAL, profile.getIkeProposal());
+               values.put(KEY_ESP_PROPOSAL, profile.getEspProposal());
                return values;
        }