2 * @file transform_attribute.h
4 * @brief Declaration of the class transform_attribute_t.
6 * An object of this type represents an IKEv2 TRANSFORM attribute.
11 * Copyright (C) 2005 Jan Hutter, Martin Willi
12 * Hochschule fuer Technik Rapperswil
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>.
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
25 #ifndef TRANSFORM_ATTRIBUTE_H_
26 #define TRANSFORM_ATTRIBUTE_H_
29 #include <encoding/payloads/payload.h>
32 typedef enum transform_attribute_type_t transform_attribute_type_t
;
35 * Type of the attribute, as in IKEv2 draft 3.3.5
37 enum transform_attribute_type_t
{
38 ATTRIBUTE_UNDEFINED
= 16384,
43 * string mappings for transform_attribute_type_t
45 extern mapping_t transform_attribute_type_m
[];
47 typedef struct transform_attribute_t transform_attribute_t
;
50 * Object representing an IKEv2- TRANSFORM Attribute
52 * The TRANSFORM ATTRIBUTE format is described in RFC section 3.3.5.
55 struct transform_attribute_t
{
57 * implements payload_t interface
59 payload_t payload_interface
;
62 * @brief Returns the currently set value of the attribute
64 * @warning Returned data are not copied
66 * @param this calling transform_attribute_t object
67 * @return chunk_t pointing to the value
69 chunk_t (*get_value_chunk
) (transform_attribute_t
*this);
72 * @brief Returns the currently set value of the attribute
74 * @warning Returned data are not copied
76 * @param this calling transform_attribute_t object
79 u_int16_t (*get_value
) (transform_attribute_t
*this);
82 * @brief Sets the value of the attribute.
84 * @warning Value is getting copied
86 * @param this calling transform_attribute_t object
87 * @param value chunk_t pointing to the value to set
92 status_t (*set_value_chunk
) (transform_attribute_t
*this, chunk_t value
);
95 * @brief Sets the value of the attribute.
97 * @param this calling transform_attribute_t object
98 * @param value value to set
103 status_t (*set_value
) (transform_attribute_t
*this, u_int16_t value
);
106 * @brief Sets the type of the attribute.
108 * @param this calling transform_attribute_t object
109 * @param type type to set (most significant bit is set to zero)
112 status_t (*set_attribute_type
) (transform_attribute_t
*this, u_int16_t type
);
115 * @brief get the type of the attribute.
117 * @param this calling transform_attribute_t object
118 * @return type of the value
120 u_int16_t (*get_attribute_type
) (transform_attribute_t
*this);
123 * @brief Clones an transform_attribute_t object.
125 * @param this transform_attribute_t object to clone
126 * @param clone the new clone will be written there
131 status_t (*clone
) (transform_attribute_t
*this,transform_attribute_t
**clone
);
134 * @brief Destroys an transform_attribute_t object.
136 * @param this transform_attribute_t object to destroy
138 * SUCCESS in any case
140 status_t (*destroy
) (transform_attribute_t
*this);
144 * @brief Creates an empty transform_attribute_t object
147 * - created transform_attribute_t object, or
151 transform_attribute_t
*transform_attribute_create();
153 #endif /*TRANSFORM_ATTRIBUTE_H_*/