aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger_handle.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/gnunet-service-messenger_handle.h')
-rw-r--r--src/messenger/gnunet-service-messenger_handle.h108
1 files changed, 36 insertions, 72 deletions
diff --git a/src/messenger/gnunet-service-messenger_handle.h b/src/messenger/gnunet-service-messenger_handle.h
index edcd2ccd0..4a68ff276 100644
--- a/src/messenger/gnunet-service-messenger_handle.h
+++ b/src/messenger/gnunet-service-messenger_handle.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2020--2022 GNUnet e.V. 3 Copyright (C) 2020--2023 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 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 6 under the terms of the GNU Affero General Public License as published
@@ -32,9 +32,8 @@
32#include "gnunet_identity_service.h" 32#include "gnunet_identity_service.h"
33 33
34#include "gnunet-service-messenger_service.h" 34#include "gnunet-service-messenger_service.h"
35#include "gnunet-service-messenger_member_session.h" 35#include "gnunet-service-messenger_sender_session.h"
36 36
37#include "messenger_api_ego.h"
38#include "messenger_api_message.h" 37#include "messenger_api_message.h"
39 38
40struct GNUNET_MESSENGER_SrvHandle 39struct GNUNET_MESSENGER_SrvHandle
@@ -42,11 +41,12 @@ struct GNUNET_MESSENGER_SrvHandle
42 struct GNUNET_MESSENGER_Service *service; 41 struct GNUNET_MESSENGER_Service *service;
43 struct GNUNET_MQ_Handle *mq; 42 struct GNUNET_MQ_Handle *mq;
44 43
45 char *name; 44 struct GNUNET_IDENTITY_PublicKey *key;
46
47 const struct GNUNET_MESSENGER_Ego *ego;
48 45
49 struct GNUNET_CONTAINER_MultiHashMap *member_ids; 46 struct GNUNET_CONTAINER_MultiHashMap *member_ids;
47 struct GNUNET_CONTAINER_MultiHashMap *next_ids;
48
49 struct GNUNET_SCHEDULER_Task *notify;
50}; 50};
51 51
52/** 52/**
@@ -69,6 +69,25 @@ void
69destroy_srv_handle (struct GNUNET_MESSENGER_SrvHandle *handle); 69destroy_srv_handle (struct GNUNET_MESSENGER_SrvHandle *handle);
70 70
71/** 71/**
72 * Sets the public key from the EGO of a given <i>handle</i>.
73 *
74 * @param[out] handle Handle
75 * @param[in] key Public key of EGO
76 */
77void
78set_srv_handle_key (struct GNUNET_MESSENGER_SrvHandle *handle,
79 const struct GNUNET_IDENTITY_PublicKey *key);
80
81/**
82 * Returns the public key from the EGO of a given <i>handle</i>.
83 *
84 * @param[in] handle Handle
85 * @return Public key of handles EGO
86 */
87const struct GNUNET_IDENTITY_PublicKey*
88get_srv_handle_key (const struct GNUNET_MESSENGER_SrvHandle *handle);
89
90/**
72 * Writes the path of the directory for a given <i>handle</i> using a specific <i>name</i> to the parameter 91 * Writes the path of the directory for a given <i>handle</i> using a specific <i>name</i> to the parameter
73 * <i>dir</i>. This directory will be used to store data regarding the handle and its messages. 92 * <i>dir</i>. This directory will be used to store data regarding the handle and its messages.
74 * 93 *
@@ -111,57 +130,6 @@ change_srv_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle,
111 const struct GNUNET_ShortHashCode *unique_id); 130 const struct GNUNET_ShortHashCode *unique_id);
112 131
113/** 132/**
114 * Sets the EGO used by a given <i>handle</i>.
115 *
116 * @param[in,out] handle Handle
117 * @param[in] ego EGO key pair
118 */
119void
120set_srv_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle,
121 const struct GNUNET_MESSENGER_Ego *ego);
122
123/**
124 * Returns the EGO used by a given <i>handle</i>.
125 *
126 * @param[in] handle Handle
127 * @return EGO key pair
128 */
129const struct GNUNET_MESSENGER_Ego*
130get_srv_handle_ego (const struct GNUNET_MESSENGER_SrvHandle *handle);
131
132/**
133 * Tries to set the name and EGO key of a <i>handle</i> initially by looking up a specific <i>name</i>.
134 *
135 * @param[in,out] handle Handle
136 * @param[in] name Name (optionally: valid EGO name)
137 */
138void
139setup_srv_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
140 const char *name);
141
142/**
143 * Tries to change the key pair of an EGO of a <i>handle</i> under the same name and informs all rooms
144 * about the change automatically.
145 *
146 * @param[in,out] handle Handle
147 */
148void
149update_srv_handle (struct GNUNET_MESSENGER_SrvHandle *handle);
150
151/**
152 * Tries to rename the handle which implies renaming the EGO its using and moving all related data into
153 * the directory fitting to the changed <i>name</i>.
154 *
155 * The client connected to the <i>handle</i> will be informed afterwards automatically.
156 *
157 * @param[in,out] handle Handle
158 * @param[in] name New name
159 */
160void
161set_srv_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
162 const char *name);
163
164/**
165 * Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and opens the 133 * Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and opens the
166 * room from the handles service. 134 * room from the handles service.
167 * 135 *
@@ -217,33 +185,29 @@ send_srv_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
217 * 185 *
218 * @param[in,out] handle Handle 186 * @param[in,out] handle Handle
219 * @param[in] room Room of the message 187 * @param[in] room Room of the message
220 * @param[in] session Member session 188 * @param[in] session Sender session
221 * @param[in] message Message 189 * @param[in] message Message
222 * @param[in] hash Hash of message 190 * @param[in] hash Hash of message
223 */ 191 */
224void 192void
225notify_srv_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, 193notify_srv_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
226 struct GNUNET_MESSENGER_SrvRoom *room, 194 struct GNUNET_MESSENGER_SrvRoom *room,
227 const struct GNUNET_MESSENGER_MemberSession *session, 195 const struct GNUNET_MESSENGER_SenderSession *session,
228 const struct GNUNET_MESSENGER_Message *message, 196 const struct GNUNET_MESSENGER_Message *message,
229 const struct GNUNET_HashCode *hash); 197 const struct GNUNET_HashCode *hash);
230 198
231/** 199/**
232 * Loads member ids and other potential configuration from a given <i>handle</i> which 200 * Notifies the handle that a new member id needs to be used.
233 * depends on the given name the <i>handle</i> uses.
234 * 201 *
235 * @param[out] handle Handle 202 * @param[in,out] handle Handle
236 */ 203 * @param[in] room Room of the member
237void 204 * @param[in] member_id Member id
238load_srv_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle); 205 * @param[in] reset Reset member session with join message
239
240/**
241 * Saves member ids and other potential configuration from a given <i>handle</i> which
242 * depends on the given name the <i>handle</i> uses.
243 *
244 * @param[in] handle Handle
245 */ 206 */
246void 207void
247save_srv_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle); 208notify_srv_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle,
209 struct GNUNET_MESSENGER_SrvRoom *room,
210 const struct GNUNET_ShortHashCode *member_id,
211 enum GNUNET_GenericReturnValue reset);
248 212
249#endif //GNUNET_SERVICE_MESSENGER_HANDLE_H 213#endif //GNUNET_SERVICE_MESSENGER_HANDLE_H