GNUnet debian-0.24.3-29-g453fda2cf
 
Loading...
Searching...
No Matches
gnunet-service-messenger_message_send.h File Reference
Include dependency graph for gnunet-service-messenger_message_send.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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

◆ 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 340 of file gnunet-service-messenger_message_send.c.

344{
345 struct GNUNET_MESSENGER_MemberStore *member_store;
346 struct GNUNET_MESSENGER_Member *member;
347 struct GNUNET_MESSENGER_MemberSession *session;
348
349 set_srv_handle_key (handle, &(message->body.join.key));
350
351 member_store = get_srv_room_member_store (room);
352 member = add_store_member (member_store,
353 &(message->header.sender_id));
354
355 if (! member)
356 {
358 "A member could not join with ID: %s\n",
359 GNUNET_sh2s (&(message->header.sender_id)));
360 goto skip_member_notification;
361 }
362
363 session = get_member_session_of (member, message, hash);
364
365 if (! session)
366 {
368 "A valid session is required to join a room!\n");
369 goto skip_member_notification;
370 }
371
372 {
373 struct GNUNET_MESSENGER_MemberNotify notify;
374
375 notify.room = room;
376 notify.handle = handle;
377 notify.session = session;
379 notify.epoch_counter = 0;
380
381 if (notify.map)
382 {
383 uint32_t epoch_count;
384
386 notify);
387
388 epoch_count = GNUNET_CONTAINER_multihashmap_size (notify.map);
389
391 "Notify about all (%u) related epochs for current membership verification!\n",
392 epoch_count);
393
394 traverse_epoch_message (&notify, &(message->body.join.epoch));
395
396 if (epoch_count > notify.epoch_counter)
397 {
398 uint32_t missing;
399
400 missing = epoch_count - notify.epoch_counter;
401
403 "Missing at least %u epoch%s for current membership verification!\n",
404 missing, missing > 1? "s" : "");
405 }
406 }
407
409 "Notify about all member sessions except: %s\n",
411
413
414 if (notify.map)
416 }
417
418skip_member_notification:
420}
void set_srv_handle_key(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_CRYPTO_PublicKey *key)
Sets the public key of a given handle.
struct GNUNET_MESSENGER_MemberSession * 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...
const struct GNUNET_ShortHashCode * get_member_session_id(const struct GNUNET_MESSENGER_MemberSession *session)
Returns the member id of a given member session.
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 traverse_epoch_message(struct GNUNET_MESSENGER_MemberNotify *notify, const struct GNUNET_HashCode *hash)
static enum GNUNET_GenericReturnValue iterate_notify_about_members(void *cls, const struct GNUNET_CRYPTO_PublicKey *public_key, struct GNUNET_MESSENGER_MemberSession *session)
static enum GNUNET_GenericReturnValue iterate_epoch_session_members(void *cls, const struct GNUNET_CRYPTO_PublicKey *public_key, struct GNUNET_MESSENGER_MemberSession *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...
struct GNUNET_MESSENGER_MemberStore * get_srv_room_member_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used member store of a given room.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition gnunet-vpn.c:35
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
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.
#define GNUNET_log(kind,...)
@ GNUNET_NO
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
struct GNUNET_MESSENGER_MemberSession * session
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.
struct GNUNET_MESSENGER_MessageHeader header
Header.
struct GNUNET_MESSENGER_MessageBody body
Body.

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_MemberSession::member, GNUNET_MESSENGER_MemberNotify::room, GNUNET_MESSENGER_MessageHeader::sender_id, GNUNET_MESSENGER_MemberNotify::session, set_srv_handle_key(), and traverse_epoch_message().

Referenced by send_srv_room_message().

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 424 of file gnunet-service-messenger_message_send.c.

428{
429 set_srv_handle_key (handle, &(message->body.key.key));
430}
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, handle, GNUNET_MESSENGER_MessageKey::key, GNUNET_MESSENGER_MessageBody::key, and set_srv_handle_key().

Referenced by send_srv_room_message().

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 434 of file gnunet-service-messenger_message_send.c.

438{
440
441 if (! room->peer_message)
442 room->peer_message = GNUNET_new (struct GNUNET_HashCode);
443
444 GNUNET_memcpy (room->peer_message, hash, sizeof(struct GNUNET_HashCode));
445
447
448 if (! msg)
450 "Sending connection message failed: %s\n",
451 GNUNET_h2s (&(room->key)));
452 else
453 send_srv_room_message (room, room->host, msg);
454}
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.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_new(type)
Allocate a struct or union of the given type.
A 512-bit hashcode.
struct GNUNET_HashCode * peer_message
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 send_srv_room_message().

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 458 of file gnunet-service-messenger_message_send.c.

462{
464 &(message->body.id.id));
465}
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 send_srv_room_message().

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 469 of file gnunet-service-messenger_message_send.c.

473{
474 struct GNUNET_MESSENGER_OperationStore *operation_store;
475
476 operation_store = get_srv_room_operation_store (room);
477
479 operation_store,
480 &(message->body.request.hash),
483}
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 send_srv_room_message().

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