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 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 
37 
42 
45 
47 #include "messenger_api_ego.h"
48 
50 {
53 
55 };
56 
58 {
60 
62 };
63 
65 {
69 
71 
75 
78 
80  struct GNUNET_MESSENGER_ListMessages last_messages;
81 
83 
86 
88 };
89 
99 
105 void
107 
117 get_room_contact (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id);
118 
126 void
127 add_room_contact (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id,
128  const struct GNUNET_IDENTITY_PublicKey *pubkey);
129 
140 
148 struct GNUNET_ShortHashCode*
150 
157 const struct GNUNET_ShortHashCode*
158 get_room_host_id (const struct GNUNET_MESSENGER_SrvRoom *room);
159 
166 void
167 change_room_host_id (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *unique_id);
168 
181 int
183 
194 int
196  const struct GNUNET_PeerIdentity *door);
197 
208 
226 struct GNUNET_MQ_Envelope*
228  struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode);
229 
242 void
244  struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash);
245 
259 void
261  struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash,
262  struct GNUNET_MESSENGER_SrvTunnel *tunnel);
263 
272 void
274  const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
275 
283 void
285 
292 struct GNUNET_CADET_Handle*
294 
301 struct GNUNET_HashCode*
303 
312 const struct GNUNET_MESSENGER_SrvTunnel*
314 
332 const struct GNUNET_MESSENGER_Message*
334  const struct GNUNET_HashCode *hash, int request);
335 
344 void
346  const struct GNUNET_HashCode *hash);
347 
357 void
358 switch_room_member_id (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *old_id,
359  const struct GNUNET_ShortHashCode *new_id, const struct GNUNET_HashCode *hash);
360 
367 void
369 
375 void
377 
378 #endif //GNUNET_SERVICE_MESSENGER_ROOM_H
void send_room_message_ext(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Sends a message from a given handle into a room excluding one specific tunnel.
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
Definition: gnunet-vpn.c:41
Opaque handle to the service.
Definition: cadet_api.c:38
struct GNUNET_MESSENGER_SrvTunnel * find_room_tunnel_to(struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *contact_id)
Returns a tunnel granting a direct connection to a specific member in 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...
void send_room_message(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash)
Sends a message from a given handle into a room.
void handle_room_messages(struct GNUNET_MESSENGER_SrvRoom *room)
Handles all queued up messages of a room to handle in correct order.
GNUnet MESSENGER service.
struct GNUNET_CADET_Port * port
struct GNUNET_CONTAINER_MultiShortmap * member_infos
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.
Internal representation of the hash map.
void switch_room_member_id(struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *old_id, const struct GNUNET_ShortHashCode *new_id, const struct GNUNET_HashCode *hash)
Changes an id of a current member from an old id to a new one and adds optionally the hash of an id m...
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...
struct GNUNET_HashCode * get_room_key(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the shared secret you need to access a room.
A 256-bit hashcode.
int entry_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...
void update_room_last_messages(struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Updates the last messages of a room by replacing them if the previous hash of a given message matches...
struct GNUNET_CADET_Handle * get_room_cadet(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the CADET handle from a rooms service.
const struct GNUNET_MESSENGER_SrvTunnel * get_room_tunnel(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.
void add_room_contact(struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id, const struct GNUNET_IDENTITY_PublicKey *pubkey)
Adds a contact from the service to a room under a specific id with a given public key...
cryptographic primitives for GNUnet
struct GNUNET_MESSENGER_MemberInfo * get_room_member_info(struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id)
Returns the member information of a member in a room identified by a given id.
struct GNUNET_SCHEDULER_Task * idle
struct GNUNET_MESSENGER_Service * service
GNUnet MESSENGER service.
struct GNUNET_HashCode * peer_message
static struct GNUNET_IDENTITY_PublicKey pubkey
Public key of the zone to look in.
struct GNUNET_MESSENGER_SrvRoom * room
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
Internal representation of the hash map.
A 512-bit hashcode.
GNUnet MESSENGER service.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_HashCode key
The key used in the DHT.
Internal representation of the hash map.
struct GNUNET_CONTAINER_MultiShortmap * members
struct GNUNET_MESSENGER_SrvHandle * host
struct GNUNET_MESSENGER_SrvContact * get_room_contact(struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id)
Returns the contact of a member in a room identified by a given id.
GNUnet MESSENGER service.
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.
struct GNUNET_ShortHashCode * generate_room_member_id(const struct GNUNET_MESSENGER_SrvRoom *room)
Tries to generate and allocate a new unique member id checking all current members for possible dupli...
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).
An identity key as per LSD0001.
struct GNUNET_MQ_Envelope * pack_room_message(struct GNUNET_MESSENGER_SrvRoom *room, 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.
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
Entry in list of pending tasks.
Definition: scheduler.c:134
Opaque handle to a port.
Definition: cadet_api.c:79
struct GNUNET_MESSENGER_ListMessages session_messages
int open_room(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle)
Tries to open a room for a given handle.
enum GNUNET_MESSENGER_MemberAccess access
struct GNUNET_ShortHashCode * contact_id
struct GNUNET_CONTAINER_MultiHashMap * requested
void forward_room_message(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, const 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.
struct GNUNET_CONTAINER_MultiPeerMap * tunnels
GNUnet MESSENGER service.