GNUnet 0.21.2
messenger_api_room.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2024 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_MESSENGER_API_ROOM_H
27#define GNUNET_MESSENGER_API_ROOM_H
28
29#include "gnunet_common.h"
30#include "gnunet_time_lib.h"
31#include "gnunet_util_lib.h"
32
34
40
42
44{
48};
49
51{
54
58};
59
61{
64
66
70
72
74
78
80
83
85};
86
87typedef void (*GNUNET_MESSENGER_RoomLinkDeletion) (struct
89 const struct
90 GNUNET_HashCode *hash,
91 const struct
93
103 const struct GNUNET_HashCode *key);
104
110void
112
120is_room_available (const struct GNUNET_MESSENGER_Room *room);
121
130
137const struct GNUNET_ShortHashCode*
138get_room_sender_id (const struct GNUNET_MESSENGER_Room *room);
139
146void
148 const struct GNUNET_ShortHashCode *id);
149
158const struct GNUNET_MESSENGER_Message*
159get_room_message (const struct GNUNET_MESSENGER_Room *room,
160 const struct GNUNET_HashCode *hash);
161
171get_room_sender (const struct GNUNET_MESSENGER_Room *room,
172 const struct GNUNET_HashCode *hash);
173
183get_room_recipient (const struct GNUNET_MESSENGER_Room *room,
184 const struct GNUNET_HashCode *hash);
185
192void
194 const struct GNUNET_HashCode *hash);
195
209void
211 struct GNUNET_MESSENGER_Contact *sender,
212 const struct GNUNET_MESSENGER_Message *message,
213 const struct GNUNET_HashCode *hash,
215
223void
225 const struct GNUNET_HashCode *hash);
226
236int
239 void *cls);
240
250find_room_member (const struct GNUNET_MESSENGER_Room *room,
251 const struct GNUNET_MESSENGER_Contact *contact);
252
262void
264 const struct GNUNET_HashCode *hash,
265 const struct GNUNET_HashCode *other);
266
276void
278 const struct GNUNET_HashCode *hash,
279 const struct GNUNET_TIME_Relative delay,
281
282#endif //GNUNET_MESSENGER_API_ROOM_H
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
Functions related to time.
GNUNET_GenericReturnValue
Named constants for return values.
GNUNET_MESSENGER_MessageFlags
Enum for the different supported flags used by message handling.
enum GNUNET_GenericReturnValue(* GNUNET_MESSENGER_MemberCallback)(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
Method called for each member in a room during iteration.
enum GNUNET_GenericReturnValue find_room_member(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
Checks through all members of a given room if a specific contact is found and returns a result depend...
struct GNUNET_MESSENGER_Contact * get_room_sender(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns a messages sender locally stored from a map for a given hash in a room.
void set_room_sender_id(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_ShortHashCode *id)
Sets the member id of the room's sender to a specific id or NULL.
void handle_room_message(struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags)
Handles a message with a given hash in a room for the client API to update members and its informatio...
void link_room_deletion(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay, GNUNET_MESSENGER_RoomLinkDeletion deletion)
Delete all remaining links to a certain message identified by its hash inside a given room and cause ...
const struct GNUNET_MESSENGER_Message * get_room_message(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns a message locally stored from a map for a given hash in a room.
void update_room_last_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Updates the last message hash of a room for the client API so that new messages can point to the late...
enum GNUNET_GenericReturnValue is_room_available(const struct GNUNET_MESSENGER_Room *room)
Checks whether a room is available to send messages.
void callback_room_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Executes the message callback for a given hash in a room.
struct GNUNET_MESSENGER_Handle * get_room_handle(struct GNUNET_MESSENGER_Room *room)
Returns the messenger handle of the room.
const struct GNUNET_ShortHashCode * get_room_sender_id(const struct GNUNET_MESSENGER_Room *room)
Returns the member id of the room's sender.
void link_room_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_HashCode *other)
Links a message identified by its hash inside a given room with another message identified by its oth...
int iterate_room_members(struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls)
Iterates through all members of a given room to forward each of them to a selected callback with a cu...
void destroy_room(struct GNUNET_MESSENGER_Room *room)
Destroys a room and frees its memory fully from the client API.
void(* GNUNET_MESSENGER_RoomLinkDeletion)(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
struct GNUNET_MESSENGER_Contact * get_room_recipient(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns a messages recipient locally stored from a map for a given hash in a room.
struct GNUNET_MESSENGER_Room * create_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Creates and allocates a new room for a handle with a given key for the client API.
Internal representation of the hash map.
Internal representation of the hash map.
A 512-bit hashcode.
struct GNUNET_MESSENGER_Contact * recipient
enum GNUNET_MESSENGER_MessageFlags flags
struct GNUNET_MESSENGER_Message * message
struct GNUNET_MESSENGER_Contact * sender
enum GNUNET_GenericReturnValue completed
struct GNUNET_SCHEDULER_Task * task
struct GNUNET_MESSENGER_Message * message
struct GNUNET_MESSENGER_Room * room
struct GNUNET_CONTAINER_MultiHashMap * links
struct GNUNET_CONTAINER_MultiShortmap * subscriptions
struct GNUNET_MESSENGER_Handle * handle
enum GNUNET_GenericReturnValue opened
enum GNUNET_GenericReturnValue wait_for_sync
struct GNUNET_CONTAINER_MultiShortmap * members
struct GNUNET_MESSENGER_MessageControl * control
struct GNUNET_SCHEDULER_Task * queue_task
struct GNUNET_CONTAINER_MultiHashMap * messages
enum GNUNET_GenericReturnValue use_handle_name
struct GNUNET_MESSENGER_QueueMessages queue
struct GNUNET_MESSENGER_ListTunnels entries
struct GNUNET_ShortHashCode * sender_id
struct GNUNET_HashCode key
struct GNUNET_HashCode last_message
Entry in list of pending tasks.
Definition: scheduler.c:136
A 256-bit hashcode.
Time for relative time used by GNUnet, in microseconds.