aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger_handle.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/gnunet-service-messenger_handle.c')
-rw-r--r--src/messenger/gnunet-service-messenger_handle.c79
1 files changed, 55 insertions, 24 deletions
diff --git a/src/messenger/gnunet-service-messenger_handle.c b/src/messenger/gnunet-service-messenger_handle.c
index d7007dbf6..2095f8b29 100644
--- a/src/messenger/gnunet-service-messenger_handle.c
+++ b/src/messenger/gnunet-service-messenger_handle.c
@@ -31,7 +31,8 @@
31#include "messenger_api_util.h" 31#include "messenger_api_util.h"
32 32
33struct GNUNET_MESSENGER_SrvHandle* 33struct GNUNET_MESSENGER_SrvHandle*
34create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq) 34create_handle (struct GNUNET_MESSENGER_Service *service,
35 struct GNUNET_MQ_Handle *mq)
35{ 36{
36 GNUNET_assert((service) && (mq)); 37 GNUNET_assert((service) && (mq));
37 38
@@ -49,7 +50,9 @@ create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle
49} 50}
50 51
51int 52int
52iterate_free_member_ids (void *cls, const struct GNUNET_HashCode *key, void *value) 53iterate_free_member_ids (void *cls,
54 const struct GNUNET_HashCode *key,
55 void *value)
53{ 56{
54 GNUNET_free(value); 57 GNUNET_free(value);
55 58
@@ -74,7 +77,9 @@ destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle)
74} 77}
75 78
76void 79void
77get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir) 80get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle,
81 const char *name,
82 char **dir)
78{ 83{
79 GNUNET_assert((handle) && (dir)); 84 GNUNET_assert((handle) && (dir));
80 85
@@ -87,7 +92,8 @@ get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const c
87} 92}
88 93
89static int 94static int
90create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) 95create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle,
96 const struct GNUNET_HashCode *key)
91{ 97{
92 GNUNET_assert((handle) && (key)); 98 GNUNET_assert((handle) && (key));
93 99
@@ -112,7 +118,8 @@ create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const
112} 118}
113 119
114const struct GNUNET_ShortHashCode* 120const struct GNUNET_ShortHashCode*
115get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) 121get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle,
122 const struct GNUNET_HashCode *key)
116{ 123{
117 GNUNET_assert((handle) && (key)); 124 GNUNET_assert((handle) && (key));
118 125
@@ -120,7 +127,8 @@ get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const str
120} 127}
121 128
122int 129int
123change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, 130change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle,
131 const struct GNUNET_HashCode *key,
124 const struct GNUNET_ShortHashCode *unique_id) 132 const struct GNUNET_ShortHashCode *unique_id)
125{ 133{
126 GNUNET_assert((handle) && (key) && (unique_id)); 134 GNUNET_assert((handle) && (key) && (unique_id));
@@ -165,7 +173,8 @@ send_message_to_client:
165} 173}
166 174
167static void 175static void
168change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) 176change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
177 const char *name)
169{ 178{
170 GNUNET_assert(handle); 179 GNUNET_assert(handle);
171 180
@@ -192,7 +201,8 @@ change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
192} 201}
193 202
194static void 203static void
195change_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego) 204change_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle,
205 const struct GNUNET_MESSENGER_Ego *ego)
196{ 206{
197 GNUNET_assert(handle); 207 GNUNET_assert(handle);
198 208
@@ -222,7 +232,9 @@ struct GNUNET_MESSENGER_MessageHandle
222}; 232};
223 233
224static int 234static int
225iterate_send_message (void *cls, const struct GNUNET_HashCode *key, void *value) 235iterate_send_message (void *cls,
236 const struct GNUNET_HashCode *key,
237 void *value)
226{ 238{
227 struct GNUNET_MESSENGER_MessageHandle *msg_handle = cls; 239 struct GNUNET_MESSENGER_MessageHandle *msg_handle = cls;
228 240
@@ -232,7 +244,8 @@ iterate_send_message (void *cls, const struct GNUNET_HashCode *key, void *value)
232} 244}
233 245
234void 246void
235set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego) 247set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle,
248 const struct GNUNET_MESSENGER_Ego *ego)
236{ 249{
237 GNUNET_assert((handle) && (ego)); 250 GNUNET_assert((handle) && (ego));
238 251
@@ -271,7 +284,9 @@ get_handle_ego (const struct GNUNET_MESSENGER_SrvHandle *handle)
271} 284}
272 285
273static void 286static void
274callback_setup_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) 287callback_setup_handle_name (void *cls,
288 const char *name,
289 const struct GNUNET_MESSENGER_Ego *ego)
275{ 290{
276 struct GNUNET_MESSENGER_SrvHandle *handle = cls; 291 struct GNUNET_MESSENGER_SrvHandle *handle = cls;
277 292
@@ -285,7 +300,8 @@ callback_setup_handle_name (void *cls, const char *name, const struct GNUNET_MES
285} 300}
286 301
287void 302void
288setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) 303setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
304 const char *name)
289{ 305{
290 GNUNET_assert(handle); 306 GNUNET_assert(handle);
291 307
@@ -295,7 +311,9 @@ setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
295} 311}
296 312
297static void 313static void
298callback_update_handle (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) 314callback_update_handle (void *cls,
315 const char *name,
316 const struct GNUNET_MESSENGER_Ego *ego)
299{ 317{
300 struct GNUNET_MESSENGER_SrvHandle *handle = cls; 318 struct GNUNET_MESSENGER_SrvHandle *handle = cls;
301 319
@@ -326,7 +344,9 @@ update_handle (struct GNUNET_MESSENGER_SrvHandle *handle)
326} 344}
327 345
328static void 346static void
329callback_set_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) 347callback_set_handle_name (void *cls,
348 const char *name,
349 const struct GNUNET_MESSENGER_Ego *ego)
330{ 350{
331 struct GNUNET_MESSENGER_SrvHandle *handle = cls; 351 struct GNUNET_MESSENGER_SrvHandle *handle = cls;
332 352
@@ -383,7 +403,8 @@ callback_set_handle_name (void *cls, const char *name, const struct GNUNET_MESSE
383} 403}
384 404
385void 405void
386set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) 406set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
407 const char *name)
387{ 408{
388 GNUNET_assert(handle); 409 GNUNET_assert(handle);
389 410
@@ -403,7 +424,8 @@ set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
403} 424}
404 425
405int 426int
406open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) 427open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
428 const struct GNUNET_HashCode *key)
407{ 429{
408 GNUNET_assert((handle) && (key)); 430 GNUNET_assert((handle) && (key));
409 431
@@ -414,7 +436,8 @@ open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET
414} 436}
415 437
416int 438int
417entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, 439entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
440 const struct GNUNET_PeerIdentity *door,
418 const struct GNUNET_HashCode *key) 441 const struct GNUNET_HashCode *key)
419{ 442{
420 GNUNET_assert((handle) && (door) && (key)); 443 GNUNET_assert((handle) && (door) && (key));
@@ -426,7 +449,8 @@ entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE
426} 449}
427 450
428int 451int
429close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) 452close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
453 const struct GNUNET_HashCode *key)
430{ 454{
431 GNUNET_assert((handle) && (key)); 455 GNUNET_assert((handle) && (key));
432 456
@@ -437,7 +461,8 @@ close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE
437} 461}
438 462
439int 463int
440send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, 464send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
465 const struct GNUNET_HashCode *key,
441 const struct GNUNET_MESSENGER_Message *message) 466 const struct GNUNET_MESSENGER_Message *message)
442{ 467{
443 GNUNET_assert((handle) && (key) && (message)); 468 GNUNET_assert((handle) && (key) && (message));
@@ -475,7 +500,8 @@ get_next_member_session_contect(const struct GNUNET_MESSENGER_MemberSession *ses
475} 500}
476 501
477static const struct GNUNET_MESSENGER_MemberSession* 502static const struct GNUNET_MESSENGER_MemberSession*
478get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) 503get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle,
504 const struct GNUNET_HashCode *key)
479{ 505{
480 GNUNET_assert((handle) && (key) && (handle->service)); 506 GNUNET_assert((handle) && (key) && (handle->service));
481 507
@@ -497,9 +523,11 @@ get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle, const stru
497} 523}
498 524
499void 525void
500notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, 526notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
527 const struct GNUNET_HashCode *key,
501 const struct GNUNET_MESSENGER_MemberSession *session, 528 const struct GNUNET_MESSENGER_MemberSession *session,
502 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 529 const struct GNUNET_MESSENGER_Message *message,
530 const struct GNUNET_HashCode *hash)
503{ 531{
504 GNUNET_assert((handle) && (key) && (session) && (message) && (hash)); 532 GNUNET_assert((handle) && (key) && (session) && (message) && (hash));
505 533
@@ -563,7 +591,8 @@ notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct G
563} 591}
564 592
565static int 593static int
566callback_scan_for_rooms (void *cls, const char *filename) 594callback_scan_for_rooms (void *cls,
595 const char *filename)
567{ 596{
568 struct GNUNET_MESSENGER_SrvHandle *handle = cls; 597 struct GNUNET_MESSENGER_SrvHandle *handle = cls;
569 598
@@ -606,7 +635,9 @@ load_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle)
606} 635}
607 636
608static int 637static int
609iterate_save_rooms (void *cls, const struct GNUNET_HashCode *key, void *value) 638iterate_save_rooms (void *cls,
639 const struct GNUNET_HashCode *key,
640 void *value)
610{ 641{
611 struct GNUNET_MESSENGER_SrvHandle *handle = cls; 642 struct GNUNET_MESSENGER_SrvHandle *handle = cls;
612 struct GNUNET_ShortHashCode *member_id = value; 643 struct GNUNET_ShortHashCode *member_id = value;