diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2017-12-02 22:32:28 +0100 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2017-12-02 22:32:28 +0100 |
commit | a9a7ac802811e76e33b54040bf31f00ea9438cea (patch) | |
tree | 7f9a22daca2b95e7308d8877c668fc878a39ae4c | |
parent | 14c62ed969ace8843154d10b55d4c3571383dc37 (diff) | |
download | gnunet-a9a7ac802811e76e33b54040bf31f00ea9438cea.tar.gz gnunet-a9a7ac802811e76e33b54040bf31f00ea9438cea.zip |
-refactored
18 files changed, 830 insertions, 431 deletions
diff --git a/configure.ac b/configure.ac index 206a407fa..e0d92fb8c 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1654,6 +1654,7 @@ src/vpn/vpn.conf | |||
1654 | src/zonemaster/Makefile | 1654 | src/zonemaster/Makefile |
1655 | src/zonemaster/zonemaster.conf | 1655 | src/zonemaster/zonemaster.conf |
1656 | src/rest/Makefile | 1656 | src/rest/Makefile |
1657 | src/identity-attribute/Makefile | ||
1657 | src/identity-provider/Makefile | 1658 | src/identity-provider/Makefile |
1658 | pkgconfig/Makefile | 1659 | pkgconfig/Makefile |
1659 | pkgconfig/gnunetarm.pc | 1660 | pkgconfig/gnunetarm.pc |
diff --git a/po/POTFILES.in b/po/POTFILES.in index 3444e321b..b06eb3a9f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -196,9 +196,10 @@ src/hello/hello.c | |||
196 | src/hostlist/gnunet-daemon-hostlist.c | 196 | src/hostlist/gnunet-daemon-hostlist.c |
197 | src/hostlist/gnunet-daemon-hostlist_client.c | 197 | src/hostlist/gnunet-daemon-hostlist_client.c |
198 | src/hostlist/gnunet-daemon-hostlist_server.c | 198 | src/hostlist/gnunet-daemon-hostlist_server.c |
199 | src/identity-attribute/identity_attribute.c | ||
200 | src/identity-attribute/plugin_identity_attribute_type_gnuid.c | ||
199 | src/identity-provider/gnunet-idp.c | 201 | src/identity-provider/gnunet-idp.c |
200 | src/identity-provider/gnunet-service-identity-provider.c | 202 | src/identity-provider/gnunet-service-identity-provider.c |
201 | src/identity-provider/identity_attribute.c | ||
202 | src/identity-provider/identity_provider_api.c | 203 | src/identity-provider/identity_provider_api.c |
203 | src/identity-provider/jwt.c | 204 | src/identity-provider/jwt.c |
204 | src/identity-provider/plugin_gnsrecord_identity_provider.c | 205 | src/identity-provider/plugin_gnsrecord_identity_provider.c |
diff --git a/src/Makefile.am b/src/Makefile.am index e4d7d8924..68878b5a0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -17,6 +17,7 @@ endif | |||
17 | 17 | ||
18 | if HAVE_JSON | 18 | if HAVE_JSON |
19 | if HAVE_MHD | 19 | if HAVE_MHD |
20 | ATTRIBUTE_DIR = identity-attribute | ||
20 | PROVIDER_DIR = identity-provider | 21 | PROVIDER_DIR = identity-provider |
21 | endif | 22 | endif |
22 | endif | 23 | endif |
@@ -131,6 +132,7 @@ SUBDIRS = \ | |||
131 | social \ | 132 | social \ |
132 | $(AUCTION_DIR) \ | 133 | $(AUCTION_DIR) \ |
133 | $(EXP_DIR) \ | 134 | $(EXP_DIR) \ |
135 | $(ATTRIBUTE_DIR) \ | ||
134 | $(PROVIDER_DIR) | 136 | $(PROVIDER_DIR) |
135 | 137 | ||
136 | endif | 138 | endif |
diff --git a/src/identity-attribute/Makefile.am b/src/identity-attribute/Makefile.am new file mode 100644 index 000000000..770bc2ead --- /dev/null +++ b/src/identity-attribute/Makefile.am | |||
@@ -0,0 +1,44 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
7 | |||
8 | libexecdir= $(pkglibdir)/libexec/ | ||
9 | |||
10 | if MINGW | ||
11 | WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols | ||
12 | endif | ||
13 | |||
14 | if USE_COVERAGE | ||
15 | AM_CFLAGS = --coverage -O0 | ||
16 | XLIBS = -lgcov | ||
17 | endif | ||
18 | |||
19 | lib_LTLIBRARIES = \ | ||
20 | libgnunetidentityattribute.la | ||
21 | |||
22 | libgnunetidentityattribute_la_SOURCES = \ | ||
23 | identity_attribute.c | ||
24 | libgnunetidentityattribute_la_LIBADD = \ | ||
25 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
26 | $(GN_LIBINTL) | ||
27 | libgnunetidentityattribute_la_LDFLAGS = \ | ||
28 | $(GN_LIB_LDFLAGS) $(WINFLAGS) \ | ||
29 | -version-info 0:0:0 | ||
30 | |||
31 | |||
32 | plugin_LTLIBRARIES = \ | ||
33 | libgnunet_plugin_identity_attribute_gnuid.la | ||
34 | |||
35 | |||
36 | libgnunet_plugin_identity_attribute_gnuid_la_SOURCES = \ | ||
37 | plugin_identity_attribute_gnuid.c | ||
38 | libgnunet_plugin_identity_attribute_gnuid_la_LIBADD = \ | ||
39 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
40 | $(LTLIBINTL) | ||
41 | libgnunet_plugin_gnsrecord_dns_la_LDFLAGS = \ | ||
42 | $(GN_PLUGIN_LDFLAGS) | ||
43 | |||
44 | |||
diff --git a/src/identity-provider/identity_attribute.c b/src/identity-attribute/identity_attribute.c index c7e833326..377eb3211 100644 --- a/src/identity-provider/identity_attribute.c +++ b/src/identity-attribute/identity_attribute.c | |||
@@ -36,20 +36,21 @@ | |||
36 | * @param data_size the attribute value size | 36 | * @param data_size the attribute value size |
37 | * @return the new attribute | 37 | * @return the new attribute |
38 | */ | 38 | */ |
39 | struct GNUNET_IDENTITY_PROVIDER_Attribute * | 39 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim * |
40 | attribute_new (const char* attr_name, | 40 | GNUNET_IDENTITY_ATTRIBUTE_claim_new (const char* attr_name, |
41 | uint32_t attr_type, | 41 | uint32_t attr_type, |
42 | const void* data, | 42 | const void* data, |
43 | size_t data_size) | 43 | size_t data_size) |
44 | { | 44 | { |
45 | struct GNUNET_IDENTITY_PROVIDER_Attribute *attr; | 45 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr; |
46 | char *write_ptr; | 46 | char *write_ptr; |
47 | 47 | ||
48 | attr = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_Attribute) + | 48 | attr = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_ATTRIBUTE_Claim) + |
49 | strlen (attr_name) + 1 + | 49 | strlen (attr_name) + 1 + |
50 | data_size); | 50 | data_size); |
51 | attr->attribute_type = attr_type; | 51 | attr->type = attr_type; |
52 | attr->data_size = data_size; | 52 | attr->data_size = data_size; |
53 | attr->version = 0; | ||
53 | write_ptr = (char*)&attr[1]; | 54 | write_ptr = (char*)&attr[1]; |
54 | GNUNET_memcpy (write_ptr, | 55 | GNUNET_memcpy (write_ptr, |
55 | attr_name, | 56 | attr_name, |
@@ -64,20 +65,20 @@ attribute_new (const char* attr_name, | |||
64 | } | 65 | } |
65 | 66 | ||
66 | size_t | 67 | size_t |
67 | attribute_list_serialize_get_size (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) | 68 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) |
68 | { | 69 | { |
69 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 70 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
70 | size_t len = 0; | 71 | size_t len = 0; |
71 | for (le = attrs->list_head; NULL != le; le = le->next) | 72 | for (le = attrs->list_head; NULL != le; le = le->next) |
72 | len += attribute_serialize_get_size (le->attribute); | 73 | len += GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (le->claim); |
73 | return len; | 74 | return len; |
74 | } | 75 | } |
75 | 76 | ||
76 | size_t | 77 | size_t |
77 | attribute_list_serialize (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs, | 78 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, |
78 | char *result) | 79 | char *result) |
79 | { | 80 | { |
80 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 81 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
81 | size_t len; | 82 | size_t len; |
82 | size_t total_len; | 83 | size_t total_len; |
83 | char* write_ptr; | 84 | char* write_ptr; |
@@ -86,7 +87,7 @@ attribute_list_serialize (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *a | |||
86 | total_len = 0; | 87 | total_len = 0; |
87 | for (le = attrs->list_head; NULL != le; le = le->next) | 88 | for (le = attrs->list_head; NULL != le; le = le->next) |
88 | { | 89 | { |
89 | len = attribute_serialize (le->attribute, | 90 | len = GNUNET_IDENTITY_ATTRIBUTE_serialize (le->claim, |
90 | write_ptr); | 91 | write_ptr); |
91 | total_len += len; | 92 | total_len += len; |
92 | write_ptr += len; | 93 | write_ptr += len; |
@@ -94,55 +95,55 @@ attribute_list_serialize (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *a | |||
94 | return total_len; | 95 | return total_len; |
95 | } | 96 | } |
96 | 97 | ||
97 | struct GNUNET_IDENTITY_PROVIDER_AttributeList * | 98 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList * |
98 | attribute_list_deserialize (const char* data, | 99 | GNUNET_IDENTITY_ATTRIBUTE_list_deserialize (const char* data, |
99 | size_t data_size) | 100 | size_t data_size) |
100 | { | 101 | { |
101 | struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs; | 102 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; |
102 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 103 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
103 | size_t attr_len; | 104 | size_t attr_len; |
104 | const char* read_ptr; | 105 | const char* read_ptr; |
105 | 106 | ||
106 | if (data_size < sizeof (struct Attribute)) | 107 | if (data_size < sizeof (struct Attribute)) |
107 | return NULL; | 108 | return NULL; |
108 | 109 | ||
109 | attrs = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeList); | 110 | attrs = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); |
110 | read_ptr = data; | 111 | read_ptr = data; |
111 | while (((data + data_size) - read_ptr) >= sizeof (struct Attribute)) | 112 | while (((data + data_size) - read_ptr) >= sizeof (struct Attribute)) |
112 | { | 113 | { |
113 | 114 | ||
114 | le = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry); | 115 | le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); |
115 | le->attribute = attribute_deserialize (read_ptr, | 116 | le->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize (read_ptr, |
116 | data_size - (read_ptr - data)); | 117 | data_size - (read_ptr - data)); |
117 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 118 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
118 | "Deserialized attribute %s\n", le->attribute->name); | 119 | "Deserialized attribute %s\n", le->claim->name); |
119 | GNUNET_CONTAINER_DLL_insert (attrs->list_head, | 120 | GNUNET_CONTAINER_DLL_insert (attrs->list_head, |
120 | attrs->list_tail, | 121 | attrs->list_tail, |
121 | le); | 122 | le); |
122 | attr_len = attribute_serialize_get_size (le->attribute); | 123 | attr_len = GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (le->claim); |
123 | read_ptr += attr_len; | 124 | read_ptr += attr_len; |
124 | } | 125 | } |
125 | return attrs; | 126 | return attrs; |
126 | } | 127 | } |
127 | 128 | ||
128 | struct GNUNET_IDENTITY_PROVIDER_AttributeList* | 129 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList* |
129 | attribute_list_dup (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) | 130 | GNUNET_IDENTITY_ATTRIBUTE_list_dup (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) |
130 | { | 131 | { |
131 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 132 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
132 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *result_le; | 133 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *result_le; |
133 | struct GNUNET_IDENTITY_PROVIDER_AttributeList *result; | 134 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *result; |
134 | size_t len; | 135 | size_t len; |
135 | 136 | ||
136 | result = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeList); | 137 | result = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); |
137 | for (le = attrs->list_head; NULL != le; le = le->next) | 138 | for (le = attrs->list_head; NULL != le; le = le->next) |
138 | { | 139 | { |
139 | result_le = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry); | 140 | result_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); |
140 | len = sizeof (struct GNUNET_IDENTITY_PROVIDER_Attribute) + le->attribute->data_size; | 141 | len = sizeof (struct GNUNET_IDENTITY_ATTRIBUTE_Claim) + le->claim->data_size; |
141 | result_le->attribute = GNUNET_malloc (len); | 142 | result_le->claim = GNUNET_malloc (len); |
142 | GNUNET_memcpy (result_le->attribute, | 143 | GNUNET_memcpy (result_le->claim, |
143 | le->attribute, | 144 | le->claim, |
144 | len); | 145 | len); |
145 | result_le->attribute->name = (const char*)&result_le->attribute[1]; | 146 | result_le->claim->name = (const char*)&result_le->claim[1]; |
146 | GNUNET_CONTAINER_DLL_insert (result->list_head, | 147 | GNUNET_CONTAINER_DLL_insert (result->list_head, |
147 | result->list_tail, | 148 | result->list_tail, |
148 | result_le); | 149 | result_le); |
@@ -152,14 +153,14 @@ attribute_list_dup (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) | |||
152 | 153 | ||
153 | 154 | ||
154 | void | 155 | void |
155 | attribute_list_destroy (struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) | 156 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) |
156 | { | 157 | { |
157 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 158 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
158 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *tmp_le; | 159 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *tmp_le; |
159 | 160 | ||
160 | for (le = attrs->list_head; NULL != le;) | 161 | for (le = attrs->list_head; NULL != le;) |
161 | { | 162 | { |
162 | GNUNET_free (le->attribute); | 163 | GNUNET_free (le->claim); |
163 | tmp_le = le; | 164 | tmp_le = le; |
164 | le = le->next; | 165 | le = le->next; |
165 | GNUNET_free (tmp_le); | 166 | GNUNET_free (tmp_le); |
@@ -169,15 +170,15 @@ attribute_list_destroy (struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) | |||
169 | } | 170 | } |
170 | 171 | ||
171 | size_t | 172 | size_t |
172 | attribute_serialize_get_size (const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr) | 173 | GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) |
173 | { | 174 | { |
174 | return sizeof (struct Attribute) | 175 | return sizeof (struct Attribute) |
175 | + strlen (attr->name) | 176 | + strlen (attr->name) |
176 | + attr->data_size; //TODO get data_size from plugin | 177 | + attr->data_size; |
177 | } | 178 | } |
178 | 179 | ||
179 | size_t | 180 | size_t |
180 | attribute_serialize (const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr, | 181 | GNUNET_IDENTITY_ATTRIBUTE_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr, |
181 | char *result) | 182 | char *result) |
182 | { | 183 | { |
183 | size_t data_len_ser; | 184 | size_t data_len_ser; |
@@ -186,8 +187,8 @@ attribute_serialize (const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr, | |||
186 | char* write_ptr; | 187 | char* write_ptr; |
187 | 188 | ||
188 | attr_ser = (struct Attribute*)result; | 189 | attr_ser = (struct Attribute*)result; |
189 | attr_ser->attribute_type = htons (attr->attribute_type); | 190 | attr_ser->attribute_type = htons (attr->type); |
190 | attr_ser->attribute_version = htonl (attr->attribute_version); | 191 | attr_ser->attribute_version = htonl (attr->version); |
191 | name_len = strlen (attr->name); | 192 | name_len = strlen (attr->name); |
192 | attr_ser->name_len = htons (name_len); | 193 | attr_ser->name_len = htons (name_len); |
193 | write_ptr = (char*)&attr_ser[1]; | 194 | write_ptr = (char*)&attr_ser[1]; |
@@ -203,11 +204,11 @@ attribute_serialize (const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr, | |||
203 | return sizeof (struct Attribute) + strlen (attr->name) + attr->data_size; | 204 | return sizeof (struct Attribute) + strlen (attr->name) + attr->data_size; |
204 | } | 205 | } |
205 | 206 | ||
206 | struct GNUNET_IDENTITY_PROVIDER_Attribute * | 207 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim * |
207 | attribute_deserialize (const char* data, | 208 | GNUNET_IDENTITY_ATTRIBUTE_deserialize (const char* data, |
208 | size_t data_size) | 209 | size_t data_size) |
209 | { | 210 | { |
210 | struct GNUNET_IDENTITY_PROVIDER_Attribute *attr; | 211 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr; |
211 | struct Attribute *attr_ser; | 212 | struct Attribute *attr_ser; |
212 | size_t data_len; | 213 | size_t data_len; |
213 | size_t name_len; | 214 | size_t name_len; |
@@ -217,13 +218,12 @@ attribute_deserialize (const char* data, | |||
217 | return NULL; | 218 | return NULL; |
218 | 219 | ||
219 | attr_ser = (struct Attribute*)data; | 220 | attr_ser = (struct Attribute*)data; |
220 | //TODO use plugin. | ||
221 | data_len = ntohs (attr_ser->data_size); | 221 | data_len = ntohs (attr_ser->data_size); |
222 | name_len = ntohs (attr_ser->name_len); | 222 | name_len = ntohs (attr_ser->name_len); |
223 | attr = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_Attribute) | 223 | attr = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_ATTRIBUTE_Claim) |
224 | + data_len + name_len + 1); | 224 | + data_len + name_len + 1); |
225 | attr->attribute_type = ntohs (attr_ser->attribute_type); | 225 | attr->type = ntohs (attr_ser->attribute_type); |
226 | attr->attribute_version = ntohl (attr_ser->attribute_version); | 226 | attr->version = ntohl (attr_ser->attribute_version); |
227 | attr->data_size = ntohs (attr_ser->data_size); | 227 | attr->data_size = ntohs (attr_ser->data_size); |
228 | 228 | ||
229 | write_ptr = (char*)&attr[1]; | 229 | write_ptr = (char*)&attr[1]; |
diff --git a/src/identity-attribute/identity_attribute.h b/src/identity-attribute/identity_attribute.h new file mode 100644 index 000000000..046321807 --- /dev/null +++ b/src/identity-attribute/identity_attribute.h | |||
@@ -0,0 +1,56 @@ | |||
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 | #endif | ||
diff --git a/src/identity-attribute/plugin_identity_attribute_gnuid.c b/src/identity-attribute/plugin_identity_attribute_gnuid.c new file mode 100644 index 000000000..ba460d0a5 --- /dev/null +++ b/src/identity-attribute/plugin_identity_attribute_gnuid.c | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2013, 2014, 2016 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 | /** | ||
22 | * @file identity-provider/plugin_identity_attribute_gnuid.c | ||
23 | * @brief identity attribute plugin to provide the API for fundamental | ||
24 | * attribute types. | ||
25 | * | ||
26 | * @author Martin Schanzenbach | ||
27 | */ | ||
28 | #include "platform.h" | ||
29 | #include "gnunet_util_lib.h" | ||
30 | #include "gnunet_identity_attribute_plugin.h" | ||
31 | #include <inttypes.h> | ||
32 | |||
33 | |||
34 | /** | ||
35 | * Convert the 'value' of an attribute to a string. | ||
36 | * | ||
37 | * @param cls closure, unused | ||
38 | * @param type type of the attribute | ||
39 | * @param data value in binary encoding | ||
40 | * @param data_size number of bytes in @a data | ||
41 | * @return NULL on error, otherwise human-readable representation of the value | ||
42 | */ | ||
43 | static char * | ||
44 | gnuid_value_to_string (void *cls, | ||
45 | uint32_t type, | ||
46 | const void *data, | ||
47 | size_t data_size) | ||
48 | { | ||
49 | |||
50 | switch (type) | ||
51 | { | ||
52 | case GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING: | ||
53 | return GNUNET_strndup (data, data_size); | ||
54 | default: | ||
55 | return NULL; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | |||
60 | /** | ||
61 | * Convert human-readable version of a 'value' of an attribute to the binary | ||
62 | * representation. | ||
63 | * | ||
64 | * @param cls closure, unused | ||
65 | * @param type type of the attribute | ||
66 | * @param s human-readable string | ||
67 | * @param data set to value in binary encoding (will be allocated) | ||
68 | * @param data_size set to number of bytes in @a data | ||
69 | * @return #GNUNET_OK on success | ||
70 | */ | ||
71 | static int | ||
72 | gnuid_string_to_value (void *cls, | ||
73 | uint32_t type, | ||
74 | const char *s, | ||
75 | void **data, | ||
76 | size_t *data_size) | ||
77 | { | ||
78 | if (NULL == s) | ||
79 | return GNUNET_SYSERR; | ||
80 | switch (type) | ||
81 | { | ||
82 | |||
83 | case GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING: | ||
84 | *data = GNUNET_strdup (s); | ||
85 | *data_size = strlen (s); | ||
86 | return GNUNET_OK; | ||
87 | default: | ||
88 | return GNUNET_SYSERR; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | |||
93 | /** | ||
94 | * Mapping of attribute type numbers to human-readable | ||
95 | * attribute type names. | ||
96 | */ | ||
97 | static struct { | ||
98 | const char *name; | ||
99 | uint32_t number; | ||
100 | } gnuid_name_map[] = { | ||
101 | { "STRING", GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING }, | ||
102 | { NULL, UINT32_MAX } | ||
103 | }; | ||
104 | |||
105 | |||
106 | /** | ||
107 | * Convert a type name to the corresponding number. | ||
108 | * | ||
109 | * @param cls closure, unused | ||
110 | * @param gnuid_typename name to convert | ||
111 | * @return corresponding number, UINT32_MAX on error | ||
112 | */ | ||
113 | static uint32_t | ||
114 | gnuid_typename_to_number (void *cls, | ||
115 | const char *gnuid_typename) | ||
116 | { | ||
117 | unsigned int i; | ||
118 | |||
119 | i=0; | ||
120 | while ( (NULL != gnuid_name_map[i].name) && | ||
121 | (0 != strcasecmp (gnuid_typename, | ||
122 | gnuid_name_map[i].name)) ) | ||
123 | i++; | ||
124 | return gnuid_name_map[i].number; | ||
125 | } | ||
126 | |||
127 | |||
128 | /** | ||
129 | * Convert a type number (i.e. 1) to the corresponding type string | ||
130 | * | ||
131 | * @param cls closure, unused | ||
132 | * @param type number of a type to convert | ||
133 | * @return corresponding typestring, NULL on error | ||
134 | */ | ||
135 | static const char * | ||
136 | gnuid_number_to_typename (void *cls, | ||
137 | uint32_t type) | ||
138 | { | ||
139 | unsigned int i; | ||
140 | |||
141 | i=0; | ||
142 | while ( (NULL != gnuid_name_map[i].name) && | ||
143 | (type != gnuid_name_map[i].number) ) | ||
144 | i++; | ||
145 | return gnuid_name_map[i].name; | ||
146 | } | ||
147 | |||
148 | |||
149 | /** | ||
150 | * Entry point for the plugin. | ||
151 | * | ||
152 | * @param cls NULL | ||
153 | * @return the exported block API | ||
154 | */ | ||
155 | void * | ||
156 | libgnunet_plugin_attribute_type_gnuid_init (void *cls) | ||
157 | { | ||
158 | struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api; | ||
159 | |||
160 | api = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions); | ||
161 | api->value_to_string = &gnuid_value_to_string; | ||
162 | api->string_to_value = &gnuid_string_to_value; | ||
163 | api->typename_to_number = &gnuid_typename_to_number; | ||
164 | api->number_to_typename = &gnuid_number_to_typename; | ||
165 | return api; | ||
166 | } | ||
167 | |||
168 | |||
169 | /** | ||
170 | * Exit point from the plugin. | ||
171 | * | ||
172 | * @param cls the return value from #libgnunet_plugin_block_test_init() | ||
173 | * @return NULL | ||
174 | */ | ||
175 | void * | ||
176 | libgnunet_plugin_attribute_type_gnuid_done (void *cls) | ||
177 | { | ||
178 | struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api = cls; | ||
179 | |||
180 | GNUNET_free (api); | ||
181 | return NULL; | ||
182 | } | ||
183 | |||
184 | /* end of plugin_identity_attribute_type_gnuid.c */ | ||
diff --git a/src/identity-provider/Makefile.am b/src/identity-provider/Makefile.am index f64f1aa68..3b072e59d 100644 --- a/src/identity-provider/Makefile.am +++ b/src/identity-provider/Makefile.am | |||
@@ -63,8 +63,7 @@ libgnunet_plugin_identity_provider_sqlite_la_LDFLAGS = \ | |||
63 | 63 | ||
64 | 64 | ||
65 | gnunet_service_identity_provider_SOURCES = \ | 65 | gnunet_service_identity_provider_SOURCES = \ |
66 | gnunet-service-identity-provider.c \ | 66 | gnunet-service-identity-provider.c |
67 | identity_attribute.h | ||
68 | gnunet_service_identity_provider_LDADD = \ | 67 | gnunet_service_identity_provider_LDADD = \ |
69 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ | 68 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ |
70 | $(top_builddir)/src/util/libgnunetutil.la \ | 69 | $(top_builddir)/src/util/libgnunetutil.la \ |
@@ -72,14 +71,14 @@ gnunet_service_identity_provider_LDADD = \ | |||
72 | $(top_builddir)/src/identity/libgnunetidentity.la \ | 71 | $(top_builddir)/src/identity/libgnunetidentity.la \ |
73 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 72 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
74 | $(top_builddir)/src/credential/libgnunetcredential.la \ | 73 | $(top_builddir)/src/credential/libgnunetcredential.la \ |
74 | $(top_builddir)/src/identity-attribute/libgnunetidentityattribute.la \ | ||
75 | libgnunetidentityprovider.la \ | 75 | libgnunetidentityprovider.la \ |
76 | $(top_builddir)/src/gns/libgnunetgns.la \ | 76 | $(top_builddir)/src/gns/libgnunetgns.la \ |
77 | $(GN_LIBINTL) | 77 | $(GN_LIBINTL) |
78 | 78 | ||
79 | libgnunetidentityprovider_la_SOURCES = \ | 79 | libgnunetidentityprovider_la_SOURCES = \ |
80 | identity_provider_api.c \ | 80 | identity_provider_api.c \ |
81 | identity_provider.h \ | 81 | identity_provider.h |
82 | identity_attribute.c | ||
83 | libgnunetidentityprovider_la_LIBADD = \ | 82 | libgnunetidentityprovider_la_LIBADD = \ |
84 | $(top_builddir)/src/util/libgnunetutil.la \ | 83 | $(top_builddir)/src/util/libgnunetutil.la \ |
85 | $(GN_LIBINTL) $(XLIB) | 84 | $(GN_LIBINTL) $(XLIB) |
@@ -88,13 +87,13 @@ libgnunetidentityprovider_la_LDFLAGS = \ | |||
88 | -version-info 0:0:0 | 87 | -version-info 0:0:0 |
89 | 88 | ||
90 | libgnunet_plugin_rest_identity_provider_la_SOURCES = \ | 89 | libgnunet_plugin_rest_identity_provider_la_SOURCES = \ |
91 | plugin_rest_identity_provider.c \ | 90 | plugin_rest_identity_provider.c |
92 | jwt.c | ||
93 | libgnunet_plugin_rest_identity_provider_la_LIBADD = \ | 91 | libgnunet_plugin_rest_identity_provider_la_LIBADD = \ |
94 | $(top_builddir)/src/identity/libgnunetidentity.la \ | 92 | $(top_builddir)/src/identity/libgnunetidentity.la \ |
95 | libgnunetidentityprovider.la \ | 93 | libgnunetidentityprovider.la \ |
96 | $(top_builddir)/src/rest/libgnunetrest.la \ | 94 | $(top_builddir)/src/rest/libgnunetrest.la \ |
97 | $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \ | 95 | $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \ |
96 | $(top_builddir)/src/identity-attribute/libgnunetidentityattribute.la \ | ||
98 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ | 97 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ |
99 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ | 98 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ |
100 | $(LTLIBINTL) -ljansson -lmicrohttpd | 99 | $(LTLIBINTL) -ljansson -lmicrohttpd |
@@ -108,6 +107,7 @@ gnunet_idp_LDADD = \ | |||
108 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ | 107 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ |
109 | libgnunetidentityprovider.la \ | 108 | libgnunetidentityprovider.la \ |
110 | $(top_builddir)/src/identity/libgnunetidentity.la \ | 109 | $(top_builddir)/src/identity/libgnunetidentity.la \ |
110 | $(top_builddir)/src/identity-attribute/libgnunetidentityattribute.la \ | ||
111 | $(GN_LIBINTL) | 111 | $(GN_LIBINTL) |
112 | 112 | ||
113 | check_SCRIPTS = \ | 113 | check_SCRIPTS = \ |
diff --git a/src/identity-provider/gnunet-idp.c b/src/identity-provider/gnunet-idp.c index 88136c124..18a5676c0 100644 --- a/src/identity-provider/gnunet-idp.c +++ b/src/identity-provider/gnunet-idp.c | |||
@@ -119,7 +119,7 @@ static struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; | |||
119 | /** | 119 | /** |
120 | * Attribute list | 120 | * Attribute list |
121 | */ | 121 | */ |
122 | static struct GNUNET_IDENTITY_PROVIDER_AttributeList *attr_list; | 122 | static struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attr_list; |
123 | 123 | ||
124 | static void | 124 | static void |
125 | do_cleanup(void *cls) | 125 | do_cleanup(void *cls) |
@@ -166,7 +166,7 @@ store_attr_cont (void *cls, | |||
166 | static void | 166 | static void |
167 | process_attrs (void *cls, | 167 | process_attrs (void *cls, |
168 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 168 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
169 | const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr) | 169 | const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) |
170 | { | 170 | { |
171 | if (NULL == identity) | 171 | if (NULL == identity) |
172 | { | 172 | { |
@@ -207,7 +207,7 @@ process_rvk (void *cls, int success, const char* msg) | |||
207 | static void | 207 | static void |
208 | iter_finished (void *cls) | 208 | iter_finished (void *cls) |
209 | { | 209 | { |
210 | struct GNUNET_IDENTITY_PROVIDER_Attribute *attr; | 210 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr; |
211 | 211 | ||
212 | attr_iterator = NULL; | 212 | attr_iterator = NULL; |
213 | if (list) | 213 | if (list) |
@@ -244,8 +244,8 @@ iter_finished (void *cls) | |||
244 | NULL); | 244 | NULL); |
245 | return; | 245 | return; |
246 | } | 246 | } |
247 | attr = GNUNET_IDENTITY_PROVIDER_attribute_new (attr_name, | 247 | attr = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr_name, |
248 | GNUNET_IDENTITY_PROVIDER_AT_STRING, | 248 | GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING, |
249 | attr_value, | 249 | attr_value, |
250 | strlen (attr_value) + 1); | 250 | strlen (attr_value) + 1); |
251 | idp_op = GNUNET_IDENTITY_PROVIDER_attribute_store (idp_handle, | 251 | idp_op = GNUNET_IDENTITY_PROVIDER_attribute_store (idp_handle, |
@@ -260,9 +260,9 @@ iter_finished (void *cls) | |||
260 | static void | 260 | static void |
261 | iter_cb (void *cls, | 261 | iter_cb (void *cls, |
262 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 262 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
263 | const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr) | 263 | const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) |
264 | { | 264 | { |
265 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 265 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
266 | char *attrs_tmp; | 266 | char *attrs_tmp; |
267 | char *attr_str; | 267 | char *attr_str; |
268 | 268 | ||
@@ -275,11 +275,11 @@ iter_cb (void *cls, | |||
275 | attr_str = strtok (NULL, ","); | 275 | attr_str = strtok (NULL, ","); |
276 | continue; | 276 | continue; |
277 | } | 277 | } |
278 | le = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry); | 278 | le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); |
279 | le->attribute = GNUNET_IDENTITY_PROVIDER_attribute_new (attr->name, | 279 | le->claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr->name, |
280 | attr->attribute_type, | 280 | attr->type, |
281 | attr->data, | 281 | attr->data, |
282 | attr->data_size); | 282 | attr->data_size); |
283 | GNUNET_CONTAINER_DLL_insert (attr_list->list_head, | 283 | GNUNET_CONTAINER_DLL_insert (attr_list->list_head, |
284 | attr_list->list_tail, | 284 | attr_list->list_tail, |
285 | le); | 285 | le); |
@@ -321,7 +321,7 @@ ego_cb (void *cls, | |||
321 | sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); | 321 | sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); |
322 | 322 | ||
323 | 323 | ||
324 | attr_list = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeList); | 324 | attr_list = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); |
325 | 325 | ||
326 | attr_iterator = GNUNET_IDENTITY_PROVIDER_get_attributes_start (idp_handle, | 326 | attr_iterator = GNUNET_IDENTITY_PROVIDER_get_attributes_start (idp_handle, |
327 | pkey, | 327 | pkey, |
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 58dea88a7..a5c178aa5 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -34,9 +34,9 @@ | |||
34 | #include "gnunet_statistics_service.h" | 34 | #include "gnunet_statistics_service.h" |
35 | #include "gnunet_gns_service.h" | 35 | #include "gnunet_gns_service.h" |
36 | #include "gnunet_identity_provider_plugin.h" | 36 | #include "gnunet_identity_provider_plugin.h" |
37 | #include "gnunet_identity_attribute_lib.h" | ||
37 | #include "gnunet_signatures.h" | 38 | #include "gnunet_signatures.h" |
38 | #include "identity_provider.h" | 39 | #include "identity_provider.h" |
39 | #include "identity_attribute.h" | ||
40 | 40 | ||
41 | /** | 41 | /** |
42 | * First pass state | 42 | * First pass state |
@@ -365,7 +365,7 @@ struct AttributeStoreHandle | |||
365 | /** | 365 | /** |
366 | * The attribute to store | 366 | * The attribute to store |
367 | */ | 367 | */ |
368 | struct GNUNET_IDENTITY_PROVIDER_Attribute *attribute; | 368 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *claim; |
369 | 369 | ||
370 | /** | 370 | /** |
371 | * request id | 371 | * request id |
@@ -428,7 +428,7 @@ struct ConsumeTicketHandle | |||
428 | /** | 428 | /** |
429 | * Attributes | 429 | * Attributes |
430 | */ | 430 | */ |
431 | struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs; | 431 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; |
432 | 432 | ||
433 | /** | 433 | /** |
434 | * Lookup time | 434 | * Lookup time |
@@ -490,12 +490,12 @@ struct TicketRevocationHandle | |||
490 | /** | 490 | /** |
491 | * Attributes to reissue | 491 | * Attributes to reissue |
492 | */ | 492 | */ |
493 | struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs; | 493 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; |
494 | 494 | ||
495 | /** | 495 | /** |
496 | * Attributes to revoke | 496 | * Attributes to revoke |
497 | */ | 497 | */ |
498 | struct GNUNET_IDENTITY_PROVIDER_AttributeList *rvk_attrs; | 498 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *rvk_attrs; |
499 | 499 | ||
500 | /** | 500 | /** |
501 | * Issuer Key | 501 | * Issuer Key |
@@ -549,7 +549,7 @@ struct TicketIssueHandle | |||
549 | /** | 549 | /** |
550 | * Attributes to issue | 550 | * Attributes to issue |
551 | */ | 551 | */ |
552 | struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs; | 552 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; |
553 | 553 | ||
554 | /** | 554 | /** |
555 | * Issuer Key | 555 | * Issuer Key |
@@ -809,7 +809,7 @@ static void | |||
809 | cleanup_ticket_issue_handle (struct TicketIssueHandle *handle) | 809 | cleanup_ticket_issue_handle (struct TicketIssueHandle *handle) |
810 | { | 810 | { |
811 | if (NULL != handle->attrs) | 811 | if (NULL != handle->attrs) |
812 | attribute_list_destroy (handle->attrs); | 812 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs); |
813 | if (NULL != handle->ns_qe) | 813 | if (NULL != handle->ns_qe) |
814 | GNUNET_NAMESTORE_cancel (handle->ns_qe); | 814 | GNUNET_NAMESTORE_cancel (handle->ns_qe); |
815 | GNUNET_free (handle); | 815 | GNUNET_free (handle); |
@@ -820,7 +820,7 @@ static void | |||
820 | send_ticket_result (struct IdpClient *client, | 820 | send_ticket_result (struct IdpClient *client, |
821 | uint32_t r_id, | 821 | uint32_t r_id, |
822 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | 822 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, |
823 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) | 823 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) |
824 | { | 824 | { |
825 | struct TicketResultMessage *irm; | 825 | struct TicketResultMessage *irm; |
826 | struct GNUNET_MQ_Envelope *env; | 826 | struct GNUNET_MQ_Envelope *env; |
@@ -873,13 +873,13 @@ store_ticket_issue_cont (void *cls, | |||
873 | 873 | ||
874 | int | 874 | int |
875 | serialize_abe_keyinfo2 (const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | 875 | serialize_abe_keyinfo2 (const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, |
876 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs, | 876 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, |
877 | const struct GNUNET_CRYPTO_AbeKey *rp_key, | 877 | const struct GNUNET_CRYPTO_AbeKey *rp_key, |
878 | struct GNUNET_CRYPTO_EcdhePrivateKey **ecdh_privkey, | 878 | struct GNUNET_CRYPTO_EcdhePrivateKey **ecdh_privkey, |
879 | char **result) | 879 | char **result) |
880 | { | 880 | { |
881 | struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pubkey; | 881 | struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pubkey; |
882 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 882 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
883 | char *enc_keyinfo; | 883 | char *enc_keyinfo; |
884 | char *serialized_key; | 884 | char *serialized_key; |
885 | char *buf; | 885 | char *buf; |
@@ -896,7 +896,7 @@ serialize_abe_keyinfo2 (const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | |||
896 | (void**)&serialized_key); | 896 | (void**)&serialized_key); |
897 | attrs_str_len = 0; | 897 | attrs_str_len = 0; |
898 | for (le = attrs->list_head; NULL != le; le = le->next) { | 898 | for (le = attrs->list_head; NULL != le; le = le->next) { |
899 | attrs_str_len += strlen (le->attribute->name) + 1; | 899 | attrs_str_len += strlen (le->claim->name) + 1; |
900 | } | 900 | } |
901 | buf = GNUNET_malloc (attrs_str_len + size); | 901 | buf = GNUNET_malloc (attrs_str_len + size); |
902 | write_ptr = buf; | 902 | write_ptr = buf; |
@@ -904,14 +904,14 @@ serialize_abe_keyinfo2 (const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | |||
904 | "Writing attributes\n"); | 904 | "Writing attributes\n"); |
905 | for (le = attrs->list_head; NULL != le; le = le->next) { | 905 | for (le = attrs->list_head; NULL != le; le = le->next) { |
906 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 906 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
907 | "%s\n", le->attribute->name); | 907 | "%s\n", le->claim->name); |
908 | 908 | ||
909 | 909 | ||
910 | GNUNET_memcpy (write_ptr, | 910 | GNUNET_memcpy (write_ptr, |
911 | le->attribute->name, | 911 | le->claim->name, |
912 | strlen (le->attribute->name)); | 912 | strlen (le->claim->name)); |
913 | write_ptr[strlen (le->attribute->name)] = ','; | 913 | write_ptr[strlen (le->claim->name)] = ','; |
914 | write_ptr += strlen (le->attribute->name) + 1; | 914 | write_ptr += strlen (le->claim->name) + 1; |
915 | } | 915 | } |
916 | write_ptr--; | 916 | write_ptr--; |
917 | write_ptr[0] = '\0'; //replace last , with a 0-terminator | 917 | write_ptr[0] = '\0'; //replace last , with a 0-terminator |
@@ -954,7 +954,7 @@ issue_ticket_after_abe_bootstrap (void *cls, | |||
954 | struct GNUNET_CRYPTO_AbeMasterKey *abe_key) | 954 | struct GNUNET_CRYPTO_AbeMasterKey *abe_key) |
955 | { | 955 | { |
956 | struct TicketIssueHandle *ih = cls; | 956 | struct TicketIssueHandle *ih = cls; |
957 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 957 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
958 | struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; | 958 | struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; |
959 | struct GNUNET_GNSRECORD_Data code_record[1]; | 959 | struct GNUNET_GNSRECORD_Data code_record[1]; |
960 | struct GNUNET_CRYPTO_AbeKey *rp_key; | 960 | struct GNUNET_CRYPTO_AbeKey *rp_key; |
@@ -974,8 +974,8 @@ issue_ticket_after_abe_bootstrap (void *cls, | |||
974 | i = 0; | 974 | i = 0; |
975 | for (le = ih->attrs->list_head; NULL != le; le = le->next) { | 975 | for (le = ih->attrs->list_head; NULL != le; le = le->next) { |
976 | GNUNET_asprintf (&policy, "%s_%lu", | 976 | GNUNET_asprintf (&policy, "%s_%lu", |
977 | le->attribute->name, | 977 | le->claim->name, |
978 | le->attribute->attribute_version); | 978 | le->claim->version); |
979 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 979 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
980 | "Adding attribute to key: %s\n", | 980 | "Adding attribute to key: %s\n", |
981 | policy); | 981 | policy); |
@@ -1061,7 +1061,7 @@ handle_issue_ticket_message (void *cls, | |||
1061 | 1061 | ||
1062 | ih = GNUNET_new (struct TicketIssueHandle); | 1062 | ih = GNUNET_new (struct TicketIssueHandle); |
1063 | attrs_len = ntohs (im->attr_len); | 1063 | attrs_len = ntohs (im->attr_len); |
1064 | ih->attrs = attribute_list_deserialize ((char*)&im[1], attrs_len); | 1064 | ih->attrs = GNUNET_IDENTITY_ATTRIBUTE_list_deserialize ((char*)&im[1], attrs_len); |
1065 | ih->r_id = ntohl (im->id); | 1065 | ih->r_id = ntohl (im->id); |
1066 | ih->client = idp; | 1066 | ih->client = idp; |
1067 | ih->identity = im->identity; | 1067 | ih->identity = im->identity; |
@@ -1087,9 +1087,9 @@ static void | |||
1087 | cleanup_revoke_ticket_handle (struct TicketRevocationHandle *handle) | 1087 | cleanup_revoke_ticket_handle (struct TicketRevocationHandle *handle) |
1088 | { | 1088 | { |
1089 | if (NULL != handle->attrs) | 1089 | if (NULL != handle->attrs) |
1090 | attribute_list_destroy (handle->attrs); | 1090 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs); |
1091 | if (NULL != handle->rvk_attrs) | 1091 | if (NULL != handle->rvk_attrs) |
1092 | attribute_list_destroy (handle->rvk_attrs); | 1092 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->rvk_attrs); |
1093 | if (NULL != handle->abe_key) | 1093 | if (NULL != handle->abe_key) |
1094 | GNUNET_CRYPTO_cpabe_delete_master_key (handle->abe_key); | 1094 | GNUNET_CRYPTO_cpabe_delete_master_key (handle->abe_key); |
1095 | if (NULL != handle->ns_qe) | 1095 | if (NULL != handle->ns_qe) |
@@ -1132,7 +1132,7 @@ send_revocation_finished (struct TicketRevocationHandle *rh, | |||
1132 | static void | 1132 | static void |
1133 | ticket_reissue_proc (void *cls, | 1133 | ticket_reissue_proc (void *cls, |
1134 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | 1134 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, |
1135 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs); | 1135 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); |
1136 | 1136 | ||
1137 | static void | 1137 | static void |
1138 | revocation_reissue_tickets (struct TicketRevocationHandle *rh); | 1138 | revocation_reissue_tickets (struct TicketRevocationHandle *rh); |
@@ -1176,11 +1176,11 @@ reissue_ticket_cont (void *cls, | |||
1176 | static void | 1176 | static void |
1177 | ticket_reissue_proc (void *cls, | 1177 | ticket_reissue_proc (void *cls, |
1178 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | 1178 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, |
1179 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) | 1179 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) |
1180 | { | 1180 | { |
1181 | struct TicketRevocationHandle *rh = cls; | 1181 | struct TicketRevocationHandle *rh = cls; |
1182 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 1182 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
1183 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le_rollover; | 1183 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le_rollover; |
1184 | struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; | 1184 | struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; |
1185 | struct GNUNET_GNSRECORD_Data code_record[1]; | 1185 | struct GNUNET_GNSRECORD_Data code_record[1]; |
1186 | struct GNUNET_CRYPTO_AbeKey *rp_key; | 1186 | struct GNUNET_CRYPTO_AbeKey *rp_key; |
@@ -1223,11 +1223,11 @@ ticket_reissue_proc (void *cls, | |||
1223 | NULL != le_rollover; | 1223 | NULL != le_rollover; |
1224 | le_rollover = le_rollover->next) | 1224 | le_rollover = le_rollover->next) |
1225 | { | 1225 | { |
1226 | if (0 == strcmp (le_rollover->attribute->name, | 1226 | if (0 == strcmp (le_rollover->claim->name, |
1227 | le->attribute->name)) | 1227 | le->claim->name)) |
1228 | { | 1228 | { |
1229 | reissue_ticket = GNUNET_YES; | 1229 | reissue_ticket = GNUNET_YES; |
1230 | le->attribute->attribute_version = le_rollover->attribute->attribute_version; | 1230 | le->claim->version = le_rollover->claim->version; |
1231 | } | 1231 | } |
1232 | } | 1232 | } |
1233 | } | 1233 | } |
@@ -1255,8 +1255,8 @@ ticket_reissue_proc (void *cls, | |||
1255 | i = 0; | 1255 | i = 0; |
1256 | for (le = attrs->list_head; NULL != le; le = le->next) { | 1256 | for (le = attrs->list_head; NULL != le; le = le->next) { |
1257 | GNUNET_asprintf (&policy, "%s_%lu", | 1257 | GNUNET_asprintf (&policy, "%s_%lu", |
1258 | le->attribute->name, | 1258 | le->claim->name, |
1259 | le->attribute->attribute_version); | 1259 | le->claim->version); |
1260 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1260 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1261 | "Recreating key with %s\n", policy); | 1261 | "Recreating key with %s\n", policy); |
1262 | attr_arr[i] = policy; | 1262 | attr_arr[i] = policy; |
@@ -1349,14 +1349,14 @@ reenc_next_attribute (struct TicketRevocationHandle *rh) | |||
1349 | revocation_reissue_tickets (rh); | 1349 | revocation_reissue_tickets (rh); |
1350 | return; | 1350 | return; |
1351 | } | 1351 | } |
1352 | buf_size = attribute_serialize_get_size (rh->attrs->list_head->attribute); | 1352 | buf_size = GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (rh->attrs->list_head->claim); |
1353 | buf = GNUNET_malloc (buf_size); | 1353 | buf = GNUNET_malloc (buf_size); |
1354 | attribute_serialize (rh->attrs->list_head->attribute, | 1354 | GNUNET_IDENTITY_ATTRIBUTE_serialize (rh->attrs->list_head->claim, |
1355 | buf); | 1355 | buf); |
1356 | rh->attrs->list_head->attribute->attribute_version++; | 1356 | rh->attrs->list_head->claim->version++; |
1357 | GNUNET_asprintf (&policy, "%s_%lu", | 1357 | GNUNET_asprintf (&policy, "%s_%lu", |
1358 | rh->attrs->list_head->attribute->name, | 1358 | rh->attrs->list_head->claim->name, |
1359 | rh->attrs->list_head->attribute->attribute_version); | 1359 | rh->attrs->list_head->claim->version); |
1360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1361 | "Encrypting with policy %s\n", policy); | 1361 | "Encrypting with policy %s\n", policy); |
1362 | /** | 1362 | /** |
@@ -1371,7 +1371,7 @@ reenc_next_attribute (struct TicketRevocationHandle *rh) | |||
1371 | GNUNET_free (policy); | 1371 | GNUNET_free (policy); |
1372 | rd[0].data_size = enc_size + sizeof (uint32_t); | 1372 | rd[0].data_size = enc_size + sizeof (uint32_t); |
1373 | rd_buf = GNUNET_malloc (rd[0].data_size); | 1373 | rd_buf = GNUNET_malloc (rd[0].data_size); |
1374 | attr_ver = htonl (rh->attrs->list_head->attribute->attribute_version); | 1374 | attr_ver = htonl (rh->attrs->list_head->claim->version); |
1375 | GNUNET_memcpy (rd_buf, | 1375 | GNUNET_memcpy (rd_buf, |
1376 | &attr_ver, | 1376 | &attr_ver, |
1377 | sizeof (uint32_t)); | 1377 | sizeof (uint32_t)); |
@@ -1384,7 +1384,7 @@ reenc_next_attribute (struct TicketRevocationHandle *rh) | |||
1384 | rd[0].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; //TODO sane? | 1384 | rd[0].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; //TODO sane? |
1385 | rh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle, | 1385 | rh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle, |
1386 | &rh->identity, | 1386 | &rh->identity, |
1387 | rh->attrs->list_head->attribute->name, | 1387 | rh->attrs->list_head->claim->name, |
1388 | 1, | 1388 | 1, |
1389 | rd, | 1389 | rd, |
1390 | &attr_reenc_cont, | 1390 | &attr_reenc_cont, |
@@ -1403,7 +1403,7 @@ attr_reenc_cont (void *cls, | |||
1403 | const char *emsg) | 1403 | const char *emsg) |
1404 | { | 1404 | { |
1405 | struct TicketRevocationHandle *rh = cls; | 1405 | struct TicketRevocationHandle *rh = cls; |
1406 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 1406 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
1407 | 1407 | ||
1408 | if (GNUNET_SYSERR == success) | 1408 | if (GNUNET_SYSERR == success) |
1409 | { | 1409 | { |
@@ -1437,11 +1437,11 @@ attr_reenc_cont (void *cls, | |||
1437 | static void | 1437 | static void |
1438 | process_attributes_to_update (void *cls, | 1438 | process_attributes_to_update (void *cls, |
1439 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | 1439 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, |
1440 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) | 1440 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) |
1441 | { | 1441 | { |
1442 | struct TicketRevocationHandle *rh = cls; | 1442 | struct TicketRevocationHandle *rh = cls; |
1443 | 1443 | ||
1444 | rh->attrs = attribute_list_dup (attrs); | 1444 | rh->attrs = GNUNET_IDENTITY_ATTRIBUTE_list_dup (attrs); |
1445 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1445 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1446 | "Revocation Phase I: Collecting attributes\n"); | 1446 | "Revocation Phase I: Collecting attributes\n"); |
1447 | /* Reencrypt all attributes with new key */ | 1447 | /* Reencrypt all attributes with new key */ |
@@ -1514,7 +1514,7 @@ handle_revoke_ticket_message (void *cls, | |||
1514 | 1514 | ||
1515 | rh = GNUNET_new (struct TicketRevocationHandle); | 1515 | rh = GNUNET_new (struct TicketRevocationHandle); |
1516 | ticket = (struct GNUNET_IDENTITY_PROVIDER_Ticket*)&rm[1]; | 1516 | ticket = (struct GNUNET_IDENTITY_PROVIDER_Ticket*)&rm[1]; |
1517 | rh->rvk_attrs = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeList); | 1517 | rh->rvk_attrs = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); |
1518 | rh->ticket = *ticket; | 1518 | rh->ticket = *ticket; |
1519 | rh->r_id = ntohl (rm->id); | 1519 | rh->r_id = ntohl (rm->id); |
1520 | rh->client = idp; | 1520 | rh->client = idp; |
@@ -1537,7 +1537,7 @@ cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle) | |||
1537 | GNUNET_CRYPTO_cpabe_delete_key (handle->key, | 1537 | GNUNET_CRYPTO_cpabe_delete_key (handle->key, |
1538 | GNUNET_YES); | 1538 | GNUNET_YES); |
1539 | if (NULL != handle->attrs) | 1539 | if (NULL != handle->attrs) |
1540 | attribute_list_destroy (handle->attrs); | 1540 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs); |
1541 | GNUNET_free (handle); | 1541 | GNUNET_free (handle); |
1542 | } | 1542 | } |
1543 | 1543 | ||
@@ -1575,7 +1575,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1575 | struct ConsumeTicketHandle *handle = parallel_lookup->handle; | 1575 | struct ConsumeTicketHandle *handle = parallel_lookup->handle; |
1576 | struct ConsumeTicketResultMessage *crm; | 1576 | struct ConsumeTicketResultMessage *crm; |
1577 | struct GNUNET_MQ_Envelope *env; | 1577 | struct GNUNET_MQ_Envelope *env; |
1578 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *attr_le; | 1578 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *attr_le; |
1579 | struct GNUNET_TIME_Absolute decrypt_duration; | 1579 | struct GNUNET_TIME_Absolute decrypt_duration; |
1580 | char *data; | 1580 | char *data; |
1581 | char *data_tmp; | 1581 | char *data_tmp; |
@@ -1618,10 +1618,10 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1618 | 1, | 1618 | 1, |
1619 | GNUNET_YES); | 1619 | GNUNET_YES); |
1620 | 1620 | ||
1621 | attr_le = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry); | 1621 | attr_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); |
1622 | attr_le->attribute = attribute_deserialize (data, | 1622 | attr_le->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize (data, |
1623 | attr_len); | 1623 | attr_len); |
1624 | attr_le->attribute->attribute_version = ntohl(*(uint32_t*)rd->data); | 1624 | attr_le->claim->version = ntohl(*(uint32_t*)rd->data); |
1625 | GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head, | 1625 | GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head, |
1626 | handle->attrs->list_tail, | 1626 | handle->attrs->list_tail, |
1627 | attr_le); | 1627 | attr_le); |
@@ -1643,7 +1643,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1643 | } | 1643 | } |
1644 | 1644 | ||
1645 | GNUNET_SCHEDULER_cancel (handle->kill_task); | 1645 | GNUNET_SCHEDULER_cancel (handle->kill_task); |
1646 | attrs_len = attribute_list_serialize_get_size (handle->attrs); | 1646 | attrs_len = GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (handle->attrs); |
1647 | env = GNUNET_MQ_msg_extra (crm, | 1647 | env = GNUNET_MQ_msg_extra (crm, |
1648 | attrs_len, | 1648 | attrs_len, |
1649 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET_RESULT); | 1649 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET_RESULT); |
@@ -1651,7 +1651,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1651 | crm->attrs_len = htons (attrs_len); | 1651 | crm->attrs_len = htons (attrs_len); |
1652 | crm->identity = handle->ticket.identity; | 1652 | crm->identity = handle->ticket.identity; |
1653 | data_tmp = (char *) &crm[1]; | 1653 | data_tmp = (char *) &crm[1]; |
1654 | attribute_list_serialize (handle->attrs, | 1654 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (handle->attrs, |
1655 | data_tmp); | 1655 | data_tmp); |
1656 | GNUNET_MQ_send (handle->client->mq, env); | 1656 | GNUNET_MQ_send (handle->client->mq, env); |
1657 | cleanup_consume_ticket_handle (handle); | 1657 | cleanup_consume_ticket_handle (handle); |
@@ -1802,7 +1802,7 @@ handle_consume_ticket_message (void *cls, | |||
1802 | ch->r_id = ntohl (cm->id); | 1802 | ch->r_id = ntohl (cm->id); |
1803 | ch->client = idp; | 1803 | ch->client = idp; |
1804 | ch->identity = cm->identity; | 1804 | ch->identity = cm->identity; |
1805 | ch->attrs = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeList); | 1805 | ch->attrs = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); |
1806 | GNUNET_CRYPTO_ecdsa_key_get_public (&ch->identity, | 1806 | GNUNET_CRYPTO_ecdsa_key_get_public (&ch->identity, |
1807 | &ch->identity_pub); | 1807 | &ch->identity_pub); |
1808 | ch->ticket = *((struct GNUNET_IDENTITY_PROVIDER_Ticket*)&cm[1]); | 1808 | ch->ticket = *((struct GNUNET_IDENTITY_PROVIDER_Ticket*)&cm[1]); |
@@ -1830,8 +1830,8 @@ handle_consume_ticket_message (void *cls, | |||
1830 | static void | 1830 | static void |
1831 | cleanup_as_handle (struct AttributeStoreHandle *handle) | 1831 | cleanup_as_handle (struct AttributeStoreHandle *handle) |
1832 | { | 1832 | { |
1833 | if (NULL != handle->attribute) | 1833 | if (NULL != handle->claim) |
1834 | GNUNET_free (handle->attribute); | 1834 | GNUNET_free (handle->claim); |
1835 | if (NULL != handle->abe_key) | 1835 | if (NULL != handle->abe_key) |
1836 | GNUNET_CRYPTO_cpabe_delete_master_key (handle->abe_key); | 1836 | GNUNET_CRYPTO_cpabe_delete_master_key (handle->abe_key); |
1837 | GNUNET_free (handle); | 1837 | GNUNET_free (handle); |
@@ -1882,16 +1882,16 @@ attr_store_task (void *cls) | |||
1882 | 1882 | ||
1883 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1883 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1884 | "Storing attribute\n"); | 1884 | "Storing attribute\n"); |
1885 | buf_size = attribute_serialize_get_size (as_handle->attribute); | 1885 | buf_size = GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (as_handle->claim); |
1886 | buf = GNUNET_malloc (buf_size); | 1886 | buf = GNUNET_malloc (buf_size); |
1887 | 1887 | ||
1888 | attribute_serialize (as_handle->attribute, | 1888 | GNUNET_IDENTITY_ATTRIBUTE_serialize (as_handle->claim, |
1889 | buf); | 1889 | buf); |
1890 | 1890 | ||
1891 | GNUNET_asprintf (&policy, | 1891 | GNUNET_asprintf (&policy, |
1892 | "%s_%lu", | 1892 | "%s_%lu", |
1893 | as_handle->attribute->name, | 1893 | as_handle->claim->name, |
1894 | as_handle->attribute->attribute_version); | 1894 | as_handle->claim->version); |
1895 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1895 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1896 | "Encrypting with policy %s\n", policy); | 1896 | "Encrypting with policy %s\n", policy); |
1897 | /** | 1897 | /** |
@@ -1906,7 +1906,7 @@ attr_store_task (void *cls) | |||
1906 | GNUNET_free (policy); | 1906 | GNUNET_free (policy); |
1907 | rd[0].data_size = enc_size + sizeof (uint32_t); | 1907 | rd[0].data_size = enc_size + sizeof (uint32_t); |
1908 | rd_buf = GNUNET_malloc (rd[0].data_size); | 1908 | rd_buf = GNUNET_malloc (rd[0].data_size); |
1909 | attr_ver = htonl (as_handle->attribute->attribute_version); | 1909 | attr_ver = htonl (as_handle->claim->version); |
1910 | GNUNET_memcpy (rd_buf, | 1910 | GNUNET_memcpy (rd_buf, |
1911 | &attr_ver, | 1911 | &attr_ver, |
1912 | sizeof (uint32_t)); | 1912 | sizeof (uint32_t)); |
@@ -1919,7 +1919,7 @@ attr_store_task (void *cls) | |||
1919 | rd[0].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; //TODO sane? | 1919 | rd[0].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; //TODO sane? |
1920 | as_handle->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle, | 1920 | as_handle->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle, |
1921 | &as_handle->identity, | 1921 | &as_handle->identity, |
1922 | as_handle->attribute->name, | 1922 | as_handle->claim->name, |
1923 | 1, | 1923 | 1, |
1924 | rd, | 1924 | rd, |
1925 | &attr_store_cont, | 1925 | &attr_store_cont, |
@@ -1984,7 +1984,7 @@ handle_attribute_store_message (void *cls, | |||
1984 | data_len = ntohs (sam->attr_len); | 1984 | data_len = ntohs (sam->attr_len); |
1985 | 1985 | ||
1986 | as_handle = GNUNET_new (struct AttributeStoreHandle); | 1986 | as_handle = GNUNET_new (struct AttributeStoreHandle); |
1987 | as_handle->attribute = attribute_deserialize ((char*)&sam[1], | 1987 | as_handle->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize ((char*)&sam[1], |
1988 | data_len); | 1988 | data_len); |
1989 | 1989 | ||
1990 | as_handle->r_id = ntohl (sam->id); | 1990 | as_handle->r_id = ntohl (sam->id); |
@@ -2280,7 +2280,7 @@ cleanup_ticket_iter_handle (struct TicketIteration *ti) | |||
2280 | static void | 2280 | static void |
2281 | ticket_iterate_proc (void *cls, | 2281 | ticket_iterate_proc (void *cls, |
2282 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | 2282 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, |
2283 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) | 2283 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) |
2284 | { | 2284 | { |
2285 | struct TicketIterationProcResult *proc = cls; | 2285 | struct TicketIterationProcResult *proc = cls; |
2286 | 2286 | ||
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 | ||
diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c index 6d28709df..6fc8d228a 100644 --- a/src/identity-provider/identity_provider_api.c +++ b/src/identity-provider/identity_provider_api.c | |||
@@ -29,13 +29,12 @@ | |||
29 | #include "gnunet_protocols.h" | 29 | #include "gnunet_protocols.h" |
30 | #include "gnunet_mq_lib.h" | 30 | #include "gnunet_mq_lib.h" |
31 | #include "gnunet_identity_provider_service.h" | 31 | #include "gnunet_identity_provider_service.h" |
32 | #include "gnunet_identity_attribute_lib.h" | ||
32 | #include "identity_provider.h" | 33 | #include "identity_provider.h" |
33 | #include "identity_attribute.h" | ||
34 | 34 | ||
35 | #define LOG(kind,...) GNUNET_log_from (kind, "identity-api",__VA_ARGS__) | 35 | #define LOG(kind,...) GNUNET_log_from (kind, "identity-api",__VA_ARGS__) |
36 | 36 | ||
37 | 37 | ||
38 | |||
39 | /** | 38 | /** |
40 | * Handle for an operation with the service. | 39 | * Handle for an operation with the service. |
41 | */ | 40 | */ |
@@ -495,9 +494,9 @@ handle_consume_ticket_result (void *cls, | |||
495 | return; | 494 | return; |
496 | 495 | ||
497 | { | 496 | { |
498 | struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs; | 497 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; |
499 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *le; | 498 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
500 | attrs = attribute_list_deserialize ((char*)&msg[1], | 499 | attrs = GNUNET_IDENTITY_ATTRIBUTE_list_deserialize ((char*)&msg[1], |
501 | attrs_len); | 500 | attrs_len); |
502 | if (NULL != op->ar_cb) | 501 | if (NULL != op->ar_cb) |
503 | { | 502 | { |
@@ -512,8 +511,8 @@ handle_consume_ticket_result (void *cls, | |||
512 | for (le = attrs->list_head; NULL != le; le = le->next) | 511 | for (le = attrs->list_head; NULL != le; le = le->next) |
513 | op->ar_cb (op->cls, | 512 | op->ar_cb (op->cls, |
514 | &msg->identity, | 513 | &msg->identity, |
515 | le->attribute); | 514 | le->claim); |
516 | attribute_list_destroy (attrs); | 515 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (attrs); |
517 | } | 516 | } |
518 | } | 517 | } |
519 | op->ar_cb (op->cls, | 518 | op->ar_cb (op->cls, |
@@ -619,9 +618,9 @@ handle_attribute_result (void *cls, | |||
619 | } | 618 | } |
620 | 619 | ||
621 | { | 620 | { |
622 | struct GNUNET_IDENTITY_PROVIDER_Attribute *attr; | 621 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr; |
623 | attr = attribute_deserialize ((char*)&msg[1], | 622 | attr = GNUNET_IDENTITY_ATTRIBUTE_deserialize ((char*)&msg[1], |
624 | attr_len); | 623 | attr_len); |
625 | if (NULL != it) | 624 | if (NULL != it) |
626 | { | 625 | { |
627 | if (NULL != it->proc) | 626 | if (NULL != it->proc) |
@@ -905,7 +904,7 @@ GNUNET_IDENTITY_PROVIDER_disconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h) | |||
905 | struct GNUNET_IDENTITY_PROVIDER_Operation * | 904 | struct GNUNET_IDENTITY_PROVIDER_Operation * |
906 | GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle *h, | 905 | GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle *h, |
907 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 906 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
908 | const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr, | 907 | const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr, |
909 | GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus cont, | 908 | GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus cont, |
910 | void *cont_cls) | 909 | void *cont_cls) |
911 | { | 910 | { |
@@ -921,14 +920,14 @@ GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle | |||
921 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, | 920 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, |
922 | h->op_tail, | 921 | h->op_tail, |
923 | op); | 922 | op); |
924 | attr_len = attribute_serialize_get_size (attr); | 923 | attr_len = GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (attr); |
925 | op->env = GNUNET_MQ_msg_extra (sam, | 924 | op->env = GNUNET_MQ_msg_extra (sam, |
926 | attr_len, | 925 | attr_len, |
927 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_STORE); | 926 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_STORE); |
928 | sam->identity = *pkey; | 927 | sam->identity = *pkey; |
929 | sam->id = htonl (op->r_id); | 928 | sam->id = htonl (op->r_id); |
930 | 929 | ||
931 | attribute_serialize (attr, | 930 | GNUNET_IDENTITY_ATTRIBUTE_serialize (attr, |
932 | (char*)&sam[1]); | 931 | (char*)&sam[1]); |
933 | 932 | ||
934 | sam->attr_len = htons (attr_len); | 933 | sam->attr_len = htons (attr_len); |
@@ -941,24 +940,6 @@ GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle | |||
941 | 940 | ||
942 | 941 | ||
943 | /** | 942 | /** |
944 | * Create a new attribute. | ||
945 | * | ||
946 | * @param name the attribute name | ||
947 | * @param type the attribute type | ||
948 | * @param data the attribute value | ||
949 | * @param data_size the attribute value size | ||
950 | * @return the new attribute | ||
951 | */ | ||
952 | struct GNUNET_IDENTITY_PROVIDER_Attribute * | ||
953 | GNUNET_IDENTITY_PROVIDER_attribute_new (const char* attr_name, | ||
954 | uint32_t attr_type, | ||
955 | const void* data, | ||
956 | size_t data_size) | ||
957 | { | ||
958 | return attribute_new (attr_name, attr_type, data, data_size); | ||
959 | } | ||
960 | |||
961 | /** | ||
962 | * List all attributes for a local identity. | 943 | * List all attributes for a local identity. |
963 | * This MUST lock the `struct GNUNET_IDENTITY_PROVIDER_Handle` | 944 | * This MUST lock the `struct GNUNET_IDENTITY_PROVIDER_Handle` |
964 | * for any other calls than #GNUNET_IDENTITY_PROVIDER_get_attributes_next() and | 945 | * for any other calls than #GNUNET_IDENTITY_PROVIDER_get_attributes_next() and |
@@ -1089,7 +1070,7 @@ struct GNUNET_IDENTITY_PROVIDER_Operation * | |||
1089 | GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h, | 1070 | GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h, |
1090 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, | 1071 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, |
1091 | const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, | 1072 | const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, |
1092 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs, | 1073 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, |
1093 | GNUNET_IDENTITY_PROVIDER_TicketCallback cb, | 1074 | GNUNET_IDENTITY_PROVIDER_TicketCallback cb, |
1094 | void *cb_cls) | 1075 | void *cb_cls) |
1095 | { | 1076 | { |
@@ -1105,7 +1086,7 @@ GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h | |||
1105 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, | 1086 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, |
1106 | h->op_tail, | 1087 | h->op_tail, |
1107 | op); | 1088 | op); |
1108 | attr_len = attribute_list_serialize_get_size (attrs); | 1089 | attr_len = GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (attrs); |
1109 | op->env = GNUNET_MQ_msg_extra (tim, | 1090 | op->env = GNUNET_MQ_msg_extra (tim, |
1110 | attr_len, | 1091 | attr_len, |
1111 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ISSUE_TICKET); | 1092 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ISSUE_TICKET); |
@@ -1113,7 +1094,7 @@ GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h | |||
1113 | tim->rp = *rp; | 1094 | tim->rp = *rp; |
1114 | tim->id = htonl (op->r_id); | 1095 | tim->id = htonl (op->r_id); |
1115 | 1096 | ||
1116 | attribute_list_serialize (attrs, | 1097 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (attrs, |
1117 | (char*)&tim[1]); | 1098 | (char*)&tim[1]); |
1118 | 1099 | ||
1119 | tim->attr_len = htons (attr_len); | 1100 | tim->attr_len = htons (attr_len); |
diff --git a/src/identity-provider/plugin_identity_provider_sqlite.c b/src/identity-provider/plugin_identity_provider_sqlite.c index c87f30e1c..594e4788d 100644 --- a/src/identity-provider/plugin_identity_provider_sqlite.c +++ b/src/identity-provider/plugin_identity_provider_sqlite.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_identity_provider_service.h" | 28 | #include "gnunet_identity_provider_service.h" |
29 | #include "gnunet_identity_provider_plugin.h" | 29 | #include "gnunet_identity_provider_plugin.h" |
30 | #include "identity_attribute.h" | 30 | #include "gnunet_identity_attribute_lib.h" |
31 | #include "gnunet_sq_lib.h" | 31 | #include "gnunet_sq_lib.h" |
32 | #include <sqlite3.h> | 32 | #include <sqlite3.h> |
33 | 33 | ||
@@ -373,7 +373,7 @@ database_shutdown (struct Plugin *plugin) | |||
373 | static int | 373 | static int |
374 | identity_provider_sqlite_store_ticket (void *cls, | 374 | identity_provider_sqlite_store_ticket (void *cls, |
375 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | 375 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, |
376 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs) | 376 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) |
377 | { | 377 | { |
378 | struct Plugin *plugin = cls; | 378 | struct Plugin *plugin = cls; |
379 | size_t attrs_len; | 379 | size_t attrs_len; |
@@ -402,9 +402,9 @@ identity_provider_sqlite_store_ticket (void *cls, | |||
402 | GNUNET_SQ_reset (plugin->dbh, | 402 | GNUNET_SQ_reset (plugin->dbh, |
403 | plugin->delete_ticket); | 403 | plugin->delete_ticket); |
404 | 404 | ||
405 | attrs_len = attribute_list_serialize_get_size (attrs); | 405 | attrs_len = GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (attrs); |
406 | attrs_ser = GNUNET_malloc (attrs_len); | 406 | attrs_ser = GNUNET_malloc (attrs_len); |
407 | attribute_list_serialize (attrs, | 407 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (attrs, |
408 | attrs_ser); | 408 | attrs_ser); |
409 | struct GNUNET_SQ_QueryParam sparams[] = { | 409 | struct GNUNET_SQ_QueryParam sparams[] = { |
410 | GNUNET_SQ_query_param_auto_from_type (&ticket->identity), | 410 | GNUNET_SQ_query_param_auto_from_type (&ticket->identity), |
@@ -526,7 +526,7 @@ get_ticket_and_call_iterator (struct Plugin *plugin, | |||
526 | void *iter_cls) | 526 | void *iter_cls) |
527 | { | 527 | { |
528 | struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; | 528 | struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; |
529 | struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs; | 529 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; |
530 | int ret; | 530 | int ret; |
531 | int sret; | 531 | int sret; |
532 | size_t attrs_len; | 532 | size_t attrs_len; |
@@ -553,13 +553,13 @@ get_ticket_and_call_iterator (struct Plugin *plugin, | |||
553 | } | 553 | } |
554 | else | 554 | else |
555 | { | 555 | { |
556 | attrs = attribute_list_deserialize (attrs_ser, | 556 | attrs = GNUNET_IDENTITY_ATTRIBUTE_list_deserialize (attrs_ser, |
557 | attrs_len); | 557 | attrs_len); |
558 | if (NULL != iter) | 558 | if (NULL != iter) |
559 | iter (iter_cls, | 559 | iter (iter_cls, |
560 | &ticket, | 560 | &ticket, |
561 | attrs); | 561 | attrs); |
562 | attribute_list_destroy (attrs); | 562 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (attrs); |
563 | ret = GNUNET_YES; | 563 | ret = GNUNET_YES; |
564 | } | 564 | } |
565 | GNUNET_SQ_cleanup_result (rs); | 565 | GNUNET_SQ_cleanup_result (rs); |
diff --git a/src/identity-provider/plugin_rest_identity_provider.c b/src/identity-provider/plugin_rest_identity_provider.c index f6039722f..c27662a0d 100644 --- a/src/identity-provider/plugin_rest_identity_provider.c +++ b/src/identity-provider/plugin_rest_identity_provider.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <jansson.h> | 37 | #include <jansson.h> |
38 | #include <inttypes.h> | 38 | #include <inttypes.h> |
39 | #include "gnunet_signatures.h" | 39 | #include "gnunet_signatures.h" |
40 | #include "gnunet_identity_attribute_lib.h" | ||
40 | #include "gnunet_identity_provider_service.h" | 41 | #include "gnunet_identity_provider_service.h" |
41 | 42 | ||
42 | /** | 43 | /** |
@@ -508,7 +509,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
508 | struct RequestHandle *handle = cls; | 509 | struct RequestHandle *handle = cls; |
509 | struct EgoEntry *ego_entry; | 510 | struct EgoEntry *ego_entry; |
510 | struct MHD_Response *resp; | 511 | struct MHD_Response *resp; |
511 | struct GNUNET_IDENTITY_PROVIDER_Attribute *attribute; | 512 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attribute; |
512 | struct GNUNET_JSONAPI_Document *json_obj; | 513 | struct GNUNET_JSONAPI_Document *json_obj; |
513 | struct GNUNET_JSONAPI_Resource *json_res; | 514 | struct GNUNET_JSONAPI_Resource *json_res; |
514 | char term_data[handle->rest_handle->data_size+1]; | 515 | char term_data[handle->rest_handle->data_size+1]; |
@@ -596,8 +597,8 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
596 | value_json = GNUNET_JSONAPI_resource_read_attr (json_res, | 597 | value_json = GNUNET_JSONAPI_resource_read_attr (json_res, |
597 | "value"); | 598 | "value"); |
598 | value_str = json_string_value (value_json); | 599 | value_str = json_string_value (value_json); |
599 | attribute = GNUNET_IDENTITY_PROVIDER_attribute_new (name_str, | 600 | attribute = GNUNET_IDENTITY_ATTRIBUTE_claim_new (name_str, |
600 | GNUNET_IDENTITY_PROVIDER_AT_STRING, | 601 | GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING, |
601 | value_str, | 602 | value_str, |
602 | strlen (value_str) + 1); | 603 | strlen (value_str) + 1); |
603 | handle->idp = GNUNET_IDENTITY_PROVIDER_connect (cfg); | 604 | handle->idp = GNUNET_IDENTITY_PROVIDER_connect (cfg); |
@@ -619,7 +620,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
619 | static void | 620 | static void |
620 | attr_collect (void *cls, | 621 | attr_collect (void *cls, |
621 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 622 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
622 | const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr) | 623 | const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) |
623 | { | 624 | { |
624 | struct GNUNET_JSONAPI_Resource *json_resource; | 625 | struct GNUNET_JSONAPI_Resource *json_resource; |
625 | struct RequestHandle *handle = cls; | 626 | struct RequestHandle *handle = cls; |
@@ -833,7 +834,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
833 | static void | 834 | static void |
834 | consume_cont (void *cls, | 835 | consume_cont (void *cls, |
835 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 836 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
836 | const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr) | 837 | const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) |
837 | { | 838 | { |
838 | struct RequestHandle *handle = cls; | 839 | struct RequestHandle *handle = cls; |
839 | struct GNUNET_JSONAPI_Resource *json_resource; | 840 | struct GNUNET_JSONAPI_Resource *json_resource; |
diff --git a/src/include/gnunet_identity_attribute_lib.h b/src/include/gnunet_identity_attribute_lib.h new file mode 100644 index 000000000..039b50351 --- /dev/null +++ b/src/include/gnunet_identity_attribute_lib.h | |||
@@ -0,0 +1,231 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2017 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 | /** | ||
22 | * @author Martin Schanzenbach | ||
23 | * | ||
24 | * @file | ||
25 | * Identity attribute definitions | ||
26 | * | ||
27 | * @defgroup identity-provider Identity Provider service | ||
28 | * @{ | ||
29 | */ | ||
30 | #ifndef GNUNET_IDENTITY_ATTRIBUTE_LIB_H | ||
31 | #define GNUNET_IDENTITY_ATTRIBUTE_LIB_H | ||
32 | |||
33 | #ifdef __cplusplus | ||
34 | extern "C" | ||
35 | { | ||
36 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
37 | } | ||
38 | #endif | ||
39 | #endif | ||
40 | |||
41 | #include "gnunet_util_lib.h" | ||
42 | |||
43 | |||
44 | /** | ||
45 | * No value attribute. | ||
46 | */ | ||
47 | #define GNUNET_IDENTITY_ATTRIBUTE_TYPE_NONE 0 | ||
48 | |||
49 | /** | ||
50 | * String attribute. | ||
51 | */ | ||
52 | #define GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING 1 | ||
53 | |||
54 | |||
55 | |||
56 | /** | ||
57 | * An attribute. | ||
58 | */ | ||
59 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim | ||
60 | { | ||
61 | /** | ||
62 | * The name of the attribute. Note "name" must never be individually | ||
63 | * free'd | ||
64 | */ | ||
65 | const char* name; | ||
66 | |||
67 | /** | ||
68 | * Type of Claim | ||
69 | */ | ||
70 | uint32_t type; | ||
71 | |||
72 | /** | ||
73 | * Version | ||
74 | */ | ||
75 | uint32_t version; | ||
76 | |||
77 | /** | ||
78 | * Number of bytes in @e data. | ||
79 | */ | ||
80 | size_t data_size; | ||
81 | |||
82 | /** | ||
83 | * Binary value stored as attribute value. Note: "data" must never | ||
84 | * be individually 'malloc'ed, but instead always points into some | ||
85 | * existing data area. | ||
86 | */ | ||
87 | const void *data; | ||
88 | |||
89 | }; | ||
90 | |||
91 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList | ||
92 | { | ||
93 | /** | ||
94 | * List head | ||
95 | */ | ||
96 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *list_head; | ||
97 | |||
98 | /** | ||
99 | * List tail | ||
100 | */ | ||
101 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *list_tail; | ||
102 | }; | ||
103 | |||
104 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry | ||
105 | { | ||
106 | /** | ||
107 | * DLL | ||
108 | */ | ||
109 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *prev; | ||
110 | |||
111 | /** | ||
112 | * DLL | ||
113 | */ | ||
114 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *next; | ||
115 | |||
116 | /** | ||
117 | * The attribute claim | ||
118 | */ | ||
119 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *claim; | ||
120 | }; | ||
121 | |||
122 | /** | ||
123 | * Create a new attribute claim. | ||
124 | * | ||
125 | * @param name the attribute name | ||
126 | * @param type the attribute type | ||
127 | * @param data the attribute value | ||
128 | * @param data_size the attribute value size | ||
129 | * @return the new attribute | ||
130 | */ | ||
131 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim * | ||
132 | GNUNET_IDENTITY_ATTRIBUTE_claim_new (const char* attr_name, | ||
133 | uint32_t type, | ||
134 | const void* data, | ||
135 | size_t data_size); | ||
136 | |||
137 | |||
138 | /** | ||
139 | * Get required size for serialization buffer | ||
140 | * | ||
141 | * @param attrs the attribute list to serialize | ||
142 | * | ||
143 | * @return the required buffer size | ||
144 | */ | ||
145 | size_t | ||
146 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); | ||
147 | |||
148 | void | ||
149 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); | ||
150 | |||
151 | |||
152 | /** | ||
153 | * Serialize an attribute list | ||
154 | * | ||
155 | * @param attrs the attribute list to serialize | ||
156 | * @param result the serialized attribute | ||
157 | * | ||
158 | * @return length of serialized data | ||
159 | */ | ||
160 | size_t | ||
161 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, | ||
162 | char *result); | ||
163 | |||
164 | /** | ||
165 | * Deserialize an attribute list | ||
166 | * | ||
167 | * @param data the serialized attribute list | ||
168 | * @param data_size the length of the serialized data | ||
169 | * | ||
170 | * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller | ||
171 | */ | ||
172 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList * | ||
173 | GNUNET_IDENTITY_ATTRIBUTE_list_deserialize (const char* data, | ||
174 | size_t data_size); | ||
175 | |||
176 | |||
177 | /** | ||
178 | * Get required size for serialization buffer | ||
179 | * | ||
180 | * @param attr the attribute to serialize | ||
181 | * | ||
182 | * @return the required buffer size | ||
183 | */ | ||
184 | size_t | ||
185 | GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr); | ||
186 | |||
187 | |||
188 | |||
189 | /** | ||
190 | * Serialize an attribute | ||
191 | * | ||
192 | * @param attr the attribute to serialize | ||
193 | * @param result the serialized attribute | ||
194 | * | ||
195 | * @return length of serialized data | ||
196 | */ | ||
197 | size_t | ||
198 | GNUNET_IDENTITY_ATTRIBUTE_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr, | ||
199 | char *result); | ||
200 | |||
201 | /** | ||
202 | * Deserialize an attribute | ||
203 | * | ||
204 | * @param data the serialized attribute | ||
205 | * @param data_size the length of the serialized data | ||
206 | * | ||
207 | * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller | ||
208 | */ | ||
209 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim * | ||
210 | GNUNET_IDENTITY_ATTRIBUTE_deserialize (const char* data, | ||
211 | size_t data_size); | ||
212 | |||
213 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList* | ||
214 | GNUNET_IDENTITY_ATTRIBUTE_list_dup (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); | ||
215 | |||
216 | |||
217 | |||
218 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
219 | { | ||
220 | #endif | ||
221 | #ifdef __cplusplus | ||
222 | } | ||
223 | #endif | ||
224 | |||
225 | |||
226 | /* ifndef GNUNET_IDENTITY_ATTRIBUTE_LIB_H */ | ||
227 | #endif | ||
228 | |||
229 | /** @} */ /* end of group identity */ | ||
230 | |||
231 | /* end of gnunet_identity_attribute_lib.h */ | ||
diff --git a/src/include/gnunet_identity_attribute_plugin.h b/src/include/gnunet_identity_attribute_plugin.h new file mode 100644 index 000000000..edeed57fd --- /dev/null +++ b/src/include/gnunet_identity_attribute_plugin.h | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2012, 2013 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 | /** | ||
22 | * @author Martin Schanzenbach | ||
23 | * | ||
24 | * @file | ||
25 | * Plugin API for the idp database backend | ||
26 | * | ||
27 | * @defgroup identity-provider-plugin IdP service plugin API | ||
28 | * Plugin API for the idp database backend | ||
29 | * @{ | ||
30 | */ | ||
31 | #ifndef GNUNET_IDENTITY_ATTRIBUTE_PLUGIN_H | ||
32 | #define GNUNET_IDENTITY_ATTRIBUTE_PLUGIN_H | ||
33 | |||
34 | #include "gnunet_util_lib.h" | ||
35 | #include "gnunet_identity_attribute_lib.h" | ||
36 | |||
37 | #ifdef __cplusplus | ||
38 | extern "C" | ||
39 | { | ||
40 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
41 | } | ||
42 | #endif | ||
43 | #endif | ||
44 | |||
45 | |||
46 | /** | ||
47 | * Function called to convert the binary value @a data of an attribute of | ||
48 | * type @a type to a human-readable string. | ||
49 | * | ||
50 | * @param cls closure | ||
51 | * @param type type of the attribute | ||
52 | * @param data value in binary encoding | ||
53 | * @param data_size number of bytes in @a data | ||
54 | * @return NULL on error, otherwise human-readable representation of the value | ||
55 | */ | ||
56 | typedef char * (*GNUNET_IDENTITY_ATTRIBUTE_ValueToStringFunction) (void *cls, | ||
57 | uint32_t type, | ||
58 | const void *data, | ||
59 | size_t data_size); | ||
60 | |||
61 | |||
62 | /** | ||
63 | * Function called to convert human-readable version of the value @a s | ||
64 | * of an attribute of type @a type to the respective binary | ||
65 | * representation. | ||
66 | * | ||
67 | * @param cls closure | ||
68 | * @param type type of the attribute | ||
69 | * @param s human-readable string | ||
70 | * @param data set to value in binary encoding (will be allocated) | ||
71 | * @param data_size set to number of bytes in @a data | ||
72 | * @return #GNUNET_OK on success | ||
73 | */ | ||
74 | typedef int (*GNUNET_IDENTITY_ATTRIBUTE_StringToValueFunction) (void *cls, | ||
75 | uint32_t type, | ||
76 | const char *s, | ||
77 | void **data, | ||
78 | size_t *data_size); | ||
79 | |||
80 | |||
81 | /** | ||
82 | * Function called to convert a type name to the | ||
83 | * corresponding number. | ||
84 | * | ||
85 | * @param cls closure | ||
86 | * @param typename name to convert | ||
87 | * @return corresponding number, UINT32_MAX on error | ||
88 | */ | ||
89 | typedef uint32_t (*GNUNET_IDENTITY_ATTRIBUTE_TypenameToNumberFunction) (void *cls, | ||
90 | const char *typename); | ||
91 | |||
92 | |||
93 | /** | ||
94 | * Function called to convert a type number (i.e. 1) to the | ||
95 | * corresponding type string | ||
96 | * | ||
97 | * @param cls closure | ||
98 | * @param type number of a type to convert | ||
99 | * @return corresponding typestring, NULL on error | ||
100 | */ | ||
101 | typedef const char * (*GNUNET_IDENTITY_ATTRIBUTE_NumberToTypenameFunction) (void *cls, | ||
102 | uint32_t type); | ||
103 | |||
104 | |||
105 | /** | ||
106 | * Each plugin is required to return a pointer to a struct of this | ||
107 | * type as the return value from its entry point. | ||
108 | */ | ||
109 | struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions | ||
110 | { | ||
111 | |||
112 | /** | ||
113 | * Closure for all of the callbacks. | ||
114 | */ | ||
115 | void *cls; | ||
116 | |||
117 | /** | ||
118 | * Conversion to string. | ||
119 | */ | ||
120 | GNUNET_IDENTITY_ATTRIBUTE_ValueToStringFunction value_to_string; | ||
121 | |||
122 | /** | ||
123 | * Conversion to binary. | ||
124 | */ | ||
125 | GNUNET_IDENTITY_ATTRIBUTE_StringToValueFunction string_to_value; | ||
126 | |||
127 | /** | ||
128 | * Typename to number. | ||
129 | */ | ||
130 | GNUNET_IDENTITY_ATTRIBUTE_TypenameToNumberFunction typename_to_number; | ||
131 | |||
132 | /** | ||
133 | * Number to typename. | ||
134 | */ | ||
135 | GNUNET_IDENTITY_ATTRIBUTE_NumberToTypenameFunction number_to_typename; | ||
136 | |||
137 | }; | ||
138 | |||
139 | |||
140 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
141 | { | ||
142 | #endif | ||
143 | #ifdef __cplusplus | ||
144 | } | ||
145 | #endif | ||
146 | |||
147 | #endif | ||
148 | |||
149 | /** @} */ /* end of group */ | ||
diff --git a/src/include/gnunet_identity_provider_plugin.h b/src/include/gnunet_identity_provider_plugin.h index c0a258ab6..4b5098d58 100644 --- a/src/include/gnunet_identity_provider_plugin.h +++ b/src/include/gnunet_identity_provider_plugin.h | |||
@@ -51,7 +51,7 @@ extern "C" | |||
51 | */ | 51 | */ |
52 | typedef void (*GNUNET_IDENTITY_PROVIDER_TicketIterator) (void *cls, | 52 | typedef void (*GNUNET_IDENTITY_PROVIDER_TicketIterator) (void *cls, |
53 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | 53 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, |
54 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs); | 54 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); |
55 | 55 | ||
56 | 56 | ||
57 | /** | 57 | /** |
@@ -74,7 +74,7 @@ struct GNUNET_IDENTITY_PROVIDER_PluginFunctions | |||
74 | */ | 74 | */ |
75 | int (*store_ticket) (void *cls, | 75 | int (*store_ticket) (void *cls, |
76 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | 76 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, |
77 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs); | 77 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Delete a ticket from the database. | 80 | * Delete a ticket from the database. |
@@ -111,7 +111,6 @@ struct GNUNET_IDENTITY_PROVIDER_PluginFunctions | |||
111 | void *iter_cls); | 111 | void *iter_cls); |
112 | }; | 112 | }; |
113 | 113 | ||
114 | |||
115 | #if 0 /* keep Emacsens' auto-indent happy */ | 114 | #if 0 /* keep Emacsens' auto-indent happy */ |
116 | { | 115 | { |
117 | #endif | 116 | #endif |
diff --git a/src/include/gnunet_identity_provider_service.h b/src/include/gnunet_identity_provider_service.h index d17a1cc9c..6bc05d0f4 100644 --- a/src/include/gnunet_identity_provider_service.h +++ b/src/include/gnunet_identity_provider_service.h | |||
@@ -39,7 +39,7 @@ extern "C" | |||
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #include "gnunet_util_lib.h" | 41 | #include "gnunet_util_lib.h" |
42 | 42 | #include "gnunet_identity_attribute_lib.h" | |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Version number of GNUnet Identity Provider API. | 45 | * Version number of GNUnet Identity Provider API. |
@@ -82,92 +82,6 @@ struct GNUNET_IDENTITY_PROVIDER_Ticket | |||
82 | */ | 82 | */ |
83 | struct GNUNET_IDENTITY_PROVIDER_Operation; | 83 | struct GNUNET_IDENTITY_PROVIDER_Operation; |
84 | 84 | ||
85 | /** | ||
86 | * Flags that can be set for an attribute. | ||
87 | */ | ||
88 | enum GNUNET_IDENTITY_PROVIDER_AttributeType | ||
89 | { | ||
90 | |||
91 | /** | ||
92 | * No value attribute. | ||
93 | */ | ||
94 | GNUNET_IDENTITY_PROVIDER_AT_NULL = 0, | ||
95 | |||
96 | /** | ||
97 | * String attribute. | ||
98 | */ | ||
99 | GNUNET_IDENTITY_PROVIDER_AT_STRING = 1, | ||
100 | |||
101 | }; | ||
102 | |||
103 | |||
104 | |||
105 | /** | ||
106 | * An attribute. | ||
107 | */ | ||
108 | struct GNUNET_IDENTITY_PROVIDER_Attribute | ||
109 | { | ||
110 | |||
111 | /** | ||
112 | * Type of Attribute. | ||
113 | */ | ||
114 | uint32_t attribute_type; | ||
115 | |||
116 | /** | ||
117 | * Attribute version | ||
118 | */ | ||
119 | uint32_t attribute_version; | ||
120 | |||
121 | /** | ||
122 | * Number of bytes in @e data. | ||
123 | */ | ||
124 | size_t data_size; | ||
125 | |||
126 | /** | ||
127 | * The name of the attribute. Note "name" must never be individually | ||
128 | * free'd | ||
129 | */ | ||
130 | const char* name; | ||
131 | |||
132 | /** | ||
133 | * Binary value stored as attribute value. Note: "data" must never | ||
134 | * be individually 'malloc'ed, but instead always points into some | ||
135 | * existing data area. | ||
136 | */ | ||
137 | const void *data; | ||
138 | |||
139 | }; | ||
140 | |||
141 | struct GNUNET_IDENTITY_PROVIDER_AttributeList | ||
142 | { | ||
143 | /** | ||
144 | * List head | ||
145 | */ | ||
146 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *list_head; | ||
147 | |||
148 | /** | ||
149 | * List tail | ||
150 | */ | ||
151 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *list_tail; | ||
152 | }; | ||
153 | |||
154 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry | ||
155 | { | ||
156 | /** | ||
157 | * DLL | ||
158 | */ | ||
159 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *prev; | ||
160 | |||
161 | /** | ||
162 | * DLL | ||
163 | */ | ||
164 | struct GNUNET_IDENTITY_PROVIDER_AttributeListEntry *next; | ||
165 | |||
166 | /** | ||
167 | * The attribute | ||
168 | */ | ||
169 | struct GNUNET_IDENTITY_PROVIDER_Attribute *attribute; | ||
170 | }; | ||
171 | 85 | ||
172 | /** | 86 | /** |
173 | * Connect to the identity provider service. | 87 | * Connect to the identity provider service. |
@@ -208,27 +122,12 @@ typedef void | |||
208 | struct GNUNET_IDENTITY_PROVIDER_Operation * | 122 | struct GNUNET_IDENTITY_PROVIDER_Operation * |
209 | GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle *h, | 123 | GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle *h, |
210 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 124 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
211 | const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr, | 125 | const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr, |
212 | GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus cont, | 126 | GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus cont, |
213 | void *cont_cls); | 127 | void *cont_cls); |
214 | 128 | ||
215 | 129 | ||
216 | /** | 130 | /** |
217 | * Create a new attribute. | ||
218 | * | ||
219 | * @param name the attribute name | ||
220 | * @param type the attribute type | ||
221 | * @param data the attribute value | ||
222 | * @param data_size the attribute value size | ||
223 | * @return the new attribute | ||
224 | */ | ||
225 | struct GNUNET_IDENTITY_PROVIDER_Attribute * | ||
226 | GNUNET_IDENTITY_PROVIDER_attribute_new (const char* attr_name, | ||
227 | uint32_t attr_type, | ||
228 | const void* data, | ||
229 | size_t data_size); | ||
230 | |||
231 | /** | ||
232 | * Process an attribute that was stored in the idp. | 131 | * Process an attribute that was stored in the idp. |
233 | * | 132 | * |
234 | * @param cls closure | 133 | * @param cls closure |
@@ -237,7 +136,7 @@ GNUNET_IDENTITY_PROVIDER_attribute_new (const char* attr_name, | |||
237 | typedef void | 136 | typedef void |
238 | (*GNUNET_IDENTITY_PROVIDER_AttributeResult) (void *cls, | 137 | (*GNUNET_IDENTITY_PROVIDER_AttributeResult) (void *cls, |
239 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 138 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
240 | const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr); | 139 | const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr); |
241 | 140 | ||
242 | 141 | ||
243 | 142 | ||
@@ -327,7 +226,7 @@ struct GNUNET_IDENTITY_PROVIDER_Operation * | |||
327 | GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *id, | 226 | GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *id, |
328 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, | 227 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, |
329 | const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, | 228 | const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, |
330 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs, | 229 | const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, |
331 | GNUNET_IDENTITY_PROVIDER_TicketCallback cb, | 230 | GNUNET_IDENTITY_PROVIDER_TicketCallback cb, |
332 | void *cb_cls); | 231 | void *cb_cls); |
333 | 232 | ||