IKEv1 ConfigMode: Added the payload handlers for attribute_payload and data_attribute...
[strongswan.git] / src / libcharon / encoding / payloads / data_attribute_v1.h
1
2 /**
3 * @defgroup data_attribute_v1 data_attribute_v1
4 * @{ @ingroup payloads
5 */
6
7 #ifndef DATA_ATTRIBUTE_V1_H_
8 #define DATA_ATTRIBUTE_V1_H_
9
10 typedef struct data_attribute_v1_t data_attribute_v1_t;
11
12 #include <library.h>
13 #include <attributes/attributes.h>
14 #include <encoding/payloads/payload.h>
15
16 /**
17 * Configuration attribute header length in bytes.
18 */
19 #define DATA_ATTRIBUTE_V1_HEADER_LENGTH 4
20
21 /**
22 * Class representing an IKEv1-Data Attribute.
23 *
24 * The DATA_ATTRIBUTE_V1 format is described in RFC section 3.15.1.
25 */
26 struct data_attribute_v1_t {
27
28 /**
29 * Implements payload_t interface.
30 */
31 payload_t payload_interface;
32
33 /**
34 * Get the type of the attribute.
35 *
36 * @return type of the data attribute
37 */
38 configuration_attribute_type_t (*get_type)(data_attribute_v1_t *this);
39
40 /**
41 * Returns the value of the attribute.
42 *
43 * @return the basic internal value
44 */
45 u_int16_t (*get_value) (data_attribute_v1_t *this);
46
47 /**
48 * Returns the value of the attribute.
49 *
50 * @return chunk_t pointing to the internal value
51 */
52 chunk_t (*get_value_chunk) (data_attribute_v1_t *this);
53
54 /**
55 * Destroys an configuration_attribute_t object.
56 */
57 void (*destroy) (data_attribute_v1_t *this);
58 };
59
60 /**
61 * Creates an empty data attribute.
62 *
63 * @return created data attribute
64 */
65 data_attribute_v1_t *data_attribute_v1_create();
66
67 /**
68 * Creates a data attribute with type and value.
69 *
70 * @param type type of data attribute
71 * @param value value, gets cloned
72 * @return created data attribute
73 */
74 data_attribute_v1_t *data_attribute_v1_create_value(
75 configuration_attribute_type_t type, chunk_t value);
76
77
78 /**
79 * Creates a data attribute with type and value.
80 *
81 * @param type type of data attribute
82 * @param value value
83 * @return created data attribute
84 */
85 data_attribute_v1_t *data_attribute_v1_create_basic(
86 configuration_attribute_type_t type, u_int16_t value);
87
88 #endif /** DATA_ATTRIBUTE_V1_H_ @}*/