2 * @file configuration_attribute.h
4 * @brief Interface of configuration_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 CONFIGURATION_ATTRIBUTE_H_
24 #define CONFIGURATION_ATTRIBUTE_H_
27 #include <encoding/payloads/payload.h>
32 * Configuration attribute header length in bytes.
36 #define CONFIGURATION_ATTRIBUTE_HEADER_LENGTH 4
39 typedef enum configuration_attribute_type_t configuration_attribute_type_t
;
42 * Type of the attribute, as in IKEv2 RFC 3.15.1.
46 enum configuration_attribute_type_t
{
47 INTERNAL_IP4_ADDRESS
= 1,
48 INTERNAL_IP4_NETMASK
= 2,
50 INTERNAL_IP4_NBNS
= 4,
51 INTERNAL_ADDRESS_EXPIRY
= 5,
52 INTERNAL_IP4_DHCP
= 6,
53 APPLICATION_VERSION
= 7,
54 INTERNAL_IP6_ADDRESS
= 8,
55 INTERNAL_IP6_DNS
= 10,
56 INTERNAL_IP6_NBNS
= 11,
57 INTERNAL_IP6_DHCP
= 12,
58 INTERNAL_IP4_SUBNET
= 13,
59 SUPPORTED_ATTRIBUTES
= 14,
60 INTERNAL_IP6_SUBNET
= 15
64 * String mappings for configuration_attribute_type_t.
68 extern mapping_t configuration_attribute_type_m
[];
70 typedef struct configuration_attribute_t configuration_attribute_t
;
73 * @brief Class representing an IKEv2-CONFIGURATION Attribute.
75 * The CONFIGURATION ATTRIBUTE format is described in RFC section 3.15.1.
78 * - configuration_attribute_create()
82 struct configuration_attribute_t
{
84 * The payload_t interface.
86 payload_t payload_interface
;
89 * @brief Returns the currently set value of the attribute.
91 * @warning Returned data are not copied.
93 * @param this calling configuration_attribute_t object
94 * @return chunk_t pointing to the value
96 chunk_t (*get_value
) (configuration_attribute_t
*this);
99 * @brief Sets the value of the attribute.
101 * @warning Value is getting copied.
103 * @param this calling configuration_attribute_t object
104 * @param value chunk_t pointing to the value to set
106 void (*set_value
) (configuration_attribute_t
*this, chunk_t value
);
109 * @brief Sets the type of the attribute.
111 * @param this calling configuration_attribute_t object
112 * @param type type to set (most significant bit is set to zero)
114 void (*set_attribute_type
) (configuration_attribute_t
*this, u_int16_t type
);
117 * @brief get the type of the attribute.
119 * @param this calling configuration_attribute_t object
120 * @return type of the value
122 u_int16_t (*get_attribute_type
) (configuration_attribute_t
*this);
125 * @brief get the length of an attribute.
127 * @param this calling configuration_attribute_t object
128 * @return type of the value
130 u_int16_t (*get_attribute_length
) (configuration_attribute_t
*this);
133 * @brief Destroys an configuration_attribute_t object.
135 * @param this configuration_attribute_t object to destroy
137 void (*destroy
) (configuration_attribute_t
*this);
141 * @brief Creates an empty configuration_attribute_t object.
143 * @return created configuration_attribute_t object
147 configuration_attribute_t
*configuration_attribute_create(void);
149 #endif /* CONFIGURATION_ATTRIBUTE_H_*/