#include "messenger_api_message_control.h"
#include "gnunet_common.h"
#include "gnunet_messenger_service.h"
#include "gnunet_scheduler_lib.h"
#include "messenger_api_contact.h"
#include "messenger_api_contact_store.h"
#include "messenger_api_handle.h"
#include "messenger_api_message.h"
#include "messenger_api_room.h"
Go to the source code of this file.
Functions | |
struct GNUNET_MESSENGER_MessageControl * | create_message_control (struct GNUNET_MESSENGER_Room *room) |
Creates and allocates a new message control for a room of the client API. More... | |
void | destroy_message_control (struct GNUNET_MESSENGER_MessageControl *control) |
Destroys a message control and frees its memory fully from the client API. More... | |
static void | enqueue_message_control (struct GNUNET_MESSENGER_MessageControl *control, const struct GNUNET_HashCode *sender, const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message, enum GNUNET_MESSENGER_MessageFlags flags) |
static void | handle_message_control (struct GNUNET_MESSENGER_MessageControl *control, struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message, enum GNUNET_MESSENGER_MessageFlags flags) |
static void | task_message_control (void *cls) |
static enum GNUNET_GenericReturnValue | iterate_message_control (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
void | process_message_control (struct GNUNET_MESSENGER_MessageControl *control, const struct GNUNET_HashCode *sender, const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message, enum GNUNET_MESSENGER_MessageFlags flags) |
Processes a new message with its hash and regarding information about sender, context and message flags using a selected message control. More... | |
struct GNUNET_MESSENGER_MessageControl * create_message_control | ( | struct GNUNET_MESSENGER_Room * | room | ) |
Creates and allocates a new message control for a room of the client API.
[in,out] | room | Room |
Definition at line 38 of file messenger_api_message_control.c.
References GNUNET_assert, GNUNET_CONTAINER_multishortmap_create(), GNUNET_new, GNUNET_NO, GNUNET_MESSENGER_MessageControl::head, GNUNET_MESSENGER_MessageControl::member_messages, GNUNET_MESSENGER_MessageControl::peer_messages, GNUNET_MESSENGER_MessageControl::room, and GNUNET_MESSENGER_MessageControl::tail.
Referenced by create_room().
void destroy_message_control | ( | struct GNUNET_MESSENGER_MessageControl * | control | ) |
Destroys a message control and frees its memory fully from the client API.
[in,out] | control | Message control |
Definition at line 59 of file messenger_api_message_control.c.
References GNUNET_MESSENGER_MessageControlQueue::control, destroy_message(), GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_MESSENGER_MessageControl::head, GNUNET_MESSENGER_MessageControl::member_messages, GNUNET_MESSENGER_MessageControl::peer_messages, queue(), and GNUNET_MESSENGER_MessageControl::tail.
Referenced by destroy_room().
|
static |
Definition at line 85 of file messenger_api_message_control.c.
References context, GNUNET_MESSENGER_MessageControlQueue::control, copy_message(), GNUNET_MESSENGER_MessageControlQueue::flags, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multishortmap_put(), GNUNET_memcpy, GNUNET_new, GNUNET_YES, GNUNET_MESSENGER_MessageControlQueue::hash, GNUNET_MESSENGER_MessageControl::head, GNUNET_MESSENGER_Message::header, is_peer_message(), map, GNUNET_MESSENGER_MessageControl::member_messages, GNUNET_MESSENGER_MessageControlQueue::message, GNUNET_MESSENGER_MessageControl::peer_messages, queue(), GNUNET_MESSENGER_MessageControlQueue::sender, GNUNET_MESSENGER_MessageHeader::sender_id, and GNUNET_MESSENGER_MessageControl::tail.
Referenced by process_message_control().
|
static |
Definition at line 123 of file messenger_api_message_control.c.
References callback_room_message(), GNUNET_MESSENGER_MessageControlQueue::control, GNUNET_MESSENGER_MessageControlQueue::flags, get_message_discourse(), GNUNET_assert, GNUNET_MESSENGER_FLAG_RECENT, handle_room_message(), GNUNET_MESSENGER_MessageControlQueue::hash, GNUNET_MESSENGER_MessageControlQueue::message, GNUNET_MESSENGER_MessageControl::room, and update_room_last_message().
Referenced by process_message_control(), and task_message_control().
|
static |
Definition at line 142 of file messenger_api_message_control.c.
References destroy_message(), get_handle_contact_store(), get_room_handle(), get_store_contact_raw(), GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multishortmap_remove(), GNUNET_free, GNUNET_YES, handle, handle_message_control(), GNUNET_MESSENGER_MessageControl::head, is_peer_message(), map, GNUNET_MESSENGER_MessageControl::member_messages, GNUNET_MESSENGER_MessageControl::peer_messages, queue(), GNUNET_MESSENGER_MessageControl::room, and GNUNET_MESSENGER_MessageControl::tail.
Referenced by iterate_message_control().
|
static |
Definition at line 191 of file messenger_api_message_control.c.
References GNUNET_assert, GNUNET_SCHEDULER_add_now(), GNUNET_YES, key, queue(), task_message_control(), and value.
Referenced by process_message_control().
void process_message_control | ( | struct GNUNET_MESSENGER_MessageControl * | control, |
const struct GNUNET_HashCode * | sender, | ||
const struct GNUNET_HashCode * | context, | ||
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_MESSENGER_Message * | message, | ||
enum GNUNET_MESSENGER_MessageFlags | flags | ||
) |
Processes a new message with its hash and regarding information about sender, context and message flags using a selected message control.
The message control will ensure order of messages so that senders of messages can be identified via previously processed messages.
[in,out] | control | Message control |
[in] | sender | Sender hash |
[in] | context | Context hash |
[in] | hash | Message hash |
[in] | message | Message |
[in] | flags | Message flags |
Definition at line 210 of file messenger_api_message_control.c.
References GNUNET_MESSENGER_Message::body, context, enqueue_message_control(), get_handle_contact_store(), get_room_handle(), get_store_contact_raw(), GNUNET_assert, GNUNET_CONTAINER_multishortmap_get_multiple(), GNUNET_MESSENGER_KIND_ID, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_PEER, GNUNET_YES, handle, handle_message_control(), GNUNET_MESSENGER_Message::header, id, GNUNET_MESSENGER_MessageId::id, GNUNET_MESSENGER_MessageBody::id, is_peer_message(), iterate_message_control(), GNUNET_MESSENGER_MessageHeader::kind, map, GNUNET_MESSENGER_MessageControl::member_messages, GNUNET_MESSENGER_MessageControl::peer_messages, GNUNET_MESSENGER_MessageControl::room, and GNUNET_MESSENGER_MessageHeader::sender_id.
Referenced by handle_recv_message().