messenger api: client implementation of GNUnet MESSENGER service More...
#include "platform.h"
#include "gnunet_messenger_service.h"
#include "gnunet-service-messenger.h"
#include "messenger_api_handle.h"
#include "messenger_api_message.h"
#include "messenger_api_util.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_MESSENGER_RoomFind |
Functions | |
const char * | GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind) |
Get the name of a message kind. More... | |
static int | check_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) |
static void | handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) |
static int | check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) |
static void | handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) |
static void | handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg) |
static void | handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) |
static void | handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) |
static void | handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) |
static int | check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) |
static void | handle_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) |
static void | reconnect (struct GNUNET_MESSENGER_Handle *handle) |
static void | send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) |
static void | send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_PeerIdentity *door) |
static void | send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) |
static int | iterate_reset_room (void *cls, const struct GNUNET_HashCode *key, void *value) |
static void | callback_reconnect (void *cls) |
static int | iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value) |
static void | callback_mq_error (void *cls, enum GNUNET_MQ_Error error) |
struct GNUNET_MESSENGER_Handle * | GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls) |
Set up a handle for the messenger related functions and connects to all necessary services. More... | |
int | GNUNET_MESSENGER_update (struct GNUNET_MESSENGER_Handle *handle) |
Update a handle of the messenger to use a different ego key and replace the old one with a newly generated one. More... | |
void | GNUNET_MESSENGER_disconnect (struct GNUNET_MESSENGER_Handle *handle) |
Disconnect all of the messengers used services and clears up its used memory. More... | |
const char * | GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle) |
Get the name (if specified, otherwise NULL) used by the messenger. More... | |
int | GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) |
Set the name for the messenger. More... | |
static const struct GNUNET_IDENTITY_PublicKey * | get_non_anonymous_key (const struct GNUNET_IDENTITY_PublicKey *public_key) |
const struct GNUNET_IDENTITY_PublicKey * | GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle) |
Get the public key used by the messenger or NULL if the anonymous key was used. More... | |
struct GNUNET_MESSENGER_Room * | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
Open a room to send and receive messages. More... | |
struct GNUNET_MESSENGER_Room * | GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) |
Enter a room to send and receive messages through a door opened using GNUNET_MESSENGER_open_room. More... | |
void | GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room) |
Close a room which was entered, opened or both in various order and variety. More... | |
static int | iterate_find_room (void *cls, const struct GNUNET_HashCode *key, void *value) |
int | GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, GNUNET_MESSENGER_MemberCallback callback, void *cls) |
Searches for a specific contact in a given room and calls a selected callback with a given closure for each of them containing the contact as a member. More... | |
const struct GNUNET_HashCode * | GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room) |
Get the key of a given room. More... | |
const struct GNUNET_MESSENGER_Contact * | GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Get the contact of a member in a room which sent a specific message identified with a given hash. More... | |
const char * | GNUNET_MESSENGER_contact_get_name (const struct GNUNET_MESSENGER_Contact *contact) |
Get the name used by the contact. More... | |
const struct GNUNET_IDENTITY_PublicKey * | GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact) |
Get the public key used by the contact or NULL if the anonymous key was used. More... | |
void | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_MESSENGER_Contact *contact) |
Send a message into a room. More... | |
const struct GNUNET_MESSENGER_Message * | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Get the message in a room identified by its hash. More... | |
int | GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls) |
Iterates through all members of a given room and calls a selected callback for each of them with a provided closure. More... | |
messenger api: client implementation of GNUnet MESSENGER service
Definition in file messenger_api.c.
|
static |
Definition at line 76 of file messenger_api.c.
References GNUNET_MQ_check_zero_termination, GNUNET_OK, and msg.
|
static |
Definition at line 84 of file messenger_api.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, handle, msg, name, and set_handle_name().
|
static |
Definition at line 97 of file messenger_api.c.
References GNUNET_IDENTITY_read_public_key_from_buffer(), GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, msg, pubkey, and GNUNET_MessageHeader::size.
|
static |
Definition at line 119 of file messenger_api.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_IDENTITY_public_key_to_string(), GNUNET_IDENTITY_read_public_key_from_buffer(), GNUNET_log, GNUNET_SYSERR, handle, msg, pubkey, set_handle_key(), and GNUNET_MessageHeader::size.
|
static |
Definition at line 145 of file messenger_api.c.
References GNUNET_MESSENGER_Room::contact_id, GNUNET_CONTAINER_multihashmap_get(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_new, handle, key, and msg.
|
static |
Definition at line 167 of file messenger_api.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, handle, key, msg, and open_handle_room().
|
static |
Definition at line 180 of file messenger_api.c.
References entry_handle_room_at(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, handle, key, and msg.
|
static |
Definition at line 194 of file messenger_api.c.
References close_handle_room(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, handle, key, and msg.
|
static |
Definition at line 207 of file messenger_api.c.
References cleanup_message(), decode_message(), get_message_kind_size(), GNUNET_MESSENGER_KIND_UNKNOWN, GNUNET_NO, GNUNET_OK, GNUNET_YES, msg, and GNUNET_MessageHeader::size.
|
static |
Definition at line 231 of file messenger_api.c.
References cleanup_message(), context, decode_message(), get_handle_contact_store(), get_room_message(), get_store_contact_raw(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_h2s_full(), GNUNET_log, GNUNET_MESSENGER_name_of_kind(), GNUNET_YES, handle, handle_room_message(), GNUNET_MESSENGER_Message::header, key, GNUNET_MESSENGER_MessageHeader::kind, msg, and GNUNET_MessageHeader::size.
|
static |
Definition at line 393 of file messenger_api.c.
References callback_mq_error(), GNUNET_DNS_Handle::cfg, get_key(), GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_KEY, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_NAME, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_OPEN, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE, GNUNET_MESSENGER_SERVICE_NAME, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, handle, handlers, GNUNET_DNS_Handle::mq, and recv_message().
Referenced by callback_reconnect(), and GNUNET_MESSENGER_connect().
|
static |
Definition at line 282 of file messenger_api.c.
References env, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_OPEN, GNUNET_MQ_msg, GNUNET_MQ_send(), handle, GNUNET_MESSENGER_Room::key, GNUNET_DNS_Handle::mq, and msg.
Referenced by GNUNET_MESSENGER_open_room(), and iterate_reset_room().
|
static |
Definition at line 294 of file messenger_api.c.
References env, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY, GNUNET_MQ_msg, GNUNET_MQ_send(), handle, GNUNET_MESSENGER_Room::key, GNUNET_DNS_Handle::mq, and msg.
Referenced by GNUNET_MESSENGER_enter_room(), and iterate_reset_room().
|
static |
Definition at line 308 of file messenger_api.c.
References env, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE, GNUNET_MQ_msg, GNUNET_MQ_send(), handle, GNUNET_MESSENGER_Room::key, GNUNET_DNS_Handle::mq, and msg.
Referenced by GNUNET_MESSENGER_close_room(), and iterate_close_room().
|
static |
Definition at line 320 of file messenger_api.c.
References GNUNET_MESSENGER_Room::entries, GNUNET_PEER_resolve(), GNUNET_YES, handle, GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::next, GNUNET_MESSENGER_Room::opened, GNUNET_MESSENGER_ListTunnel::peer, send_enter_room(), send_open_room(), and value.
Referenced by callback_reconnect().
|
static |
Definition at line 347 of file messenger_api.c.
References GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_TIME_STD_BACKOFF, handle, iterate_reset_room(), reconnect(), and GNUNET_DNS_Handle::reconnect_task.
Referenced by callback_mq_error().
|
static |
Definition at line 361 of file messenger_api.c.
References GNUNET_YES, handle, send_close_room(), and value.
Referenced by callback_mq_error().
|
static |
Definition at line 374 of file messenger_api.c.
References callback_reconnect(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), handle, iterate_close_room(), GNUNET_DNS_Handle::mq, and GNUNET_DNS_Handle::reconnect_task.
Referenced by reconnect().
|
static |
Definition at line 538 of file messenger_api.c.
References get_anonymous_public_key(), and GNUNET_memcmp.
Referenced by GNUNET_MESSENGER_contact_get_key(), GNUNET_MESSENGER_get_key(), and GNUNET_MESSENGER_send_message().
|
static |
Definition at line 624 of file messenger_api.c.
References GNUNET_MESSENGER_RoomFind::callback, GNUNET_MESSENGER_RoomFind::cls, GNUNET_MESSENGER_RoomFind::contact, GNUNET_MESSENGER_RoomFind::counter, find_room_member(), GNUNET_NO, GNUNET_YES, and value.
Referenced by GNUNET_MESSENGER_find_rooms().