GNUnet MESSENGER service. More...
#include "platform.h"
#include "gnunet_cadet_service.h"
#include "gnunet_util_lib.h"
#include "gnunet_identity_service.h"
#include "gnunet_messenger_service.h"
#include "gnunet-service-messenger_basement.h"
#include "gnunet-service-messenger_handle.h"
#include "gnunet-service-messenger_message_state.h"
#include "gnunet-service-messenger_list_messages.h"
#include "messenger_api_list_tunnels.h"
#include "gnunet-service-messenger_member_store.h"
#include "gnunet-service-messenger_message_store.h"
#include "gnunet-service-messenger_operation_store.h"
#include "messenger_api_ego.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, int deletion) |
Destroys a room and frees its memory fully. 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... | |
int | open_srv_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) |
Tries to open a room for a given handle. More... | |
int | 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, int mode) |
Packs a message depending on the selected mode into a newly allocated envelope. More... | |
int | 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... | |
int | 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... | |
int | 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_IDENTITY_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... | |
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... | |
GNUnet MESSENGER service.
Definition in file gnunet-service-messenger_room.h.
#define GNUNET_MESSENGER_IDLE_DELAY |
Definition at line 47 of file gnunet-service-messenger_room.h.
#define GNUNET_MESSENGER_REQUEST_DELAY |
Definition at line 50 of file gnunet-service-messenger_room.h.
#define GNUNET_MESSENGER_MERGE_DELAY |
Definition at line 53 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 299 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 47 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(), 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(), 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, |
int | 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 96 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(), GNUNET_MESSENGER_Service::dir, get_srv_room_member_store(), get_srv_room_message_store(), get_srv_room_operation_store(), GNUNET_assert, GNUNET_CADET_close_port(), 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, GNUNET_MESSENGER_SrvRoom::port, 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_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 137 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(), check_srv_room_peer_status(), create_srv_room(), destroy_srv_room(), get_handle_member_session(), handle_get_message(), handle_room_messages(), join_room_locally(), load_srv_room(), open_srv_room(), recv_message_info(), recv_message_request(), save_srv_room(), 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 145 of file gnunet-service-messenger_room.c.
References GNUNET_assert, and GNUNET_MESSENGER_SrvRoom::message_store.
Referenced by callback_room_deletion(), callback_verify_room_message(), check_member_session_completion(), check_srv_room_peer_status(), create_srv_room(), delete_srv_room_message(), destroy_srv_room(), forward_about_members(), handle_room_messages(), load_srv_room(), notify_about_members(), request_room_message_step(), save_srv_room(), update_room_message(), and update_tunnel_last_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 153 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().
int 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 340 of file gnunet-service-messenger_room.c.
References add_store_member(), cadet, callback_room_connect(), callback_tunnel_disconnect(), 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_close_port(), GNUNET_CADET_open_port(), GNUNET_ERROR_TYPE_INFO, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_CADET_CLI, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_NO, handle, handlers, GNUNET_MESSENGER_Message::header, join_room(), join_room_locally(), key, port, GNUNET_MESSENGER_SrvRoom::port, GNUNET_MESSENGER_MemberStore::room, GNUNET_MESSENGER_MemberNotify::room, send_srv_room_message(), GNUNET_MESSENGER_MessageHeader::sender_id, and GNUNET_MESSENGER_SrvRoom::service.
Referenced by open_service_room().
int 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 388 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(), peer, GNUNET_MESSENGER_SrvTunnel::room, GNUNET_MESSENGER_SrvRoom::service, and GNUNET_MESSENGER_SrvRoom::tunnels.
Referenced by 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, | ||
int | 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 EGO.
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 427 of file gnunet-service-messenger_room.c.
References get_message_state_chain_hash(), get_srv_handle_ego(), get_srv_handle_member_id(), get_srv_room_key(), GNUNET_assert, GNUNET_memcpy, GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_hton(), handle, GNUNET_MESSENGER_Message::header, mode, pack_message(), GNUNET_MESSENGER_MessageHeader::previous, GNUNET_MESSENGER_MessageHeader::sender_id, GNUNET_MESSENGER_SrvRoom::state, and GNUNET_MESSENGER_MessageHeader::timestamp.
Referenced by iterate_send_room_message(), send_srv_room_message(), and send_tunnel_message().
int 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 504 of file gnunet-service-messenger_room.c.
References callback_room_handle_message(), GNUNET_MESSENGER_ClosureSendRoom::exclude, get_srv_handle_member_id(), get_srv_room_key(), GNUNET_assert, GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_MESSENGER_KIND_ID, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_PEER, GNUNET_MESSENGER_KIND_REQUEST, GNUNET_MESSENGER_PACK_MODE_UNKNOWN, GNUNET_NO, GNUNET_sh2s(), GNUNET_SYSERR, GNUNET_YES, handle, GNUNET_MESSENGER_ClosureSendRoom::handle, GNUNET_MESSENGER_ClosureSendRoom::hash, GNUNET_MESSENGER_Message::header, is_message_session_bound(), iterate_send_room_message(), GNUNET_MESSENGER_MessageHeader::kind, merge_srv_room_last_messages(), GNUNET_MESSENGER_ClosureSendRoom::message, pack_srv_room_message(), GNUNET_MESSENGER_ClosureSendRoom::packed, GNUNET_MESSENGER_ClosureSendRoom::room, send_message_id(), send_message_join(), send_message_peer(), send_message_request(), GNUNET_MESSENGER_SrvRoom::tunnels, and update_room_message().
Referenced by callback_found_message(), callback_room_disconnect(), callback_room_merge(), check_srv_room_peer_status(), close_service_room(), join_room(), merge_srv_room_last_messages(), open_srv_room(), send_srv_handle_message(), and solve_srv_room_member_collisions().
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 562 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 588 of file gnunet-service-messenger_room.c.
References create_message_peer(), forward_tunnel_message(), get_member_session_of(), get_srv_room_member_store(), get_srv_room_message_store(), get_store_member_of(), get_store_message(), GNUNET_free, GNUNET_YES, GNUNET_MESSENGER_SrvRoom::host, is_member_session_closed(), GNUNET_MESSENGER_MemberSession::member, GNUNET_MESSENGER_SrvRoom::peer_message, GNUNET_MESSENGER_MemberStore::room, send_srv_room_message(), and GNUNET_MESSENGER_SrvRoom::service.
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 627 of file gnunet-service-messenger_room.c.
References create_message_merge(), get_message_state_merge_hash(), GNUNET_assert, handle, send_srv_room_message(), and GNUNET_MESSENGER_SrvRoom::state.
Referenced by send_srv_room_message().
int 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 669 of file gnunet-service-messenger_room.c.
References check_member_session_history(), delay, 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_INFO, 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 711 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 719 of file gnunet-service-messenger_room.c.
References GNUNET_assert, and GNUNET_MESSENGER_SrvRoom::key.
Referenced by callback_room_connect(), connect_tunnel(), get_member_store_key(), get_room_data_subdir(), handle_message_join(), handle_message_leave(), join_room(), join_room_locally(), notify_srv_handle_message(), open_srv_room(), pack_srv_room_message(), send_message_id(), send_srv_room_message(), 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 727 of file gnunet-service-messenger_room.c.
References GNUNET_assert, GNUNET_CONTAINER_multipeermap_get(), peer, GNUNET_MESSENGER_SrvTunnel::room, and GNUNET_MESSENGER_SrvRoom::tunnels.
int 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 775 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_IDENTITY_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 of EGO |
[in] | member_id | Member ID |
[in] | timestamp | Timestamp |
Definition at line 874 of file gnunet-service-messenger_room.c.
References create_message_id(), generate_free_member_id(), get_member_session(), get_member_session_start(), get_srv_handle_ego(), 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_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, GNUNET_MESSENGER_Ego::pub, GNUNET_MESSENGER_MemberStore::room, send_srv_room_message(), GNUNET_MESSENGER_SrvRoom::service, GNUNET_MESSENGER_Member::sessions, and start.
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 916 of file gnunet-service-messenger_room.c.
References GNUNET_MESSENGER_SrvRoom::basement, connect_tunnel(), count_of_tunnels(), disconnect_tunnel(), find_list_tunnels(), get_service_peer_identity(), GNUNET_assert, GNUNET_CONTAINER_multipeermap_get(), GNUNET_OK, GNUNET_PEER_resolve(), GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::next, GNUNET_MESSENGER_ListTunnel::peer, peer, remove_from_list_tunnels(), required_connection_between(), GNUNET_MESSENGER_SrvTunnel::room, GNUNET_MESSENGER_SrvRoom::service, and GNUNET_MESSENGER_SrvRoom::tunnels.
Referenced by handle_message_miss(), and handle_message_peer().
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 1177 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(), GNUNET_asprintf(), GNUNET_assert, GNUNET_DISK_directory_test(), GNUNET_free, GNUNET_YES, load_list_tunnels(), load_member_store(), load_message_state(), load_message_store(), load_operation_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 1203 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(), GNUNET_asprintf(), GNUNET_assert, GNUNET_DISK_directory_create(), GNUNET_DISK_directory_test(), GNUNET_free, GNUNET_NO, GNUNET_OK, GNUNET_YES, save_list_tunnels(), save_member_store(), save_message_state(), save_message_store(), save_operation_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 1230 of file gnunet-service-messenger_room.c.
References get_room_data_subdir(), GNUNET_assert, GNUNET_DISK_directory_remove(), GNUNET_DISK_directory_test(), GNUNET_free, and GNUNET_YES.
Referenced by destroy_srv_room().