- code cleaned up
[strongswan.git] / Source / charon / sa / child_sa.c
1 /**
2 * @file child_sa.c
3 *
4 * @brief Implementation of child_sa_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #include "child_sa.h"
24
25
26 #include <utils/allocator.h>
27
28 typedef struct private_child_sa_t private_child_sa_t;
29
30 /**
31 * Private data of a child_sa_t object.
32 */
33 struct private_child_sa_t {
34 /**
35 * Public interface of child_sa_t.
36 */
37 child_sa_t public;
38
39 /**
40 * Type of this child sa, ESP or AH.
41 */
42 protocol_id_t sa_type;
43 };
44
45
46 /**
47 * Implementation of child_sa_t.get_spi.
48 */
49 static u_int32_t get_spi(private_child_sa_t *this)
50 {
51 return 0;
52 }
53
54 /**
55 * Implementation of child_sa_t.destroy.
56 */
57 static void destroy(private_child_sa_t *this)
58 {
59 allocator_free(this);
60 }
61
62 /*
63 * Described in header.
64 */
65 child_sa_t * child_sa_create(protocol_id_t sa_type, prf_plus_t *prf_plus)
66 {
67 private_child_sa_t *this = allocator_alloc_thing(private_child_sa_t);
68
69 /* public functions */
70 this->public.get_spi = (u_int32_t(*)(child_sa_t*))get_spi;
71 this->public.destroy = (void(*)(child_sa_t*))destroy;
72
73 /* private data */
74 this->sa_type = sa_type;
75
76 return (&this->public);
77 }