GNUnet MESSENGER service. More...
#include "platform.h"
#include "gnunet-service-messenger_ego_store.h"
#include "gnunet-service-messenger_handle.h"
Go to the source code of this file.
Functions | |
static void | callback_update_ego (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *identifier) |
void | init_ego_store (struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config) |
Initializes an EGO-store as fully empty. More... | |
static int | iterate_destroy_egos (void *cls, const struct GNUNET_HashCode *key, void *value) |
void | clear_ego_store (struct GNUNET_MESSENGER_EgoStore *store) |
Clears an EGO-store, wipes its content and deallocates its memory. More... | |
static int | iterate_create_ego (void *cls, const struct GNUNET_HashCode *key, void *value) |
static void | callback_ego_create (void *cls, const struct GNUNET_IDENTITY_PrivateKey *key, enum GNUNET_ErrorCode ec) |
void | create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier) |
Creates a new EGO which will be registered to a store under a specific identifier. More... | |
void | bind_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, void *handle) |
Binds an EGO which was registered to a store under a specific identifier to a given handle More... | |
void | unbind_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, void *handle) |
Binds an EGO which was registered to a store under a specific identifier to a given handle More... | |
static void | callback_ego_lookup (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
void | lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls) |
Lookups an EGO which was registered to a store under a specific identifier. More... | |
struct GNUNET_MESSENGER_Ego * | update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, const struct GNUNET_IDENTITY_PrivateKey *key) |
Updates the registration of an EGO to a store under a specific identifier with a new key. More... | |
void | delete_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier) |
Deletes the registration of an EGO in a store under a specific identifier. More... | |
static void | callback_ego_rename (void *cls, enum GNUNET_ErrorCode ec) |
void | rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier, const char *new_identifier) |
Updates the location of a registered EGO in a store to a different one under a specific new_identifier replacing its old one. More... | |
static void | callback_ego_delete (void *cls, enum GNUNET_ErrorCode ec) |
void | renew_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier) |
Replaces the registered EGO in a store under a specific identifier with a newly created one. More... | |
GNUnet MESSENGER service.
Definition in file gnunet-service-messenger_ego_store.c.
|
static |
Definition at line 32 of file gnunet-service-messenger_ego_store.c.
References ctx, delete_store_ego(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_log, and update_store_ego().
Referenced by init_ego_store().
void init_ego_store | ( | struct GNUNET_MESSENGER_EgoStore * | store, |
const struct GNUNET_CONFIGURATION_Handle * | config | ||
) |
Initializes an EGO-store as fully empty.
[out] | store | EGO-store |
[in] | config | Configuration handle |
Definition at line 55 of file gnunet-service-messenger_ego_store.c.
References callback_update_ego(), GNUNET_MESSENGER_EgoStore::cfg, config, GNUNET_MESSENGER_EgoStore::egos, GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_IDENTITY_connect(), GNUNET_NO, GNUNET_MESSENGER_EgoStore::handles, GNUNET_MESSENGER_EgoStore::identity, GNUNET_MESSENGER_EgoStore::lu_end, GNUNET_MESSENGER_EgoStore::lu_start, GNUNET_MESSENGER_EgoStore::op_end, and GNUNET_MESSENGER_EgoStore::op_start.
Referenced by create_service().
|
static |
Definition at line 73 of file gnunet-service-messenger_ego_store.c.
References GNUNET_free, GNUNET_YES, and value.
Referenced by clear_ego_store().
void clear_ego_store | ( | struct GNUNET_MESSENGER_EgoStore * | store | ) |
Clears an EGO-store, wipes its content and deallocates its memory.
[in,out] | store | EGO-store |
Definition at line 83 of file gnunet-service-messenger_ego_store.c.
References GNUNET_MESSENGER_EgoStore::egos, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, GNUNET_IDENTITY_cancel(), GNUNET_IDENTITY_disconnect(), GNUNET_IDENTITY_ego_lookup_cancel(), GNUNET_MESSENGER_EgoStore::handles, GNUNET_MESSENGER_EgoLookup::identifier, GNUNET_MESSENGER_EgoStore::identity, iterate_destroy_egos(), GNUNET_MESSENGER_EgoLookup::lookup, GNUNET_MESSENGER_EgoStore::lu_end, GNUNET_MESSENGER_EgoStore::lu_start, op, GNUNET_MESSENGER_EgoStore::op_end, GNUNET_MESSENGER_EgoStore::op_start, GNUNET_MESSENGER_EgoLookup::store, and GNUNET_MESSENGER_EgoOperation::store.
Referenced by destroy_service().
|
static |
Definition at line 131 of file gnunet-service-messenger_ego_store.c.
References GNUNET_YES, handle, set_srv_handle_ego(), and value.
Referenced by callback_ego_create().
|
static |
FIXME: This is dangerous, please handle errors
Definition at line 141 of file gnunet-service-messenger_ego_store.c.
References GNUNET_MESSENGER_EgoOperation::cls, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CRYPTO_hash(), GNUNET_EC_NONE, GNUNET_ERROR_TYPE_WARNING, GNUNET_ErrorCode_get_hint(), GNUNET_free, GNUNET_log, GNUNET_MESSENGER_EgoStore::handles, GNUNET_MESSENGER_EgoOperation::identifier, iterate_create_ego(), key, GNUNET_MESSENGER_EgoStore::op_end, GNUNET_MESSENGER_EgoStore::op_start, GNUNET_MESSENGER_EgoOperation::store, and update_store_ego().
Referenced by create_store_ego().
void create_store_ego | ( | struct GNUNET_MESSENGER_EgoStore * | store, |
const char * | identifier | ||
) |
Creates a new EGO which will be registered to a store under a specific identifier.
[in,out] | store | EGO-store |
[in] | identifier | Identifier string |
Definition at line 175 of file gnunet-service-messenger_ego_store.c.
References callback_ego_create(), GNUNET_MESSENGER_EgoOperation::cls, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_IDENTITY_create(), GNUNET_IDENTITY_TYPE_ECDSA, GNUNET_log, GNUNET_new, GNUNET_strdup, GNUNET_MESSENGER_EgoOperation::identifier, GNUNET_MESSENGER_EgoStore::identity, GNUNET_MESSENGER_EgoStore::op_end, GNUNET_MESSENGER_EgoStore::op_start, GNUNET_MESSENGER_EgoOperation::operation, and GNUNET_MESSENGER_EgoOperation::store.
Referenced by callback_ego_delete(), and callback_update_handle().
void bind_store_ego | ( | struct GNUNET_MESSENGER_EgoStore * | store, |
const char * | identifier, | ||
void * | handle | ||
) |
Binds an EGO which was registered to a store under a specific identifier to a given handle
[in,out] | store | EGO-store |
[in] | identifier | Identifier string |
[in,out] | handle | Handle |
Definition at line 202 of file gnunet-service-messenger_ego_store.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains_value(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_YES, handle, GNUNET_MESSENGER_EgoStore::handles, GNUNET_MESSENGER_EgoOperation::identifier, and GNUNET_MESSENGER_EgoOperation::store.
Referenced by callback_update_handle().
void unbind_store_ego | ( | struct GNUNET_MESSENGER_EgoStore * | store, |
const char * | identifier, | ||
void * | handle | ||
) |
Binds an EGO which was registered to a store under a specific identifier to a given handle
[in,out] | store | EGO-store |
[in] | identifier | Identifier string |
[in,out] | handle | Handle |
Definition at line 222 of file gnunet-service-messenger_ego_store.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains_value(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_YES, handle, and GNUNET_MESSENGER_EgoStore::handles.
Referenced by destroy_srv_handle().
|
static |
Definition at line 241 of file gnunet-service-messenger_ego_store.c.
References GNUNET_MESSENGER_EgoLookup::cb, GNUNET_MESSENGER_EgoLookup::cls, delete_store_ego(), GNUNET_MESSENGER_EgoStore::egos, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_log, GNUNET_MESSENGER_EgoLookup::identifier, GNUNET_MESSENGER_EgoStore::lu_end, GNUNET_MESSENGER_EgoStore::lu_start, GNUNET_MESSENGER_EgoLookup::store, and update_store_ego().
Referenced by lookup_store_ego().
void lookup_store_ego | ( | struct GNUNET_MESSENGER_EgoStore * | store, |
const char * | identifier, | ||
GNUNET_MESSENGER_EgoLookupCallback | lookup, | ||
void * | cls | ||
) |
Lookups an EGO which was registered to a store under a specific identifier.
[in,out] | store | EGO-store |
[in] | identifier | Identifier string |
[in] | lookup | Lookup callback (non-NULL) |
[in] | cls | Closure |
Definition at line 281 of file gnunet-service-messenger_ego_store.c.
References callback_ego_lookup(), GNUNET_MESSENGER_EgoLookup::cb, GNUNET_MESSENGER_EgoStore::cfg, GNUNET_MESSENGER_EgoLookup::cls, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_IDENTITY_ego_lookup(), GNUNET_log, GNUNET_new, GNUNET_strdup, GNUNET_MESSENGER_EgoLookup::identifier, GNUNET_MESSENGER_EgoLookup::lookup, GNUNET_MESSENGER_EgoStore::lu_end, GNUNET_MESSENGER_EgoStore::lu_start, and GNUNET_MESSENGER_EgoLookup::store.
Referenced by set_srv_handle_name(), setup_srv_handle_name(), and update_srv_handle().
struct GNUNET_MESSENGER_Ego* update_store_ego | ( | struct GNUNET_MESSENGER_EgoStore * | store, |
const char * | identifier, | ||
const struct GNUNET_IDENTITY_PrivateKey * | key | ||
) |
Updates the registration of an EGO to a store under a specific identifier with a new key.
[in,out] | store | EGO-store |
[in] | identifier | Identifier string |
[in] | key | Private EGO key |
Definition at line 311 of file gnunet-service-messenger_ego_store.c.
References GNUNET_MESSENGER_EgoStore::egos, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_IDENTITY_key_get_public(), GNUNET_log, GNUNET_memcpy, GNUNET_new, GNUNET_OK, key, GNUNET_MESSENGER_Ego::priv, and GNUNET_MESSENGER_Ego::pub.
Referenced by callback_ego_create(), callback_ego_lookup(), and callback_update_ego().
void delete_store_ego | ( | struct GNUNET_MESSENGER_EgoStore * | store, |
const char * | identifier | ||
) |
Deletes the registration of an EGO in a store under a specific identifier.
[in,out] | store | EGO-store |
[in] | identifier | Identifier string |
Definition at line 339 of file gnunet-service-messenger_ego_store.c.
References GNUNET_MESSENGER_EgoStore::egos, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, and GNUNET_YES.
Referenced by callback_ego_lookup(), and callback_update_ego().
|
static |
FIXME: Dangerous, handle error
Definition at line 367 of file gnunet-service-messenger_ego_store.c.
References GNUNET_MESSENGER_EgoOperation::cls, GNUNET_MESSENGER_EgoStore::egos, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CRYPTO_hash(), GNUNET_EC_NONE, GNUNET_ERROR_TYPE_WARNING, GNUNET_ErrorCode_get_hint(), GNUNET_free, GNUNET_log, GNUNET_YES, GNUNET_MESSENGER_EgoOperation::identifier, GNUNET_MESSENGER_EgoStore::op_end, GNUNET_MESSENGER_EgoStore::op_start, and GNUNET_MESSENGER_EgoOperation::store.
Referenced by rename_store_ego().
void rename_store_ego | ( | struct GNUNET_MESSENGER_EgoStore * | store, |
const char * | old_identifier, | ||
const char * | new_identifier | ||
) |
Updates the location of a registered EGO in a store to a different one under a specific new_identifier replacing its old one.
[in,out] | store | EGO-store |
[in] | old_identifier | Old identifier string |
[in] | new_identifier | New identifier string |
Definition at line 410 of file gnunet-service-messenger_ego_store.c.
References callback_ego_rename(), GNUNET_MESSENGER_EgoOperation::cls, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_IDENTITY_rename(), GNUNET_log, GNUNET_new, GNUNET_strdup, GNUNET_MESSENGER_EgoOperation::identifier, GNUNET_MESSENGER_EgoStore::identity, GNUNET_MESSENGER_EgoStore::op_end, GNUNET_MESSENGER_EgoStore::op_start, GNUNET_MESSENGER_EgoOperation::operation, and GNUNET_MESSENGER_EgoOperation::store.
Referenced by callback_set_handle_name().
|
static |
FIXME: Dangerous, handle error
Definition at line 437 of file gnunet-service-messenger_ego_store.c.
References GNUNET_MESSENGER_EgoOperation::cls, create_store_ego(), GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_EC_NONE, GNUNET_ERROR_TYPE_WARNING, GNUNET_ErrorCode_get_hint(), GNUNET_free, GNUNET_log, GNUNET_MESSENGER_EgoOperation::identifier, GNUNET_MESSENGER_EgoStore::op_end, GNUNET_MESSENGER_EgoStore::op_start, and GNUNET_MESSENGER_EgoOperation::store.
Referenced by renew_store_ego().
void renew_store_ego | ( | struct GNUNET_MESSENGER_EgoStore * | store, |
const char * | identifier | ||
) |
Replaces the registered EGO in a store under a specific identifier with a newly created one.
[in,out] | store | EGO-store |
[in] | identifier | Identifier string |
Definition at line 460 of file gnunet-service-messenger_ego_store.c.
References callback_ego_delete(), GNUNET_MESSENGER_EgoOperation::cls, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_IDENTITY_delete(), GNUNET_log, GNUNET_new, GNUNET_strdup, GNUNET_MESSENGER_EgoOperation::identifier, GNUNET_MESSENGER_EgoStore::identity, GNUNET_MESSENGER_EgoStore::op_end, GNUNET_MESSENGER_EgoStore::op_start, GNUNET_MESSENGER_EgoOperation::operation, and GNUNET_MESSENGER_EgoOperation::store.
Referenced by callback_update_handle().