2 * @file transform_attribute.h
4 * @brief Interface of transform_attribute_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
23 #ifndef TRANSFORM_ATTRIBUTE_H_
24 #define TRANSFORM_ATTRIBUTE_H_
27 #include <encoding/payloads/payload.h>
30 typedef enum transform_attribute_type_t transform_attribute_type_t
;
33 * Type of the attribute, as in IKEv2 RFC 3.3.5.
37 enum transform_attribute_type_t
{
38 ATTRIBUTE_UNDEFINED
= 16384,
43 * String mappings for transform_attribute_type_t.
47 extern mapping_t transform_attribute_type_m
[];
49 typedef struct transform_attribute_t transform_attribute_t
;
52 * @brief Class representing an IKEv2- TRANSFORM Attribute.
54 * The TRANSFORM ATTRIBUTE format is described in RFC section 3.3.5.
58 struct transform_attribute_t
{
60 * The payload_t interface.
62 payload_t payload_interface
;
65 * @brief Returns the currently set value of the attribute.
67 * @warning Returned data are not copied.
69 * @param this calling transform_attribute_t object
70 * @return chunk_t pointing to the value
72 chunk_t (*get_value_chunk
) (transform_attribute_t
*this);
75 * @brief Returns the currently set value of the attribute.
77 * @warning Returned data are not copied.
79 * @param this calling transform_attribute_t object
82 u_int16_t (*get_value
) (transform_attribute_t
*this);
85 * @brief Sets the value of the attribute.
87 * @warning Value is getting copied.
89 * @param this calling transform_attribute_t object
90 * @param value chunk_t pointing to the value to set
92 void (*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
100 void (*set_value
) (transform_attribute_t
*this, u_int16_t value
);
103 * @brief Sets the type of the attribute.
105 * @param this calling transform_attribute_t object
106 * @param type type to set (most significant bit is set to zero)
108 void (*set_attribute_type
) (transform_attribute_t
*this, u_int16_t type
);
111 * @brief get the type of the attribute.
113 * @param this calling transform_attribute_t object
114 * @return type of the value
116 u_int16_t (*get_attribute_type
) (transform_attribute_t
*this);
119 * @brief Clones an transform_attribute_t object.
121 * @param this transform_attribute_t object to clone
122 * @return cloned transform_attribute_t object
124 transform_attribute_t
* (*clone
) (transform_attribute_t
*this);
127 * @brief Destroys an transform_attribute_t object.
129 * @param this transform_attribute_t object to destroy
131 void (*destroy
) (transform_attribute_t
*this);
135 * @brief Creates an empty transform_attribute_t object.
137 * @return transform_attribute_t object
141 transform_attribute_t
*transform_attribute_create();
144 * @brief Creates an transform_attribute_t of type KEY_LENGTH.
146 * @param key_length key length in bytes
147 * @return transform_attribute_t object
151 transform_attribute_t
*transform_attribute_create_key_length(u_int16_t key_length
);
154 #endif /*TRANSFORM_ATTRIBUTE_H_*/