2 * Copyright (C) 2005-2006 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 transform_attribute transform_attribute
19 * @{ @ingroup payloads
22 #ifndef TRANSFORM_ATTRIBUTE_H_
23 #define TRANSFORM_ATTRIBUTE_H_
25 typedef enum transform_attribute_type_t transform_attribute_type_t
;
26 typedef struct transform_attribute_t transform_attribute_t
;
29 #include <encoding/payloads/payload.h>
33 * Type of the attribute, as in IKEv2 RFC 3.3.5.
35 enum transform_attribute_type_t
{
36 ATTRIBUTE_UNDEFINED
= 16384,
41 * enum name for transform_attribute_type_t.
43 extern enum_name_t
*transform_attribute_type_names
;
46 * Class representing an IKEv2- TRANSFORM Attribute.
48 * The TRANSFORM ATTRIBUTE format is described in RFC section 3.3.5.
50 struct transform_attribute_t
{
52 * The payload_t interface.
54 payload_t payload_interface
;
57 * Returns the currently set value of the attribute.
59 * Returned data are not copied.
61 * @return chunk_t pointing to the value
63 chunk_t (*get_value_chunk
) (transform_attribute_t
*this);
66 * Returns the currently set value of the attribute.
68 * Returned data are not copied.
72 u_int16_t (*get_value
) (transform_attribute_t
*this);
75 * Sets the value of the attribute.
77 * Value is getting copied.
79 * @param value chunk_t pointing to the value to set
81 void (*set_value_chunk
) (transform_attribute_t
*this, chunk_t value
);
84 * Sets the value of the attribute.
86 * @param value value to set
88 void (*set_value
) (transform_attribute_t
*this, u_int16_t value
);
91 * Sets the type of the attribute.
93 * @param type type to set (most significant bit is set to zero)
95 void (*set_attribute_type
) (transform_attribute_t
*this, u_int16_t type
);
98 * get the type of the attribute.
100 * @return type of the value
102 u_int16_t (*get_attribute_type
) (transform_attribute_t
*this);
105 * Clones an transform_attribute_t object.
107 * @return cloned transform_attribute_t object
109 transform_attribute_t
* (*clone
) (transform_attribute_t
*this);
112 * Destroys an transform_attribute_t object.
114 void (*destroy
) (transform_attribute_t
*this);
118 * Creates an empty transform_attribute_t object.
120 * @return transform_attribute_t object
122 transform_attribute_t
*transform_attribute_create(void);
125 * Creates an transform_attribute_t of type KEY_LENGTH.
127 * @param key_length key length in bytes
128 * @return transform_attribute_t object
130 transform_attribute_t
*transform_attribute_create_key_length(u_int16_t key_length
);
132 #endif /** TRANSFORM_ATTRIBUTE_H_ @}*/