diff options
Diffstat (limited to 'Source/charon/sa')
-rw-r--r-- | Source/charon/sa/Makefile.sa | 4 | ||||
-rw-r--r-- | Source/charon/sa/child_sa.c | 82 | ||||
-rw-r--r-- | Source/charon/sa/child_sa.h | 56 |
3 files changed, 142 insertions, 0 deletions
diff --git a/Source/charon/sa/Makefile.sa b/Source/charon/sa/Makefile.sa index b22a58b93..4c3e11bbc 100644 --- a/Source/charon/sa/Makefile.sa +++ b/Source/charon/sa/Makefile.sa @@ -29,5 +29,9 @@ $(BUILD_DIR)ike_sa.o : $(SA_DIR)ike_sa.c $(SA_DIR)ike_sa.h OBJS+= $(BUILD_DIR)authenticator.o $(BUILD_DIR)authenticator.o : $(SA_DIR)authenticator.c $(SA_DIR)authenticator.h $(CC) $(CFLAGS) -c -o $@ $< + +OBJS+= $(BUILD_DIR)child_sa.o +$(BUILD_DIR)child_sa.o : $(SA_DIR)child_sa.c $(SA_DIR)child_sa.h + $(CC) $(CFLAGS) -c -o $@ $< include $(SA_DIR)states/Makefile.states
\ No newline at end of file diff --git a/Source/charon/sa/child_sa.c b/Source/charon/sa/child_sa.c new file mode 100644 index 000000000..b0ba55d41 --- /dev/null +++ b/Source/charon/sa/child_sa.c @@ -0,0 +1,82 @@ +/** + * @file child_sa.c + * + * @brief Implementation of child_sa_t. + * + */ + +/* + * Copyright (C) 2005 Jan Hutter, Martin Willi + * 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. + */ + +#include "child_sa.h" + + +#include <utils/allocator.h> + +typedef struct private_child_sa_t private_child_sa_t; + +/** + * Private data of an child_sa_t object + */ +struct private_child_sa_t { + /** + * Public part of a child_sa object + */ + child_sa_t public; + + /** + * type of this child sa, ESP or AH + */ + protocol_id_t sa_type; + + +}; + + +/** + * implements child_sa_t.clone. + */ +static u_int32_t get_spi(private_child_sa_t *this) +{ + return 0; +} + +/** + * implements child_sa_t.clone. + */ +static void destroy(private_child_sa_t *this) +{ + allocator_free(this); +} + +/* + * Described in Header-File + */ +child_sa_t * child_sa_create(protocol_id_t sa_type, prf_plus_t *prf_plus) +{ + private_child_sa_t *this = allocator_alloc_thing(private_child_sa_t); + + /* Public functions */ + this->public.get_spi = (u_int32_t(*)(child_sa_t*))get_spi; + this->public.destroy = (void(*)(child_sa_t*))destroy; + + /* private data */ + this->sa_type = sa_type; + + + + + return (&this->public); +} diff --git a/Source/charon/sa/child_sa.h b/Source/charon/sa/child_sa.h new file mode 100644 index 000000000..da8883cc9 --- /dev/null +++ b/Source/charon/sa/child_sa.h @@ -0,0 +1,56 @@ +/** + * @file child_sa.h + * + * @brief Interface of child_sa_t. + * + */ + +/* + * Copyright (C) 2005 Jan Hutter, Martin Willi + * 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. + */ + + +#ifndef CHILD_SA_H_ +#define CHILD_SA_H_ + +#include <types.h> +#include <transforms/prf_plus.h> +#include <encoding/payloads/proposal_substructure.h> + +typedef struct child_sa_t child_sa_t; + +/** + * @brief + * @ingroup sa + */ +struct child_sa_t { + + u_int32_t (*get_spi) (child_sa_t *this); + + /** + * @brief Destroys a child_sa. + * + * @param this child_sa_t object + */ + void (*destroy) (child_sa_t *this); +}; + +/** + * @brief + * + * @ingroup sa + */ +child_sa_t * child_sa_create(protocol_id_t protocol_id, prf_plus_t *prf_plus); + +#endif /*CHILD_SA_H_*/ |