2 * Copyright (C) 2012 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 package org
.strongswan
.android
.data
;
20 IKEV2_EAP("ikev2-eap", true
, false
),
21 IKEV2_CERT("ikev2-cert", false
, true
);
23 private String mIdentifier
;
24 private boolean mCertificate
;
25 private boolean mUsernamePassword
;
28 * Enum which provides additional information about the supported VPN types.
30 * @param id identifier used to store and transmit this specific type
31 * @param userpass true if username and password are required
32 * @param certificate true if a client certificate is required
34 VpnType(String id
, boolean userpass
, boolean certificate
)
37 mUsernamePassword
= userpass
;
38 mCertificate
= certificate
;
42 * The identifier used to store this value in the database
45 public String
getIdentifier()
51 * Whether username and password are required for this type of VPN.
53 * @return true if username and password are required
55 public boolean getRequiresUsernamePassword()
57 return mUsernamePassword
;
61 * Whether a certificate is required for this type of VPN.
63 * @return true if a certificate is required
65 public boolean getRequiresCertificate()
71 * Get the enum entry with the given identifier.
73 * @param identifier get the enum entry with this identifier
74 * @return the enum entry, or the default if not found
76 public static VpnType
fromIdentifier(String identifier
)
78 for (VpnType type
: VpnType
.values())
80 if (identifier
.equals(type
.mIdentifier
))
85 return VpnType
.IKEV2_EAP
;