- started implementation of netlink kernel interface
[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 an child_sa_t object
32 */
33 struct private_child_sa_t {
34 /**
35 * Public part of a child_sa object
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
48 /**
49 * implements child_sa_t.clone.
50 */
51 static u_int32_t get_spi(private_child_sa_t *this)
52 {
53 return 0;
54 }
55
56 /**
57 * implements child_sa_t.clone.
58 */
59 static void destroy(private_child_sa_t *this)
60 {
61 allocator_free(this);
62 }
63
64 /*
65 * Described in Header-File
66 */
67 child_sa_t * child_sa_create(protocol_id_t sa_type, prf_plus_t *prf_plus)
68 {
69 private_child_sa_t *this = allocator_alloc_thing(private_child_sa_t);
70
71 /* Public functions */
72 this->public.get_spi = (u_int32_t(*)(child_sa_t*))get_spi;
73 this->public.destroy = (void(*)(child_sa_t*))destroy;
74
75 /* private data */
76 this->sa_type = sa_type;
77
78
79
80
81 return (&this->public);
82 }