aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_reclaim_plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_reclaim_plugin.h')
-rw-r--r--src/include/gnunet_reclaim_plugin.h197
1 files changed, 171 insertions, 26 deletions
diff --git a/src/include/gnunet_reclaim_plugin.h b/src/include/gnunet_reclaim_plugin.h
index 7ee9e730f..2ba8fc8a0 100644
--- a/src/include/gnunet_reclaim_plugin.h
+++ b/src/include/gnunet_reclaim_plugin.h
@@ -27,8 +27,8 @@
27 * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims 27 * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims
28 * @{ 28 * @{
29 */ 29 */
30#ifndef GNUNET_RECLAIM_AttributePLUGIN_H 30#ifndef GNUNET_RECLAIM_PLUGIN_H
31#define GNUNET_RECLAIM_AttributePLUGIN_H 31#define GNUNET_RECLAIM_PLUGIN_H
32 32
33#include "gnunet_util_lib.h" 33#include "gnunet_util_lib.h"
34#include "gnunet_reclaim_lib.h" 34#include "gnunet_reclaim_lib.h"
@@ -113,7 +113,7 @@ typedef const char *(*GNUNET_RECLAIM_AttributeNumberToTypenameFunction) (
113 * @param data_size number of bytes in @a data 113 * @param data_size number of bytes in @a data
114 * @return NULL on error, otherwise human-readable representation of the value 114 * @return NULL on error, otherwise human-readable representation of the value
115 */ 115 */
116typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) ( 116typedef char *(*GNUNET_RECLAIM_CredentialValueToStringFunction) (
117 void *cls, 117 void *cls,
118 uint32_t type, 118 uint32_t type,
119 const void *data, 119 const void *data,
@@ -132,7 +132,7 @@ typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) (
132 * @param data_size set to number of bytes in @a data 132 * @param data_size set to number of bytes in @a data
133 * @return #GNUNET_OK on success 133 * @return #GNUNET_OK on success
134 */ 134 */
135typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) ( 135typedef int (*GNUNET_RECLAIM_CredentialStringToValueFunction) (
136 void *cls, 136 void *cls,
137 uint32_t type, 137 uint32_t type,
138 const char *s, 138 const char *s,
@@ -148,7 +148,7 @@ typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) (
148 * @param typename name to convert 148 * @param typename name to convert
149 * @return corresponding number, UINT32_MAX on error 149 * @return corresponding number, UINT32_MAX on error
150 */ 150 */
151typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) ( 151typedef uint32_t (*GNUNET_RECLAIM_CredentialTypenameToNumberFunction) (
152 void *cls, 152 void *cls,
153 const char *typename); 153 const char *typename);
154 154
@@ -161,47 +161,151 @@ typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) (
161 * @param type number of a type to convert 161 * @param type number of a type to convert
162 * @return corresponding typestring, NULL on error 162 * @return corresponding typestring, NULL on error
163 */ 163 */
164typedef const char *(*GNUNET_RECLAIM_AttestationNumberToTypenameFunction) ( 164typedef const char *(*GNUNET_RECLAIM_CredentialNumberToTypenameFunction) (
165 void *cls, 165 void *cls,
166 uint32_t type); 166 uint32_t type);
167 167
168/** 168/**
169 * Function called to extract attributes from an attestation 169 * Function called to extract attributes from a credential
170 * 170 *
171 * @param cls closure 171 * @param cls closure
172 * @param attest the attestation object 172 * @param cred the credential object
173 * @return an attribute list 173 * @return an attribute list
174 */ 174 */
175typedef struct 175typedef struct
176 GNUNET_RECLAIM_AttributeList *(* 176 GNUNET_RECLAIM_AttributeList *(*
177GNUNET_RECLAIM_AttestationGetAttributesFunction) ( 177GNUNET_RECLAIM_CredentialGetAttributesFunction) (
178 void *cls, 178 void *cls,
179 const struct GNUNET_RECLAIM_Attestation *attest); 179 const struct GNUNET_RECLAIM_Credential *cred);
180 180
181/** 181/**
182 * Function called to get the issuer of the attestation (as string) 182 * Function called to get the issuer of the credential (as string)
183 * 183 *
184 * @param cls closure 184 * @param cls closure
185 * @param attest the attestation object 185 * @param cred the credential object
186 * @return corresponding issuer string 186 * @return corresponding issuer string
187 */ 187 */
188typedef char *(*GNUNET_RECLAIM_AttestationGetIssuerFunction) ( 188typedef char *(*GNUNET_RECLAIM_CredentialGetIssuerFunction) (
189 void *cls, 189 void *cls,
190 const struct GNUNET_RECLAIM_Attestation *attest); 190 const struct GNUNET_RECLAIM_Credential *cred);
191 191
192/** 192/**
193 * Function called to get the expiration of the attestation 193 * Function called to get the expiration of the credential
194 * 194 *
195 * @param cls closure 195 * @param cls closure
196 * @param attest the attestation object 196 * @param cred the credential object
197 * @param where to write the value 197 * @param where to write the value
198 * @return GNUNET_OK if successful 198 * @return GNUNET_OK if successful
199 */ 199 */
200typedef int (*GNUNET_RECLAIM_AttestationGetExpirationFunction) ( 200typedef int (*GNUNET_RECLAIM_CredentialGetExpirationFunction) (
201 void *cls, 201 void *cls,
202 const struct GNUNET_RECLAIM_Attestation *attest, 202 const struct GNUNET_RECLAIM_Credential *cred,
203 struct GNUNET_TIME_Absolute *expiration); 203 struct GNUNET_TIME_Absolute *expiration);
204 204
205/**
206 * Function called to convert the binary value @a data of an attribute of
207 * type @a type to a human-readable string.
208 *
209 * @param cls closure
210 * @param type type of the attribute
211 * @param data value in binary encoding
212 * @param data_size number of bytes in @a data
213 * @return NULL on error, otherwise human-readable representation of the value
214 */
215typedef char *(*GNUNET_RECLAIM_PresentationValueToStringFunction) (
216 void *cls,
217 uint32_t type,
218 const void *data,
219 size_t data_size);
220
221
222/**
223 * Function called to convert human-readable version of the value @a s
224 * of an attribute of type @a type to the respective binary
225 * representation.
226 *
227 * @param cls closure
228 * @param type type of the attribute
229 * @param s human-readable string
230 * @param data set to value in binary encoding (will be allocated)
231 * @param data_size set to number of bytes in @a data
232 * @return #GNUNET_OK on success
233 */
234typedef int (*GNUNET_RECLAIM_PresentationStringToValueFunction) (
235 void *cls,
236 uint32_t type,
237 const char *s,
238 void **data,
239 size_t *data_size);
240
241
242/**
243 * Function called to convert a type name to the
244 * corresponding number.
245 *
246 * @param cls closure
247 * @param typename name to convert
248 * @return corresponding number, UINT32_MAX on error
249 */
250typedef uint32_t (*GNUNET_RECLAIM_PresentationTypenameToNumberFunction) (
251 void *cls,
252 const char *typename);
253
254
255/**
256 * Function called to convert a type number (i.e. 1) to the
257 * corresponding type string
258 *
259 * @param cls closure
260 * @param type number of a type to convert
261 * @return corresponding typestring, NULL on error
262 */
263typedef const char *(*GNUNET_RECLAIM_PresentationNumberToTypenameFunction) (
264 void *cls,
265 uint32_t type);
266
267/**
268 * Function called to extract attributes from a credential
269 *
270 * @param cls closure
271 * @param cred the credential object
272 * @return an attribute list
273 */
274typedef struct
275 GNUNET_RECLAIM_AttributeList *(*
276GNUNET_RECLAIM_PresentationGetAttributesFunction) (
277 void *cls,
278 const struct GNUNET_RECLAIM_Presentation *cred);
279
280/**
281 * Function called to get the issuer of the credential (as string)
282 *
283 * @param cls closure
284 * @param cred the credential object
285 * @return corresponding issuer string
286 */
287typedef char *(*GNUNET_RECLAIM_PresentationGetIssuerFunction) (
288 void *cls,
289 const struct GNUNET_RECLAIM_Presentation *cred);
290
291/**
292 * Function called to get the expiration of the credential
293 *
294 * @param cls closure
295 * @param cred the credential object
296 * @param where to write the value
297 * @return GNUNET_OK if successful
298 */
299typedef int (*GNUNET_RECLAIM_PresentationGetExpirationFunction) (
300 void *cls,
301 const struct GNUNET_RECLAIM_Presentation *cred,
302 struct GNUNET_TIME_Absolute *expiration);
303
304typedef int (*GNUNET_RECLAIM_CredentialToPresentation) (
305 void *cls,
306 const struct GNUNET_RECLAIM_Credential *cred,
307 const struct GNUNET_RECLAIM_AttributeList *attrs,
308 struct GNUNET_RECLAIM_Presentation **presentation);
205 309
206/** 310/**
207 * Each plugin is required to return a pointer to a struct of this 311 * Each plugin is required to return a pointer to a struct of this
@@ -240,7 +344,7 @@ struct GNUNET_RECLAIM_AttributePluginFunctions
240 * Each plugin is required to return a pointer to a struct of this 344 * Each plugin is required to return a pointer to a struct of this
241 * type as the return value from its entry point. 345 * type as the return value from its entry point.
242 */ 346 */
243struct GNUNET_RECLAIM_AttestationPluginFunctions 347struct GNUNET_RECLAIM_CredentialPluginFunctions
244{ 348{
245 /** 349 /**
246 * Closure for all of the callbacks. 350 * Closure for all of the callbacks.
@@ -250,37 +354,78 @@ struct GNUNET_RECLAIM_AttestationPluginFunctions
250 /** 354 /**
251 * Conversion to string. 355 * Conversion to string.
252 */ 356 */
253 GNUNET_RECLAIM_AttestationValueToStringFunction value_to_string; 357 GNUNET_RECLAIM_CredentialValueToStringFunction value_to_string;
358
359 /**
360 * Conversion to binary.
361 */
362 GNUNET_RECLAIM_CredentialStringToValueFunction string_to_value;
363
364 /**
365 * Typename to number.
366 */
367 GNUNET_RECLAIM_CredentialTypenameToNumberFunction typename_to_number;
368
369 /**
370 * Number to typename.
371 */
372 GNUNET_RECLAIM_CredentialNumberToTypenameFunction number_to_typename;
373
374 /**
375 * Attesation attributes.
376 */
377 GNUNET_RECLAIM_CredentialGetAttributesFunction get_attributes;
378
379 /**
380 * Attesation issuer.
381 */
382 GNUNET_RECLAIM_CredentialGetIssuerFunction get_issuer;
383
384 /**
385 * Expiration.
386 */
387 GNUNET_RECLAIM_CredentialGetExpirationFunction get_expiration;
388
389 /**
390 * Conversion to string.
391 */
392 GNUNET_RECLAIM_PresentationValueToStringFunction value_to_string_p;
254 393
255 /** 394 /**
256 * Conversion to binary. 395 * Conversion to binary.
257 */ 396 */
258 GNUNET_RECLAIM_AttestationStringToValueFunction string_to_value; 397 GNUNET_RECLAIM_PresentationStringToValueFunction string_to_value_p;
259 398
260 /** 399 /**
261 * Typename to number. 400 * Typename to number.
262 */ 401 */
263 GNUNET_RECLAIM_AttestationTypenameToNumberFunction typename_to_number; 402 GNUNET_RECLAIM_PresentationTypenameToNumberFunction typename_to_number_p;
264 403
265 /** 404 /**
266 * Number to typename. 405 * Number to typename.
267 */ 406 */
268 GNUNET_RECLAIM_AttestationNumberToTypenameFunction number_to_typename; 407 GNUNET_RECLAIM_PresentationNumberToTypenameFunction number_to_typename_p;
269 408
270 /** 409 /**
271 * Attesation attributes. 410 * Attesation attributes.
272 */ 411 */
273 GNUNET_RECLAIM_AttestationGetAttributesFunction get_attributes; 412 GNUNET_RECLAIM_PresentationGetAttributesFunction get_attributes_p;
274 413
275 /** 414 /**
276 * Attesation issuer. 415 * Attesation issuer.
277 */ 416 */
278 GNUNET_RECLAIM_AttestationGetIssuerFunction get_issuer; 417 GNUNET_RECLAIM_PresentationGetIssuerFunction get_issuer_p;
279 418
280 /** 419 /**
281 * Expiration. 420 * Expiration.
282 */ 421 */
283 GNUNET_RECLAIM_AttestationGetExpirationFunction get_expiration; 422 GNUNET_RECLAIM_PresentationGetExpirationFunction get_expiration_p;
423
424 /**
425 * Get presentation
426 */
427 GNUNET_RECLAIM_CredentialToPresentation create_presentation;
428
284}; 429};
285 430
286 431