aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/kernel
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2008-09-25 13:56:23 +0000
committerTobias Brunner <tobias@strongswan.org>2008-09-25 13:56:23 +0000
commita341a68fac045e94a45aa3fb1f7ac3e821e8a8be (patch)
tree3a55ecb885c39c1bb7ff48f1b9162291b97c9217 /src/charon/kernel
parent507f26f685b83ced2b2cd51465ad426bf87f2da5 (diff)
downloadstrongswan-a341a68fac045e94a45aa3fb1f7ac3e821e8a8be.tar.bz2
strongswan-a341a68fac045e94a45aa3fb1f7ac3e821e8a8be.tar.xz
merging renaming of mode_t to ipsec_mode_t back to trunk
Diffstat (limited to 'src/charon/kernel')
-rw-r--r--src/charon/kernel/kernel_interface.c8
-rw-r--r--src/charon/kernel/kernel_interface.h4
-rw-r--r--src/charon/kernel/kernel_ipsec.c26
-rw-r--r--src/charon/kernel/kernel_ipsec.h24
4 files changed, 54 insertions, 8 deletions
diff --git a/src/charon/kernel/kernel_interface.c b/src/charon/kernel/kernel_interface.c
index ef4fc11fb..4e56a0762 100644
--- a/src/charon/kernel/kernel_interface.c
+++ b/src/charon/kernel/kernel_interface.c
@@ -87,7 +87,7 @@ static status_t add_sa(private_kernel_interface_t *this, host_t *src, host_t *ds
u_int64_t expire_soft, u_int64_t expire_hard,
u_int16_t enc_alg, u_int16_t enc_size,
u_int16_t int_alg, u_int16_t int_size,
- prf_plus_t *prf_plus, mode_t mode, u_int16_t ipcomp, bool encap,
+ prf_plus_t *prf_plus, ipsec_mode_t mode, u_int16_t ipcomp, bool encap,
bool update)
{
return this->ipsec->add_sa(this->ipsec, src, dst, spi, protocol, reqid,
@@ -130,7 +130,7 @@ static status_t del_sa(private_kernel_interface_t *this, host_t *dst, u_int32_t
static status_t add_policy(private_kernel_interface_t *this, host_t *src, host_t *dst,
traffic_selector_t *src_ts, traffic_selector_t *dst_ts,
policy_dir_t direction, protocol_id_t protocol,
- u_int32_t reqid, bool high_prio, mode_t mode,
+ u_int32_t reqid, bool high_prio, ipsec_mode_t mode,
u_int16_t ipcomp)
{
return this->ipsec->add_policy(this->ipsec, src, dst, src_ts, dst_ts,
@@ -321,11 +321,11 @@ kernel_interface_t *kernel_interface_create()
this->public.get_spi = (status_t(*)(kernel_interface_t*,host_t*,host_t*,protocol_id_t,u_int32_t,u_int32_t*))get_spi;
this->public.get_cpi = (status_t(*)(kernel_interface_t*,host_t*,host_t*,u_int32_t,u_int16_t*))get_cpi;
- this->public.add_sa = (status_t(*)(kernel_interface_t *,host_t*,host_t*,u_int32_t,protocol_id_t,u_int32_t,u_int64_t,u_int64_t,u_int16_t,u_int16_t,u_int16_t,u_int16_t,prf_plus_t*,mode_t,u_int16_t,bool,bool))add_sa;
+ this->public.add_sa = (status_t(*)(kernel_interface_t *,host_t*,host_t*,u_int32_t,protocol_id_t,u_int32_t,u_int64_t,u_int64_t,u_int16_t,u_int16_t,u_int16_t,u_int16_t,prf_plus_t*,ipsec_mode_t,u_int16_t,bool,bool))add_sa;
this->public.update_sa = (status_t(*)(kernel_interface_t*,u_int32_t,protocol_id_t,host_t*,host_t*,host_t*,host_t*,bool))update_sa;
this->public.query_sa = (status_t(*)(kernel_interface_t*,host_t*,u_int32_t,protocol_id_t,u_int32_t*))query_sa;
this->public.del_sa = (status_t(*)(kernel_interface_t*,host_t*,u_int32_t,protocol_id_t))del_sa;
- this->public.add_policy = (status_t(*)(kernel_interface_t*,host_t*,host_t*,traffic_selector_t*,traffic_selector_t*,policy_dir_t,protocol_id_t,u_int32_t,bool,mode_t,u_int16_t))add_policy;
+ this->public.add_policy = (status_t(*)(kernel_interface_t*,host_t*,host_t*,traffic_selector_t*,traffic_selector_t*,policy_dir_t,protocol_id_t,u_int32_t,bool,ipsec_mode_t,u_int16_t))add_policy;
this->public.query_policy = (status_t(*)(kernel_interface_t*,traffic_selector_t*,traffic_selector_t*,policy_dir_t,u_int32_t*))query_policy;
this->public.del_policy = (status_t(*)(kernel_interface_t*,traffic_selector_t*,traffic_selector_t*,policy_dir_t))del_policy;
diff --git a/src/charon/kernel/kernel_interface.h b/src/charon/kernel/kernel_interface.h
index 757459fe3..49faf7c0c 100644
--- a/src/charon/kernel/kernel_interface.h
+++ b/src/charon/kernel/kernel_interface.h
@@ -117,7 +117,7 @@ struct kernel_interface_t {
u_int64_t expire_soft, u_int64_t expire_hard,
u_int16_t enc_alg, u_int16_t enc_size,
u_int16_t int_alg, u_int16_t int_size,
- prf_plus_t *prf_plus, mode_t mode,
+ prf_plus_t *prf_plus, ipsec_mode_t mode,
u_int16_t ipcomp, bool encap,
bool update);
@@ -192,7 +192,7 @@ struct kernel_interface_t {
traffic_selector_t *src_ts,
traffic_selector_t *dst_ts,
policy_dir_t direction, protocol_id_t protocol,
- u_int32_t reqid, bool high_prio, mode_t mode,
+ u_int32_t reqid, bool high_prio, ipsec_mode_t mode,
u_int16_t ipcomp);
/**
diff --git a/src/charon/kernel/kernel_ipsec.c b/src/charon/kernel/kernel_ipsec.c
new file mode 100644
index 000000000..e12e0096e
--- /dev/null
+++ b/src/charon/kernel/kernel_ipsec.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2008 Tobias Brunner
+ * Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * $Id$
+ */
+
+#include "kernel_ipsec.h"
+
+ENUM(ipsec_mode_names, MODE_TRANSPORT, MODE_BEET,
+ "TRANSPORT",
+ "TUNNEL",
+ "2",
+ "3",
+ "BEET",
+);
diff --git a/src/charon/kernel/kernel_ipsec.h b/src/charon/kernel/kernel_ipsec.h
index b8ca3c91b..342d6ceb2 100644
--- a/src/charon/kernel/kernel_ipsec.h
+++ b/src/charon/kernel/kernel_ipsec.h
@@ -26,6 +26,7 @@
#ifndef KERNEL_IPSEC_H_
#define KERNEL_IPSEC_H_
+typedef enum ipsec_mode_t ipsec_mode_t;
typedef enum policy_dir_t policy_dir_t;
typedef struct kernel_ipsec_t kernel_ipsec_t;
@@ -34,6 +35,25 @@ typedef struct kernel_ipsec_t kernel_ipsec_t;
#include <encoding/payloads/proposal_substructure.h>
/**
+ * Mode of an CHILD_SA.
+ *
+ * These are equal to those defined in XFRM, so don't change.
+ */
+enum ipsec_mode_t {
+ /** transport mode, no inner address */
+ MODE_TRANSPORT = 0,
+ /** tunnel mode, inner and outer addresses */
+ MODE_TUNNEL = 1,
+ /** BEET mode, tunnel mode but fixed, bound inner addresses */
+ MODE_BEET = 4,
+};
+
+/**
+ * enum names for ipsec_mode_t.
+ */
+extern enum_name_t *ipsec_mode_names;
+
+/**
* Direction of a policy. These are equal to those
* defined in xfrm.h, but we want to stay implementation
* neutral here.
@@ -124,7 +144,7 @@ struct kernel_ipsec_t {
u_int64_t expire_soft, u_int64_t expire_hard,
u_int16_t enc_alg, u_int16_t enc_size,
u_int16_t int_alg, u_int16_t int_size,
- prf_plus_t *prf_plus, mode_t mode,
+ prf_plus_t *prf_plus, ipsec_mode_t mode,
u_int16_t ipcomp, bool encap,
bool update);
@@ -199,7 +219,7 @@ struct kernel_ipsec_t {
traffic_selector_t *src_ts,
traffic_selector_t *dst_ts,
policy_dir_t direction, protocol_id_t protocol,
- u_int32_t reqid, bool high_prio, mode_t mode,
+ u_int32_t reqid, bool high_prio, ipsec_mode_t mode,
u_int16_t ipcomp);
/**