GNUnet 0.27.0
 
Loading...
Searching...
No Matches
gnunet-service-messenger_room.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2026 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
30#include "gnunet_common.h"
31#include "gnunet_util_lib.h"
32
34#include "gnunet_pils_service.h"
35
43
46
47#define GNUNET_MESSENGER_IDLE_DELAY GNUNET_TIME_relative_multiply \
48 (GNUNET_TIME_relative_get_second_ (), 5)
49
50#define GNUNET_MESSENGER_REQUEST_DELAY GNUNET_TIME_relative_multiply \
51 (GNUNET_TIME_relative_get_minute_ (), 5)
52
53#define GNUNET_MESSENGER_MERGE_DELAY GNUNET_TIME_relative_multiply \
54 (GNUNET_TIME_relative_get_second_ (), 30)
55
59
60typedef void (*GNUNET_MESSENGER_SignedCallback)(void *cls,
62 *room,
64 *message,
65 struct GNUNET_MQ_Envelope *
66 envelope,
67 const struct GNUNET_HashCode *
68 hash);
69
83
109
119 const struct GNUNET_HashCode *key);
120
130void
132 enum GNUNET_GenericReturnValue deletion);
133
142
151
160
169
185
199 const struct GNUNET_PeerIdentity *door);
200
217 struct GNUNET_MESSENGER_Message *message,
219 void *closure);
220
239 struct GNUNET_MESSENGER_Message *message);
240
252void
254 struct GNUNET_MESSENGER_SrvTunnel *tunnel,
255 struct GNUNET_MQ_Envelope *envelope,
256 const struct GNUNET_HashCode *hash);
257
266void
268 struct GNUNET_MESSENGER_SrvTunnel *tunnel);
269
285
298 struct GNUNET_MESSENGER_SrvMemberSession *session,
299 const struct GNUNET_HashCode *hash,
300 const struct GNUNET_TIME_Relative delay);
301
310
317const struct GNUNET_HashCode*
318get_srv_room_key (const struct GNUNET_MESSENGER_SrvRoom *room);
319
328const struct GNUNET_MESSENGER_SrvTunnel*
330 const struct GNUNET_PeerIdentity *peer);
331
341 void *cls,
342 struct GNUNET_MESSENGER_SrvRoom *room,
343 const struct GNUNET_MESSENGER_Message *message,
344 const struct GNUNET_HashCode *hash);
345
363 const struct GNUNET_HashCode *hash,
365 session,
367 void *cls);
368
378void
380 const struct
382 const struct GNUNET_ShortHashCode *member_id,
384
391void
393
400uint32_t
402
409uint32_t
411
419void
421 const struct GNUNET_ShortHashCode *
422 discourse);
423
430void
432
439void
441
447void
449
450#endif // GNUNET_SERVICE_MESSENGER_ROOM_H
static uint64_t timestamp(void)
Get current timestamp.
struct GNUNET_HashCode key
The key used in the DHT.
uint32_t get_srv_room_amount_of_tunnels(const struct GNUNET_MESSENGER_SrvRoom *room)
Returns the amount of active tunnels of a given room.
enum GNUNET_GenericReturnValue sign_srv_room_message(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_Message *message, GNUNET_MESSENGER_SignedCallback callback, void *closure)
Packs a message depending on its kind into a newly allocated envelope.
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,...
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.
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 r...
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 dependi...
struct GNUNET_MESSENGER_MessageStore * get_srv_room_message_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used message store of a given room.
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...
struct GNUNET_MESSENGER_PeerStore * get_srv_room_peer_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used peer store of a given room.
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...
enum GNUNET_GenericReturnValue delete_srv_room_message(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvMemberSession *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...
void remove_srv_room(struct GNUNET_MESSENGER_SrvRoom *room)
Removes the configuration for a given room of a service.
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.
void destroy_srv_room(struct GNUNET_MESSENGER_SrvRoom *room, enum GNUNET_GenericReturnValue deletion)
Destroys a room and frees its memory fully.
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 memb...
void send_srv_room_envelope(struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *envelope, const struct GNUNET_HashCode *hash)
Sends an envelope from a message with a given hash excluding a specific tunnel inside of a room.
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.
enum GNUNET_GenericReturnValue 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 me...
enum GNUNET_GenericReturnValue request_srv_room_message(struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_SrvMemberSession *session, GNUNET_MESSENGER_MessageRequestCallback callback, void *cls)
Requests a message from a room identified by a given hash.
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.
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.
void solve_srv_room_member_collisions(struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_CRYPTO_BlindablePublicKey *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 u...
struct GNUNET_MESSENGER_OperationStore * get_srv_room_operation_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used operation store of a given room.
struct GNUNET_CADET_Handle * get_srv_room_cadet(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the CADET handle from a rooms service.
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_MemberStore * get_srv_room_member_store(struct GNUNET_MESSENGER_SrvRoom *room)
Returns the used member store of a given room.
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...
void(* GNUNET_MESSENGER_SignedCallback)(void *cls, struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_Message *message, struct GNUNET_MQ_Envelope *envelope, const struct GNUNET_HashCode *hash)
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition gnunet-vpn.c:35
CADET service; establish channels to distant peers.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
GNUNET_GenericReturnValue
Named constants for return values.
Opaque handle to the service.
Definition cadet_api.c:39
Opaque handle to a port.
Definition cadet_api.c:80
Internal representation of the hash map.
Internal representation of the hash map.
An identity key as per LSD0001.
A 512-bit hashcode.
struct GNUNET_MESSENGER_SrvRoom * room
struct GNUNET_MESSENGER_Message * message
struct GNUNET_MESSENGER_PeerStore peer_store
struct GNUNET_CONTAINER_MultiPeerMap * tunnels
struct GNUNET_MESSENGER_MemberStore member_store
struct GNUNET_MESSENGER_Service * service
struct GNUNET_MESSENGER_SrvHandle * sync
struct GNUNET_MESSENGER_ListTunnels basement
struct GNUNET_SCHEDULER_Task * idle
struct GNUNET_MESSENGER_MessageStore message_store
struct GNUNET_MESSENGER_MessageState state
struct GNUNET_MESSENGER_ListMessages handling
struct GNUNET_MESSENGER_OperationStore operation_store
struct GNUNET_MESSENGER_SrvHandle * host
struct GNUNET_CONTAINER_MultiHashMap * signatures
struct GNUNET_MESSENGER_SrvRoom * room
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Definition scheduler.c:141
A 256-bit hashcode.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.