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. | |
| const char * | GNUNET_IDENTITY_ego_get_name (const struct GNUNET_IDENTITY_Ego *ego) |
| Obtain the name associated with an ego. | |
| static void | reconnect (void *cls) |
| Try again to connect to the identity service. | |
| static int | free_ego (void *cls, const struct GNUNET_HashCode *key, void *value) |
| Free ego from hash map. | |
| static void | reschedule_connect (struct GNUNET_IDENTITY_Handle *h) |
| Reschedule a connect attempt to the service. | |
| 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. | |
| static void | handle_identity_result_code (void *cls, const struct ResultCodeMessage *rcm) |
| We received a result code from the service. | |
| static int | check_identity_update (void *cls, const struct UpdateMessage *um) |
| Check validity of identity update message. | |
| static void | handle_identity_update (void *cls, const struct UpdateMessage *um) |
| Handle identity update message. | |
| 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. | |
| const struct GNUNET_CRYPTO_BlindablePrivateKey * | GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) |
| Obtain the ECC key associated with a ego. | |
| void | GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_CRYPTO_BlindablePublicKey *pk) |
| Get the identifier (public key) of an ego. | |
| static enum GNUNET_GenericReturnValue | private_key_create (enum GNUNET_CRYPTO_KeyType ktype, struct GNUNET_CRYPTO_BlindablePrivateKey *key) |
| struct GNUNET_IDENTITY_Operation * | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, const char *name, const struct GNUNET_CRYPTO_BlindablePrivateKey *privkey, enum GNUNET_CRYPTO_KeyType ktype, GNUNET_IDENTITY_CreateContinuation cont, void *cont_cls) |
| Create a new ego with the given name. | |
| 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. | |
| 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. | |
| void | GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op) |
| Cancel an identity operation. | |
| void | GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h) |
| Disconnect from identity service. | |
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 446 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.
|
static |
Free ego from hash map.
| cls | identity service handle |
| key | unused |
| value | ego to free |
Definition at line 203 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 230 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 281 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 297 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 330 of file identity_api.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, UpdateMessage::header, UpdateMessage::name_len, GNUNET_MessageHeader::size, size, and str.
|
static |
Handle identity update message.
| cls | closure |
| um | message received |
Definition at line 354 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_blindable_sk_get_length(), GNUNET_CRYPTO_hash(), 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, reschedule_connect(), and str.
|
static |
Definition at line 548 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().