951319067b4696c13bc1e95aa01c3eab2c25f593
[strongswan.git] / Source / charon / threads / kernel_interface.h
1 /**
2 * @file kernel_interface.h
3 *
4 * @brief Interface of kernel_interface_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 #ifndef KERNEL_INTERFACE_H_
24 #define KERNEL_INTERFACE_H_
25
26
27 #include <network/host.h>
28 #include <encoding/payloads/proposal_substructure.h>
29
30 typedef struct kernel_interface_t kernel_interface_t;
31
32 /**
33 * @brief Interface to the kernel.
34 *
35 * @b Constructors:
36 * - kernel_interface_create()
37 *
38 * @ingroup threads
39 */
40 struct kernel_interface_t {
41
42 /**
43 * @brief Get a SPI from the kernel
44 *
45 * @todo Fix spi range
46 */
47 status_t (*get_spi) (kernel_interface_t *this, host_t *src, host_t *dest, protocol_id_t protocol, bool tunnel_mode, u_int32_t *spi);
48
49 /**
50 * @brief Create an SA.
51 *
52 * @todo Fix reqid and replay_window params
53 *
54 * @todo Cleanup method params
55 */
56 status_t (*add_sa)(kernel_interface_t *this,
57 host_t *me,
58 host_t *other,
59 u_int32_t spi,
60 int protocol,
61 bool tunnel_mode,
62 encryption_algorithm_t enc_alg,
63 size_t enc_size,
64 chunk_t enc_key,
65 integrity_algorithm_t int_alg,
66 size_t int_size,
67 chunk_t int_key,
68 bool replace);
69
70 /**
71 * @brief Destroys a kernel_interface object.
72 *
73 * @param kernel_interface_t calling object
74 */
75 void (*destroy) (kernel_interface_t *kernel_interface);
76 };
77
78 /**
79 * @brief Creates an object of type kernel_interface_t.
80 *
81 * @ingroup threads
82 */
83 kernel_interface_t *kernel_interface_create();
84
85 #endif /*KERNEL_INTERFACE_H_*/