diff options
author | Jan Hutter <jhutter@hsr.ch> | 2005-11-08 09:47:17 +0000 |
---|---|---|
committer | Jan Hutter <jhutter@hsr.ch> | 2005-11-08 09:47:17 +0000 |
commit | ca6dd4f659df3f8c528b0d56e90cff219da663ba (patch) | |
tree | 03a1ef268644bd419b8fa5329216253da1ca39f7 | |
parent | d75f797e25e866344f8154c9545fe154e197a7f8 (diff) | |
download | strongswan-ca6dd4f659df3f8c528b0d56e90cff219da663ba.tar.bz2 strongswan-ca6dd4f659df3f8c528b0d56e90cff219da663ba.tar.xz |
- implemented create and destroy function
-rw-r--r-- | Source/charon/message.c | 54 | ||||
-rw-r--r-- | Source/charon/message.h | 28 |
2 files changed, 82 insertions, 0 deletions
diff --git a/Source/charon/message.c b/Source/charon/message.c index b7c86a9aa..a65a3d8a9 100644 --- a/Source/charon/message.c +++ b/Source/charon/message.c @@ -20,4 +20,58 @@ * for more details. */ +#include <stdlib.h> +#include <freeswan.h> +#include <pluto/constants.h> +#include <pluto/defs.h> + +#include "types.h" #include "message.h" + +/** + * Private data of an message_t object + */ +typedef struct private_message_s private_message_t; + +struct private_message_s { + + /** + * Public part of a message_t object + */ + message_t public; + + + /* Private values */ + +}; + +/** + * @brief implements function destroy of message_t + */ +static status_t destroy (private_message_t *this) +{ + if (this == NULL) + { + return FAILED; + } + pfree(this); + return SUCCESS; +} + +/* + * Described in Header-File + */ +message_t * message_create() +{ + private_message_t *this = alloc_thing(private_message_t, "private_message_t"); + if (this == NULL) + { + return NULL; + } + + /* Public functions */ + this->public.destroy = (status_t(*)(message_t*))destroy; + + + return (&this->public); +} diff --git a/Source/charon/message.h b/Source/charon/message.h index 0ac72212f..d511b27f6 100644 --- a/Source/charon/message.h +++ b/Source/charon/message.h @@ -23,4 +23,32 @@ #ifndef MESSAGE_H_ #define MESSAGE_H_ +#include "types.h" + +/** + * @brief This class is used to represent an IKEv2-Message. + * + * An IKEv2-Message is either a request or response. + */ +typedef struct message_s message_t; + +struct message_s { + + /** + * @brief Destroys a message object + * + * @param this message_t object + * @return SUCCESSFUL if succeeded, FAILED otherwise + */ + status_t (*destroy) (message_t *this); +}; + +/** + * Creates an message_t-object + * + * @return created message_t object + */ +message_t * message_create(); + + #endif /*MESSAGE_H_*/ |