4 * @brief Declaration of the class sa_payload_t.
6 * An object of this type represents an IKEv2 SA-Payload and contains proposal
12 * Copyright (C) 2005 Jan Hutter, Martin Willi
13 * Hochschule fuer Technik Rapperswil
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>.
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
30 #include <encoding/payloads/payload.h>
31 #include <encoding/payloads/proposal_substructure.h>
32 #include <utils/linked_list.h>
35 * Critical flag must not be set
37 #define SA_PAYLOAD_CRITICAL_FLAG FALSE;
40 * SA_PAYLOAD length in bytes without any proposal substructure
42 #define SA_PAYLOAD_HEADER_LENGTH 4
44 typedef struct sa_payload_t sa_payload_t
;
47 * Object representing an IKEv2-SA Payload
49 * The SA Payload format is described in RFC section 3.3.
54 * implements payload_t interface
56 payload_t payload_interface
;
59 * @brief Creates an iterator of stored proposal_substructure_t objects.
61 * @warning The created iterator has to get destroyed by the caller!
63 * @warning When deleting an proposal using this iterator,
64 * the length of this transform substructure has to be refreshed
65 * by calling get_length()!
67 * @param this calling sa_payload_t object
68 * @param iterator the created iterator is stored at the pointed pointer
69 * @param[in] forward iterator direction (TRUE: front to end)
72 * - OUT_OF_RES if iterator could not be created
74 status_t (*create_proposal_substructure_iterator
) (sa_payload_t
*this,iterator_t
**iterator
, bool forward
);
77 * @brief Adds a proposal_substructure_t object to this object.
79 * @warning The added proposal_substructure_t object is
80 * getting destroyed in destroy function of sa_payload_t.
82 * @param this calling sa_payload_t object
83 * @param proposal proposal_substructure_t object to add
84 * @return - SUCCESS if succeeded
87 status_t (*add_proposal_substructure
) (sa_payload_t
*this,proposal_substructure_t
*proposal
);
90 * @brief Destroys an sa_payload_t object.
92 * @param this sa_payload_t object to destroy
96 status_t (*destroy
) (sa_payload_t
*this);
100 * @brief Creates an empty sa_payload_t object
103 * - created sa_payload_t object, or
107 sa_payload_t
*sa_payload_create();
110 #endif /*SA_PAYLOAD_H_*/