#include "gnunet_cadet_service.h"
#include "gnunet_util_lib.h"
#include "gnunet_messenger_service.h"
#include "gnunet-service-messenger_handle.h"
#include "gnunet-service-messenger_message_state.h"
#include "gnunet-service-messenger_list_messages.h"
#include "gnunet-service-messenger_member_store.h"
#include "gnunet-service-messenger_message_store.h"
#include "gnunet-service-messenger_operation_store.h"
#include "gnunet-service-messenger_peer_store.h"
#include "messenger_api_list_tunnels.h"
#include "messenger_api_message.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_MESSENGER_SrvRoom |
Macros | |
#define | GNUNET_MESSENGER_IDLE_DELAY |
#define | GNUNET_MESSENGER_REQUEST_DELAY |
#define | GNUNET_MESSENGER_MERGE_DELAY |
Typedefs | |
typedef void() | GNUNET_MESSENGER_MessageRequestCallback(void *cls, struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
Method called whenever a message is found during a request in a room. More... | |
Functions | |
struct GNUNET_MESSENGER_SrvRoom * | create_srv_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) |
Creates and allocates a new room for a handle with a given key. More... | |
void | destroy_srv_room (struct GNUNET_MESSENGER_SrvRoom *room, enum GNUNET_GenericReturnValue deletion) |
Destroys a room and frees its memory fully. More... | |
struct GNUNET_MESSENGER_PeerStore * | get_srv_room_peer_store (struct GNUNET_MESSENGER_SrvRoom *room) |
Returns the used peer store of a given room. More... | |
struct GNUNET_MESSENGER_MemberStore * | get_srv_room_member_store (struct GNUNET_MESSENGER_SrvRoom *room) |
Returns the used member store of a given room. More... | |
struct GNUNET_MESSENGER_MessageStore * | get_srv_room_message_store (struct GNUNET_MESSENGER_SrvRoom *room) |
Returns the used message store of a given room. More... | |
struct GNUNET_MESSENGER_OperationStore * | get_srv_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room) |
Returns the used operation store of a given room. More... | |
enum GNUNET_GenericReturnValue | open_srv_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) |
Tries to open a room for a given handle. More... | |
enum GNUNET_GenericReturnValue | enter_srv_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door) |
Connects a tunnel to a hosting peer of a room through a so called door which is represented by a peer identity of a hosting peer. More... | |
struct GNUNET_MQ_Envelope * | pack_srv_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_PackMode mode) |
Packs a message depending on the selected mode into a newly allocated envelope. More... | |
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. More... | |
void | forward_srv_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
Forwards a message with a given hash to a specific tunnel inside of a room. More... | |
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 selected tunnel or to all connected tunnels if necessary or if the selected tunnel is NULL. More... | |
void | merge_srv_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) |
Reduces all current forks inside of the message history of a room to one remaining last message by merging them down. More... | |
enum GNUNET_GenericReturnValue | delete_srv_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) |
Deletes a message from the room with a given hash in a specific delay if the provided member by its session is permitted to do so. More... | |
struct GNUNET_CADET_Handle * | get_srv_room_cadet (struct GNUNET_MESSENGER_SrvRoom *room) |
Returns the CADET handle from a rooms service. More... | |
const struct GNUNET_HashCode * | get_srv_room_key (const struct GNUNET_MESSENGER_SrvRoom *room) |
Returns the shared secret you need to access a room. More... | |
const struct GNUNET_MESSENGER_SrvTunnel * | get_srv_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer) |
Returns a tunnel inside of a room leading towards a given peer if such a tunnel exists, otherwise NULL. More... | |
enum GNUNET_GenericReturnValue | request_srv_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_MemberSession *session, GNUNET_MESSENGER_MessageRequestCallback callback, void *cls) |
Requests a message from a room identified by a given hash. More... | |
void | solve_srv_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_CRYPTO_PublicKey *public_key, const struct GNUNET_ShortHashCode *member_id, struct GNUNET_TIME_Absolute timestamp) |
Checks for potential collisions with member ids and solves them changing active handles ids if they use an already used member id (comparing public key and timestamp). More... | |
void | rebuild_srv_room_basement_structure (struct GNUNET_MESSENGER_SrvRoom *room) |
Rebuilds the decentralized structure for a room by ensuring all required connections are made depending on the amount of peers and this peers index in the list of them. More... | |
uint32_t | get_srv_room_amount_of_tunnels (const struct GNUNET_MESSENGER_SrvRoom *room) |
Returns the amount of active tunnels of a given room. More... | |
uint32_t | get_srv_room_connection_flags (const struct GNUNET_MESSENGER_SrvRoom *room) |
Returns connection flags about connection information of a given room and the service managing it. More... | |
void | cleanup_srv_room_discourse_messages (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *discourse) |
Cleanup discourse messages outside of current subscriptions from a specific discourse of all the members in a given room. More... | |
void | load_srv_room (struct GNUNET_MESSENGER_SrvRoom *room) |
Loads the local configuration for a given room of a service which contains the last messages hash and the ruleset for general access of new members. More... | |
void | save_srv_room (struct GNUNET_MESSENGER_SrvRoom *room) |
Saves the configuration for a given room of a service which contains the last messages hash and the ruleset for general access of new members locally. More... | |
void | remove_srv_room (struct GNUNET_MESSENGER_SrvRoom *room) |
Removes the configuration for a given room of a service. More... | |
#define GNUNET_MESSENGER_IDLE_DELAY |
Definition at line 44 of file gnunet-service-messenger_room.h.
#define GNUNET_MESSENGER_REQUEST_DELAY |
Definition at line 47 of file gnunet-service-messenger_room.h.
#define GNUNET_MESSENGER_MERGE_DELAY |
Definition at line 50 of file gnunet-service-messenger_room.h.
typedef void() GNUNET_MESSENGER_MessageRequestCallback(void *cls, struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
Method called whenever a message is found during a request in a room.
[in,out] | cls | Closure from #request_room_message |
[in,out] | room | Room |
[in] | message | Message or NULL |
[in] | hash | Hash of message |
Definition at line 306 of file gnunet-service-messenger_room.h.
struct GNUNET_MESSENGER_SrvRoom * create_srv_room | ( | struct GNUNET_MESSENGER_SrvHandle * | handle, |
const struct GNUNET_HashCode * | key | ||
) |
Creates and allocates a new room for a handle with a given key.
[in,out] | handle | Handle |
[in] | key | Key of room |
Definition at line 46 of file gnunet-service-messenger_room.c.
References GNUNET_MESSENGER_SrvRoom::basement, GNUNET_MESSENGER_Service::dir, get_srv_room_member_store(), get_srv_room_message_store(), get_srv_room_operation_store(), get_srv_room_peer_store(), GNUNET_assert, GNUNET_CONTAINER_multipeermap_create(), GNUNET_memcpy, GNUNET_new, GNUNET_NO, GNUNET_SCHEDULER_add_with_priority(), GNUNET_SCHEDULER_PRIORITY_IDLE, handle, GNUNET_MESSENGER_SrvRoom::handling, GNUNET_MESSENGER_SrvRoom::host, GNUNET_MESSENGER_SrvRoom::idle, idle_request_room_messages(), init_list_messages(), init_list_tunnels(), init_member_store(), init_message_state(), init_message_store(), init_operation_store(), init_peer_store(), key, GNUNET_MESSENGER_SrvRoom::key, load_srv_room(), GNUNET_MESSENGER_SrvRoom::peer_message, GNUNET_MESSENGER_SrvRoom::port, GNUNET_MESSENGER_SrvRoom::service, GNUNET_MESSENGER_SrvRoom::state, and GNUNET_MESSENGER_SrvRoom::tunnels.
Referenced by entry_service_room(), and open_service_room().
void destroy_srv_room | ( | struct GNUNET_MESSENGER_SrvRoom * | room, |
enum GNUNET_GenericReturnValue | deletion | ||
) |
Destroys a room and frees its memory fully.
The deletion flag should only be set to GNUNET_YES if the room gets dropped by the service, otherwise GNUNET_NO.
[in,out] | room | Room |
[in] | deletion | Flag to indicate context of destruction |
Definition at line 109 of file gnunet-service-messenger_room.c.
References GNUNET_MESSENGER_SrvRoom::basement, clear_list_tunnels(), clear_member_store(), clear_message_state(), clear_message_store(), clear_operation_store(), clear_peer_store(), close_srv_room(), GNUNET_MESSENGER_Service::dir, get_srv_room_member_store(), get_srv_room_message_store(), get_srv_room_operation_store(), get_srv_room_peer_store(), GNUNET_assert, GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_YES, handle_room_messages(), GNUNET_MESSENGER_SrvRoom::idle, iterate_destroy_tunnels(), GNUNET_MESSENGER_SrvRoom::peer_message, remove_srv_room(), GNUNET_MESSENGER_SrvTunnel::room, save_srv_room(), GNUNET_MESSENGER_SrvRoom::service, GNUNET_MESSENGER_SrvRoom::state, and GNUNET_MESSENGER_SrvRoom::tunnels.
Referenced by close_service_room(), entry_service_room(), iterate_destroy_rooms(), and open_service_room().
struct GNUNET_MESSENGER_PeerStore * get_srv_room_peer_store | ( | struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Returns the used peer store of a given room.
[in,out] | room | Room |
Definition at line 152 of file gnunet-service-messenger_room.c.
References GNUNET_assert, and GNUNET_MESSENGER_SrvRoom::peer_store.
Referenced by callback_found_message(), callback_room_handle_message(), create_srv_room(), destroy_srv_room(), handle_message_miss(), handle_message_peer(), handle_room_messages(), load_srv_room(), and save_srv_room().
struct GNUNET_MESSENGER_MemberStore * get_srv_room_member_store | ( | struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Returns the used member store of a given room.
[in,out] | room | Room |
Definition at line 161 of file gnunet-service-messenger_room.c.
References GNUNET_assert, GNUNET_MESSENGER_SrvRoom::member_store, and GNUNET_MESSENGER_MemberStore::room.
Referenced by callback_found_message(), callback_room_handle_message(), cleanup_srv_room_discourse_messages(), create_srv_room(), destroy_srv_room(), get_handle_member_session(), handle_get_message(), handle_room_messages(), initialize_service_handle(), join_room_locally(), load_srv_room(), notify_srv_handle_message(), open_srv_room(), recv_message_info(), recv_message_request(), save_srv_room(), send_message_join(), and solve_srv_room_member_collisions().
struct GNUNET_MESSENGER_MessageStore * get_srv_room_message_store | ( | struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Returns the used message store of a given room.
[in,out] | room | Room |
Definition at line 170 of file gnunet-service-messenger_room.c.
References GNUNET_assert, and GNUNET_MESSENGER_SrvRoom::message_store.
Referenced by callback_operation(), check_member_session_completion(), check_srv_room_peer_status(), cleanup_srv_room_discourse_messages(), create_srv_room(), delete_srv_room_message(), destroy_srv_room(), forward_about_members(), handle_room_messages(), load_srv_room(), notify_about_members(), recv_message_info(), request_room_message_step(), save_srv_room(), update_room_message(), update_tunnel_last_message(), and verify_tunnel_message().
struct GNUNET_MESSENGER_OperationStore * get_srv_room_operation_store | ( | struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Returns the used operation store of a given room.
[in,out] | room | Room |
Definition at line 179 of file gnunet-service-messenger_room.c.
References GNUNET_assert, GNUNET_MESSENGER_SrvRoom::operation_store, and GNUNET_MESSENGER_OperationStore::room.
Referenced by callback_found_message(), create_srv_room(), delete_srv_room_message(), destroy_srv_room(), idle_request_room_messages(), load_srv_room(), save_srv_room(), send_message_request(), update_room_message(), and update_tunnel_last_message().
enum GNUNET_GenericReturnValue open_srv_room | ( | struct GNUNET_MESSENGER_SrvRoom * | room, |
struct GNUNET_MESSENGER_SrvHandle * | handle | ||
) |
Tries to open a room for a given handle.
If the room has already been opened, the handle will locally join the room.
Calling this method should result in joining a room and sending a peer message as well for this peer.
If the function returns GNUNET_YES the port for this room is guaranteed to be open for incoming connections.
[in,out] | room | Room |
[in,out] | handle | Handle |
Definition at line 306 of file gnunet-service-messenger_room.c.
References add_store_member(), cadet, callback_room_connect(), callback_tunnel_disconnect(), close_srv_room(), convert_messenger_key_to_port(), create_message_peer(), get_srv_handle_member_id(), get_srv_room_cadet(), get_srv_room_key(), get_srv_room_member_store(), GNUNET_assert, GNUNET_CADET_open_port(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_CADET_CLI, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_NO, GNUNET_YES, handle, handlers, GNUNET_MESSENGER_SrvRoom::host, join_room(), join_room_locally(), key, port, GNUNET_MESSENGER_SrvRoom::port, send_srv_room_message(), and GNUNET_MESSENGER_SrvRoom::service.
Referenced by open_service_room(), and recv_message_miss().
enum GNUNET_GenericReturnValue enter_srv_room_at | ( | struct GNUNET_MESSENGER_SrvRoom * | room, |
struct GNUNET_MESSENGER_SrvHandle * | handle, | ||
const struct GNUNET_PeerIdentity * | door | ||
) |
Connects a tunnel to a hosting peer of a room through a so called door which is represented by a peer identity of a hosting peer.
During the connection the handle will join the room as a member, waiting for an info message from the selected host.
[in,out] | room | Room |
[in,out] | handle | Handle |
[in] | door | Peer identity |
Definition at line 420 of file gnunet-service-messenger_room.c.
References connect_tunnel(), create_tunnel(), destroy_tunnel(), get_service_peer_identity(), GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multipeermap_get(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_CONTAINER_multipeermap_remove(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_memcmp, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, handle, join_room_locally(), GNUNET_MESSENGER_SrvTunnel::peer, GNUNET_MESSENGER_SrvTunnel::room, GNUNET_MESSENGER_SrvRoom::service, and GNUNET_MESSENGER_SrvRoom::tunnels.
Referenced by callback_tunnel_disconnect(), and entry_service_room().
struct GNUNET_MQ_Envelope * pack_srv_room_message | ( | const struct GNUNET_MESSENGER_SrvRoom * | room, |
const struct GNUNET_MESSENGER_SrvHandle * | handle, | ||
struct GNUNET_MESSENGER_Message * | message, | ||
struct GNUNET_HashCode * | hash, | ||
enum GNUNET_MESSENGER_PackMode | mode | ||
) |
Packs a message depending on the selected mode into a newly allocated envelope.
It will set the timestamp of the message, the sender id and the previous messages hash automatically before packing. The message will be signed by the handles private key.
If the optional hash parameter is a valid pointer, its value will be overridden by the signed messages hash.
If mode is set to GNUNET_MESSENGER_PACK_MODE_ENVELOPE, the function returns a valid envelope to send through a message queue, otherwise NULL.
[in] | room | Room |
[in] | handle | Handle |
[in,out] | message | Message |
[out] | hash | Hash of message |
[in] | mode | Packing mode |
Definition at line 483 of file gnunet-service-messenger_room.c.
References convert_peer_identity_to_id(), get_message_state_chain_hash(), get_service_peer_identity(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_OK, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_sh2s(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_hton(), GNUNET_YES, handle, GNUNET_MESSENGER_Message::header, is_peer_message(), mode, pack_message(), GNUNET_MESSENGER_MessageHeader::previous, GNUNET_MESSENGER_MessageHeader::sender_id, sign_srv_room_message_by_peer(), GNUNET_MESSENGER_MessageHeader::signature, GNUNET_MESSENGER_SrvRoom::state, GNUNET_MESSENGER_MessageHeader::timestamp, and GNUNET_CRYPTO_Signature::type.
Referenced by iterate_send_room_message(), send_srv_room_message(), and send_tunnel_message().
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.
The hash parameter will be updated with the hash-value resulting from the sent message.
The function handles packing the message automatically and will call linked message-events locally even if the message won't be sent to another peer.
The function returns GNUNET_YES on success, GNUNET_NO if message is null and GNUNET_SYSERR if the message was known already.
[in,out] | room | Room |
[in,out] | handle | Handle |
[in,out] | message | Message |
Definition at line 580 of file gnunet-service-messenger_room.c.
References callback_room_handle_message(), GNUNET_MESSENGER_ClosureSendRoom::exclude, GNUNET_assert, GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_h2s(), GNUNET_log, GNUNET_MESSENGER_KIND_ID, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_KEY, GNUNET_MESSENGER_KIND_PEER, GNUNET_MESSENGER_KIND_REQUEST, GNUNET_MESSENGER_name_of_kind(), GNUNET_MESSENGER_PACK_MODE_UNKNOWN, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, handle, GNUNET_MESSENGER_ClosureSendRoom::handle, GNUNET_MESSENGER_ClosureSendRoom::hash, GNUNET_MESSENGER_Message::header, iterate_send_room_message(), GNUNET_MESSENGER_SrvRoom::key, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_ClosureSendRoom::message, pack_srv_room_message(), GNUNET_MESSENGER_ClosureSendRoom::packed, GNUNET_MESSENGER_ClosureSendRoom::room, send_message_id(), send_message_join(), send_message_key(), send_message_peer(), send_message_request(), GNUNET_MESSENGER_SrvRoom::tunnels, and update_room_message().
Referenced by callback_operation(), callback_tunnel_disconnect(), close_service_room(), close_srv_room(), merge_srv_room_last_messages(), open_srv_room(), send_message_peer(), and send_srv_handle_message().
void forward_srv_room_message | ( | struct GNUNET_MESSENGER_SrvRoom * | room, |
struct GNUNET_MESSENGER_SrvTunnel * | tunnel, | ||
struct GNUNET_MESSENGER_Message * | message, | ||
const struct GNUNET_HashCode * | hash | ||
) |
Forwards a message with a given hash to a specific tunnel inside of a room.
[in,out] | room | Room |
[in,out] | tunnel | Tunnel |
[in,out] | message | Message |
[in] | hash | Hash of message |
Definition at line 652 of file gnunet-service-messenger_room.c.
References GNUNET_MESSENGER_ClosureSendRoom::exclude, GNUNET_assert, GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_memcpy, GNUNET_YES, GNUNET_MESSENGER_ClosureSendRoom::handle, GNUNET_MESSENGER_ClosureSendRoom::hash, iterate_send_room_message(), GNUNET_MESSENGER_ClosureSendRoom::message, GNUNET_MESSENGER_ClosureSendRoom::packed, GNUNET_MESSENGER_ClosureSendRoom::room, and GNUNET_MESSENGER_SrvRoom::tunnels.
Referenced by handle_tunnel_message().
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 selected tunnel or to all connected tunnels if necessary or if the selected tunnel is NULL.
[in,out] | room | Room |
[in,out] | tunnel | Tunnel |
Definition at line 680 of file gnunet-service-messenger_room.c.
References forward_tunnel_message(), get_srv_room_message_store(), get_store_message(), GNUNET_free, and GNUNET_MESSENGER_SrvRoom::peer_message.
Referenced by recv_message_info(), and send_message_join().
void merge_srv_room_last_messages | ( | struct GNUNET_MESSENGER_SrvRoom * | room, |
struct GNUNET_MESSENGER_SrvHandle * | handle | ||
) |
Reduces all current forks inside of the message history of a room to one remaining last message by merging them down.
All merge messages will be sent from a given handle.
[in,out] | room | Room |
[in,out] | handle | Handle |
Definition at line 705 of file gnunet-service-messenger_room.c.
References create_message_merge(), get_message_state_merge_hash(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_h2s(), GNUNET_log, handle, GNUNET_MESSENGER_SrvRoom::key, send_srv_room_message(), and GNUNET_MESSENGER_SrvRoom::state.
Referenced by sync_srv_handle_messages().
enum GNUNET_GenericReturnValue delete_srv_room_message | ( | struct GNUNET_MESSENGER_SrvRoom * | room, |
struct GNUNET_MESSENGER_MemberSession * | session, | ||
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_TIME_Relative | delay | ||
) |
Deletes a message from the room with a given hash in a specific delay if the provided member by its session is permitted to do so.
[in,out] | room | Room |
[in,out] | session | Member session |
[in] | hash | Hash of message |
[in] | delay | Delay of deletion |
Definition at line 744 of file gnunet-service-messenger_room.c.
References check_member_session_history(), get_member_session_id(), get_srv_room_message_store(), get_srv_room_operation_store(), get_store_message(), GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_log, GNUNET_memcmp, GNUNET_MESSENGER_OP_DELETE, GNUNET_NO, GNUNET_OK, GNUNET_sh2s(), GNUNET_SYSERR, GNUNET_TIME_relative_get_forever_(), GNUNET_YES, GNUNET_MESSENGER_OperationStore::room, and use_store_operation().
Referenced by handle_message_delete().
struct GNUNET_CADET_Handle * get_srv_room_cadet | ( | struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Returns the CADET handle from a rooms service.
[in,out] | room | Room |
Definition at line 802 of file gnunet-service-messenger_room.c.
References GNUNET_MESSENGER_Service::cadet, GNUNET_assert, and GNUNET_MESSENGER_SrvRoom::service.
Referenced by connect_tunnel(), and open_srv_room().
const struct GNUNET_HashCode * get_srv_room_key | ( | const struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Returns the shared secret you need to access a room.
[in] | room | Room |
Definition at line 811 of file gnunet-service-messenger_room.c.
References GNUNET_assert, and GNUNET_MESSENGER_SrvRoom::key.
Referenced by callback_room_connect(), callback_tunnel_disconnect(), clear_member_store(), clear_operation_store(), connect_tunnel(), find_member_session_in_room(), get_member_store_key(), get_room_data_subdir(), handle_message_join(), handle_message_leave(), handle_room_messages(), join_room(), join_room_locally(), notify_srv_handle_member_id(), notify_srv_handle_message(), open_srv_room(), remove_room_member_session(), send_message_id(), solve_srv_room_member_collisions(), and update_room_message().
const struct GNUNET_MESSENGER_SrvTunnel * get_srv_room_tunnel | ( | const struct GNUNET_MESSENGER_SrvRoom * | room, |
const struct GNUNET_PeerIdentity * | peer | ||
) |
Returns a tunnel inside of a room leading towards a given peer if such a tunnel exists, otherwise NULL.
[in] | room | Room |
[in] | peer | Peer identity |
Definition at line 820 of file gnunet-service-messenger_room.c.
References GNUNET_assert, GNUNET_CONTAINER_multipeermap_get(), GNUNET_MESSENGER_SrvTunnel::peer, GNUNET_MESSENGER_SrvTunnel::room, and GNUNET_MESSENGER_SrvRoom::tunnels.
enum GNUNET_GenericReturnValue request_srv_room_message | ( | struct GNUNET_MESSENGER_SrvRoom * | room, |
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_MESSENGER_MemberSession * | session, | ||
GNUNET_MESSENGER_MessageRequestCallback | callback, | ||
void * | cls | ||
) |
Requests a message from a room identified by a given hash.
If the message is found, the selected callback will be called with it and the provided closure. If no matching message is found but it wasn't deleted the selected callback will be called with #NULL as message instead. In case of deletion the next available previous message will be used to call the callback.
It is also possible that the given callback will not be called if the requesting session is not permitted!
[in,out] | room | Room |
[in] | hash | Hash of message |
[in] | callback | Callback to process result |
[in] | cls | Closure for the callback |
Definition at line 889 of file gnunet-service-messenger_room.c.
References GNUNET_assert, GNUNET_NO, request_room_message_step(), and result.
Referenced by handle_get_message(), and recv_message_request().
void solve_srv_room_member_collisions | ( | struct GNUNET_MESSENGER_SrvRoom * | room, |
const struct GNUNET_CRYPTO_PublicKey * | public_key, | ||
const struct GNUNET_ShortHashCode * | member_id, | ||
struct GNUNET_TIME_Absolute | timestamp | ||
) |
Checks for potential collisions with member ids and solves them changing active handles ids if they use an already used member id (comparing public key and timestamp).
[in,out] | room | Room |
[in] | public_key | Public key |
[in] | member_id | Member ID |
[in] | timestamp | Timestamp |
Definition at line 943 of file gnunet-service-messenger_room.c.
References generate_free_member_id(), get_member_session(), get_member_session_start(), get_srv_handle_key(), get_srv_handle_member_id(), get_srv_room_key(), get_srv_room_member_store(), get_store_member(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_size(), GNUNET_memcmp, GNUNET_NO, GNUNET_TIME_absolute_get_difference(), GNUNET_TIME_relative_get_zero_(), GNUNET_MESSENGER_ListHandle::handle, GNUNET_MESSENGER_Service::handles, GNUNET_MESSENGER_ListHandles::head, GNUNET_MESSENGER_MemberSession::member, GNUNET_MESSENGER_MemberStore::members, GNUNET_MESSENGER_ListHandle::next, notify_srv_handle_member_id(), pubkey, GNUNET_MESSENGER_MemberSession::public_key, GNUNET_MESSENGER_SrvRoom::service, GNUNET_MESSENGER_Member::sessions, start, and timestamp().
Referenced by handle_message_id(), and handle_message_join().
void rebuild_srv_room_basement_structure | ( | struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Rebuilds the decentralized structure for a room by ensuring all required connections are made depending on the amount of peers and this peers index in the list of them.
[in,out] | room | Room |
Definition at line 1004 of file gnunet-service-messenger_room.c.
References GNUNET_MESSENGER_SrvRoom::basement, close_srv_room(), connect_tunnel(), count_of_tunnels(), disconnect_tunnel(), find_list_tunnels(), get_service_peer_identity(), GNUNET_assert, GNUNET_CONTAINER_multipeermap_get(), GNUNET_MESSENGER_FLAG_CONNECTION_AUTO, GNUNET_NO, GNUNET_OK, GNUNET_PEER_resolve(), GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_SrvRoom::host, is_srv_handle_routing(), GNUNET_MESSENGER_SrvRoom::key, GNUNET_MESSENGER_Service::min_routers, GNUNET_MESSENGER_ListTunnel::next, GNUNET_MESSENGER_SrvTunnel::peer, GNUNET_MESSENGER_ListTunnel::peer, remove_from_list_tunnels(), required_connection_between(), GNUNET_MESSENGER_SrvTunnel::room, GNUNET_MESSENGER_SrvRoom::service, GNUNET_MESSENGER_SrvRoom::tunnels, and verify_list_tunnels_flag_token().
Referenced by handle_message_miss(), and handle_message_peer().
uint32_t get_srv_room_amount_of_tunnels | ( | const struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Returns the amount of active tunnels of a given room.
[in] | room | Room |
Definition at line 1067 of file gnunet-service-messenger_room.c.
References GNUNET_assert, GNUNET_CONTAINER_multipeermap_size(), GNUNET_MESSENGER_SrvTunnel::room, and GNUNET_MESSENGER_SrvRoom::tunnels.
Referenced by create_message_connection().
uint32_t get_srv_room_connection_flags | ( | const struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Returns connection flags about connection information of a given room and the service managing it.
[in] | room | Room |
Definition at line 1076 of file gnunet-service-messenger_room.c.
References GNUNET_MESSENGER_Service::auto_routing, GNUNET_assert, GNUNET_MESSENGER_FLAG_CONNECTION_AUTO, GNUNET_MESSENGER_FLAG_CONNECTION_NONE, GNUNET_YES, GNUNET_MESSENGER_SrvTunnel::room, and GNUNET_MESSENGER_SrvRoom::service.
Referenced by create_message_connection().
void cleanup_srv_room_discourse_messages | ( | struct GNUNET_MESSENGER_SrvRoom * | room, |
const struct GNUNET_ShortHashCode * | discourse | ||
) |
Cleanup discourse messages outside of current subscriptions from a specific discourse of all the members in a given room.
[in,out] | room | Room |
[in] | discourse | Hash of discourse |
Definition at line 1250 of file gnunet-service-messenger_room.c.
References cleanup_store_discourse_messages_before(), GNUNET_MESSENGER_MemberSubscriptionIteration::discourse, get_srv_room_member_store(), get_srv_room_message_store(), GNUNET_assert, GNUNET_TIME_absolute_get_forever_(), iterate_member_for_subscription(), iterate_store_members(), and GNUNET_MESSENGER_MemberSubscriptionIteration::start.
Referenced by handle_message_subscribe(), and task_subscription_exit().
void load_srv_room | ( | struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Loads the local configuration for a given room of a service which contains the last messages hash and the ruleset for general access of new members.
[out] | room | Room |
Definition at line 1450 of file gnunet-service-messenger_room.c.
References GNUNET_MESSENGER_SrvRoom::basement, get_room_data_subdir(), get_srv_room_member_store(), get_srv_room_message_store(), get_srv_room_operation_store(), get_srv_room_peer_store(), GNUNET_asprintf(), GNUNET_assert, GNUNET_DISK_directory_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_YES, load_list_tunnels(), load_member_store(), load_message_state(), load_message_store(), load_operation_store(), load_peer_store(), and GNUNET_MESSENGER_SrvRoom::state.
Referenced by create_srv_room().
void save_srv_room | ( | struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Saves the configuration for a given room of a service which contains the last messages hash and the ruleset for general access of new members locally.
[in] | room | Room |
Definition at line 1489 of file gnunet-service-messenger_room.c.
References GNUNET_MESSENGER_SrvRoom::basement, get_room_data_subdir(), get_srv_room_member_store(), get_srv_room_message_store(), get_srv_room_operation_store(), get_srv_room_peer_store(), GNUNET_asprintf(), GNUNET_assert, GNUNET_DISK_directory_create(), GNUNET_DISK_directory_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_YES, save_list_tunnels(), save_member_store(), save_message_state(), save_message_store(), save_operation_store(), save_peer_store(), and GNUNET_MESSENGER_SrvRoom::state.
Referenced by destroy_srv_room().
void remove_srv_room | ( | struct GNUNET_MESSENGER_SrvRoom * | room | ) |
Removes the configuration for a given room of a service.
[in] | room | Room |
Definition at line 1529 of file gnunet-service-messenger_room.c.
References get_room_data_subdir(), GNUNET_assert, GNUNET_DISK_directory_remove(), GNUNET_DISK_directory_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, and GNUNET_YES.
Referenced by destroy_srv_room().