android: Add property for included subnets to VPN profiles
This commit is contained in:
+11
-1
@@ -27,7 +27,7 @@ public class VpnProfile implements Cloneable
|
|||||||
public static final int SPLIT_TUNNELING_BLOCK_IPV6 = 2;
|
public static final int SPLIT_TUNNELING_BLOCK_IPV6 = 2;
|
||||||
|
|
||||||
private String mName, mGateway, mUsername, mPassword, mCertificate, mUserCertificate;
|
private String mName, mGateway, mUsername, mPassword, mCertificate, mUserCertificate;
|
||||||
private String mRemoteId, mLocalId, mExcludedSubnets;
|
private String mRemoteId, mLocalId, mExcludedSubnets, mIncludedSubnets;
|
||||||
private Integer mMTU, mPort, mSplitTunneling;
|
private Integer mMTU, mPort, mSplitTunneling;
|
||||||
private VpnType mVpnType;
|
private VpnType mVpnType;
|
||||||
private UUID mUUID;
|
private UUID mUUID;
|
||||||
@@ -178,6 +178,16 @@ public class VpnProfile implements Cloneable
|
|||||||
return mExcludedSubnets;
|
return mExcludedSubnets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIncludedSubnets(String includedSubnets)
|
||||||
|
{
|
||||||
|
this.mIncludedSubnets = includedSubnets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIncludedSubnets()
|
||||||
|
{
|
||||||
|
return mIncludedSubnets;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getSplitTunneling()
|
public Integer getSplitTunneling()
|
||||||
{
|
{
|
||||||
return mSplitTunneling;
|
return mSplitTunneling;
|
||||||
|
|||||||
+12
-2
@@ -48,6 +48,7 @@ public class VpnProfileDataSource
|
|||||||
public static final String KEY_LOCAL_ID = "local_id";
|
public static final String KEY_LOCAL_ID = "local_id";
|
||||||
public static final String KEY_REMOTE_ID = "remote_id";
|
public static final String KEY_REMOTE_ID = "remote_id";
|
||||||
public static final String KEY_EXCLUDED_SUBNETS = "excluded_subnets";
|
public static final String KEY_EXCLUDED_SUBNETS = "excluded_subnets";
|
||||||
|
public static final String KEY_INCLUDED_SUBNETS = "included_subnets";
|
||||||
|
|
||||||
private DatabaseHelper mDbHelper;
|
private DatabaseHelper mDbHelper;
|
||||||
private SQLiteDatabase mDatabase;
|
private SQLiteDatabase mDatabase;
|
||||||
@@ -56,7 +57,7 @@ public class VpnProfileDataSource
|
|||||||
private static final String DATABASE_NAME = "strongswan.db";
|
private static final String DATABASE_NAME = "strongswan.db";
|
||||||
private static final String TABLE_VPNPROFILE = "vpnprofile";
|
private static final String TABLE_VPNPROFILE = "vpnprofile";
|
||||||
|
|
||||||
private static final int DATABASE_VERSION = 10;
|
private static final int DATABASE_VERSION = 11;
|
||||||
|
|
||||||
public static final String DATABASE_CREATE =
|
public static final String DATABASE_CREATE =
|
||||||
"CREATE TABLE " + TABLE_VPNPROFILE + " (" +
|
"CREATE TABLE " + TABLE_VPNPROFILE + " (" +
|
||||||
@@ -74,7 +75,8 @@ public class VpnProfileDataSource
|
|||||||
KEY_SPLIT_TUNNELING + " INTEGER," +
|
KEY_SPLIT_TUNNELING + " INTEGER," +
|
||||||
KEY_LOCAL_ID + " TEXT," +
|
KEY_LOCAL_ID + " TEXT," +
|
||||||
KEY_REMOTE_ID + " TEXT," +
|
KEY_REMOTE_ID + " TEXT," +
|
||||||
KEY_EXCLUDED_SUBNETS + " TEXT" +
|
KEY_EXCLUDED_SUBNETS + " TEXT," +
|
||||||
|
KEY_INCLUDED_SUBNETS + " TEXT" +
|
||||||
");";
|
");";
|
||||||
private static final String[] ALL_COLUMNS = new String[] {
|
private static final String[] ALL_COLUMNS = new String[] {
|
||||||
KEY_ID,
|
KEY_ID,
|
||||||
@@ -92,6 +94,7 @@ public class VpnProfileDataSource
|
|||||||
KEY_LOCAL_ID,
|
KEY_LOCAL_ID,
|
||||||
KEY_REMOTE_ID,
|
KEY_REMOTE_ID,
|
||||||
KEY_EXCLUDED_SUBNETS,
|
KEY_EXCLUDED_SUBNETS,
|
||||||
|
KEY_INCLUDED_SUBNETS,
|
||||||
};
|
};
|
||||||
|
|
||||||
private static class DatabaseHelper extends SQLiteOpenHelper
|
private static class DatabaseHelper extends SQLiteOpenHelper
|
||||||
@@ -159,6 +162,11 @@ public class VpnProfileDataSource
|
|||||||
db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_EXCLUDED_SUBNETS +
|
db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_EXCLUDED_SUBNETS +
|
||||||
" TEXT;");
|
" TEXT;");
|
||||||
}
|
}
|
||||||
|
if (oldVersion < 11)
|
||||||
|
{
|
||||||
|
db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_INCLUDED_SUBNETS +
|
||||||
|
" TEXT;");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateColumns(SQLiteDatabase db)
|
private void updateColumns(SQLiteDatabase db)
|
||||||
@@ -335,6 +343,7 @@ public class VpnProfileDataSource
|
|||||||
profile.setLocalId(cursor.getString(cursor.getColumnIndex(KEY_LOCAL_ID)));
|
profile.setLocalId(cursor.getString(cursor.getColumnIndex(KEY_LOCAL_ID)));
|
||||||
profile.setRemoteId(cursor.getString(cursor.getColumnIndex(KEY_REMOTE_ID)));
|
profile.setRemoteId(cursor.getString(cursor.getColumnIndex(KEY_REMOTE_ID)));
|
||||||
profile.setExcludedSubnets(cursor.getString(cursor.getColumnIndex(KEY_EXCLUDED_SUBNETS)));
|
profile.setExcludedSubnets(cursor.getString(cursor.getColumnIndex(KEY_EXCLUDED_SUBNETS)));
|
||||||
|
profile.setIncludedSubnets(cursor.getString(cursor.getColumnIndex(KEY_INCLUDED_SUBNETS)));
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,6 +364,7 @@ public class VpnProfileDataSource
|
|||||||
values.put(KEY_LOCAL_ID, profile.getLocalId());
|
values.put(KEY_LOCAL_ID, profile.getLocalId());
|
||||||
values.put(KEY_REMOTE_ID, profile.getRemoteId());
|
values.put(KEY_REMOTE_ID, profile.getRemoteId());
|
||||||
values.put(KEY_EXCLUDED_SUBNETS, profile.getExcludedSubnets());
|
values.put(KEY_EXCLUDED_SUBNETS, profile.getExcludedSubnets());
|
||||||
|
values.put(KEY_INCLUDED_SUBNETS, profile.getIncludedSubnets());
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user