android: Add property for excluded subnets to VPN profiles
This commit is contained in:
parent
d852a02717
commit
13ead876ad
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2016 Tobias Brunner
|
||||
* Copyright (C) 2012-2017 Tobias Brunner
|
||||
* Copyright (C) 2012 Giuliano Grassi
|
||||
* Copyright (C) 2012 Ralf Sager
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
|
@ -27,7 +27,7 @@ public class VpnProfile implements Cloneable
|
|||
public static final int SPLIT_TUNNELING_BLOCK_IPV6 = 2;
|
||||
|
||||
private String mName, mGateway, mUsername, mPassword, mCertificate, mUserCertificate;
|
||||
private String mRemoteId, mLocalId;
|
||||
private String mRemoteId, mLocalId, mExcludedSubnets;
|
||||
private Integer mMTU, mPort, mSplitTunneling;
|
||||
private VpnType mVpnType;
|
||||
private UUID mUUID;
|
||||
|
@ -168,6 +168,16 @@ public class VpnProfile implements Cloneable
|
|||
this.mPort = port;
|
||||
}
|
||||
|
||||
public void setExcludedSubnets(String excludedSubnets)
|
||||
{
|
||||
this.mExcludedSubnets = excludedSubnets;
|
||||
}
|
||||
|
||||
public String getExcludedSubnets()
|
||||
{
|
||||
return mExcludedSubnets;
|
||||
}
|
||||
|
||||
public Integer getSplitTunneling()
|
||||
{
|
||||
return mSplitTunneling;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2016 Tobias Brunner
|
||||
* Copyright (C) 2012-2017 Tobias Brunner
|
||||
* Copyright (C) 2012 Giuliano Grassi
|
||||
* Copyright (C) 2012 Ralf Sager
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
|
@ -17,10 +17,6 @@
|
|||
|
||||
package org.strongswan.android.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
|
@ -30,6 +26,10 @@ import android.database.sqlite.SQLiteOpenHelper;
|
|||
import android.database.sqlite.SQLiteQueryBuilder;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class VpnProfileDataSource
|
||||
{
|
||||
private static final String TAG = VpnProfileDataSource.class.getSimpleName();
|
||||
|
@ -47,6 +47,7 @@ public class VpnProfileDataSource
|
|||
public static final String KEY_SPLIT_TUNNELING = "split_tunneling";
|
||||
public static final String KEY_LOCAL_ID = "local_id";
|
||||
public static final String KEY_REMOTE_ID = "remote_id";
|
||||
public static final String KEY_EXCLUDED_SUBNETS = "excluded_subnets";
|
||||
|
||||
private DatabaseHelper mDbHelper;
|
||||
private SQLiteDatabase mDatabase;
|
||||
|
@ -55,7 +56,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 = 9;
|
||||
private static final int DATABASE_VERSION = 10;
|
||||
|
||||
public static final String DATABASE_CREATE =
|
||||
"CREATE TABLE " + TABLE_VPNPROFILE + " (" +
|
||||
|
@ -72,7 +73,8 @@ public class VpnProfileDataSource
|
|||
KEY_PORT + " INTEGER," +
|
||||
KEY_SPLIT_TUNNELING + " INTEGER," +
|
||||
KEY_LOCAL_ID + " TEXT," +
|
||||
KEY_REMOTE_ID + " TEXT" +
|
||||
KEY_REMOTE_ID + " TEXT," +
|
||||
KEY_EXCLUDED_SUBNETS + " TEXT" +
|
||||
");";
|
||||
private static final String[] ALL_COLUMNS = new String[] {
|
||||
KEY_ID,
|
||||
|
@ -89,6 +91,7 @@ public class VpnProfileDataSource
|
|||
KEY_SPLIT_TUNNELING,
|
||||
KEY_LOCAL_ID,
|
||||
KEY_REMOTE_ID,
|
||||
KEY_EXCLUDED_SUBNETS,
|
||||
};
|
||||
|
||||
private static class DatabaseHelper extends SQLiteOpenHelper
|
||||
|
@ -151,6 +154,11 @@ public class VpnProfileDataSource
|
|||
" TEXT;");
|
||||
updateColumns(db);
|
||||
}
|
||||
if (oldVersion < 10)
|
||||
{
|
||||
db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_EXCLUDED_SUBNETS +
|
||||
" TEXT;");
|
||||
}
|
||||
}
|
||||
|
||||
private void updateColumns(SQLiteDatabase db)
|
||||
|
@ -326,6 +334,7 @@ public class VpnProfileDataSource
|
|||
profile.setSplitTunneling(getInt(cursor, cursor.getColumnIndex(KEY_SPLIT_TUNNELING)));
|
||||
profile.setLocalId(cursor.getString(cursor.getColumnIndex(KEY_LOCAL_ID)));
|
||||
profile.setRemoteId(cursor.getString(cursor.getColumnIndex(KEY_REMOTE_ID)));
|
||||
profile.setExcludedSubnets(cursor.getString(cursor.getColumnIndex(KEY_EXCLUDED_SUBNETS)));
|
||||
return profile;
|
||||
}
|
||||
|
||||
|
@ -345,6 +354,7 @@ public class VpnProfileDataSource
|
|||
values.put(KEY_SPLIT_TUNNELING, profile.getSplitTunneling());
|
||||
values.put(KEY_LOCAL_ID, profile.getLocalId());
|
||||
values.put(KEY_REMOTE_ID, profile.getRemoteId());
|
||||
values.put(KEY_EXCLUDED_SUBNETS, profile.getExcludedSubnets());
|
||||
return values;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue