- class transform_attribute fully tested and written
[strongswan.git] / Source / charon / payloads / transform_attribute.h
1 /**
2 * @file transform_attribute.h
3 *
4 * @brief Declaration of the class transform_attribute_t.
5 *
6 * An object of this type represents an IKEv2 TRANSFORM attribute.
7 *
8 */
9
10 /*
11 * Copyright (C) 2005 Jan Hutter, Martin Willi
12 * Hochschule fuer Technik Rapperswil
13 *
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>.
18 *
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
22 * for more details.
23 */
24
25 #ifndef TRANSFORM_ATTRIBUTE_H_
26 #define TRANSFORM_ATTRIBUTE_H_
27
28 #include "../types.h"
29 #include "payload.h"
30
31 /**
32 * Object representing an IKEv2- TRANSFORM Attribute
33 *
34 * The TRANSFORM ATTRIBUTE format is described in RFC section 3.3.5.
35 *
36 */
37 typedef struct transform_attribute_s transform_attribute_t;
38
39 struct transform_attribute_s {
40 /**
41 * implements payload_t interface
42 */
43 payload_t payload_interface;
44
45 /**
46 * @brief Returns the currently set value of the attribute
47 *
48 * @warning Returned data are not copied
49 *
50 * @param this calling transform_attribute_t object
51 * @return chunk_t pointing to the value
52 */
53 chunk_t (*get_value) (transform_attribute_t *this);
54
55 /**
56 * @brief Sets the value of the attribute.
57 *
58 * @warning Value is getting copied
59 *
60 * @param this calling transform_attribute_t object
61 * @param value chunk_t pointing to the value to set
62 * @return
63 * - SUCCESS or
64 * - OUT_OF_RES
65 */
66 status_t (*set_value) (transform_attribute_t *this, chunk_t value);
67
68 /**
69 * @brief Sets the type of the attribute.
70 *
71 * @param this calling transform_attribute_t object
72 * @param type type to set (most significant bit is set to zero)
73 * @return SUCCESS
74 */
75 status_t (*set_attribute_type) (transform_attribute_t *this, u_int16_t type);
76
77 /**
78 * @brief get the type of the attribute.
79 *
80 * @param this calling transform_attribute_t object
81 * @return type of the value
82 */
83 u_int16_t (*get_attribute_type) (transform_attribute_t *this);
84
85 /**
86 * @brief Destroys an transform_attribute_t object.
87 *
88 * @param this transform_attribute_t object to destroy
89 * @return
90 * SUCCESS in any case
91 */
92 status_t (*destroy) (transform_attribute_t *this);
93 };
94
95 /**
96 * @brief Creates an empty transform_attribute_t object
97 *
98 * @return
99 * - created transform_attribute_t object, or
100 * - NULL if failed
101 */
102
103 transform_attribute_t *transform_attribute_create();
104
105 #endif /*TRANSFORM_ATTRIBUTE_H_*/