GNUnet 0.29.1-6-gb66d952d5
 
Loading...
Searching...
No Matches
gnunet-service-messenger_message_send.c File Reference
Include dependency graph for gnunet-service-messenger_message_send.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_MESSENGER_MemberNotify
 

Functions

static void notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify, struct GNUNET_MESSENGER_SrvMemberSession *session, enum GNUNET_GenericReturnValue check_permission)
 
static enum GNUNET_GenericReturnValue iterate_notify_about_members (void *cls, const struct GNUNET_CRYPTO_BlindablePublicKey *public_key, struct GNUNET_MESSENGER_SrvMemberSession *session)
 
static enum GNUNET_GenericReturnValue iterate_epoch_session_members (void *cls, const struct GNUNET_CRYPTO_BlindablePublicKey *public_key, struct GNUNET_MESSENGER_SrvMemberSession *session)
 
static enum GNUNET_GenericReturnValue traverse_epoch_message (struct GNUNET_MESSENGER_MemberNotify *notify, const struct GNUNET_HashCode *hash)
 
static enum GNUNET_GenericReturnValue traverse_epoch_session_message (struct GNUNET_MESSENGER_MemberNotify *notify, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message)
 
void send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent join message to ensure growth of the decentralized room structure.
 
void send_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent key message to ensure changes to the public key of the sending handle.
 
void send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent peer message to update the rooms peer message of this service.
 
void send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent id message to update the handles member id in the room.
 
void send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles a sent request message to trigger the request operation for this service.
 

Function Documentation

◆ notify_about_members()

static void notify_about_members ( struct GNUNET_MESSENGER_MemberNotify *  notify,
struct GNUNET_MESSENGER_SrvMemberSession *  session,
enum GNUNET_GenericReturnValue  check_permission 
)
static

Definition at line 47 of file gnunet-service-messenger_message_send.c.

50{
51 struct GNUNET_MESSENGER_MessageStore *message_store;
52 struct GNUNET_MESSENGER_ListMessage *element;
53
54 GNUNET_assert ((notify) && (session));
55
56 if (session->prev)
57 notify_about_members (notify, session->prev, GNUNET_YES);
58
59 message_store = get_srv_room_message_store (notify->room);
60
62 "Notify through all of member session: %s\n",
64
65 for (element = session->messages.head; element; element = element->next)
66 {
67 const struct GNUNET_MESSENGER_Message *message;
68
69 if ((notify->map) &&
71 &(element->hash))
72 ))
73 continue;
74
75 if ((GNUNET_YES == check_permission) &&
77 &(element->hash),
78 GNUNET_NO)))
79 {
81 "Permission for notification of session message denied!\n");
82 continue;
83 }
84
85 if ((notify->map) &&
86 (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (notify->map, &(element
87 ->hash),
88 NULL,
90
91
92
94 "Notification of session message could be duplicated!\n");
95
96 message = get_store_message (message_store, &(element->hash));
97
98 if ((! message) || (GNUNET_YES == is_peer_message (message)))
99 {
101 "Session message for notification is invalid!\n");
102 continue;
103 }
104
105 {
106 struct GNUNET_MESSENGER_SenderSession sender;
107 const struct GNUNET_HashCode *epoch;
108
109 sender.member = session;
110 epoch = get_store_message_epoch (message_store, &(element->hash));
111
112 notify_srv_handle_message (notify->handle, notify->room, &sender, message,
113 &(element->hash), epoch, GNUNET_NO);
114 }
115 }
116}
void notify_srv_handle_message(struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SenderSession *session, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, const struct GNUNET_HashCode *epoch, enum GNUNET_GenericReturnValue recent)
Notifies the handle that a new message was received or sent.
const struct GNUNET_ShortHashCode * get_member_session_id(const struct GNUNET_MESSENGER_SrvMemberSession *session)
Returns the member id of a given member session.
enum GNUNET_GenericReturnValue check_member_session_history(const struct GNUNET_MESSENGER_SrvMemberSession *session, const struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue ownership)
Checks the history of a session for a specific message which is identified by its hash and if the own...
static void notify_about_members(struct GNUNET_MESSENGER_MemberNotify *notify, struct GNUNET_MESSENGER_SrvMemberSession *session, enum GNUNET_GenericReturnValue check_permission)
const struct GNUNET_HashCode * get_store_message_epoch(const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash)
Returns the epoch hash of a message from a message store matching a given hash.
const struct GNUNET_MESSENGER_Message * get_store_message(struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash)
Returns the message from a message store matching a given hash.
struct GNUNET_MESSENGER_MessageStore * get_srv_room_message_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used message store of a given room.
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).
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_UNIQUE_FAST
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE...
#define GNUNET_log(kind,...)
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
const char * GNUNET_sh2s(const struct GNUNET_ShortHashCode *shc)
Convert a short hash value to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_DEBUG
enum GNUNET_GenericReturnValue is_peer_message(const struct GNUNET_MESSENGER_Message *message)
Returns whether a specific kind of message can be sent by the service without usage of a clients priv...
A 512-bit hashcode.
struct GNUNET_MESSENGER_ListMessage * next
struct GNUNET_MESSENGER_ListMessage * head
struct GNUNET_CONTAINER_MultiHashMap * map
struct GNUNET_MESSENGER_SrvMemberSession * session
struct GNUNET_MESSENGER_SrvHandle * handle
struct GNUNET_MESSENGER_SrvMemberSession * prev

References check_member_session_history(), get_member_session_id(), get_srv_room_message_store(), get_store_message(), get_store_message_epoch(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_sh2s(), GNUNET_YES, GNUNET_MESSENGER_MemberNotify::handle, GNUNET_MESSENGER_ListMessage::hash, GNUNET_MESSENGER_ListMessages::head, is_peer_message(), GNUNET_MESSENGER_MemberNotify::map, GNUNET_MESSENGER_SenderSession::member, GNUNET_MESSENGER_SrvMemberSession::messages, GNUNET_MESSENGER_ListMessage::next, notify_about_members(), notify_srv_handle_message(), GNUNET_MESSENGER_SrvMemberSession::prev, GNUNET_MESSENGER_MemberNotify::room, and GNUNET_MESSENGER_MemberNotify::session.

Referenced by iterate_notify_about_members(), and notify_about_members().

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

◆ iterate_notify_about_members()

static enum GNUNET_GenericReturnValue iterate_notify_about_members ( void *  cls,
const struct GNUNET_CRYPTO_BlindablePublicKey *  public_key,
struct GNUNET_MESSENGER_SrvMemberSession *  session 
)
static

Definition at line 120 of file gnunet-service-messenger_message_send.c.

124{
125 struct GNUNET_MESSENGER_MemberNotify *notify;
126
127 GNUNET_assert ((cls) && (session));
128
129 notify = cls;
130
131 if ((notify->session == session) ||
133 return GNUNET_YES;
134
135 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Notify about member session: %s\n",
137
139 return GNUNET_YES;
140}
enum GNUNET_GenericReturnValue is_member_session_completed(const struct GNUNET_MESSENGER_SrvMemberSession *session)
Returns if the given member session has been completed.

References get_member_session_id(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_sh2s(), GNUNET_YES, is_member_session_completed(), notify_about_members(), and GNUNET_MESSENGER_MemberNotify::session.

Referenced by send_message_join().

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

◆ iterate_epoch_session_members()

static enum GNUNET_GenericReturnValue iterate_epoch_session_members ( void *  cls,
const struct GNUNET_CRYPTO_BlindablePublicKey *  public_key,
struct GNUNET_MESSENGER_SrvMemberSession *  session 
)
static

Definition at line 144 of file gnunet-service-messenger_message_send.c.

149{
150 struct GNUNET_MESSENGER_MemberNotify *notify;
151 struct GNUNET_MESSENGER_MessageStore *message_store;
152 struct GNUNET_MESSENGER_ListMessage *element;
153
154 GNUNET_assert ((cls) && (session));
155
156 notify = cls;
157
158 if ((notify->session == session) ||
160 return GNUNET_YES;
161
162 message_store = get_srv_room_message_store (notify->room);
163
164 for (element = session->messages.head; element; element = element->next)
165 {
166 const struct GNUNET_MESSENGER_Message *message;
167
169 &(element->hash)))
170 continue;
171
172 message = get_store_message (message_store, &(element->hash));
173
174 if ((! message) ||
175 ((GNUNET_MESSENGER_KIND_JOIN != message->header.kind) &&
177 continue;
178
180 "Mark member session being labeled as important: %s\n",
182
183 GNUNET_CONTAINER_multihashmap_put (notify->map, &(element->hash), session,
185 }
186
187 return GNUNET_YES;
188}
@ GNUNET_MESSENGER_KIND_LEAVE
The leave kind.
@ GNUNET_MESSENGER_KIND_JOIN
The join kind.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.
struct GNUNET_MESSENGER_MessageHeader header
Header.

References get_member_session_id(), get_srv_room_message_store(), get_store_message(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_sh2s(), GNUNET_YES, GNUNET_MESSENGER_ListMessage::hash, GNUNET_MESSENGER_ListMessages::head, GNUNET_MESSENGER_Message::header, is_member_session_completed(), GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MemberNotify::map, GNUNET_MESSENGER_SrvMemberSession::messages, GNUNET_MESSENGER_ListMessage::next, GNUNET_MESSENGER_MemberNotify::room, and GNUNET_MESSENGER_MemberNotify::session.

Referenced by send_message_join().

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

◆ traverse_epoch_message()

static enum GNUNET_GenericReturnValue traverse_epoch_message ( struct GNUNET_MESSENGER_MemberNotify *  notify,
const struct GNUNET_HashCode *  hash 
)
static

Definition at line 313 of file gnunet-service-messenger_message_send.c.

315{
316 struct GNUNET_MESSENGER_MessageStore *message_store;
317 const struct GNUNET_MESSENGER_Message *message;
318
319 GNUNET_assert ((notify) && (hash));
320
321 if (GNUNET_is_zero (hash))
322 return GNUNET_NO;
323
325 return GNUNET_NO;
326
327 message_store = get_srv_room_message_store (notify->room);
328
329 if (! message_store)
330 return GNUNET_NO;
331
332 message = get_store_message (message_store, hash);
333
334 if (! message)
335 return GNUNET_NO;
336
337 return traverse_epoch_session_message (notify, hash, message);
338}
static enum GNUNET_GenericReturnValue traverse_epoch_session_message(struct GNUNET_MESSENGER_MemberNotify *notify, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message)
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
#define GNUNET_is_zero(a)
Check that memory in a is all zeros.

References GNUNET_MESSENGER_MemberNotify::epoch_counter, get_srv_room_message_store(), get_store_message(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_size(), GNUNET_is_zero, GNUNET_NO, GNUNET_MESSENGER_MemberNotify::map, GNUNET_MESSENGER_MemberNotify::room, and traverse_epoch_session_message().

Referenced by send_message_join(), and traverse_epoch_session_message().

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

◆ traverse_epoch_session_message()

static enum GNUNET_GenericReturnValue traverse_epoch_session_message ( struct GNUNET_MESSENGER_MemberNotify *  notify,
const struct GNUNET_HashCode *  hash,
const struct GNUNET_MESSENGER_Message *  message 
)
static

Definition at line 197 of file gnunet-service-messenger_message_send.c.

200{
201 struct GNUNET_MESSENGER_SrvMemberSession *session;
202 enum GNUNET_GenericReturnValue notification;
203 struct GNUNET_PeerIdentity *peer_identity;
204
205 GNUNET_assert ((notify) && (message) && (hash));
206
207 session = GNUNET_CONTAINER_multihashmap_get (notify->map, hash);
208
209 if (session)
210 {
212 "Unmark member session from labeled as important: %s\n",
214
215 GNUNET_CONTAINER_multihashmap_put (notify->map, hash, NULL,
217 notify->epoch_counter++;
218
219 notification = GNUNET_YES;
220 }
222 hash))
223 return GNUNET_YES;
224 else
225 notification = GNUNET_NO;
226
227 peer_identity = NULL;
228
229 switch (message->header.kind)
230 {
232 if (GNUNET_YES == traverse_epoch_message (notify, &(message->body.join.epoch
233 )))
234 notification = GNUNET_YES;
235 break;
237 if (GNUNET_YES == traverse_epoch_message (notify, &(message->body.leave.
238 epoch)))
239 notification = GNUNET_YES;
240 break;
242 {
243 struct GNUNET_MESSENGER_PeerStore *peer_store;
244
245 peer_store = get_srv_room_peer_store (notify->room);
246
247 if (peer_store)
248 peer_identity = get_store_peer_of (peer_store, message, hash);
249
250 if (GNUNET_YES == traverse_epoch_message (notify, &(message->body.merge.
251 epochs[0])))
252 notification = GNUNET_YES;
253 if (GNUNET_YES == traverse_epoch_message (notify, &(message->body.merge.
254 epochs[1])))
255 notification = GNUNET_YES;
256 break;
257 }
258 default:
259 break;
260 }
261
262 if (GNUNET_YES != notification)
263 return notification;
264
265 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Notify about past epoch: %s\n",
266 GNUNET_h2s (hash));
267
268 if (! session)
269 {
270 struct GNUNET_MESSENGER_MemberStore *member_store;
271 struct GNUNET_MESSENGER_Member *member = NULL;
272
274 goto skip_session;
275
276 member_store = get_srv_room_member_store (notify->room);
277
278 if (member_store)
279 member = get_store_member_of (member_store, message);
280
281 if (member)
282 session = get_member_session_of (member, message, hash);
283
284skip_session:
285 GNUNET_CONTAINER_multihashmap_put (notify->map, hash, NULL,
287 }
288
289 {
290 struct GNUNET_MESSENGER_SenderSession sender;
291
292 if (session)
293 sender.member = session;
294 else if (peer_identity)
295 sender.peer = peer_identity;
296 else
297 {
299 "No valid sender session for message: %s\n",
300 GNUNET_h2s (hash));
301 return notification;
302 }
303
304 notify_srv_handle_message (notify->handle, notify->room, &sender, message,
305 hash, hash, GNUNET_NO);
306 }
307
308 return notification;
309}
static unsigned int epochs
-e option.
struct GNUNET_MESSENGER_SrvMemberSession * get_member_session_of(struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Returns the member session of a member using a public key which can verify the signature of a given m...
struct GNUNET_MESSENGER_Member * get_store_member_of(struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message)
Returns the member of a store using a sender id of a given message.
static enum GNUNET_GenericReturnValue traverse_epoch_message(struct GNUNET_MESSENGER_MemberNotify *notify, const struct GNUNET_HashCode *hash)
struct GNUNET_PeerIdentity * get_store_peer_of(struct GNUNET_MESSENGER_PeerStore *store, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Returns the peer identity inside the store which verifies the signature of a given message as valid.
struct GNUNET_MESSENGER_PeerStore * get_srv_room_peer_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used peer store of a given room.
struct GNUNET_MESSENGER_MemberStore * get_srv_room_member_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used member store of a given room.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE
If a value with the given key exists, replace it.
GNUNET_GenericReturnValue
Named constants for return values.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
@ GNUNET_MESSENGER_KIND_MERGE
The merge kind.
struct GNUNET_MESSENGER_MessageMerge merge
struct GNUNET_MESSENGER_MessageLeave leave
struct GNUNET_MESSENGER_MessageJoin join
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
struct GNUNET_MESSENGER_MessageBody body
Body.
struct GNUNET_MESSENGER_SrvMemberSession * member
The identity of the host (wraps the signing key of the peer).

References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_MessageJoin::epoch, GNUNET_MESSENGER_MemberNotify::epoch_counter, epochs, get_member_session_id(), get_member_session_of(), get_srv_room_member_store(), get_srv_room_peer_store(), get_store_member_of(), get_store_peer_of(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_log, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_MERGE, GNUNET_NO, GNUNET_sh2s(), GNUNET_YES, GNUNET_MESSENGER_MemberNotify::handle, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageBody::join, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MessageBody::leave, GNUNET_MESSENGER_MemberNotify::map, GNUNET_MESSENGER_SenderSession::member, GNUNET_MESSENGER_MessageBody::merge, notify_srv_handle_message(), GNUNET_MESSENGER_SenderSession::peer, GNUNET_MESSENGER_MemberNotify::room, and traverse_epoch_message().

Referenced by traverse_epoch_message().

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

◆ send_message_join()

void send_message_join ( struct GNUNET_MESSENGER_SrvRoom *  room,
struct GNUNET_MESSENGER_SrvHandle *  handle,
const struct GNUNET_MESSENGER_Message *  message,
const struct GNUNET_HashCode *  hash 
)

Handles a sent join message to ensure growth of the decentralized room structure.

(if the service provides a peer message for this room currently, it will be forwarded)

Parameters
[in,out]roomRoom of the message
[in,out]handleSending handle
[in]messageJOIN-Message
[in]hashHash of the message

Definition at line 342 of file gnunet-service-messenger_message_send.c.

346{
347 struct GNUNET_MESSENGER_MemberStore *member_store;
348 struct GNUNET_MESSENGER_Member *member;
349 struct GNUNET_MESSENGER_SrvMemberSession *session;
350
351 set_srv_handle_key (handle, &(message->body.join.key));
352
353 member_store = get_srv_room_member_store (room);
354 member = add_store_member (member_store,
355 &(message->header.sender_id));
356
357 if (! member)
358 {
360 "A member could not join with ID: %s\n",
361 GNUNET_sh2s (&(message->header.sender_id)));
362 goto skip_member_notification;
363 }
364
365 session = get_member_session_of (member, message, hash);
366
367 if (! session)
368 {
370 "A valid session is required to join a room!\n");
371 goto skip_member_notification;
372 }
373
374 {
375 struct GNUNET_MESSENGER_MemberNotify notify;
376
377 notify.room = room;
378 notify.handle = handle;
379 notify.session = session;
381 notify.epoch_counter = 0;
382
383 if (notify.map)
384 {
385 uint32_t epoch_count;
386
388 notify);
389
390 epoch_count = GNUNET_CONTAINER_multihashmap_size (notify.map);
391
393 "Notify about all (%u) related epochs for current membership verification!\n",
394 epoch_count);
395
396 traverse_epoch_message (&notify, &(message->body.join.epoch));
397
398 if (epoch_count > notify.epoch_counter)
399 {
400 uint32_t missing;
401
402 missing = epoch_count - notify.epoch_counter;
403
405 "Missing at least %u epoch%s for current membership verification!\n",
406 missing, missing > 1? "s" : "");
407 }
408 }
409
411 "Notify about all member sessions except: %s\n",
413
415
416 if (notify.map)
418 }
419
420skip_member_notification:
422}
void set_srv_handle_key(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_CRYPTO_BlindablePublicKey *key)
Sets the public key of a given handle.
int iterate_store_members(struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it, void *cls)
Iterate through all member sessions currently connected to the members of the given member store and ...
struct GNUNET_MESSENGER_Member * add_store_member(struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id)
Adds a member to a store under a specific id and returns it on success.
static enum GNUNET_GenericReturnValue iterate_epoch_session_members(void *cls, const struct GNUNET_CRYPTO_BlindablePublicKey *public_key, struct GNUNET_MESSENGER_SrvMemberSession *session)
static enum GNUNET_GenericReturnValue iterate_notify_about_members(void *cls, const struct GNUNET_CRYPTO_BlindablePublicKey *public_key, struct GNUNET_MESSENGER_SrvMemberSession *session)
void check_srv_room_peer_status(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Checks the current state of opening a given room from this peer and re-publishes it if necessary to a...
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition gnunet-vpn.c:35
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
struct GNUNET_ShortHashCode sender_id
The senders id inside of the room the message was sent in.
struct GNUNET_CRYPTO_BlindablePublicKey key
The senders blindable public key to verify its signatures.

References add_store_member(), GNUNET_MESSENGER_Message::body, check_srv_room_peer_status(), GNUNET_MESSENGER_MessageJoin::epoch, GNUNET_MESSENGER_MemberNotify::epoch_counter, get_member_session_id(), get_member_session_of(), get_srv_room_member_store(), GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NO, GNUNET_sh2s(), handle, GNUNET_MESSENGER_MemberNotify::handle, GNUNET_MESSENGER_Message::header, iterate_epoch_session_members(), iterate_notify_about_members(), iterate_store_members(), GNUNET_MESSENGER_MessageBody::join, GNUNET_MESSENGER_MessageJoin::key, GNUNET_MESSENGER_MemberNotify::map, GNUNET_MESSENGER_SrvMemberSession::member, GNUNET_MESSENGER_MemberNotify::room, GNUNET_MESSENGER_MessageHeader::sender_id, GNUNET_MESSENGER_MemberNotify::session, set_srv_handle_key(), and traverse_epoch_message().

Referenced by callback_srv_room_message_signed().

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

◆ send_message_key()

void send_message_key ( struct GNUNET_MESSENGER_SrvRoom *  room,
struct GNUNET_MESSENGER_SrvHandle *  handle,
const struct GNUNET_MESSENGER_Message *  message,
const struct GNUNET_HashCode *  hash 
)

Handles a sent key message to ensure changes to the public key of the sending handle.

Parameters
[in,out]roomRoom of the message
[in,out]handleSending handle
[in]messageKEY-Message
[in]hashHash of the message

Definition at line 426 of file gnunet-service-messenger_message_send.c.

430{
431 set_srv_handle_key (handle, &(message->body.key.key));
432}
struct GNUNET_MESSENGER_MessageKey key
struct GNUNET_CRYPTO_BlindablePublicKey key
The new blindable public key which replaces the current senders public key.

References GNUNET_MESSENGER_Message::body, handle, GNUNET_MESSENGER_MessageKey::key, GNUNET_MESSENGER_MessageBody::key, and set_srv_handle_key().

Referenced by callback_srv_room_message_signed().

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

◆ send_message_peer()

void send_message_peer ( struct GNUNET_MESSENGER_SrvRoom *  room,
struct GNUNET_MESSENGER_SrvHandle *  handle,
const struct GNUNET_MESSENGER_Message *  message,
const struct GNUNET_HashCode *  hash 
)

Handles a sent peer message to update the rooms peer message of this service.

(a set peer message indicates this service being a part of the decentralized room structure)

Parameters
[in,out]roomRoom of the message
[in,out]handleSending handle
[in]messagePEER-Message
[in]hashHash of the message

Definition at line 436 of file gnunet-service-messenger_message_send.c.

440{
442
443 if (! room->peer_message)
444 room->peer_message = GNUNET_new (struct GNUNET_HashCode);
445
446 GNUNET_memcpy (room->peer_message, hash, sizeof(struct GNUNET_HashCode));
447
449
450 if (! msg)
452 "Sending connection message failed: %s\n",
453 GNUNET_h2s (&(room->key)));
454 else
455 send_srv_room_message (room, room->host, msg);
456}
struct GNUNET_MessageHeader * msg
Definition 005.c:2
struct GNUNET_MESSENGER_Message * create_message_connection(const struct GNUNET_MESSENGER_SrvRoom *room)
Creates and allocates a new connection message containing the amount of the peer's connections in a g...
enum GNUNET_GenericReturnValue send_srv_room_message(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_Message *message)
Sends a message from a given handle into a room.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_MESSENGER_SrvHandle * host

References create_message_connection(), GNUNET_ERROR_TYPE_ERROR, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_new, GNUNET_MESSENGER_SrvRoom::host, GNUNET_MESSENGER_SrvRoom::key, msg, GNUNET_MESSENGER_SrvRoom::peer_message, and send_srv_room_message().

Referenced by callback_srv_room_message_signed().

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

◆ send_message_id()

void send_message_id ( struct GNUNET_MESSENGER_SrvRoom *  room,
struct GNUNET_MESSENGER_SrvHandle *  handle,
const struct GNUNET_MESSENGER_Message *  message,
const struct GNUNET_HashCode *  hash 
)

Handles a sent id message to update the handles member id in the room.

(changing member id is useful to prevent collisions)

Parameters
[in,out]roomRoom of the message
[in,out]handleSending handle
[in]messageID-Message
[in]hashHash of the message

Definition at line 460 of file gnunet-service-messenger_message_send.c.

464{
466 &(message->body.id.id));
467}
enum GNUNET_GenericReturnValue change_srv_handle_member_id(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *unique_id)
Changes the member id of a given handle in a specific room to match a unique_id and returns GNUNET_OK...
const struct GNUNET_HashCode * get_srv_room_key(const struct GNUNET_MESSENGER_SrvRoom *room)
Returns the shared secret you need to access a room.
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, change_srv_handle_member_id(), get_srv_room_key(), handle, GNUNET_MESSENGER_MessageId::id, and GNUNET_MESSENGER_MessageBody::id.

Referenced by callback_srv_room_message_signed().

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

◆ send_message_request()

void send_message_request ( struct GNUNET_MESSENGER_SrvRoom *  room,
struct GNUNET_MESSENGER_SrvHandle *  handle,
const struct GNUNET_MESSENGER_Message *  message,
const struct GNUNET_HashCode *  hash 
)

Handles a sent request message to trigger the request operation for this service.

(the request operation will deactivate the possibility of spamming requests)

Parameters
[in,out]roomRoom of the message
[in,out]handleSending handle
[in]messageREQUEST-Message
[in]hashHash of the message

Definition at line 471 of file gnunet-service-messenger_message_send.c.

475{
476 struct GNUNET_MESSENGER_OperationStore *operation_store;
477
478 operation_store = get_srv_room_operation_store (room);
479
481 operation_store,
482 &(message->body.request.hash),
485}
enum GNUNET_GenericReturnValue use_store_operation(struct GNUNET_MESSENGER_OperationStore *store, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_OperationType type, struct GNUNET_TIME_Relative delay)
Tries to use an operation under a given hash in a specific operation store.
struct GNUNET_MESSENGER_OperationStore * get_srv_room_operation_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used operation store of a given room.
#define GNUNET_MESSENGER_REQUEST_DELAY
struct GNUNET_MESSENGER_MessageRequest request
struct GNUNET_HashCode hash
The hash of the requested message.

References GNUNET_MESSENGER_Message::body, get_srv_room_operation_store(), GNUNET_MESSENGER_OP_REQUEST, GNUNET_MESSENGER_REQUEST_DELAY, GNUNET_MESSENGER_MessageRequest::hash, GNUNET_MESSENGER_MessageBody::request, GNUNET_MESSENGER_OperationStore::room, and use_store_operation().

Referenced by callback_srv_room_message_signed().

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