#include "gnunet-service-reclaim_tickets.h"
#include "gnunet_common.h"
#include "gnunet_gns_service.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_reclaim_service.h"
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | TicketReference |
A reference to a ticket stored in GNS. More... | |
struct | RECLAIM_TICKETS_ConsumeHandle |
Handle to a consume operation. More... | |
struct | ParallelLookup |
Handle for a parallel GNS lookup job. More... | |
struct | TicketIssueHandle |
Ticket issue request handle. More... | |
struct | RECLAIM_TICKETS_Iterator |
Ticket iterator. More... | |
struct | RevokedAttributeEntry |
struct | RECLAIM_TICKETS_RevokeHandle |
Ticket revocation request handle. More... | |
Macros | |
#define | DEFAULT_TICKET_REFRESH_INTERVAL GNUNET_TIME_UNIT_HOURS |
FIXME: the default ticket iteration interval should probably be the minimum attribute expiration. More... | |
Functions | |
static void | cleanup_rvk (struct RECLAIM_TICKETS_RevokeHandle *rh) |
Cleanup revoke handle. More... | |
static void | process_tickets (void *cls) |
For each ticket, store new, updated attribute references (Implementation further below) More... | |
static void | ticket_processed (void *cls, enum GNUNET_ErrorCode ec) |
Finished storing updated attribute references. More... | |
static void | rvk_ticket_update_finished (void *cls) |
Done collecting tickets. More... | |
static void | rvk_ticket_update (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
We need to update all other tickets with the new attribute IDs. More... | |
static void | rvk_ns_iter_err (void *cls) |
Error iterating namestore. More... | |
static void | rvk_ns_err (void *cls) |
Error storing new attribute in namestore. More... | |
static void | move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rh) |
We change every attribute ID of the ticket attributes we want to revoke. More... | |
static void | move_attrs_cont (void *cls) |
Delayed continuation for move_attrs. More... | |
static void | del_attr_finished (void *cls, enum GNUNET_ErrorCode ec) |
Done deleting the old record. More... | |
static void | move_attr_finished (void *cls, enum GNUNET_ErrorCode ec) |
Updated an attribute ID. More... | |
static void | rvk_move_attr_cb (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Got the referenced attribute. More... | |
static void | remove_ticket_cont (void *cls, enum GNUNET_ErrorCode ec) |
Finished deleting ticket and attribute references. More... | |
static void | revoke_attrs_cb (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
We found the attribute references. More... | |
static void | rvk_attrs_err_cb (void *cls) |
Failed to query namestore. More... | |
struct RECLAIM_TICKETS_RevokeHandle * | RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_CRYPTO_PrivateKey *identity, RECLAIM_TICKETS_RevokeCallback cb, void *cb_cls) |
Revoke a ticket. More... | |
void | RECLAIM_TICKETS_revoke_cancel (struct RECLAIM_TICKETS_RevokeHandle *rh) |
Cancel a revocation. More... | |
static void | cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth) |
Cleanup ticket consume handle. More... | |
static void | process_parallel_lookup_result (void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
static void | abort_parallel_lookups (void *cls) |
Cancel the lookups for attribute records. More... | |
static void | lookup_authz_cb (void *cls, int is_gns, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
struct RECLAIM_TICKETS_ConsumeHandle * | RECLAIM_TICKETS_consume (const struct GNUNET_RECLAIM_Ticket *ticket, const char *rp_uri, RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls) |
Consume a ticket. More... | |
void | RECLAIM_TICKETS_consume_cancel (struct RECLAIM_TICKETS_ConsumeHandle *cth) |
Cancel a consume operation. More... | |
static void | cleanup_issue_handle (struct TicketIssueHandle *handle) |
Cleanup ticket consume handle. More... | |
static void | store_ticket_issue_cont (void *cls, enum GNUNET_ErrorCode ec) |
Store finished, abort on error. More... | |
static void | issue_ticket (struct TicketIssueHandle *ih) |
Issue a new ticket. More... | |
static void | filter_tickets_error_cb (void *cls) |
Namestore error on issue. More... | |
static void | filter_tickets_cb (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Iterator over records. More... | |
static void | filter_tickets_finished_cb (void *cls) |
Done iterating over tickets and we apparently did not find an existing, matching ticket. More... | |
void | RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_PrivateKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const char *rp, RECLAIM_TICKETS_TicketResult cb, void *cb_cls) |
Issue a new reclaim ticket, thereby authorizing the audience to access the set of provided attributes. More... | |
static void | cleanup_iter (struct RECLAIM_TICKETS_Iterator *iter) |
Cleanup ticket iterator. More... | |
static void | collect_tickets_cb (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Return each record of type GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET to the caller and proceed with the iteration. More... | |
static void | collect_tickets_finished_cb (void *cls) |
Signal ticket iteration has finished. More... | |
static void | collect_tickets_error_cb (void *cls) |
Cancel ticket iteration on namestore error. More... | |
void | RECLAIM_TICKETS_iteration_next (struct RECLAIM_TICKETS_Iterator *iter) |
Continue ticket iteration. More... | |
void | RECLAIM_TICKETS_iteration_stop (struct RECLAIM_TICKETS_Iterator *iter) |
Stop a running ticket iteration. More... | |
struct RECLAIM_TICKETS_Iterator * | RECLAIM_TICKETS_iteration_start (const struct GNUNET_CRYPTO_PrivateKey *identity, RECLAIM_TICKETS_TicketIter cb, void *cb_cls) |
Iterate over all tickets issued by an identity. More... | |
int | RECLAIM_TICKETS_init (const struct GNUNET_CONFIGURATION_Handle *c) |
Initialize tickets component. More... | |
void | RECLAIM_TICKETS_deinit (void) |
Close handles and clean up. More... | |
Variables | |
static struct GNUNET_TIME_Relative | ticket_refresh_interval |
Ticket expiration interval. More... | |
static struct GNUNET_NAMESTORE_Handle * | nsh |
static struct GNUNET_GNS_Handle * | gns |
static struct GNUNET_STATISTICS_Handle * | stats |
#define DEFAULT_TICKET_REFRESH_INTERVAL GNUNET_TIME_UNIT_HOURS |
FIXME: the default ticket iteration interval should probably be the minimum attribute expiration.
Definition at line 39 of file gnunet-service-reclaim_tickets.c.
|
static |
Cleanup revoke handle.
rh | the ticket revocation handle |
Definition at line 362 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::attrs_tail, TicketRecordsEntry::data, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_zone_iteration_stop(), TicketRecordsEntry::label, RECLAIM_TICKETS_RevokeHandle::ns_it, RECLAIM_TICKETS_RevokeHandle::ns_qe, and RECLAIM_TICKETS_RevokeHandle::tickets_to_update_head.
Referenced by del_attr_finished(), move_attr_finished(), process_tickets(), RECLAIM_TICKETS_revoke_cancel(), remove_ticket_cont(), rvk_attrs_err_cb(), rvk_ns_err(), and rvk_ns_iter_err().
|
static |
For each ticket, store new, updated attribute references (Implementation further below)
For each ticket, store new, updated attribute references.
cls | handle to the operation |
Definition at line 425 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), data, GNUNET_GNSRECORD_Data::data, TicketRecordsEntry::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GNSRECORD_records_deserialize(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_log, GNUNET_NAMESTORE_record_set_store(), GNUNET_OK, GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::identity, TicketRecordsEntry::label, RevokedAttributeEntry::new_id, RevokedAttributeEntry::next, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, RevokedAttributeEntry::old_id, rd, rd_count, GNUNET_GNSRECORD_Data::record_type, ticket_processed(), RECLAIM_TICKETS_RevokeHandle::tickets_to_update_head, and RECLAIM_TICKETS_RevokeHandle::tickets_to_update_tail.
Referenced by rvk_ticket_update_finished(), and ticket_processed().
|
static |
Finished storing updated attribute references.
Abort on error, else continue processing tickets
cls | handle to the operation |
success | result of namestore operation |
emsg | (NULL on success) |
Definition at line 410 of file gnunet-service-reclaim_tickets.c.
References GNUNET_SCHEDULER_add_now(), RECLAIM_TICKETS_RevokeHandle::ns_qe, and process_tickets().
Referenced by process_tickets().
|
static |
Done collecting tickets.
Start processing.
cls | handle to the operation |
Definition at line 487 of file gnunet-service-reclaim_tickets.c.
References GNUNET_SCHEDULER_add_now(), RECLAIM_TICKETS_RevokeHandle::ns_it, and process_tickets().
Referenced by move_attrs().
|
static |
We need to update all other tickets with the new attribute IDs.
We first collect them all. Processing after.
cls | handle to the operation |
zone | ticket issuer private key |
label | ticket rnd |
rd_count | size of record set |
rd | record set |
Let everything point to the old record
Definition at line 507 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::attrs_head, data, TicketRecordsEntry::data, TicketRecordsEntry::data_size, GNUNET_CONTAINER_DLL_insert, GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_malloc, GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_new, GNUNET_NO, GNUNET_strdup, GNUNET_YES, TicketRecordsEntry::label, RevokedAttributeEntry::next, RECLAIM_TICKETS_RevokeHandle::ns_it, RevokedAttributeEntry::old_id, rd, rd_count, TicketRecordsEntry::rd_count, RECLAIM_TICKETS_RevokeHandle::tickets_to_update_head, and RECLAIM_TICKETS_RevokeHandle::tickets_to_update_tail.
Referenced by move_attrs().
|
static |
Error iterating namestore.
Abort.
cls | handle to the operation |
Definition at line 555 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_SYSERR, and RECLAIM_TICKETS_RevokeHandle::ns_it.
Referenced by move_attrs().
|
static |
Error storing new attribute in namestore.
Abort
cls | handle to the operation |
Definition at line 571 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_SYSERR, and RECLAIM_TICKETS_RevokeHandle::ns_qe.
Referenced by move_attrs().
|
static |
We change every attribute ID of the ticket attributes we want to revoke.
When we are done, we need to update any other ticket which included references to any of the changed attributes.
rh | handle to the operation |
Definition at line 779 of file gnunet-service-reclaim_tickets.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_NAMESTORE_records_lookup(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_STRINGS_data_to_string_alloc(), RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::move_attr, RECLAIM_TICKETS_RevokeHandle::ns_it, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, RevokedAttributeEntry::old_id, rvk_move_attr_cb(), rvk_ns_err(), rvk_ns_iter_err(), rvk_ticket_update(), and rvk_ticket_update_finished().
Referenced by move_attrs_cont(), and remove_ticket_cont().
|
static |
Delayed continuation for move_attrs.
cls | handle to the operation. |
Definition at line 599 of file gnunet-service-reclaim_tickets.c.
References move_attrs().
Referenced by del_attr_finished(), and rvk_move_attr_cb().
|
static |
Done deleting the old record.
Abort on error. Else, continue updating attribute IDs.
cls | handle to the operation |
success | result of the namestore operation |
emsg | error message (NULL on success) |
Definition at line 614 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_EC_NONE, GNUNET_ERROR_TYPE_ERROR, GNUNET_ErrorCode_get_hint(), GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::move_attr, move_attrs_cont(), RevokedAttributeEntry::next, and RECLAIM_TICKETS_RevokeHandle::ns_qe.
Referenced by move_attr_finished().
|
static |
Updated an attribute ID.
Abort on error if namestore operation failed. Else, we have to delete the old record.
cls | handle to the operation |
success | result of the store operation |
emsg | error message (NULL on success) |
Definition at line 643 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), del_attr_finished(), GNUNET_assert, GNUNET_EC_NONE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ErrorCode_get_hint(), GNUNET_free, GNUNET_log, GNUNET_NAMESTORE_record_set_store(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::move_attr, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, and RevokedAttributeEntry::old_id.
Referenced by rvk_move_attr_cb().
|
static |
Got the referenced attribute.
Updating the ID
cls | handle to the operation |
zone | issuer identity |
label | attribute ID |
rd_count | size of record set (should be 1) |
rd | record set (the attribute) |
find a new place for this attribute
Definition at line 683 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::attrs_tail, claim, credential, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE, GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL, GNUNET_log, GNUNET_malloc, GNUNET_NAMESTORE_record_set_store(), GNUNET_RECLAIM_attribute_deserialize(), GNUNET_RECLAIM_attribute_serialize(), GNUNET_RECLAIM_attribute_serialize_get_size(), GNUNET_RECLAIM_credential_deserialize(), GNUNET_RECLAIM_credential_serialize(), GNUNET_RECLAIM_credential_serialize_get_size(), GNUNET_RECLAIM_id_generate, GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_Identifier::id, GNUNET_RECLAIM_Attribute::id, RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::move_attr, move_attr_finished(), move_attrs_cont(), GNUNET_RECLAIM_Attribute::name, RevokedAttributeEntry::new_id, RevokedAttributeEntry::next, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, rd, rd_count, and GNUNET_GNSRECORD_Data::record_type.
Referenced by move_attrs().
|
static |
Finished deleting ticket and attribute references.
Abort on failure. Else, we start changing every attribute ID in the found attribute references so that access is no longer possible.
cls | handle to the operation |
success | Namestore operation return value |
emsg | error message (NULL on success) |
Definition at line 824 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_EC_NONE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_ErrorCode_get_hint(), GNUNET_log, GNUNET_OK, GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::move_attr, move_attrs(), RECLAIM_TICKETS_RevokeHandle::ns_qe, and RECLAIM_TICKETS_RevokeHandle::ticket_attrs.
Referenced by revoke_attrs_cb().
|
static |
We found the attribute references.
Store them for later and remove the record set.
cls | handle to the operation |
zone | the issuer key |
label | ticket rnd |
rd_count | size of record set |
rd | record set |
Temporarily store attribute references. We need it later.
Remove attribute references
Definition at line 862 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::attrs_tail, data, GNUNET_CONTAINER_DLL_insert, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_NAMESTORE_record_set_store(), GNUNET_new, RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, RevokedAttributeEntry::old_id, rd, rd_count, remove_ticket_cont(), and RECLAIM_TICKETS_RevokeHandle::ticket_attrs.
Referenced by RECLAIM_TICKETS_revoke().
|
static |
Failed to query namestore.
Abort operation
cls | handle to the operation |
Definition at line 904 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), and GNUNET_SYSERR.
Referenced by RECLAIM_TICKETS_revoke().
struct RECLAIM_TICKETS_RevokeHandle * RECLAIM_TICKETS_revoke | ( | const struct GNUNET_RECLAIM_Ticket * | ticket, |
const struct GNUNET_CRYPTO_PrivateKey * | identity, | ||
RECLAIM_TICKETS_RevokeCallback | cb, | ||
void * | cb_cls | ||
) |
Revoke a ticket.
We start by looking up attribute references in order to change attribute IDs.
ticket | ticket to revoke |
identity | private key of issuer |
cb | revocation status callback |
cb_cls | callback closure |
Get shared attributes
Definition at line 925 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, GNUNET_RECLAIM_Ticket::gns_name, GNUNET_assert, GNUNET_free, GNUNET_NAMESTORE_records_lookup(), GNUNET_new, GNUNET_strdup, identity, RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, revoke_attrs_cb(), rvk_attrs_err_cb(), ticket, and RECLAIM_TICKETS_RevokeHandle::ticket.
Referenced by handle_revoke_ticket_message().
void RECLAIM_TICKETS_revoke_cancel | ( | struct RECLAIM_TICKETS_RevokeHandle * | rh | ) |
Cancel a revocation.
rh | handle to the operation |
Definition at line 961 of file gnunet-service-reclaim_tickets.c.
References cleanup_rvk(), and GNUNET_assert.
Referenced by cleanup_client().
|
static |
Cleanup ticket consume handle.
cth | the handle to clean up |
Definition at line 978 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_ConsumeHandle::attrs, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_GNS_lookup_cancel(), GNUNET_GNS_lookup_with_tld_cancel(), GNUNET_RECLAIM_attribute_list_destroy(), GNUNET_RECLAIM_presentation_list_destroy(), GNUNET_SCHEDULER_cancel(), RECLAIM_TICKETS_ConsumeHandle::kill_task, ParallelLookup::label, RECLAIM_TICKETS_ConsumeHandle::lookup_request, ParallelLookup::lookup_request, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_head, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_tail, and RECLAIM_TICKETS_ConsumeHandle::presentations.
Referenced by lookup_authz_cb(), process_parallel_lookup_result(), and RECLAIM_TICKETS_consume_cancel().
|
static |
Definition at line 1006 of file gnunet-service-reclaim_tickets.c.
References GNUNET_RECLAIM_AttributeListEntry::attribute, RECLAIM_TICKETS_ConsumeHandle::attrs, RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, cleanup_cth(), data, data_size, GNUNET_RECLAIM_Ticket::gns_name, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNS_parse_ztld(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE, GNUNET_log, GNUNET_new, GNUNET_OK, GNUNET_RECLAIM_attribute_deserialize(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_get_duration(), GNUNET_YES, ParallelLookup::handle, ParallelLookup::label, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_AttributeList::list_tail, ParallelLookup::lookup_start_time, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_head, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_tail, RECLAIM_TICKETS_ConsumeHandle::presentations, rd, rd_count, GNUNET_TIME_Relative::rel_value_us, stats, and RECLAIM_TICKETS_ConsumeHandle::ticket.
Referenced by lookup_authz_cb().
|
static |
Cancel the lookups for attribute records.
cls | handle to the operation |
Definition at line 1065 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_GNS_lookup_cancel(), GNUNET_SYSERR, RECLAIM_TICKETS_ConsumeHandle::kill_task, ParallelLookup::label, ParallelLookup::lookup_request, ParallelLookup::next, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_head, and RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_tail.
Referenced by lookup_authz_cb().
|
static |
Check if record is a credential presentation or an attribute reference.
Return error
Return error
We started lookups. Add a timeout task. FIXME: Really needed here?
No references found, return empty attribute list
Definition at line 1088 of file gnunet-service-reclaim_tickets.c.
References abort_parallel_lookups(), RECLAIM_TICKETS_ConsumeHandle::attrs, RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, cleanup_cth(), data, GNUNET_GNSRECORD_Data::data, data_size, gns, GNUNET_RECLAIM_Ticket::gns_name, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_GNS_LO_DEFAULT, GNUNET_GNS_lookup(), GNUNET_GNS_parse_ztld(), GNUNET_GNSRECORD_TYPE_ANY, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION, GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_RECLAIM_presentation_deserialize(), GNUNET_SCHEDULER_add_delayed(), GNUNET_STATISTICS_update(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_MINUTES, GNUNET_YES, ParallelLookup::handle, RECLAIM_TICKETS_ConsumeHandle::kill_task, ParallelLookup::label, GNUNET_RECLAIM_PresentationList::list_head, GNUNET_RECLAIM_PresentationList::list_tail, RECLAIM_TICKETS_ConsumeHandle::lookup_request, ParallelLookup::lookup_request, RECLAIM_TICKETS_ConsumeHandle::lookup_start_time, ParallelLookup::lookup_start_time, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_head, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_tail, GNUNET_RECLAIM_PresentationListEntry::presentation, RECLAIM_TICKETS_ConsumeHandle::presentations, process_parallel_lookup_result(), rd, rd_count, GNUNET_TIME_Relative::rel_value_us, RECLAIM_TICKETS_ConsumeHandle::rp_uri, stats, and RECLAIM_TICKETS_ConsumeHandle::ticket.
Referenced by RECLAIM_TICKETS_consume().
struct RECLAIM_TICKETS_ConsumeHandle * RECLAIM_TICKETS_consume | ( | const struct GNUNET_RECLAIM_Ticket * | ticket, |
const char * | rp_uri, | ||
RECLAIM_TICKETS_ConsumeCallback | cb, | ||
void * | cb_cls | ||
) |
Consume a ticket.
We first looking attribute references under the label ticket.rnd in GNS.
id | the audience of the ticket |
ticket | the ticket to consume |
cb | callback to call with attributes of ticket |
cb_cls | callback closure |
Definition at line 1218 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_ConsumeHandle::attrs, RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, gns, GNUNET_RECLAIM_Ticket::gns_name, GNUNET_GNS_LO_DEFAULT, GNUNET_GNS_lookup_with_tld(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_new, GNUNET_TIME_absolute_get(), lookup_authz_cb(), RECLAIM_TICKETS_ConsumeHandle::lookup_request, RECLAIM_TICKETS_ConsumeHandle::lookup_start_time, RECLAIM_TICKETS_ConsumeHandle::presentations, RECLAIM_TICKETS_ConsumeHandle::rp_uri, ticket, and RECLAIM_TICKETS_ConsumeHandle::ticket.
Referenced by handle_consume_ticket_message().
void RECLAIM_TICKETS_consume_cancel | ( | struct RECLAIM_TICKETS_ConsumeHandle * | cth | ) |
Cancel a consume operation.
cth | the operation to cancel |
Definition at line 1251 of file gnunet-service-reclaim_tickets.c.
References cleanup_cth().
Referenced by cleanup_client().
|
static |
Cleanup ticket consume handle.
handle | the handle to clean up |
Definition at line 1267 of file gnunet-service-reclaim_tickets.c.
References GNUNET_free, GNUNET_NAMESTORE_cancel(), and handle.
Referenced by filter_tickets_cb(), filter_tickets_error_cb(), and store_ticket_issue_cont().
|
static |
Store finished, abort on error.
Else, return new ticket to caller.
cls | handle to the operation |
success | store operation result |
emsg | error message (or NULL on success) |
Definition at line 1284 of file gnunet-service-reclaim_tickets.c.
References cleanup_issue_handle(), GNUNET_EC_NONE, GNUNET_OK, GNUNET_SYSERR, and handle.
Referenced by issue_ticket().
|
static |
Issue a new ticket.
We store references to attribute record labels and the ticket itself under the label base64(ticket.rnd).
ih | handle to the operation containing relevant metadata |
Definition at line 1314 of file gnunet-service-reclaim_tickets.c.
References GNUNET_RECLAIM_AttributeListEntry::attribute, TicketIssueHandle::attrs, GNUNET_RECLAIM_Attribute::credential, GNUNET_RECLAIM_Presentation::credential_id, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_RECLAIM_Ticket::gns_name, GNUNET_CRYPTO_key_get_public(), GNUNET_CRYPTO_public_key_to_string(), GNUNET_DNSPARSER_TYPE_TXT, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_log, GNUNET_malloc, GNUNET_NAMESTORE_record_set_store(), GNUNET_NO, GNUNET_RECLAIM_id_is_zero, GNUNET_RECLAIM_presentation_deserialize(), GNUNET_RECLAIM_presentation_serialize(), GNUNET_RECLAIM_presentation_serialize_get_size(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_Attribute::id, TicketIssueHandle::identity, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_PresentationList::list_head, GNUNET_RECLAIM_Attribute::name, GNUNET_RECLAIM_AttributeListEntry::next, GNUNET_RECLAIM_PresentationListEntry::next, TicketIssueHandle::ns_qe, nsh, GNUNET_RECLAIM_PresentationListEntry::presentation, TicketIssueHandle::presentations, pub, GNUNET_GNSRECORD_Data::record_type, GNUNET_TIME_Relative::rel_value_us, TicketIssueHandle::rnd, TicketIssueHandle::rp_uri, store_ticket_issue_cont(), TicketIssueHandle::ticket, and ticket_refresh_interval.
Referenced by filter_tickets_finished_cb().
|
static |
Namestore error on issue.
Abort.
cls | handle to the operation |
Definition at line 1482 of file gnunet-service-reclaim_tickets.c.
References TicketIssueHandle::cb, TicketIssueHandle::cb_cls, cleanup_issue_handle(), GNUNET_SYSERR, TicketIssueHandle::ns_it, and TicketIssueHandle::ticket.
Referenced by RECLAIM_TICKETS_issue().
|
static |
Iterator over records.
Check if any previously issued ticket already matches what we need to prevent duplicates and improve resolution synergy.
cls | handle to the operation |
zone | issuer identity |
label | ticket rnd |
rd_count | size of record set |
rd | record set |
If we found a matching ticket, return that to the caller and we are done.
Definition at line 1509 of file gnunet-service-reclaim_tickets.c.
References GNUNET_RECLAIM_AttributeListEntry::attribute, TicketIssueHandle::attrs, TicketIssueHandle::cb, TicketIssueHandle::cb_cls, cleanup_issue_handle(), cred, GNUNET_RECLAIM_Attribute::credential, GNUNET_RECLAIM_Presentation::credential_id, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, GNUNET_CONTAINER_DLL_insert, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL, GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_log, GNUNET_NAMESTORE_zone_iteration_stop(), GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_RECLAIM_credential_deserialize(), GNUNET_RECLAIM_credential_get_presentation(), GNUNET_RECLAIM_id_is_equal, GNUNET_RECLAIM_id_is_zero, GNUNET_RECLAIM_presentation_deserialize(), GNUNET_RECLAIM_presentation_list_destroy(), GNUNET_YES, GNUNET_RECLAIM_Attribute::id, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_PresentationList::list_head, GNUNET_RECLAIM_PresentationList::list_tail, GNUNET_RECLAIM_AttributeListEntry::next, TicketIssueHandle::ns_it, GNUNET_RECLAIM_PresentationListEntry::presentation, TicketIssueHandle::presentations, rd, rd_count, TicketIssueHandle::rp_uri, ticket, and TicketIssueHandle::ticket.
Referenced by RECLAIM_TICKETS_issue().
|
static |
Done iterating over tickets and we apparently did not find an existing, matching ticket.
Continue by issuing a new ticket.
cls | handle to the operation |
Definition at line 1665 of file gnunet-service-reclaim_tickets.c.
References GNUNET_RECLAIM_id_generate, issue_ticket(), and TicketIssueHandle::rnd.
Referenced by RECLAIM_TICKETS_issue().
void RECLAIM_TICKETS_issue | ( | const struct GNUNET_CRYPTO_PrivateKey * | identity, |
const struct GNUNET_RECLAIM_AttributeList * | attrs, | ||
const char * | rp, | ||
RECLAIM_TICKETS_TicketResult | cb, | ||
void * | cb_cls | ||
) |
Issue a new reclaim ticket, thereby authorizing the audience to access the set of provided attributes.
identity | the issuer |
attrs | the attributes to share |
audience | the audience to share the attributes with |
cb | the callback to call with the ticket result |
cb_cls | the callback closure FIXME: Return handle?? |
Definition at line 1686 of file gnunet-service-reclaim_tickets.c.
References TicketIssueHandle::attrs, TicketIssueHandle::cb, TicketIssueHandle::cb_cls, filter_tickets_cb(), filter_tickets_error_cb(), filter_tickets_finished_cb(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_new, GNUNET_RECLAIM_attribute_list_dup(), identity, TicketIssueHandle::identity, TicketIssueHandle::ns_it, nsh, TicketIssueHandle::presentations, rp, and TicketIssueHandle::rp_uri.
Referenced by handle_issue_ticket_message().
|
static |
Cleanup ticket iterator.
iter | handle to the iteration |
Definition at line 1725 of file gnunet-service-reclaim_tickets.c.
References GNUNET_free, GNUNET_NAMESTORE_zone_iteration_stop(), and RECLAIM_TICKETS_Iterator::ns_it.
Referenced by collect_tickets_error_cb(), collect_tickets_finished_cb(), and RECLAIM_TICKETS_iteration_stop().
|
static |
Return each record of type GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET to the caller and proceed with the iteration.
FIXME: Should we not proceed automatically here?
cls | handle to the iteration |
zone | the ticket issuer |
label | the ticket rnd |
rd_count | number of records in record set |
rd | record set containing a ticket |
Definition at line 1745 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_Iterator::cb, RECLAIM_TICKETS_Iterator::cb_cls, data, GNUNET_GNSRECORD_Data::data, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_NO, GNUNET_YES, RECLAIM_TICKETS_Iterator::ns_it, rd, rd_count, and ticket.
Referenced by RECLAIM_TICKETS_iteration_start().
|
static |
Signal ticket iteration has finished.
cls | handle to the iteration |
Definition at line 1779 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_Iterator::cb, RECLAIM_TICKETS_Iterator::cb_cls, cleanup_iter(), and RECLAIM_TICKETS_Iterator::ns_it.
Referenced by RECLAIM_TICKETS_iteration_start().
|
static |
Cancel ticket iteration on namestore error.
cls | the iteration handle |
Definition at line 1795 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_Iterator::cb, RECLAIM_TICKETS_Iterator::cb_cls, cleanup_iter(), and RECLAIM_TICKETS_Iterator::ns_it.
Referenced by RECLAIM_TICKETS_iteration_start().
void RECLAIM_TICKETS_iteration_next | ( | struct RECLAIM_TICKETS_Iterator * | iter | ) |
Continue ticket iteration.
iter | the iteration to continue |
Definition at line 1811 of file gnunet-service-reclaim_tickets.c.
References GNUNET_NAMESTORE_zone_iterator_next(), and RECLAIM_TICKETS_Iterator::ns_it.
Referenced by handle_ticket_iteration_next().
void RECLAIM_TICKETS_iteration_stop | ( | struct RECLAIM_TICKETS_Iterator * | iter | ) |
Stop a running ticket iteration.
iter | iteration to cancel |
Definition at line 1823 of file gnunet-service-reclaim_tickets.c.
References cleanup_iter(), GNUNET_NAMESTORE_zone_iteration_stop(), and RECLAIM_TICKETS_Iterator::ns_it.
Referenced by cleanup_client(), and handle_ticket_iteration_stop().
struct RECLAIM_TICKETS_Iterator * RECLAIM_TICKETS_iteration_start | ( | const struct GNUNET_CRYPTO_PrivateKey * | identity, |
RECLAIM_TICKETS_TicketIter | cb, | ||
void * | cb_cls | ||
) |
Iterate over all tickets issued by an identity.
identity | the issuing identity |
cb | ticket callback function |
cb_cls | callback closure |
Definition at line 1839 of file gnunet-service-reclaim_tickets.c.
References RECLAIM_TICKETS_Iterator::cb, RECLAIM_TICKETS_Iterator::cb_cls, collect_tickets_cb(), collect_tickets_error_cb(), collect_tickets_finished_cb(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_new, identity, RECLAIM_TICKETS_Iterator::ns_it, and nsh.
Referenced by handle_ticket_iteration_start().
int RECLAIM_TICKETS_init | ( | const struct GNUNET_CONFIGURATION_Handle * | c | ) |
Initialize tickets component.
c | the configuration |
Definition at line 1869 of file gnunet-service-reclaim_tickets.c.
References DEFAULT_TICKET_REFRESH_INTERVAL, gns, GNUNET_CONFIGURATION_get_value_time(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_GNS_connect(), GNUNET_log, GNUNET_log_strerror, GNUNET_NAMESTORE_connect(), GNUNET_OK, GNUNET_STATISTICS_create(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_SYSERR, GNUNET_YES, nsh, stats, and ticket_refresh_interval.
Referenced by run().
void RECLAIM_TICKETS_deinit | ( | void | ) |
Close handles and clean up.
FIXME: cancel all pending operations (gns, ns etc)
Definition at line 1911 of file gnunet-service-reclaim_tickets.c.
References gns, GNUNET_GNS_disconnect(), GNUNET_NAMESTORE_disconnect(), GNUNET_NO, GNUNET_STATISTICS_destroy(), nsh, and stats.
Referenced by cleanup().
|
static |
Ticket expiration interval.
Definition at line 341 of file gnunet-service-reclaim_tickets.c.
Referenced by issue_ticket(), and RECLAIM_TICKETS_init().
|
static |
Definition at line 345 of file gnunet-service-reclaim_tickets.c.
Referenced by issue_ticket(), move_attr_finished(), move_attrs(), process_tickets(), RECLAIM_TICKETS_deinit(), RECLAIM_TICKETS_init(), RECLAIM_TICKETS_issue(), RECLAIM_TICKETS_iteration_start(), RECLAIM_TICKETS_revoke(), revoke_attrs_cb(), and rvk_move_attr_cb().
|
static |
Definition at line 349 of file gnunet-service-reclaim_tickets.c.
Referenced by lookup_authz_cb(), RECLAIM_TICKETS_consume(), RECLAIM_TICKETS_deinit(), and RECLAIM_TICKETS_init().
|
static |
Definition at line 353 of file gnunet-service-reclaim_tickets.c.
Referenced by lookup_authz_cb(), process_parallel_lookup_result(), RECLAIM_TICKETS_deinit(), and RECLAIM_TICKETS_init().