- changed dh_group type to diffie_hellman_group_t
[strongswan.git] / Source / charon / payloads / ke_payload.h
1 /**
2 * @file ke_payload.h
3 *
4 * @brief Declaration of the class ke_payload_t.
5 *
6 * An object of this type represents an IKEv2 KE-Payload.
7 *
8 * See section 3.4 of RFC for details of this payload type.
9 *
10 */
11
12 /*
13 * Copyright (C) 2005 Jan Hutter, Martin Willi
14 * Hochschule fuer Technik Rapperswil
15 *
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 2 of the License, or (at your
19 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
20 *
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * for more details.
25 */
26
27 #ifndef KE_PAYLOAD_H_
28 #define KE_PAYLOAD_H_
29
30 #include "../types.h"
31 #include "payload.h"
32 #include "transform_substructure.h"
33 #include "../utils/linked_list.h"
34
35 /**
36 * Critical flag must not be set
37 */
38 #define KE_PAYLOAD_CRITICAL_FLAG FALSE;
39
40 /**
41 * KE payload length in bytes without any key exchange data
42 */
43 #define KE_PAYLOAD_HEADER_LENGTH 8
44
45 /**
46 * Object representing an IKEv2-KE Payload
47 *
48 * The KE Payload format is described in RFC section 3.4.
49 *
50 */
51 typedef struct ke_payload_s ke_payload_t;
52
53 struct ke_payload_s {
54 /**
55 * implements payload_t interface
56 */
57 payload_t payload_interface;
58
59 /**
60 * @brief Returns the currently set key exchange data of this KE payload.
61 *
62 * @warning Returned data are not copied.
63 *
64 * @param this calling ke_payload_t object
65 * @return chunk_t pointing to the value
66 */
67 chunk_t (*get_key_exchange_data) (ke_payload_t *this);
68
69 /**
70 * @brief Sets the key exchange data of this KE payload.
71 *
72 * @warning Value is getting copied.
73 *
74 * @param this calling ke_payload_t object
75 * @param key_exchange_data chunk_t pointing to the value to set
76 * @return
77 * - SUCCESS or
78 * - OUT_OF_RES
79 */
80 status_t (*set_key_exchange_data) (ke_payload_t *this, chunk_t key_exchange_data);
81
82 /**
83 * @brief Gets the Diffie-Hellman Group Number of this KE payload.
84 *
85 * @param this calling ke_payload_t object
86 * @return DH Group Number of this payload
87 */
88 diffie_hellman_group_t (*get_dh_group_number) (ke_payload_t *this);
89
90 /**
91 * @brief Sets the Diffie-Hellman Group Number of this KE payload.
92 *
93 * @param this calling ke_payload_t object
94 * @param dh_group_number DH Group to set
95 * @return SUCCESS
96 */
97 status_t (*set_dh_group_number) (ke_payload_t *this, diffie_hellman_group_t dh_group_number);
98
99 /**
100 * @brief Destroys an ke_payload_t object.
101 *
102 * @param this ke_payload_t object to destroy
103 * @return
104 * SUCCESS in any case
105 */
106 status_t (*destroy) (ke_payload_t *this);
107 };
108
109 /**
110 * @brief Creates an empty ke_payload_t object
111 *
112 * @return
113 * - created ke_payload_t object, or
114 * - NULL if failed
115 */
116
117 ke_payload_t *ke_payload_create();
118
119
120 #endif /*KE_PAYLOAD_H_*/