diff options
Diffstat (limited to 'src/include/gnunet_reclaim_service.h')
-rw-r--r-- | src/include/gnunet_reclaim_service.h | 85 |
1 files changed, 64 insertions, 21 deletions
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h index 38e1c8735..a8ab8776e 100644 --- a/src/include/gnunet_reclaim_service.h +++ b/src/include/gnunet_reclaim_service.h | |||
@@ -19,13 +19,16 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @addtogroup reclaim_suite RECLAIM services and libraries | ||
23 | * @{ | ||
24 | * | ||
22 | * @author Martin Schanzenbach | 25 | * @author Martin Schanzenbach |
23 | * | 26 | * |
24 | * @file | 27 | * @file |
25 | * reclaim service; implements identity and personal data sharing | 28 | * reclaim service; implements identity and personal data sharing |
26 | * for GNUnet | 29 | * for GNUnet |
27 | * | 30 | * |
28 | * @defgroup reclaim service | 31 | * @defgroup reclaim Reclaim service |
29 | * @{ | 32 | * @{ |
30 | */ | 33 | */ |
31 | #ifndef GNUNET_RECLAIM_SERVICE_H | 34 | #ifndef GNUNET_RECLAIM_SERVICE_H |
@@ -38,6 +41,7 @@ extern "C" { | |||
38 | #endif | 41 | #endif |
39 | #endif | 42 | #endif |
40 | 43 | ||
44 | |||
41 | #include "gnunet_identity_service.h" | 45 | #include "gnunet_identity_service.h" |
42 | #include "gnunet_reclaim_lib.h" | 46 | #include "gnunet_reclaim_lib.h" |
43 | #include "gnunet_util_lib.h" | 47 | #include "gnunet_util_lib.h" |
@@ -70,12 +74,12 @@ struct GNUNET_RECLAIM_Ticket | |||
70 | /** | 74 | /** |
71 | * The ticket issuer (= the user) | 75 | * The ticket issuer (= the user) |
72 | */ | 76 | */ |
73 | struct GNUNET_IDENTITY_PublicKey identity; | 77 | struct GNUNET_CRYPTO_PublicKey identity; |
74 | 78 | ||
75 | /** | 79 | /** |
76 | * The ticket audience (= relying party) | 80 | * The ticket audience (= relying party) |
77 | */ | 81 | */ |
78 | struct GNUNET_IDENTITY_PublicKey audience; | 82 | struct GNUNET_CRYPTO_PublicKey audience; |
79 | 83 | ||
80 | /** | 84 | /** |
81 | * The ticket random identifier | 85 | * The ticket random identifier |
@@ -130,7 +134,7 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls, | |||
130 | * @param attr The attribute | 134 | * @param attr The attribute |
131 | */ | 135 | */ |
132 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( | 136 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( |
133 | void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, | 137 | void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, |
134 | const struct GNUNET_RECLAIM_Attribute *attr); | 138 | const struct GNUNET_RECLAIM_Attribute *attr); |
135 | 139 | ||
136 | /** | 140 | /** |
@@ -142,7 +146,7 @@ typedef void (*GNUNET_RECLAIM_AttributeResult) ( | |||
142 | * @param presentation The presentation for the credential (may be NULL) | 146 | * @param presentation The presentation for the credential (may be NULL) |
143 | */ | 147 | */ |
144 | typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( | 148 | typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( |
145 | void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, | 149 | void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, |
146 | const struct GNUNET_RECLAIM_Attribute *attr, | 150 | const struct GNUNET_RECLAIM_Attribute *attr, |
147 | const struct GNUNET_RECLAIM_Presentation *presentation); | 151 | const struct GNUNET_RECLAIM_Presentation *presentation); |
148 | 152 | ||
@@ -156,7 +160,7 @@ typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( | |||
156 | * @param attributes the parsed attributes | 160 | * @param attributes the parsed attributes |
157 | */ | 161 | */ |
158 | typedef void (*GNUNET_RECLAIM_CredentialResult) ( | 162 | typedef void (*GNUNET_RECLAIM_CredentialResult) ( |
159 | void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, | 163 | void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, |
160 | const struct GNUNET_RECLAIM_Credential *credential); | 164 | const struct GNUNET_RECLAIM_Credential *credential); |
161 | 165 | ||
162 | 166 | ||
@@ -185,7 +189,7 @@ GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | |||
185 | struct GNUNET_RECLAIM_Operation * | 189 | struct GNUNET_RECLAIM_Operation * |
186 | GNUNET_RECLAIM_attribute_store ( | 190 | GNUNET_RECLAIM_attribute_store ( |
187 | struct GNUNET_RECLAIM_Handle *h, | 191 | struct GNUNET_RECLAIM_Handle *h, |
188 | const struct GNUNET_IDENTITY_PrivateKey *pkey, | 192 | const struct GNUNET_CRYPTO_PrivateKey *pkey, |
189 | const struct GNUNET_RECLAIM_Attribute *attr, | 193 | const struct GNUNET_RECLAIM_Attribute *attr, |
190 | const struct GNUNET_TIME_Relative *exp_interval, | 194 | const struct GNUNET_TIME_Relative *exp_interval, |
191 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); | 195 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); |
@@ -197,7 +201,7 @@ GNUNET_RECLAIM_attribute_store ( | |||
197 | * | 201 | * |
198 | * @param h handle to the re:claimID service | 202 | * @param h handle to the re:claimID service |
199 | * @param pkey private key of the identity | 203 | * @param pkey private key of the identity |
200 | * @param attr the credential value | 204 | * @param credential the credential value |
201 | * @param exp_interval the relative expiration interval for the credential | 205 | * @param exp_interval the relative expiration interval for the credential |
202 | * @param cont continuation to call when done | 206 | * @param cont continuation to call when done |
203 | * @param cont_cls closure for @a cont | 207 | * @param cont_cls closure for @a cont |
@@ -206,7 +210,7 @@ GNUNET_RECLAIM_attribute_store ( | |||
206 | struct GNUNET_RECLAIM_Operation * | 210 | struct GNUNET_RECLAIM_Operation * |
207 | GNUNET_RECLAIM_credential_store ( | 211 | GNUNET_RECLAIM_credential_store ( |
208 | struct GNUNET_RECLAIM_Handle *h, | 212 | struct GNUNET_RECLAIM_Handle *h, |
209 | const struct GNUNET_IDENTITY_PrivateKey *pkey, | 213 | const struct GNUNET_CRYPTO_PrivateKey *pkey, |
210 | const struct GNUNET_RECLAIM_Credential *credential, | 214 | const struct GNUNET_RECLAIM_Credential *credential, |
211 | const struct GNUNET_TIME_Relative *exp_interval, | 215 | const struct GNUNET_TIME_Relative *exp_interval, |
212 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 216 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
@@ -227,12 +231,12 @@ GNUNET_RECLAIM_credential_store ( | |||
227 | struct GNUNET_RECLAIM_Operation * | 231 | struct GNUNET_RECLAIM_Operation * |
228 | GNUNET_RECLAIM_attribute_delete ( | 232 | GNUNET_RECLAIM_attribute_delete ( |
229 | struct GNUNET_RECLAIM_Handle *h, | 233 | struct GNUNET_RECLAIM_Handle *h, |
230 | const struct GNUNET_IDENTITY_PrivateKey *pkey, | 234 | const struct GNUNET_CRYPTO_PrivateKey *pkey, |
231 | const struct GNUNET_RECLAIM_Attribute *attr, | 235 | const struct GNUNET_RECLAIM_Attribute *attr, |
232 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); | 236 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); |
233 | 237 | ||
234 | /** | 238 | /** |
235 | * Delete a credential. Tickets used to share use a presentation of this | 239 | * Delete a credential. Tickets used to share a presentation of this |
236 | * credential are updated accordingly. | 240 | * credential are updated accordingly. |
237 | * | 241 | * |
238 | * @param h handle to the re:claimID service | 242 | * @param h handle to the re:claimID service |
@@ -245,7 +249,7 @@ GNUNET_RECLAIM_attribute_delete ( | |||
245 | struct GNUNET_RECLAIM_Operation * | 249 | struct GNUNET_RECLAIM_Operation * |
246 | GNUNET_RECLAIM_credential_delete ( | 250 | GNUNET_RECLAIM_credential_delete ( |
247 | struct GNUNET_RECLAIM_Handle *h, | 251 | struct GNUNET_RECLAIM_Handle *h, |
248 | const struct GNUNET_IDENTITY_PrivateKey *pkey, | 252 | const struct GNUNET_CRYPTO_PrivateKey *pkey, |
249 | const struct GNUNET_RECLAIM_Credential *cred, | 253 | const struct GNUNET_RECLAIM_Credential *cred, |
250 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 254 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
251 | void *cont_cls); | 255 | void *cont_cls); |
@@ -277,7 +281,7 @@ GNUNET_RECLAIM_credential_delete ( | |||
277 | struct GNUNET_RECLAIM_AttributeIterator * | 281 | struct GNUNET_RECLAIM_AttributeIterator * |
278 | GNUNET_RECLAIM_get_attributes_start ( | 282 | GNUNET_RECLAIM_get_attributes_start ( |
279 | struct GNUNET_RECLAIM_Handle *h, | 283 | struct GNUNET_RECLAIM_Handle *h, |
280 | const struct GNUNET_IDENTITY_PrivateKey *identity, | 284 | const struct GNUNET_CRYPTO_PrivateKey *identity, |
281 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, | 285 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, |
282 | GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, | 286 | GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, |
283 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); | 287 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); |
@@ -333,7 +337,7 @@ GNUNET_RECLAIM_get_attributes_stop ( | |||
333 | struct GNUNET_RECLAIM_CredentialIterator * | 337 | struct GNUNET_RECLAIM_CredentialIterator * |
334 | GNUNET_RECLAIM_get_credentials_start ( | 338 | GNUNET_RECLAIM_get_credentials_start ( |
335 | struct GNUNET_RECLAIM_Handle *h, | 339 | struct GNUNET_RECLAIM_Handle *h, |
336 | const struct GNUNET_IDENTITY_PrivateKey *identity, | 340 | const struct GNUNET_CRYPTO_PrivateKey *identity, |
337 | GNUNET_SCHEDULER_TaskCallback error_cb, | 341 | GNUNET_SCHEDULER_TaskCallback error_cb, |
338 | void *error_cb_cls, | 342 | void *error_cb_cls, |
339 | GNUNET_RECLAIM_CredentialResult proc, | 343 | GNUNET_RECLAIM_CredentialResult proc, |
@@ -346,7 +350,7 @@ GNUNET_RECLAIM_get_credentials_start ( | |||
346 | * Calls the record processor specified in #GNUNET_RECLAIM_get_credentials_start | 350 | * Calls the record processor specified in #GNUNET_RECLAIM_get_credentials_start |
347 | * for the next record. | 351 | * for the next record. |
348 | * | 352 | * |
349 | * @param it the iterator | 353 | * @param ait the iterator |
350 | */ | 354 | */ |
351 | void | 355 | void |
352 | GNUNET_RECLAIM_get_credentials_next ( | 356 | GNUNET_RECLAIM_get_credentials_next ( |
@@ -358,7 +362,7 @@ GNUNET_RECLAIM_get_credentials_next ( | |||
358 | * be called on any iteration that has not yet completed prior to calling | 362 | * be called on any iteration that has not yet completed prior to calling |
359 | * #GNUNET_RECLAIM_disconnect. | 363 | * #GNUNET_RECLAIM_disconnect. |
360 | * | 364 | * |
361 | * @param it the iterator | 365 | * @param ait the iterator |
362 | */ | 366 | */ |
363 | void | 367 | void |
364 | GNUNET_RECLAIM_get_credentials_stop ( | 368 | GNUNET_RECLAIM_get_credentials_stop ( |
@@ -381,8 +385,8 @@ GNUNET_RECLAIM_get_credentials_stop ( | |||
381 | struct GNUNET_RECLAIM_Operation * | 385 | struct GNUNET_RECLAIM_Operation * |
382 | GNUNET_RECLAIM_ticket_issue ( | 386 | GNUNET_RECLAIM_ticket_issue ( |
383 | struct GNUNET_RECLAIM_Handle *h, | 387 | struct GNUNET_RECLAIM_Handle *h, |
384 | const struct GNUNET_IDENTITY_PrivateKey *iss, | 388 | const struct GNUNET_CRYPTO_PrivateKey *iss, |
385 | const struct GNUNET_IDENTITY_PublicKey *rp, | 389 | const struct GNUNET_CRYPTO_PublicKey *rp, |
386 | const struct GNUNET_RECLAIM_AttributeList *attrs, | 390 | const struct GNUNET_RECLAIM_AttributeList *attrs, |
387 | GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls); | 391 | GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls); |
388 | 392 | ||
@@ -403,7 +407,7 @@ GNUNET_RECLAIM_ticket_issue ( | |||
403 | struct GNUNET_RECLAIM_Operation * | 407 | struct GNUNET_RECLAIM_Operation * |
404 | GNUNET_RECLAIM_ticket_revoke ( | 408 | GNUNET_RECLAIM_ticket_revoke ( |
405 | struct GNUNET_RECLAIM_Handle *h, | 409 | struct GNUNET_RECLAIM_Handle *h, |
406 | const struct GNUNET_IDENTITY_PrivateKey *identity, | 410 | const struct GNUNET_CRYPTO_PrivateKey *identity, |
407 | const struct GNUNET_RECLAIM_Ticket *ticket, | 411 | const struct GNUNET_RECLAIM_Ticket *ticket, |
408 | GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls); | 412 | GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls); |
409 | 413 | ||
@@ -423,7 +427,7 @@ GNUNET_RECLAIM_ticket_revoke ( | |||
423 | struct GNUNET_RECLAIM_Operation * | 427 | struct GNUNET_RECLAIM_Operation * |
424 | GNUNET_RECLAIM_ticket_consume ( | 428 | GNUNET_RECLAIM_ticket_consume ( |
425 | struct GNUNET_RECLAIM_Handle *h, | 429 | struct GNUNET_RECLAIM_Handle *h, |
426 | const struct GNUNET_IDENTITY_PrivateKey *identity, | 430 | const struct GNUNET_CRYPTO_PrivateKey *identity, |
427 | const struct GNUNET_RECLAIM_Ticket *ticket, | 431 | const struct GNUNET_RECLAIM_Ticket *ticket, |
428 | GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls); | 432 | GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls); |
429 | 433 | ||
@@ -448,7 +452,7 @@ GNUNET_RECLAIM_ticket_consume ( | |||
448 | struct GNUNET_RECLAIM_TicketIterator * | 452 | struct GNUNET_RECLAIM_TicketIterator * |
449 | GNUNET_RECLAIM_ticket_iteration_start ( | 453 | GNUNET_RECLAIM_ticket_iteration_start ( |
450 | struct GNUNET_RECLAIM_Handle *h, | 454 | struct GNUNET_RECLAIM_Handle *h, |
451 | const struct GNUNET_IDENTITY_PrivateKey *identity, | 455 | const struct GNUNET_CRYPTO_PrivateKey *identity, |
452 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, | 456 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, |
453 | GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, | 457 | GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, |
454 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); | 458 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); |
@@ -495,6 +499,43 @@ GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h); | |||
495 | void | 499 | void |
496 | GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op); | 500 | GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op); |
497 | 501 | ||
502 | /** | ||
503 | * Get serialized ticket size | ||
504 | * | ||
505 | * @param tkt the ticket | ||
506 | * @return the buffer length requirement for a serialization | ||
507 | */ | ||
508 | size_t | ||
509 | GNUNET_RECLAIM_ticket_serialize_get_size (const struct GNUNET_RECLAIM_Ticket *tkt); | ||
510 | |||
511 | /** | ||
512 | * Deserializes a ticket | ||
513 | * | ||
514 | * @param buffer the buffer to read from | ||
515 | * @param len the length of the buffer | ||
516 | * @param tkt the ticket to write to (must be allocated) | ||
517 | * @param kb_read how many bytes were read from buffer | ||
518 | * @return GNUNET_SYSERR on error | ||
519 | */ | ||
520 | enum GNUNET_GenericReturnValue | ||
521 | GNUNET_RECLAIM_read_ticket_from_buffer (const void *buffer, | ||
522 | size_t len, | ||
523 | struct GNUNET_RECLAIM_Ticket *tkt, | ||
524 | size_t *tb_read); | ||
525 | |||
526 | /** | ||
527 | * Serializes a ticket | ||
528 | * | ||
529 | * @param tkt the ticket to serialize | ||
530 | * @param buffer the buffer to serialize to (must be allocated with sufficient size | ||
531 | * @param len the length of the buffer | ||
532 | * @return the number of written bytes or < 0 on error | ||
533 | */ | ||
534 | ssize_t | ||
535 | GNUNET_RECLAIM_write_ticket_to_buffer (const struct | ||
536 | GNUNET_RECLAIM_Ticket *tkt, | ||
537 | void *buffer, | ||
538 | size_t len); | ||
498 | 539 | ||
499 | #if 0 /* keep Emacsens' auto-indent happy */ | 540 | #if 0 /* keep Emacsens' auto-indent happy */ |
500 | { | 541 | { |
@@ -509,4 +550,6 @@ GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op); | |||
509 | 550 | ||
510 | /** @} */ /* end of group reclaim */ | 551 | /** @} */ /* end of group reclaim */ |
511 | 552 | ||
553 | /** @} */ /* end of group addition */ | ||
554 | |||
512 | /* end of gnunet_reclaim_service.h */ | 555 | /* end of gnunet_reclaim_service.h */ |