aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/config/peer_cfg.h
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-11-16 17:28:06 +0100
committerTobias Brunner <tobias@strongswan.org>2012-03-20 17:30:41 +0100
commitf7a8fcedc0305dfca7d82adba03c88401240d039 (patch)
treee00296ac8545abdda0a6a58662711d365fbd07ff /src/libcharon/config/peer_cfg.h
parent3238faf8e6a91f554a76a376bacbc333c3530925 (diff)
downloadstrongswan-f7a8fcedc0305dfca7d82adba03c88401240d039.tar.bz2
strongswan-f7a8fcedc0305dfca7d82adba03c88401240d039.tar.xz
Use enum to define IKE version on peer_cfg_t.
Replaced all those magic numbers.
Diffstat (limited to 'src/libcharon/config/peer_cfg.h')
-rw-r--r--src/libcharon/config/peer_cfg.h32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/libcharon/config/peer_cfg.h b/src/libcharon/config/peer_cfg.h
index f644fb547..6096f6413 100644
--- a/src/libcharon/config/peer_cfg.h
+++ b/src/libcharon/config/peer_cfg.h
@@ -23,6 +23,7 @@
#ifndef PEER_CFG_H_
#define PEER_CFG_H_
+typedef enum ike_version_t ike_version_t;
typedef enum cert_policy_t cert_policy_t;
typedef enum unique_policy_t unique_policy_t;
typedef struct peer_cfg_t peer_cfg_t;
@@ -39,6 +40,21 @@ typedef struct peer_cfg_t peer_cfg_t;
#include <credentials/auth_cfg.h>
/**
+ * IKE version.
+ */
+enum ike_version_t {
+ /** IKE version 1 */
+ IKEV1 = 1,
+ /** IKE version 2 */
+ IKEV2 = 2,
+};
+
+/**
+ * enum strings fro ike_version_t
+ */
+extern enum_name_t *ike_version_names;
+
+/**
* Certificate sending policy. This is also used for certificate
* requests when using this definition for the other peer. If
* it is CERT_NEVER_SEND, a certreq is omitted, otherwise its
@@ -130,7 +146,7 @@ struct peer_cfg_t {
*
* @return IKE major version
*/
- u_int (*get_ike_version)(peer_cfg_t *this);
+ ike_version_t (*get_ike_version)(peer_cfg_t *this);
/**
* Get the IKE config to use for initiaton.
@@ -347,13 +363,13 @@ struct peer_cfg_t {
* @param peer_id ID that identifies our peer at the mediation server
* @return peer_cfg_t object
*/
-peer_cfg_t *peer_cfg_create(char *name, u_int ike_version, ike_cfg_t *ike_cfg,
- cert_policy_t cert_policy, unique_policy_t unique,
- u_int32_t keyingtries, u_int32_t rekey_time,
- u_int32_t reauth_time, u_int32_t jitter_time,
- u_int32_t over_time, bool mobike, u_int32_t dpd,
- host_t *virtual_ip, char *pool,
- bool mediation, peer_cfg_t *mediated_by,
+peer_cfg_t *peer_cfg_create(char *name, ike_version_t ike_version,
+ ike_cfg_t *ike_cfg, cert_policy_t cert_policy,
+ unique_policy_t unique, u_int32_t keyingtries,
+ u_int32_t rekey_time, u_int32_t reauth_time,
+ u_int32_t jitter_time, u_int32_t over_time,
+ bool mobike, u_int32_t dpd, host_t *virtual_ip,
+ char *pool, bool mediation, peer_cfg_t *mediated_by,
identification_t *peer_id);
#endif /** PEER_CFG_H_ @}*/