#include "messenger_api_handle.h"
#include "messenger_api_epoch.h"
#include "messenger_api_epoch_announcement.h"
#include "messenger_api_epoch_group.h"
#include "messenger_api_room.h"
#include "messenger_api_util.h"
Go to the source code of this file.
Functions | |
struct GNUNET_MESSENGER_Handle * | create_handle (const struct GNUNET_CONFIGURATION_Handle *config, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls) |
Creates and allocates a new handle using a given configuration and a custom message callback with a given closure for the client API. | |
static enum GNUNET_GenericReturnValue | iterate_destroy_room (void *cls, const struct GNUNET_HashCode *key, void *value) |
void | destroy_handle (struct GNUNET_MESSENGER_Handle *handle) |
Destroys a handle and frees its memory fully from the client API. | |
void | set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) |
Sets the name of a handle to a specific name. | |
const char * | get_handle_name (const struct GNUNET_MESSENGER_Handle *handle) |
Returns the current name of a given handle or NULL if no valid name was assigned yet. | |
static void | cb_key_error (void *cls) |
static void | cb_key_monitor (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute expiry) |
static enum GNUNET_GenericReturnValue | it_announcement_store_key (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
static enum GNUNET_GenericReturnValue | it_group_store_key (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
static enum GNUNET_GenericReturnValue | it_epoch_store_keys (void *cls, const struct GNUNET_HashCode *key, void *value) |
static enum GNUNET_GenericReturnValue | it_room_store_keys (void *cls, const struct GNUNET_HashCode *key, void *value) |
static void | cb_key_sync (void *cls) |
void | set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_CRYPTO_PrivateKey *key) |
Sets the keypair of a given handle to the keypair of a specific private key. | |
const struct GNUNET_CRYPTO_PrivateKey * | get_handle_key (const struct GNUNET_MESSENGER_Handle *handle) |
Returns the private key of a given handle. | |
const struct GNUNET_CRYPTO_PublicKey * | get_handle_pubkey (const struct GNUNET_MESSENGER_Handle *handle) |
Returns the public key of a given handle. | |
struct GNUNET_MESSENGER_ContactStore * | get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle) |
Returns the used contact store of a given handle. | |
struct GNUNET_MESSENGER_Contact * | get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
Returns the contact of a given handle in a room identified by a given key. | |
void | open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
Marks a room known to a handle identified by a given key as open. | |
void | entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) |
Adds a tunnel for a room known to a handle identified by a given key to a list of opened connections. | |
void | close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
Destroys and so implicitly closes a room known to a handle identified by a given key. | |
struct GNUNET_MESSENGER_Room * | get_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
Returns the room known to a handle identified by a given key. | |
enum GNUNET_GenericReturnValue | store_handle_epoch_key (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_HashCode *hash, const struct GNUNET_ShortHashCode *identifier, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, uint32_t flags, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls, struct GNUNET_NAMESTORE_QueueEntry **query) |
Stores/deletes a shared_key for a given room from a handle identified by its key in an epoch with certain hash using a specific identifier for this epoch key. | |
struct GNUNET_MESSENGER_Handle * create_handle | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_MESSENGER_MessageCallback | msg_callback, | ||
void * | msg_cls | ||
) |
Creates and allocates a new handle using a given configuration and a custom message callback with a given closure for the client API.
[in] | cfg | Configuration |
[in] | msg_callback | Message callback |
[in,out] | msg_cls | Closure |
Definition at line 35 of file messenger_api_handle.c.
References config, get_handle_contact_store(), GNUNET_assert, GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_CONTAINER_multihashmap_create(), GNUNET_MESSENGER_SERVICE_NAME, GNUNET_NAMESTORE_connect(), GNUNET_new, GNUNET_NO, GNUNET_TIME_relative_get_zero_(), handle, init_contact_store(), GNUNET_VPN_Handle::mq, GNUNET_MESSENGER_Handle::msg_callback, and GNUNET_MESSENGER_Handle::msg_cls.
Referenced by GNUNET_MESSENGER_connect().
|
static |
Definition at line 77 of file messenger_api_handle.c.
References destroy_room(), GNUNET_assert, GNUNET_YES, and value.
Referenced by destroy_handle().
void destroy_handle | ( | struct GNUNET_MESSENGER_Handle * | handle | ) |
Destroys a handle and frees its memory fully from the client API.
[in,out] | handle | Handle |
Definition at line 93 of file messenger_api_handle.c.
References clear_contact_store(), get_handle_contact_store(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_NAMESTORE_disconnect(), GNUNET_NAMESTORE_zone_monitor_stop(), GNUNET_SCHEDULER_cancel(), handle, iterate_destroy_room(), and GNUNET_VPN_Handle::mq.
Referenced by GNUNET_MESSENGER_connect(), and GNUNET_MESSENGER_disconnect().
void set_handle_name | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const char * | name | ||
) |
Sets the name of a handle to a specific name.
[in,out] | handle | Handle |
[in] | name | New name |
Definition at line 133 of file messenger_api_handle.c.
References GNUNET_assert, GNUNET_free, GNUNET_strdup, handle, and name.
Referenced by GNUNET_MESSENGER_connect(), and GNUNET_MESSENGER_set_name().
const char * get_handle_name | ( | const struct GNUNET_MESSENGER_Handle * | handle | ) |
Returns the current name of a given handle or NULL if no valid name was assigned yet.
[in] | handle | Handle |
Definition at line 146 of file messenger_api_handle.c.
References GNUNET_assert, and handle.
Referenced by cb_key_error(), cb_key_sync(), GNUNET_MESSENGER_get_name(), handle_name_message(), iterate_send_name_to_room(), and send_message_to_room_with_key().
|
static |
Definition at line 155 of file messenger_api_handle.c.
References get_handle_name(), GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, handle, and name.
Referenced by set_handle_key().
|
static |
Definition at line 171 of file messenger_api_handle.c.
References GNUNET_MESSENGER_EpochIdentifier::code, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_MESSENGER_EpochAnnouncement::epoch, GNUNET_MESSENGER_EpochGroup::epoch, get_epoch_announcement(), get_epoch_group(), get_handle_room(), get_room_epoch(), get_room_key(), GNUNET_assert, GNUNET_CRYPTO_kdf(), GNUNET_CRYPTO_symmetric_decrypt(), GNUNET_CRYPTO_symmetric_derive_iv(), GNUNET_CRYPTO_zero_keys(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_TYPE_MESSENGER_ROOM_EPOCH_KEY, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSENGER_FLAG_EPOCH_VALID, GNUNET_NAMESTORE_zone_monitor_next(), GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, handle, GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_EpochAnnouncement::identifier, GNUNET_MESSENGER_EpochGroup::identifier, GNUNET_MESSENGER_Room::key, rd, rd_count, record(), GNUNET_GNSRECORD_Data::record_type, set_epoch_announcement_key(), set_epoch_group_key(), GNUNET_MESSENGER_EpochAnnouncement::shared_key, GNUNET_MESSENGER_EpochGroup::shared_key, GNUNET_MESSENGER_EpochAnnouncement::valid, and GNUNET_MESSENGER_EpochGroup::valid.
Referenced by set_handle_key().
|
static |
Definition at line 282 of file messenger_api_handle.c.
References GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_EpochAnnouncement::stored, value, and write_epoch_announcement_record().
Referenced by it_epoch_store_keys().
|
static |
Definition at line 302 of file messenger_api_handle.c.
References GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_EpochGroup::stored, value, and write_epoch_group_record().
Referenced by it_epoch_store_keys().
|
static |
Definition at line 322 of file messenger_api_handle.c.
References GNUNET_MESSENGER_Epoch::announcements, GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_YES, GNUNET_MESSENGER_Epoch::groups, it_announcement_store_key(), it_group_store_key(), and value.
Referenced by it_room_store_keys().
|
static |
Definition at line 341 of file messenger_api_handle.c.
References GNUNET_MESSENGER_Room::epochs, GNUNET_assert, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_YES, it_epoch_store_keys(), and value.
Referenced by cb_key_sync(), and set_handle_key().
|
static |
Definition at line 360 of file messenger_api_handle.c.
References get_handle_name(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, handle, it_room_store_keys(), and name.
Referenced by set_handle_key().
void set_handle_key | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_CRYPTO_PrivateKey * | key | ||
) |
Sets the keypair of a given handle to the keypair of a specific private key.
[in,out] | handle | Handle |
[in] | key | Private key or NULL |
Definition at line 380 of file messenger_api_handle.c.
References cb_key_error(), cb_key_monitor(), cb_key_sync(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CRYPTO_key_get_public(), GNUNET_free, GNUNET_GNSRECORD_FILTER_NONE, GNUNET_memcpy, GNUNET_NAMESTORE_zone_monitor_start2(), GNUNET_NAMESTORE_zone_monitor_stop(), GNUNET_new, GNUNET_YES, handle, it_room_store_keys(), and key.
Referenced by GNUNET_MESSENGER_connect(), and GNUNET_MESSENGER_set_key().
const struct GNUNET_CRYPTO_PrivateKey * get_handle_key | ( | const struct GNUNET_MESSENGER_Handle * | handle | ) |
Returns the private key of a given handle.
[in] | handle | Handle |
Definition at line 432 of file messenger_api_handle.c.
References get_anonymous_private_key(), GNUNET_assert, and handle.
Referenced by enqueue_message_to_room(), handle_member_id(), handle_private_message(), and store_handle_epoch_key().
const struct GNUNET_CRYPTO_PublicKey * get_handle_pubkey | ( | const struct GNUNET_MESSENGER_Handle * | handle | ) |
Returns the public key of a given handle.
[in] | handle | Handle |
Definition at line 444 of file messenger_api_handle.c.
References get_anonymous_public_key(), GNUNET_assert, and handle.
Referenced by get_handle_contact(), GNUNET_MESSENGER_get_key(), handle_join_message(), send_enter_room(), send_message_to_room_with_key(), and send_open_room().
struct GNUNET_MESSENGER_ContactStore * get_handle_contact_store | ( | struct GNUNET_MESSENGER_Handle * | handle | ) |
Returns the used contact store of a given handle.
[in,out] | handle | Handle |
Definition at line 456 of file messenger_api_handle.c.
References GNUNET_assert, and handle.
Referenced by create_handle(), destroy_handle(), get_handle_contact(), handle_id_message(), handle_join_message(), handle_key_message(), handle_transcript_message(), process_message_control(), and task_message_control().
struct GNUNET_MESSENGER_Contact * get_handle_contact | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_HashCode * | key | ||
) |
Returns the contact of a given handle in a room identified by a given key.
[in,out] | handle | Handle |
[in] | key | Key of room |
Definition at line 465 of file messenger_api_handle.c.
References context, get_context_from_member(), get_handle_contact_store(), get_handle_pubkey(), get_room_sender_id(), get_store_contact(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), handle, and key.
Referenced by get_room_availble_epoch_entry(), handle_appeal_message(), handle_epoch_announcement(), and handle_private_message().
void open_handle_room | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_HashCode * | key | ||
) |
Marks a room known to a handle identified by a given key as open.
[in,out] | handle | Handle |
[in] | key | Key of room |
Definition at line 495 of file messenger_api_handle.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_YES, handle, key, and GNUNET_MESSENGER_Room::opened.
Referenced by handle_room_open().
void entry_handle_room_at | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_PeerIdentity * | door, | ||
const struct GNUNET_HashCode * | key | ||
) |
Adds a tunnel for a room known to a handle identified by a given key to a list of opened connections.
[in,out] | handle | Handle |
[in] | door | Peer identity |
[in] | key | Key of room |
Definition at line 510 of file messenger_api_handle.c.
References add_to_list_tunnels(), GNUNET_MESSENGER_Room::entries, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), handle, and key.
Referenced by handle_room_entry().
void close_handle_room | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_HashCode * | key | ||
) |
Destroys and so implicitly closes a room known to a handle identified by a given key.
[in,out] | handle | Handle |
[in] | key | Key of room |
Definition at line 526 of file messenger_api_handle.c.
References destroy_room(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_YES, handle, and key.
Referenced by handle_room_close().
struct GNUNET_MESSENGER_Room * get_handle_room | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_HashCode * | key | ||
) |
Returns the room known to a handle identified by a given key.
[in,out] | handle | handle Handle |
[in] | key | Key of room |
Definition at line 542 of file messenger_api_handle.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), handle, and key.
Referenced by cb_key_monitor(), handle_member_id(), handle_miss_message(), handle_recv_message(), handle_room_close(), handle_room_entry(), handle_room_open(), and handle_room_sync().
enum GNUNET_GenericReturnValue store_handle_epoch_key | ( | const struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_HashCode * | key, | ||
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_ShortHashCode * | identifier, | ||
const struct GNUNET_CRYPTO_SymmetricSessionKey * | shared_key, | ||
uint32_t | flags, | ||
GNUNET_NAMESTORE_ContinuationWithStatus | cont, | ||
void * | cont_cls, | ||
struct GNUNET_NAMESTORE_QueueEntry ** | query | ||
) |
Stores/deletes a shared_key for a given room from a handle identified by its key in an epoch with certain hash using a specific identifier for this epoch key.
[in] | handle | Handle |
[in] | key | Room key |
[in] | hash | Epoch hash |
[in] | identifier | Epoch key identifier |
[in] | shared_key | Shared epoch key or NULL |
[in] | flags | Epoch key flags |
[in] | cont | Continuation status callback or NULL |
[in] | cont_cls | Continuation closure or NULL |
[out] | query |
Definition at line 552 of file messenger_api_handle.c.
References data, expiration, get_handle_key(), GNUNET_asprintf(), GNUNET_assert, GNUNET_CRYPTO_kdf(), GNUNET_CRYPTO_symmetric_derive_iv(), GNUNET_CRYPTO_symmetric_encrypt(), GNUNET_CRYPTO_zero_keys(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_TYPE_MESSENGER_ROOM_EPOCH_KEY, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_record_set_store(), GNUNET_OK, GNUNET_sh2s(), GNUNET_STRINGS_utf8_tolower(), GNUNET_SYSERR, GNUNET_TIME_absolute_get_forever_(), GNUNET_YES, handle, GNUNET_MESSENGER_RoomEpochKeyRecord::hash, GNUNET_MESSENGER_RoomEpochKeyRecord::identifier, key, record(), and GNUNET_MESSENGER_RoomEpochKeyRecord::shared_key.
Referenced by write_epoch_announcement_record(), and write_epoch_group_record().