android: Add fields for local and remote identities to data model
[strongswan.git] / src / frontends / android / app / src / main / java / org / strongswan / android / data / VpnProfile.java
1 /*
2 * Copyright (C) 2012-2016 Tobias Brunner
3 * Copyright (C) 2012 Giuliano Grassi
4 * Copyright (C) 2012 Ralf Sager
5 * HSR Hochschule fuer Technik Rapperswil
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 package org.strongswan.android.data;
19
20
21 public class VpnProfile implements Cloneable
22 {
23 /* While storing this as EnumSet would be nicer this simplifies storing it in a database */
24 public static final int SPLIT_TUNNELING_BLOCK_IPV4 = 1;
25 public static final int SPLIT_TUNNELING_BLOCK_IPV6 = 2;
26
27 private String mName, mGateway, mUsername, mPassword, mCertificate, mUserCertificate;
28 private String mRemoteId, mLocalId;
29 private Integer mMTU, mPort, mSplitTunneling;
30 private VpnType mVpnType;
31 private long mId = -1;
32
33 public long getId()
34 {
35 return mId;
36 }
37
38 public void setId(long id)
39 {
40 this.mId = id;
41 }
42
43 public String getName()
44 {
45 return mName;
46 }
47
48 public void setName(String name)
49 {
50 this.mName = name;
51 }
52
53 public String getGateway()
54 {
55 return mGateway;
56 }
57
58 public void setGateway(String gateway)
59 {
60 this.mGateway = gateway;
61 }
62
63 public VpnType getVpnType()
64 {
65 return mVpnType;
66 }
67
68 public void setVpnType(VpnType type)
69 {
70 this.mVpnType = type;
71 }
72
73 public String getUsername()
74 {
75 return mUsername;
76 }
77
78 public void setUsername(String username)
79 {
80 this.mUsername = username;
81 }
82
83 public String getPassword()
84 {
85 return mPassword;
86 }
87
88 public void setPassword(String password)
89 {
90 this.mPassword = password;
91 }
92
93 public String getCertificateAlias()
94 {
95 return mCertificate;
96 }
97
98 public void setCertificateAlias(String alias)
99 {
100 this.mCertificate = alias;
101 }
102
103 public String getUserCertificateAlias()
104 {
105 return mUserCertificate;
106 }
107
108 public void setUserCertificateAlias(String alias)
109 {
110 this.mUserCertificate = alias;
111 }
112
113 public String getLocalId()
114 {
115 return mLocalId;
116 }
117
118 public void setLocalId(String localId)
119 {
120 this.mLocalId = localId;
121 }
122
123 public String getRemoteId()
124 {
125 return mRemoteId;
126 }
127
128 public void setRemoteId(String remoteId)
129 {
130 this.mRemoteId = remoteId;
131 }
132
133 public Integer getMTU()
134 {
135 return mMTU;
136 }
137
138 public void setMTU(Integer mtu)
139 {
140 this.mMTU = mtu;
141 }
142
143 public Integer getPort()
144 {
145 return mPort;
146 }
147
148 public void setPort(Integer port)
149 {
150 this.mPort = port;
151 }
152
153 public Integer getSplitTunneling()
154 {
155 return mSplitTunneling;
156 }
157
158 public void setSplitTunneling(Integer splitTunneling)
159 {
160 this.mSplitTunneling = splitTunneling;
161 }
162
163 @Override
164 public String toString()
165 {
166 return mName;
167 }
168
169 @Override
170 public boolean equals(Object o)
171 {
172 if (o != null && o instanceof VpnProfile)
173 {
174 return this.mId == ((VpnProfile)o).getId();
175 }
176 return false;
177 }
178
179 @Override
180 public VpnProfile clone()
181 {
182 try
183 {
184 return (VpnProfile)super.clone();
185 }
186 catch (CloneNotSupportedException e)
187 {
188 throw new AssertionError();
189 }
190 }
191 }