diff options
Diffstat (limited to 'tinyIPSec/src/tipsec_common.c')
-rw-r--r-- | tinyIPSec/src/tipsec_common.c | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/tinyIPSec/src/tipsec_common.c b/tinyIPSec/src/tipsec_common.c new file mode 100644 index 0000000..4ae44d7 --- /dev/null +++ b/tinyIPSec/src/tipsec_common.c @@ -0,0 +1,115 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tipsec_common.c + * @brief IPSec common functions. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#include "tipsec_common.h" + +#include "tsk_debug.h" + +/**@defgroup tipsec_common_group IPSec common. +* Common to all OSes. +*/ + +tipsec_context_t* tipsec_context_create(tipsec_ipproto_t ipproto, tsk_bool_t use_ipv6, tipsec_mode_t mode, tipsec_ealgorithm_t ealg, tipsec_algorithm_t alg, tipsec_protocol_t protocol) +{ + return tsk_object_new(tipsec_context_def_t, ipproto, use_ipv6, (tipsec_mode_t)mode, ealg, alg, protocol); +} + +#if !HAVE_IPSEC_VISTA && !HAVE_IPSEC_XP && !HAVE_IPSEC_RACOON + +int tipsec_start(tipsec_context_t* ctx) +{ + TSK_DEBUG_WARN("No IPSec implementation found."); + return 0; +} + +int tipsec_set_local(tipsec_context_t* ctx, const char* addr_local, const char* addr_remote, tipsec_port_t port_uc, tipsec_port_t port_us) +{ + TSK_DEBUG_WARN("No IPSec implementation found."); + + ctx->port_uc = port_uc; + ctx->port_us = port_us; + return -1; +} + +int tipsec_set_keys(tipsec_context_t* ctx, const tipsec_key_t* ik, const tipsec_key_t* ck) +{ + TSK_DEBUG_WARN("No IPSec implementation found."); + return 0; +} + +int tipsec_set_remote(tipsec_context_t* ctx, tipsec_spi_t spi_pc, tipsec_spi_t spi_ps, tipsec_port_t port_pc, tipsec_port_t port_ps, tipsec_lifetime_t lifetime) +{ + TSK_DEBUG_WARN("No IPSec implementation found."); + return 0; +} + +int tipsec_stop(tipsec_context_t* ctx) +{ + TSK_DEBUG_WARN("No IPSec implementation found."); + return 0; +} + + + +//================================================================================================= +// IPSec context object definition +// +static tsk_object_t* tipsec_context_ctor(tsk_object_t * self, va_list * app) +{ + tipsec_context_t *context = self; + if(context){ + } + return self; +} + +static tsk_object_t* tipsec_context_dtor(tsk_object_t * self) +{ + tipsec_context_t *context = self; + if(context){ + } + + return self; +} + +static int tipsec_context_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2) +{ + return-1; +} + +static const tsk_object_def_t tipsec_context_def_s = +{ +sizeof(tipsec_context_t), +tipsec_context_ctor, +tipsec_context_dtor, +tipsec_context_cmp, +}; + + +const void *tipsec_context_def_t = &tipsec_context_def_s; +#endif |