GNUnet  0.11.x
gnunet-service-messenger_room.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2020--2021 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
26 #ifndef GNUNET_SERVICE_MESSENGER_ROOM_H
27 #define GNUNET_SERVICE_MESSENGER_ROOM_H
28 
29 #include "platform.h"
30 #include "gnunet_cadet_service.h"
31 #include "gnunet_container_lib.h"
32 #include "gnunet_crypto_lib.h"
34 #include "gnunet_mq_lib.h"
35 
40 
42 
46 #include "messenger_api_ego.h"
47 
48 #define GNUNET_MESSENGER_IDLE_DELAY GNUNET_TIME_relative_multiply \
49  (GNUNET_TIME_relative_get_second_ (), 5)
50 
51 #define GNUNET_MESSENGER_REQUEST_DELAY GNUNET_TIME_relative_multiply \
52  (GNUNET_TIME_relative_get_minute_ (), 5)
53 
54 #define GNUNET_MESSENGER_MERGE_DELAY GNUNET_TIME_relative_multiply \
55  (GNUNET_TIME_relative_get_second_ (), 30)
56 
59 
61 {
65 
67 
69 
73 
76 
78 
81 };
82 
92 
98 void
100 
109 
118 
127 
134 const struct GNUNET_ShortHashCode*
135 get_room_host_id (const struct GNUNET_MESSENGER_SrvRoom *room);
136 
143 void
144 change_room_host_id (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *unique_id);
145 
158 int
160 
171 int
173  const struct GNUNET_PeerIdentity *door);
174 
192 struct GNUNET_MQ_Envelope*
194  struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode);
195 
211 int
213  struct GNUNET_MESSENGER_Message *message);
214 
223 void
225  struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
226 
235 void
237 
245 void
247 
258 int
260  const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay);
261 
268 struct GNUNET_CADET_Handle*
270 
277 const struct GNUNET_HashCode*
278 get_room_key (const struct GNUNET_MESSENGER_SrvRoom *room);
279 
288 const struct GNUNET_MESSENGER_SrvTunnel*
290 
308 const struct GNUNET_MESSENGER_Message*
310  const struct GNUNET_HashCode *hash, int request);
311 
318 void
320 
327 void
328 load_room (struct GNUNET_MESSENGER_SrvRoom *room);
329 
336 void
337 save_room (struct GNUNET_MESSENGER_SrvRoom *room);
338 
339 #endif //GNUNET_SERVICE_MESSENGER_ROOM_H
struct GNUNET_MESSENGER_MemberStore member_store
GNUnet MESSENGER service.
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
Definition: gnunet-vpn.c:41
void check_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_MessageStore message_store
Opaque handle to the service.
Definition: cadet_api.c:38
void load_room(struct GNUNET_MESSENGER_SrvRoom *room)
Loads the local configuration for a given room of a service which contains the last messages hash and...
void forward_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.
void rebuild_room_basement_structure(struct GNUNET_MESSENGER_SrvRoom *room)
Rebuilds the decentralized structure for a room by ensuring all required connections are made dependi...
GNUnet MESSENGER service.
struct GNUNET_CADET_Port * port
const struct GNUNET_MESSENGER_SrvTunnel * get_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.
static enum @8 mode
Should we do a PUT (mode = 0) or GET (mode = 1);.
struct GNUNET_MESSENGER_SrvRoom * create_room(struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
Creates and allocates a new room for a handle with a given key.
const struct GNUNET_ShortHashCode * get_room_host_id(const struct GNUNET_MESSENGER_SrvRoom *room)
Returns the member id of the member representing the handle currently hosting this room...
A 256-bit hashcode.
struct GNUNET_MESSENGER_OperationStore operation_store
struct GNUNET_CADET_Handle * get_room_cadet(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the CADET handle from a rooms service.
cryptographic primitives for GNUnet
int send_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.
struct GNUNET_SCHEDULER_Task * idle
struct GNUNET_MESSENGER_ListMessages last_messages
struct GNUNET_MESSENGER_Service * service
GNUnet MESSENGER service.
struct GNUNET_HashCode * peer_message
void save_room(struct GNUNET_MESSENGER_SrvRoom *room)
Saves the configuration for a given room of a service which contains the last messages hash and the r...
struct GNUNET_MESSENGER_MessageStore * get_room_message_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used message store of a given room.
struct GNUNET_MESSENGER_SrvRoom * room
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
struct GNUNET_MESSENGER_OperationStore * get_room_operation_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used operation store of a given room.
Internal representation of the hash map.
struct GNUNET_MESSENGER_ListMessages handling
A 512-bit hashcode.
struct GNUNET_MESSENGER_MemberStore * get_room_member_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used member store of a given room.
GNUnet MESSENGER service.
int delete_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 s...
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_MESSENGER_SrvHandle * host
struct GNUNET_MQ_Envelope * pack_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.
const struct GNUNET_MESSENGER_Message * get_room_message(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *hash, int request)
Returns a message from a room identified by a given hash.
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
void merge_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 me...
void change_room_host_id(struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *unique_id)
Changes the member id of the member representing the handle currently hosting this room...
The identity of the host (wraps the signing key of the peer).
void destroy_room(struct GNUNET_MESSENGER_SrvRoom *room)
Destroys a room and frees its memory fully.
messenger api: client and service implementation of GNUnet MESSENGER service
struct GNUNET_MESSENGER_ListTunnels basement
Entry in list of pending tasks.
Definition: scheduler.c:134
Opaque handle to a port.
Definition: cadet_api.c:79
int enter_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...
int open_room(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle)
Tries to open a room for a given handle.
const struct GNUNET_HashCode * get_room_key(const struct GNUNET_MESSENGER_SrvRoom *room)
Returns the shared secret you need to access a room.
struct GNUNET_CONTAINER_MultiPeerMap * tunnels
Time for relative time used by GNUnet, in microseconds.