GNUnet debian-0.24.3-29-g453fda2cf
 
Loading...
Searching...
No Matches
messenger_api_room.c File Reference
Include dependency graph for messenger_api_room.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_MESSENGER_RoomCancelAction
 
struct  GNUNET_MESSENGER_MemberCall
 
struct  GNUNET_MESSENGER_MemberFind
 
struct  GNUNET_MESSENGER_RoomLinkDeletionInfo
 

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.
 
static enum GNUNET_GenericReturnValue iterate_destroy_action (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)
 
static enum GNUNET_GenericReturnValue iterate_destroy_link (void *cls, const struct GNUNET_HashCode *key, void *value)
 
static enum GNUNET_GenericReturnValue iterate_destroy_subscription (void *cls, const struct GNUNET_ShortHashCode *key, void *value)
 
static enum GNUNET_GenericReturnValue iterate_destroy_epoch (void *cls, const struct GNUNET_HashCode *key, void *value)
 
void destroy_room (struct GNUNET_MESSENGER_Room *room)
 Destroys a room and frees its memory fully from the client API.
 
const struct GNUNET_HashCodeget_room_key (const struct GNUNET_MESSENGER_Room *room)
 Return a the hash representation of a given room.
 
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.
 
static enum GNUNET_GenericReturnValue is_message_entry_recent (const struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static struct GNUNET_MESSENGER_Epochget_room_availble_epoch_entry (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry, const struct GNUNET_MESSENGER_Contact *contact)
 
static void handle_room_delayed_deletion (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_room_delayed_announcement (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_room_delayed_appeal (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_room_delayed_action (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
 
static void handle_room_action_task (void *cls)
 
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.
 
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.
 
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)
 
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().
 
enum GNUNET_GenericReturnValue is_room_available (const struct GNUNET_MESSENGER_Room *room)
 Checks whether a room is available to send messages.
 
struct GNUNET_MESSENGER_Handleget_room_handle (struct GNUNET_MESSENGER_Room *room)
 Returns the messenger handle of the room.
 
const struct GNUNET_ShortHashCodeget_room_sender_id (const struct GNUNET_MESSENGER_Room *room)
 Returns the member id of the room's sender.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static enum GNUNET_GenericReturnValue is_epoch_identifier_upper (const union GNUNET_MESSENGER_EpochIdentifier *identifier, const union GNUNET_MESSENGER_EpochIdentifier *other)
 
static enum GNUNET_GenericReturnValue iterate_room_request (void *cls, const struct GNUNET_HashCode *key, void *value)
 
static void handle_room_request_task (void *cls)
 
void require_message_from_room (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
 Requires a specific message in a given room which can be identified by its hash.
 
static void handle_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_join_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static enum GNUNET_GenericReturnValue iterate_room_epoch_member_invalidation (void *cls, const struct GNUNET_HashCode *key, void *value)
 
static void handle_leave_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_name_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_key_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_id_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_miss_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_merge_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_private_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_delete_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_transcript_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_announcement_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_secret_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_appeal_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_access_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_revolution_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_group_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
static void handle_authorization_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
 
void handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, 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.
 
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.
 
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.
 
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.
 
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.
 
static enum GNUNET_GenericReturnValue iterate_local_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value)
 
int iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls)
 Iterates through all members of a given room to forward each of them to a selected callback with a custom closure.
 
static enum GNUNET_GenericReturnValue iterate_find_member (void *cls, const struct GNUNET_ShortHashCode *key, void *value)
 
enum GNUNET_GenericReturnValue find_room_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
 Checks through all members of a given room if a specific contact is found and returns a result depending on that.
 
static enum GNUNET_GenericReturnValue find_linked_hash (void *cls, const struct GNUNET_HashCode *key, void *value)
 
void link_room_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_HashCode *other)
 Links a message identified by its hash inside a given room with another message identified by its other hash.
 
static enum GNUNET_GenericReturnValue clear_linked_hash (void *cls, const struct GNUNET_HashCode *key, void *value)
 
static enum GNUNET_GenericReturnValue delete_linked_hash (void *cls, const struct GNUNET_HashCode *key, void *value)
 
void link_room_deletion (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay, GNUNET_MESSENGER_RoomLinkDeletion deletion)
 Delete all remaining links to a certain message identified by its hash inside a given room and cause a deletion process to all of the linked messages.
 

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:

◆ iterate_destroy_action()

static enum GNUNET_GenericReturnValue iterate_destroy_action ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 93 of file messenger_api_room.c.

96{
98
100
101 action = value;
102
103 if (action->task)
105
106 GNUNET_free (action);
107 return GNUNET_YES;
108}
static char * value
Value of the record to add/remove.
#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

References GNUNET_assert, GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_YES, and value.

Referenced by cancel_room_action(), and destroy_room().

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

◆ iterate_destroy_message()

static enum GNUNET_GenericReturnValue iterate_destroy_message ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 112 of file messenger_api_room.c.

115{
117
119
120 entry = value;
121
122 destroy_message (entry->message);
123 GNUNET_free (entry);
124 return GNUNET_YES;
125}
void destroy_message(struct GNUNET_MESSENGER_Message *message)
Destroys a message and frees its memory fully.
struct GNUNET_MESSENGER_Message * message

References destroy_message(), GNUNET_assert, GNUNET_free, GNUNET_YES, GNUNET_MESSENGER_RoomMessageEntry::message, and value.

Referenced by destroy_room().

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

◆ iterate_destroy_link()

static enum GNUNET_GenericReturnValue iterate_destroy_link ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 129 of file messenger_api_room.c.

132{
133 struct GNUNET_HashCode *hash;
134
136
137 hash = value;
138
139 GNUNET_free (hash);
140 return GNUNET_YES;
141}
A 512-bit hashcode.

References GNUNET_assert, GNUNET_free, GNUNET_YES, and value.

Referenced by destroy_room().

Here is the caller graph for this function:

◆ iterate_destroy_subscription()

static enum GNUNET_GenericReturnValue iterate_destroy_subscription ( void *  cls,
const struct GNUNET_ShortHashCode key,
void *  value 
)
static

Definition at line 145 of file messenger_api_room.c.

148{
149 struct GNUNET_MESSENGER_RoomSubscription *subscription;
150
152
153 subscription = value;
154
155 if (subscription->task)
156 GNUNET_SCHEDULER_cancel (subscription->task);
157
158 if (subscription->message)
159 destroy_message (subscription->message);
160
161 GNUNET_free (subscription);
162 return GNUNET_YES;
163}
struct GNUNET_SCHEDULER_Task * task
struct GNUNET_MESSENGER_Message * message

References destroy_message(), GNUNET_assert, GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_YES, GNUNET_MESSENGER_RoomSubscription::message, GNUNET_MESSENGER_RoomSubscription::task, and value.

Referenced by destroy_room().

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

◆ iterate_destroy_epoch()

static enum GNUNET_GenericReturnValue iterate_destroy_epoch ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 167 of file messenger_api_room.c.

170{
171 struct GNUNET_MESSENGER_Epoch *epoch;
172
174
175 epoch = value;
176
177 destroy_epoch (epoch);
178 return GNUNET_YES;
179}
void destroy_epoch(struct GNUNET_MESSENGER_Epoch *epoch)
Destroys an epoch and frees its memory fully from the client API.

References destroy_epoch(), GNUNET_assert, GNUNET_YES, and value.

Referenced by destroy_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.
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:

◆ is_message_entry_recent()

static enum GNUNET_GenericReturnValue is_message_entry_recent ( const struct GNUNET_MESSENGER_RoomMessageEntry entry)
static

Definition at line 272 of file messenger_api_room.c.

273{
274 GNUNET_assert (entry);
275
277 return GNUNET_YES;
278 else
279 return GNUNET_NO;
280}
@ GNUNET_MESSENGER_FLAG_RECENT
The recent flag.
enum GNUNET_MESSENGER_MessageFlags flags

References GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_MESSENGER_FLAG_RECENT, GNUNET_NO, and GNUNET_YES.

Referenced by get_room_availble_epoch_entry(), and get_room_message_epoch().

Here is the caller graph for this function:

◆ get_room_availble_epoch_entry()

static struct GNUNET_MESSENGER_Epoch * get_room_availble_epoch_entry ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
const struct GNUNET_MESSENGER_RoomMessageEntry entry,
const struct GNUNET_MESSENGER_Contact contact 
)
static

Definition at line 284 of file messenger_api_room.c.

289{
290 struct GNUNET_MESSENGER_Epoch *room_epoch;
291
292 GNUNET_assert ((room) && (hash) && (entry));
293
294 room_epoch = get_room_epoch (
295 room, &(entry->epoch),
297
298 if (! room_epoch)
299 return NULL;
300
302 return NULL;
303
305 room_epoch,
307 return NULL;
308
310 room_epoch, contact? contact : entry->sender))
311 return NULL;
312
313 return room_epoch;
314}
enum GNUNET_GenericReturnValue delay_epoch_message_for_its_members(struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_HashCode *hash)
Adds a message with a given hash to a list that can be delayed in processing for the members of a spe...
enum GNUNET_GenericReturnValue is_epoch_member(const struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact)
Returns whether a specific contact is member of a given epoch.
struct GNUNET_MESSENGER_Contact * get_handle_contact(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Returns the contact of a given handle in a room identified by a given key.
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)
const struct GNUNET_HashCode * get_room_key(const struct GNUNET_MESSENGER_Room *room)
Return a the hash representation of a given room.
struct GNUNET_MESSENGER_Room * room
struct GNUNET_HashCode hash

References delay_epoch_message_for_its_members(), GNUNET_MESSENGER_RoomMessageEntry::epoch, get_handle_contact(), get_room_epoch(), get_room_key(), GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Epoch::hash, is_epoch_member(), is_message_entry_recent(), GNUNET_MESSENGER_Epoch::room, and GNUNET_MESSENGER_RoomMessageEntry::sender.

Referenced by handle_access_message(), handle_announcement_message(), handle_appeal_message(), handle_authorization_message(), handle_group_message(), handle_revolution_message(), handle_room_delayed_announcement(), handle_room_delayed_appeal(), and handle_secret_message().

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

◆ handle_room_delayed_deletion()

static void handle_room_delayed_deletion ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
const struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 318 of file messenger_api_room.c.

322{
323 const struct GNUNET_HashCode *target_hash;
325
326 target_hash = &(entry->message->body.deletion.hash);
327
329 {
330 struct GNUNET_TIME_Relative delay;
331
332 delay = get_message_timeout (entry->message);
333
334 link_room_deletion (room, target_hash, delay, delete_room_message);
335 }
336
337 target = GNUNET_CONTAINER_multihashmap_get (room->messages, target_hash);
338 if (! target)
339 return;
340
341 if ((target->sender != entry->sender) &&
342 (! (GNUNET_MESSENGER_FLAG_SENT & entry->flags)))
343 return;
344
346 callback_room_message (room, target_hash);
347
348 switch (target->message->header.kind)
349 {
351 {
352 struct GNUNET_MESSENGER_Epoch *epoch;
353 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
354
355 epoch = get_room_message_epoch (room, target_hash);
356
357 if (! epoch)
358 break;
359
360 announcement = get_epoch_announcement (
361 epoch,
363 GNUNET_NO);
364
365 if (! announcement)
366 break;
367
369 announcement,
370 target_hash,
371 target->message,
372 target->sender);
373 break;
374 }
375 default:
376 break;
377 }
378
380 room->messages, target_hash, target))
381 {
382 destroy_message (target->message);
383 GNUNET_free (target);
384 }
385}
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.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
@ GNUNET_MESSENGER_KIND_ANNOUNCEMENT
The announcement kind.
@ GNUNET_MESSENGER_FLAG_SENT
The sent flag.
@ GNUNET_MESSENGER_FLAG_DELETE
The delete flag.
struct GNUNET_MESSENGER_EpochAnnouncement * get_epoch_announcement(struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid)
Returns the epoch announcement of a given epoch using a specific unique identifier or NULL.
enum GNUNET_GenericReturnValue revoke_epoch_announcement_member(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_Contact *contact)
Revokes an announcement message with its hash from a given epoch announcement removing the caused con...
struct GNUNET_TIME_Relative get_message_timeout(const struct GNUNET_MESSENGER_Message *message)
Return the relative timeout of the content from a given message that controls when a delayed handling...
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.
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 ...
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.
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.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
struct GNUNET_MESSENGER_MessageAnnouncement announcement
struct GNUNET_MESSENGER_MessageDeletion deletion
struct GNUNET_HashCode hash
The hash of the message to delete.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.
struct GNUNET_MESSENGER_MessageHeader header
Header.
struct GNUNET_MESSENGER_MessageBody body
Body.
struct GNUNET_MESSENGER_Contact * sender
Time for relative time used by GNUnet, in microseconds.

References GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_Message::body, callback_room_message(), delete_room_message(), GNUNET_MESSENGER_MessageBody::deletion, destroy_message(), GNUNET_MESSENGER_EpochAnnouncement::epoch, GNUNET_MESSENGER_RoomMessageEntry::flags, get_epoch_announcement(), get_message_timeout(), get_room_message_epoch(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_MESSENGER_FLAG_DELETE, GNUNET_MESSENGER_FLAG_SENT, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_MessageDeletion::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageAnnouncement::identifier, GNUNET_MESSENGER_MessageHeader::kind, link_room_deletion(), GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, revoke_epoch_announcement_member(), and GNUNET_MESSENGER_RoomMessageEntry::sender.

Referenced by handle_room_delayed_action().

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

◆ handle_room_delayed_announcement()

static void handle_room_delayed_announcement ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
const struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 389 of file messenger_api_room.c.

393{
394 struct GNUNET_MESSENGER_Epoch *epoch;
395 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
397
398 GNUNET_assert ((room) && (hash) && (entry));
399
400 epoch = get_room_availble_epoch_entry (room, hash, entry, NULL);
401
402 if (! epoch)
403 return;
404
405 identifier = &(entry->message->body.announcement.identifier);
406
408 sent = GNUNET_YES;
409 else
410 sent = GNUNET_NO;
411
412 if (identifier->code.group_bit)
413 {
414 struct GNUNET_MESSENGER_EpochGroup *group;
415
417
418 if (! group)
419 return;
420
422 group,
423 entry->message,
424 hash,
425 entry->sender,
426 sent);
427 }
428 else
429 {
430 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
431
433
434 if (! announcement)
435 return;
436
438 announcement,
439 entry->message,
440 hash,
441 entry->sender,
442 sent);
443 }
444}
GNUNET_GenericReturnValue
Named constants for return values.
struct GNUNET_MESSENGER_EpochGroup * get_epoch_group(struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid)
Returns the epoch group of a given epoch using a specific unique identifier or NULL.
void handle_epoch_announcement_delay(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *sender, enum GNUNET_GenericReturnValue sent)
Handles an announcement message with hash from its sender inside a given epoch announcement as second...
void handle_epoch_group_announcement_delay(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *sender, enum GNUNET_GenericReturnValue sent)
Handles an announcement message with hash from its sender inside a given epoch group as second stage ...
static struct GNUNET_MESSENGER_Epoch * get_room_availble_epoch_entry(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry, const struct GNUNET_MESSENGER_Contact *contact)
union GNUNET_MESSENGER_EpochIdentifier identifier
struct GNUNET_MESSENGER_Epoch * epoch
union GNUNET_MESSENGER_EpochIdentifier identifier
An epoch identifier unifies an epoch identifier code and its 256bit hash representation.
struct GNUNET_MESSENGER_EpochIdentifierCode code

References GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, GNUNET_MESSENGER_EpochAnnouncement::epoch, GNUNET_MESSENGER_EpochGroup::epoch, GNUNET_MESSENGER_RoomMessageEntry::flags, get_epoch_announcement(), get_epoch_group(), get_room_availble_epoch_entry(), GNUNET_assert, GNUNET_MESSENGER_FLAG_SENT, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, handle_epoch_announcement_delay(), handle_epoch_group_announcement_delay(), GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_MessageAnnouncement::identifier, GNUNET_MESSENGER_EpochAnnouncement::identifier, GNUNET_MESSENGER_EpochGroup::identifier, GNUNET_MESSENGER_RoomMessageEntry::message, and GNUNET_MESSENGER_RoomMessageEntry::sender.

Referenced by handle_room_delayed_action().

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

◆ handle_room_delayed_appeal()

static void handle_room_delayed_appeal ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
const struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 448 of file messenger_api_room.c.

452{
453 const struct GNUNET_MESSENGER_RoomMessageEntry *event_entry;
454 struct GNUNET_MESSENGER_Epoch *epoch;
455 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
456 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
458
459 GNUNET_assert ((room) && (hash) && (entry));
460
462 room->messages, &(entry->message->body.appeal.event));
463
464 if (! event_entry)
465 return;
466
468 return;
469
471 room, hash, event_entry, entry->sender);
472
473 if (! epoch)
474 return;
475
476 identifier = &(event_entry->message->body.announcement.identifier);
477
478 if (identifier->code.group_bit)
479 return;
480
481 announcement = get_epoch_announcement (epoch, identifier, GNUNET_NO);
482
483 if (! announcement)
484 return;
485
487 return;
488
489 if (GNUNET_YES != is_epoch_member (epoch, entry->sender))
490 return;
491
492 if (GNUNET_YES == is_epoch_announcement_member (announcement, entry->sender))
493 return;
494
495 key = get_epoch_announcement_key (announcement);
496
497 if (! key)
498 return;
499
500 send_epoch_announcement_access (announcement, hash);
501}
enum GNUNET_GenericReturnValue send_epoch_announcement_access(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *event)
Tries to send an access message by the client responding to a previous event in regards to a given ep...
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.
enum GNUNET_GenericReturnValue is_epoch_announcement_member(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Contact *contact)
Returns whether a specific contact is confirmed member of a given epoch announcement.
struct GNUNET_HashCode event
The hash of the linked announcement message event.
struct GNUNET_MESSENGER_MessageAppeal appeal

References GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_MessageBody::appeal, GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, GNUNET_MESSENGER_MessageAppeal::event, GNUNET_MESSENGER_RoomMessageEntry::flags, get_epoch_announcement(), get_epoch_announcement_key(), get_room_availble_epoch_entry(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_MESSENGER_FLAG_SENT, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageAnnouncement::identifier, is_epoch_announcement_member(), is_epoch_member(), key, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, send_epoch_announcement_access(), and GNUNET_MESSENGER_RoomMessageEntry::sender.

Referenced by handle_room_delayed_action().

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

◆ handle_room_delayed_action()

static void handle_room_delayed_action ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash 
)
static

Definition at line 505 of file messenger_api_room.c.

507{
508 const struct GNUNET_MESSENGER_RoomMessageEntry *entry;
509
510 GNUNET_assert ((room) && (hash));
511
512 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
513
514 if ((! entry) || (! entry->message))
515 return;
516
517 if ((entry->flags & GNUNET_MESSENGER_FLAG_UPDATE) ||
519 goto skip_delayed_handling;
520
521 switch (entry->message->header.kind)
522 {
524 handle_room_delayed_deletion (room, hash, entry);
525 break;
527 handle_room_delayed_announcement (room, hash, entry);
528 break;
530 handle_room_delayed_appeal (room, hash, entry);
531 break;
532 default:
533 break;
534 }
535
536skip_delayed_handling:
538 callback_room_message (room, hash);
539}
@ GNUNET_MESSENGER_KIND_APPEAL
The appeal kind.
@ GNUNET_MESSENGER_KIND_DELETION
The deletion kind.
@ GNUNET_MESSENGER_FLAG_UPDATE
The update flag.
static void handle_room_delayed_announcement(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_room_delayed_appeal(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_room_delayed_deletion(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry)

References callback_room_message(), GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_MESSENGER_FLAG_DELETE, GNUNET_MESSENGER_FLAG_UPDATE, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_MESSENGER_KIND_APPEAL, GNUNET_MESSENGER_KIND_DELETION, handle_room_delayed_announcement(), handle_room_delayed_appeal(), handle_room_delayed_deletion(), GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_RoomMessageEntry::message, and GNUNET_MESSENGER_Room::messages.

Referenced by handle_room_action_task().

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

◆ handle_room_action_task()

static void handle_room_action_task ( void *  cls)
static

Definition at line 543 of file messenger_api_room.c.

544{
546 struct GNUNET_MESSENGER_Room *room;
547
548 GNUNET_assert (cls);
549
550 action = cls;
551 action->task = NULL;
552
553 room = action->room;
554
556 room->actions, &(action->hash), action))
557 handle_room_delayed_action (room, &(action->hash));
558
559 GNUNET_free (action);
560}
static void handle_room_delayed_action(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)

References GNUNET_MESSENGER_Room::actions, GNUNET_assert, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_YES, and handle_room_delayed_action().

Referenced by delay_room_action().

Here is the call graph for this function:
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
578 room->actions, hash, action,
580 {
581 GNUNET_free (action);
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 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:

◆ iterate_cancel_action_by()

static enum GNUNET_GenericReturnValue iterate_cancel_action_by ( void *  cls,
const struct GNUNET_HashCode hash,
void *  value 
)
static

Definition at line 623 of file messenger_api_room.c.

626{
629 struct GNUNET_MESSENGER_Room *room;
630 const struct GNUNET_MESSENGER_Message *message;
631
632 GNUNET_assert ((cls) && (hash) && (value));
633
634 cancel = cls;
635 action = value;
636 room = action->room;
637
638 message = get_room_message (room, hash);
639
640 if ((! message) || (message->header.kind != cancel->kind))
641 return GNUNET_YES;
642
643 if (cancel->epoch_hash)
644 {
645 const struct GNUNET_MESSENGER_Epoch *epoch;
646
648
649 if ((! epoch) || (0 != GNUNET_CRYPTO_hash_cmp (&(epoch->hash), cancel->
650 epoch_hash)))
651 return GNUNET_YES;
652 }
653
654 if (cancel->identifier)
655 {
656 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
657
658 identifier = get_room_message_epoch_identifier (room, hash);
659
660 if ((! identifier) || (0 != GNUNET_memcmp (identifier, cancel->identifier)))
661 return GNUNET_YES;
662 }
663
664 if ((cancel->contact) && (cancel->contact != get_room_sender (room, hash)))
665 return GNUNET_YES;
666
669 return GNUNET_YES;
670}
int GNUNET_CRYPTO_hash_cmp(const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2)
Compare function for HashCodes, producing a total ordering of all hashcodes.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE
If a value with the given key exists, replace it.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
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.
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.
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...
const struct GNUNET_HashCode * epoch_hash
const struct GNUNET_MESSENGER_Contact * contact
enum GNUNET_MESSENGER_MessageKind kind
const union GNUNET_MESSENGER_EpochIdentifier * identifier
struct GNUNET_CONTAINER_MultiHashMap * map

References GNUNET_MESSENGER_RoomCancelAction::contact, GNUNET_MESSENGER_RoomCancelAction::epoch_hash, get_room_message(), get_room_message_epoch(), get_room_message_epoch_identifier(), get_room_sender(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, GNUNET_CRYPTO_hash_cmp(), GNUNET_memcmp, GNUNET_YES, GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_RoomCancelAction::identifier, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_RoomCancelAction::kind, GNUNET_MESSENGER_RoomCancelAction::map, GNUNET_MESSENGER_Epoch::room, and value.

Referenced by cancel_room_actions_by().

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

◆ iterate_cancel_action()

static enum GNUNET_GenericReturnValue iterate_cancel_action ( void *  cls,
const struct GNUNET_HashCode hash,
void *  value 
)
static

Definition at line 674 of file messenger_api_room.c.

677{
678 struct GNUNET_MESSENGER_Room *room;
679
680 GNUNET_assert ((cls) && (hash));
681
682 room = cls;
683
684 cancel_room_action (room, hash);
685 return GNUNET_YES;
686}
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 usi...

References cancel_room_action(), GNUNET_assert, and GNUNET_YES.

Referenced by cancel_room_actions_by().

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)

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
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}
@ 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.

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

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_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.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
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
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
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.

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

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}

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}

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:

◆ is_epoch_identifier_upper()

static enum GNUNET_GenericReturnValue is_epoch_identifier_upper ( const union GNUNET_MESSENGER_EpochIdentifier identifier,
const union GNUNET_MESSENGER_EpochIdentifier other 
)
static

Definition at line 1054 of file messenger_api_room.c.

1057{
1058 uint32_t level, other_level;
1059
1060 GNUNET_assert ((identifier) && (other));
1061
1062 level = (uint32_t) identifier->code.level_bits;
1063 other_level = (uint32_t) other->code.level_bits;
1064
1065 if (level > other_level)
1066 return GNUNET_YES;
1067 else
1068 return GNUNET_NO;
1069}

References GNUNET_MESSENGER_EpochIdentifier::code, GNUNET_assert, GNUNET_NO, GNUNET_YES, and GNUNET_MESSENGER_EpochIdentifierCode::level_bits.

Referenced by handle_access_message(), and handle_authorization_message().

Here is the caller graph for this function:

◆ iterate_room_request()

static enum GNUNET_GenericReturnValue iterate_room_request ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 1073 of file messenger_api_room.c.

1076{
1077 struct GNUNET_MESSENGER_Room *room;
1078
1079 GNUNET_assert ((cls) && (key));
1080
1081 room = cls;
1083
1084 return GNUNET_YES;
1085}
void request_message_from_room(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Requests a specific message from a given room which can be identified by its hash.

References GNUNET_assert, GNUNET_YES, key, and request_message_from_room().

Referenced by handle_room_request_task().

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

◆ handle_room_request_task()

static void handle_room_request_task ( void *  cls)
static

Definition at line 1089 of file messenger_api_room.c.

1090{
1091 struct GNUNET_MESSENGER_Room *room;
1092
1093 GNUNET_assert (cls);
1094
1095 room = cls;
1096 room->request_task = NULL;
1097
1098 if ((GNUNET_YES != room->joined) || (! get_room_sender_id (room)))
1099 {
1100 struct GNUNET_TIME_Relative delay;
1102 delay = GNUNET_TIME_relative_multiply (delay, 100);
1103
1105 delay,
1108 room);
1109 return;
1110 }
1111
1113 room->requests,
1115 room);
1116
1118}
unsigned int GNUNET_CONTAINER_multihashmap_clear(struct GNUNET_CONTAINER_MultiHashMap *map)
Remove all entries from the map.
@ GNUNET_SCHEDULER_PRIORITY_BACKGROUND
Run as background job (higher than idle, lower than default).
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_millisecond_(void)
Return relative time of 1ms.
Definition time.c:160
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition time.c:486
static enum GNUNET_GenericReturnValue iterate_room_request(void *cls, const struct GNUNET_HashCode *key, void *value)
static void handle_room_request_task(void *cls)

References get_room_sender_id(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_clear(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_SCHEDULER_add_delayed_with_priority(), GNUNET_SCHEDULER_PRIORITY_BACKGROUND, GNUNET_TIME_relative_get_millisecond_(), GNUNET_TIME_relative_multiply(), GNUNET_YES, handle_room_request_task(), iterate_room_request(), GNUNET_MESSENGER_Room::joined, GNUNET_MESSENGER_Room::request_task, and GNUNET_MESSENGER_Room::requests.

Referenced by handle_room_request_task(), and require_message_from_room().

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

◆ require_message_from_room()

void require_message_from_room ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash 
)

Requires a specific message in a given room which can be identified by its hash.

The required message will be requested asynchronously.

Parameters
[in]roomRoom
[in]hashHash of message

Definition at line 1122 of file messenger_api_room.c.

1124{
1125 GNUNET_assert ((room) && (hash));
1126
1127 if (GNUNET_is_zero (hash))
1128 return;
1129
1130 if (get_room_message (room, hash))
1131 return;
1132
1134 room->requests,
1135 hash, NULL,
1137 return;
1138
1139 if (room->request_task)
1140 return;
1141
1145 room);
1146}
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_with_priority(enum GNUNET_SCHEDULER_Priority prio, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified priority.
Definition scheduler.c:1231

References get_room_message(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, GNUNET_is_zero, GNUNET_OK, GNUNET_SCHEDULER_add_with_priority(), GNUNET_SCHEDULER_PRIORITY_BACKGROUND, handle_room_request_task(), GNUNET_MESSENGER_Room::request_task, and GNUNET_MESSENGER_Room::requests.

Referenced by create_epoch(), GNUNET_MESSENGER_get_message(), handle_join_message(), handle_leave_message(), and handle_merge_message().

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

◆ handle_message()

static void handle_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 2104 of file messenger_api_room.c.

2107{
2108 GNUNET_assert ((room) && (hash) && (entry));
2109
2110 switch (entry->message->header.kind)
2111 {
2113 handle_join_message (room, hash, entry);
2114 break;
2116 handle_leave_message (room, hash, entry);
2117 break;
2119 handle_name_message (room, hash, entry);
2120 break;
2122 handle_key_message (room, hash, entry);
2123 break;
2125 handle_id_message (room, hash, entry);
2126 break;
2128 handle_miss_message (room, hash, entry);
2129 break;
2131 handle_merge_message (room, hash, entry);
2132 break;
2134 handle_private_message (room, hash, entry);
2135 break;
2137 handle_delete_message (room, hash, entry);
2138 break;
2140 handle_transcript_message (room, hash, entry);
2141 break;
2143 handle_announcement_message (room, hash, entry);
2144 break;
2146 handle_secret_message (room, hash, entry);
2147 break;
2149 handle_appeal_message (room, hash, entry);
2150 break;
2152 handle_access_message (room, hash, entry);
2153 break;
2155 handle_revolution_message (room, hash, entry);
2156 break;
2158 handle_group_message (room, hash, entry);
2159 break;
2161 handle_authorization_message (room, hash, entry);
2162 break;
2163 default:
2164 break;
2165 }
2166
2167 if (GNUNET_YES == is_epoch_message (entry->message))
2168 {
2169 struct GNUNET_MESSENGER_Epoch *epoch;
2170
2171 epoch = get_room_epoch (room, &(entry->epoch), GNUNET_NO);
2172
2173 if ((! epoch) || (get_epoch_size (epoch)))
2174 return;
2175
2176 reset_epoch_size (epoch);
2177 }
2178
2181}
@ GNUNET_MESSENGER_KIND_MISS
The miss kind.
@ GNUNET_MESSENGER_KIND_PRIVATE
The private kind.
@ GNUNET_MESSENGER_KIND_NAME
The name kind.
@ GNUNET_MESSENGER_KIND_LEAVE
The leave kind.
@ GNUNET_MESSENGER_KIND_TRANSCRIPT
The transcript kind.
@ GNUNET_MESSENGER_KIND_KEY
The key kind.
@ GNUNET_MESSENGER_KIND_JOIN
The join kind.
@ GNUNET_MESSENGER_KIND_MERGE
The merge kind.
@ GNUNET_MESSENGER_KIND_ID
The id kind.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_zero_(void)
Return relative time of 0ms.
Definition time.c:133
uint32_t get_epoch_size(const struct GNUNET_MESSENGER_Epoch *epoch)
Returns the amount of members by a given epoch or zero as long as it's not fully initialized yet.
void reset_epoch_size(struct GNUNET_MESSENGER_Epoch *epoch)
Resets the amount of members by a given epoch to recalculate the exact amount.
enum GNUNET_GenericReturnValue is_epoch_message(const struct GNUNET_MESSENGER_Message *message)
Returns whether a certain kind of message from storage contains some specific details that might be r...
static void handle_name_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_appeal_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_authorization_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_id_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_secret_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_announcement_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_access_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_private_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_group_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_revolution_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_join_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_leave_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_miss_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_transcript_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_key_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_delete_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_merge_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
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 o...

References delay_room_action(), GNUNET_MESSENGER_RoomMessageEntry::epoch, GNUNET_MESSENGER_RoomMessageEntry::flags, get_epoch_size(), get_room_epoch(), GNUNET_assert, GNUNET_MESSENGER_FLAG_UPDATE, GNUNET_MESSENGER_KIND_ACCESS, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_MESSENGER_KIND_APPEAL, GNUNET_MESSENGER_KIND_AUTHORIZATION, GNUNET_MESSENGER_KIND_DELETION, GNUNET_MESSENGER_KIND_GROUP, GNUNET_MESSENGER_KIND_ID, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_KEY, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_MERGE, GNUNET_MESSENGER_KIND_MISS, GNUNET_MESSENGER_KIND_NAME, GNUNET_MESSENGER_KIND_PRIVATE, GNUNET_MESSENGER_KIND_REVOLUTION, GNUNET_MESSENGER_KIND_SECRET, GNUNET_MESSENGER_KIND_TRANSCRIPT, GNUNET_NO, GNUNET_TIME_relative_get_zero_(), GNUNET_YES, handle_access_message(), handle_announcement_message(), handle_appeal_message(), handle_authorization_message(), handle_delete_message(), handle_group_message(), handle_id_message(), handle_join_message(), handle_key_message(), handle_leave_message(), handle_merge_message(), handle_miss_message(), handle_name_message(), handle_private_message(), handle_revolution_message(), handle_secret_message(), handle_transcript_message(), GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_Message::header, is_epoch_message(), GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_RoomMessageEntry::message, reset_epoch_size(), and GNUNET_MESSENGER_Epoch::room.

Referenced by handle_private_message(), handle_room_message(), handle_transcript_message(), update_room_message(), and update_room_secret_message().

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

◆ handle_join_message()

static void handle_join_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1156 of file messenger_api_room.c.

1159{
1160 GNUNET_assert ((room) && (hash) && (entry));
1161
1162 if (! entry->sender)
1163 {
1164 struct GNUNET_MESSENGER_ContactStore *store;
1165 struct GNUNET_HashCode context;
1166
1167 store = get_handle_contact_store (room->handle);
1168
1170 &(entry->message->header.sender_id),
1171 &context);
1172
1173 entry->sender = get_store_contact (store, &context,
1174 &(entry->message->body.join.key));
1175 }
1176
1178 room->members, &(entry->message->header.sender_id), entry->sender)) &&
1180 room->members,
1181 &(entry->message->header.sender_id),
1182 entry->sender,
1184 increase_contact_rc (entry->sender);
1185
1186 if ((get_room_sender_id (room)) &&
1187 (0 == GNUNET_memcmp (&(entry->message->header.sender_id),
1188 get_room_sender_id (room))) &&
1189 (0 == GNUNET_memcmp (&(entry->message->body.join.key), get_handle_pubkey (
1190 room->handle))))
1191 room->joined = GNUNET_YES;
1192
1193 require_message_from_room (room, &(entry->message->body.join.epoch));
1194}
static pa_context * context
Pulseaudio context.
int GNUNET_CONTAINER_multishortmap_contains_value(const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, const void *value)
Check if the map contains the given value under the given key.
void increase_contact_rc(struct GNUNET_MESSENGER_Contact *contact)
Increases the reference counter of a given contact which is zero as default.
void get_context_from_member(const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, struct GNUNET_HashCode *context)
Calculates the context hash of a member in a room and returns it.
struct GNUNET_MESSENGER_Contact * get_store_contact(struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, const struct GNUNET_CRYPTO_PublicKey *pubkey)
Returns a contact using a specific public key.
struct GNUNET_MESSENGER_ContactStore * get_handle_contact_store(struct GNUNET_MESSENGER_Handle *handle)
Returns the used contact store of a given handle.
const struct GNUNET_CRYPTO_PublicKey * get_handle_pubkey(const struct GNUNET_MESSENGER_Handle *handle)
Returns the public key of a given handle.
void require_message_from_room(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Requires a specific message in a given room which can be identified by its hash.
struct GNUNET_MESSENGER_MessageJoin join
struct GNUNET_ShortHashCode sender_id
The senders id inside of the room the message was sent in.
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
struct GNUNET_CRYPTO_PublicKey key
The senders public key to verify its signatures.

References GNUNET_MESSENGER_Message::body, context, GNUNET_MESSENGER_MessageJoin::epoch, get_context_from_member(), get_handle_contact_store(), get_handle_pubkey(), get_room_key(), get_room_sender_id(), get_store_contact(), GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multishortmap_contains_value(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_memcmp, GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Message::header, increase_contact_rc(), GNUNET_MESSENGER_MessageBody::join, GNUNET_MESSENGER_Room::joined, GNUNET_MESSENGER_MessageJoin::key, GNUNET_MESSENGER_Room::members, GNUNET_MESSENGER_RoomMessageEntry::message, require_message_from_room(), GNUNET_MESSENGER_RoomMessageEntry::sender, and GNUNET_MESSENGER_MessageHeader::sender_id.

Referenced by handle_message().

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

◆ iterate_room_epoch_member_invalidation()

static enum GNUNET_GenericReturnValue iterate_room_epoch_member_invalidation ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 1198 of file messenger_api_room.c.

1201{
1202 struct GNUNET_MESSENGER_Contact *contact;
1203 struct GNUNET_MESSENGER_Epoch *epoch;
1204
1205 GNUNET_assert ((cls) && (value));
1206
1207 contact = cls;
1208 epoch = value;
1209
1210 invalidate_epoch_keys_by_member (epoch, contact);
1211 return GNUNET_YES;
1212}
void invalidate_epoch_keys_by_member(struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact)
Invalidates all announced epoch and group keys by a specific contact inside a given epoch.

References GNUNET_assert, GNUNET_YES, invalidate_epoch_keys_by_member(), and value.

Referenced by handle_leave_message().

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

◆ handle_leave_message()

static void handle_leave_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1216 of file messenger_api_room.c.

1219{
1220 GNUNET_assert ((room) && (hash) && (entry));
1221
1222 if ((! entry->sender) ||
1224 room->members,
1225 &(entry->message->header.sender_id),
1226 entry->sender)))
1227 return;
1228
1232 entry->sender);
1233
1234 if (GNUNET_YES == decrease_contact_rc (entry->sender))
1236 "A contact does not share any room with you anymore!\n");
1237
1239}
int GNUNET_CONTAINER_multishortmap_remove(struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, const void *value)
Remove the given key-value pair from the map.
enum GNUNET_GenericReturnValue decrease_contact_rc(struct GNUNET_MESSENGER_Contact *contact)
Decreases the reference counter if possible (can not underflow!) of a given contact and returns GNUNE...
static enum GNUNET_GenericReturnValue iterate_room_epoch_member_invalidation(void *cls, const struct GNUNET_HashCode *key, void *value)
struct GNUNET_MESSENGER_MessageLeave leave
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.

References GNUNET_MESSENGER_Message::body, decrease_contact_rc(), GNUNET_MESSENGER_MessageLeave::epoch, GNUNET_MESSENGER_Room::epochs, GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multishortmap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSENGER_FLAG_RECENT, GNUNET_YES, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_Message::header, iterate_room_epoch_member_invalidation(), GNUNET_MESSENGER_MessageBody::leave, GNUNET_MESSENGER_Room::members, GNUNET_MESSENGER_RoomMessageEntry::message, require_message_from_room(), GNUNET_MESSENGER_Epoch::room, GNUNET_MESSENGER_RoomMessageEntry::sender, and GNUNET_MESSENGER_MessageHeader::sender_id.

Referenced by handle_message().

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

◆ handle_name_message()

static void handle_name_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1243 of file messenger_api_room.c.

1246{
1247 GNUNET_assert ((room) && (hash) && (entry));
1248
1249 if (GNUNET_MESSENGER_FLAG_SENT & entry->flags)
1250 {
1251 const char *handle_name;
1252
1254 "Set rule for using handle name in room: %s\n",
1255 GNUNET_h2s (get_room_key (room)));
1256
1257 handle_name = get_handle_name (room->handle);
1258
1259 if ((handle_name) && (0 == strcmp (handle_name,
1260 entry->message->body.name.name)))
1262 }
1263
1264 if (! entry->sender)
1265 return;
1266
1267 set_contact_name (entry->sender, entry->message->body.name.name);
1268}
void set_contact_name(struct GNUNET_MESSENGER_Contact *contact, const char *name)
Changes the current name of a given contact by copying it from the parameter name.
const char * get_handle_name(const struct GNUNET_MESSENGER_Handle *handle)
Returns the current name of a given handle or NULL if no valid name was assigned yet.
struct GNUNET_MESSENGER_MessageName name
char * name
The new name which replaces the current senders name.

References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_RoomMessageEntry::flags, get_handle_name(), get_room_key(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_MESSENGER_FLAG_SENT, GNUNET_YES, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_MessageName::name, GNUNET_MESSENGER_MessageBody::name, GNUNET_MESSENGER_Epoch::room, GNUNET_MESSENGER_RoomMessageEntry::sender, set_contact_name(), and GNUNET_MESSENGER_Room::use_handle_name.

Referenced by handle_message().

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

◆ handle_key_message()

static void handle_key_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1272 of file messenger_api_room.c.

1275{
1276 struct GNUNET_HashCode context;
1277 struct GNUNET_MESSENGER_ContactStore *store;
1278
1279 GNUNET_assert ((room) && (hash) && (entry));
1280
1281 if (! entry->sender)
1282 return;
1283
1285 get_room_key (room),
1286 &(entry->message->header.sender_id),
1287 &context);
1288
1289 store = get_handle_contact_store (room->handle);
1290
1291 update_store_contact (store, entry->sender, &context, &context,
1292 &(entry->message->body.key.key));
1293}
void update_store_contact(struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *next_context, const struct GNUNET_CRYPTO_PublicKey *pubkey)
Moves a contact from the store to another location matching a given public key and member context.
struct GNUNET_MESSENGER_MessageKey key
struct GNUNET_CRYPTO_PublicKey key
The new public key which replaces the current senders public key.

References GNUNET_MESSENGER_Message::body, context, get_context_from_member(), get_handle_contact_store(), get_room_key(), GNUNET_assert, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageKey::key, GNUNET_MESSENGER_MessageBody::key, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_RoomMessageEntry::sender, GNUNET_MESSENGER_MessageHeader::sender_id, and update_store_contact().

Referenced by handle_message().

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

◆ handle_id_message()

static void handle_id_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1297 of file messenger_api_room.c.

1300{
1301 struct GNUNET_HashCode context, next_context;
1302 struct GNUNET_MESSENGER_ContactStore *store;
1303
1304 GNUNET_assert ((room) && (hash) && (entry));
1305
1306 if (GNUNET_MESSENGER_FLAG_SENT & entry->flags)
1307 set_room_sender_id (room, &(entry->message->body.id.id));
1308
1309 if ((! entry->sender) ||
1311 room->members, &(entry->message->header.sender_id),
1312 entry->sender)) ||
1314 room->members, &(entry->message->body.id.id),
1315 entry->sender,
1317 return;
1318
1320 sender_id),
1321 &context);
1323 &next_context);
1324
1325 store = get_handle_contact_store (room->handle);
1326
1327 update_store_contact (store, entry->sender, &context, &next_context,
1328 get_contact_key (entry->sender));
1329}
const struct GNUNET_CRYPTO_PublicKey * get_contact_key(const struct GNUNET_MESSENGER_Contact *contact)
Returns the public key of a given contact.
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.
struct GNUNET_MESSENGER_MessageId id
struct GNUNET_ShortHashCode id
The new id which will replace the senders id in a room.

References GNUNET_MESSENGER_Message::body, context, GNUNET_MESSENGER_RoomMessageEntry::flags, get_contact_key(), get_context_from_member(), get_handle_contact_store(), get_room_key(), GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multishortmap_put(), GNUNET_CONTAINER_multishortmap_remove(), GNUNET_MESSENGER_FLAG_SENT, GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageId::id, GNUNET_MESSENGER_MessageBody::id, GNUNET_MESSENGER_Room::members, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_RoomMessageEntry::sender, GNUNET_MESSENGER_MessageHeader::sender_id, set_room_sender_id(), and update_store_contact().

Referenced by handle_message().

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

◆ handle_miss_message()

static void handle_miss_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1333 of file messenger_api_room.c.

1336{
1337 struct GNUNET_MESSENGER_ListTunnel *match;
1338
1339 GNUNET_assert ((room) && (hash) && (entry));
1340
1341 if (0 == (GNUNET_MESSENGER_FLAG_SENT & entry->flags))
1342 return;
1343
1344 match = find_list_tunnels (
1345 &(room->entries),
1346 &(entry->message->body.miss.peer),
1347 NULL);
1348
1349 if (match)
1350 remove_from_list_tunnels (&(room->entries), match);
1351}
struct GNUNET_MESSENGER_ListTunnel * find_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index)
Searches linearly through the list of tunnels peer identities for matching a specific peer identity a...
struct GNUNET_MESSENGER_ListTunnel * remove_from_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element)
Removes a specific element from the list of tunnels peer identities and returns the next element in t...
struct GNUNET_MESSENGER_MessageMiss miss
struct GNUNET_PeerIdentity peer
The peer identity of a disconnected door to a room.

References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_Room::entries, find_list_tunnels(), GNUNET_MESSENGER_RoomMessageEntry::flags, GNUNET_assert, GNUNET_MESSENGER_FLAG_SENT, GNUNET_MESSENGER_ListTunnel::hash, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_MessageBody::miss, GNUNET_MESSENGER_MessageMiss::peer, and remove_from_list_tunnels().

Referenced by handle_message().

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

◆ handle_merge_message()

static void handle_merge_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1355 of file messenger_api_room.c.

1358{
1359 GNUNET_assert ((room) && (hash) && (entry));
1360
1361 require_message_from_room (room, &(entry->message->body.merge.epochs[0]));
1362 require_message_from_room (room, &(entry->message->body.merge.epochs[1]));
1363}
struct GNUNET_MESSENGER_MessageMerge merge
struct GNUNET_HashCode epochs[2]
The previous epochs the message was sent from.

References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_MessageMerge::epochs, GNUNET_assert, GNUNET_MESSENGER_ListTunnel::hash, GNUNET_MESSENGER_MessageBody::merge, GNUNET_MESSENGER_RoomMessageEntry::message, and require_message_from_room().

Referenced by handle_message().

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

◆ handle_private_message()

static void handle_private_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1367 of file messenger_api_room.c.

1370{
1371 struct GNUNET_MESSENGER_Message *private_message;
1372
1373 GNUNET_assert ((room) && (hash) && (entry));
1374
1375 private_message = copy_message (entry->message);
1376
1377 if (! private_message)
1378 return;
1379
1381 private_message, get_handle_key (room->handle)))
1382 {
1383 destroy_message (private_message);
1384 private_message = NULL;
1385 }
1386
1387 if (! private_message)
1388 return;
1389
1390 destroy_message (entry->message);
1391
1392 entry->recipient = get_handle_contact (room->handle, get_room_key (room));
1393
1394 entry->message = private_message;
1396
1397 if ((entry->sender) && (entry->recipient))
1398 handle_message (room, hash, entry);
1399}
@ GNUNET_MESSENGER_FLAG_PRIVATE
The private flag.
const struct GNUNET_CRYPTO_PrivateKey * get_handle_key(const struct GNUNET_MESSENGER_Handle *handle)
Returns the private key of a given handle.
struct GNUNET_MESSENGER_Message * copy_message(const struct GNUNET_MESSENGER_Message *message)
Creates and allocates a copy of a given message.
enum GNUNET_GenericReturnValue decrypt_message(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_PrivateKey *key)
Decrypts a private message using a given private key and replaces its body and kind with the inner en...
static void handle_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)

References copy_message(), decrypt_message(), destroy_message(), GNUNET_MESSENGER_RoomMessageEntry::flags, get_handle_contact(), get_handle_key(), get_room_key(), GNUNET_assert, GNUNET_MESSENGER_FLAG_PRIVATE, GNUNET_YES, GNUNET_MESSENGER_Room::handle, handle_message(), GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_RoomMessageEntry::recipient, and GNUNET_MESSENGER_RoomMessageEntry::sender.

Referenced by handle_message().

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

◆ handle_delete_message()

static void handle_delete_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1403 of file messenger_api_room.c.

1406{
1407 struct GNUNET_TIME_Relative delay;
1408
1409 GNUNET_assert ((room) && (hash) && (entry));
1410
1411 delay = get_message_timeout (entry->message);
1412
1413 delay_room_action (room, hash, delay);
1414}

References delay_room_action(), get_message_timeout(), GNUNET_assert, and GNUNET_MESSENGER_RoomMessageEntry::message.

Referenced by handle_message().

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

◆ handle_transcript_message()

static void handle_transcript_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1418 of file messenger_api_room.c.

1421{
1422 const struct GNUNET_HashCode *original_hash;
1423 struct GNUNET_MESSENGER_RoomMessageEntry *original;
1424 struct GNUNET_MESSENGER_Message *original_message;
1425
1426 GNUNET_assert ((room) && (hash) && (entry));
1427
1428 if (! (GNUNET_MESSENGER_FLAG_SENT & entry->flags))
1429 return;
1430
1431 original_hash = &(entry->message->body.transcript.hash);
1432
1433 original = GNUNET_CONTAINER_multihashmap_get (room->messages, original_hash);
1434
1435 if (original)
1436 goto read_transcript;
1437
1439
1440 if (! original)
1441 return;
1442
1443 original->sender = NULL;
1444 original->recipient = NULL;
1445
1446 original->message = NULL;
1448 original->completed = GNUNET_NO;
1449
1451 room->messages, original_hash, original,
1453 {
1454 GNUNET_free (original);
1455 return;
1456 }
1457
1458read_transcript:
1459 original_message = copy_message (entry->message);
1460
1461 if (! original_message)
1462 return;
1463
1464 if (GNUNET_YES != read_transcript_message (original_message))
1465 {
1466 destroy_message (original_message);
1467 return;
1468 }
1469
1470 {
1471 struct GNUNET_MESSENGER_ContactStore *store;
1472
1473 store = get_handle_contact_store (room->handle);
1474 original->recipient = get_store_contact (
1475 store, NULL,
1476 &(entry->message->body.transcript.key));
1477 }
1478
1479 if (original->message)
1480 {
1483
1484 copy_message_header (original_message, &(original->message->header));
1485 destroy_message (original->message);
1486 }
1487
1488 original->message = original_message;
1489
1490 link_room_message (room, hash, original_hash);
1491 link_room_message (room, original_hash, hash);
1492
1493 if ((original->sender) && (original->recipient))
1494 {
1496 handle_message (room, original_hash, original);
1497 }
1498}
@ GNUNET_MESSENGER_FLAG_NONE
The none flag.
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.
enum GNUNET_GenericReturnValue read_transcript_message(struct GNUNET_MESSENGER_Message *message)
Read the original message from a transcript message and replaces its body and kind with the inner enc...
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 oth...
struct GNUNET_MESSENGER_MessageTranscript transcript
struct GNUNET_HashCode hash
The hash of the original message.
struct GNUNET_CRYPTO_PublicKey key
The key from the recipient of the original message.

References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_RoomMessageEntry::completed, copy_message(), copy_message_header(), destroy_message(), GNUNET_MESSENGER_RoomMessageEntry::flags, get_handle_contact_store(), get_store_contact(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_free, GNUNET_MESSENGER_FLAG_NONE, GNUNET_MESSENGER_FLAG_PRIVATE, GNUNET_MESSENGER_FLAG_SENT, GNUNET_MESSENGER_FLAG_UPDATE, GNUNET_MESSENGER_KIND_PRIVATE, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_Room::handle, handle_message(), GNUNET_MESSENGER_MessageTranscript::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageTranscript::key, GNUNET_MESSENGER_MessageHeader::kind, link_room_message(), GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, read_transcript_message(), GNUNET_MESSENGER_RoomMessageEntry::recipient, GNUNET_MESSENGER_RoomMessageEntry::sender, and GNUNET_MESSENGER_MessageBody::transcript.

Referenced by handle_message().

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

◆ handle_announcement_message()

static void handle_announcement_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1502 of file messenger_api_room.c.

1505{
1506 struct GNUNET_MESSENGER_Epoch *epoch;
1507 const union GNUNET_MESSENGER_EpochNonce *nonce;
1508 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1509 enum GNUNET_GenericReturnValue sent;
1510
1511 GNUNET_assert ((room) && (hash) && (entry));
1512
1513 epoch = get_room_availble_epoch_entry (room, hash, entry, NULL);
1514
1515 if (! epoch)
1516 return;
1517
1518 nonce = &(entry->message->body.announcement.nonce);
1519
1521 epoch->nonces, &(nonce->hash)))
1522 {
1524 "Unsafe announcement: Nonce (%s) has already been used in this epoch! [%s]\n",
1525 GNUNET_sh2s (&(nonce->hash)), GNUNET_h2s (&(epoch->hash)));
1526 return;
1527 }
1528
1529 GNUNET_CONTAINER_multishortmap_put (epoch->nonces, &(nonce->hash), NULL,
1531
1532 identifier = &(entry->message->body.announcement.identifier);
1533
1534 if (GNUNET_MESSENGER_FLAG_SENT & entry->flags)
1535 sent = GNUNET_YES;
1536 else
1537 sent = GNUNET_NO;
1538
1539 if (identifier->code.group_bit)
1540 {
1541 struct GNUNET_MESSENGER_EpochGroup *group;
1542
1544
1545 if (! group)
1546 return;
1547
1549 group,
1550 entry->message,
1551 hash,
1552 entry->sender,
1553 sent);
1554 }
1555 else
1556 {
1557 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
1558
1560
1561 if (! announcement)
1562 return;
1563
1565 announcement,
1566 entry->message,
1567 hash,
1568 entry->sender,
1569 sent);
1570 }
1571}
int GNUNET_CONTAINER_multishortmap_contains(const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
const char * GNUNET_sh2s(const struct GNUNET_ShortHashCode *shc)
Convert a short hash value to a string (for printing debug messages).
void handle_epoch_announcement(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *sender, enum GNUNET_GenericReturnValue sent)
Handles an announcement message with hash from its sender inside a given epoch announcement as first ...
void handle_epoch_group_announcement(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *sender, enum GNUNET_GenericReturnValue sent)
Handles an announcement message with hash from its sender inside a given epoch group as first stage.
struct GNUNET_CONTAINER_MultiShortmap * nonces
union GNUNET_MESSENGER_EpochNonce nonce
The nonce of the announcement.
An epoch nonce unifies the epoch nonce data and its 256bit hash representation.
struct GNUNET_ShortHashCode hash

References GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, GNUNET_MESSENGER_EpochAnnouncement::epoch, GNUNET_MESSENGER_EpochGroup::epoch, GNUNET_MESSENGER_RoomMessageEntry::flags, get_epoch_announcement(), get_epoch_group(), get_room_availble_epoch_entry(), GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_multishortmap_contains(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_MESSENGER_FLAG_SENT, GNUNET_NO, GNUNET_sh2s(), GNUNET_YES, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, handle_epoch_announcement(), handle_epoch_group_announcement(), GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_EpochNonce::hash, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_MessageAnnouncement::identifier, GNUNET_MESSENGER_EpochAnnouncement::identifier, GNUNET_MESSENGER_EpochGroup::identifier, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_MessageAnnouncement::nonce, GNUNET_MESSENGER_Epoch::nonces, and GNUNET_MESSENGER_RoomMessageEntry::sender.

Referenced by handle_message().

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

◆ handle_secret_message()

static void handle_secret_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1575 of file messenger_api_room.c.

1578{
1579 struct GNUNET_MESSENGER_Epoch *epoch;
1580 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1581 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
1582
1583 GNUNET_assert ((room) && (hash) && (entry));
1584
1585 epoch = get_room_availble_epoch_entry (room, hash, entry, NULL);
1586
1587 if (! epoch)
1588 return;
1589
1591
1593 return;
1594
1596
1597 if (! announcement)
1598 return;
1599
1601 announcement, entry->message, hash);
1602}
void handle_epoch_announcement_message(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles an encrypted message with hash by a given epoch announcement using its secret key for decrypt...

References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, GNUNET_MESSENGER_EpochAnnouncement::epoch, get_epoch_announcement(), get_room_availble_epoch_entry(), GNUNET_assert, GNUNET_NO, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, handle_epoch_announcement_message(), GNUNET_MESSENGER_MessageSecret::identifier, GNUNET_MESSENGER_EpochAnnouncement::identifier, GNUNET_MESSENGER_RoomMessageEntry::message, and GNUNET_MESSENGER_MessageBody::secret.

Referenced by handle_message().

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

◆ handle_appeal_message()

static void handle_appeal_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1606 of file messenger_api_room.c.

1609{
1610 const struct GNUNET_MESSENGER_RoomMessageEntry *event_entry;
1611 struct GNUNET_MESSENGER_Epoch *epoch;
1612 const struct GNUNET_MESSENGER_Contact *contact;
1613 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1614 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
1616
1617 GNUNET_assert ((room) && (hash) && (entry));
1618
1619 event_entry = GNUNET_CONTAINER_multihashmap_get (
1620 room->messages, &(entry->message->body.appeal.event));
1621
1622 if (! event_entry)
1623 return;
1624
1626 return;
1627
1629 room, hash, event_entry, entry->sender);
1630
1631 if (! epoch)
1632 return;
1633
1634 contact = get_handle_contact (room->handle, get_room_key (room));
1635
1636 if (! contact)
1637 return;
1638
1639 if (GNUNET_YES != is_epoch_member (epoch, contact))
1640 return;
1641
1642 identifier = &(event_entry->message->body.announcement.identifier);
1643
1644 if (identifier->code.group_bit)
1645 return;
1646
1647 announcement = get_epoch_announcement (epoch, identifier, GNUNET_NO);
1648
1649 if (! announcement)
1650 return;
1651
1652 if (GNUNET_YES == is_epoch_announcement_member (announcement, entry->sender))
1653 {
1655 "Appealing contact is already member of epoch announcement! [%s]\n",
1656 GNUNET_sh2s (&(identifier->hash)));
1657 return;
1658 }
1659
1660 if (contact == event_entry->sender)
1662 else
1663 {
1665
1667 return;
1668
1670 timeout, get_epoch_position_factor (epoch, contact, NULL));
1671 }
1672
1673 if (GNUNET_MESSENGER_FLAG_SENT & entry->flags)
1674 set_epoch_announcement_appeal (announcement,
1675 get_message_timeout (entry->message));
1676
1677 delay_room_action (room, hash, timeout);
1678}
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition gnunet-arm.c:118
bool GNUNET_TIME_relative_is_zero(struct GNUNET_TIME_Relative rel)
Test if rel is zero.
Definition time.c:664
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply_double(struct GNUNET_TIME_Relative rel, double factor)
Multiply relative time by a given factor.
Definition time.c:506
double get_epoch_position_factor(const struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_MESSENGER_EpochMembership *membership)
Returns a relative member positon of a specific contact inside a given epoch in relation to its list ...
void set_epoch_announcement_appeal(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, struct GNUNET_TIME_Relative timeout)
Sets a specified timeout for a given epoch announcement of the client for its own appeal of the annou...

References GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_MessageBody::appeal, GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, delay_room_action(), GNUNET_MESSENGER_MessageAppeal::event, GNUNET_MESSENGER_RoomMessageEntry::flags, get_epoch_announcement(), get_epoch_position_factor(), get_handle_contact(), get_message_timeout(), get_room_availble_epoch_entry(), get_room_key(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSENGER_FLAG_SENT, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_NO, GNUNET_sh2s(), GNUNET_TIME_relative_get_zero_(), GNUNET_TIME_relative_is_zero(), GNUNET_TIME_relative_multiply_double(), GNUNET_YES, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageAnnouncement::identifier, is_epoch_announcement_member(), is_epoch_member(), GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, GNUNET_MESSENGER_RoomMessageEntry::sender, set_epoch_announcement_appeal(), and timeout.

Referenced by handle_message().

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

◆ handle_access_message()

static void handle_access_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1682 of file messenger_api_room.c.

1685{
1686 const struct GNUNET_MESSENGER_RoomMessageEntry *event_entry;
1687 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1688 struct GNUNET_MESSENGER_Epoch *epoch;
1689
1690 GNUNET_assert ((room) && (hash) && (entry));
1691
1692 if (! (GNUNET_MESSENGER_FLAG_RECENT & entry->flags))
1693 return;
1694
1695 event_entry = GNUNET_CONTAINER_multihashmap_get (
1696 room->messages, &(entry->message->body.access.event));
1697
1698 if (! event_entry)
1699 return;
1700
1701 switch (event_entry->message->header.kind)
1702 {
1704 {
1705 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
1706 enum GNUNET_GenericReturnValue appealed;
1707
1708 if (GNUNET_MESSENGER_FLAG_SENT & event_entry->flags)
1709 appealed = GNUNET_YES;
1710 else
1711 appealed = GNUNET_NO;
1712
1713 event_entry = GNUNET_CONTAINER_multihashmap_get (room->messages,
1714 &(event_entry->message->
1715 body.appeal.event));
1716
1717 if (! event_entry)
1718 return;
1719
1721 kind)
1722 return;
1723
1724 identifier = &(event_entry->message->body.announcement.identifier);
1725 epoch = get_room_availble_epoch_entry (room, hash, event_entry, entry->
1726 sender);
1727
1728 if (! epoch)
1729 return;
1730
1732
1733 if (! announcement)
1734 return;
1735
1736 if (GNUNET_YES != appealed)
1737 {
1738 const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key;
1739
1740 shared_key = get_epoch_announcement_key (announcement);
1741
1742 if ((shared_key) && (GNUNET_OK == verify_message_by_key (entry->message,
1743 shared_key)))
1744 cancel_room_action (room, &(entry->message->body.access.event));
1745
1746 return;
1747 }
1748
1749 handle_epoch_announcement_access (announcement, entry->message, hash);
1750 break;
1751 }
1753 {
1754 struct GNUNET_MESSENGER_EpochGroup *group;
1755 const struct GNUNET_HashCode *partner_hash;
1756 const struct GNUNET_MESSENGER_RoomMessageEntry *init_entry;
1757
1758 identifier = &(event_entry->message->body.group.identifier);
1759 epoch = get_room_availble_epoch_entry (room, hash, event_entry, entry->
1760 sender);
1761
1762 if (! epoch)
1763 return;
1764
1765 if ((epoch->main_announcement) &&
1766 (GNUNET_YES != is_epoch_identifier_upper (identifier, &(epoch->
1767 main_announcement
1768 ->identifier))
1769 ))
1770 return;
1771
1772 if ((epoch->main_group) &&
1773 (GNUNET_YES != is_epoch_identifier_upper (identifier, &(epoch->
1774 main_group->
1775 identifier))))
1776 return;
1777
1778 partner_hash = &(event_entry->message->body.group.partner);
1779 init_entry = GNUNET_CONTAINER_multihashmap_get (room->messages,
1780 &(event_entry->message->
1781 body.group.initiator));
1782
1783 if ((! init_entry) || (event_entry->sender != init_entry->sender))
1784 return;
1785
1787 )
1788 return;
1789
1790 event_entry = GNUNET_CONTAINER_multihashmap_get (room->messages,
1791 partner_hash);
1792
1793 if (! event_entry)
1794 return;
1795
1797 kind)
1798 return;
1799
1800 if (! (GNUNET_MESSENGER_FLAG_SENT & event_entry->flags))
1801 return;
1802
1803 {
1804 struct GNUNET_HashCode main_hash;
1805 enum GNUNET_GenericReturnValue has_hash;
1806
1807 if (epoch->main_group)
1808 has_hash = get_epoch_group_member_hash (epoch->main_group, &main_hash,
1809 GNUNET_NO);
1810 else if (epoch->main_announcement)
1811 has_hash = get_epoch_announcement_member_hash (epoch->
1812 main_announcement, &
1813 main_hash, GNUNET_NO);
1814 else
1815 return;
1816
1817 if ((GNUNET_OK != has_hash) ||
1818 (0 != GNUNET_CRYPTO_hash_cmp (&main_hash, partner_hash)))
1819 return;
1820 }
1821
1822 group = get_epoch_group (epoch, identifier, GNUNET_NO);
1823
1824 if (! group)
1825 return;
1826
1827 handle_epoch_group_access (group, entry->message, hash);
1828 break;
1829 }
1830 default:
1831 return;
1832 }
1833}
enum GNUNET_GenericReturnValue get_epoch_announcement_member_hash(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue other)
Provides an announcement hash of a member from a given epoch announcement.
void handle_epoch_announcement_access(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles an access message with hash from its sender inside a given epoch announcement.
void handle_epoch_group_access(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles an access message with hash from its sender inside a given epoch group.
enum GNUNET_GenericReturnValue get_epoch_group_member_hash(const struct GNUNET_MESSENGER_EpochGroup *group, struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue other)
Provides an announcement hash of a member from a given epoch group.
enum GNUNET_GenericReturnValue verify_message_by_key(const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
Verifies the hmac of a given message body with a specific shared key.
static enum GNUNET_GenericReturnValue is_epoch_identifier_upper(const union GNUNET_MESSENGER_EpochIdentifier *identifier, const union GNUNET_MESSENGER_EpochIdentifier *other)
struct GNUNET_MESSENGER_EpochGroup * main_group
struct GNUNET_MESSENGER_EpochAnnouncement * main_announcement
struct GNUNET_HashCode event
The hash of the linked announcement or group message event.
struct GNUNET_HashCode partner
The hash of the partner group announcement.

References GNUNET_MESSENGER_MessageBody::access, GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_Message::body, cancel_room_action(), GNUNET_MESSENGER_EpochAnnouncement::epoch, GNUNET_MESSENGER_RoomMessageEntry::epoch, GNUNET_MESSENGER_MessageAccess::event, GNUNET_MESSENGER_RoomMessageEntry::flags, get_epoch_announcement(), get_epoch_announcement_key(), get_epoch_announcement_member_hash(), get_epoch_group(), get_epoch_group_member_hash(), get_room_availble_epoch_entry(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CRYPTO_hash_cmp(), GNUNET_MESSENGER_FLAG_RECENT, GNUNET_MESSENGER_FLAG_SENT, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_MESSENGER_KIND_APPEAL, GNUNET_MESSENGER_KIND_GROUP, GNUNET_NO, GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_MessageBody::group, handle_epoch_announcement_access(), handle_epoch_group_access(), GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageAnnouncement::identifier, GNUNET_MESSENGER_MessageGroup::identifier, GNUNET_MESSENGER_EpochAnnouncement::identifier, is_epoch_identifier_upper(), GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_Epoch::main_announcement, GNUNET_MESSENGER_Epoch::main_group, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, GNUNET_MESSENGER_MessageGroup::partner, GNUNET_MESSENGER_Epoch::room, GNUNET_MESSENGER_RoomMessageEntry::sender, and verify_message_by_key().

Referenced by handle_message().

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

◆ handle_revolution_message()

static void handle_revolution_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1837 of file messenger_api_room.c.

1840{
1841 struct GNUNET_MESSENGER_Epoch *epoch;
1842 const union GNUNET_MESSENGER_EpochNonce *nonce;
1843 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1844
1845 GNUNET_assert ((room) && (hash) && (entry));
1846
1847 epoch = get_room_availble_epoch_entry (room, hash, entry, entry->sender);
1848
1849 if (! epoch)
1850 return;
1851
1852 nonce = &(entry->message->body.announcement.nonce);
1853
1855 nonce->hash)))
1856 {
1858 "Unsafe revolution: Nonce (%s) has already been used in this epoch! [%s]\n",
1859 GNUNET_sh2s (&(nonce->hash)), GNUNET_h2s (&(epoch->hash)));
1860 return;
1861 }
1862
1863 GNUNET_CONTAINER_multishortmap_put (epoch->nonces, &(nonce->hash), NULL,
1865
1866 identifier = &(entry->message->body.revolution.identifier);
1867
1868 if (identifier->code.group_bit)
1869 {
1870 struct GNUNET_MESSENGER_EpochGroup *group;
1872
1873 group = get_epoch_group (epoch, identifier, GNUNET_YES);
1874
1875 if (! group)
1876 return;
1877
1878 key = get_epoch_group_key (group);
1879
1880 if (! key)
1881 return;
1882
1883 if (GNUNET_OK != verify_message_by_key (entry->message, key))
1884 return;
1885
1886 invalidate_epoch_group (group, NULL);
1887 }
1888 else
1889 {
1890 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
1892
1893 announcement = get_epoch_announcement (epoch, identifier, GNUNET_YES);
1894
1895 if (! announcement)
1896 return;
1897
1898 key = get_epoch_announcement_key (announcement);
1899
1900 if (! key)
1901 return;
1902
1903 if (GNUNET_OK != verify_message_by_key (entry->message, key))
1904 return;
1905
1906 invalidate_epoch_announcement (announcement, NULL);
1907 }
1908}
void invalidate_epoch_announcement(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Contact *contact)
Invalidates a given epoch announcement by a specific contact.
void invalidate_epoch_group(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_Contact *contact)
Invalidates a given epoch group by a specific contact.
const struct GNUNET_CRYPTO_SymmetricSessionKey * get_epoch_group_key(const struct GNUNET_MESSENGER_EpochGroup *group)
Returns the secret key of a given epoch group or NULL.

References GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, get_epoch_announcement(), get_epoch_announcement_key(), get_epoch_group(), get_epoch_group_key(), get_room_availble_epoch_entry(), GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_multishortmap_contains(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_OK, GNUNET_sh2s(), GNUNET_YES, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_EpochNonce::hash, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_MessageRevolution::identifier, invalidate_epoch_announcement(), invalidate_epoch_group(), key, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_MessageAnnouncement::nonce, GNUNET_MESSENGER_Epoch::nonces, GNUNET_MESSENGER_MessageBody::revolution, GNUNET_MESSENGER_RoomMessageEntry::sender, and verify_message_by_key().

Referenced by handle_message().

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

◆ handle_group_message()

static void handle_group_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1912 of file messenger_api_room.c.

1915{
1916 struct GNUNET_MESSENGER_Epoch *epoch;
1917 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1918 struct GNUNET_MESSENGER_EpochGroup *group;
1919
1920 GNUNET_assert ((room) && (hash) && (entry));
1921
1922 epoch = get_room_availble_epoch_entry (room, hash, entry, entry->sender);
1923
1924 if (! epoch)
1925 return;
1926
1927 identifier = &(entry->message->body.group.identifier);
1929
1930 if (! (GNUNET_MESSENGER_FLAG_SENT & entry->flags))
1931 return;
1932
1934
1935 set_epoch_group_key (group, NULL, GNUNET_YES);
1936 send_epoch_group_access (group, hash);
1937}
void set_epoch_proposal_group(struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_HashCode *hash)
Sets the current group of proposal for a given epoch to the group specified by a message identified b...
enum GNUNET_GenericReturnValue send_epoch_group_access(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_HashCode *event)
Tries to send an access message by the client responding to a previous event in regards to a given ep...
void set_epoch_group_key(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, enum GNUNET_GenericReturnValue write_record)
Sets the secret key of a given epoch group to a shared key.

References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochGroup::epoch, GNUNET_MESSENGER_RoomMessageEntry::flags, get_epoch_group(), get_room_availble_epoch_entry(), GNUNET_assert, GNUNET_MESSENGER_FLAG_SENT, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_MessageBody::group, GNUNET_MESSENGER_MessageGroup::identifier, GNUNET_MESSENGER_EpochGroup::identifier, GNUNET_MESSENGER_RoomMessageEntry::message, send_epoch_group_access(), GNUNET_MESSENGER_RoomMessageEntry::sender, set_epoch_group_key(), and set_epoch_proposal_group().

Referenced by handle_message().

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

◆ handle_authorization_message()

static void handle_authorization_message ( struct GNUNET_MESSENGER_Room room,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_RoomMessageEntry entry 
)
static

Definition at line 1941 of file messenger_api_room.c.

1944{
1945 struct GNUNET_MESSENGER_Epoch *epoch;
1946 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1947 struct GNUNET_MESSENGER_EpochGroup *auth_group;
1948 const struct GNUNET_CRYPTO_SymmetricSessionKey *group_key;
1949 const struct GNUNET_MESSENGER_RoomMessageEntry *event_entry;
1950 struct GNUNET_CRYPTO_SymmetricSessionKey shared_key;
1951
1952 GNUNET_assert ((room) && (hash) && (entry));
1953
1954 epoch = get_room_availble_epoch_entry (room, hash, entry, entry->sender);
1955
1956 if (! epoch)
1957 return;
1958
1959 identifier = &(entry->message->body.authorization.identifier);
1960 auth_group = get_epoch_group (epoch, identifier, GNUNET_NO);
1961
1962 if (! auth_group)
1963 return;
1964
1965 group_key = get_epoch_group_key (auth_group);
1966
1967 if (! group_key)
1968 return;
1969
1970 event_entry = GNUNET_CONTAINER_multihashmap_get (
1971 room->messages, &(entry->message->body.authorization.event));
1972
1973 if (! event_entry)
1974 return;
1975
1976 switch (event_entry->message->header.kind)
1977 {
1979 {
1980 identifier = &(event_entry->message->body.announcement.identifier);
1981
1982 if (0 == GNUNET_memcmp (identifier, &(auth_group->identifier)))
1983 return;
1984
1985 if (identifier->code.group_bit)
1986 {
1987 struct GNUNET_MESSENGER_EpochGroup *group;
1988 uint32_t next_level;
1989
1991 identifier, &(auth_group->identifier)))
1992 return;
1993
1995
1996 if (! group)
1997 return;
1998
1999 next_level = get_epoch_group_level (auth_group) + 1;
2000
2001 if (next_level != get_epoch_group_level (group))
2002 return;
2003
2005 entry->message, group_key, &shared_key))
2006 return;
2007
2008 if (get_epoch_group_key (group))
2009 return;
2010
2013 }
2014 else
2015 {
2016 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
2017
2019
2020 if (! announcement)
2021 return;
2022
2024 entry->message, group_key, &shared_key))
2025 return;
2026
2028 event_entry->message, &shared_key))
2029 return;
2030
2031 if (get_epoch_announcement_key (announcement))
2032 return;
2033
2035 send_epoch_announcement (announcement);
2036 }
2037
2038 break;
2039 }
2041 {
2042 struct GNUNET_MESSENGER_EpochGroup *group;
2043 const struct GNUNET_HashCode *announcement_hash;
2044 uint32_t next_level;
2045
2046 identifier = &(event_entry->message->body.group.identifier);
2047
2048 if ((0 == GNUNET_memcmp (identifier, &(auth_group->identifier))) ||
2049 (GNUNET_YES != is_epoch_identifier_upper (identifier, &(auth_group->
2050 identifier))))
2051 return;
2052
2053 if (! (identifier->code.group_bit))
2054 return;
2055
2056 group = get_epoch_group (epoch, identifier, GNUNET_NO);
2057
2058 if (! group)
2059 return;
2060
2061 next_level = get_epoch_group_level (auth_group) + 1;
2062
2063 if (next_level != get_epoch_group_level (group))
2064 return;
2065
2066 if (event_entry->sender == entry->sender)
2067 announcement_hash = &(event_entry->message->body.group.initiator);
2068 else
2069 announcement_hash = &(event_entry->message->body.group.partner);
2070
2071 event_entry = GNUNET_CONTAINER_multihashmap_get (room->messages,
2072 announcement_hash);
2073
2074 if (! event_entry)
2075 return;
2076
2078 kind)
2079 return;
2080
2081 identifier = &(event_entry->message->body.announcement.identifier);
2082
2083 if (0 != GNUNET_memcmp (identifier, &(auth_group->identifier)))
2084 return;
2085
2087 entry->message, group_key, &shared_key))
2088 return;
2089
2090 if (get_epoch_group_key (group))
2091 return;
2092
2093 set_epoch_group_key (group, &shared_key, GNUNET_YES);
2095 break;
2096 }
2097 default:
2098 break;
2099 }
2100}
enum GNUNET_GenericReturnValue send_epoch_group_announcement(struct GNUNET_MESSENGER_EpochGroup *group)
Tries to send an announcement message by the client for a given epoch group using its secret key.
uint32_t get_epoch_group_level(const struct GNUNET_MESSENGER_EpochGroup *group)
Returns the group level of a given epoch group.
enum GNUNET_GenericReturnValue extract_authorization_message_key(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_SymmetricSessionKey *key, struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key)
Extracts the shared epoch or group key from an authorization message using a previously exchanged sha...
struct GNUNET_CRYPTO_SymmetricSessionKey * shared_key
struct GNUNET_CRYPTO_SymmetricSessionKey * shared_key
struct GNUNET_HashCode event
The hash of the linked group message event.
struct GNUNET_HashCode initiator
The hash of the initiator group announcement.

References GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_MessageBody::authorization, GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, GNUNET_MESSENGER_EpochAnnouncement::epoch, GNUNET_MESSENGER_EpochGroup::epoch, GNUNET_MESSENGER_MessageAuthorization::event, extract_authorization_message_key(), get_epoch_announcement(), get_epoch_announcement_key(), get_epoch_group(), get_epoch_group_key(), get_epoch_group_level(), get_room_availble_epoch_entry(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_memcmp, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_MESSENGER_KIND_GROUP, GNUNET_NO, GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_MessageBody::group, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageAnnouncement::identifier, GNUNET_MESSENGER_MessageGroup::identifier, GNUNET_MESSENGER_MessageAuthorization::identifier, GNUNET_MESSENGER_EpochAnnouncement::identifier, GNUNET_MESSENGER_EpochGroup::identifier, GNUNET_MESSENGER_MessageGroup::initiator, is_epoch_identifier_upper(), GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_RoomMessageEntry::message, GNUNET_MESSENGER_Room::messages, GNUNET_MESSENGER_MessageGroup::partner, send_epoch_announcement(), send_epoch_group_announcement(), GNUNET_MESSENGER_RoomMessageEntry::sender, set_epoch_announcement_key(), set_epoch_group_key(), GNUNET_MESSENGER_EpochAnnouncement::shared_key, GNUNET_MESSENGER_EpochGroup::shared_key, and verify_message_by_key().

Referenced by handle_message().

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}

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

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

static enum GNUNET_GenericReturnValue iterate_local_members ( void *  cls,
const struct GNUNET_ShortHashCode key,
void *  value 
)
static

Definition at line 2343 of file messenger_api_room.c.

2346{
2348 struct GNUNET_MESSENGER_Contact *contact;
2349
2350 GNUNET_assert ((cls) && (value));
2351
2352 call = cls;
2353 contact = value;
2354
2355 return call->callback (call->cls, call->room, contact);
2356}
static struct GNUNET_CONVERSATION_Call * call
Call handle (for active outgoing call).

References call, GNUNET_assert, and value.

Referenced by iterate_room_members().

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 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:

◆ iterate_find_member()

static enum GNUNET_GenericReturnValue iterate_find_member ( void *  cls,
const struct GNUNET_ShortHashCode key,
void *  value 
)
static

Definition at line 2390 of file messenger_api_room.c.

2393{
2394 struct GNUNET_MESSENGER_MemberFind *find;
2395 struct GNUNET_MESSENGER_Contact *contact;
2396
2397 GNUNET_assert ((cls) && (value));
2398
2399 find = cls;
2400 contact = value;
2401
2402 if (contact == find->contact)
2403 {
2404 find->result = GNUNET_YES;
2405 return GNUNET_NO;
2406 }
2407
2408 return GNUNET_YES;
2409}
const struct GNUNET_MESSENGER_Contact * contact
enum GNUNET_GenericReturnValue result

References GNUNET_MESSENGER_MemberFind::contact, GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_MemberFind::result, and value.

Referenced by find_room_member().

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)

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:

◆ find_linked_hash()

static enum GNUNET_GenericReturnValue find_linked_hash ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 2431 of file messenger_api_room.c.

2434{
2435 const struct GNUNET_HashCode **result;
2436 struct GNUNET_HashCode *hash;
2437
2438 GNUNET_assert ((cls) && (value));
2439
2440 result = cls;
2441 hash = value;
2442
2443 if (0 == GNUNET_CRYPTO_hash_cmp (hash, *result))
2444 {
2445 *result = NULL;
2446 return GNUNET_NO;
2447 }
2448
2449 return GNUNET_YES;
2450}
static int result
Global testing status.

References GNUNET_assert, GNUNET_CRYPTO_hash_cmp(), GNUNET_NO, GNUNET_YES, result, and value.

Referenced by link_room_message().

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}
#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)

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:

◆ clear_linked_hash()

static enum GNUNET_GenericReturnValue clear_linked_hash ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 2490 of file messenger_api_room.c.

2493{
2494 struct GNUNET_HashCode **linked;
2495 struct GNUNET_HashCode *hash;
2496
2497 GNUNET_assert ((cls) && (value));
2498
2499 linked = cls;
2500 hash = value;
2501
2502 if (0 != GNUNET_CRYPTO_hash_cmp (*linked, hash))
2503 return GNUNET_YES;
2504
2505 *linked = hash;
2506 return GNUNET_NO;
2507}

References GNUNET_assert, GNUNET_CRYPTO_hash_cmp(), GNUNET_NO, GNUNET_YES, and value.

Referenced by delete_linked_hash().

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

◆ delete_linked_hash()

static enum GNUNET_GenericReturnValue delete_linked_hash ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 2511 of file messenger_api_room.c.

2514{
2516 struct GNUNET_HashCode *hash;
2517 struct GNUNET_HashCode key_value;
2518 struct GNUNET_HashCode *linked;
2519
2520 GNUNET_assert ((cls) && (key) && (value));
2521
2522 info = cls;
2523 hash = value;
2524
2525 GNUNET_memcpy (&key_value, key, sizeof (key_value));
2526
2527 linked = &key_value;
2529 clear_linked_hash, &linked);
2530
2531 if ((linked != &key_value) &&
2533 hash, linked)))
2534 GNUNET_free (linked);
2535
2536 if (info->deletion)
2537 info->deletion (info->room, hash, info->delay);
2538
2539 GNUNET_free (hash);
2540 return GNUNET_YES;
2541}
#define info
static enum GNUNET_GenericReturnValue clear_linked_hash(void *cls, const struct GNUNET_HashCode *key, void *value)

References clear_linked_hash(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_memcpy, GNUNET_YES, info, key, and value.

Referenced by link_room_deletion().

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}
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: