diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2017-10-06 10:04:20 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2017-10-06 10:04:20 +0200 |
commit | fc76f42d3f8df9fc88648ad052f46c7ddf518879 (patch) | |
tree | 05578c1a1e9da8c9abf6e54b7c1c8d33def41568 /src | |
parent | 407c000bf423dc07f1f12fba9b8a8bcd08886d6c (diff) | |
download | gnunet-fc76f42d3f8df9fc88648ad052f46c7ddf518879.tar.gz gnunet-fc76f42d3f8df9fc88648ad052f46c7ddf518879.zip |
-add ticket iteration
Diffstat (limited to 'src')
-rw-r--r-- | src/identity-provider/gnunet-service-identity-provider.c | 10 | ||||
-rw-r--r-- | src/identity-provider/identity_provider_api.c | 293 | ||||
-rw-r--r-- | src/identity-provider/plugin_identity_provider_sqlite.c | 23 | ||||
-rw-r--r-- | src/include/gnunet_identity_provider_service.h | 99 |
4 files changed, 371 insertions, 54 deletions
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 3b3af331e..3dcb2792e 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -1770,11 +1770,7 @@ send_ticket_result (struct IdpClient *client, | |||
1770 | { | 1770 | { |
1771 | struct TicketResultMessage *irm; | 1771 | struct TicketResultMessage *irm; |
1772 | struct GNUNET_MQ_Envelope *env; | 1772 | struct GNUNET_MQ_Envelope *env; |
1773 | size_t attrs_size; | ||
1774 | struct GNUNET_IDENTITY_PROVIDER_Ticket2 *ticket_buf; | 1773 | struct GNUNET_IDENTITY_PROVIDER_Ticket2 *ticket_buf; |
1775 | char *attrs_buf; | ||
1776 | |||
1777 | attrs_size = attribute_list_serialize_get_size (attrs); | ||
1778 | 1774 | ||
1779 | /* store ticket in DB */ | 1775 | /* store ticket in DB */ |
1780 | if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls, | 1776 | if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls, |
@@ -1787,15 +1783,11 @@ send_ticket_result (struct IdpClient *client, | |||
1787 | } | 1783 | } |
1788 | 1784 | ||
1789 | env = GNUNET_MQ_msg_extra (irm, | 1785 | env = GNUNET_MQ_msg_extra (irm, |
1790 | sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket2) + attrs_size, | 1786 | sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket2), |
1791 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT); | 1787 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT); |
1792 | ticket_buf = (struct GNUNET_IDENTITY_PROVIDER_Ticket2 *)&irm[1]; | 1788 | ticket_buf = (struct GNUNET_IDENTITY_PROVIDER_Ticket2 *)&irm[1]; |
1793 | *ticket_buf = *ticket; | 1789 | *ticket_buf = *ticket; |
1794 | attrs_buf = (char*)&ticket_buf[1]; | ||
1795 | attribute_list_serialize (attrs, | ||
1796 | attrs_buf); | ||
1797 | irm->id = htonl (r_id); | 1790 | irm->id = htonl (r_id); |
1798 | |||
1799 | GNUNET_MQ_send (client->mq, | 1791 | GNUNET_MQ_send (client->mq, |
1800 | env); | 1792 | env); |
1801 | } | 1793 | } |
diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c index 371dce86d..6ef1d470e 100644 --- a/src/identity-provider/identity_provider_api.c +++ b/src/identity-provider/identity_provider_api.c | |||
@@ -108,6 +108,71 @@ struct GNUNET_IDENTITY_PROVIDER_Operation | |||
108 | }; | 108 | }; |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * Handle for a ticket iterator operation | ||
112 | */ | ||
113 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator | ||
114 | { | ||
115 | |||
116 | /** | ||
117 | * Kept in a DLL. | ||
118 | */ | ||
119 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator *next; | ||
120 | |||
121 | /** | ||
122 | * Kept in a DLL. | ||
123 | */ | ||
124 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator *prev; | ||
125 | |||
126 | /** | ||
127 | * Main handle to access the idp. | ||
128 | */ | ||
129 | struct GNUNET_IDENTITY_PROVIDER_Handle *h; | ||
130 | |||
131 | /** | ||
132 | * Function to call on completion. | ||
133 | */ | ||
134 | GNUNET_SCHEDULER_TaskCallback finish_cb; | ||
135 | |||
136 | /** | ||
137 | * Closure for @e error_cb. | ||
138 | */ | ||
139 | void *finish_cb_cls; | ||
140 | |||
141 | /** | ||
142 | * The continuation to call with the results | ||
143 | */ | ||
144 | GNUNET_IDENTITY_PROVIDER_TicketCallback tr_cb; | ||
145 | |||
146 | /** | ||
147 | * Closure for @e tr_cb. | ||
148 | */ | ||
149 | void *cls; | ||
150 | |||
151 | /** | ||
152 | * Function to call on errors. | ||
153 | */ | ||
154 | GNUNET_SCHEDULER_TaskCallback error_cb; | ||
155 | |||
156 | /** | ||
157 | * Closure for @e error_cb. | ||
158 | */ | ||
159 | void *error_cb_cls; | ||
160 | |||
161 | /** | ||
162 | * Envelope of the message to send to the service, if not yet | ||
163 | * sent. | ||
164 | */ | ||
165 | struct GNUNET_MQ_Envelope *env; | ||
166 | |||
167 | /** | ||
168 | * The operation id this zone iteration operation has | ||
169 | */ | ||
170 | uint32_t r_id; | ||
171 | |||
172 | }; | ||
173 | |||
174 | |||
175 | /** | ||
111 | * Handle for a attribute iterator operation | 176 | * Handle for a attribute iterator operation |
112 | */ | 177 | */ |
113 | struct GNUNET_IDENTITY_PROVIDER_AttributeIterator | 178 | struct GNUNET_IDENTITY_PROVIDER_AttributeIterator |
@@ -218,6 +283,17 @@ struct GNUNET_IDENTITY_PROVIDER_Handle | |||
218 | struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it_tail; | 283 | struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it_tail; |
219 | 284 | ||
220 | /** | 285 | /** |
286 | * Head of active iterations | ||
287 | */ | ||
288 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator *ticket_it_head; | ||
289 | |||
290 | /** | ||
291 | * Tail of active iterations | ||
292 | */ | ||
293 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator *ticket_it_tail; | ||
294 | |||
295 | |||
296 | /** | ||
221 | * Currently pending transmission request, or NULL for none. | 297 | * Currently pending transmission request, or NULL for none. |
222 | */ | 298 | */ |
223 | struct GNUNET_CLIENT_TransmitHandle *th; | 299 | struct GNUNET_CLIENT_TransmitHandle *th; |
@@ -747,22 +823,54 @@ handle_ticket_result (void *cls, | |||
747 | { | 823 | { |
748 | struct GNUNET_IDENTITY_PROVIDER_Handle *handle = cls; | 824 | struct GNUNET_IDENTITY_PROVIDER_Handle *handle = cls; |
749 | struct GNUNET_IDENTITY_PROVIDER_Operation *op; | 825 | struct GNUNET_IDENTITY_PROVIDER_Operation *op; |
826 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it; | ||
750 | const struct GNUNET_IDENTITY_PROVIDER_Ticket2 *ticket; | 827 | const struct GNUNET_IDENTITY_PROVIDER_Ticket2 *ticket; |
751 | uint32_t r_id = ntohl (msg->id); | 828 | uint32_t r_id = ntohl (msg->id); |
829 | size_t msg_len; | ||
752 | 830 | ||
753 | for (op = handle->op_head; NULL != op; op = op->next) | 831 | for (op = handle->op_head; NULL != op; op = op->next) |
754 | if (op->r_id == r_id) | 832 | if (op->r_id == r_id) |
755 | break; | 833 | break; |
756 | if (NULL == op) | 834 | for (it = handle->ticket_it_head; NULL != it; it = it->next) |
835 | if (it->r_id == r_id) | ||
836 | break; | ||
837 | if ((NULL == op) && (NULL == it)) | ||
757 | return; | 838 | return; |
758 | GNUNET_CONTAINER_DLL_remove (handle->op_head, | 839 | msg_len = ntohs (msg->header.size); |
759 | handle->op_tail, | 840 | if (NULL != op) |
760 | op); | 841 | { |
761 | ticket = (struct GNUNET_IDENTITY_PROVIDER_Ticket2 *)&msg[1]; | 842 | GNUNET_CONTAINER_DLL_remove (handle->op_head, |
762 | if (NULL != op->tr_cb) | 843 | handle->op_tail, |
763 | op->tr_cb (op->cls, ticket); | 844 | op); |
764 | GNUNET_free (op); | 845 | if (msg_len == sizeof (struct TicketResultMessage)) |
846 | { | ||
847 | if (NULL != op->tr_cb) | ||
848 | op->tr_cb (op->cls, NULL); | ||
849 | } else { | ||
850 | ticket = (struct GNUNET_IDENTITY_PROVIDER_Ticket2 *)&msg[1]; | ||
851 | if (NULL != op->tr_cb) | ||
852 | op->tr_cb (op->cls, ticket); | ||
853 | } | ||
854 | GNUNET_free (op); | ||
855 | return; | ||
856 | } else if (NULL != it) { | ||
857 | GNUNET_CONTAINER_DLL_remove (handle->ticket_it_head, | ||
858 | handle->ticket_it_tail, | ||
859 | it); | ||
860 | if (msg_len == sizeof (struct TicketResultMessage)) | ||
861 | { | ||
862 | if (NULL != it->tr_cb) | ||
863 | it->finish_cb (it->finish_cb_cls); | ||
864 | } else { | ||
765 | 865 | ||
866 | ticket = (struct GNUNET_IDENTITY_PROVIDER_Ticket2 *)&msg[1]; | ||
867 | if (NULL != it->tr_cb) | ||
868 | it->tr_cb (it->cls, ticket); | ||
869 | } | ||
870 | GNUNET_free (it); | ||
871 | return; | ||
872 | } | ||
873 | GNUNET_break (0); | ||
766 | } | 874 | } |
767 | 875 | ||
768 | 876 | ||
@@ -1353,6 +1461,175 @@ GNUNET_IDENTITY_PROVIDER_rp_ticket_consume (struct GNUNET_IDENTITY_PROVIDER_Hand | |||
1353 | } | 1461 | } |
1354 | 1462 | ||
1355 | 1463 | ||
1464 | /** | ||
1465 | * Lists all tickets that have been issued to remote | ||
1466 | * identites (relying parties) | ||
1467 | * | ||
1468 | * @param h the identity provider to use | ||
1469 | * @param identity the issuing identity | ||
1470 | * @param error_cb function to call on error (i.e. disconnect), | ||
1471 | * the handle is afterwards invalid | ||
1472 | * @param error_cb_cls closure for @a error_cb | ||
1473 | * @param proc function to call on each ticket; it | ||
1474 | * will be called repeatedly with a value (if available) | ||
1475 | * @param proc_cls closure for @a proc | ||
1476 | * @param finish_cb function to call on completion | ||
1477 | * the handle is afterwards invalid | ||
1478 | * @param finish_cb_cls closure for @a finish_cb | ||
1479 | * @return an iterator handle to use for iteration | ||
1480 | */ | ||
1481 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator * | ||
1482 | GNUNET_IDENTITY_PROVIDER_idp_ticket_iteration_start (struct GNUNET_IDENTITY_PROVIDER_Handle *h, | ||
1483 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | ||
1484 | GNUNET_SCHEDULER_TaskCallback error_cb, | ||
1485 | void *error_cb_cls, | ||
1486 | GNUNET_IDENTITY_PROVIDER_TicketCallback proc, | ||
1487 | void *proc_cls, | ||
1488 | GNUNET_SCHEDULER_TaskCallback finish_cb, | ||
1489 | void *finish_cb_cls) | ||
1490 | { | ||
1491 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it; | ||
1492 | struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub; | ||
1493 | struct GNUNET_MQ_Envelope *env; | ||
1494 | struct TicketIterationStartMessage *msg; | ||
1495 | uint32_t rid; | ||
1496 | |||
1497 | GNUNET_CRYPTO_ecdsa_key_get_public (identity, | ||
1498 | &identity_pub); | ||
1499 | rid = h->r_id_gen++; | ||
1500 | it = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_TicketIterator); | ||
1501 | it->h = h; | ||
1502 | it->error_cb = error_cb; | ||
1503 | it->error_cb_cls = error_cb_cls; | ||
1504 | it->finish_cb = finish_cb; | ||
1505 | it->finish_cb_cls = finish_cb_cls; | ||
1506 | it->tr_cb = proc; | ||
1507 | it->cls = proc_cls; | ||
1508 | it->r_id = rid; | ||
1509 | GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, | ||
1510 | h->ticket_it_tail, | ||
1511 | it); | ||
1512 | env = GNUNET_MQ_msg (msg, | ||
1513 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_START); | ||
1514 | msg->id = htonl (rid); | ||
1515 | msg->identity = identity_pub; | ||
1516 | msg->is_audience = htonl (GNUNET_NO); | ||
1517 | if (NULL == h->mq) | ||
1518 | it->env = env; | ||
1519 | else | ||
1520 | GNUNET_MQ_send (h->mq, | ||
1521 | env); | ||
1522 | return it; | ||
1523 | |||
1524 | } | ||
1525 | |||
1526 | |||
1527 | /** | ||
1528 | * Lists all tickets that have been issued to remote | ||
1529 | * identites (relying parties) | ||
1530 | * | ||
1531 | * @param id the identity provider to use | ||
1532 | * @param identity the issuing identity | ||
1533 | * @param error_cb function to call on error (i.e. disconnect), | ||
1534 | * the handle is afterwards invalid | ||
1535 | * @param error_cb_cls closure for @a error_cb | ||
1536 | * @param proc function to call on each ticket; it | ||
1537 | * will be called repeatedly with a value (if available) | ||
1538 | * @param proc_cls closure for @a proc | ||
1539 | * @param finish_cb function to call on completion | ||
1540 | * the handle is afterwards invalid | ||
1541 | * @param finish_cb_cls closure for @a finish_cb | ||
1542 | * @return an iterator handle to use for iteration | ||
1543 | */ | ||
1544 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator * | ||
1545 | GNUNET_IDENTITY_PROVIDER_ticket_iteration_start_rp (struct GNUNET_IDENTITY_PROVIDER_Handle *h, | ||
1546 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | ||
1547 | GNUNET_SCHEDULER_TaskCallback error_cb, | ||
1548 | void *error_cb_cls, | ||
1549 | GNUNET_IDENTITY_PROVIDER_TicketCallback proc, | ||
1550 | void *proc_cls, | ||
1551 | GNUNET_SCHEDULER_TaskCallback finish_cb, | ||
1552 | void *finish_cb_cls) | ||
1553 | { | ||
1554 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it; | ||
1555 | struct GNUNET_MQ_Envelope *env; | ||
1556 | struct TicketIterationStartMessage *msg; | ||
1557 | uint32_t rid; | ||
1558 | |||
1559 | rid = h->r_id_gen++; | ||
1560 | it = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_TicketIterator); | ||
1561 | it->h = h; | ||
1562 | it->error_cb = error_cb; | ||
1563 | it->error_cb_cls = error_cb_cls; | ||
1564 | it->finish_cb = finish_cb; | ||
1565 | it->finish_cb_cls = finish_cb_cls; | ||
1566 | it->tr_cb = proc; | ||
1567 | it->cls = proc_cls; | ||
1568 | it->r_id = rid; | ||
1569 | GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, | ||
1570 | h->ticket_it_tail, | ||
1571 | it); | ||
1572 | env = GNUNET_MQ_msg (msg, | ||
1573 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_START); | ||
1574 | msg->id = htonl (rid); | ||
1575 | msg->identity = *identity; | ||
1576 | msg->is_audience = htonl (GNUNET_YES); | ||
1577 | if (NULL == h->mq) | ||
1578 | it->env = env; | ||
1579 | else | ||
1580 | GNUNET_MQ_send (h->mq, | ||
1581 | env); | ||
1582 | return it; | ||
1583 | |||
1584 | |||
1585 | } | ||
1586 | |||
1587 | /** | ||
1588 | * Calls the record processor specified in #GNUNET_IDENTITY_PROVIDER_ticket_iteration_start | ||
1589 | * for the next record. | ||
1590 | * | ||
1591 | * @param it the iterator | ||
1592 | */ | ||
1593 | void | ||
1594 | GNUNET_IDENTITY_PROVIDER_ticket_iteration_next (struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it) | ||
1595 | { | ||
1596 | struct GNUNET_IDENTITY_PROVIDER_Handle *h = it->h; | ||
1597 | struct TicketIterationNextMessage *msg; | ||
1598 | struct GNUNET_MQ_Envelope *env; | ||
1599 | |||
1600 | env = GNUNET_MQ_msg (msg, | ||
1601 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_NEXT); | ||
1602 | msg->id = htonl (it->r_id); | ||
1603 | GNUNET_MQ_send (h->mq, | ||
1604 | env); | ||
1605 | } | ||
1606 | |||
1607 | |||
1608 | /** | ||
1609 | * Stops iteration and releases the idp handle for further calls. Must | ||
1610 | * be called on any iteration that has not yet completed prior to calling | ||
1611 | * #GNUNET_IDENTITY_PROVIDER_disconnect. | ||
1612 | * | ||
1613 | * @param it the iterator | ||
1614 | */ | ||
1615 | void | ||
1616 | GNUNET_IDENTITY_PROVIDER_ticket_iteration_stop (struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it) | ||
1617 | { | ||
1618 | struct GNUNET_IDENTITY_PROVIDER_Handle *h = it->h; | ||
1619 | struct GNUNET_MQ_Envelope *env; | ||
1620 | struct TicketIterationStopMessage *msg; | ||
1621 | |||
1622 | if (NULL != h->mq) | ||
1623 | { | ||
1624 | env = GNUNET_MQ_msg (msg, | ||
1625 | GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_STOP); | ||
1626 | msg->id = htonl (it->r_id); | ||
1627 | GNUNET_MQ_send (h->mq, | ||
1628 | env); | ||
1629 | } | ||
1630 | GNUNET_free (it); | ||
1631 | } | ||
1632 | |||
1356 | 1633 | ||
1357 | 1634 | ||
1358 | /* end of identity_provider_api.c */ | 1635 | /* end of identity_provider_api.c */ |
diff --git a/src/identity-provider/plugin_identity_provider_sqlite.c b/src/identity-provider/plugin_identity_provider_sqlite.c index f31e2e68a..464ea29cb 100644 --- a/src/identity-provider/plugin_identity_provider_sqlite.c +++ b/src/identity-provider/plugin_identity_provider_sqlite.c | |||
@@ -376,7 +376,28 @@ identity_provider_sqlite_store_ticket (void *cls, | |||
376 | attribute_list_serialize (attrs, | 376 | attribute_list_serialize (attrs, |
377 | attrs_serialized); | 377 | attrs_serialized); |
378 | 378 | ||
379 | { | 379 | { |
380 | /* First delete duplicates */ | ||
381 | struct GNUNET_SQ_QueryParam dparams[] = { | ||
382 | GNUNET_SQ_query_param_auto_from_type (&ticket->identity), | ||
383 | GNUNET_SQ_query_param_uint64 (&ticket->rnd), | ||
384 | GNUNET_SQ_query_param_end | ||
385 | }; | ||
386 | if (GNUNET_OK != | ||
387 | GNUNET_SQ_bind (plugin->delete_ticket, | ||
388 | dparams)) | ||
389 | { | ||
390 | LOG_SQLITE (plugin, | ||
391 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
392 | "sqlite3_bind_XXXX"); | ||
393 | GNUNET_SQ_reset (plugin->dbh, | ||
394 | plugin->delete_ticket); | ||
395 | return GNUNET_SYSERR; | ||
396 | } | ||
397 | n = sqlite3_step (plugin->delete_ticket); | ||
398 | GNUNET_SQ_reset (plugin->dbh, | ||
399 | plugin->delete_ticket); | ||
400 | |||
380 | struct GNUNET_SQ_QueryParam sparams[] = { | 401 | struct GNUNET_SQ_QueryParam sparams[] = { |
381 | GNUNET_SQ_query_param_auto_from_type (&ticket->identity), | 402 | GNUNET_SQ_query_param_auto_from_type (&ticket->identity), |
382 | GNUNET_SQ_query_param_auto_from_type (&ticket->audience), | 403 | GNUNET_SQ_query_param_auto_from_type (&ticket->audience), |
diff --git a/src/include/gnunet_identity_provider_service.h b/src/include/gnunet_identity_provider_service.h index 02cd15959..198e2f918 100644 --- a/src/include/gnunet_identity_provider_service.h +++ b/src/include/gnunet_identity_provider_service.h | |||
@@ -343,20 +343,6 @@ typedef void | |||
343 | const struct GNUNET_IDENTITY_PROVIDER_Ticket2 *ticket); | 343 | const struct GNUNET_IDENTITY_PROVIDER_Ticket2 *ticket); |
344 | 344 | ||
345 | /** | 345 | /** |
346 | * Method called when issued tickets are retrieved. Also returns the attributes | ||
347 | * that were issued at the time. | ||
348 | * | ||
349 | * @param cls closure | ||
350 | * @param ticket the ticket | ||
351 | * @param attrs the attributes as list | ||
352 | */ | ||
353 | typedef void | ||
354 | (*GNUNET_IDENTITY_PROVIDER_TicketResult)(void *cls, | ||
355 | const struct GNUNET_IDENTITY_PROVIDER_Ticket2 *ticket, | ||
356 | const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs); | ||
357 | |||
358 | |||
359 | /** | ||
360 | * Issues a ticket to another identity. The identity may use | 346 | * Issues a ticket to another identity. The identity may use |
361 | * @GNUNET_IDENTITY_PROVIDER_authorization_ticket_consume to consume the ticket | 347 | * @GNUNET_IDENTITY_PROVIDER_authorization_ticket_consume to consume the ticket |
362 | * and retrieve the attributes specified in the AttributeList. | 348 | * and retrieve the attributes specified in the AttributeList. |
@@ -415,37 +401,78 @@ GNUNET_IDENTITY_PROVIDER_rp_ticket_consume (struct GNUNET_IDENTITY_PROVIDER_Hand | |||
415 | GNUNET_IDENTITY_PROVIDER_AttributeResult cb, | 401 | GNUNET_IDENTITY_PROVIDER_AttributeResult cb, |
416 | void *cb_cls); | 402 | void *cb_cls); |
417 | 403 | ||
418 | /** TODO | 404 | /** |
405 | * Lists all tickets that have been issued to remote | ||
406 | * identites (relying parties) | ||
407 | * | ||
408 | * @param h the identity provider to use | ||
409 | * @param identity the issuing identity | ||
410 | * @param error_cb function to call on error (i.e. disconnect), | ||
411 | * the handle is afterwards invalid | ||
412 | * @param error_cb_cls closure for @a error_cb | ||
413 | * @param proc function to call on each ticket; it | ||
414 | * will be called repeatedly with a value (if available) | ||
415 | * @param proc_cls closure for @a proc | ||
416 | * @param finish_cb function to call on completion | ||
417 | * the handle is afterwards invalid | ||
418 | * @param finish_cb_cls closure for @a finish_cb | ||
419 | * @return an iterator handle to use for iteration | ||
420 | */ | ||
421 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator * | ||
422 | GNUNET_IDENTITY_PROVIDER_idp_ticket_iteration_start (struct GNUNET_IDENTITY_PROVIDER_Handle *h, | ||
423 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | ||
424 | GNUNET_SCHEDULER_TaskCallback error_cb, | ||
425 | void *error_cb_cls, | ||
426 | GNUNET_IDENTITY_PROVIDER_TicketCallback proc, | ||
427 | void *proc_cls, | ||
428 | GNUNET_SCHEDULER_TaskCallback finish_cb, | ||
429 | void *finish_cb_cls); | ||
430 | |||
431 | /** | ||
419 | * Lists all tickets that have been issued to remote | 432 | * Lists all tickets that have been issued to remote |
420 | * identites (relying parties) | 433 | * identites (relying parties) |
421 | * | 434 | * |
422 | * @param id the identity provider to use | 435 | * @param id the identity provider to use |
423 | * @param identity the issuing identity | 436 | * @param identity the issuing identity |
424 | * @param cb the callback to use | 437 | * @param error_cb function to call on error (i.e. disconnect), |
425 | * @param cb_cls the callback closure | 438 | * the handle is afterwards invalid |
426 | * @return handle to abort the operation | 439 | * @param error_cb_cls closure for @a error_cb |
440 | * @param proc function to call on each ticket; it | ||
441 | * will be called repeatedly with a value (if available) | ||
442 | * @param proc_cls closure for @a proc | ||
443 | * @param finish_cb function to call on completion | ||
444 | * the handle is afterwards invalid | ||
445 | * @param finish_cb_cls closure for @a finish_cb | ||
446 | * @return an iterator handle to use for iteration | ||
427 | */ | 447 | */ |
428 | struct GNUNET_IDENTITY_PROVIDER_Operation * | 448 | struct GNUNET_IDENTITY_PROVIDER_TicketIterator * |
429 | GNUNET_IDENTITY_PROVIDER_idp_tickets_list (struct GNUNET_IDENTITY_PROVIDER_Handle *id, | 449 | GNUNET_IDENTITY_PROVIDER_ticket_iteration_start_rp (struct GNUNET_IDENTITY_PROVIDER_Handle *h, |
430 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 450 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
431 | GNUNET_IDENTITY_PROVIDER_TicketCallback *cb, | 451 | GNUNET_SCHEDULER_TaskCallback error_cb, |
432 | void *cb_cls); | 452 | void *error_cb_cls, |
453 | GNUNET_IDENTITY_PROVIDER_TicketCallback proc, | ||
454 | void *proc_cls, | ||
455 | GNUNET_SCHEDULER_TaskCallback finish_cb, | ||
456 | void *finish_cb_cls); | ||
433 | 457 | ||
434 | /** TODO | 458 | /** |
435 | * Lists all attributes that are shared with this identity | 459 | * Calls the record processor specified in #GNUNET_IDENTITY_PROVIDER_ticket_iteration_start |
436 | * by remote parties | 460 | * for the next record. |
437 | * | 461 | * |
438 | * @param id identity provider service to use | 462 | * @param it the iterator |
439 | * @param identity the identity (relying party) | ||
440 | * @param cb the result callback | ||
441 | * @param cb_cls the result callback closure | ||
442 | * @return handle to abort the operation | ||
443 | */ | 463 | */ |
444 | struct GNUNET_IDENTITY_PROVIDER_Operation * | 464 | void |
445 | GNUNET_IDENTITY_PROVIDER_rp_attributes_list (struct GNUNET_IDENTITY_PROVIDER_Handle *id, | 465 | GNUNET_IDENTITY_PROVIDER_ticket_iteration_next (struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it); |
446 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 466 | |
447 | GNUNET_IDENTITY_PROVIDER_AttributeResult *cb, | 467 | /** |
448 | void *cb_cls); | 468 | * Stops iteration and releases the idp handle for further calls. Must |
469 | * be called on any iteration that has not yet completed prior to calling | ||
470 | * #GNUNET_IDENTITY_PROVIDER_disconnect. | ||
471 | * | ||
472 | * @param it the iterator | ||
473 | */ | ||
474 | void | ||
475 | GNUNET_IDENTITY_PROVIDER_ticket_iteration_stop (struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it); | ||
449 | 476 | ||
450 | /** TODO remove DEPRECATED | 477 | /** TODO remove DEPRECATED |
451 | * Issue a token for a specific audience. | 478 | * Issue a token for a specific audience. |