android: Add property for NAT-T keepalive interval
This commit is contained in:
+11
-1
@@ -33,7 +33,7 @@ public class VpnProfile implements Cloneable
|
|||||||
|
|
||||||
private String mName, mGateway, mUsername, mPassword, mCertificate, mUserCertificate;
|
private String mName, mGateway, mUsername, mPassword, mCertificate, mUserCertificate;
|
||||||
private String mRemoteId, mLocalId, mExcludedSubnets, mIncludedSubnets, mSelectedApps;
|
private String mRemoteId, mLocalId, mExcludedSubnets, mIncludedSubnets, mSelectedApps;
|
||||||
private Integer mMTU, mPort, mSplitTunneling;
|
private Integer mMTU, mPort, mSplitTunneling, mNATKeepAlive;
|
||||||
private SelectedAppsHandling mSelectedAppsHandling = SelectedAppsHandling.SELECTED_APPS_DISABLE;
|
private SelectedAppsHandling mSelectedAppsHandling = SelectedAppsHandling.SELECTED_APPS_DISABLE;
|
||||||
private VpnType mVpnType;
|
private VpnType mVpnType;
|
||||||
private UUID mUUID;
|
private UUID mUUID;
|
||||||
@@ -193,6 +193,16 @@ public class VpnProfile implements Cloneable
|
|||||||
this.mPort = port;
|
this.mPort = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getNATKeepAlive()
|
||||||
|
{
|
||||||
|
return mNATKeepAlive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNATKeepAlive(Integer keepalive)
|
||||||
|
{
|
||||||
|
this.mNATKeepAlive = keepalive;
|
||||||
|
}
|
||||||
|
|
||||||
public void setExcludedSubnets(String excludedSubnets)
|
public void setExcludedSubnets(String excludedSubnets)
|
||||||
{
|
{
|
||||||
this.mExcludedSubnets = excludedSubnets;
|
this.mExcludedSubnets = excludedSubnets;
|
||||||
|
|||||||
+12
-2
@@ -51,6 +51,7 @@ public class VpnProfileDataSource
|
|||||||
public static final String KEY_INCLUDED_SUBNETS = "included_subnets";
|
public static final String KEY_INCLUDED_SUBNETS = "included_subnets";
|
||||||
public static final String KEY_SELECTED_APPS = "selected_apps";
|
public static final String KEY_SELECTED_APPS = "selected_apps";
|
||||||
public static final String KEY_SELECTED_APPS_LIST = "selected_apps_list";
|
public static final String KEY_SELECTED_APPS_LIST = "selected_apps_list";
|
||||||
|
public static final String KEY_NAT_KEEPALIVE = "nat_keepalive";
|
||||||
|
|
||||||
private DatabaseHelper mDbHelper;
|
private DatabaseHelper mDbHelper;
|
||||||
private SQLiteDatabase mDatabase;
|
private SQLiteDatabase mDatabase;
|
||||||
@@ -59,7 +60,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 = 12;
|
private static final int DATABASE_VERSION = 13;
|
||||||
|
|
||||||
public static final String DATABASE_CREATE =
|
public static final String DATABASE_CREATE =
|
||||||
"CREATE TABLE " + TABLE_VPNPROFILE + " (" +
|
"CREATE TABLE " + TABLE_VPNPROFILE + " (" +
|
||||||
@@ -80,7 +81,8 @@ public class VpnProfileDataSource
|
|||||||
KEY_EXCLUDED_SUBNETS + " TEXT," +
|
KEY_EXCLUDED_SUBNETS + " TEXT," +
|
||||||
KEY_INCLUDED_SUBNETS + " TEXT," +
|
KEY_INCLUDED_SUBNETS + " TEXT," +
|
||||||
KEY_SELECTED_APPS + " INTEGER," +
|
KEY_SELECTED_APPS + " INTEGER," +
|
||||||
KEY_SELECTED_APPS_LIST + " TEXT" +
|
KEY_SELECTED_APPS_LIST + " TEXT," +
|
||||||
|
KEY_NAT_KEEPALIVE + " INTEGER" +
|
||||||
");";
|
");";
|
||||||
private static final String[] ALL_COLUMNS = new String[] {
|
private static final String[] ALL_COLUMNS = new String[] {
|
||||||
KEY_ID,
|
KEY_ID,
|
||||||
@@ -101,6 +103,7 @@ public class VpnProfileDataSource
|
|||||||
KEY_INCLUDED_SUBNETS,
|
KEY_INCLUDED_SUBNETS,
|
||||||
KEY_SELECTED_APPS,
|
KEY_SELECTED_APPS,
|
||||||
KEY_SELECTED_APPS_LIST,
|
KEY_SELECTED_APPS_LIST,
|
||||||
|
KEY_NAT_KEEPALIVE,
|
||||||
};
|
};
|
||||||
|
|
||||||
private static class DatabaseHelper extends SQLiteOpenHelper
|
private static class DatabaseHelper extends SQLiteOpenHelper
|
||||||
@@ -180,6 +183,11 @@ public class VpnProfileDataSource
|
|||||||
db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_SELECTED_APPS_LIST +
|
db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_SELECTED_APPS_LIST +
|
||||||
" TEXT;");
|
" TEXT;");
|
||||||
}
|
}
|
||||||
|
if (oldVersion < 13)
|
||||||
|
{
|
||||||
|
db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_NAT_KEEPALIVE +
|
||||||
|
" INTEGER;");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateColumns(SQLiteDatabase db)
|
private void updateColumns(SQLiteDatabase db)
|
||||||
@@ -359,6 +367,7 @@ public class VpnProfileDataSource
|
|||||||
profile.setIncludedSubnets(cursor.getString(cursor.getColumnIndex(KEY_INCLUDED_SUBNETS)));
|
profile.setIncludedSubnets(cursor.getString(cursor.getColumnIndex(KEY_INCLUDED_SUBNETS)));
|
||||||
profile.setSelectedAppsHandling(getInt(cursor, cursor.getColumnIndex(KEY_SELECTED_APPS)));
|
profile.setSelectedAppsHandling(getInt(cursor, cursor.getColumnIndex(KEY_SELECTED_APPS)));
|
||||||
profile.setSelectedApps(cursor.getString(cursor.getColumnIndex(KEY_SELECTED_APPS_LIST)));
|
profile.setSelectedApps(cursor.getString(cursor.getColumnIndex(KEY_SELECTED_APPS_LIST)));
|
||||||
|
profile.setNATKeepAlive(getInt(cursor, cursor.getColumnIndex(KEY_NAT_KEEPALIVE)));
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,6 +391,7 @@ public class VpnProfileDataSource
|
|||||||
values.put(KEY_INCLUDED_SUBNETS, profile.getIncludedSubnets());
|
values.put(KEY_INCLUDED_SUBNETS, profile.getIncludedSubnets());
|
||||||
values.put(KEY_SELECTED_APPS, profile.getSelectedAppsHandling().getValue());
|
values.put(KEY_SELECTED_APPS, profile.getSelectedAppsHandling().getValue());
|
||||||
values.put(KEY_SELECTED_APPS_LIST, profile.getSelectedApps());
|
values.put(KEY_SELECTED_APPS_LIST, profile.getSelectedApps());
|
||||||
|
values.put(KEY_NAT_KEEPALIVE, profile.getNATKeepAlive());
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user