android: Add properties for DNS servers
This commit is contained in:
+12
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2018 Tobias Brunner
|
||||
* Copyright (C) 2012-2019 Tobias Brunner
|
||||
* Copyright (C) 2012 Giuliano Grassi
|
||||
* Copyright (C) 2012 Ralf Sager
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
@@ -39,7 +39,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 String mIkeProposal, mEspProposal, mDnsServers;
|
||||
private Integer mMTU, mPort, mSplitTunneling, mNATKeepAlive, mFlags;
|
||||
private SelectedAppsHandling mSelectedAppsHandling = SelectedAppsHandling.SELECTED_APPS_DISABLE;
|
||||
private VpnType mVpnType;
|
||||
@@ -140,6 +140,16 @@ public class VpnProfile implements Cloneable
|
||||
this.mEspProposal = proposal;
|
||||
}
|
||||
|
||||
public String getDnsServers()
|
||||
{
|
||||
return mDnsServers;
|
||||
}
|
||||
|
||||
public void setDnsServers(String dns)
|
||||
{
|
||||
this.mDnsServers = dns;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return mUsername;
|
||||
|
||||
+11
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2018 Tobias Brunner
|
||||
* Copyright (C) 2012-2019 Tobias Brunner
|
||||
* Copyright (C) 2012 Giuliano Grassi
|
||||
* Copyright (C) 2012 Ralf Sager
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
@@ -55,6 +55,7 @@ public class VpnProfileDataSource
|
||||
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";
|
||||
public static final String KEY_DNS_SERVERS = "dns_servers";
|
||||
|
||||
private DatabaseHelper mDbHelper;
|
||||
private SQLiteDatabase mDatabase;
|
||||
@@ -63,7 +64,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 = 16;
|
||||
private static final int DATABASE_VERSION = 17;
|
||||
|
||||
public static final DbColumn[] COLUMNS = new DbColumn[] {
|
||||
new DbColumn(KEY_ID, "INTEGER PRIMARY KEY AUTOINCREMENT", 1),
|
||||
@@ -88,6 +89,7 @@ public class VpnProfileDataSource
|
||||
new DbColumn(KEY_FLAGS, "INTEGER", 14),
|
||||
new DbColumn(KEY_IKE_PROPOSAL, "TEXT", 15),
|
||||
new DbColumn(KEY_ESP_PROPOSAL, "TEXT", 15),
|
||||
new DbColumn(KEY_DNS_SERVERS, "TEXT", 17),
|
||||
};
|
||||
|
||||
private static final String[] ALL_COLUMNS = getColumns(DATABASE_VERSION);
|
||||
@@ -243,6 +245,11 @@ public class VpnProfileDataSource
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
if (oldVersion < 17)
|
||||
{
|
||||
db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_DNS_SERVERS +
|
||||
" TEXT;");
|
||||
}
|
||||
}
|
||||
|
||||
private void updateColumns(SQLiteDatabase db, int version)
|
||||
@@ -448,6 +455,7 @@ public class VpnProfileDataSource
|
||||
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)));
|
||||
profile.setDnsServers(cursor.getString(cursor.getColumnIndex(KEY_DNS_SERVERS)));
|
||||
return profile;
|
||||
}
|
||||
|
||||
@@ -475,6 +483,7 @@ public class VpnProfileDataSource
|
||||
values.put(KEY_FLAGS, profile.getFlags());
|
||||
values.put(KEY_IKE_PROPOSAL, profile.getIkeProposal());
|
||||
values.put(KEY_ESP_PROPOSAL, profile.getEspProposal());
|
||||
values.put(KEY_DNS_SERVERS, profile.getDnsServers());
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user