diff options
Diffstat (limited to 'src/identity-provider/identity_attribute.h')
-rw-r--r-- | src/identity-provider/identity_attribute.h | 149 |
1 files changed, 0 insertions, 149 deletions
diff --git a/src/identity-provider/identity_attribute.h b/src/identity-provider/identity_attribute.h deleted file mode 100644 index 3e8fadccf..000000000 --- a/src/identity-provider/identity_attribute.h +++ /dev/null | |||
@@ -1,149 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2012-2015 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @author Martin Schanzenbach | ||
22 | * @file identity-provider/identity_attribute.h | ||
23 | * @brief GNUnet Identity Provider library | ||
24 | * | ||
25 | */ | ||
26 | #ifndef IDENTITY_ATTRIBUTE_H | ||
27 | #define IDENTITY_ATTRIBUTE_H | ||
28 | |||
29 | #include "gnunet_identity_provider_service.h" | ||
30 | |||
31 | struct Attribute | ||
32 | { | ||
33 | /** | ||
34 | * Attribute type | ||
35 | */ | ||
36 | uint32_t attribute_type; | ||
37 | |||
38 | /** | ||
39 | * Attribute version | ||
40 | */ | ||
41 | uint32_t attribute_version; | ||
42 | |||
43 | /** | ||
44 | * Name length | ||
45 | */ | ||
46 | uint32_t name_len; | ||
47 | |||
48 | /** | ||
49 | * Data size | ||
50 | */ | ||
51 | uint32_t data_size; | ||
52 | |||
53 | //followed by data_size Attribute value data | ||
54 | }; | ||
55 | |||
56 | /** | ||
57 | * Get required size for serialization buffer | ||
58 | * | ||
59 | * @param attrs the attribute list to serialize | ||
60 | * | ||
61 | * @return the required buffer size | ||
62 | */ | ||
63 | size_t | ||
64 | attribute_list_serialize_get_size (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs); | ||
65 | |||
66 | void | ||
67 | attribute_list_destroy (struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs); | ||
68 | |||
69 | |||
70 | /** | ||
71 | * Serialize an attribute list | ||
72 | * | ||
73 | * @param attrs the attribute list to serialize | ||
74 | * @param result the serialized attribute | ||
75 | * | ||
76 | * @return length of serialized data | ||
77 | */ | ||
78 | size_t | ||
79 | attribute_list_serialize (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs, | ||
80 | char *result); | ||
81 | |||
82 | /** | ||
83 | * Deserialize an attribute list | ||
84 | * | ||
85 | * @param data the serialized attribute list | ||
86 | * @param data_size the length of the serialized data | ||
87 | * | ||
88 | * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller | ||
89 | */ | ||
90 | struct GNUNET_IDENTITY_PROVIDER_AttributeList * | ||
91 | attribute_list_deserialize (const char* data, | ||
92 | size_t data_size); | ||
93 | |||
94 | |||
95 | /** | ||
96 | * Get required size for serialization buffer | ||
97 | * | ||
98 | * @param attr the attribute to serialize | ||
99 | * | ||
100 | * @return the required buffer size | ||
101 | */ | ||
102 | size_t | ||
103 | attribute_serialize_get_size (const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr); | ||
104 | |||
105 | |||
106 | |||
107 | /** | ||
108 | * Serialize an attribute | ||
109 | * | ||
110 | * @param attr the attribute to serialize | ||
111 | * @param result the serialized attribute | ||
112 | * | ||
113 | * @return length of serialized data | ||
114 | */ | ||
115 | size_t | ||
116 | attribute_serialize (const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr, | ||
117 | char *result); | ||
118 | |||
119 | /** | ||
120 | * Deserialize an attribute | ||
121 | * | ||
122 | * @param data the serialized attribute | ||
123 | * @param data_size the length of the serialized data | ||
124 | * | ||
125 | * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller | ||
126 | */ | ||
127 | struct GNUNET_IDENTITY_PROVIDER_Attribute * | ||
128 | attribute_deserialize (const char* data, | ||
129 | size_t data_size); | ||
130 | |||
131 | /** | ||
132 | * Create a new attribute. | ||
133 | * | ||
134 | * @param name the attribute name | ||
135 | * @param type the attribute type | ||
136 | * @param data the attribute value | ||
137 | * @param data_size the attribute value size | ||
138 | * @return the new attribute | ||
139 | */ | ||
140 | struct GNUNET_IDENTITY_PROVIDER_Attribute * | ||
141 | attribute_new (const char* attr_name, | ||
142 | uint32_t attr_type, | ||
143 | const void* data, | ||
144 | size_t data_size); | ||
145 | |||
146 | struct GNUNET_IDENTITY_PROVIDER_AttributeList* | ||
147 | attribute_list_dup (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs); | ||
148 | |||
149 | #endif | ||