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 draft 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 * Object representing an IKEv2- CONFIGURATION Attribute.
75 * The CONFIGURATION ATTRIBUTE format is described in RFC section 3.15.1.
79 struct configuration_attribute_t
{
81 * The payload_t interface.
83 payload_t payload_interface
;
86 * @brief Returns the currently set value of the attribute.
88 * @warning Returned data are not copied.
90 * @param this calling configuration_attribute_t object
91 * @return chunk_t pointing to the value
93 chunk_t (*get_value
) (configuration_attribute_t
*this);
96 * @brief Sets the value of the attribute.
98 * @warning Value is getting copied.
100 * @param this calling configuration_attribute_t object
101 * @param value chunk_t pointing to the value to set
103 void (*set_value
) (configuration_attribute_t
*this, chunk_t value
);
106 * @brief Sets the type of the attribute.
108 * @param this calling configuration_attribute_t object
109 * @param type type to set (most significant bit is set to zero)
111 void (*set_attribute_type
) (configuration_attribute_t
*this, u_int16_t type
);
114 * @brief get the type of the attribute.
116 * @param this calling configuration_attribute_t object
117 * @return type of the value
119 u_int16_t (*get_attribute_type
) (configuration_attribute_t
*this);
122 * @brief get the length of an attribute.
124 * @param this calling configuration_attribute_t object
125 * @return type of the value
127 u_int16_t (*get_attribute_length
) (configuration_attribute_t
*this);
130 * @brief Destroys an configuration_attribute_t object.
132 * @param this configuration_attribute_t object to destroy
134 void (*destroy
) (configuration_attribute_t
*this);
138 * @brief Creates an empty configuration_attribute_t object.
140 * @return created configuration_attribute_t object
144 configuration_attribute_t
*configuration_attribute_create();
146 #endif /*_CONFIGURATION_ATTRIBUTE_H_*/