]>
Commit | Line | Data |
---|---|---|
1ecaff31 | 1 | /** |
a6966a48 | 2 | * @file ke_payload.h |
1ecaff31 | 3 | * |
3fe05870 | 4 | * @brief Interface of ke_payload_t. |
1ecaff31 JH |
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 | ||
696be022 | 26 | #include <types.h> |
4a962238 MW |
27 | #include <encoding/payloads/payload.h> |
28 | #include <encoding/payloads/transform_substructure.h> | |
696be022 | 29 | #include <utils/linked_list.h> |
1ecaff31 | 30 | /** |
3fe05870 JH |
31 | * KE payload length in bytes without any key exchange data. |
32 | * | |
33 | * @ingroup payloads | |
1ecaff31 JH |
34 | */ |
35 | #define KE_PAYLOAD_HEADER_LENGTH 8 | |
36 | ||
95c61cb9 JH |
37 | |
38 | typedef struct ke_payload_t ke_payload_t; | |
39 | ||
1ecaff31 | 40 | /** |
c3dc864e | 41 | * @brief Class representing an IKEv2-KE Payload. |
1ecaff31 JH |
42 | * |
43 | * The KE Payload format is described in RFC section 3.4. | |
44 | * | |
c3dc864e MW |
45 | * @b Constructors: |
46 | * - ke_payload_create() | |
47 | * | |
3fe05870 | 48 | * @ingroup payloads |
1ecaff31 | 49 | */ |
95c61cb9 | 50 | struct ke_payload_t { |
1ecaff31 | 51 | /** |
3fe05870 | 52 | * The payload_t interface. |
1ecaff31 JH |
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 | |
1ecaff31 | 73 | */ |
3fe05870 | 74 | void (*set_key_exchange_data) (ke_payload_t *this, chunk_t key_exchange_data); |
1ecaff31 JH |
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 | */ | |
6278a9ae | 82 | diffie_hellman_group_t (*get_dh_group_number) (ke_payload_t *this); |
1ecaff31 JH |
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 | |
1ecaff31 | 89 | */ |
3fe05870 | 90 | void (*set_dh_group_number) (ke_payload_t *this, diffie_hellman_group_t dh_group_number); |
1ecaff31 JH |
91 | |
92 | /** | |
93 | * @brief Destroys an ke_payload_t object. | |
94 | * | |
95 | * @param this ke_payload_t object to destroy | |
1ecaff31 | 96 | */ |
3fe05870 | 97 | void (*destroy) (ke_payload_t *this); |
1ecaff31 JH |
98 | }; |
99 | ||
100 | /** | |
101 | * @brief Creates an empty ke_payload_t object | |
102 | * | |
c3dc864e | 103 | * @return ke_payload_t object |
3fe05870 JH |
104 | * |
105 | * @ingroup payloads | |
1ecaff31 | 106 | */ |
f768bdc3 | 107 | ke_payload_t *ke_payload_create(void); |
1ecaff31 JH |
108 | |
109 | ||
110 | #endif /*KE_PAYLOAD_H_*/ |