diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/Makefile.am | 16 | ||||
-rw-r--r-- | src/include/gnunet_buffer_lib.h | 176 | ||||
-rw-r--r-- | src/include/gnunet_curl_lib.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_gns_service.h | 25 | ||||
-rw-r--r-- | src/include/gnunet_gnsrecord_lib.h | 11 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 11 | ||||
-rw-r--r-- | src/include/gnunet_reclaim_attribute_lib.h | 245 | ||||
-rw-r--r-- | src/include/gnunet_reclaim_attribute_plugin.h | 27 | ||||
-rw-r--r-- | src/include/gnunet_reclaim_service.h | 82 | ||||
-rw-r--r-- | src/include/gnunet_util_taler_wallet_lib.h | 56 |
10 files changed, 579 insertions, 72 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index c81f8e7d8..b53f2420d 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -9,17 +9,6 @@ EXTRA_DIST = \ | |||
9 | block_dns.h \ | 9 | block_dns.h \ |
10 | block_regex.h | 10 | block_regex.h |
11 | 11 | ||
12 | if TALER_ONLY | ||
13 | gnunetinclude_HEADERS = \ | ||
14 | platform.h gettext.h \ | ||
15 | gnunet_common.h \ | ||
16 | gnunet_container_lib.h \ | ||
17 | gnunet_crypto_lib.h \ | ||
18 | gnunet_strings_lib.h \ | ||
19 | gnunet_time_lib.h \ | ||
20 | gnunet_util_taler_wallet_lib.h | ||
21 | else | ||
22 | |||
23 | gnunetinclude_HEADERS = \ | 12 | gnunetinclude_HEADERS = \ |
24 | platform.h gettext.h \ | 13 | platform.h gettext.h \ |
25 | compat.h \ | 14 | compat.h \ |
@@ -35,6 +24,7 @@ gnunetinclude_HEADERS = \ | |||
35 | gnunet_block_lib.h \ | 24 | gnunet_block_lib.h \ |
36 | gnunet_block_group_lib.h \ | 25 | gnunet_block_group_lib.h \ |
37 | gnunet_block_plugin.h \ | 26 | gnunet_block_plugin.h \ |
27 | gnunet_buffer_lib.h \ | ||
38 | gnunet_client_lib.h \ | 28 | gnunet_client_lib.h \ |
39 | gnunet_common.h \ | 29 | gnunet_common.h \ |
40 | gnunet_constants.h \ | 30 | gnunet_constants.h \ |
@@ -101,7 +91,7 @@ gnunetinclude_HEADERS = \ | |||
101 | gnunet_regex_service.h \ | 91 | gnunet_regex_service.h \ |
102 | gnunet_rest_lib.h \ | 92 | gnunet_rest_lib.h \ |
103 | gnunet_rest_plugin.h \ | 93 | gnunet_rest_plugin.h \ |
104 | gnunet_rps_service.h \ | 94 | gnunet_rps_service.h \ |
105 | gnunet_revocation_service.h \ | 95 | gnunet_revocation_service.h \ |
106 | gnunet_scalarproduct_service.h \ | 96 | gnunet_scalarproduct_service.h \ |
107 | gnunet_scheduler_lib.h \ | 97 | gnunet_scheduler_lib.h \ |
@@ -130,5 +120,3 @@ gnunetinclude_HEADERS = \ | |||
130 | gnunet_tun_lib.h \ | 120 | gnunet_tun_lib.h \ |
131 | gnunet_util_lib.h \ | 121 | gnunet_util_lib.h \ |
132 | gnunet_vpn_service.h | 122 | gnunet_vpn_service.h |
133 | |||
134 | endif | ||
diff --git a/src/include/gnunet_buffer_lib.h b/src/include/gnunet_buffer_lib.h new file mode 100644 index 000000000..c0ae06d77 --- /dev/null +++ b/src/include/gnunet_buffer_lib.h | |||
@@ -0,0 +1,176 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your 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 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * Common buffer management functions. | ||
23 | * | ||
24 | * @author Florian Dold | ||
25 | */ | ||
26 | |||
27 | #ifndef GNUNET_BUFFER_LIB_H | ||
28 | #define GNUNET_BUFFER_LIB_H | ||
29 | |||
30 | /** | ||
31 | * Dynamically growing buffer. Can be used to construct | ||
32 | * strings and other objects with dynamic size. | ||
33 | * | ||
34 | * This structure should, in most cases, be stack-allocated and | ||
35 | * zero-initialized, like: | ||
36 | * | ||
37 | * struct GNUNET_Buffer my_buffer = { 0 }; | ||
38 | */ | ||
39 | struct GNUNET_Buffer | ||
40 | { | ||
41 | /** | ||
42 | * Capacity of the buffer. | ||
43 | */ | ||
44 | size_t capacity; | ||
45 | |||
46 | /** | ||
47 | * Current write position. | ||
48 | */ | ||
49 | size_t position; | ||
50 | |||
51 | /** | ||
52 | * Backing memory. | ||
53 | */ | ||
54 | char *mem; | ||
55 | |||
56 | /** | ||
57 | * Log a warning if the buffer is grown over its initially allocated capacity. | ||
58 | */ | ||
59 | int warn_grow; | ||
60 | }; | ||
61 | |||
62 | |||
63 | /** | ||
64 | * Initialize a buffer with the given capacity. | ||
65 | * | ||
66 | * When a buffer is allocated with this function, a warning is logged | ||
67 | * when the buffer exceeds the initial capacity. | ||
68 | * | ||
69 | * @param buf the buffer to initialize | ||
70 | * @param capacity the capacity (in bytes) to allocate for @a buf | ||
71 | */ | ||
72 | void | ||
73 | GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, size_t capacity); | ||
74 | |||
75 | |||
76 | /** | ||
77 | * Make sure that at least @a n bytes remaining in the buffer. | ||
78 | * | ||
79 | * @param buf buffer to potentially grow | ||
80 | * @param n number of bytes that should be available to write | ||
81 | */ | ||
82 | void | ||
83 | GNUNET_buffer_ensure_remaining (struct GNUNET_Buffer *buf, size_t n); | ||
84 | |||
85 | |||
86 | /** | ||
87 | * Write bytes to the buffer. | ||
88 | * | ||
89 | * Grows the buffer if necessary. | ||
90 | * | ||
91 | * @param buf buffer to write to | ||
92 | * @param data data to read from | ||
93 | * @param len number of bytes to copy from @a data to @a buf | ||
94 | * | ||
95 | */ | ||
96 | void | ||
97 | GNUNET_buffer_write (struct GNUNET_Buffer *buf, const char *data, size_t len); | ||
98 | |||
99 | |||
100 | /** | ||
101 | * Write a 0-terminated string to a buffer, excluding the 0-terminator. | ||
102 | * | ||
103 | * Grows the buffer if necessary. | ||
104 | * | ||
105 | * @param buf the buffer to write to | ||
106 | * @param str the string to write to @a buf | ||
107 | */ | ||
108 | void | ||
109 | GNUNET_buffer_write_str (struct GNUNET_Buffer *buf, const char *str); | ||
110 | |||
111 | |||
112 | /** | ||
113 | * Write a path component to a buffer, ensuring that | ||
114 | * there is exactly one slash between the previous contents | ||
115 | * of the buffer and the new string. | ||
116 | * | ||
117 | * @param buf buffer to write to | ||
118 | * @param str string containing the new path component | ||
119 | */ | ||
120 | void | ||
121 | GNUNET_buffer_write_path (struct GNUNET_Buffer *buf, const char *str); | ||
122 | |||
123 | |||
124 | /** | ||
125 | * Write a 0-terminated formatted string to a buffer, excluding the | ||
126 | * 0-terminator. | ||
127 | * | ||
128 | * Grows the buffer if necessary. | ||
129 | * | ||
130 | * @param buf the buffer to write to | ||
131 | * @param fmt format string | ||
132 | * @param ... format arguments | ||
133 | */ | ||
134 | void | ||
135 | GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, const char *fmt, ...); | ||
136 | |||
137 | |||
138 | /** | ||
139 | * Write a 0-terminated formatted string to a buffer, excluding the | ||
140 | * 0-terminator. | ||
141 | * | ||
142 | * Grows the buffer if necessary. | ||
143 | * | ||
144 | * @param buf the buffer to write to | ||
145 | * @param fmt format string | ||
146 | * @param args format argument list | ||
147 | */ | ||
148 | void | ||
149 | GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf, const char *fmt, va_list | ||
150 | args); | ||
151 | |||
152 | |||
153 | /** | ||
154 | * Clear the buffer and return the string it contained. | ||
155 | * The caller is responsible to eventually #GNUNET_free | ||
156 | * the returned string. | ||
157 | * | ||
158 | * The returned string is always 0-terminated. | ||
159 | * | ||
160 | * @param buf the buffer to reap the string from | ||
161 | * @returns the buffer contained in the string | ||
162 | */ | ||
163 | char * | ||
164 | GNUNET_buffer_reap_str (struct GNUNET_Buffer *buf); | ||
165 | |||
166 | |||
167 | /** | ||
168 | * Free the backing memory of the given buffer. | ||
169 | * Does not free the memory of the buffer control structure, | ||
170 | * which is typically stack-allocated. | ||
171 | */ | ||
172 | void | ||
173 | GNUNET_buffer_clear (struct GNUNET_Buffer *buf); | ||
174 | |||
175 | |||
176 | #endif | ||
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h index 48eb7e490..8e981e91e 100644 --- a/src/include/gnunet_curl_lib.h +++ b/src/include/gnunet_curl_lib.h | |||
@@ -164,7 +164,7 @@ GNUNET_CURL_perform (struct GNUNET_CURL_Context *ctx); | |||
164 | 164 | ||
165 | 165 | ||
166 | /** | 166 | /** |
167 | * Run the main event loop for the Taler interaction. | 167 | * Run the main event loop for the HTTP interaction. |
168 | * | 168 | * |
169 | * @param ctx the library context | 169 | * @param ctx the library context |
170 | * @param rp parses the raw response returned from | 170 | * @param rp parses the raw response returned from |
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h index 5d2b7246a..ef81e9a88 100644 --- a/src/include/gnunet_gns_service.h +++ b/src/include/gnunet_gns_service.h | |||
@@ -147,6 +147,31 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | |||
147 | 147 | ||
148 | 148 | ||
149 | /** | 149 | /** |
150 | * Perform an asynchronous lookup operation on the GNS. | ||
151 | * | ||
152 | * @param handle handle to the GNS service | ||
153 | * @param name the name to look up (in UTF-8 encoding) | ||
154 | * @param zone zone to look in | ||
155 | * @param type the GNS record type to look for | ||
156 | * @param options local options for the lookup | ||
157 | * @param recursion_depth_limit maximum number of zones | ||
158 | * that the lookup may (still) traverse | ||
159 | * @param proc function to call on result | ||
160 | * @param proc_cls closure for @a proc | ||
161 | * @return handle to the queued request | ||
162 | */ | ||
163 | struct GNUNET_GNS_LookupRequest * | ||
164 | GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, | ||
165 | const char *name, | ||
166 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | ||
167 | uint32_t type, | ||
168 | enum GNUNET_GNS_LocalOptions options, | ||
169 | uint16_t recursion_depth_limit, | ||
170 | GNUNET_GNS_LookupResultProcessor proc, | ||
171 | void *proc_cls); | ||
172 | |||
173 | |||
174 | /** | ||
150 | * Cancel pending lookup request | 175 | * Cancel pending lookup request |
151 | * | 176 | * |
152 | * @param lr the lookup request to cancel | 177 | * @param lr the lookup request to cancel |
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 3a49d98b9..797c71380 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -141,6 +141,17 @@ extern "C" { | |||
141 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553 | 141 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553 |
142 | 142 | ||
143 | /** | 143 | /** |
144 | * Record type for reclaim identity attestation | ||
145 | */ | ||
146 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR 65554 | ||
147 | |||
148 | /** | ||
149 | * Record type for reclaim identity references | ||
150 | */ | ||
151 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE 65555 | ||
152 | |||
153 | |||
154 | /** | ||
144 | * Flags that can be set for a record. | 155 | * Flags that can be set for a record. |
145 | */ | 156 | */ |
146 | enum GNUNET_GNSRECORD_Flags | 157 | enum GNUNET_GNSRECORD_Flags |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index cd7cb50de..8091fb367 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -2714,6 +2714,14 @@ extern "C" { | |||
2714 | 2714 | ||
2715 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE 976 | 2715 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE 976 |
2716 | 2716 | ||
2717 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE 977 | ||
2718 | |||
2719 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE 978 | ||
2720 | |||
2721 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979 | ||
2722 | |||
2723 | #define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_STORE 980 | ||
2724 | |||
2717 | /************************************************** | 2725 | /************************************************** |
2718 | * | 2726 | * |
2719 | * ABD MESSAGE TYPES | 2727 | * ABD MESSAGE TYPES |
@@ -3301,6 +3309,9 @@ extern "C" { | |||
3301 | /** | 3309 | /** |
3302 | * Next available: 1500 | 3310 | * Next available: 1500 |
3303 | */ | 3311 | */ |
3312 | #define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_DELETE 1500 | ||
3313 | |||
3314 | #define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT 1501 | ||
3304 | 3315 | ||
3305 | 3316 | ||
3306 | /** | 3317 | /** |
diff --git a/src/include/gnunet_reclaim_attribute_lib.h b/src/include/gnunet_reclaim_attribute_lib.h index 4563a5f67..004f2bd10 100644 --- a/src/include/gnunet_reclaim_attribute_lib.h +++ b/src/include/gnunet_reclaim_attribute_lib.h | |||
@@ -50,6 +50,15 @@ extern "C" { | |||
50 | */ | 50 | */ |
51 | #define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING 1 | 51 | #define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING 1 |
52 | 52 | ||
53 | /** | ||
54 | * No value attestation. | ||
55 | */ | ||
56 | #define GNUNET_RECLAIM_ATTESTATION_TYPE_NONE 10 | ||
57 | |||
58 | /** | ||
59 | * A JSON Web Token attestation. | ||
60 | */ | ||
61 | #define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT 11 | ||
53 | 62 | ||
54 | /** | 63 | /** |
55 | * An attribute. | 64 | * An attribute. |
@@ -67,9 +76,48 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim | |||
67 | uint32_t type; | 76 | uint32_t type; |
68 | 77 | ||
69 | /** | 78 | /** |
79 | * Flags | ||
80 | */ | ||
81 | uint32_t flag; | ||
82 | /** | ||
83 | * The name of the attribute. Note "name" must never be individually | ||
84 | * free'd | ||
85 | */ | ||
86 | const char *name; | ||
87 | |||
88 | /** | ||
89 | * Number of bytes in @e data. | ||
90 | */ | ||
91 | size_t data_size; | ||
92 | |||
93 | /** | ||
94 | * Binary value stored as attribute value. Note: "data" must never | ||
95 | * be individually 'malloc'ed, but instead always points into some | ||
96 | * existing data area. | ||
97 | */ | ||
98 | const void *data; | ||
99 | }; | ||
100 | |||
101 | /** | ||
102 | * An attestation. | ||
103 | */ | ||
104 | struct GNUNET_RECLAIM_ATTESTATION_Claim | ||
105 | { | ||
106 | /** | ||
107 | * ID | ||
108 | */ | ||
109 | uint64_t id; | ||
110 | |||
111 | /** | ||
112 | * Type/Format of Claim | ||
113 | */ | ||
114 | uint32_t type; | ||
115 | |||
116 | /** | ||
70 | * Version | 117 | * Version |
71 | */ | 118 | */ |
72 | uint32_t version; | 119 | uint32_t version; |
120 | |||
73 | /** | 121 | /** |
74 | * The name of the attribute. Note "name" must never be individually | 122 | * The name of the attribute. Note "name" must never be individually |
75 | * free'd | 123 | * free'd |
@@ -89,6 +137,33 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim | |||
89 | const void *data; | 137 | const void *data; |
90 | }; | 138 | }; |
91 | 139 | ||
140 | /** | ||
141 | * A reference to an Attestatiom. | ||
142 | */ | ||
143 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE | ||
144 | { | ||
145 | /** | ||
146 | * ID | ||
147 | */ | ||
148 | uint64_t id; | ||
149 | |||
150 | /** | ||
151 | * Referenced ID of Attestation | ||
152 | */ | ||
153 | uint64_t id_attest; | ||
154 | |||
155 | /** | ||
156 | * The name of the attribute/attestation reference value. Note "name" must never be individually | ||
157 | * free'd | ||
158 | */ | ||
159 | const char *name; | ||
160 | |||
161 | /** | ||
162 | * The name of the attribute/attestation reference value. Note "name" must never be individually | ||
163 | * free'd | ||
164 | */ | ||
165 | const char *reference_value; | ||
166 | }; | ||
92 | 167 | ||
93 | /** | 168 | /** |
94 | * A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures. | 169 | * A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures. |
@@ -123,6 +198,20 @@ struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry | |||
123 | * The attribute claim | 198 | * The attribute claim |
124 | */ | 199 | */ |
125 | struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim; | 200 | struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim; |
201 | /** | ||
202 | * The attestation claim | ||
203 | */ | ||
204 | struct GNUNET_RECLAIM_ATTESTATION_Claim *attest; | ||
205 | |||
206 | /** | ||
207 | * The reference | ||
208 | */ | ||
209 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference; | ||
210 | }; | ||
211 | |||
212 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntryType | ||
213 | { | ||
214 | uint32_t type; | ||
126 | }; | 215 | }; |
127 | 216 | ||
128 | 217 | ||
@@ -203,6 +292,14 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize ( | |||
203 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * | 292 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * |
204 | GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char *data, size_t data_size); | 293 | GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char *data, size_t data_size); |
205 | 294 | ||
295 | /** | ||
296 | * Count attestations in claim list | ||
297 | * | ||
298 | * @param attrs list | ||
299 | */ | ||
300 | int | ||
301 | GNUNET_RECLAIM_ATTRIBUTE_list_count_attest ( | ||
302 | const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs); | ||
206 | 303 | ||
207 | /** | 304 | /** |
208 | * Get required size for serialization buffer | 305 | * Get required size for serialization buffer |
@@ -299,6 +396,154 @@ GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type, | |||
299 | const char * | 396 | const char * |
300 | GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type); | 397 | GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type); |
301 | 398 | ||
399 | /** | ||
400 | * Get required size for serialization buffer | ||
401 | * FIXME: | ||
402 | * 1. The naming convention is violated here. | ||
403 | * It should GNUNET_RECLAIM_ATTRIBUTE_<lowercase from here>. | ||
404 | * It might make sense to refactor attestations into a separate folder. | ||
405 | * 2. The struct should be called GNUNET_RECLAIM_ATTESTATION_Data or | ||
406 | * GNUNET_RECLAIM_ATTRIBUTE_Attestation depending on location in source. | ||
407 | * | ||
408 | * @param attr the attestation to serialize | ||
409 | * @return the required buffer size | ||
410 | */ | ||
411 | size_t | ||
412 | GNUNET_RECLAIM_ATTESTATION_serialize_get_size ( | ||
413 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr); | ||
414 | |||
415 | |||
416 | /** | ||
417 | * Serialize an attestation | ||
418 | * | ||
419 | * @param attr the attestation to serialize | ||
420 | * @param result the serialized attestation | ||
421 | * @return length of serialized data | ||
422 | */ | ||
423 | size_t | ||
424 | GNUNET_RECLAIM_ATTESTATION_serialize ( | ||
425 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, | ||
426 | char *result); | ||
427 | |||
428 | |||
429 | /** | ||
430 | * Deserialize an attestation | ||
431 | * | ||
432 | * @param data the serialized attestation | ||
433 | * @param data_size the length of the serialized data | ||
434 | * | ||
435 | * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller | ||
436 | */ | ||
437 | struct GNUNET_RECLAIM_ATTESTATION_Claim * | ||
438 | GNUNET_RECLAIM_ATTESTATION_deserialize (const char *data, size_t data_size); | ||
439 | |||
440 | |||
441 | /** | ||
442 | * Create a new attestation. | ||
443 | * | ||
444 | * @param attr_name the attestation name | ||
445 | * @param type the attestation type | ||
446 | * @param data the attestation value | ||
447 | * @param data_size the attestation value size | ||
448 | * @return the new attestation | ||
449 | */ | ||
450 | struct GNUNET_RECLAIM_ATTESTATION_Claim * | ||
451 | GNUNET_RECLAIM_ATTESTATION_claim_new (const char *attr_name, | ||
452 | uint32_t type, | ||
453 | const void *data, | ||
454 | size_t data_size); | ||
455 | |||
456 | /** | ||
457 | * Convert the 'claim' of an attestation to a string | ||
458 | * | ||
459 | * @param type the type of attestation | ||
460 | * @param data claim in binary encoding | ||
461 | * @param data_size number of bytes in @a data | ||
462 | * @return NULL on error, otherwise human-readable representation of the claim | ||
463 | */ | ||
464 | char * | ||
465 | GNUNET_RECLAIM_ATTESTATION_value_to_string (uint32_t type, | ||
466 | const void *data, | ||
467 | size_t data_size); | ||
468 | |||
469 | /** | ||
470 | * Convert human-readable version of a 'claim' of an attestation to the binary | ||
471 | * representation | ||
472 | * | ||
473 | * @param type type of the claim | ||
474 | * @param s human-readable string | ||
475 | * @param data set to value in binary encoding (will be allocated) | ||
476 | * @param data_size set to number of bytes in @a data | ||
477 | * @return #GNUNET_OK on success | ||
478 | */ | ||
479 | int | ||
480 | GNUNET_RECLAIM_ATTESTATION_string_to_value (uint32_t type, | ||
481 | const char *s, | ||
482 | void **data, | ||
483 | size_t *data_size); | ||
484 | |||
485 | /** | ||
486 | * Convert an attestation type number to the corresponding attestation type string | ||
487 | * | ||
488 | * @param type number of a type | ||
489 | * @return corresponding typestring, NULL on error | ||
490 | */ | ||
491 | const char * | ||
492 | GNUNET_RECLAIM_ATTESTATION_number_to_typename (uint32_t type); | ||
493 | |||
494 | /** | ||
495 | * Convert an attestation type name to the corresponding number | ||
496 | * | ||
497 | * @param typename name to convert | ||
498 | * @return corresponding number, UINT32_MAX on error | ||
499 | */ | ||
500 | uint32_t | ||
501 | GNUNET_RECLAIM_ATTESTATION_typename_to_number (const char *typename); | ||
502 | |||
503 | /** | ||
504 | * Create a new attestation reference. | ||
505 | * | ||
506 | * @param attr_name the referenced claim name | ||
507 | * @param ref_value the claim name in the attestation | ||
508 | * @return the new reference | ||
509 | */ | ||
510 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE * | ||
511 | GNUNET_RECLAIM_ATTESTATION_reference_new (const char *attr_name, | ||
512 | const char *ref_value); | ||
513 | |||
514 | |||
515 | /** | ||
516 | * Get required size for serialization buffer | ||
517 | * | ||
518 | * @param attr the reference to serialize | ||
519 | * @return the required buffer size | ||
520 | */ | ||
521 | size_t | ||
522 | GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size ( | ||
523 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr); | ||
524 | |||
525 | /** | ||
526 | * Serialize a reference | ||
527 | * | ||
528 | * @param attr the reference to serialize | ||
529 | * @param result the serialized reference | ||
530 | * @return length of serialized data | ||
531 | */ | ||
532 | size_t | ||
533 | GNUNET_RECLAIM_ATTESTATION_REF_serialize ( | ||
534 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr, | ||
535 | char *result); | ||
536 | |||
537 | /** | ||
538 | * Deserialize a reference | ||
539 | * | ||
540 | * @param data the serialized reference | ||
541 | * @param data_size the length of the serialized data | ||
542 | * | ||
543 | * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller | ||
544 | */ | ||
545 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE * | ||
546 | GNUNET_RECLAIM_ATTESTATION_REF_deserialize (const char *data, size_t data_size); | ||
302 | 547 | ||
303 | #if 0 /* keep Emacsens' auto-indent happy */ | 548 | #if 0 /* keep Emacsens' auto-indent happy */ |
304 | { | 549 | { |
diff --git a/src/include/gnunet_reclaim_attribute_plugin.h b/src/include/gnunet_reclaim_attribute_plugin.h index 26a4bb4f2..e61cca5b2 100644 --- a/src/include/gnunet_reclaim_attribute_plugin.h +++ b/src/include/gnunet_reclaim_attribute_plugin.h | |||
@@ -134,6 +134,33 @@ struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions | |||
134 | * Number to typename. | 134 | * Number to typename. |
135 | */ | 135 | */ |
136 | GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction number_to_typename; | 136 | GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction number_to_typename; |
137 | |||
138 | /** | ||
139 | * FIXME: It is odd that attestation functions are withing the attribute | ||
140 | * plugin. An attribute type may be backed by an attestation, but not | ||
141 | * necessarily. | ||
142 | * Maybe it would make more sense to refactor this into an attestation | ||
143 | * plugin? | ||
144 | * | ||
145 | * Attestation Conversion to string. | ||
146 | */ | ||
147 | GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction value_to_string_attest; | ||
148 | |||
149 | /** | ||
150 | * Attestation Conversion to binary. | ||
151 | */ | ||
152 | GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction string_to_value_attest; | ||
153 | |||
154 | /** | ||
155 | * Attestation Typename to number. | ||
156 | */ | ||
157 | GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction typename_to_number_attest; | ||
158 | |||
159 | /** | ||
160 | * Attestation Number to typename. | ||
161 | */ | ||
162 | GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction number_to_typename_attest; | ||
163 | |||
137 | }; | 164 | }; |
138 | 165 | ||
139 | 166 | ||
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h index 237d791d9..214cdba69 100644 --- a/src/include/gnunet_reclaim_service.h +++ b/src/include/gnunet_reclaim_service.h | |||
@@ -117,7 +117,9 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls, | |||
117 | */ | 117 | */ |
118 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( | 118 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( |
119 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 119 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
120 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr); | 120 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
121 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, | ||
122 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference); | ||
121 | 123 | ||
122 | 124 | ||
123 | /** | 125 | /** |
@@ -152,6 +154,28 @@ GNUNET_RECLAIM_attribute_store ( | |||
152 | 154 | ||
153 | 155 | ||
154 | /** | 156 | /** |
157 | * Store an attestation. If the attestation is already present, | ||
158 | * it is replaced with the new attestation. | ||
159 | * | ||
160 | * @param h handle to the re:claimID service | ||
161 | * @param pkey private key of the identity | ||
162 | * @param attr the attestation value | ||
163 | * @param exp_interval the relative expiration interval for the attestation | ||
164 | * @param cont continuation to call when done | ||
165 | * @param cont_cls closure for @a cont | ||
166 | * @return handle to abort the request | ||
167 | */ | ||
168 | struct GNUNET_RECLAIM_Operation * | ||
169 | GNUNET_RECLAIM_attestation_store ( | ||
170 | struct GNUNET_RECLAIM_Handle *h, | ||
171 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | ||
172 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, | ||
173 | const struct GNUNET_TIME_Relative *exp_interval, | ||
174 | GNUNET_RECLAIM_ContinuationWithStatus cont, | ||
175 | void *cont_cls); | ||
176 | |||
177 | |||
178 | /** | ||
155 | * Delete an attribute. Tickets used to share this attribute are updated | 179 | * Delete an attribute. Tickets used to share this attribute are updated |
156 | * accordingly. | 180 | * accordingly. |
157 | * | 181 | * |
@@ -169,8 +193,44 @@ GNUNET_RECLAIM_attribute_delete ( | |||
169 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 193 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
170 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); | 194 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); |
171 | 195 | ||
196 | /** | ||
197 | * Delete an attestation. Tickets used to share this attestation are updated | ||
198 | * accordingly. | ||
199 | * | ||
200 | * @param h handle to the re:claimID service | ||
201 | * @param pkey Private key of the identity to add an attribute to | ||
202 | * @param attr The attestation | ||
203 | * @param cont Continuation to call when done | ||
204 | * @param cont_cls Closure for @a cont | ||
205 | * @return handle Used to to abort the request | ||
206 | */ | ||
207 | struct GNUNET_RECLAIM_Operation * | ||
208 | GNUNET_RECLAIM_attestation_delete ( | ||
209 | struct GNUNET_RECLAIM_Handle *h, | ||
210 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | ||
211 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, | ||
212 | GNUNET_RECLAIM_ContinuationWithStatus cont, | ||
213 | void *cont_cls); | ||
172 | 214 | ||
173 | /** | 215 | /** |
216 | * Delete an attestation reference. Tickets used to share this reference are updated | ||
217 | * accordingly. | ||
218 | * | ||
219 | * @param h handle to the re:claimID service | ||
220 | * @param pkey Private key of the identity to delete the reference from | ||
221 | * @param attr The reference | ||
222 | * @param cont Continuation to call when done | ||
223 | * @param cont_cls Closure for @a cont | ||
224 | * @return handle Used to to abort the request | ||
225 | */ | ||
226 | struct GNUNET_RECLAIM_Operation * | ||
227 | GNUNET_RECLAIM_attestation_reference_delete ( | ||
228 | struct GNUNET_RECLAIM_Handle *h, | ||
229 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | ||
230 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr, | ||
231 | GNUNET_RECLAIM_ContinuationWithStatus cont, | ||
232 | void *cont_cls); | ||
233 | /** | ||
174 | * List all attributes for a local identity. | 234 | * List all attributes for a local identity. |
175 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` | 235 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` |
176 | * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and | 236 | * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and |
@@ -202,6 +262,26 @@ GNUNET_RECLAIM_get_attributes_start ( | |||
202 | GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, | 262 | GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, |
203 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); | 263 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); |
204 | 264 | ||
265 | /** | ||
266 | * Store an attestation reference. If the reference is already present, | ||
267 | * it is replaced with the new reference. | ||
268 | * | ||
269 | * @param h handle to the re:claimID service | ||
270 | * @param pkey private key of the identity | ||
271 | * @param attr the reference value | ||
272 | * @param exp_interval the relative expiration interval for the reference | ||
273 | * @param cont continuation to call when done | ||
274 | * @param cont_cls closure for @a cont | ||
275 | * @return handle to abort the request | ||
276 | */ | ||
277 | struct GNUNET_RECLAIM_Operation * | ||
278 | GNUNET_RECLAIM_attestation_reference_store ( | ||
279 | struct GNUNET_RECLAIM_Handle *h, | ||
280 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | ||
281 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr, | ||
282 | const struct GNUNET_TIME_Relative *exp_interval, | ||
283 | GNUNET_RECLAIM_ContinuationWithStatus cont, | ||
284 | void *cont_cls); | ||
205 | 285 | ||
206 | /** | 286 | /** |
207 | * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start | 287 | * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start |
diff --git a/src/include/gnunet_util_taler_wallet_lib.h b/src/include/gnunet_util_taler_wallet_lib.h deleted file mode 100644 index a036824f6..000000000 --- a/src/include/gnunet_util_taler_wallet_lib.h +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2009, 2015 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your 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 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author Christian Grothoff | ||
23 | * | ||
24 | * @file | ||
25 | * Convenience header including all headers of subsystems in | ||
26 | * gnunet_util_taler_wallet library. Note that (due to the structure of the | ||
27 | * original headers), not all symbols declared by the included headers are | ||
28 | * actually included in the gnunet_util_taler_wallet library! The library | ||
29 | * excludes anything relating to the GNUnet installation location, scheduler, | ||
30 | * networking or OS-specific logic that would not apply to Apps/Browser | ||
31 | * extensions. | ||
32 | */ | ||
33 | |||
34 | #ifndef GNUNET_UTIL_TALER_WALLET_LIB_H | ||
35 | #define GNUNET_UTIL_TALER_WALLET_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 | #include "gnunet_crypto_lib.h" | ||
46 | #include "gnunet_container_lib.h" | ||
47 | #include "gnunet_strings_lib.h" | ||
48 | |||
49 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
50 | { | ||
51 | #endif | ||
52 | #ifdef __cplusplus | ||
53 | } | ||
54 | #endif | ||
55 | |||
56 | #endif | ||