public class VpnProfile implements Cloneable
{
private String mName, mGateway, mUsername, mPassword, mCertificate, mUserCertificate;
- private Integer mMTU;
+ private Integer mMTU, mPort;
private VpnType mVpnType;
private long mId = -1;
this.mMTU = mtu;
}
+ public Integer getPort()
+ {
+ return mPort;
+ }
+
+ public void setPort(Integer port)
+ {
+ this.mPort = port;
+ }
+
@Override
public String toString()
{
public static final String KEY_CERTIFICATE = "certificate";
public static final String KEY_USER_CERTIFICATE = "user_certificate";
public static final String KEY_MTU = "mtu";
+ public static final String KEY_PORT = "port";
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDatabase;
private static final String DATABASE_NAME = "strongswan.db";
private static final String TABLE_VPNPROFILE = "vpnprofile";
- private static final int DATABASE_VERSION = 5;
+ private static final int DATABASE_VERSION = 6;
public static final String DATABASE_CREATE =
"CREATE TABLE " + TABLE_VPNPROFILE + " (" +
KEY_PASSWORD + " TEXT," +
KEY_CERTIFICATE + " TEXT," +
KEY_USER_CERTIFICATE + " TEXT," +
- KEY_MTU + " INTEGER" +
+ KEY_MTU + " INTEGER," +
+ KEY_PORT + " INTEGER" +
");";
private static final String[] ALL_COLUMNS = new String[] {
KEY_ID,
KEY_CERTIFICATE,
KEY_USER_CERTIFICATE,
KEY_MTU,
+ KEY_PORT,
};
private static class DatabaseHelper extends SQLiteOpenHelper
db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_MTU +
" INTEGER;");
}
+ if (oldVersion < 6)
+ {
+ db.execSQL("ALTER TABLE " + TABLE_VPNPROFILE + " ADD " + KEY_PORT +
+ " INTEGER;");
+ }
}
private void updateColumns(SQLiteDatabase db)
profile.setCertificateAlias(cursor.getString(cursor.getColumnIndex(KEY_CERTIFICATE)));
profile.setUserCertificateAlias(cursor.getString(cursor.getColumnIndex(KEY_USER_CERTIFICATE)));
profile.setMTU(getInt(cursor, cursor.getColumnIndex(KEY_MTU)));
+ profile.setPort(getInt(cursor, cursor.getColumnIndex(KEY_PORT)));
return profile;
}
values.put(KEY_CERTIFICATE, profile.getCertificateAlias());
values.put(KEY_USER_CERTIFICATE, profile.getUserCertificateAlias());
values.put(KEY_MTU, profile.getMTU());
+ values.put(KEY_PORT, profile.getPort());
return values;
}