4 * @brief Interface of cp_payload_t.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
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>.
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
27 #include <encoding/payloads/payload.h>
28 #include <encoding/payloads/configuration_attribute.h>
29 #include <utils/linked_list.h>
32 * CP_PAYLOAD length in bytes without any proposal substructure.
36 #define CP_PAYLOAD_HEADER_LENGTH 8
39 typedef enum config_type_t config_type_t
;
42 * Config Type of an Configuration Payload.
54 * string mappings for config_type_t.
58 extern mapping_t config_type_m
[];
61 typedef struct cp_payload_t cp_payload_t
;
64 * @brief Class representing an IKEv2-CP Payload.
66 * The CP Payload format is described in RFC section 3.15.
69 * - cp_payload_create()
75 * The payload_t interface.
77 payload_t payload_interface
;
80 * @brief Creates an iterator of stored configuration_attribute_t objects.
82 * @warning The created iterator has to get destroyed by the caller!
84 * @warning When deleting an attribute using this iterator,
85 * the length of this configuration_attribute_t has to be refreshed
86 * by calling get_length()!
88 * @param this calling cp_payload_t object
89 * @param[in] forward iterator direction (TRUE: front to end)
90 * @return created iterator_t object
92 iterator_t
*(*create_configuration_attribute_iterator
) (cp_payload_t
*this, bool forward
);
95 * @brief Adds a configuration_attribute_t object to this object.
97 * @warning The added configuration_attribute_t object is
98 * getting destroyed in destroy function of cp_payload_t.
100 * @param this calling cp_payload_t object
101 * @param attribute configuration_attribute_t object to add
103 void (*add_configuration_attribute
) (cp_payload_t
*this, configuration_attribute_t
*attribute
);
106 * @brief Set the config type.
108 * @param this calling cp_payload_t object
109 * @param config_type config_type_t to set
111 void (*set_config_type
) (cp_payload_t
*this,config_type_t config_type
);
114 * @brief Get the config type.
116 * @param this calling cp_payload_t object
117 * @return config_type_t
119 config_type_t (*get_config_type
) (cp_payload_t
*this);
122 * @brief Destroys an cp_payload_t object.
124 * @param this cp_payload_t object to destroy
126 void (*destroy
) (cp_payload_t
*this);
130 * @brief Creates an empty cp_payload_t object
132 * @return cp_payload_t object
136 cp_payload_t
*cp_payload_create();
138 #endif /*CP_PAYLOAD_H_*/