]>
Commit | Line | Data |
---|---|---|
1 | /** | |
2 | * @file ke_payload.h | |
3 | * | |
4 | * @brief Interface of ke_payload_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 KE_PAYLOAD_H_ | |
24 | #define KE_PAYLOAD_H_ | |
25 | ||
26 | #include <types.h> | |
27 | #include <encoding/payloads/payload.h> | |
28 | #include <encoding/payloads/transform_substructure.h> | |
29 | #include <utils/linked_list.h> | |
30 | /** | |
31 | * KE payload length in bytes without any key exchange data. | |
32 | * | |
33 | * @ingroup payloads | |
34 | */ | |
35 | #define KE_PAYLOAD_HEADER_LENGTH 8 | |
36 | ||
37 | ||
38 | typedef struct ke_payload_t ke_payload_t; | |
39 | ||
40 | /** | |
41 | * @brief Class representing an IKEv2-KE Payload. | |
42 | * | |
43 | * The KE Payload format is described in RFC section 3.4. | |
44 | * | |
45 | * @b Constructors: | |
46 | * - ke_payload_create() | |
47 | * | |
48 | * @ingroup payloads | |
49 | */ | |
50 | struct ke_payload_t { | |
51 | /** | |
52 | * The payload_t interface. | |
53 | */ | |
54 | payload_t payload_interface; | |
55 | ||
56 | /** | |
57 | * @brief Returns the currently set key exchange data of this KE payload. | |
58 | * | |
59 | * @warning Returned data are not copied. | |
60 | * | |
61 | * @param this calling ke_payload_t object | |
62 | * @return chunk_t pointing to the value | |
63 | */ | |
64 | chunk_t (*get_key_exchange_data) (ke_payload_t *this); | |
65 | ||
66 | /** | |
67 | * @brief Sets the key exchange data of this KE payload. | |
68 | * | |
69 | * @warning Value is getting copied. | |
70 | * | |
71 | * @param this calling ke_payload_t object | |
72 | * @param key_exchange_data chunk_t pointing to the value to set | |
73 | */ | |
74 | void (*set_key_exchange_data) (ke_payload_t *this, chunk_t key_exchange_data); | |
75 | ||
76 | /** | |
77 | * @brief Gets the Diffie-Hellman Group Number of this KE payload. | |
78 | * | |
79 | * @param this calling ke_payload_t object | |
80 | * @return DH Group Number of this payload | |
81 | */ | |
82 | diffie_hellman_group_t (*get_dh_group_number) (ke_payload_t *this); | |
83 | ||
84 | /** | |
85 | * @brief Sets the Diffie-Hellman Group Number of this KE payload. | |
86 | * | |
87 | * @param this calling ke_payload_t object | |
88 | * @param dh_group_number DH Group to set | |
89 | */ | |
90 | void (*set_dh_group_number) (ke_payload_t *this, diffie_hellman_group_t dh_group_number); | |
91 | ||
92 | /** | |
93 | * @brief Destroys an ke_payload_t object. | |
94 | * | |
95 | * @param this ke_payload_t object to destroy | |
96 | */ | |
97 | void (*destroy) (ke_payload_t *this); | |
98 | }; | |
99 | ||
100 | /** | |
101 | * @brief Creates an empty ke_payload_t object | |
102 | * | |
103 | * @return ke_payload_t object | |
104 | * | |
105 | * @ingroup payloads | |
106 | */ | |
107 | ke_payload_t *ke_payload_create(); | |
108 | ||
109 | ||
110 | #endif /*KE_PAYLOAD_H_*/ |