5c64ad0e5d0b644bb9bea171a5cd359499e6bd56
[strongswan.git] / src / frontends / android / app / src / main / java / org / strongswan / android / data / VpnProfile.java
1 /*
2 * Copyright (C) 2012-2015 Tobias Brunner
3 * Copyright (C) 2012 Giuliano Grassi
4 * Copyright (C) 2012 Ralf Sager
5 * 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 Integer mMTU, mPort, mSplitTunneling;
29 private VpnType mVpnType;
30 private long mId = -1;
31
32 public long getId()
33 {
34 return mId;
35 }
36
37 public void setId(long id)
38 {
39 this.mId = id;
40 }
41
42 public String getName()
43 {
44 return mName;
45 }
46
47 public void setName(String name)
48 {
49 this.mName = name;
50 }
51
52 public String getGateway()
53 {
54 return mGateway;
55 }
56
57 public void setGateway(String gateway)
58 {
59 this.mGateway = gateway;
60 }
61
62 public VpnType getVpnType()
63 {
64 return mVpnType;
65 }
66
67 public void setVpnType(VpnType type)
68 {
69 this.mVpnType = type;
70 }
71
72 public String getUsername()
73 {
74 return mUsername;
75 }
76
77 public void setUsername(String username)
78 {
79 this.mUsername = username;
80 }
81
82 public String getPassword()
83 {
84 return mPassword;
85 }
86
87 public void setPassword(String password)
88 {
89 this.mPassword = password;
90 }
91
92 public String getCertificateAlias()
93 {
94 return mCertificate;
95 }
96
97 public void setCertificateAlias(String alias)
98 {
99 this.mCertificate = alias;
100 }
101
102 public String getUserCertificateAlias()
103 {
104 return mUserCertificate;
105 }
106
107 public void setUserCertificateAlias(String alias)
108 {
109 this.mUserCertificate = alias;
110 }
111
112 public Integer getMTU()
113 {
114 return mMTU;
115 }
116
117 public void setMTU(Integer mtu)
118 {
119 this.mMTU = mtu;
120 }
121
122 public Integer getPort()
123 {
124 return mPort;
125 }
126
127 public void setPort(Integer port)
128 {
129 this.mPort = port;
130 }
131
132 public Integer getSplitTunneling()
133 {
134 return mSplitTunneling;
135 }
136
137 public void setSplitTunneling(Integer splitTunneling)
138 {
139 this.mSplitTunneling = splitTunneling;
140 }
141
142 @Override
143 public String toString()
144 {
145 return mName;
146 }
147
148 @Override
149 public boolean equals(Object o)
150 {
151 if (o != null && o instanceof VpnProfile)
152 {
153 return this.mId == ((VpnProfile)o).getId();
154 }
155 return false;
156 }
157
158 @Override
159 public VpnProfile clone()
160 {
161 try
162 {
163 return (VpnProfile)super.clone();
164 }
165 catch (CloneNotSupportedException e)
166 {
167 throw new AssertionError();
168 }
169 }
170 }