aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger_room.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/gnunet-service-messenger_room.h')
-rw-r--r--src/messenger/gnunet-service-messenger_room.h73
1 files changed, 41 insertions, 32 deletions
diff --git a/src/messenger/gnunet-service-messenger_room.h b/src/messenger/gnunet-service-messenger_room.h
index a40961177..b6a0f1064 100644
--- a/src/messenger/gnunet-service-messenger_room.h
+++ b/src/messenger/gnunet-service-messenger_room.h
@@ -36,6 +36,7 @@
36#include "gnunet_messenger_service.h" 36#include "gnunet_messenger_service.h"
37#include "gnunet-service-messenger_basement.h" 37#include "gnunet-service-messenger_basement.h"
38#include "gnunet-service-messenger_handle.h" 38#include "gnunet-service-messenger_handle.h"
39#include "gnunet-service-messenger_message_state.h"
39#include "gnunet-service-messenger_list_messages.h" 40#include "gnunet-service-messenger_list_messages.h"
40 41
41#include "messenger_api_list_tunnels.h" 42#include "messenger_api_list_tunnels.h"
@@ -72,7 +73,7 @@ struct GNUNET_MESSENGER_SrvRoom
72 struct GNUNET_MESSENGER_OperationStore operation_store; 73 struct GNUNET_MESSENGER_OperationStore operation_store;
73 74
74 struct GNUNET_MESSENGER_ListTunnels basement; 75 struct GNUNET_MESSENGER_ListTunnels basement;
75 struct GNUNET_MESSENGER_ListMessages last_messages; 76 struct GNUNET_MESSENGER_MessageState state;
76 77
77 struct GNUNET_HashCode *peer_message; 78 struct GNUNET_HashCode *peer_message;
78 79
@@ -126,24 +127,6 @@ struct GNUNET_MESSENGER_OperationStore*
126get_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room); 127get_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room);
127 128
128/** 129/**
129 * Returns the member id of the member representing the handle currently hosting this <i>room</i>.
130 *
131 * @param[in] room Room
132 * @return Host member id or NULL
133 */
134const struct GNUNET_ShortHashCode*
135get_room_host_id (const struct GNUNET_MESSENGER_SrvRoom *room);
136
137/**
138 * Changes the member id of the member representing the handle currently hosting this <i>room</i>.
139 *
140 * @param[in/out] room Room
141 * @param[in] unique_id Unique member id
142 */
143void
144change_room_host_id (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *unique_id);
145
146/**
147 * Tries to open a <i>room</i> for a given <i>handle</i>. If the room has already been opened, the handle 130 * Tries to open a <i>room</i> for a given <i>handle</i>. If the room has already been opened, the handle
148 * will locally join the room. 131 * will locally join the room.
149 * 132 *
@@ -289,25 +272,51 @@ const struct GNUNET_MESSENGER_SrvTunnel*
289get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer); 272get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer);
290 273
291/** 274/**
292 * Returns a message from a <i>room</i> identified by a given <i>hash</i>. If no matching message is 275 * Method called whenever a <i>message</i> is found during a request in a <i>room</i>.
293 * found and <i>request</i> is set to #GNUNET_YES, the <i>handle</i> will request the missing message
294 * automatically.
295 * 276 *
296 * The function uses the optimized check for a message via its hash from the message store. 277 * @param[in/out] cls Closure from #request_room_message
297 * @see contains_store_message() 278 * @param[in/out] room Room
279 * @param[in] message Message or NULL
280 * @param[in] hash Hash of message
281 */
282typedef void (GNUNET_MESSENGER_MessageRequestCallback) (
283 void *cls, struct GNUNET_MESSENGER_SrvRoom *room,
284 const struct GNUNET_MESSENGER_Message *message,
285 const struct GNUNET_HashCode *hash
286);
287
288/**
289 * Requests a message from a <i>room</i> identified by a given <i>hash</i>. If the message is found,
290 * the selected <i>callback</i> will be called with it and the provided closure. If no matching message
291 * is found but it wasn't deleted the selected callback will be called with #NULL as message instead.
292 * In case of deletion the next available previous message will be used to call the callback.
298 * 293 *
299 * If a message is missing independent of the following request, NULL gets returned instead of the 294 * It is also possible that the given callback will not be called if the requesting session is not
300 * matching message. 295 * permitted!
301 * 296 *
302 * @param[in/out] room Room 297 * @param[in/out] room Room
303 * @param[in/out] handle Handle
304 * @param[in] hash Hash of message 298 * @param[in] hash Hash of message
305 * @param[in] request Flag to request a message 299 * @param[in] callback Callback to process result
306 * @return Message or NULL 300 * @param[in] cls Closure for the <i>callback</i>
301 * @return #GNUNET_YES if the request could be processed, otherwise #GNUNET_NO
302 */
303int
304request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash,
305 const struct GNUNET_MESSENGER_MemberSession *session,
306 GNUNET_MESSENGER_MessageRequestCallback callback, void* cls);
307
308/**
309 * Checks for potential collisions with member ids and solves them changing active handles ids if they
310 * use an already used member id (comparing public key and timestamp).
311 *
312 * @param[in/out] room Room
313 * @param[in] public_key Public key of EGO
314 * @param[in] member_id Member ID
315 * @param[in] timestamp Timestamp
307 */ 316 */
308const struct GNUNET_MESSENGER_Message* 317void
309get_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 318solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key,
310 const struct GNUNET_HashCode *hash, int request); 319 const struct GNUNET_ShortHashCode *member_id, struct GNUNET_TIME_Absolute timestamp);
311 320
312/** 321/**
313 * Rebuilds the decentralized structure for a <i>room</i> by ensuring all required connections are made 322 * Rebuilds the decentralized structure for a <i>room</i> by ensuring all required connections are made