249137e2b1cc59a3ec352bb16758d678c9930801
[strongswan.git] / Source / charon / message.h
1 /**
2 * @file message.h
3 *
4 * @brief Class message_t. Object of this type represents an IKEv2-Message.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
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>.
16 *
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
20 * for more details.
21 */
22
23 #ifndef MESSAGE_H_
24 #define MESSAGE_H_
25
26 #include "types.h"
27 #include "packet.h"
28
29 /**
30 * @brief This class is used to represent an IKEv2-Message.
31 *
32 * An IKEv2-Message is either a request or response.
33 */
34 typedef struct message_s message_t;
35
36 struct message_s {
37
38 /**
39 * @brief Destroys a message and all including objects
40 *
41 * @param this message_t object
42 * @return
43 * - SUCCESSFUL if succeeded
44 */
45 status_t (*destroy) (message_t *this);
46 };
47
48 /**
49 * Creates an message_t object from a incoming UDP Packet.
50 *
51 * @warning the given packet_t object is not copied and gets
52 * destroyed in message_t's destroy call.
53 *
54 * @param packet packet_t object which is assigned to message
55 *
56 * @return
57 * - created message_t object
58 * - NULL if out of ressources
59 */
60 message_t * message_create_from_packet(packet_t *packet);
61
62
63 /**
64 * Creates an empty message_t object.
65 *
66 * @return
67 * - created message_t object
68 * - NULL if out of ressources
69 */
70 message_t * message_create();
71
72 #endif /*MESSAGE_H_*/