GNUnet debian-0.24.3-23-g589b01d60
messenger_api_room.h File Reference
Include dependency graph for messenger_api_room.h:
This graph shows which files directly or indirectly include this file:

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_Roomcreate_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_HashCodeget_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_Handleget_room_handle (struct GNUNET_MESSENGER_Room *room)
 Returns the messenger handle of the room. More...
 
const struct GNUNET_ShortHashCodeget_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_Epochget_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_Epochget_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_EpochIdentifierget_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_Messageget_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_Contactget_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_Contactget_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_HashCodeget_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 Documentation

◆ GNUNET_MESSENGER_RoomLinkDeletion

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.

Function Documentation

◆ create_room()

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.

Parameters
[in,out]handleHandle
[in]keyKey of room
Returns
New room

Definition at line 48 of file messenger_api_room.c.

50{
51 struct GNUNET_MESSENGER_Room *room;
52
53 GNUNET_assert ((handle) && (key));
54
55 room = GNUNET_new (struct GNUNET_MESSENGER_Room);
56 room->handle = handle;
57
58 GNUNET_memcpy (&(room->key), key, sizeof(*key));
59
60 memset (&(room->last_message), 0, sizeof(room->last_message));
61 memset (&(room->last_epoch), 0, sizeof(room->last_epoch));
62
63 room->joined = GNUNET_NO;
64 room->opened = GNUNET_NO;
67
68 room->sender_id = NULL;
69
70 init_list_tunnels (&(room->entries));
71
76
80
81 init_queue_messages (&(room->queue));
82 room->queue_task = NULL;
83
84 room->request_task = NULL;
85
86 room->control = create_message_control (room);
87
88 return room;
89}
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
struct GNUNET_CONTAINER_MultiShortmap * GNUNET_CONTAINER_multishortmap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_YES
@ GNUNET_NO
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
void init_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels)
Initializes list of tunnels peer identities as empty list.
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.
void init_queue_messages(struct GNUNET_MESSENGER_QueueMessages *messages)
Initializes queue of messages as empty queue.
struct GNUNET_CONTAINER_MultiHashMap * links
struct GNUNET_CONTAINER_MultiShortmap * subscriptions
struct GNUNET_MESSENGER_Handle * handle
enum GNUNET_GenericReturnValue opened
union GNUNET_MESSENGER_RoomKey key
enum GNUNET_GenericReturnValue wait_for_sync
struct GNUNET_CONTAINER_MultiShortmap * members
struct GNUNET_MESSENGER_MessageControl * control
struct GNUNET_SCHEDULER_Task * request_task
struct GNUNET_CONTAINER_MultiHashMap * requests
struct GNUNET_SCHEDULER_Task * queue_task
struct GNUNET_CONTAINER_MultiHashMap * epochs
struct GNUNET_HashCode last_epoch
struct GNUNET_CONTAINER_MultiHashMap * messages
struct GNUNET_CONTAINER_MultiHashMap * actions
enum GNUNET_GenericReturnValue use_handle_name
struct GNUNET_MESSENGER_QueueMessages queue
enum GNUNET_GenericReturnValue joined
struct GNUNET_MESSENGER_ListTunnels entries
struct GNUNET_ShortHashCode * sender_id
struct GNUNET_HashCode last_message

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy_room()

void destroy_room ( struct GNUNET_MESSENGER_Room room)

Destroys a room and frees its memory fully from the client API.

Parameters
[in,out]roomRoom

Definition at line 183 of file messenger_api_room.c.

184{
185 GNUNET_assert (room);
186
188
189 if (room->actions)
190 {
193
195 }
196
197 if (room->request_task)
199
200 if (room->queue_task)
202
203 clear_queue_messages (&(room->queue));
204 clear_list_tunnels (&(room->entries));
205
206 if (room->requests)
208
209 if (room->epochs)
210 {
213 NULL);
214
216 }
217
218 if (room->subscriptions)
219 {
222 NULL);
223
225 }
226
227 if (room->messages)
228 {
231
233 }
234
235 if (room->members)
237
238 if (room->links)
239 {
242
244 }
245
246 if (room->sender_id)
247 GNUNET_free (room->sender_id);
248
249 GNUNET_free (room);
250}
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
int GNUNET_CONTAINER_multishortmap_iterate(struct GNUNET_CONTAINER_MultiShortmap *map, GNUNET_CONTAINER_ShortmapIterator it, void *it_cls)
Iterate over all entries in the map.
void GNUNET_CONTAINER_multishortmap_destroy(struct GNUNET_CONTAINER_MultiShortmap *map)
Destroy a hash map.
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:980
void clear_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels)
Clears the list of tunnels peer identities.
void destroy_message_control(struct GNUNET_MESSENGER_MessageControl *control)
Destroys a message control and frees its memory fully from the client API.
void clear_queue_messages(struct GNUNET_MESSENGER_QueueMessages *messages)
Clears the queue of messages.
static enum GNUNET_GenericReturnValue iterate_destroy_epoch(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)
static enum GNUNET_GenericReturnValue iterate_destroy_action(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_message(void *cls, const struct GNUNET_HashCode *key, void *value)

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_room_key()

const struct GNUNET_HashCode * get_room_key ( const struct GNUNET_MESSENGER_Room room)

Return a the hash representation of a given room.

Parameters
[in]roomRoom
Returns
Hash of room key

Definition at line 254 of file messenger_api_room.c.

255{
256 GNUNET_assert (room);
257
258 return &(room->key.hash);
259}

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().

Here is the caller graph for this function:

◆ is_room_public()

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.

Parameters
[in]roomRoom
Returns
GNUNET_YES if the room is public, otherwise GNUNET_NO

Definition at line 263 of file messenger_api_room.c.

264{
265 GNUNET_assert (room);
266
267 return room->key.code.public_bit? GNUNET_YES : GNUNET_NO;
268}
struct GNUNET_MESSENGER_RoomKeyCode code

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().

Here is the caller graph for this function:

◆ delay_room_action()

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.

Parameters
[in,out]roomRoom
[in]hashHash of message
[in]delayDelay of action

Definition at line 564 of file messenger_api_room.c.

567{
569
570 GNUNET_assert ((room) && (hash));
571
573
574 if (! action)
575 return;
576
580 {
582 return;
583 }
584
585 GNUNET_memcpy (&(action->hash), hash, sizeof(action->hash));
586
587 action->room = room;
589 delay,
592 action);
593}
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
@ GNUNET_SCHEDULER_PRIORITY_HIGH
Run with high priority (important requests).
@ GNUNET_OK
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed_with_priority(struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1207
static void handle_room_action_task(void *cls)
struct GNUNET_HashCode hash
struct GNUNET_MESSENGER_Room * room

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancel_room_action()

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.

Parameters
[in,out]roomRoom
[in]hashHash of message

Definition at line 597 of file messenger_api_room.c.

599{
600 GNUNET_assert ((room) && (hash));
601
603 )
604 return;
605
609}
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_contains(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
int GNUNET_CONTAINER_multihashmap_remove_all(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Remove all entries for the given key from the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_get_multiple(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancel_room_actions_by()

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.

Parameters
[in,out]roomRoom
[in]kindMessage kind
[in]epoch_hashHash of epoch or NULL
[in]identifierIdentifier of epoch key/group or NULL
[in]contactContact of sender or NULL

Definition at line 690 of file messenger_api_room.c.

696{
698
699 GNUNET_assert (room);
700
701 cancel.kind = kind;
702 cancel.epoch_hash = epoch_hash;
703 cancel.identifier = identifier;
704 cancel.contact = contact;
705
707
708 if (! cancel.map)
709 return;
710
713 &cancel);
714
717 room);
718
720}
static enum GNUNET_GenericReturnValue iterate_cancel_action_by(void *cls, const struct GNUNET_HashCode *hash, void *value)
static enum GNUNET_GenericReturnValue iterate_cancel_action(void *cls, const struct GNUNET_HashCode *hash, void *value)
const struct GNUNET_HashCode * epoch_hash
const struct GNUNET_MESSENGER_Contact * contact
enum GNUNET_MESSENGER_MessageKind kind
const union GNUNET_MESSENGER_EpochIdentifier * identifier

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_room_available()

enum GNUNET_GenericReturnValue is_room_available ( const struct GNUNET_MESSENGER_Room room)

Checks whether a room is available to send messages.

Parameters
[in]roomRoom
Returns
GNUNET_YES if the room is available, otherwise GNUNET_NO

Definition at line 724 of file messenger_api_room.c.

725{
726 GNUNET_assert (room);
727
728 if (! get_room_sender_id (room))
729 return GNUNET_NO;
730
731 if ((GNUNET_YES == room->opened) || (room->entries.head))
732 return GNUNET_YES;
733 else
734 return GNUNET_NO;
735}
const struct GNUNET_ShortHashCode * get_room_sender_id(const struct GNUNET_MESSENGER_Room *room)
Returns the member id of the room's sender.
struct GNUNET_MESSENGER_ListTunnel * head

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_room_handle()

struct GNUNET_MESSENGER_Handle * get_room_handle ( struct GNUNET_MESSENGER_Room room)

Returns the messenger handle of the room.

Parameters
[in,out]roomRoom
Returns
Messenger handle or NULL

Definition at line 739 of file messenger_api_room.c.

740{
741 GNUNET_assert (room);
742
743 return room->handle;
744}

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().

Here is the caller graph for this function:

◆ get_room_sender_id()

const struct GNUNET_ShortHashCode * get_room_sender_id ( const struct GNUNET_MESSENGER_Room room)

Returns the member id of the room's sender.

Parameters
[in]roomRoom
Returns
Member id or NULL

Definition at line 748 of file messenger_api_room.c.

749{
750 GNUNET_assert (room);
751
752 return room->sender_id;
753}

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().

Here is the caller graph for this function:

◆ set_room_sender_id()

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.

Parameters
[in,out]roomRoom
[in]idMember id or NULL

Definition at line 757 of file messenger_api_room.c.

759{
760 GNUNET_assert (room);
761
762 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Set member id for room: %s\n",
763 GNUNET_h2s (get_room_key (room)));
764
765 if (! id)
766 {
767 if (room->sender_id)
768 GNUNET_free (room->sender_id);
769
770 room->sender_id = NULL;
771 return;
772 }
773
774 if (! room->sender_id)
776
777 GNUNET_memcpy (room->sender_id, id, sizeof(struct GNUNET_ShortHashCode));
778}
#define GNUNET_log(kind,...)
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_DEBUG
const struct GNUNET_HashCode * get_room_key(const struct GNUNET_MESSENGER_Room *room)
Return a the hash representation of a given room.
A 256-bit hashcode.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_room_epoch()

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.

Parameters
[in,out]roomRoom
[in]hashHash of epoch
[in]recentRecent flag
Returns
Epoch or NULL

Definition at line 782 of file messenger_api_room.c.

785{
786 struct GNUNET_MESSENGER_Epoch *epoch;
787
788 GNUNET_assert ((room) && (hash));
789
790 if (GNUNET_is_zero (hash))
791 return NULL;
792
794
795 if (epoch)
796 return epoch;
797
798 if (GNUNET_YES == recent)
799 epoch = create_new_epoch (room, hash);
800 else
801 epoch = create_epoch (room, hash);
802
803 if (! epoch)
804 return NULL;
805
807 hash,
808 epoch,
810 {
811 destroy_epoch (epoch);
812 return NULL;
813 }
814
815 return epoch;
816}
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE...
#define GNUNET_is_zero(a)
Check that memory in a is all zeros.
struct GNUNET_MESSENGER_Epoch * create_new_epoch(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Creates and allocates a new epoch in a given room which can be identified by a specific hash.
struct GNUNET_MESSENGER_Epoch * create_epoch(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Creates and allocates an epoch in a given room which can be identified by a specific hash.
void destroy_epoch(struct GNUNET_MESSENGER_Epoch *epoch)
Destroys an epoch and frees its memory fully from the client API.
struct GNUNET_MESSENGER_Room * room
struct GNUNET_HashCode hash

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_room_epoch_announcement()

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.

Parameters
[in,out]roomRoom
[in,out]epochEpoch
[out]announcementEpoch announcement

Definition at line 820 of file messenger_api_room.c.

824{
825 struct GNUNET_MESSENGER_EpochAnnouncement *epoch_announcement;
826
827 GNUNET_assert ((room) && (epoch) && (announcement) && (! (*announcement)));
828
829 epoch_announcement = create_epoch_announcement (epoch, NULL, GNUNET_YES);
830
831 if (! epoch_announcement)
832 return;
833
835 &(epoch_announcement->
837 epoch_announcement,
839 {
840 destroy_epoch_announcement (epoch_announcement);
841 return;
842 }
843
844 if (! get_epoch_announcement_key (epoch_announcement))
845 set_epoch_announcement_key (epoch_announcement, NULL, GNUNET_YES);
846
847 *announcement = epoch_announcement;
848
849 send_epoch_announcement (epoch_announcement);
850}
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multishortmap_put(struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
enum GNUNET_GenericReturnValue send_epoch_announcement(struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Tries to send an announcement message by the client for a given epoch announcement using its secret k...
struct GNUNET_MESSENGER_EpochAnnouncement * create_epoch_announcement(struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid)
Creates and allocates a new epoch announcement for a given epoch using a specific announcement identi...
const struct GNUNET_CRYPTO_SymmetricSessionKey * get_epoch_announcement_key(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Returns the secret key of a given epoch announcement or NULL.
void set_epoch_announcement_key(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, enum GNUNET_GenericReturnValue write_record)
Sets the secret key of a given epoch announcement to a shared key.
void destroy_epoch_announcement(struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Destroys a given epoch announcement and frees its resources.
union GNUNET_MESSENGER_EpochIdentifier identifier
struct GNUNET_CONTAINER_MultiShortmap * announcements

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_room_message_epoch()

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.

Parameters
[in,out]roomRoom
[in]hashHash of message
Returns
Epoch or NULL

Definition at line 854 of file messenger_api_room.c.

856{
858
859 GNUNET_assert ((room) && (hash));
860
861 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
862
863 if (! entry)
864 return NULL;
865
866 return get_room_epoch (room, &(entry->epoch),
868}
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 ep...
static enum GNUNET_GenericReturnValue is_message_entry_recent(const struct GNUNET_MESSENGER_RoomMessageEntry *entry)

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_room_message_epoch_identifier()

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.

Parameters
[in]roomRoom
[in]hashHash of message
Returns
Epoch identifier or NULL

Definition at line 872 of file messenger_api_room.c.

874{
876
877 GNUNET_assert ((room) && (hash));
878
879 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
880
881 if ((! entry) || (! entry->message))
882 return NULL;
883
884 switch (entry->message->header.kind)
885 {
887 return &(entry->message->body.announcement.identifier);
889 return &(entry->message->body.secret.identifier);
892 &(entry->message->body.appeal.
893 event));
896 &(entry->message->body.access.
897 event));
899 return &(entry->message->body.revolution.identifier);
901 return &(entry->message->body.group.identifier);
903 return &(entry->message->body.authorization.identifier);
904 default:
905 return NULL;
906 }
907}
@ GNUNET_MESSENGER_KIND_AUTHORIZATION
The authorization kind.
@ GNUNET_MESSENGER_KIND_ANNOUNCEMENT
The announcement kind.
@ GNUNET_MESSENGER_KIND_APPEAL
The appeal kind.
@ GNUNET_MESSENGER_KIND_ACCESS
The access kind.
@ GNUNET_MESSENGER_KIND_REVOLUTION
The revolution kind.
@ GNUNET_MESSENGER_KIND_SECRET
The secret kind.
@ GNUNET_MESSENGER_KIND_GROUP
The group kind.
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 specif...
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
struct GNUNET_MESSENGER_MessageAnnouncement announcement
struct GNUNET_MESSENGER_MessageGroup group
struct GNUNET_MESSENGER_MessageSecret secret
struct GNUNET_MESSENGER_MessageRevolution revolution
struct GNUNET_MESSENGER_MessageAccess access
struct GNUNET_MESSENGER_MessageAuthorization authorization
struct GNUNET_MESSENGER_MessageAppeal appeal
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
struct GNUNET_MESSENGER_MessageHeader header
Header.
struct GNUNET_MESSENGER_MessageBody body
Body.
struct GNUNET_MESSENGER_Message * message

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_room_message()

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.

Parameters
[in]roomRoom
[in]hashHash of message
Returns
Message or NULL

Definition at line 911 of file messenger_api_room.c.

913{
915
916 GNUNET_assert ((room) && (hash));
917
918 if (! (room->messages))
919 return NULL;
920
921 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
922
923 if ((! entry) || (GNUNET_YES != entry->completed))
924 return NULL;
925
926 return entry->message;
927}
enum GNUNET_GenericReturnValue completed

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_room_message_sent()

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.

Parameters
[in]roomRoom
[in]hashHash of message
Returns
GNUNET_YES if it has been sent, GNUNET_SYSERR on failure, otherwise GNUNET_NO

Definition at line 931 of file messenger_api_room.c.

933{
935
936 GNUNET_assert ((room) && (hash));
937
938 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
939
940 if (! entry)
941 return GNUNET_SYSERR;
942
944 return GNUNET_YES;
945 else
946 return GNUNET_NO;
947}
@ GNUNET_SYSERR
@ GNUNET_MESSENGER_FLAG_SENT
The sent flag.
enum GNUNET_MESSENGER_MessageFlags flags

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_room_sender()

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.

Parameters
[in]roomRoom
[in]hashHash of message
Returns
Contact of sender or NULL

Definition at line 951 of file messenger_api_room.c.

953{
955
956 GNUNET_assert ((room) && (hash));
957
958 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
959
960 if ((! entry) || (GNUNET_YES != entry->completed))
961 return NULL;
962
963 return entry->sender;
964}
struct GNUNET_MESSENGER_Contact * sender

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_room_recipient()

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.

Parameters
[in]roomRoom
[in]hashHash of message
Returns
Contact of recipient or NULL

Definition at line 968 of file messenger_api_room.c.

970{
972
973 GNUNET_assert ((room) && (hash));
974
975 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
976
977 if ((! entry) || (GNUNET_YES != entry->completed))
978 return NULL;
979
980 return entry->recipient;
981}
struct GNUNET_MESSENGER_Contact * recipient

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_room_epoch_hash()

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.

Parameters
[in]roomRoom
[in]hashHash of message
Returns
Hash of epoch or NULL

Definition at line 985 of file messenger_api_room.c.

987{
989
990 GNUNET_assert ((room) && (hash));
991
992 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
993
994 if (! entry)
995 return NULL;
996
997 return &(entry->epoch);
998}

References GNUNET_MESSENGER_RoomMessageEntry::epoch, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), and GNUNET_MESSENGER_Room::messages.

Here is the call graph for this function:

◆ delete_room_message()

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.

Parameters
[in,out]roomRoom
[in]hashHash of message
[in]delayDelay of deletion

Definition at line 1002 of file messenger_api_room.c.

1005{
1006 struct GNUNET_MESSENGER_Message *message;
1007
1008 GNUNET_assert ((room) && (hash));
1009
1010 message = create_message_deletion (hash, delay);
1011
1012 if (! message)
1013 {
1015 "Sending deletion aborted: Message creation failed!\n");
1016 return;
1017 }
1018
1019 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
1020}
@ GNUNET_ERROR_TYPE_WARNING
void enqueue_message_to_room(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *epoch, struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_Message *transcript, enum GNUNET_GenericReturnValue sync)
Enqueus a message and its optional transcript for sending it to a given room and epoch.
struct GNUNET_MESSENGER_Message * create_message_deletion(const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
Creates and allocates a new deletion message containing the hash of a message to delete after a speci...

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_room_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.

Parameters
[in,out]roomRoom
[in]hashHash of message

Definition at line 1024 of file messenger_api_room.c.

1026{
1029
1030 GNUNET_assert ((room) && (hash));
1031
1032 handle = room->handle;
1033 if (! handle)
1034 return;
1035
1036 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
1037 if (! entry)
1038 return;
1039
1040 if (handle->msg_callback)
1041 handle->msg_callback (handle->msg_cls, room,
1042 entry->sender,
1043 entry->recipient,
1044 entry->message,
1045 hash,
1046 entry->flags);
1047
1050}
@ GNUNET_MESSENGER_FLAG_UPDATE
The update flag.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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,
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...)

Parameters
[in,out]roomRoom
[in,out]senderContact of sender
[in]messageMessage
[in]hashHash of message
[in]epochHash of epoch
[in]flagsFlags of message

Definition at line 2185 of file messenger_api_room.c.

2191{
2193
2194 GNUNET_assert ((room) && (message) && (hash));
2195
2196 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
2197
2198 if (entry)
2199 goto update_entry;
2200
2202
2203 if (! entry)
2204 return;
2205
2206 entry->sender = NULL;
2207 entry->recipient = NULL;
2208
2209 entry->message = NULL;
2210
2211 GNUNET_memcpy (&(entry->epoch), epoch, sizeof (entry->epoch));
2212
2214 entry->completed = GNUNET_NO;
2215
2217 room->messages, hash, entry,
2219 {
2220 GNUNET_free (entry);
2221 return;
2222 }
2223
2224update_entry:
2225 entry->sender = sender;
2226 entry->flags = flags;
2227
2228 if (entry->message)
2229 {
2232
2234 }
2235 else
2236 entry->message = copy_message (message);
2237
2238 entry->completed = GNUNET_YES;
2239 handle_message (room, hash, entry);
2240}
@ GNUNET_MESSENGER_KIND_PRIVATE
The private kind.
@ GNUNET_MESSENGER_FLAG_PRIVATE
The private flag.
@ GNUNET_MESSENGER_FLAG_NONE
The none flag.
struct GNUNET_MESSENGER_Message * copy_message(const struct GNUNET_MESSENGER_Message *message)
Creates and allocates a copy of a given message.
void copy_message_header(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_MESSENGER_MessageHeader *header)
Copy message header details from another message to a given message.
static void handle_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_room_message()

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.

Parameters
[in,out]roomRoom
[in]hashHash of message
Returns
GNUNET_YES if successful, GNUNET_NO on failure and otherwise GNUNET_SYSERR

Definition at line 2244 of file messenger_api_room.c.

2246{
2248
2249 GNUNET_assert ((room) && (hash));
2250
2251 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
2252
2253 if ((! entry) || (! entry->message))
2254 return GNUNET_SYSERR;
2255
2257 return GNUNET_NO;
2258
2260 handle_message (room, hash, entry);
2261 return GNUNET_YES;
2262}

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.

Here is the call graph for this function:

◆ update_room_secret_message()

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.

Parameters
[in,out]roomRoom
[in]hashHash of message
[in]keyEpoch key
[in]updateFlag message as update on success
Returns
GNUNET_YES if successful, GNUNET_NO on failure and otherwise GNUNET_SYSERR

Definition at line 2266 of file messenger_api_room.c.

2270{
2272 struct GNUNET_MESSENGER_Message *secret_message;
2273
2274 GNUNET_assert ((room) && (hash) && (key));
2275
2276 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
2277
2278 if ((! entry) || (! entry->message) ||
2280 return GNUNET_SYSERR;
2281
2282 secret_message = copy_message (entry->message);
2283
2284 if (! secret_message)
2285 return GNUNET_NO;
2286
2287 if (GNUNET_YES != decrypt_secret_message (secret_message, key))
2288 {
2289 destroy_message (secret_message);
2290 secret_message = NULL;
2291 }
2292
2293 if (! secret_message)
2294 return GNUNET_NO;
2295
2296 destroy_message (entry->message);
2297
2298 entry->message = secret_message;
2300
2301 if (GNUNET_YES == update)
2303
2304 if (entry->sender)
2305 handle_message (room, hash, entry);
2306
2307 return GNUNET_YES;
2308}
@ GNUNET_MESSENGER_FLAG_SECRET
The secret flag.
enum GNUNET_GenericReturnValue decrypt_secret_message(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
Decrypts a secret message using a given shared key and replaces its body and kind with the inner encr...
void destroy_message(struct GNUNET_MESSENGER_Message *message)
Destroys a message and frees its memory fully.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_room_last_message()

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.

Parameters
[in,out]roomRoom
[in]hashHash of message
[in]epochHash of epoch

Definition at line 2312 of file messenger_api_room.c.

2315{
2316 GNUNET_assert ((room) && (hash) && (epoch));
2317
2318 GNUNET_memcpy (&(room->last_message), hash, sizeof(room->last_message));
2319
2320 if (epoch)
2321 GNUNET_memcpy (&(room->last_epoch), epoch, sizeof(room->last_epoch));
2322}

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().

Here is the caller graph for this function:

◆ copy_room_last_message()

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.

Parameters
[in]roomRoom
[out]hashHash of message

Definition at line 2326 of file messenger_api_room.c.

2328{
2329 GNUNET_assert (room);
2330
2331 GNUNET_memcpy (hash, &(room->last_message), sizeof(room->last_message));
2332}

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().

Here is the caller graph for this function:

◆ 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.

Parameters
[in,out]roomRoom
[in]callbackFunction called for each member
[in,out]clsClosure
Returns
Amount of members iterated

Definition at line 2360 of file messenger_api_room.c.

2363{
2365
2367
2368 if (! callback)
2370
2371 call.room = room;
2372 call.callback = callback;
2373 call.cls = cls;
2374
2376
2379 &call);
2380}
static struct GNUNET_CONVERSATION_Call * call
Call handle (for active outgoing call).
static enum GNUNET_GenericReturnValue iterate_local_members(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
GNUNET_MESSENGER_MemberCallback callback
struct GNUNET_MESSENGER_Room * room

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Parameters
[in]roomRoom
[in]contact
Returns
GNUNET_YES if found, otherwise GNUNET_NO

Definition at line 2413 of file messenger_api_room.c.

2415{
2416 struct GNUNET_MESSENGER_MemberFind find;
2417
2418 GNUNET_assert (room);
2419
2420 find.contact = contact;
2421 find.result = GNUNET_NO;
2422
2424 room->members, iterate_find_member, &find);
2425
2426 return find.result;
2427}
static enum GNUNET_GenericReturnValue iterate_find_member(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
const struct GNUNET_MESSENGER_Contact * contact

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Parameters
[in,out]roomRoom
[in]hashHash of message
[in]otherHash of other message

Definition at line 2454 of file messenger_api_room.c.

2457{
2458 const struct GNUNET_HashCode **result;
2459 struct GNUNET_HashCode *value;
2460
2461 GNUNET_assert ((room) && (hash) && (other));
2462
2463 result = &other;
2466
2467 if (! *result)
2468 return;
2469
2470 value = GNUNET_memdup (other, sizeof(struct GNUNET_HashCode));
2471 if (! value)
2472 return;
2473
2475 room->links, hash, value,
2478}
static char * value
Value of the record to add/remove.
static int result
Global testing status.
#define GNUNET_memdup(buf, size)
Allocate and initialize a block of memory.
static enum GNUNET_GenericReturnValue find_linked_hash(void *cls, const struct GNUNET_HashCode *key, void *value)
A 512-bit hashcode.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Parameters
[in,out]roomRoom
[in]hashHash of message
[in]delayDelay for linked deletion
[in]deletionFunction called for each linked deletion

Definition at line 2545 of file messenger_api_room.c.

2549{
2551
2552 GNUNET_assert ((room) && (hash));
2553
2554 info.room = room;
2555 info.delay = delay;
2556 info.deletion = deletion;
2557
2561}
#define info
static enum GNUNET_GenericReturnValue delete_linked_hash(void *cls, const struct GNUNET_HashCode *key, void *value)
struct GNUNET_MESSENGER_Room * room
GNUNET_MESSENGER_RoomLinkDeletion deletion

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().

Here is the call graph for this function:
Here is the caller graph for this function: