generator now has its generator_context which is used to generate more

then one payload in sequence...
This commit is contained in:
Jan Hutter
2005-11-10 17:17:46 +00:00
parent c64d7032fe
commit 110dc83a3c
7 changed files with 417 additions and 126 deletions
+106 -3
View File
@@ -26,6 +26,38 @@
#include "types.h"
#include "packet.h"
/**
* @brief Different types of IKE-Exchanges.
*
* See RFC for different types.
*/
typedef enum exchange_type_e exchange_type_t;
enum exchange_type_e{
/**
* NOT_SET, not a official message type :-)
*/
NOT_SET = 0,
/**
* IKE_SA_INIT
*/
IKE_SA_INIT = 34,
/**
* IKE_AUTH
*/
IKE_AUTH = 35,
/**
* CREATE_CHILD_SA
*/
CREATE_CHILD_SA = 36,
/**
* INFORMATIONAL
*/
INFORMATIONAL = 37
};
/**
* @brief This class is used to represent an IKEv2-Message.
*
@@ -35,22 +67,89 @@ typedef struct message_s message_t;
struct message_s {
/**
* @brief Sets the exchange type of the message.
*
* @param this message_t object
* @param exchange_type exchange_type to set
* @return SUCCESS
*/
status_t (*set_exchange_type) (message_t *this,exchange_type_t exchange_type);
/**
* @brief Gets the exchange type of the message.
*
* @param this message_t object
* @return exchange type of the message
*/
exchange_type_t (*get_exchange_type) (message_t *this);
/**
* @brief Sets the original initiator flag.
*
* @param this message_t object
* @param original_initiator TRUE if message is from original initiator
* @return SUCCESS
*/
status_t (*set_original_initiator) (message_t *this,bool original_initiator);
/**
* @brief Gets original initiator flag.
*
* @param this message_t object
* @return TRUE if message is from original initiator, FALSE otherwise
*/
bool (*get_original_initiator) (message_t *this);
/**
* @brief Sets the request flag.
*
* @param this message_t object
* @param original_initiator TRUE if message is a request, FALSE if it is a reply
* @return SUCCESS
*/
status_t (*set_request) (message_t *this,bool request);
/**
* @brief Gets request flag.
*
* @param this message_t object
* @return TRUE if message is a request, FALSE if it is a reply
*/
bool (*get_request) (message_t *this);
/**
* @brief Generates the UDP packet of specific message
*
* @param this message_t object
* @return
* - SUCCESS if packet could be generated
* - EXCHANGE_TYPE_NOT_SET if exchange type is currently not set
* ....
*/
status_t (*generate_packet) (message_t *this, packet_t **packet);
/**
* @brief Destroys a message and all including objects
*
* @param this message_t object
* @return
* - SUCCESSFUL if succeeded
* @return SUCCESS
*/
status_t (*destroy) (message_t *this);
};
/**
* Creates an message_t object from a incoming UDP Packet.
*
*
* @warning the given packet_t object is not copied and gets
* destroyed in message_t's destroy call.
*
* @warning Packet is not parsed in here!
*
* - exchange_type is set to NOT_SET
* - original_initiator is set to TRUE
* - is_request is set to TRUE
*
* @param packet packet_t object which is assigned to message
*
* @return
@@ -63,6 +162,10 @@ message_t * message_create_from_packet(packet_t *packet);
/**
* Creates an empty message_t object.
*
* - exchange_type is set to NOT_SET
* - original_initiator is set to TRUE
* - is_request is set to TRUE
*
* @return
* - created message_t object
* - NULL if out of ressources