- parser succesfully parses sa payload
[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 #include "../utils/linked_list.h"
33
34 /**
35 * Critical flag must not be set
36 */
37 #define SA_PAYLOAD_CRITICAL_FLAG FALSE;
38
39 /**
40 * SA_PAYLOAD length in bytes without any proposal substructure
41 */
42 #define SA_PAYLOAD_HEADER_LENGTH 4
43
44 /**
45 * Object representing an IKEv2-SA Payload
46 *
47 * The SA Payload format is described in RFC section 3.3.
48 *
49 */
50 typedef struct sa_payload_s sa_payload_t;
51
52 struct sa_payload_s {
53 /**
54 * implements payload_t interface
55 */
56 payload_t payload_interface;
57
58 /**
59 * @brief Creates an iterator of stored proposal_substructure_t objects.
60 *
61 * @warning The created iterator has to get destroyed by the caller!
62 *
63 * @param this calling sa_payload_t object
64 * @param iterator the created iterator is stored at the pointed pointer
65 * @param[in] forward iterator direction (TRUE: front to end)
66 * @return
67 * - SUCCESS or
68 * - OUT_OF_RES if iterator could not be created
69 */
70 status_t (*create_proposal_substructure_iterator) (sa_payload_t *this,linked_list_iterator_t **iterator, bool forward);
71
72 /**
73 * @brief Adds a proposal_substructure_t object to this object.
74 *
75 * @warning The added proposal_substructure_t object is
76 * getting destroyed in destroy function of sa_payload_t.
77 *
78 * @param this calling sa_payload_t object
79 * @param proposal proposal_substructure_t object to add
80 * @return - SUCCESS if succeeded
81 * - FAILED otherwise
82 */
83 status_t (*add_proposal_substructure) (sa_payload_t *this,proposal_substructure_t *proposal);
84
85 /**
86 * @brief Destroys an sa_payload_t object.
87 *
88 * @param this sa_payload_t object to destroy
89 * @return
90 * SUCCESS in any case
91 */
92 status_t (*destroy) (sa_payload_t *this);
93 };
94
95 /**
96 * @brief Creates an empty sa_payload_t object
97 *
98 * @return
99 * - created sa_payload_t object, or
100 * - NULL if failed
101 */
102
103 sa_payload_t *sa_payload_create();
104
105
106 #endif /*SA_PAYLOAD_H_*/