4 * @brief Declaration of the class ike_header_t.
6 * An object of this type represents an ike header and is used to
7 * generate and parse ike headers.
12 * Copyright (C) 2005 Jan Hutter, Martin Willi
13 * Hochschule fuer Technik Rapperswil
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
20 * This program is distributed in the hope that it will be useful, but
21 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
33 * Major Version of IKEv2
35 #define IKE_MAJOR_VERSION 2
38 * Minor Version of IKEv2
40 #define IKE_MINOR_VERSION 0
43 * Flag in IKEv2-Header. Always 0
45 #define HIGHER_VERSION_SUPPORTED_FLAG 0
48 * Length of IKE Header in Bytes
50 #define IKE_HEADER_LENGTH 28
53 * @brief Different types of IKE-Exchanges.
55 * See RFC for different types.
57 typedef enum exchange_type_e exchange_type_t
;
62 * NOT_SET, not a official message type :-)
85 * Object representing an IKEv2-Header
87 * The header format of an IKEv2-Message is compatible to the
88 * ISAKMP-Header format to allow implementations supporting
89 * both versions of the IKE-protocol.
92 typedef struct ike_header_s ike_header_t
;
96 * implements payload_t interface
98 payload_t payload_interface
;
101 * @brief get the next payload type
103 * @param this ike_header_t object
104 * @return next payload type
106 u_int8_t (*get_next_payload
) (ike_header_t
*this);
109 * @brief set the next payload
111 * @param this ike_header_t object
112 * @param next_payload next payload type
114 void (*set_next_payload
) (ike_header_t
*this, u_int8_t next_payload
);
117 * @brief get the initiator spi
119 * @param this ike_header_t object
120 * @return initiator_spi
122 u_int64_t (*get_initiator_spi
) (ike_header_t
*this);
125 * @brief set the initiator spi
127 * @param this ike_header_t object
128 * @param initiator_spi initiator_spi
130 void (*set_initiator_spi
) (ike_header_t
*this, u_int64_t initiator_spi
);
133 * @brief get the responder spi
135 * @param this ike_header_t object
136 * @return responder_spi
138 u_int64_t (*get_responder_spi
) (ike_header_t
*this);
141 * @brief set the responder spi
143 * @param this ike_header_t object
144 * @param responder_spi responder_spi
146 void (*set_responder_spi
) (ike_header_t
*this, u_int64_t responder_spi
);
149 * @brief get the major version
151 * @param this ike_header_t object
152 * @return major version
154 u_int8_t (*get_maj_version
) (ike_header_t
*this);
157 * @brief get the mainor version
159 * @param this ike_header_t object
160 * @return minor version
162 u_int8_t (*get_min_version
) (ike_header_t
*this);
165 * @brief get the response flag
167 * @param this ike_header_t object
168 * @return response flag
170 bool (*get_response_flag
) (ike_header_t
*this);
173 * @brief Set the response flag
175 * @param this ike_header_t object
176 * @param response response flag
179 void (*set_response_flag
) (ike_header_t
*this, bool response
);
181 * @brief get "higher version supported"-flag
183 * @param this ike_header_t object
184 * @return version flag
186 bool (*get_version_flag
) (ike_header_t
*this);
189 * @brief get the initiator flag
191 * @param this ike_header_t object
192 * @return initiator flag
194 bool (*get_initiator_flag
) (ike_header_t
*this);
197 * @brief Set the initiator flag
199 * @param this ike_header_t object
200 * @param initiator initiator flag
203 void (*set_initiator_flag
) (ike_header_t
*this, bool initiator
);
206 * @brief get the exchange type
208 * @param this ike_header_t object
209 * @return exchange type
211 u_int8_t (*get_exchange_type
) (ike_header_t
*this);
214 * @brief set the exchange type
216 * @param this ike_header_t object
217 * @param exchange_type exchange type
219 void (*set_exchange_type
) (ike_header_t
*this, u_int8_t exchange_type
);
222 * @brief get the message id
224 * @param this ike_header_t object
227 u_int32_t (*get_message_id
) (ike_header_t
*this);
230 * @brief set the message id
232 * @param this ike_header_t object
233 * @param initiator_spi message id
235 void (*set_message_id
) (ike_header_t
*this, u_int32_t message_id
);
238 * @brief Destroys a ike_header_t object.
240 * @param this ike_header_t object to destroy
242 * SUCCESS in any case
244 status_t (*destroy
) (ike_header_t
*this);
248 * @brief Create an ike_header_t object
251 * - created ike_header, or
255 ike_header_t
*ike_header_create();
257 #endif /*IKE_HEADER_H_*/