IKEv1 ConfigMode: Added the payload handlers for attribute_payload and data_attribute...
[strongswan.git] / src / libcharon / encoding / payloads / attribute_payload_v1.h
1
2 /**
3 * @defgroup attribute_payload_v1 attribute_payload_v1
4 * @{ @ingroup payloads
5 */
6
7 #ifndef ATTRIBUTE_PAYLOAD_V1_H_
8 #define ATTRIBUTE_PAYLOAD_V1_H_
9
10 typedef enum config_type_v1_t config_type_v1_t;
11 typedef struct attribute_payload_v1_t attribute_payload_v1_t;
12
13 #include <library.h>
14 #include <encoding/payloads/payload.h>
15 #include <encoding/payloads/data_attribute_v1.h>
16 #include <utils/enumerator.h>
17
18 /**
19 * ATTRIBUTE_PAYLOAD_V1 length in bytes without any proposal substructure.
20 */
21 #define ATTRIBUTE_PAYLOAD_V1_HEADER_LENGTH 8
22
23 /**
24 * Config Type of an Attribute Payload.
25 */
26 enum config_type_v1_t {
27 ISAKMP_CFG_REQUEST = 1,
28 ISAKMP_CFG_REPLY = 2,
29 ISAKMP_CFG_SET = 3,
30 ISAKMP_CFG_ACK = 4,
31 };
32
33 /**
34 * enum name for config_type_v1_t.
35 */
36 extern enum_name_t *config_type_v1_names;
37
38 /**
39 * Class representing an ISAKMP Config Mode Attribute Payload.
40 *
41 * The Attribute Payload format is described in draft-ietf-ipsec-isakmp-mode-cfg-o5.txt section 3.2.
42 */
43 struct attribute_payload_v1_t {
44
45 /**
46 * The payload_t interface.
47 */
48 payload_t payload_interface;
49
50 /**
51 * Creates an enumerator of stored data_attribute_v1_t objects.
52 *
53 * @return enumerator over configration_attribute_t
54 */
55 enumerator_t *(*create_attribute_enumerator) (attribute_payload_v1_t *this);
56
57 /**
58 * Adds a configuration attribute to the attribute payload.
59 *
60 * @param attribute attribute to add
61 */
62 void (*add_attribute)(attribute_payload_v1_t *this,
63 data_attribute_v1_t *attribute);
64
65 /**
66 * Get the attribute payload type.
67 *
68 * @return type of attribute payload
69 */
70 config_type_v1_t (*get_type) (attribute_payload_v1_t *this);
71
72 /**
73 * Destroys an attribute_payload_v1_t object.
74 */
75 void (*destroy) (attribute_payload_v1_t *this);
76 };
77
78 /**
79 * Creates an empty attribute payload
80 *
81 * @return empty attribute payload
82 */
83 attribute_payload_v1_t *attribute_payload_v1_create();
84
85 /**
86 * Creates an attribute_payload_v1_t with type and value
87 *
88 * @param config_type type of attribute payload to create
89 * @return created attribute payload
90 */
91 attribute_payload_v1_t *attribute_payload_v1_create_type(config_type_v1_t config_type);
92
93 #endif /** ATTRIBUTE_PAYLOAD_V1_H_ @}*/