2005-12-04 19:05:52 +00:00
|
|
|
/**
|
|
|
|
* @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;
|
|
|
|
|
|
|
|
/**
|
2005-12-07 08:13:22 +00:00
|
|
|
* Private data of a child_sa_t object.
|
2005-12-04 19:05:52 +00:00
|
|
|
*/
|
|
|
|
struct private_child_sa_t {
|
|
|
|
/**
|
2005-12-07 08:13:22 +00:00
|
|
|
* Public interface of child_sa_t.
|
2005-12-04 19:05:52 +00:00
|
|
|
*/
|
|
|
|
child_sa_t public;
|
|
|
|
|
|
|
|
/**
|
2005-12-07 08:13:22 +00:00
|
|
|
* Type of this child sa, ESP or AH.
|
2005-12-04 19:05:52 +00:00
|
|
|
*/
|
2005-12-07 08:13:22 +00:00
|
|
|
protocol_id_t sa_type;
|
2005-12-04 19:05:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-12-07 08:13:22 +00:00
|
|
|
* Implementation of child_sa_t.get_spi.
|
2005-12-04 19:05:52 +00:00
|
|
|
*/
|
|
|
|
static u_int32_t get_spi(private_child_sa_t *this)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-12-07 08:13:22 +00:00
|
|
|
* Implementation of child_sa_t.destroy.
|
2005-12-04 19:05:52 +00:00
|
|
|
*/
|
|
|
|
static void destroy(private_child_sa_t *this)
|
|
|
|
{
|
|
|
|
allocator_free(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2005-12-07 08:13:22 +00:00
|
|
|
* Described in header.
|
2005-12-04 19:05:52 +00:00
|
|
|
*/
|
|
|
|
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);
|
|
|
|
|
2005-12-07 08:13:22 +00:00
|
|
|
/* public functions */
|
2005-12-04 19:05:52 +00:00
|
|
|
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);
|
|
|
|
}
|