]>
Commit | Line | Data |
---|---|---|
3ebebc5e MW |
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 | ||
a527a426 | 26 | #include <linux/xfrm.h> |
3ebebc5e | 27 | |
ba425b87 MW |
28 | #include <network/host.h> |
29 | #include <encoding/payloads/proposal_substructure.h> | |
3ebebc5e MW |
30 | |
31 | typedef struct kernel_interface_t kernel_interface_t; | |
32 | ||
33 | /** | |
3febcf15 JH |
34 | * @brief Interface to the kernel. |
35 | * | |
36 | * @b Constructors: | |
37 | * - kernel_interface_create() | |
3ebebc5e MW |
38 | * |
39 | * @ingroup threads | |
40 | */ | |
41 | struct kernel_interface_t { | |
42 | ||
3febcf15 | 43 | /** |
2ed133a8 MW |
44 | * @brief Get a SPI from the kernel |
45 | * | |
46 | * @todo Fix spi range | |
3febcf15 | 47 | */ |
a527a426 MW |
48 | status_t (*get_spi) (kernel_interface_t *this, |
49 | host_t *src, host_t *dest, | |
50 | protocol_id_t protocol, | |
51 | u_int32_t reqid, | |
52 | u_int32_t *spi); | |
ba425b87 | 53 | |
3febcf15 | 54 | /** |
2ed133a8 MW |
55 | * @brief Create an SA. |
56 | * | |
57 | * @todo Fix reqid and replay_window params | |
58 | * | |
59 | * @todo Cleanup method params | |
3febcf15 | 60 | */ |
ba425b87 | 61 | status_t (*add_sa)(kernel_interface_t *this, |
a527a426 | 62 | host_t *src, host_t *dst, |
384efc76 | 63 | u_int32_t spi, |
a527a426 MW |
64 | protocol_id_t protocol, |
65 | u_int32_t reqid, | |
384efc76 | 66 | encryption_algorithm_t enc_alg, |
fc186705 | 67 | chunk_t encryption_key, |
384efc76 | 68 | integrity_algorithm_t int_alg, |
fc186705 | 69 | chunk_t integrity_key, |
384efc76 | 70 | bool replace); |
ba425b87 | 71 | |
a527a426 MW |
72 | status_t (*add_policy) (kernel_interface_t *this, |
73 | host_t *me, host_t *other, | |
74 | host_t *src, host_t *dst, | |
75 | u_int8_t src_hostbits, u_int8_t dst_hostbits, | |
76 | int direction, int upper_proto, | |
77 | bool ah, bool esp, | |
78 | u_int32_t reqid); | |
79 | ||
3ebebc5e MW |
80 | /** |
81 | * @brief Destroys a kernel_interface object. | |
82 | * | |
3ebebc5e MW |
83 | * @param kernel_interface_t calling object |
84 | */ | |
85 | void (*destroy) (kernel_interface_t *kernel_interface); | |
86 | }; | |
87 | ||
88 | /** | |
3febcf15 | 89 | * @brief Creates an object of type kernel_interface_t. |
3ebebc5e MW |
90 | * |
91 | * @ingroup threads | |
92 | */ | |
93 | kernel_interface_t *kernel_interface_create(); | |
94 | ||
95 | #endif /*KERNEL_INTERFACE_H_*/ |