#include "gnunet_util_lib.h"
#include "gnunet_messenger_service.h"
#include "messenger_api_contact_store.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_MESSENGER_Handle |
Functions | |
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. More... | |
void | destroy_handle (struct GNUNET_MESSENGER_Handle *handle) |
Destroys a handle and frees its memory fully from the client API. More... | |
void | set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) |
Sets the name of a handle to a specific name. More... | |
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. More... | |
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. More... | |
const struct GNUNET_CRYPTO_PrivateKey * | get_handle_key (const struct GNUNET_MESSENGER_Handle *handle) |
Returns the private key of a given handle. More... | |
const struct GNUNET_CRYPTO_PublicKey * | get_handle_pubkey (const struct GNUNET_MESSENGER_Handle *handle) |
Returns the public key of a given handle. More... | |
struct GNUNET_MESSENGER_ContactStore * | get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle) |
Returns the used contact store of a given handle. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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 32 of file messenger_api_handle.c.
References cfg, GNUNET_VPN_Handle::cfg, get_handle_contact_store(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), 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().
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 80 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_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 114 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 127 of file messenger_api_handle.c.
References GNUNET_assert, and handle.
Referenced by GNUNET_MESSENGER_get_name(), handle_name_message(), iterate_send_name_to_room(), and send_message_to_room_with_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 136 of file messenger_api_handle.c.
References GNUNET_assert, GNUNET_CRYPTO_key_get_public(), GNUNET_free, GNUNET_memcpy, GNUNET_new, handle, 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 166 of file messenger_api_handle.c.
References get_anonymous_private_key(), GNUNET_assert, and handle.
Referenced by enqueue_message_to_room(), handle_member_id(), and handle_private_message().
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 178 of file messenger_api_handle.c.
References get_anonymous_public_key(), GNUNET_assert, and handle.
Referenced by get_handle_contact(), GNUNET_MESSENGER_get_key(), 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 190 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 199 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 handle_delete_message(), handle_private_message(), and handle_transcript_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 229 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 244 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 260 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 276 of file messenger_api_handle.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), handle, and key.
Referenced by handle_member_id(), handle_miss_message(), handle_recv_message(), handle_room_close(), handle_room_entry(), handle_room_open(), and handle_room_sync().