/*
This file is part of GNUnet.
- (C) 2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2013 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Liceidentity as published
You should have received a copy of the GNU General Public Liceidentity
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
/**
* Private key associated with this ego.
*/
- struct GNUNET_CRYPTO_EccPrivateKey *pk;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
/**
* Current name associated with this ego.
const struct GNUNET_MessageHeader *msg;
/**
- * Continuation to invoke with the result of the transmission; 'cb'
+ * Continuation to invoke with the result of the transmission; @e cb
* will be NULL in this case.
*/
GNUNET_IDENTITY_Continuation cont;
/**
* Continuation to invoke with the result of the transmission for
- * 'get' operations ('cont' will be NULL in this case).
+ * 'get' operations (@e cont will be NULL in this case).
*/
GNUNET_IDENTITY_Callback cb;
/**
- * Closure for 'cont' or 'cb'.
+ * Closure for @e cont or @e cb.
*/
void *cls;
/**
* Task doing exponential back-off trying to reconnect.
*/
- GNUNET_SCHEDULER_TaskIdentifier reconnect_task;
+ struct GNUNET_SCHEDULER_Task * reconnect_task;
/**
* Time for next connect retry.
GNUNET_IDENTITY_ego_get_anonymous ()
{
static struct GNUNET_IDENTITY_Ego anon;
- struct GNUNET_CRYPTO_EccPublicSignKey pub;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pub;
if (NULL != anon.pk)
return &anon;
- anon.pk = (struct GNUNET_CRYPTO_EccPrivateKey *) GNUNET_CRYPTO_ecc_key_get_anonymous ();
- GNUNET_CRYPTO_ecc_key_get_public_for_signature (anon.pk,
+ anon.pk = (struct GNUNET_CRYPTO_EcdsaPrivateKey *) GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
+ GNUNET_CRYPTO_ecdsa_key_get_public (anon.pk,
&pub);
GNUNET_CRYPTO_hash (&pub, sizeof (pub), &anon.id);
return &anon;
static void
reschedule_connect (struct GNUNET_IDENTITY_Handle *h)
{
- GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK);
+ GNUNET_assert (h->reconnect_task == NULL);
if (NULL != h->th)
{
const struct GNUNET_IDENTITY_ResultCodeMessage *rcm;
const struct GNUNET_IDENTITY_UpdateMessage *um;
const struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
- struct GNUNET_CRYPTO_EccPublicSignKey pub;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pub;
struct GNUNET_HashCode id;
const char *str;
uint16_t size;
h->cb (h->cb_cls, NULL, NULL, NULL);
break;
}
- GNUNET_CRYPTO_ecc_key_get_public_for_signature (&um->private_key,
+ GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key,
&pub);
GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id);
if (0 == name_len)
return;
}
ego = GNUNET_new (struct GNUNET_IDENTITY_Ego);
- ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey);
+ ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
*ego->pk = um->private_key;
ego->name = GNUNET_strdup (str);
ego->id = id;
}
/* Note: we know which service this should be for, so we're not
really using 'str' henceforth */
- GNUNET_CRYPTO_ecc_key_get_public_for_signature (&sdm->private_key,
+ GNUNET_CRYPTO_ecdsa_key_get_public (&sdm->private_key,
&pub);
GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id);
ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
return;
}
op = h->op_head;
+ if (NULL == op)
+ {
+ GNUNET_break (0);
+ reschedule_connect (h);
+ return;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received SET_DEFAULT message from identity service\n");
GNUNET_CONTAINER_DLL_remove (h->op_head,
h->op_tail,
op);
struct GNUNET_IDENTITY_Operation *op;
struct GNUNET_MessageHeader msg;
- h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
+ h->reconnect_task = NULL;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Connecting to identity service.\n");
GNUNET_assert (NULL == h->client);
* @param ego the ego
* @return associated ECC key, valid as long as the ego is valid
*/
-const struct GNUNET_CRYPTO_EccPrivateKey *
+const struct GNUNET_CRYPTO_EcdsaPrivateKey *
GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
{
return ego->pk;
*/
void
GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_CRYPTO_EccPublicSignKey *pk)
+ struct GNUNET_CRYPTO_EcdsaPublicKey *pk)
{
- GNUNET_CRYPTO_ecc_key_get_public_for_signature (ego->pk,
+ GNUNET_CRYPTO_ecdsa_key_get_public (ego->pk,
pk);
}
{
struct GNUNET_IDENTITY_Operation *op;
struct GNUNET_IDENTITY_CreateRequestMessage *crm;
- struct GNUNET_CRYPTO_EccPrivateKey *pk;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
size_t slen;
slen = strlen (name) + 1;
- pk = GNUNET_CRYPTO_ecc_key_create ();
+ pk = GNUNET_CRYPTO_ecdsa_key_create ();
if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_CreateRequestMessage))
{
(NULL == h->client) )
{
/* request not active, can simply remove */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Client aborted non-head operation, simply removing it\n");
GNUNET_CONTAINER_DLL_remove (h->op_head,
h->op_tail,
op);
if (NULL != h->th)
{
/* request active but not yet with service, can still abort */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Client aborted head operation prior to transmission, aborting it\n");
GNUNET_CLIENT_notify_transmit_ready_cancel (h->th);
h->th = NULL;
GNUNET_CONTAINER_DLL_remove (h->op_head,
return;
}
/* request active with service, simply ensure continuations are not called */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Client aborted active request, NULLing continuation\n");
op->cont = NULL;
op->cb = NULL;
}
struct GNUNET_IDENTITY_Operation *op;
GNUNET_assert (NULL != h);
- while (NULL != (op = h->op_head))
- {
- GNUNET_CONTAINER_DLL_remove (h->op_head,
- h->op_tail,
- op);
- GNUNET_free (op);
- }
- if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK)
+ if (h->reconnect_task != NULL)
{
GNUNET_SCHEDULER_cancel (h->reconnect_task);
- h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
+ h->reconnect_task = NULL;
}
if (NULL != h->th)
{
GNUNET_CONTAINER_multihashmap_destroy (h->egos);
h->egos = NULL;
}
+ while (NULL != (op = h->op_head))
+ {
+ GNUNET_break (NULL == op->cont);
+ GNUNET_CONTAINER_DLL_remove (h->op_head,
+ h->op_tail,
+ op);
+ GNUNET_free (op);
+ }
if (NULL != h->client)
{
GNUNET_CLIENT_disconnect (h->client);