9146bc8ddeb803c51d8c7d2faf4f77e92bc7aa0c
[strongswan.git] / Source / charon / payloads / proposal_substructure.h
1 /**
2 * @file proposal_substructure.h
3 *
4 * @brief Declaration of the class proposal_substructure_t.
5 *
6 * An object of this type represents an IKEv2 PROPOSAL Substructure and contains transforms.
7 *
8 */
9
10 /*
11 * Copyright (C) 2005 Jan Hutter, Martin Willi
12 * Hochschule fuer Technik Rapperswil
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2 of the License, or (at your
17 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
23 */
24
25 #ifndef PROPOSAL_SUBSTRUCTURE_H_
26 #define PROPOSAL_SUBSTRUCTURE_H_
27
28 #include "../types.h"
29 #include "payload.h"
30 #include "../utils/linked_list.h"
31 #include "transform_substructure.h"
32
33 /**
34 * Object representing an IKEv2- PROPOSAL SUBSTRUCTURE
35 *
36 * The PROPOSAL SUBSTRUCTURE format is described in RFC section 3.3.1.
37 *
38 */
39 typedef struct proposal_substructure_s proposal_substructure_t;
40
41 struct proposal_substructure_s {
42 /**
43 * implements payload_t interface
44 */
45 payload_t payload_interface;
46
47 /**
48 * @brief Creates an iterator of stored transform_substructure_t objects.
49 *
50 * @warning The created iterator has to get destroyed by the caller!
51 *
52 * @param this calling proposal_substructure_t object
53 * @param iterator the created iterator is stored at the pointed pointer
54 * @param[in] forward iterator direction (TRUE: front to end)
55 * @return
56 * - SUCCESS or
57 * - OUT_OF_RES if iterator could not be created
58 */
59 status_t (*create_transform_substructure_iterator) (proposal_substructure_t *this,linked_list_iterator_t **iterator, bool forward);
60
61 /**
62 * @brief Adds a transform_substructure_t object to this object.
63 *
64 * @warning The added transform_substructure_t object is
65 * getting destroyed in destroy function of proposal_substructure_t.
66 *
67 * @param this calling proposal_substructure_t object
68 * @param transform transform_substructure_t object to add
69 * @return - SUCCESS if succeeded
70 * - FAILED otherwise
71 */
72 status_t (*add_transform_substructure) (proposal_substructure_t *this,transform_substructure_t *transform);
73
74 /**
75 * @brief Destroys an proposal_substructure_t object.
76 *
77 * @param this proposal_substructure_t object to destroy
78 * @return
79 * SUCCESS in any case
80 */
81 status_t (*destroy) (proposal_substructure_t *this);
82 };
83
84 /**
85 * @brief Creates an empty proposal_substructure_t object
86 *
87 * @return
88 * - created proposal_substructure_t object, or
89 * - NULL if failed
90 */
91
92 proposal_substructure_t *proposal_substructure_create();
93
94
95
96 #endif /*PROPOSAL_SUBSTRUCTURE_H_*/