![]() |
GNUnet
0.11.x
|
messenger api: client implementation of GNUnet MESSENGER service More...
Go to the source code of this file.
Data Structures | |
struct | GNUNET_MESSENGER_MemberCall |
Functions | |
struct GNUNET_MESSENGER_Room * | create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
Creates and allocates a new room for a handle with a given key for the client API. More... | |
static int | iterate_destroy_message (void *cls, const struct GNUNET_HashCode *key, void *value) |
void | destroy_room (struct GNUNET_MESSENGER_Room *room) |
Destroys a room and frees its memory fully from the client API. More... | |
const struct GNUNET_MESSENGER_Message * | get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Returns a message locally stored from a map for a given hash in a room. More... | |
struct GNUNET_MESSENGER_Contact * | get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Returns a messages sender locally stored from a map for a given hash in a room. More... | |
static void | handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
static void | handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
static void | handle_name_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
static void | handle_key_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
static void | handle_id_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
static void | handle_miss_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
static void | handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
void | handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
Handles a message with a given hash in a room for the client API to update members and its information. More... | |
static int | iterate_local_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
int | iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls) |
Iterates through all members of a given room to forward each of them to a selected callback with a custom closure. More... | |
messenger api: client implementation of GNUnet MESSENGER service
Definition in file messenger_api_room.c.
struct GNUNET_MESSENGER_Room* create_room | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_HashCode * | key | ||
) |
Creates and allocates a new room for a handle with a given key for the client API.
Definition at line 31 of file messenger_api_room.c.
References GNUNET_MESSENGER_Room::contact_id, GNUNET_MESSENGER_Room::entries, GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multishortmap_create(), GNUNET_memcpy, GNUNET_new, GNUNET_NO, handle, GNUNET_MESSENGER_Room::handle, init_list_tunnels(), GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_Room::members, GNUNET_MESSENGER_Room::messages, and GNUNET_MESSENGER_Room::opened.
|
static |
Definition at line 52 of file messenger_api_room.c.
References destroy_message(), GNUNET_free, GNUNET_YES, GNUNET_MESSENGER_RoomMessageEntry::message, and value.
Referenced by destroy_room().
void destroy_room | ( | struct GNUNET_MESSENGER_Room * | room | ) |
Destroys a room and frees its memory fully from the client API.
Definition at line 63 of file messenger_api_room.c.
References clear_list_tunnels(), GNUNET_MESSENGER_Room::contact_id, GNUNET_MESSENGER_Room::entries, GNUNET_assert, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_free, iterate_destroy_message(), GNUNET_MESSENGER_Room::members, and GNUNET_MESSENGER_Room::messages.
const struct GNUNET_MESSENGER_Message* get_room_message | ( | const struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Returns a message locally stored from a map for a given hash in a room.
If no matching message is found, NULL gets returned.
[in] | room | Room |
[in] | hash | Hash of message |
Definition at line 86 of file messenger_api_room.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_MESSENGER_RoomMessageEntry::message, and GNUNET_MESSENGER_Room::messages.
struct GNUNET_MESSENGER_Contact* get_room_sender | ( | const struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Returns a messages sender locally stored from a map for a given hash in a room.
If no matching message is found, NULL gets returned.
[in] | room | Room |
[in] | hash | Hash of message |
Definition at line 98 of file messenger_api_room.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_MESSENGER_Room::messages, and GNUNET_MESSENGER_RoomMessageEntry::sender.
Referenced by GNUNET_MESSENGER_get_sender().
|
static |
Definition at line 110 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, get_context_from_member(), get_handle_contact_store(), get_store_contact(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multishortmap_contains_value(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Message::header, increase_contact_rc(), GNUNET_MESSENGER_MessageBody::join, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_MessageJoin::key, GNUNET_MESSENGER_Room::members, and GNUNET_MESSENGER_MessageHeader::sender_id.
Referenced by handle_room_message().
|
static |
Definition at line 130 of file messenger_api_room.c.
References decrease_contact_rc(), get_context_from_member(), get_handle_contact_store(), GNUNET_CONTAINER_multishortmap_remove(), GNUNET_YES, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_Room::members, remove_store_contact(), and GNUNET_MESSENGER_MessageHeader::sender_id.
Referenced by handle_room_message().
|
static |
Definition at line 147 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_MessageName::name, GNUNET_MESSENGER_MessageBody::name, and set_contact_name().
Referenced by handle_room_message().
|
static |
Definition at line 157 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, get_context_from_member(), get_handle_contact_store(), GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_MessageKey::key, GNUNET_MESSENGER_MessageBody::key, GNUNET_MESSENGER_MessageHeader::sender_id, and update_store_contact().
Referenced by handle_room_message().
|
static |
Definition at line 172 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, get_contact_key(), get_context_from_member(), get_handle_contact_store(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multishortmap_put(), GNUNET_CONTAINER_multishortmap_remove(), GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageId::id, GNUNET_MESSENGER_MessageBody::id, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_Room::members, GNUNET_MESSENGER_MessageHeader::sender_id, and update_store_contact().
Referenced by handle_room_message().
|
static |
Definition at line 191 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_Room::contact_id, GNUNET_MESSENGER_Room::entries, find_list_tunnels(), GNUNET_memcmp, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageBody::miss, GNUNET_MESSENGER_MessageMiss::peer, remove_from_list_tunnels(), and GNUNET_MESSENGER_MessageHeader::sender_id.
Referenced by handle_room_message().
|
static |
Definition at line 204 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_MessageBody::delete, destroy_message(), get_handle_contact(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_YES, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_MessageDelete::hash, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, and GNUNET_MESSENGER_RoomMessageEntry::sender.
Referenced by handle_room_message().
void handle_room_message | ( | struct GNUNET_MESSENGER_Room * | room, |
struct GNUNET_MESSENGER_Contact * | sender, | ||
const struct GNUNET_MESSENGER_Message * | message, | ||
const struct GNUNET_HashCode * | hash | ||
) |
Handles a message with a given hash in a room for the client API to update members and its information.
The function also stores the message in map locally for access afterwards.
Definition at line 220 of file messenger_api_room.c.
References copy_message(), destroy_message(), GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_free, GNUNET_MESSENGER_KIND_DELETE, GNUNET_MESSENGER_KIND_ID, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_KEY, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_MISS, GNUNET_MESSENGER_KIND_NAME, GNUNET_new, GNUNET_NO, GNUNET_OK, handle_delete_message(), handle_id_message(), handle_join_message(), handle_key_message(), handle_leave_message(), handle_miss_message(), handle_name_message(), GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, and GNUNET_MESSENGER_RoomMessageEntry::sender.
Referenced by handle_recv_message().
|
static |
Definition at line 277 of file messenger_api_room.c.
References call, GNUNET_MESSENGER_MemberCall::callback, GNUNET_MESSENGER_MemberCall::cls, GNUNET_MESSENGER_MemberCall::room, and value.
Referenced by iterate_room_members().
int iterate_room_members | ( | struct GNUNET_MESSENGER_Room * | room, |
GNUNET_MESSENGER_MemberCallback | callback, | ||
void * | cls | ||
) |
Iterates through all members of a given room to forward each of them to a selected callback with a custom closure.
Definition at line 286 of file messenger_api_room.c.
References GNUNET_MESSENGER_MemberCall::callback, GNUNET_MESSENGER_MemberCall::cls, GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterate(), iterate_local_members(), GNUNET_MESSENGER_Room::members, and GNUNET_MESSENGER_MemberCall::room.
Referenced by GNUNET_MESSENGER_iterate_members().