* Attribute iteration operations in
* progress initiated by this client
*/
- struct AttributeIterator *op_head;
+ struct AttributeIterator *attr_iter_head;
/**
* Tail of the DLL of
* Attribute iteration operations
* in progress initiated by this client
*/
- struct AttributeIterator *op_tail;
+ struct AttributeIterator *attr_iter_tail;
/**
* Head of DLL of ticket iteration ops
*/
struct TicketIteration *ticket_iter_tail;
-
/**
* Head of DLL of ticket revocation ops
*/
- struct TicketRevocationHandle *revocation_list_head;
+ struct TicketRevocationHandle *revoke_op_head;
/**
* Tail of DLL of ticket revocation ops
*/
- struct TicketRevocationHandle *revocation_list_tail;
-};
+ struct TicketRevocationHandle *revoke_op_tail;
+
+ /**
+ * Head of DLL of ticket issue ops
+ */
+ struct TicketIssueHandle *issue_op_head;
+
+ /**
+ * Tail of DLL of ticket issue ops
+ */
+ struct TicketIssueHandle *issue_op_tail;
+
+ /**
+ * Head of DLL of ticket consume ops
+ */
+ struct ConsumeTicketHandle *consume_op_head;
+
+ /**
+ * Tail of DLL of ticket consume ops
+ */
+ struct ConsumeTicketHandle *consume_op_tail;
+
+ /**
+ * Head of DLL of attribute store ops
+ */
+ struct AttributeStoreHandle *store_op_head;
+ /**
+ * Tail of DLL of attribute store ops
+ */
+ struct AttributeStoreHandle *store_op_tail;
+};
struct AttributeStoreHandle
{
+ /**
+ * DLL
+ */
+ struct AttributeStoreHandle *next;
+
+ /**
+ * DLL
+ */
+ struct AttributeStoreHandle *prev;
/**
* Client connection
struct ConsumeTicketHandle
{
+ /**
+ * DLL
+ */
+ struct ConsumeTicketHandle *next;
+
+ /**
+ * DLL
+ */
+ struct ConsumeTicketHandle *prev;
/**
* Client connection
/**
* DLL
*/
- struct TicketRevocationHandle *next;
+ struct TicketRevocationHandle *prev;
/**
* DLL
*/
- struct TicketRevocationHandle *prev;
+ struct TicketRevocationHandle *next;
/**
* Client connection
*/
struct TicketIssueHandle
{
+ /**
+ * DLL
+ */
+ struct TicketIssueHandle *prev;
+
+ /**
+ * DLL
+ */
+ struct TicketIssueHandle *next;
/**
* Client connection
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Cleaning up\n");
+
if (NULL != stats)
{
GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
return GNUNET_OK;
}
+/**
+ * Cleanup ticket consume handle
+ * @param handle the handle to clean up
+ */
static void
cleanup_ticket_issue_handle (struct TicketIssueHandle *handle)
{
struct TicketIssueHandle *handle = cls;
handle->ns_qe = NULL;
+ GNUNET_CONTAINER_DLL_remove (handle->client->issue_op_head,
+ handle->client->issue_op_tail,
+ handle);
if (GNUNET_SYSERR == success)
{
cleanup_ticket_issue_handle (handle);
ssize_t enc_size;
size = GNUNET_ABE_cpabe_serialize_key (rp_key,
- (void**)&serialized_key);
+ (void**)&serialized_key);
attrs_str_len = 0;
for (le = attrs->list_head; NULL != le; le = le->next) {
attrs_str_len += strlen (le->claim->name) + 1;
}
attrs[i] = NULL;
rp_key = GNUNET_ABE_cpabe_create_key (abe_key,
- attrs);
+ attrs);
//TODO review this wireformat
code_record_len = serialize_abe_keyinfo2 (&ih->ticket,
GNUNET_free (attrs);
GNUNET_free (code_record_data);
GNUNET_ABE_cpabe_delete_key (rp_key,
- GNUNET_YES);
+ GNUNET_YES);
GNUNET_ABE_cpabe_delete_master_key (abe_key);
}
ih->ticket.rnd =
GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG,
UINT64_MAX);
+ GNUNET_CONTAINER_DLL_insert (idp->issue_op_head,
+ idp->issue_op_tail,
+ ih);
bootstrap_abe (&ih->identity, &issue_ticket_after_abe_bootstrap, ih, GNUNET_NO);
GNUNET_SERVICE_client_continue (idp->client);
trm->success = htonl (success);
GNUNET_MQ_send (rh->client->mq,
env);
- GNUNET_CONTAINER_DLL_remove (rh->client->revocation_list_head,
- rh->client->revocation_list_tail,
+ GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
+ rh->client->revoke_op_tail,
rh);
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n",
"Unknown Error\n");
send_revocation_finished (rh, GNUNET_SYSERR);
+ GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
+ rh->client->revoke_op_tail,
+ rh);
cleanup_revoke_ticket_handle (rh);
return;
}
}
attr_arr[i] = NULL;
rp_key = GNUNET_ABE_cpabe_create_key (rh->abe_key,
- attr_arr);
+ attr_arr);
//TODO review this wireformat
code_record_len = serialize_abe_keyinfo2 (ticket,
if (GNUNET_NO == ret)
{
send_revocation_finished (rh, GNUNET_OK);
+ GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
+ rh->client->revoke_op_tail,
+ rh);
cleanup_revoke_ticket_handle (rh);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unable to check for existing attribute\n");
send_revocation_finished (rh, GNUNET_SYSERR);
+ GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
+ rh->client->revoke_op_tail,
+ rh);
cleanup_revoke_ticket_handle (rh);
}
size_t buf_size;
char* policy;
uint32_t attr_ver;
-
+
if (1 != rd_count) {
GNUNET_SCHEDULER_add_now (&reenc_next_attribute,
rh);
policy);
GNUNET_free (policy);
send_revocation_finished (rh, GNUNET_SYSERR);
+ GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
+ rh->client->revoke_op_tail,
+ rh);
cleanup_revoke_ticket_handle (rh);
return;
}
{
/* No attributes to reencrypt */
send_revocation_finished (rh, GNUNET_OK);
+ GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
+ rh->client->revoke_op_tail,
+ rh);
cleanup_revoke_ticket_handle (rh);
return;
} else {
rh->identity = rm->identity;
GNUNET_CRYPTO_ecdsa_key_get_public (&rh->identity,
&rh->ticket.identity);
- GNUNET_CONTAINER_DLL_insert (idp->revocation_list_head,
- idp->revocation_list_tail,
+ GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head,
+ idp->revoke_op_tail,
rh);
bootstrap_abe (&rh->identity, &get_ticket_after_abe_bootstrap, rh, GNUNET_NO);
GNUNET_SERVICE_client_continue (idp->client);
}
-
+/**
+ * Cleanup ticket consume handle
+ * @param handle the handle to clean up
+ */
static void
cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle)
{
GNUNET_IDENTITY_ATTRIBUTE_list_serialize (handle->attrs,
data_tmp);
GNUNET_MQ_send (handle->client->mq, env);
+ GNUNET_CONTAINER_DLL_remove (handle->client->consume_op_head,
+ handle->client->consume_op_tail,
+ handle);
cleanup_consume_ticket_handle (handle);
}
struct ParallelLookup *tmp;
struct AttributeResultMessage *arm;
struct GNUNET_MQ_Envelope *env;
-
+
handle->kill_task = NULL;
for (lu = handle->parallel_lookups_head;
NULL != lu;) {
"Number of keys %d != 1.",
rd_count);
cleanup_consume_ticket_handle (handle);
+ GNUNET_CONTAINER_DLL_remove (handle->client->consume_op_head,
+ handle->client->consume_op_tail,
+ handle);
GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
return;
}
GNUNET_GNS_LO_DEFAULT,
&process_consume_abe_key,
ch);
+ GNUNET_CONTAINER_DLL_insert (idp->consume_op_head,
+ idp->consume_op_tail,
+ ch);
GNUNET_free (rnd_label);
GNUNET_SERVICE_client_continue (idp->client);
}
+/**
+ * Cleanup attribute store handle
+ *
+ * @param handle handle to clean up
+ */
static void
cleanup_as_handle (struct AttributeStoreHandle *handle)
{
+ if (NULL != handle->ns_qe)
+ GNUNET_NAMESTORE_cancel (handle->ns_qe);
if (NULL != handle->claim)
GNUNET_free (handle->claim);
if (NULL != handle->abe_key)
struct AttributeStoreHandle *as_handle = cls;
struct GNUNET_MQ_Envelope *env;
struct AttributeStoreResultMessage *acr_msg;
+
+ as_handle->ns_qe = NULL;
+ GNUNET_CONTAINER_DLL_remove (as_handle->client->store_op_head,
+ as_handle->client->store_op_tail,
+ as_handle);
if (GNUNET_SYSERR == success)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to encrypt with policy %s\n",
policy);
+ GNUNET_CONTAINER_DLL_remove (as_handle->client->store_op_head,
+ as_handle->client->store_op_tail,
+ as_handle);
+
cleanup_as_handle (as_handle);
GNUNET_free (buf);
GNUNET_free (policy);
GNUNET_SERVICE_client_continue (idp->client);
as_handle->client = idp;
+ GNUNET_CONTAINER_DLL_insert (idp->store_op_head,
+ idp->store_op_tail,
+ as_handle);
bootstrap_abe (&as_handle->identity, &store_after_abe_bootstrap, as_handle, GNUNET_NO);
}
static void
-cleanup_iter_handle (struct AttributeIterator *ai)
+cleanup_attribute_iter_handle (struct AttributeIterator *ai)
{
if (NULL != ai->abe_key)
GNUNET_ABE_cpabe_delete_master_key (ai->abe_key);
- GNUNET_CONTAINER_DLL_remove (ai->client->op_head,
- ai->client->op_tail,
- ai);
GNUNET_free (ai);
}
//TODO
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to iterate over attributes\n");
- cleanup_iter_handle (ai);
+ GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
+ ai->client->attr_iter_tail,
+ ai);
+ cleanup_attribute_iter_handle (ai);
GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
}
arm->id = htonl (ai->request_id);
arm->attr_len = htons (0);
GNUNET_MQ_send (ai->client->mq, env);
- cleanup_iter_handle (ai);
+ GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
+ ai->client->attr_iter_tail,
+ ai);
+ cleanup_attribute_iter_handle (ai);
}
static void
ai->client = idp;
ai->identity = ais_msg->identity;
- GNUNET_CONTAINER_DLL_insert (idp->op_head,
- idp->op_tail,
+ GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head,
+ idp->attr_iter_tail,
ai);
bootstrap_abe (&ai->identity, &iterate_after_abe_bootstrap, ai, GNUNET_NO);
GNUNET_SERVICE_client_continue (idp->client);
"Received `%s' message\n",
"ATTRIBUTE_ITERATION_STOP");
rid = ntohl (ais_msg->id);
- for (ai = idp->op_head; NULL != ai; ai = ai->next)
+ for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
if (ai->request_id == rid)
break;
if (NULL == ai)
GNUNET_SERVICE_client_drop (idp->client);
return;
}
- GNUNET_CONTAINER_DLL_remove (idp->op_head,
- idp->op_tail,
+ GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head,
+ idp->attr_iter_tail,
ai);
GNUNET_free (ai);
GNUNET_SERVICE_client_continue (idp->client);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received ATTRIBUTE_ITERATION_NEXT message\n");
rid = ntohl (ais_msg->id);
- for (ai = idp->op_head; NULL != ai; ai = ai->next)
+ for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
if (ai->request_id == rid)
break;
if (NULL == ai)
struct AttributeIterator *ai;
struct TicketIteration *ti;
struct TicketRevocationHandle *rh;
+ struct TicketIssueHandle *iss;
+ struct ConsumeTicketHandle *ct;
+ struct AttributeStoreHandle *as;
//TODO other operations
"Client %p disconnected\n",
client);
- while (NULL != (ai = idp->op_head))
+ while (NULL != (iss = idp->issue_op_head))
+ {
+ GNUNET_CONTAINER_DLL_remove (idp->issue_op_head,
+ idp->issue_op_tail,
+ iss);
+ cleanup_ticket_issue_handle (iss);
+ }
+ while (NULL != (ct = idp->consume_op_head))
+ {
+ GNUNET_CONTAINER_DLL_remove (idp->consume_op_head,
+ idp->consume_op_tail,
+ ct);
+ cleanup_consume_ticket_handle (ct);
+ }
+ while (NULL != (as = idp->store_op_head))
+ {
+ GNUNET_CONTAINER_DLL_remove (idp->store_op_head,
+ idp->store_op_tail,
+ as);
+ cleanup_as_handle (as);
+ }
+
+ while (NULL != (ai = idp->attr_iter_head))
{
- GNUNET_CONTAINER_DLL_remove (idp->op_head,
- idp->op_tail,
+ GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head,
+ idp->attr_iter_tail,
ai);
- GNUNET_free (ai);
+ cleanup_attribute_iter_handle (ai);
}
- while (NULL != (rh = idp->revocation_list_head))
+ while (NULL != (rh = idp->revoke_op_head))
{
- GNUNET_CONTAINER_DLL_remove (idp->revocation_list_head,
- idp->revocation_list_tail,
+ GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head,
+ idp->revoke_op_tail,
rh);
cleanup_revoke_ticket_handle (rh);
}