#include "messenger_api_room.h"
#include "gnunet_common.h"
#include "gnunet_messenger_service.h"
#include "messenger_api.h"
#include "messenger_api_contact_store.h"
#include "messenger_api_handle.h"
#include "messenger_api_message.h"
#include "messenger_api_message_control.h"
#include "messenger_api_message_kind.h"
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | GNUNET_MESSENGER_MemberCall |
struct | GNUNET_MESSENGER_MemberFind |
struct | GNUNET_MESSENGER_RoomLinkDeletionInfo |
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 enum GNUNET_GenericReturnValue | iterate_destroy_message (void *cls, const struct GNUNET_HashCode *key, void *value) |
static enum GNUNET_GenericReturnValue | iterate_destroy_link (void *cls, const struct GNUNET_HashCode *key, void *value) |
static enum GNUNET_GenericReturnValue | iterate_destroy_subscription (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
void | destroy_room (struct GNUNET_MESSENGER_Room *room) |
Destroys a room and frees its memory fully from the client API. More... | |
enum GNUNET_GenericReturnValue | is_room_available (const struct GNUNET_MESSENGER_Room *room) |
Checks whether a room is available to send messages. More... | |
struct GNUNET_MESSENGER_Handle * | get_room_handle (struct GNUNET_MESSENGER_Room *room) |
Returns the messenger handle of the room. More... | |
const struct GNUNET_ShortHashCode * | get_room_sender_id (const struct GNUNET_MESSENGER_Room *room) |
Returns the member id of the room's sender. More... | |
void | set_room_sender_id (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_ShortHashCode *id) |
Sets the member id of the room's sender to a specific id or NULL. 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... | |
struct GNUNET_MESSENGER_Contact * | get_room_recipient (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Returns a messages recipient locally stored from a map for a given hash in a room. More... | |
void | delete_room_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) |
Deletes a message with a given hash inside a room under a specific delay. More... | |
void | callback_room_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Executes the message callback for a given hash in a room. More... | |
static void | handle_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry) |
static void | handle_join_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry) |
static void | handle_leave_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry) |
static void | handle_name_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry) |
static void | handle_key_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry) |
static void | handle_id_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry) |
static void | handle_miss_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry) |
static void | handle_private_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry) |
static void | handle_delete_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry) |
static void | handle_transcript_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry) |
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, enum GNUNET_MESSENGER_MessageFlags flags) |
Handles a message with a given hash in a room for the client API to update members and its information. More... | |
void | update_room_last_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Updates the last message hash of a room for the client API so that new messages can point to the latest message hash while sending. More... | |
static enum GNUNET_GenericReturnValue | 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... | |
static enum GNUNET_GenericReturnValue | iterate_find_member (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
enum GNUNET_GenericReturnValue | find_room_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact) |
Checks through all members of a given room if a specific contact is found and returns a result depending on that. More... | |
static enum GNUNET_GenericReturnValue | find_linked_hash (void *cls, const struct GNUNET_HashCode *key, void *value) |
void | link_room_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_HashCode *other) |
Links a message identified by its hash inside a given room with another message identified by its other hash. More... | |
static enum GNUNET_GenericReturnValue | clear_linked_hash (void *cls, const struct GNUNET_HashCode *key, void *value) |
static enum GNUNET_GenericReturnValue | delete_linked_hash (void *cls, const struct GNUNET_HashCode *key, void *value) |
void | link_room_deletion (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay, GNUNET_MESSENGER_RoomLinkDeletion deletion) |
Delete all remaining links to a certain message identified by its hash inside a given room and cause a deletion process to all of the linked messages. More... | |
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.
[in,out] | handle | Handle |
[in] | key | Key of room |
Definition at line 41 of file messenger_api_room.c.
References GNUNET_MESSENGER_Room::control, create_message_control(), GNUNET_MESSENGER_Room::entries, GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multishortmap_create(), GNUNET_memcpy, GNUNET_new, GNUNET_NO, GNUNET_YES, handle, GNUNET_MESSENGER_Room::handle, init_list_tunnels(), init_queue_messages(), key, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_Room::last_message, GNUNET_MESSENGER_Room::links, GNUNET_MESSENGER_Room::members, GNUNET_MESSENGER_Room::messages, GNUNET_MESSENGER_Room::opened, GNUNET_MESSENGER_Room::queue, GNUNET_MESSENGER_Room::queue_task, GNUNET_MESSENGER_Room::sender_id, GNUNET_MESSENGER_Room::subscriptions, GNUNET_MESSENGER_Room::use_handle_name, and GNUNET_MESSENGER_Room::wait_for_sync.
Referenced by GNUNET_MESSENGER_enter_room(), and GNUNET_MESSENGER_open_room().
|
static |
Definition at line 79 of file messenger_api_room.c.
References destroy_message(), GNUNET_assert, GNUNET_free, GNUNET_YES, GNUNET_MESSENGER_RoomMessageEntry::message, and value.
Referenced by destroy_room().
|
static |
Definition at line 96 of file messenger_api_room.c.
References GNUNET_assert, GNUNET_free, GNUNET_YES, and value.
Referenced by destroy_room().
|
static |
Definition at line 112 of file messenger_api_room.c.
References destroy_message(), GNUNET_assert, GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_YES, GNUNET_MESSENGER_RoomSubscription::message, GNUNET_MESSENGER_RoomSubscription::task, 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.
[in,out] | room | Room |
Definition at line 134 of file messenger_api_room.c.
References clear_list_tunnels(), clear_queue_messages(), GNUNET_MESSENGER_Room::control, destroy_message_control(), GNUNET_MESSENGER_Room::entries, GNUNET_assert, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_free, GNUNET_SCHEDULER_cancel(), iterate_destroy_link(), iterate_destroy_message(), iterate_destroy_subscription(), GNUNET_MESSENGER_Room::links, GNUNET_MESSENGER_Room::members, GNUNET_MESSENGER_Room::messages, GNUNET_MESSENGER_Room::queue, GNUNET_MESSENGER_Room::queue_task, GNUNET_MESSENGER_RoomSubscription::room, GNUNET_MESSENGER_Room::sender_id, and GNUNET_MESSENGER_Room::subscriptions.
Referenced by close_handle_room(), GNUNET_MESSENGER_enter_room(), GNUNET_MESSENGER_open_room(), and iterate_destroy_room().
enum GNUNET_GenericReturnValue is_room_available | ( | const struct GNUNET_MESSENGER_Room * | room | ) |
Checks whether a room is available to send messages.
[in] | room | Room |
Definition at line 182 of file messenger_api_room.c.
References GNUNET_MESSENGER_Room::entries, get_room_sender_id(), GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_Room::opened, and GNUNET_MESSENGER_RoomSubscription::room.
Referenced by dequeue_message_from_room(), dequeue_messages_from_room(), and enqueue_message_to_room().
struct GNUNET_MESSENGER_Handle * get_room_handle | ( | struct GNUNET_MESSENGER_Room * | room | ) |
Returns the messenger handle of the room.
[in,out] | room | Room |
Definition at line 197 of file messenger_api_room.c.
References GNUNET_assert, and GNUNET_MESSENGER_Room::handle.
Referenced by process_message_control(), and task_message_control().
const struct GNUNET_ShortHashCode * get_room_sender_id | ( | const struct GNUNET_MESSENGER_Room * | room | ) |
Returns the member id of the room's sender.
[in] | room | Room |
Definition at line 206 of file messenger_api_room.c.
References GNUNET_assert, and GNUNET_MESSENGER_Room::sender_id.
Referenced by get_handle_contact(), handle_member_id(), handle_miss_message(), is_room_available(), and send_message_to_room().
void set_room_sender_id | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_ShortHashCode * | id | ||
) |
Sets the member id of the room's sender to a specific id or NULL.
[in,out] | room | Room |
[in] | id | Member id or NULL |
Definition at line 215 of file messenger_api_room.c.
References GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_new, GNUNET_MESSENGER_Room::key, and GNUNET_MESSENGER_Room::sender_id.
Referenced by handle_id_message(), and handle_member_id().
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 240 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomMessageEntry::completed, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_YES, GNUNET_MESSENGER_RoomMessageEntry::message, and GNUNET_MESSENGER_Room::messages.
Referenced by GNUNET_MESSENGER_get_message().
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 257 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomMessageEntry::completed, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_YES, GNUNET_MESSENGER_Room::messages, and GNUNET_MESSENGER_RoomMessageEntry::sender.
Referenced by GNUNET_MESSENGER_get_sender().
struct GNUNET_MESSENGER_Contact * get_room_recipient | ( | const struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Returns a messages recipient locally stored from a map for a given hash in a room.
If no matching message is found or the message has not been privately received, NULL gets returned.
[in] | room | Room |
[in] | hash | Hash of message |
Definition at line 274 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomMessageEntry::completed, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_YES, GNUNET_MESSENGER_Room::messages, and GNUNET_MESSENGER_RoomMessageEntry::recipient.
Referenced by GNUNET_MESSENGER_get_recipient().
void delete_room_message | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_TIME_Relative | delay | ||
) |
Deletes a message with a given hash inside a room under a specific delay.
[in,out] | room | Room |
[in] | hash | Hash of message |
[in] | delay | Delay of deletion |
Definition at line 291 of file messenger_api_room.c.
References create_message_delete(), enqueue_message_to_room(), GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, and GNUNET_log.
Referenced by GNUNET_MESSENGER_delete_message(), and handle_delete_message().
void callback_room_message | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Executes the message callback for a given hash in a room.
[in,out] | room | Room |
[in] | hash | Hash of message |
Definition at line 313 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_MESSENGER_FLAG_UPDATE, handle, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, GNUNET_MESSENGER_RoomMessageEntry::recipient, and GNUNET_MESSENGER_RoomMessageEntry::sender.
Referenced by handle_delete_message(), handle_message(), and handle_message_control().
|
static |
Definition at line 681 of file messenger_api_room.c.
References callback_room_message(), GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_MESSENGER_FLAG_UPDATE, 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_MESSENGER_KIND_PRIVATE, GNUNET_MESSENGER_KIND_TRANSCRIPT, handle_delete_message(), handle_id_message(), handle_join_message(), handle_key_message(), handle_leave_message(), handle_miss_message(), handle_name_message(), handle_private_message(), handle_transcript_message(), GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageHeader::kind, and GNUNET_MESSENGER_RoomMessageEntry::message.
Referenced by handle_private_message(), handle_room_message(), and handle_transcript_message().
|
static |
Definition at line 349 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, context, get_context_from_member(), get_handle_contact_store(), get_store_contact(), GNUNET_assert, 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_MessageJoin::key, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_Room::members, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_RoomMessageEntry::sender, and GNUNET_MESSENGER_MessageHeader::sender_id.
Referenced by handle_message().
|
static |
Definition at line 381 of file messenger_api_room.c.
References decrease_contact_rc(), GNUNET_assert, GNUNET_CONTAINER_multishortmap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_YES, GNUNET_MESSENGER_Room::members, GNUNET_MESSENGER_RoomMessageEntry::message, and GNUNET_MESSENGER_RoomMessageEntry::sender.
Referenced by handle_message().
|
static |
Definition at line 401 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_RoomMessageEntry::flags, get_handle_name(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_MESSENGER_FLAG_SENT, GNUNET_YES, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_MessageName::name, GNUNET_MESSENGER_MessageBody::name, GNUNET_MESSENGER_RoomMessageEntry::sender, set_contact_name(), and GNUNET_MESSENGER_Room::use_handle_name.
Referenced by handle_message().
|
static |
Definition at line 430 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, context, get_context_from_member(), get_handle_contact_store(), GNUNET_assert, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageKey::key, GNUNET_MESSENGER_MessageBody::key, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_RoomMessageEntry::sender, GNUNET_MESSENGER_MessageHeader::sender_id, and update_store_contact().
Referenced by handle_message().
|
static |
Definition at line 453 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, context, GNUNET_MESSENGER_RoomMessageEntry::flags, get_contact_key(), get_context_from_member(), get_handle_contact_store(), GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multishortmap_put(), GNUNET_CONTAINER_multishortmap_remove(), GNUNET_MESSENGER_FLAG_SENT, 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_RoomMessageEntry::message, GNUNET_MESSENGER_RoomMessageEntry::sender, GNUNET_MESSENGER_MessageHeader::sender_id, set_room_sender_id(), and update_store_contact().
Referenced by handle_message().
|
static |
Definition at line 491 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_Room::entries, find_list_tunnels(), GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_MESSENGER_FLAG_SENT, GNUNET_MESSENGER_ListTunnel::hash, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_MessageBody::miss, GNUNET_MESSENGER_MessageMiss::peer, and remove_from_list_tunnels().
Referenced by handle_message().
|
static |
Definition at line 510 of file messenger_api_room.c.
References copy_message(), decrypt_message(), destroy_message(), GNUNET_MESSENGER_RoomMessageEntry::flags, get_handle_contact(), get_handle_key(), GNUNET_assert, GNUNET_MESSENGER_FLAG_PRIVATE, GNUNET_YES, GNUNET_MESSENGER_Room::handle, handle_message(), GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_RoomMessageEntry::recipient, and GNUNET_MESSENGER_RoomMessageEntry::sender.
Referenced by handle_message().
|
static |
Definition at line 546 of file messenger_api_room.c.
References consensus-simulation::action, GNUNET_MESSENGER_Message::body, callback_room_message(), GNUNET_MESSENGER_MessageDelete::delay, delete_room_message(), GNUNET_MESSENGER_MessageBody::deletion, destroy_message(), GNUNET_MESSENGER_RoomMessageEntry::flags, get_handle_contact(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_MESSENGER_FLAG_DELETE, GNUNET_TIME_absolute_add(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_difference(), GNUNET_TIME_absolute_ntoh(), GNUNET_TIME_relative_ntoh(), GNUNET_YES, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_MessageDelete::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_Room::key, link_room_deletion(), GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, GNUNET_MESSENGER_RoomMessageEntry::sender, and GNUNET_MESSENGER_MessageHeader::timestamp.
Referenced by handle_message().
|
static |
Definition at line 595 of file messenger_api_room.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_RoomMessageEntry::completed, copy_message(), copy_message_header(), destroy_message(), GNUNET_MESSENGER_RoomMessageEntry::flags, get_handle_contact(), get_handle_contact_store(), get_store_contact(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_free, GNUNET_MESSENGER_FLAG_NONE, GNUNET_MESSENGER_FLAG_PRIVATE, GNUNET_MESSENGER_FLAG_UPDATE, GNUNET_MESSENGER_KIND_PRIVATE, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_Room::handle, handle_message(), GNUNET_MESSENGER_MessageTranscript::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageTranscript::key, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_MessageHeader::kind, link_room_message(), GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, read_transcript_message(), GNUNET_MESSENGER_RoomMessageEntry::recipient, GNUNET_MESSENGER_RoomMessageEntry::sender, and GNUNET_MESSENGER_MessageBody::transcript.
Referenced by handle_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, | ||
enum GNUNET_MESSENGER_MessageFlags | flags | ||
) |
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.
The contact of the message's sender could be updated or even created. It may not be freed or destroyed though! (The contact may still be in use for old messages...)
[in,out] | room | Room |
[in,out] | sender | Contact of sender |
[in] | message | Message |
[in] | hash | Hash of message |
[in] | flags | Flags of message |
Definition at line 726 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomMessageEntry::completed, copy_message(), copy_message_header(), GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_free, GNUNET_MESSENGER_FLAG_NONE, GNUNET_MESSENGER_FLAG_PRIVATE, GNUNET_MESSENGER_KIND_PRIVATE, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_YES, handle_message(), GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, GNUNET_MESSENGER_RoomMessageEntry::recipient, and GNUNET_MESSENGER_RoomMessageEntry::sender.
Referenced by handle_message_control().
void update_room_last_message | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Updates the last message hash of a room for the client API so that new messages can point to the latest message hash while sending.
[in,out] | room | Room |
[in] | hash | Hash of message |
Definition at line 782 of file messenger_api_room.c.
References GNUNET_assert, GNUNET_memcpy, and GNUNET_MESSENGER_Room::last_message.
Referenced by handle_message_control(), handle_room_close(), handle_room_entry(), handle_room_open(), handle_room_sync(), and send_message_to_room().
|
static |
Definition at line 799 of file messenger_api_room.c.
References call, GNUNET_assert, 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.
[in,out] | room | Room |
[in] | callback | Function called for each member |
[in,out] | cls | Closure |
Definition at line 816 of file messenger_api_room.c.
References call, 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().
|
static |
Definition at line 846 of file messenger_api_room.c.
References GNUNET_MESSENGER_MemberFind::contact, GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_MemberFind::result, and value.
Referenced by find_room_member().
enum GNUNET_GenericReturnValue find_room_member | ( | const struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_MESSENGER_Contact * | contact | ||
) |
Checks through all members of a given room if a specific contact is found and returns a result depending on that.
[in] | room | Room |
[in] | contact |
Definition at line 869 of file messenger_api_room.c.
References GNUNET_MESSENGER_MemberFind::contact, GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_NO, iterate_find_member(), GNUNET_MESSENGER_Room::members, and GNUNET_MESSENGER_MemberFind::result.
Referenced by iterate_find_room().
|
static |
Definition at line 887 of file messenger_api_room.c.
References GNUNET_assert, GNUNET_CRYPTO_hash_cmp(), GNUNET_NO, GNUNET_YES, result, and value.
Referenced by link_room_message().
void link_room_message | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_HashCode * | other | ||
) |
Links a message identified by its hash inside a given room with another message identified by its other hash.
Linked messages will be deleted automatically, if any linked message to it gets deleted.
[in,out] | room | Room |
[in] | hash | Hash of message |
[in] | other | Hash of other message |
Definition at line 910 of file messenger_api_room.c.
References find_linked_hash(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_free, GNUNET_memdup, GNUNET_OK, GNUNET_MESSENGER_Room::links, result, and value.
Referenced by dequeue_message_from_room(), and handle_transcript_message().
|
static |
Definition at line 946 of file messenger_api_room.c.
References GNUNET_assert, GNUNET_CRYPTO_hash_cmp(), GNUNET_NO, GNUNET_YES, and value.
Referenced by delete_linked_hash().
|
static |
Definition at line 967 of file messenger_api_room.c.
References clear_linked_hash(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_memcpy, GNUNET_YES, info, key, and value.
Referenced by link_room_deletion().
void link_room_deletion | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_TIME_Relative | delay, | ||
GNUNET_MESSENGER_RoomLinkDeletion | deletion | ||
) |
Delete all remaining links to a certain message identified by its hash inside a given room and cause a deletion process to all of the linked messages.
[in,out] | room | Room |
[in] | hash | Hash of message |
[in] | delay | Delay for linked deletion |
[in] | deletion | Function called for each linked deletion |
Definition at line 1001 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomLinkDeletionInfo::delay, delete_linked_hash(), GNUNET_MESSENGER_RoomLinkDeletionInfo::deletion, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_remove_all(), info, GNUNET_MESSENGER_Room::links, and GNUNET_MESSENGER_RoomLinkDeletionInfo::room.
Referenced by handle_delete_message().