GNUnet 0.22.2
Identity service

Identity management. More...

Collaboration diagram for Identity service:

Macros

#define GNUNET_IDENTITY_VERSION   0x00000100
 Version number of GNUnet Identity API. More...
 

Typedefs

typedef void(* GNUNET_IDENTITY_Callback) (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
 Method called to inform about the egos of this peer. More...
 
typedef void(* GNUNET_IDENTITY_Continuation) (void *cls, enum GNUNET_ErrorCode ec)
 Function called once the requested operation has been completed. More...
 
typedef void(* GNUNET_IDENTITY_CreateContinuation) (void *cls, const struct GNUNET_CRYPTO_PrivateKey *pk, enum GNUNET_ErrorCode ec)
 Function called once the requested operation has been completed. More...
 
typedef void(* GNUNET_IDENTITY_EgoCallback) (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 Function called with the result. More...
 
typedef void(* GNUNET_IDENTITY_EgoSuffixCallback) (void *cls, const struct GNUNET_CRYPTO_PrivateKey *priv, const char *ego_name)
 Function called with the result. More...
 

Functions

const struct GNUNET_CRYPTO_PrivateKeyGNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
 Obtain the ECC key associated with a ego. More...
 
struct GNUNET_IDENTITY_EgoGNUNET_IDENTITY_ego_get_anonymous (void)
 Obtain the ego representing 'anonymous' users. More...
 
void GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_CRYPTO_PublicKey *pk)
 Get the identifier (public key) of an ego. More...
 
const char * GNUNET_IDENTITY_ego_get_name (const struct GNUNET_IDENTITY_Ego *ego)
 Obtain the name associated with an ego. More...
 
struct GNUNET_IDENTITY_HandleGNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
 Connect to the identity service. More...
 
struct GNUNET_IDENTITY_OperationGNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id, const char *service_name, GNUNET_IDENTITY_Callback cb, void *cb_cls)
 Obtain the ego that is currently preferred/default for a service. More...
 
struct GNUNET_IDENTITY_OperationGNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id, const char *service_name, struct GNUNET_IDENTITY_Ego *ego, GNUNET_IDENTITY_Continuation cont, void *cont_cls)
 Set the preferred/default ego for a service. More...
 
void GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h)
 Disconnect from identity service. More...
 
struct GNUNET_IDENTITY_OperationGNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, const char *name, const struct GNUNET_CRYPTO_PrivateKey *privkey, enum GNUNET_CRYPTO_KeyType ktype, GNUNET_IDENTITY_CreateContinuation cont, void *cont_cls)
 Create a new ego with the given name. More...
 
struct GNUNET_IDENTITY_OperationGNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id, const char *old_name, const char *new_name, GNUNET_IDENTITY_Continuation cb, void *cb_cls)
 Renames an existing ego. More...
 
struct GNUNET_IDENTITY_OperationGNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, const char *name, GNUNET_IDENTITY_Continuation cb, void *cb_cls)
 Delete an existing ego. More...
 
void GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op)
 Cancel an identity operation. More...
 
struct GNUNET_IDENTITY_EgoLookupGNUNET_IDENTITY_ego_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, GNUNET_IDENTITY_EgoCallback cb, void *cb_cls)
 Lookup an ego by name. More...
 
void GNUNET_IDENTITY_ego_lookup_cancel (struct GNUNET_IDENTITY_EgoLookup *el)
 Abort ego lookup attempt. More...
 
struct GNUNET_IDENTITY_EgoSuffixLookupGNUNET_IDENTITY_ego_lookup_by_suffix (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *suffix, GNUNET_IDENTITY_EgoSuffixCallback cb, void *cb_cls)
 Obtain the ego with the maximum suffix match between the ego's name and the given domain name suffix. More...
 
void GNUNET_IDENTITY_ego_lookup_by_suffix_cancel (struct GNUNET_IDENTITY_EgoSuffixLookup *el)
 Abort ego suffix lookup attempt. More...
 

Detailed Description

Identity management.

Egos in GNUnet are ECDSA keys. You assume an ego by using (signing with) a particular private key. As GNUnet users are expected to have many egos, we need an identity service to allow users to manage their egos. The identity service manages the egos (private keys) of the local user; it does NOT manage egos of other users (public keys). For giving names to other users and manage their public keys securely, we use GNS.

See also
Documentation

Macro Definition Documentation

◆ GNUNET_IDENTITY_VERSION

#define GNUNET_IDENTITY_VERSION   0x00000100

Version number of GNUnet Identity API.

Definition at line 63 of file gnunet_identity_service.h.

Typedef Documentation

◆ GNUNET_IDENTITY_Callback

typedef void(* GNUNET_IDENTITY_Callback) (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)

Method called to inform about the egos of this peer.

When used with GNUNET_IDENTITY_connect, this function is initially called for all egos and then again whenever a ego's name changes or if it is deleted. At the end of the initial pass over all egos, the function is once called with 'NULL' for ego. That does NOT mean that the callback won't be invoked in the future or that there was an error.

When used with GNUNET_IDENTITY_create or GNUNET_IDENTITY_get, this function is only called ONCE, and 'NULL' being passed in ego does indicate an error (for example because name is taken or no default value is known). If ego is non-NULL and if '*ctx' is set in those callbacks, the value WILL be passed to a subsequent call to the identity callback of GNUNET_IDENTITY_connect (if that one was not NULL).

When an identity is renamed, this function is called with the (known) ego but the NEW name.

When an identity is deleted, this function is called with the (known) ego and "NULL" for the name. In this case, the ego is henceforth invalid (and the ctx should also be cleaned up).

Parameters
clsclosure
egoego handle
ctxcontext for application to store data for this ego (during the lifetime of this process, initially NULL)
namename assigned by the user for this ego, NULL if the user just deleted the ego and it must thus no longer be used

Definition at line 155 of file gnunet_identity_service.h.

◆ GNUNET_IDENTITY_Continuation

typedef void(* GNUNET_IDENTITY_Continuation) (void *cls, enum GNUNET_ErrorCode ec)

Function called once the requested operation has been completed.

Parameters
clsclosure
ecthe GNUNET_ErrorCode

Definition at line 199 of file gnunet_identity_service.h.

◆ GNUNET_IDENTITY_CreateContinuation

typedef void(* GNUNET_IDENTITY_CreateContinuation) (void *cls, const struct GNUNET_CRYPTO_PrivateKey *pk, enum GNUNET_ErrorCode ec)

Function called once the requested operation has been completed.

Parameters
clsclosure
pkprivate key, NULL on error
ecthe GNUNET_ErrorCode

Definition at line 239 of file gnunet_identity_service.h.

◆ GNUNET_IDENTITY_EgoCallback

typedef void(* GNUNET_IDENTITY_EgoCallback) (void *cls, struct GNUNET_IDENTITY_Ego *ego)

Function called with the result.

Parameters
clsclosure
egoNULL on error / ego not found

Definition at line 320 of file gnunet_identity_service.h.

◆ GNUNET_IDENTITY_EgoSuffixCallback

typedef void(* GNUNET_IDENTITY_EgoSuffixCallback) (void *cls, const struct GNUNET_CRYPTO_PrivateKey *priv, const char *ego_name)

Function called with the result.

Parameters
clsclosure
egoNULL on error / ego not found
ego_nameNULL on error, name of the ego otherwise

Definition at line 361 of file gnunet_identity_service.h.

Function Documentation

◆ GNUNET_IDENTITY_ego_get_private_key()

const struct GNUNET_CRYPTO_PrivateKey * GNUNET_IDENTITY_ego_get_private_key ( const struct GNUNET_IDENTITY_Ego ego)

◆ GNUNET_IDENTITY_ego_get_anonymous()

struct GNUNET_IDENTITY_Ego * GNUNET_IDENTITY_ego_get_anonymous ( void  )

Obtain the ego representing 'anonymous' users.

Returns
handle for the anonymous user, MUST NOT be freed

Definition at line 157 of file identity_api.c.

158{
159 static struct GNUNET_IDENTITY_Ego anon;
160 static int setup;
161 ssize_t key_len;
162
163 if (setup)
164 return &anon;
165 anon.pk.type = htonl (GNUNET_PUBLIC_KEY_TYPE_ECDSA);
166 anon.pub.type = htonl (GNUNET_PUBLIC_KEY_TYPE_ECDSA);
167 anon.pk.ecdsa_key = *GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
168 key_len = GNUNET_CRYPTO_private_key_get_length (&anon.pk);
169 GNUNET_assert (0 < key_len);
170 GNUNET_CRYPTO_hash (&anon.pk,
171 key_len,
172 &anon.id);
173 setup = 1;
174 return &anon;
175}
const struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_CRYPTO_ecdsa_key_get_anonymous(void)
Get the shared private key we use for anonymous users.
Definition: crypto_ecc.c:500
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
ssize_t GNUNET_CRYPTO_private_key_get_length(const struct GNUNET_CRYPTO_PrivateKey *key)
Get the compacted length of a GNUNET_CRYPTO_PrivateKey.
Definition: crypto_pkey.c:64
@ GNUNET_PUBLIC_KEY_TYPE_ECDSA
The identity type.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Handle for an ego.
Definition: identity.h:37

References GNUNET_CRYPTO_PrivateKey::ecdsa_key, GNUNET_assert, GNUNET_CRYPTO_ecdsa_key_get_anonymous(), GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_private_key_get_length(), GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_IDENTITY_Ego::id, GNUNET_IDENTITY_Ego::pk, GNUNET_IDENTITY_Ego::pub, httpdomain.autohttp.bottle::setup(), GNUNET_CRYPTO_PrivateKey::type, and GNUNET_CRYPTO_PublicKey::type.

Referenced by get_anonymous_private_key(), and get_anonymous_public_key().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_IDENTITY_ego_get_public_key()

void GNUNET_IDENTITY_ego_get_public_key ( struct GNUNET_IDENTITY_Ego ego,
struct GNUNET_CRYPTO_PublicKey pk 
)

Get the identifier (public key) of an ego.

Parameters
egoidentity handle with the private key
pkset to ego's public key

Definition at line 529 of file identity_api.c.

531{
532 if (GNUNET_NO == ego->pub_initialized)
533 {
534 GNUNET_CRYPTO_key_get_public (&ego->pk, &ego->pub);
536 }
537 *pk = ego->pub;
538}
struct GNUNET_CRYPTO_PrivateKey pk
Private key from command line option, or NULL.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_key_get_public(const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: crypto_pkey.c:430
@ GNUNET_YES
@ GNUNET_NO
bool pub_initialized
Set to true once pub was initialized.
Definition: identity.h:66
struct GNUNET_CRYPTO_PublicKey pub
The identity key pair.
Definition: identity.h:46

References GNUNET_CRYPTO_key_get_public(), GNUNET_NO, GNUNET_YES, pk, GNUNET_IDENTITY_Ego::pk, GNUNET_IDENTITY_Ego::pub, and GNUNET_IDENTITY_Ego::pub_initialized.

Referenced by code_redirect(), DID_create(), DID_ego_to_did(), DID_identity_to_did(), DID_identity_to_did_document(), ego_callback(), find_ego(), get_anonymous_public_key(), get_ego(), get_identity_for_string(), id_connect_cb(), list_ego(), print_ego(), revoke_ticket_cont(), and store_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_IDENTITY_ego_get_name()

const char * GNUNET_IDENTITY_ego_get_name ( const struct GNUNET_IDENTITY_Ego ego)

Obtain the name associated with an ego.

Parameters
egothe ego
Returns
associated name, valid as long as the ego is valid

◆ GNUNET_IDENTITY_connect()

struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect ( const struct GNUNET_CONFIGURATION_Handle cfg,
GNUNET_IDENTITY_Callback  cb,
void *  cb_cls 
)

Connect to the identity service.

Parameters
cfgConfiguration to contact the identity service.
cbfunction to call on all identity events, can be NULL
cb_clsclosure for cb
Returns
handle to communicate with identity service
Parameters
cfgthe configuration to use
cbfunction to call on all identity events, can be NULL
cb_clsclosure for cb
Returns
handle to use

Definition at line 487 of file identity_api.c.

490{
492
494 h->cfg = cfg;
495 h->cb = cb;
496 h->cb_cls = cb_cls;
498 GNUNET_YES);
499 reconnect (h);
500 if (NULL == h->mq)
501 {
502 GNUNET_free (h);
503 return NULL;
504 }
505 return h;
506}
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:98
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
static void reconnect(void *cls)
Try again to connect to the identity service.
Definition: identity_api.c:440
struct GNUNET_MQ_Handle * mq
Our connection to the ARM service.
Definition: arm_api.c:107
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration that we are using.
Definition: arm_api.c:112
Handle for the service.
Definition: identity_api.c:97
GNUNET_IDENTITY_Callback cb
Function to call when we receive updates.
Definition: identity_api.c:117
void * cb_cls
Closure for cb.
Definition: identity_api.c:122

References GNUNET_IDENTITY_Handle::cb, GNUNET_IDENTITY_Handle::cb_cls, cfg, GNUNET_ARM_Handle::cfg, GNUNET_CONTAINER_multihashmap_create(), GNUNET_free, GNUNET_new, GNUNET_YES, h, GNUNET_ARM_Handle::mq, and reconnect().

Referenced by REST_identity_init(), REST_namestore_init(), REST_openid_init(), REST_reclaim_init(), and run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_IDENTITY_get()

struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_get ( struct GNUNET_IDENTITY_Handle id,
const char *  service_name,
GNUNET_IDENTITY_Callback  cb,
void *  cb_cls 
)

Obtain the ego that is currently preferred/default for a service.

Parameters
ididentity service to query
service_namefor which service is an identity wanted
cbfunction to call with the result (will only be called once)
cb_clsclosure for cb
Returns
handle to abort the operation

◆ GNUNET_IDENTITY_set()

struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_set ( struct GNUNET_IDENTITY_Handle id,
const char *  service_name,
struct GNUNET_IDENTITY_Ego ego,
GNUNET_IDENTITY_Continuation  cont,
void *  cont_cls 
)

Set the preferred/default ego for a service.

Parameters
ididentity service to inform
service_namefor which service is an identity set
egonew default identity to be set for this service
contfunction to call once the operation finished
cont_clsclosure for cont
Returns
handle to abort the operation

◆ GNUNET_IDENTITY_disconnect()

void GNUNET_IDENTITY_disconnect ( struct GNUNET_IDENTITY_Handle h)

Disconnect from identity service.

Parameters
hidentity service to disconnect
hhandle to destroy

Definition at line 732 of file identity_api.c.

733{
735
736 GNUNET_assert (NULL != h);
737 if (h->reconnect_task != NULL)
738 {
740 h->reconnect_task = NULL;
741 }
742 if (NULL != h->egos)
743 {
745 &free_ego,
746 h);
748 h->egos = NULL;
749 }
750 while (NULL != (op = h->op_head))
751 {
752 GNUNET_break (NULL == op->cont);
753 GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
754 memset (&op->pk,
755 0,
756 sizeof (op->pk));
757 GNUNET_free (op);
758 }
759 if (NULL != h->mq)
760 {
762 h->mq = NULL;
763 }
764 GNUNET_free (h);
765}
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:143
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:700
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:980
static int free_ego(void *cls, const struct GNUNET_HashCode *key, void *value)
Free ego from hash map.
Definition: identity_api.c:197
struct GNUNET_SCHEDULER_Task * reconnect_task
ID of the reconnect task (if any).
Definition: arm_api.c:147
Handle for an operation with the identity service.
Definition: identity_api.c:41

References free_ego(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), h, GNUNET_ARM_Handle::mq, op, and GNUNET_ARM_Handle::reconnect_task.

Referenced by cleanup(), do_cleanup(), do_shutdown(), do_stop_task(), process_stdin(), REST_identity_done(), REST_namestore_done(), REST_openid_done(), REST_reclaim_done(), and shutdown_task().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_IDENTITY_create()

struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_create ( struct GNUNET_IDENTITY_Handle id,
const char *  name,
const struct GNUNET_CRYPTO_PrivateKey privkey,
enum GNUNET_CRYPTO_KeyType  ktype,
GNUNET_IDENTITY_CreateContinuation  cont,
void *  cont_cls 
)

Create a new ego with the given name.

Parameters
ididentity service to use
namedesired name
privkeydesired private key or NULL to create one
ktypethe type of key to create. Ignored if privkey != NULL.
contfunction to call with the result (will only be called once)
cont_clsclosure for cont
Returns
handle to abort the operation

Definition at line 561 of file identity_api.c.

567{
568 struct GNUNET_CRYPTO_PrivateKey private_key;
570 struct GNUNET_MQ_Envelope *env;
571 struct CreateRequestMessage *crm;
572 size_t slen;
573 size_t key_len;
574
575 if (NULL == h->mq)
576 return NULL;
577 slen = strlen (name) + 1;
578 if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof(struct CreateRequestMessage))
579 {
580 GNUNET_break (0);
581 return NULL;
582 }
584 op->h = h;
585 op->create_cont = cont;
586 op->cls = cont_cls;
587 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
588 if (NULL == privkey)
589 {
591 private_key_create (ktype, &private_key));
592 }
593 else
594 private_key = *privkey;
596 env = GNUNET_MQ_msg_extra (crm, slen + key_len,
598 crm->name_len = htons (slen);
600 &crm[1],
601 key_len);
602 crm->key_len = htons (key_len);
603 op->pk = private_key;
604 GNUNET_memcpy ((char*) &crm[1] + key_len, name, slen);
606 return op;
607}
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static char * name
Name (label) of the records to list.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
ssize_t GNUNET_CRYPTO_write_private_key_to_buffer(const struct GNUNET_CRYPTO_PrivateKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PrivateKey to a compact buffer.
Definition: crypto_pkey.c:172
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_OK
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:305
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
Definition: gnunet_mq_lib.h:61
#define GNUNET_MESSAGE_TYPE_IDENTITY_CREATE
627 and 628 unused
static enum GNUNET_GenericReturnValue private_key_create(enum GNUNET_CRYPTO_KeyType ktype, struct GNUNET_CRYPTO_PrivateKey *key)
Definition: identity_api.c:541
Client requests creation of an identity.
Definition: identity.h:151
uint16_t name_len
Number of bytes in identity name string including 0-termination, in NBO.
Definition: identity.h:160
uint16_t key_len
Key length.
Definition: identity.h:165
struct GNUNET_ARM_Handle * h
ARM handle.
Definition: arm_api.c:55
A private key for an identity as per LSD0001.

References env, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_IDENTITY_CREATE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_OK, h, GNUNET_ARM_Operation::h, CreateRequestMessage::key_len, GNUNET_ARM_Handle::mq, name, CreateRequestMessage::name_len, op, and private_key_create().

Referenced by create_did_ego_lockup_cb(), ego_create(), origin_lookup_cb(), and run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_IDENTITY_rename()

struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_rename ( struct GNUNET_IDENTITY_Handle h,
const char *  old_name,
const char *  new_name,
GNUNET_IDENTITY_Continuation  cb,
void *  cb_cls 
)

Renames an existing ego.

Parameters
ididentity service to use
old_nameold name
new_namedesired new name
cbfunction to call with the result (will only be called once)
cb_clsclosure for cb
Returns
handle to abort the operation

Renames an existing ego.

Parameters
hidentity service to use
old_nameold name
new_namedesired new name
cbfunction to call with the result (will only be called once)
cb_clsclosure for cb
Returns
handle to abort the operation

Definition at line 621 of file identity_api.c.

626{
628 struct GNUNET_MQ_Envelope *env;
629 struct RenameMessage *grm;
630 size_t slen_old;
631 size_t slen_new;
632 char *dst;
633
634 if (NULL == h->mq)
635 return NULL;
636 slen_old = strlen (old_name) + 1;
637 slen_new = strlen (new_name) + 1;
638 if ((slen_old >= GNUNET_MAX_MESSAGE_SIZE) ||
639 (slen_new >= GNUNET_MAX_MESSAGE_SIZE) ||
640 (slen_old + slen_new >=
641 GNUNET_MAX_MESSAGE_SIZE - sizeof(struct RenameMessage)))
642 {
643 GNUNET_break (0);
644 return NULL;
645 }
647 op->h = h;
648 op->cont = cb;
649 op->cls = cb_cls;
650 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
652 slen_old + slen_new,
654 grm->old_name_len = htons (slen_old);
655 grm->new_name_len = htons (slen_new);
656 dst = (char *) &grm[1];
657 GNUNET_memcpy (dst, old_name, slen_old);
658 GNUNET_memcpy (&dst[slen_old], new_name, slen_new);
660 return op;
661}
#define GNUNET_MESSAGE_TYPE_IDENTITY_RENAME
Rename existing identity (client->service).
Client requests renaming of an identity.
Definition: identity.h:178
uint16_t old_name_len
Number of characters in the old name including 0-termination, in NBO.
Definition: identity.h:187
uint16_t new_name_len
Number of characters in the new name including 0-termination, in NBO.
Definition: identity.h:192

References env, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_IDENTITY_RENAME, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_ARM_Operation::h, GNUNET_ARM_Handle::mq, RenameMessage::new_name_len, RenameMessage::old_name_len, and op.

Referenced by ego_edit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_IDENTITY_delete()

struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_delete ( struct GNUNET_IDENTITY_Handle h,
const char *  name,
GNUNET_IDENTITY_Continuation  cb,
void *  cb_cls 
)

Delete an existing ego.

Parameters
ididentity service to use
namename of the identity to delete
cbfunction to call with the result (will only be called once)
cb_clsclosure for cb
Returns
handle to abort the operation

Delete an existing ego.

Parameters
hidentity service to use
namename of the identity to delete
cbfunction to call with the result (will only be called once)
cb_clsclosure for cb
Returns
handle to abort the operation

Definition at line 674 of file identity_api.c.

678{
680 struct GNUNET_MQ_Envelope *env;
681 struct DeleteMessage *gdm;
682 size_t slen;
683
684 if (NULL == h->mq)
685 return NULL;
686 slen = strlen (name) + 1;
687 if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof(struct DeleteMessage))
688 {
689 GNUNET_break (0);
690 return NULL;
691 }
693 op->h = h;
694 op->cont = cb;
695 op->cls = cb_cls;
696 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
698 gdm->name_len = htons (slen);
699 gdm->reserved = htons (0);
700 GNUNET_memcpy (&gdm[1], name, slen);
702 return op;
703}
#define GNUNET_MESSAGE_TYPE_IDENTITY_DELETE
Delete identity (client->service).
Client requests deletion of an identity.
Definition: identity.h:204
uint16_t name_len
Number of characters in the name including 0-termination, in NBO.
Definition: identity.h:213
uint16_t reserved
Always zero.
Definition: identity.h:218

References env, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_IDENTITY_DELETE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_ARM_Operation::h, GNUNET_ARM_Handle::mq, name, DeleteMessage::name_len, op, and DeleteMessage::reserved.

Referenced by ego_delete_name(), ego_delete_pubkey(), and run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_IDENTITY_cancel()

void GNUNET_IDENTITY_cancel ( struct GNUNET_IDENTITY_Operation op)

Cancel an identity operation.

Note that the operation MAY still be executed; this merely cancels the continuation; if the request was already transmitted, the service may still choose to complete the operation.

Parameters
opoperation to cancel

Definition at line 715 of file identity_api.c.

716{
717 op->cont = NULL;
718 op->cb = NULL;
719 op->create_cont = NULL;
720 memset (&op->pk,
721 0,
722 sizeof (op->pk));
723}

References op.

Referenced by do_shutdown(), and shutdown_task().

Here is the caller graph for this function:

◆ GNUNET_IDENTITY_ego_lookup()

struct GNUNET_IDENTITY_EgoLookup * GNUNET_IDENTITY_ego_lookup ( const struct GNUNET_CONFIGURATION_Handle cfg,
const char *  name,
GNUNET_IDENTITY_EgoCallback  cb,
void *  cb_cls 
)

Lookup an ego by name.

Parameters
cfgconfiguration to use
namename to look up
cbcallback to invoke with the result
cb_clsclosure for cb
Returns
NULL on error

Definition at line 186 of file identity_api_lookup.c.

190{
192 struct GNUNET_MQ_Envelope *env;
193 struct GNUNET_MessageHeader *req;
194 size_t nlen;
195
196 GNUNET_assert (NULL != cb);
198 el->cb = cb;
199 el->cb_cls = cb_cls;
200 {
202 { GNUNET_MQ_hd_var_size (identity_result_code,
204 struct ResultCodeMessage,
205 el),
206 GNUNET_MQ_hd_var_size (identity_update,
208 struct UpdateMessage,
209 el),
211
212 el->mq =
214 }
215 if (NULL == el->mq)
216 {
217 GNUNET_break (0);
218 GNUNET_free (el);
219 return NULL;
220 }
222 nlen = strlen (name) + 1;
224 memcpy (&req[1], name, nlen);
226 return el;
227}
struct GNUNET_MQ_MessageHandlers handlers[]
Definition: 003.c:1
static struct GNUNET_IDENTITY_EgoLookup * el
Handle to identity lookup.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:1060
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP
First message send from identity client to service to lookup a single ego.
#define GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE
Generic response from identity service with success and/or error message.
#define GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE
Update about identity status from service to clients.
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
Handle for ego lookup.
struct GNUNET_MQ_Handle * mq
Connection to service.
void * cb_cls
Closure for cb.
char * name
Name of the ego we are looking up.
GNUNET_IDENTITY_EgoCallback cb
Function to call with the result.
Message handler for a specific message type.
Header for all communications.
Answer from service to client about last operation; GET_DEFAULT maybe answered with this message on f...
Definition: identity.h:81
Service informs client about status of a pseudonym.
Definition: identity.h:114

References GNUNET_IDENTITY_EgoLookup::cb, GNUNET_IDENTITY_EgoLookup::cb_cls, cfg, el, env, GNUNET_assert, GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_free, GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP, GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_strdup, handlers, GNUNET_IDENTITY_EgoLookup::mq, mq_error_handler(), name, and GNUNET_IDENTITY_EgoLookup::name.

Referenced by add_continuation(), create_did(), create_did_ego_create_cb(), ego_sign_data(), parse(), remove_did_document(), replace_did_document_remove_cb(), and run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_IDENTITY_ego_lookup_cancel()

void GNUNET_IDENTITY_ego_lookup_cancel ( struct GNUNET_IDENTITY_EgoLookup el)

Abort ego lookup attempt.

Parameters
elhandle for lookup to abort

Definition at line 236 of file identity_api_lookup.c.

237{
240 GNUNET_free (el);
241}

References el, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_IDENTITY_EgoLookup::mq, and GNUNET_IDENTITY_EgoLookup::name.

Referenced by do_shutdown(), handle_identity_result_code(), handle_identity_update(), and shutdown_hook().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_IDENTITY_ego_lookup_by_suffix()

struct GNUNET_IDENTITY_EgoSuffixLookup * GNUNET_IDENTITY_ego_lookup_by_suffix ( const struct GNUNET_CONFIGURATION_Handle cfg,
const char *  suffix,
GNUNET_IDENTITY_EgoSuffixCallback  cb,
void *  cb_cls 
)

Obtain the ego with the maximum suffix match between the ego's name and the given domain name suffix.

For example, given a suffix "a.b.c" and egos with names "d.a.b.c", "b.c" and "c", we return the ego for "b.c".

Parameters
cfgconfiguration to use
suffixfor which domain name suffix is an identity wanted
cbfunction to call with the result (will only be called once)
cb_clsclosure for cb
Returns
handle to abort the operation

Obtain the ego with the maximum suffix match between the ego's name and the given domain name suffix.

Parameters
cfgconfiguration to use
namename to look up
cbcallback to invoke with the result
cb_clsclosure for cb
Returns
NULL on error

Definition at line 185 of file identity_api_suffix_lookup.c.

190{
192 struct GNUNET_MQ_Envelope *env;
193 struct GNUNET_MessageHeader *req;
194 size_t nlen;
195
196 GNUNET_assert (NULL != cb);
198 el->cb = cb;
199 el->cb_cls = cb_cls;
200 {
202 { GNUNET_MQ_hd_var_size (identity_result_code,
204 struct ResultCodeMessage,
205 el),
206 GNUNET_MQ_hd_var_size (identity_update,
208 struct UpdateMessage,
209 el),
211
212 el->mq =
214 }
215 if (NULL == el->mq)
216 {
217 GNUNET_break (0);
218 GNUNET_free (el);
219 return NULL;
220 }
221 el->suffix = GNUNET_strdup (suffix);
222 nlen = strlen (suffix) + 1;
223 env = GNUNET_MQ_msg_extra (req, nlen,
225 memcpy (&req[1], suffix, nlen);
227 return el;
228}
#define GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP_BY_SUFFIX
First message send from identity client to service to lookup a single ego matching the given suffix (...
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...

References GNUNET_IDENTITY_EgoLookup::cb, GNUNET_IDENTITY_EgoLookup::cb_cls, cfg, el, env, GNUNET_assert, GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_free, GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP_BY_SUFFIX, GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_strdup, handlers, GNUNET_IDENTITY_EgoLookup::mq, and mq_error_handler().

Referenced by GNUNET_GNS_lookup_with_tld().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_IDENTITY_ego_lookup_by_suffix_cancel()

void GNUNET_IDENTITY_ego_lookup_by_suffix_cancel ( struct GNUNET_IDENTITY_EgoSuffixLookup el)

Abort ego suffix lookup attempt.

Parameters
elhandle for lookup to abort

Abort ego suffix lookup attempt.

Parameters
elhandle for lookup to abort

Definition at line 237 of file identity_api_suffix_lookup.c.

239{
241 GNUNET_free (el->suffix);
242 GNUNET_free (el);
243}

References el, GNUNET_free, GNUNET_MQ_destroy(), and GNUNET_IDENTITY_EgoLookup::mq.

Referenced by GNUNET_GNS_lookup_with_tld_cancel(), handle_identity_result_code(), handle_identity_update(), and mq_error_handler().

Here is the call graph for this function:
Here is the caller graph for this function: