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