2 * Copyright (C) 2005-2009 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * @defgroup cp_payload cp_payload
19 * @{ @ingroup payloads
25 typedef enum config_type_t config_type_t
;
26 typedef struct cp_payload_t cp_payload_t
;
29 #include <encoding/payloads/payload.h>
30 #include <encoding/payloads/configuration_attribute.h>
31 #include <utils/enumerator.h>
34 * Config Type of an Configuration Payload.
44 * enum name for config_type_t.
46 extern enum_name_t
*config_type_names
;
49 * Class representing an IKEv2 configuration / IKEv1 attribute payload.
54 * The payload_t interface.
56 payload_t payload_interface
;
59 * Creates an enumerator of stored configuration_attribute_t objects.
61 * @return enumerator over configration_attribute_T
63 enumerator_t
*(*create_attribute_enumerator
) (cp_payload_t
*this);
66 * Adds a configuration attribute to the configuration payload.
68 * @param attribute attribute to add
70 void (*add_attribute
)(cp_payload_t
*this,
71 configuration_attribute_t
*attribute
);
74 * Get the configuration payload type.
76 * @return type of configuration payload
78 config_type_t (*get_type
) (cp_payload_t
*this);
81 * Set the configuration payload identifier (IKEv1 only).
83 @param identifier identifier to set
85 void (*set_identifier
) (cp_payload_t
*this, u_int16_t identifier
);
88 * Get the configuration payload identifier (IKEv1 only).
92 u_int16_t (*get_identifier
) (cp_payload_t
*this);
95 * Destroys an cp_payload_t object.
97 void (*destroy
) (cp_payload_t
*this);
101 * Creates an empty configuration payload
103 * @param type payload type, CONFIGURATION or CONFIGURATION_V1
104 * @return empty configuration payload
106 cp_payload_t
*cp_payload_create(payload_type_t type
);
109 * Creates an cp_payload_t with type and value
111 * @param type payload type, CONFIGURATION or CONFIGURATION_V1
112 * @param cfg_type type of configuration payload to create
113 * @return created configuration payload
115 cp_payload_t
*cp_payload_create_type(payload_type_t type
, config_type_t cfg_type
);
117 #endif /** CP_PAYLOAD_H_ @}*/