Revision b5a2055f src/charon/encoding/payloads/configuration_attribute.h

b/src/charon/encoding/payloads/configuration_attribute.h
1 1
/*
2
 * Copyright (C) 2005-2006 Martin Willi
2
 * Copyright (C) 2005-2009 Martin Willi
3 3
 * Copyright (C) 2005 Jan Hutter
4 4
 * Hochschule fuer Technik Rapperswil
5 5
 *
......
28 28
#include <attributes/attributes.h>
29 29
#include <encoding/payloads/payload.h>
30 30

  
31

  
32 31
/**
33 32
 * Configuration attribute header length in bytes.
34 33
 */
......
40 39
 * The CONFIGURATION ATTRIBUTE format is described in RFC section 3.15.1.
41 40
 */
42 41
struct configuration_attribute_t {
43
	/**
44
	 * The payload_t interface.
45
	 */
46
	payload_t payload_interface;
47

  
48
	/**
49
	 * Returns the currently set value of the attribute.
50
	 *
51
	 * @warning Returned data are not copied.
52
	 *
53
	 * @return 		chunk_t pointing to the value
54
	 */
55
	chunk_t (*get_value) (configuration_attribute_t *this);
56

  
57
	/**
58
	 * Sets the value of the attribute.
59
	 *
60
	 * Value is getting copied.
61
	 *
62
	 * @param value chunk_t pointing to the value to set
63
	 */
64
	void (*set_value) (configuration_attribute_t *this, chunk_t value);
65 42

  
66 43
	/**
67
	 * Sets the type of the attribute.
68
	 *
69
	 * @param type	type to set (most significant bit is set to zero)
44
	 * Implements payload_t interface.
70 45
	 */
71
	void (*set_type) (configuration_attribute_t *this, u_int16_t type);
46
	payload_t payload_interface;
72 47

  
73 48
	/**
74
	 * get the type of the attribute.
49
	 * Get the type of the attribute.
75 50
	 *
76
	 * @return 		type of the value
51
	 * @return 		type of the configuration attribute
77 52
	 */
78
	u_int16_t (*get_type) (configuration_attribute_t *this);
53
	configuration_attribute_type_t (*get_type)(configuration_attribute_t *this);
79 54

  
80 55
	/**
81
	 * get the length of an attribute.
56
	 * Returns the value of the attribute.
82 57
	 *
83
	 * @return 		type of the value
58
	 * @return 		chunk_t pointing to the internal value
84 59
	 */
85
	u_int16_t (*get_length) (configuration_attribute_t *this);
60
	chunk_t (*get_value) (configuration_attribute_t *this);
86 61

  
87 62
	/**
88 63
	 * Destroys an configuration_attribute_t object.
......
91 66
};
92 67

  
93 68
/**
94
 * Creates an empty configuration_attribute_t object.
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.
95 77
 *
96
 * @return			created configuration_attribute_t object
78
 * @param type	type of configuration attribute
79
 * @param value	value, gets cloned
80
 * @return		created configuration attribute
97 81
 */
98
configuration_attribute_t *configuration_attribute_create(void);
82
configuration_attribute_t *configuration_attribute_create_value(
83
							configuration_attribute_type_t type, chunk_t value);
99 84

  
100 85
#endif /** CONFIGURATION_ATTRIBUTE_H_ @}*/

Also available in: Unified diff