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
30 #include <encoding/payloads/payload.h>
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 * EXCHANGE_TYPE_UNDEFINED, not a official message type :-)
64 EXCHANGE_TYPE_UNDEFINED
= 240,
83 extern mapping_t exchange_type_m
[];
86 * Object representing an IKEv2-Header
88 * The header format of an IKEv2-Message is compatible to the
89 * ISAKMP-Header format to allow implementations supporting
90 * both versions of the IKE-protocol.
93 typedef struct ike_header_s ike_header_t
;
97 * implements payload_t interface
99 payload_t payload_interface
;
102 * @brief get the initiator spi
104 * @param this ike_header_t object
105 * @return initiator_spi
107 u_int64_t (*get_initiator_spi
) (ike_header_t
*this);
110 * @brief set the initiator spi
112 * @param this ike_header_t object
113 * @param initiator_spi initiator_spi
115 void (*set_initiator_spi
) (ike_header_t
*this, u_int64_t initiator_spi
);
118 * @brief get the responder spi
120 * @param this ike_header_t object
121 * @return responder_spi
123 u_int64_t (*get_responder_spi
) (ike_header_t
*this);
126 * @brief set the responder spi
128 * @param this ike_header_t object
129 * @param responder_spi responder_spi
131 void (*set_responder_spi
) (ike_header_t
*this, u_int64_t responder_spi
);
134 * @brief get the major version
136 * @param this ike_header_t object
137 * @return major version
139 u_int8_t (*get_maj_version
) (ike_header_t
*this);
142 * @brief get the mainor version
144 * @param this ike_header_t object
145 * @return minor version
147 u_int8_t (*get_min_version
) (ike_header_t
*this);
150 * @brief get the response flag
152 * @param this ike_header_t object
153 * @return response flag
155 bool (*get_response_flag
) (ike_header_t
*this);
158 * @brief Set the response flag
160 * @param this ike_header_t object
161 * @param response response flag
164 void (*set_response_flag
) (ike_header_t
*this, bool response
);
166 * @brief get "higher version supported"-flag
168 * @param this ike_header_t object
169 * @return version flag
171 bool (*get_version_flag
) (ike_header_t
*this);
174 * @brief get the initiator flag
176 * @param this ike_header_t object
177 * @return initiator flag
179 bool (*get_initiator_flag
) (ike_header_t
*this);
182 * @brief Set the initiator flag
184 * @param this ike_header_t object
185 * @param initiator initiator flag
188 void (*set_initiator_flag
) (ike_header_t
*this, bool initiator
);
191 * @brief get the exchange type
193 * @param this ike_header_t object
194 * @return exchange type
196 u_int8_t (*get_exchange_type
) (ike_header_t
*this);
199 * @brief set the exchange type
201 * @param this ike_header_t object
202 * @param exchange_type exchange type
204 void (*set_exchange_type
) (ike_header_t
*this, u_int8_t exchange_type
);
207 * @brief get the message id
209 * @param this ike_header_t object
212 u_int32_t (*get_message_id
) (ike_header_t
*this);
215 * @brief set the message id
217 * @param this ike_header_t object
218 * @param initiator_spi message id
220 void (*set_message_id
) (ike_header_t
*this, u_int32_t message_id
);
223 * @brief Destroys a ike_header_t object.
225 * @param this ike_header_t object to destroy
227 * SUCCESS in any case
229 status_t (*destroy
) (ike_header_t
*this);
233 * @brief Create an ike_header_t object
236 * - created ike_header, or
240 ike_header_t
*ike_header_create();
242 #endif /*IKE_HEADER_H_*/