#include "gnunet_common.h"
#include "gnunet_time_lib.h"
#include "gnunet_util_lib.h"
#include "gnunet_messenger_service.h"
#include "messenger_api_handle.h"
#include "messenger_api_list_tunnels.h"
#include "messenger_api_contact.h"
#include "messenger_api_message_control.h"
#include "messenger_api_queue_messages.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_MESSENGER_RoomAction |
struct | GNUNET_MESSENGER_RoomMessageEntry |
struct | GNUNET_MESSENGER_RoomSubscription |
struct | GNUNET_MESSENGER_Room |
Typedefs | |
typedef void(* | GNUNET_MESSENGER_RoomLinkDeletion) (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) |
Functions | |
struct GNUNET_MESSENGER_Room * | create_room (struct GNUNET_MESSENGER_Handle *handle, const union GNUNET_MESSENGER_RoomKey *key) |
Creates and allocates a new room for a handle with a given key for the client API. More... | |
void | destroy_room (struct GNUNET_MESSENGER_Room *room) |
Destroys a room and frees its memory fully from the client API. More... | |
const struct GNUNET_HashCode * | get_room_key (const struct GNUNET_MESSENGER_Room *room) |
Return a the hash representation of a given room. More... | |
enum GNUNET_GenericReturnValue | is_room_public (const struct GNUNET_MESSENGER_Room *room) |
Returns whether a given room is public or using epoch keys to encrypt private traffic and sync those keys automatically. More... | |
void | delay_room_action (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) |
Enqueues delayed handling of a message in a room under a given hash once a specific delay has timed out. More... | |
void | cancel_room_action (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Cancels the delayed handling of a message in a room under a given hash in case it has been queued using the function delay_room_action() before and the action has not been fully processed yet. More... | |
void | cancel_room_actions_by (struct GNUNET_MESSENGER_Room *room, enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_HashCode *epoch_hash, const union GNUNET_MESSENGER_EpochIdentifier *identifier, const struct GNUNET_MESSENGER_Contact *contact) |
Searches queued actions to handle messages of a specific message kind in a room with any delay and cancels them using the function cancel_room_action() . 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... | |
struct GNUNET_MESSENGER_Epoch * | get_room_epoch (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue recent) |
Returns the epoch in a given room from a specific epoch hash that represents the exact message the epoch starts. More... | |
void | generate_room_epoch_announcement (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Epoch *epoch, struct GNUNET_MESSENGER_EpochAnnouncement **announcement) |
Generate a new announcement for a given epoch in a room under a random and unique announcement identifier. More... | |
struct GNUNET_MESSENGER_Epoch * | get_room_message_epoch (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Returns the epoch of a local message with a given hash in a room. More... | |
const union GNUNET_MESSENGER_EpochIdentifier * | get_room_message_epoch_identifier (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Returns the epoch identifier a local message with a given hash is targeting in a room with its specific operation. 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... | |
enum GNUNET_GenericReturnValue | is_room_message_sent (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Returns whether a message is sent by the handle of the given room itself or another client that is using the same unique key to sign its sent messages. 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... | |
const struct GNUNET_HashCode * | get_room_epoch_hash (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Returns the messages epoch hash that is locally stored for a message of 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... | |
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, const struct GNUNET_HashCode *epoch, 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... | |
enum GNUNET_GenericReturnValue | update_room_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Updates any message with a given hash in a room for the client API to force handling the message again after some changes that might affect it. More... | |
enum GNUNET_GenericReturnValue | update_room_secret_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_SymmetricSessionKey *key, enum GNUNET_GenericReturnValue update) |
Updates a secret message with a given hash in a room for the client API trying to decrypt it with the given epoch key from an epoch announcement. More... | |
void | update_room_last_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_HashCode *epoch) |
Updates the last message hash and its epoch of a room for the client API so that new messages can point to the latest message hash while sending. More... | |
void | copy_room_last_message (const struct GNUNET_MESSENGER_Room *room, struct GNUNET_HashCode *hash) |
Copies the last message hash of a room into a given hash variable. More... | |
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... | |
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... | |
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... | |
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... | |
typedef void(* GNUNET_MESSENGER_RoomLinkDeletion) (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) |
Definition at line 108 of file messenger_api_room.h.
struct GNUNET_MESSENGER_Room * create_room | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const union GNUNET_MESSENGER_RoomKey * | 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 48 of file messenger_api_room.c.
References GNUNET_MESSENGER_Room::actions, GNUNET_MESSENGER_Room::control, create_message_control(), GNUNET_MESSENGER_Room::entries, GNUNET_MESSENGER_Room::epochs, 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(), GNUNET_MESSENGER_Room::joined, key, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_Room::last_epoch, 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::request_task, GNUNET_MESSENGER_Room::requests, 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().
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 183 of file messenger_api_room.c.
References GNUNET_MESSENGER_Room::actions, clear_list_tunnels(), clear_queue_messages(), GNUNET_MESSENGER_Room::control, destroy_message_control(), GNUNET_MESSENGER_Room::entries, GNUNET_MESSENGER_Room::epochs, 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_action(), iterate_destroy_epoch(), 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_Room::request_task, GNUNET_MESSENGER_Room::requests, GNUNET_MESSENGER_Epoch::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().
const struct GNUNET_HashCode * get_room_key | ( | const struct GNUNET_MESSENGER_Room * | room | ) |
Return a the hash representation of a given room.
[in] | room | Room |
Definition at line 254 of file messenger_api_room.c.
References GNUNET_assert, GNUNET_MESSENGER_RoomKey::hash, and GNUNET_MESSENGER_Room::key.
Referenced by cb_key_monitor(), get_room_availble_epoch_entry(), GNUNET_MESSENGER_room_get_key(), handle_appeal_message(), handle_epoch_announcement(), handle_id_message(), handle_join_message(), handle_key_message(), handle_name_message(), handle_private_message(), request_message_from_room(), send_close_room(), send_enter_room(), send_message_to_room(), send_message_to_room_with_key(), send_open_room(), send_sync_room(), set_room_sender_id(), write_epoch_announcement_record(), and write_epoch_group_record().
enum GNUNET_GenericReturnValue is_room_public | ( | const struct GNUNET_MESSENGER_Room * | room | ) |
Returns whether a given room is public or using epoch keys to encrypt private traffic and sync those keys automatically.
[in] | room | Room |
Definition at line 263 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomKey::code, GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_Room::key, and GNUNET_MESSENGER_RoomKeyCode::public_bit.
Referenced by handle_epoch_announcement_delay(), handle_epoch_group_announcement_delay(), and send_message_to_room().
void delay_room_action | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_TIME_Relative | delay | ||
) |
Enqueues delayed handling of a message in a room under a given hash once a specific delay has timed out.
[in,out] | room | Room |
[in] | hash | Hash of message |
[in] | delay | Delay of action |
Definition at line 564 of file messenger_api_room.c.
References warningfilter::action, GNUNET_MESSENGER_Room::actions, GNUNET_assert, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_free, GNUNET_memcpy, GNUNET_new, GNUNET_OK, GNUNET_SCHEDULER_add_delayed_with_priority(), GNUNET_SCHEDULER_PRIORITY_HIGH, handle_room_action_task(), GNUNET_MESSENGER_RoomAction::hash, and GNUNET_MESSENGER_RoomAction::room.
Referenced by handle_appeal_message(), handle_delete_message(), handle_epoch_announcement(), handle_epoch_group_announcement(), and handle_message().
void cancel_room_action | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Cancels the delayed handling of a message in a room under a given hash in case it has been queued using the function delay_room_action()
before and the action has not been fully processed yet.
[in,out] | room | Room |
[in] | hash | Hash of message |
Definition at line 597 of file messenger_api_room.c.
References GNUNET_MESSENGER_Room::actions, GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_remove_all(), GNUNET_YES, GNUNET_MESSENGER_RoomAction::hash, iterate_destroy_action(), and GNUNET_MESSENGER_RoomAction::room.
Referenced by handle_access_message(), and iterate_cancel_action().
void cancel_room_actions_by | ( | struct GNUNET_MESSENGER_Room * | room, |
enum GNUNET_MESSENGER_MessageKind | kind, | ||
const struct GNUNET_HashCode * | epoch_hash, | ||
const union GNUNET_MESSENGER_EpochIdentifier * | identifier, | ||
const struct GNUNET_MESSENGER_Contact * | contact | ||
) |
Searches queued actions to handle messages of a specific message kind in a room with any delay and cancels them using the function cancel_room_action()
.
The actions that need to be cancelled can be filtered by providing the specific hash of the epoch, identifier of the epoch key or group or even the contact from the sender of the exact message. All these parameters are optional.
[in,out] | room | Room |
[in] | kind | Message kind |
[in] | epoch_hash | Hash of epoch or NULL |
[in] | identifier | Identifier of epoch key/group or NULL |
[in] | contact | Contact of sender or NULL |
Definition at line 690 of file messenger_api_room.c.
References GNUNET_MESSENGER_Room::actions, GNUNET_MESSENGER_RoomCancelAction::contact, GNUNET_MESSENGER_RoomCancelAction::epoch_hash, GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_NO, GNUNET_MESSENGER_RoomCancelAction::identifier, iterate_cancel_action(), iterate_cancel_action_by(), GNUNET_MESSENGER_RoomCancelAction::kind, and GNUNET_MESSENGER_RoomCancelAction::map.
Referenced by handle_epoch_announcement().
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 724 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, and GNUNET_MESSENGER_Room::opened.
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 739 of file messenger_api_room.c.
References GNUNET_assert, and GNUNET_MESSENGER_Room::handle.
Referenced by handle_epoch_announcement(), process_message_control(), task_message_control(), write_epoch_announcement_record(), and write_epoch_group_record().
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 748 of file messenger_api_room.c.
References GNUNET_assert, and GNUNET_MESSENGER_Room::sender_id.
Referenced by get_handle_contact(), GNUNET_MESSENGER_get_message(), handle_join_message(), handle_member_id(), handle_miss_message(), handle_room_request_task(), 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 757 of file messenger_api_room.c.
References get_room_key(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_new, and GNUNET_MESSENGER_Room::sender_id.
Referenced by handle_id_message(), and handle_member_id().
struct GNUNET_MESSENGER_Epoch * get_room_epoch | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash, | ||
enum GNUNET_GenericReturnValue | recent | ||
) |
Returns the epoch in a given room from a specific epoch hash that represents the exact message the epoch starts.
[in,out] | room | Room |
[in] | hash | Hash of epoch |
[in] | recent | Recent flag |
Definition at line 782 of file messenger_api_room.c.
References create_epoch(), create_new_epoch(), destroy_epoch(), GNUNET_MESSENGER_Room::epochs, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_is_zero, GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_Epoch::hash, and GNUNET_MESSENGER_Epoch::room.
Referenced by cb_key_monitor(), get_members_of_epoch(), get_room_availble_epoch_entry(), get_room_message_epoch(), handle_message(), invalidate_epoch_announcement(), invalidate_epoch_group(), send_message_to_room(), and setup_following_epochs_of_previous().
void generate_room_epoch_announcement | ( | struct GNUNET_MESSENGER_Room * | room, |
struct GNUNET_MESSENGER_Epoch * | epoch, | ||
struct GNUNET_MESSENGER_EpochAnnouncement ** | announcement | ||
) |
Generate a new announcement for a given epoch in a room under a random and unique announcement identifier.
The function will automatically generate an announcement message and send it to others.
[in,out] | room | Room |
[in,out] | epoch | Epoch |
[out] | announcement | Epoch announcement |
Definition at line 820 of file messenger_api_room.c.
References GNUNET_MESSENGER_Epoch::announcements, create_epoch_announcement(), destroy_epoch_announcement(), GNUNET_MESSENGER_EpochAnnouncement::epoch, get_epoch_announcement_key(), GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_multishortmap_put(), GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_EpochAnnouncement::identifier, send_epoch_announcement(), and set_epoch_announcement_key().
Referenced by send_message_to_room().
struct GNUNET_MESSENGER_Epoch * get_room_message_epoch | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Returns the epoch of a local message with a given hash in a room.
If no matching message is found or no matching epoch for that message is available, NULL gets returned.
[in,out] | room | Room |
[in] | hash | Hash of message |
Definition at line 854 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomMessageEntry::epoch, get_room_epoch(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), is_message_entry_recent(), and GNUNET_MESSENGER_Room::messages.
Referenced by get_epoch_previous_announcement(), get_epoch_previous_group(), handle_room_delayed_deletion(), and iterate_cancel_action_by().
const union GNUNET_MESSENGER_EpochIdentifier * get_room_message_epoch_identifier | ( | const struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Returns the epoch identifier a local message with a given hash is targeting in a room with its specific operation.
The function is returning NULL if the given message does not provide any context which can be identified with an epoch identifier or if there's no message available under the given hash.
[in] | room | Room |
[in] | hash | Hash of message |
Definition at line 872 of file messenger_api_room.c.
References GNUNET_MESSENGER_MessageBody::access, GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_MessageBody::appeal, GNUNET_MESSENGER_MessageBody::authorization, GNUNET_MESSENGER_Message::body, get_room_message_epoch_identifier(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_MESSENGER_KIND_ACCESS, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_MESSENGER_KIND_APPEAL, GNUNET_MESSENGER_KIND_AUTHORIZATION, GNUNET_MESSENGER_KIND_GROUP, GNUNET_MESSENGER_KIND_REVOLUTION, GNUNET_MESSENGER_KIND_SECRET, GNUNET_MESSENGER_MessageBody::group, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageAnnouncement::identifier, GNUNET_MESSENGER_MessageSecret::identifier, GNUNET_MESSENGER_MessageRevolution::identifier, GNUNET_MESSENGER_MessageGroup::identifier, GNUNET_MESSENGER_MessageAuthorization::identifier, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, GNUNET_MESSENGER_MessageBody::revolution, and GNUNET_MESSENGER_MessageBody::secret.
Referenced by get_room_message_epoch_identifier(), and iterate_cancel_action_by().
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 911 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 get_epoch_previous_announcement(), get_epoch_previous_group(), get_epoch_proposal_group(), get_members_of_epoch(), GNUNET_MESSENGER_delete_message(), GNUNET_MESSENGER_get_message(), handle_epoch_announcement_access(), invalidate_epoch_announcement(), invalidate_epoch_group(), is_epoch_member_in_room_graph(), is_epoch_previous_of_other(), iterate_cancel_action_by(), require_message_from_room(), send_epoch_announcement_access(), send_epoch_announcement_authorization(), send_epoch_group(), send_epoch_group_access(), send_epoch_group_authorization(), set_epoch_proposal_group(), and setup_following_epochs_of_previous().
enum GNUNET_GenericReturnValue is_room_message_sent | ( | const struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Returns whether a message is sent by the handle of the given room itself or another client that is using the same unique key to sign its sent messages.
[in] | room | Room |
[in] | hash | Hash of message |
Definition at line 931 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_MESSENGER_FLAG_SENT, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, and GNUNET_MESSENGER_Room::messages.
Referenced by send_epoch_group(), send_epoch_group_access(), and send_epoch_group_authorization().
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 951 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 get_members_of_epoch(), GNUNET_MESSENGER_get_sender(), iterate_cancel_action_by(), and send_epoch_group().
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 968 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().
const struct GNUNET_HashCode * get_room_epoch_hash | ( | const struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Returns the messages epoch hash that is locally stored for a message of 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 985 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomMessageEntry::epoch, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), and GNUNET_MESSENGER_Room::messages.
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 1002 of file messenger_api_room.c.
References create_message_deletion(), enqueue_message_to_room(), GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, and GNUNET_NO.
Referenced by GNUNET_MESSENGER_delete_message(), and handle_room_delayed_deletion().
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 1024 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_message_control(), handle_room_delayed_action(), and handle_room_delayed_deletion().
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, | ||
const struct GNUNET_HashCode * | epoch, | ||
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] | epoch | Hash of epoch |
[in] | flags | Flags of message |
Definition at line 2185 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomMessageEntry::completed, copy_message(), copy_message_header(), GNUNET_MESSENGER_RoomMessageEntry::epoch, GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_free, GNUNET_memcpy, 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().
enum GNUNET_GenericReturnValue update_room_message | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Updates any message with a given hash in a room for the client API to force handling the message again after some changes that might affect it.
[in,out] | room | Room |
[in] | hash | Hash of message |
Definition at line 2244 of file messenger_api_room.c.
References GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_MESSENGER_FLAG_UPDATE, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, handle_message(), GNUNET_MESSENGER_RoomMessageEntry::message, and GNUNET_MESSENGER_Room::messages.
enum GNUNET_GenericReturnValue update_room_secret_message | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_CRYPTO_SymmetricSessionKey * | key, | ||
enum GNUNET_GenericReturnValue | update | ||
) |
Updates a secret message with a given hash in a room for the client API trying to decrypt it with the given epoch key from an epoch announcement.
[in,out] | room | Room |
[in] | hash | Hash of message |
[in] | key | Epoch key |
[in] | update | Flag message as update on success |
Definition at line 2266 of file messenger_api_room.c.
References copy_message(), decrypt_secret_message(), destroy_message(), GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_MESSENGER_FLAG_SECRET, GNUNET_MESSENGER_FLAG_UPDATE, GNUNET_MESSENGER_KIND_SECRET, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, handle_message(), GNUNET_MESSENGER_Message::header, key, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, and GNUNET_MESSENGER_RoomMessageEntry::sender.
Referenced by handle_secret_message_with_key().
void update_room_last_message | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_HashCode * | epoch | ||
) |
Updates the last message hash and its epoch 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 |
[in] | epoch | Hash of epoch |
Definition at line 2312 of file messenger_api_room.c.
References GNUNET_assert, GNUNET_memcpy, GNUNET_MESSENGER_Room::last_epoch, 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().
void copy_room_last_message | ( | const struct GNUNET_MESSENGER_Room * | room, |
struct GNUNET_HashCode * | hash | ||
) |
Copies the last message hash of a room into a given hash variable.
[in] | room | Room |
[out] | hash | Hash of message |
Definition at line 2326 of file messenger_api_room.c.
References GNUNET_assert, GNUNET_memcpy, and GNUNET_MESSENGER_Room::last_message.
Referenced by send_close_room(), send_enter_room(), send_message_to_room(), send_open_room(), and send_sync_room().
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 2360 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().
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 2413 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().
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 2454 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().
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 2545 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_room_delayed_deletion().