4 * @brief Class message_t. Object of this type represents an IKEv2-Message.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
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>.
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
30 * @brief Different types of IKE-Exchanges.
32 * See RFC for different types.
34 typedef enum exchange_type_e exchange_type_t
;
39 * NOT_SET, not a official message type :-)
62 * @brief This class is used to represent an IKEv2-Message.
64 * An IKEv2-Message is either a request or response.
66 typedef struct message_s message_t
;
71 * @brief Sets the exchange type of the message.
73 * @param this message_t object
74 * @param exchange_type exchange_type to set
77 status_t (*set_exchange_type
) (message_t
*this,exchange_type_t exchange_type
);
80 * @brief Gets the exchange type of the message.
82 * @param this message_t object
83 * @return exchange type of the message
85 exchange_type_t (*get_exchange_type
) (message_t
*this);
88 * @brief Sets the original initiator flag.
90 * @param this message_t object
91 * @param original_initiator TRUE if message is from original initiator
94 status_t (*set_original_initiator
) (message_t
*this,bool original_initiator
);
97 * @brief Gets original initiator flag.
99 * @param this message_t object
100 * @return TRUE if message is from original initiator, FALSE otherwise
102 bool (*get_original_initiator
) (message_t
*this);
105 * @brief Sets the request flag.
107 * @param this message_t object
108 * @param original_initiator TRUE if message is a request, FALSE if it is a reply
111 status_t (*set_request
) (message_t
*this,bool request
);
114 * @brief Gets request flag.
116 * @param this message_t object
117 * @return TRUE if message is a request, FALSE if it is a reply
119 bool (*get_request
) (message_t
*this);
122 * @brief Generates the UDP packet of specific message
124 * @param this message_t object
126 * - SUCCESS if packet could be generated
127 * - EXCHANGE_TYPE_NOT_SET if exchange type is currently not set
130 status_t (*generate_packet
) (message_t
*this, packet_t
**packet
);
133 * @brief Destroys a message and all including objects
135 * @param this message_t object
138 status_t (*destroy
) (message_t
*this);
142 * Creates an message_t object from a incoming UDP Packet.
144 * @warning the given packet_t object is not copied and gets
145 * destroyed in message_t's destroy call.
147 * @warning Packet is not parsed in here!
149 * - exchange_type is set to NOT_SET
150 * - original_initiator is set to TRUE
151 * - is_request is set to TRUE
153 * @param packet packet_t object which is assigned to message
156 * - created message_t object
157 * - NULL if out of ressources
159 message_t
* message_create_from_packet(packet_t
*packet
);
163 * Creates an empty message_t object.
165 * - exchange_type is set to NOT_SET
166 * - original_initiator is set to TRUE
167 * - is_request is set to TRUE
170 * - created message_t object
171 * - NULL if out of ressources
173 message_t
* message_create();
175 #endif /*MESSAGE_H_*/