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 /* the order here must match the items in R.array.vpn_types */
21 IKEV2_EAP("ikev2-eap", true
, false
),
22 IKEV2_CERT("ikev2-cert", false
, true
);
24 private String mIdentifier
;
25 private boolean mCertificate
;
26 private boolean mUsernamePassword
;
29 * Enum which provides additional information about the supported VPN types.
31 * @param id identifier used to store and transmit this specific type
32 * @param userpass true if username and password are required
33 * @param certificate true if a client certificate is required
35 VpnType(String id
, boolean userpass
, boolean certificate
)
38 mUsernamePassword
= userpass
;
39 mCertificate
= certificate
;
43 * The identifier used to store this value in the database
46 public String
getIdentifier()
52 * Whether username and password are required for this type of VPN.
54 * @return true if username and password are required
56 public boolean getRequiresUsernamePassword()
58 return mUsernamePassword
;
62 * Whether a certificate is required for this type of VPN.
64 * @return true if a certificate is required
66 public boolean getRequiresCertificate()
72 * Get the enum entry with the given identifier.
74 * @param identifier get the enum entry with this identifier
75 * @return the enum entry, or the default if not found
77 public static VpnType
fromIdentifier(String identifier
)
79 for (VpnType type
: VpnType
.values())
81 if (identifier
.equals(type
.mIdentifier
))
86 return VpnType
.IKEV2_EAP
;