Introduced payload types sa_payload and proposal_substructure
[strongswan.git] / Source / charon / payloads / sa_payload.h
1 /**
2 * @file sa_payload.h
3 *
4 * @brief Declaration of the class sa_payload_t.
5 *
6 * An object of this type represents an IKEv2 SA-Payload and contains proposal
7 * substructures.
8 *
9 */
10
11 /*
12 * Copyright (C) 2005 Jan Hutter, Martin Willi
13 * Hochschule fuer Technik Rapperswil
14 *
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>.
19 *
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
23 * for more details.
24 */
25
26 #ifndef SA_PAYLOAD_H_
27 #define SA_PAYLOAD_H_
28
29 #include "../types.h"
30 #include "payload.h"
31 #include "proposal_substructure.h"
32
33 /**
34 * Critical flag must not be set
35 */
36 #define SA_PAYLOAD_CRITICAL_FLAG FALSE;
37
38 /**
39 * SA_PAYLOAD length in bytes without any proposal substructure
40 */
41 #define SA_PAYLOAD_HEADER_LENGTH 4
42
43 /**
44 * Object representing an IKEv2-SA Payload
45 *
46 * The SA Payload format is described in RFC section 3.3.
47 *
48 */
49 typedef struct sa_payload_s sa_payload_t;
50
51 struct sa_payload_s {
52 /**
53 * implements payload_t interface
54 */
55 payload_t payload_interface;
56
57 /**
58 * @brief Destroys an sa_payload_t object.
59 *
60 * @param this sa_payload_t object to destroy
61 * @return
62 * SUCCESS in any case
63 */
64 status_t (*destroy) (sa_payload_t *this);
65 };
66
67 /**
68 * @brief Creates an empty sa_payload_t object
69 *
70 * @return
71 * - created sa_payload_t object, or
72 * - NULL if failed
73 */
74
75 sa_payload_t *sa_payload_create();
76
77
78 #endif /*SA_PAYLOAD_H_*/