Removed strayed code fragment
[strongswan.git] / src / charon / encoding / payloads / configuration_attribute.h
1 /*
2 * Copyright (C) 2005-2009 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 /**
18 * @defgroup configuration_attribute configuration_attribute
19 * @{ @ingroup payloads
20 */
21
22 #ifndef CONFIGURATION_ATTRIBUTE_H_
23 #define CONFIGURATION_ATTRIBUTE_H_
24
25 typedef struct configuration_attribute_t configuration_attribute_t;
26
27 #include <library.h>
28 #include <attributes/attributes.h>
29 #include <encoding/payloads/payload.h>
30
31 /**
32 * Configuration attribute header length in bytes.
33 */
34 #define CONFIGURATION_ATTRIBUTE_HEADER_LENGTH 4
35
36 /**
37 * Class representing an IKEv2-CONFIGURATION Attribute.
38 *
39 * The CONFIGURATION ATTRIBUTE format is described in RFC section 3.15.1.
40 */
41 struct configuration_attribute_t {
42
43 /**
44 * Implements payload_t interface.
45 */
46 payload_t payload_interface;
47
48 /**
49 * Get the type of the attribute.
50 *
51 * @return type of the configuration attribute
52 */
53 configuration_attribute_type_t (*get_type)(configuration_attribute_t *this);
54
55 /**
56 * Returns the value of the attribute.
57 *
58 * @return chunk_t pointing to the internal value
59 */
60 chunk_t (*get_value) (configuration_attribute_t *this);
61
62 /**
63 * Destroys an configuration_attribute_t object.
64 */
65 void (*destroy) (configuration_attribute_t *this);
66 };
67
68 /**
69 * Creates an empty configuration attribute.
70 *
71 * @return created configuration attribute
72 */
73 configuration_attribute_t *configuration_attribute_create();
74
75 /**
76 * Creates a configuration attribute with type and value.
77 *
78 * @param type type of configuration attribute
79 * @param value value, gets cloned
80 * @return created configuration attribute
81 */
82 configuration_attribute_t *configuration_attribute_create_value(
83 configuration_attribute_type_t type, chunk_t value);
84
85 #endif /** CONFIGURATION_ATTRIBUTE_H_ @}*/