api to interact with the identity service More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_constants.h"
#include "gnunet_error_codes.h"
#include "gnunet_protocols.h"
#include "gnunet_identity_service.h"
#include "identity.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_IDENTITY_Operation |
Handle for an operation with the identity service. More... | |
struct | GNUNET_IDENTITY_Handle |
Handle for the service. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "identity-api", __VA_ARGS__) |
Functions | |
struct GNUNET_IDENTITY_Ego * | GNUNET_IDENTITY_ego_get_anonymous () |
Obtain the ego representing 'anonymous' users. More... | |
static void | reconnect (void *cls) |
Try again to connect to the identity service. More... | |
static int | free_ego (void *cls, const struct GNUNET_HashCode *key, void *value) |
Free ego from hash map. More... | |
static void | reschedule_connect (struct GNUNET_IDENTITY_Handle *h) |
Reschedule a connect attempt to the service. More... | |
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 creation of the message queue. More... | |
static void | handle_identity_result_code (void *cls, const struct ResultCodeMessage *rcm) |
We received a result code from the service. More... | |
static int | check_identity_update (void *cls, const struct UpdateMessage *um) |
Check validity of identity update message. More... | |
static void | handle_identity_update (void *cls, const struct UpdateMessage *um) |
Handle identity update message. More... | |
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. More... | |
const struct GNUNET_CRYPTO_PrivateKey * | GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) |
Obtain the ECC key associated with a ego. 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... | |
static enum GNUNET_GenericReturnValue | private_key_create (enum GNUNET_CRYPTO_KeyType ktype, struct GNUNET_CRYPTO_PrivateKey *key) |
struct GNUNET_IDENTITY_Operation * | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, 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_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 identity. More... | |
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 identity. More... | |
void | GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) |
Cancel an identity operation. More... | |
void | GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h) |
Disconnect from identity service. More... | |
api to interact with the identity service
Definition in file identity_api.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "identity-api", __VA_ARGS__) |
Definition at line 34 of file identity_api.c.
|
static |
Try again to connect to the identity service.
cls | handle to the identity service. |
Definition at line 440 of file identity_api.c.
References GNUNET_ARM_Handle::cfg, env, GNUNET_assert, GNUNET_CLIENT_connect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, GNUNET_MESSAGE_TYPE_IDENTITY_START, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), h, handlers, LOG, GNUNET_ARM_Handle::mq, mq_error_handler(), msg, and GNUNET_ARM_Handle::reconnect_task.
Referenced by GNUNET_IDENTITY_connect(), and reschedule_connect().
|
static |
Free ego from hash map.
cls | identity service handle |
key | unused |
value | ego to free |
Definition at line 197 of file identity_api.c.
References GNUNET_IDENTITY_Ego::ctx, GNUNET_assert, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_OK, GNUNET_YES, h, key, GNUNET_IDENTITY_Ego::name, and value.
Referenced by GNUNET_IDENTITY_disconnect(), and reschedule_connect().
|
static |
Reschedule a connect attempt to the service.
h | transport service to reconnect |
Definition at line 224 of file identity_api.c.
References free_ego(), GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_EC_SERVICE_COMMUNICATION_FAILED, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_STD_BACKOFF, GNUNET_YES, h, LOG, GNUNET_ARM_Handle::mq, op, reconnect(), and GNUNET_ARM_Handle::reconnect_task.
Referenced by handle_identity_result_code(), handle_identity_update(), and mq_error_handler().
|
static |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
cls | closure with the struct GNUNET_IDENTITY_Handle * |
error | error code |
Definition at line 275 of file identity_api.c.
References h, and reschedule_connect().
Referenced by reconnect().
|
static |
We received a result code from the service.
cls | closure |
rcm | result message received |
Definition at line 291 of file identity_api.c.
References GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_EC_NONE, GNUNET_free, h, op, reschedule_connect(), and ResultCodeMessage::result_code.
|
static |
Check validity of identity update message.
cls | closure |
um | message received |
Definition at line 324 of file identity_api.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, UpdateMessage::header, UpdateMessage::name_len, GNUNET_MessageHeader::size, and size.
|
static |
Handle identity update message.
cls | closure |
um | message received |
Definition at line 348 of file identity_api.c.
References GNUNET_IDENTITY_Ego::ctx, UpdateMessage::end_of_list, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_read_private_key_from_buffer(), GNUNET_free, GNUNET_new, GNUNET_NO, GNUNET_strdup, GNUNET_SYSERR, GNUNET_YES, h, id, GNUNET_IDENTITY_Ego::id, UpdateMessage::key_len, GNUNET_IDENTITY_Ego::name, UpdateMessage::name_len, GNUNET_IDENTITY_Ego::pk, GNUNET_IDENTITY_Ego::pub_initialized, and reschedule_connect().
|
static |
Definition at line 541 of file identity_api.c.
References GNUNET_break, GNUNET_CRYPTO_ecdsa_key_create(), GNUNET_CRYPTO_eddsa_key_create(), GNUNET_OK, GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SYSERR, and key.
Referenced by GNUNET_IDENTITY_create().