![]() |
GNUnet
0.11.x
|
messenger api: client implementation of GNUnet MESSENGER service More...
#include "messenger_api_handle.h"
Go to the source code of this file.
Functions | |
struct GNUNET_MESSENGER_Handle * | create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls, 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... | |
static int | iterate_destroy_room (void *cls, const struct GNUNET_HashCode *key, void *value) |
static int | iterate_destroy_contact (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. 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_IDENTITY_PublicKey *pubkey) |
Sets the public key of a given handle to a specific public key. More... | |
const struct GNUNET_IDENTITY_PublicKey * | get_handle_key (const struct GNUNET_MESSENGER_Handle *handle) |
Returns the public key of a given handle. More... | |
struct GNUNET_MESSENGER_Contact * | get_handle_contact_by_pubkey (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey) |
Returns a contact known to a handle identified by a given public key. More... | |
void | swap_handle_contact_by_pubkey (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_IDENTITY_PublicKey *pubkey) |
Changes the public key for a contact known to a handle to a specific public key and updates local map entries to access the contact by its updated 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... | |
messenger api: client implementation of GNUnet MESSENGER service
Definition in file messenger_api_handle.c.
struct GNUNET_MESSENGER_Handle* create_handle | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_MESSENGER_IdentityCallback | identity_callback, | ||
void * | identity_cls, | ||
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.
cfg | Configuration |
msg_callback | Message callback |
msg_cls | Closure |
Definition at line 29 of file messenger_api_handle.c.
References cfg, GNUNET_MESSENGER_Handle::cfg, GNUNET_MESSENGER_Handle::contacts, GNUNET_CONTAINER_multihashmap_create(), GNUNET_new, GNUNET_NO, GNUNET_TIME_relative_get_zero_(), handle, GNUNET_MESSENGER_Handle::identity_callback, GNUNET_MESSENGER_Handle::identity_cls, GNUNET_MESSENGER_Handle::mq, GNUNET_MESSENGER_Handle::msg_callback, GNUNET_MESSENGER_Handle::msg_cls, GNUNET_MESSENGER_Handle::name, GNUNET_MESSENGER_Handle::pubkey, GNUNET_MESSENGER_Handle::reconnect_task, GNUNET_MESSENGER_Handle::reconnect_time, and GNUNET_MESSENGER_Handle::rooms.
|
static |
Definition at line 56 of file messenger_api_handle.c.
References destroy_room(), GNUNET_YES, and value.
Referenced by destroy_handle().
|
static |
Definition at line 66 of file messenger_api_handle.c.
References destroy_contact(), 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.
handle | Handle |
Definition at line 76 of file messenger_api_handle.c.
References GNUNET_MESSENGER_Handle::contacts, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), iterate_destroy_contact(), iterate_destroy_room(), GNUNET_MESSENGER_Handle::mq, GNUNET_MESSENGER_Handle::name, GNUNET_MESSENGER_Handle::pubkey, GNUNET_MESSENGER_Handle::reconnect_task, and GNUNET_MESSENGER_Handle::rooms.
void set_handle_name | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const char * | name | ||
) |
Sets the name of a handle to a specific name.
handle | Handle |
name | New name |
Definition at line 108 of file messenger_api_handle.c.
References GNUNET_free, GNUNET_strdup, and GNUNET_MESSENGER_Handle::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.
handle | Handle |
Definition at line 117 of file messenger_api_handle.c.
References GNUNET_MESSENGER_Handle::name.
Referenced by GNUNET_MESSENGER_get_name(), and GNUNET_MESSENGER_update().
void set_handle_key | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_IDENTITY_PublicKey * | pubkey | ||
) |
Sets the public key of a given handle to a specific public key.
handle | Handle |
pubkey | Public key |
Definition at line 123 of file messenger_api_handle.c.
References GNUNET_memcpy, GNUNET_new, and GNUNET_MESSENGER_Handle::pubkey.
Referenced by handle_get_key().
const struct GNUNET_IDENTITY_PublicKey* get_handle_key | ( | const struct GNUNET_MESSENGER_Handle * | handle | ) |
Returns the public key of a given handle.
handle | Handle |
Definition at line 132 of file messenger_api_handle.c.
References GNUNET_IDENTITY_ego_get_anonymous(), GNUNET_IDENTITY_ego_get_public_key(), pubkey, and GNUNET_MESSENGER_Handle::pubkey.
Referenced by GNUNET_MESSENGER_get_key().
struct GNUNET_MESSENGER_Contact* get_handle_contact_by_pubkey | ( | const struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_IDENTITY_PublicKey * | pubkey | ||
) |
Returns a contact known to a handle identified by a given public key.
If not matching contact is found, NULL gets returned.
handle | Handle |
pubkey | Public key of EGO |
Definition at line 148 of file messenger_api_handle.c.
References GNUNET_MESSENGER_Handle::contacts, create_contact(), destroy_contact(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CRYPTO_hash(), and GNUNET_OK.
Referenced by handle_join_message().
void swap_handle_contact_by_pubkey | ( | struct GNUNET_MESSENGER_Handle * | handle, |
struct GNUNET_MESSENGER_Contact * | contact, | ||
const struct GNUNET_IDENTITY_PublicKey * | pubkey | ||
) |
Changes the public key for a contact known to a handle to a specific public key and updates local map entries to access the contact by its updated key.
handle | Handle |
contact | Contact |
pubkey | Public key of EGO |
Definition at line 171 of file messenger_api_handle.c.
References GNUNET_MESSENGER_Handle::contacts, get_contact_id_from_key(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_memcpy, GNUNET_YES, and GNUNET_MESSENGER_Contact::public_key.
Referenced by handle_key_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.
handle | Handle |
key | Key of room |
Definition at line 188 of file messenger_api_handle.c.
References GNUNET_CONTAINER_multihashmap_get(), GNUNET_YES, GNUNET_MESSENGER_Room::opened, and GNUNET_MESSENGER_Handle::rooms.
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.
handle | Handle |
door | Peer identity |
key | Key of room |
Definition at line 197 of file messenger_api_handle.c.
References add_to_list_tunnels(), GNUNET_MESSENGER_Room::entries, GNUNET_CONTAINER_multihashmap_get(), and GNUNET_MESSENGER_Handle::rooms.
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.
handle | Handle |
key | Key of room |
Definition at line 207 of file messenger_api_handle.c.
References destroy_room(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_YES, and GNUNET_MESSENGER_Handle::rooms.