aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_messenger_service.h47
-rw-r--r--src/messenger/gnunet-messenger.c21
-rw-r--r--src/messenger/gnunet-service-messenger.c51
-rw-r--r--src/messenger/gnunet-service-messenger_basement.c8
-rw-r--r--src/messenger/gnunet-service-messenger_basement.h8
-rw-r--r--src/messenger/gnunet-service-messenger_ego_store.c37
-rw-r--r--src/messenger/gnunet-service-messenger_ego_store.h21
-rw-r--r--src/messenger/gnunet-service-messenger_handle.c79
-rw-r--r--src/messenger/gnunet-service-messenger_handle.h40
-rw-r--r--src/messenger/gnunet-service-messenger_list_handles.c9
-rw-r--r--src/messenger/gnunet-service-messenger_list_handles.h9
-rw-r--r--src/messenger/gnunet-service-messenger_list_messages.c15
-rw-r--r--src/messenger/gnunet-service-messenger_list_messages.h15
-rw-r--r--src/messenger/gnunet-service-messenger_member.c61
-rw-r--r--src/messenger/gnunet-service-messenger_member.h28
-rw-r--r--src/messenger/gnunet-service-messenger_member_session.c26
-rw-r--r--src/messenger/gnunet-service-messenger_member_session.h12
-rw-r--r--src/messenger/gnunet-service-messenger_member_store.c44
-rw-r--r--src/messenger/gnunet-service-messenger_member_store.h21
-rw-r--r--src/messenger/gnunet-service-messenger_message_handle.c51
-rw-r--r--src/messenger/gnunet-service-messenger_message_handle.h48
-rw-r--r--src/messenger/gnunet-service-messenger_message_kind.c6
-rw-r--r--src/messenger/gnunet-service-messenger_message_kind.h6
-rw-r--r--src/messenger/gnunet-service-messenger_message_recv.c32
-rw-r--r--src/messenger/gnunet-service-messenger_message_recv.h18
-rw-r--r--src/messenger/gnunet-service-messenger_message_send.c24
-rw-r--r--src/messenger/gnunet-service-messenger_message_send.h24
-rw-r--r--src/messenger/gnunet-service-messenger_message_state.c12
-rw-r--r--src/messenger/gnunet-service-messenger_message_state.h12
-rw-r--r--src/messenger/gnunet-service-messenger_message_store.c54
-rw-r--r--src/messenger/gnunet-service-messenger_message_store.h21
-rw-r--r--src/messenger/gnunet-service-messenger_operation.c6
-rw-r--r--src/messenger/gnunet-service-messenger_operation.h6
-rw-r--r--src/messenger/gnunet-service-messenger_operation_store.c20
-rw-r--r--src/messenger/gnunet-service-messenger_operation_store.h3
-rw-r--r--src/messenger/gnunet-service-messenger_room.c142
-rw-r--r--src/messenger/gnunet-service-messenger_room.h55
-rw-r--r--src/messenger/gnunet-service-messenger_service.c37
-rw-r--r--src/messenger/gnunet-service-messenger_service.h33
-rw-r--r--src/messenger/gnunet-service-messenger_tunnel.c49
-rw-r--r--src/messenger/gnunet-service-messenger_tunnel.h22
-rw-r--r--src/messenger/messenger_api.c90
-rw-r--r--src/messenger/messenger_api_contact.c6
-rw-r--r--src/messenger/messenger_api_contact.h6
-rw-r--r--src/messenger/messenger_api_contact_store.c22
-rw-r--r--src/messenger/messenger_api_contact_store.h15
-rw-r--r--src/messenger/messenger_api_handle.c29
-rw-r--r--src/messenger/messenger_api_handle.h25
-rw-r--r--src/messenger/messenger_api_list_tunnels.c22
-rw-r--r--src/messenger/messenger_api_list_tunnels.h19
-rw-r--r--src/messenger/messenger_api_message.c74
-rw-r--r--src/messenger/messenger_api_message.h37
-rw-r--r--src/messenger/messenger_api_room.c75
-rw-r--r--src/messenger/messenger_api_room.h21
-rw-r--r--src/messenger/messenger_api_util.c6
-rw-r--r--src/messenger/messenger_api_util.h6
-rw-r--r--src/messenger/test_messenger.c10
-rw-r--r--src/messenger/test_messenger_adapt.c3
-rw-r--r--src/messenger/test_messenger_anonymous.c10
-rw-r--r--src/messenger/test_messenger_async_client.c3
-rw-r--r--src/messenger/test_messenger_async_p2p.c3
-rw-r--r--src/messenger/test_messenger_growth.c3
-rw-r--r--src/messenger/test_messenger_ring.c3
-rw-r--r--src/messenger/test_messenger_server.c3
-rw-r--r--src/messenger/test_messenger_sync_client.c3
-rw-r--r--src/messenger/test_messenger_sync_p2p.c3
-rw-r--r--src/messenger/test_messenger_worst_client.c3
-rw-r--r--src/messenger/test_messenger_worst_p2p.c3
-rw-r--r--src/messenger/testing_messenger_barrier.c6
-rw-r--r--src/messenger/testing_messenger_setup.c41
-rw-r--r--src/messenger/testing_messenger_setup.h3
71 files changed, 1219 insertions, 567 deletions
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h
index 5d7155a3d..b54567aa7 100644
--- a/src/include/gnunet_messenger_service.h
+++ b/src/include/gnunet_messenger_service.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 GNUnet e.V. 3 Copyright (C) 2020--2021 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
@@ -527,7 +527,8 @@ enum GNUNET_MESSENGER_MessageFlags
527 * @param[in/out] handle Messenger handle 527 * @param[in/out] handle Messenger handle
528 */ 528 */
529typedef void 529typedef void
530(*GNUNET_MESSENGER_IdentityCallback) (void *cls, struct GNUNET_MESSENGER_Handle *handle); 530(*GNUNET_MESSENGER_IdentityCallback) (void *cls,
531 struct GNUNET_MESSENGER_Handle *handle);
531 532
532/** 533/**
533 * Method called whenever a message is sent or received from a <i>room</i>. 534 * Method called whenever a message is sent or received from a <i>room</i>.
@@ -543,7 +544,8 @@ typedef void
543 * @param[in] flags Flags of the message 544 * @param[in] flags Flags of the message
544 */ 545 */
545typedef void 546typedef void
546(*GNUNET_MESSENGER_MessageCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, 547(*GNUNET_MESSENGER_MessageCallback) (void *cls,
548 struct GNUNET_MESSENGER_Room *room,
547 const struct GNUNET_MESSENGER_Contact *sender, 549 const struct GNUNET_MESSENGER_Contact *sender,
548 const struct GNUNET_MESSENGER_Message *message, 550 const struct GNUNET_MESSENGER_Message *message,
549 const struct GNUNET_HashCode *hash, 551 const struct GNUNET_HashCode *hash,
@@ -558,7 +560,8 @@ typedef void
558 * @param[in] contact Contact handle 560 * @param[in] contact Contact handle
559 */ 561 */
560typedef int 562typedef int
561(*GNUNET_MESSENGER_MemberCallback) (void* cls, struct GNUNET_MESSENGER_Room *room, 563(*GNUNET_MESSENGER_MemberCallback) (void* cls,
564 struct GNUNET_MESSENGER_Room *room,
562 const struct GNUNET_MESSENGER_Contact *contact); 565 const struct GNUNET_MESSENGER_Contact *contact);
563 566
564/** 567/**
@@ -574,9 +577,12 @@ typedef int
574 * @return Messenger handle to use, NULL on error 577 * @return Messenger handle to use, NULL on error
575 */ 578 */
576struct GNUNET_MESSENGER_Handle* 579struct GNUNET_MESSENGER_Handle*
577GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, 580GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
578 GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls, 581 const char *name,
579 GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls); 582 GNUNET_MESSENGER_IdentityCallback identity_callback,
583 void *identity_cls,
584 GNUNET_MESSENGER_MessageCallback msg_callback,
585 void *msg_cls);
580 586
581/** 587/**
582 * Update a handle of the messenger to use a different ego key and replace the old one with a newly generated one. All 588 * Update a handle of the messenger to use a different ego key and replace the old one with a newly generated one. All
@@ -619,7 +625,8 @@ GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle);
619 * @return #GNUNET_YES on success, #GNUNET_NO on failure and #GNUNET_SYSERR if <i>handle</i> is NULL 625 * @return #GNUNET_YES on success, #GNUNET_NO on failure and #GNUNET_SYSERR if <i>handle</i> is NULL
620 */ 626 */
621int 627int
622GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); 628GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle,
629 const char *name);
623 630
624/** 631/**
625 * Get the public key used by the messenger or NULL if the anonymous key was used. 632 * Get the public key used by the messenger or NULL if the anonymous key was used.
@@ -647,7 +654,8 @@ GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle);
647 * @return Room handle, NULL on error 654 * @return Room handle, NULL on error
648 */ 655 */
649struct GNUNET_MESSENGER_Room* 656struct GNUNET_MESSENGER_Room*
650GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); 657GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle,
658 const struct GNUNET_HashCode *key);
651 659
652/** 660/**
653 * Enter a room to send and receive messages through a <b>door</b> opened using #GNUNET_MESSENGER_open_room. 661 * Enter a room to send and receive messages through a <b>door</b> opened using #GNUNET_MESSENGER_open_room.
@@ -668,7 +676,8 @@ GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct
668 * @return Room handle, NULL on error 676 * @return Room handle, NULL on error
669 */ 677 */
670struct GNUNET_MESSENGER_Room* 678struct GNUNET_MESSENGER_Room*
671GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, 679GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle,
680 const struct GNUNET_PeerIdentity *door,
672 const struct GNUNET_HashCode *key); 681 const struct GNUNET_HashCode *key);
673 682
674/** 683/**
@@ -695,8 +704,10 @@ GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room);
695 * @return Amount of rooms iterated 704 * @return Amount of rooms iterated
696 */ 705 */
697int 706int
698GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, 707GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle,
699 GNUNET_MESSENGER_MemberCallback callback, void *cls); 708 const struct GNUNET_MESSENGER_Contact *contact,
709 GNUNET_MESSENGER_MemberCallback callback,
710 void *cls);
700 711
701/** 712/**
702 * Get the key of a given <i>room</i>. 713 * Get the key of a given <i>room</i>.
@@ -717,7 +728,8 @@ GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room);
717 * @return Contact handle, NULL otherwise 728 * @return Contact handle, NULL otherwise
718 */ 729 */
719const struct GNUNET_MESSENGER_Contact* 730const struct GNUNET_MESSENGER_Contact*
720GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); 731GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room,
732 const struct GNUNET_HashCode *hash);
721 733
722/** 734/**
723 * Get the name used by the <i>contact</i>. 735 * Get the name used by the <i>contact</i>.
@@ -756,7 +768,8 @@ GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact
756 * @param[in] contact Contact or NULL 768 * @param[in] contact Contact or NULL
757 */ 769 */
758void 770void
759GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, 771GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room,
772 const struct GNUNET_MESSENGER_Message *message,
760 const struct GNUNET_MESSENGER_Contact* contact); 773 const struct GNUNET_MESSENGER_Contact* contact);
761 774
762/** 775/**
@@ -767,7 +780,8 @@ GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct
767 * @return Message struct or NULL if no message with that hash is known 780 * @return Message struct or NULL if no message with that hash is known
768 */ 781 */
769const struct GNUNET_MESSENGER_Message* 782const struct GNUNET_MESSENGER_Message*
770GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); 783GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room,
784 const struct GNUNET_HashCode *hash);
771 785
772/** 786/**
773 * Iterates through all members of a given <i>room</i> and calls a selected <i>callback</i> 787 * Iterates through all members of a given <i>room</i> and calls a selected <i>callback</i>
@@ -780,7 +794,8 @@ GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const st
780 * @return Amount of members iterated 794 * @return Amount of members iterated
781 */ 795 */
782int 796int
783GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, 797GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room,
798 GNUNET_MESSENGER_MemberCallback callback,
784 void* cls); 799 void* cls);
785 800
786#if 0 /* keep Emacsens' auto-indent happy */ 801#if 0 /* keep Emacsens' auto-indent happy */
diff --git a/src/messenger/gnunet-messenger.c b/src/messenger/gnunet-messenger.c
index 28fa4b147..e2d106be8 100644
--- a/src/messenger/gnunet-messenger.c
+++ b/src/messenger/gnunet-messenger.c
@@ -42,8 +42,11 @@ struct GNUNET_MESSENGER_Handle *messenger;
42 * @param[in] flags Flags of message 42 * @param[in] flags Flags of message
43 */ 43 */
44void 44void
45on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, 45on_message (void *cls,
46 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, 46 struct GNUNET_MESSENGER_Room *room,
47 const struct GNUNET_MESSENGER_Contact *sender,
48 const struct GNUNET_MESSENGER_Message *message,
49 const struct GNUNET_HashCode *hash,
47 enum GNUNET_MESSENGER_MessageFlags flags) 50 enum GNUNET_MESSENGER_MessageFlags flags)
48{ 51{
49 const char *sender_name = GNUNET_MESSENGER_contact_get_name (sender); 52 const char *sender_name = GNUNET_MESSENGER_contact_get_name (sender);
@@ -124,7 +127,8 @@ listen_stdio (void *cls);
124#define MAX_BUFFER_SIZE 60000 127#define MAX_BUFFER_SIZE 60000
125 128
126static int 129static int
127iterate_send_private_message (void *cls, struct GNUNET_MESSENGER_Room *room, 130iterate_send_private_message (void *cls,
131 struct GNUNET_MESSENGER_Room *room,
128 const struct GNUNET_MESSENGER_Contact *contact) 132 const struct GNUNET_MESSENGER_Contact *contact)
129{ 133{
130 struct GNUNET_MESSENGER_Message *message = cls; 134 struct GNUNET_MESSENGER_Message *message = cls;
@@ -226,7 +230,8 @@ struct GNUNET_SCHEDULER_Task *shutdown_task;
226 * @param[in/out] handle Handle of messenger service 230 * @param[in/out] handle Handle of messenger service
227 */ 231 */
228static void 232static void
229on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) 233on_identity (void *cls,
234 struct GNUNET_MESSENGER_Handle *handle)
230{ 235{
231 struct GNUNET_HashCode key; 236 struct GNUNET_HashCode key;
232 memset (&key, 0, sizeof(key)); 237 memset (&key, 0, sizeof(key));
@@ -292,7 +297,10 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
292 * @param[in] cfg configuration 297 * @param[in] cfg configuration
293 */ 298 */
294static void 299static void
295run (void *cls, char *const*args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) 300run (void *cls,
301 char *const*args,
302 const char *cfgfile,
303 const struct GNUNET_CONFIGURATION_Handle *cfg)
296{ 304{
297 messenger = GNUNET_MESSENGER_connect (cfg, ego_name, &on_identity, NULL, &on_message, NULL); 305 messenger = GNUNET_MESSENGER_connect (cfg, ego_name, &on_identity, NULL, &on_message, NULL);
298 306
@@ -307,7 +315,8 @@ run (void *cls, char *const*args, const char *cfgfile, const struct GNUNET_CONFI
307 * @return #EXIT_SUCCESS ok, #EXIT_FAILURE on error 315 * @return #EXIT_SUCCESS ok, #EXIT_FAILURE on error
308 */ 316 */
309int 317int
310main (int argc, char **argv) 318main (int argc,
319 char **argv)
311{ 320{
312 const char *description = "Open and connect to rooms using the MESSENGER to chat."; 321 const char *description = "Open and connect to rooms using the MESSENGER to chat.";
313 322
diff --git a/src/messenger/gnunet-service-messenger.c b/src/messenger/gnunet-service-messenger.c
index 7edd76d32..989157ceb 100644
--- a/src/messenger/gnunet-service-messenger.c
+++ b/src/messenger/gnunet-service-messenger.c
@@ -39,14 +39,16 @@ struct GNUNET_MESSENGER_Client
39struct GNUNET_MESSENGER_Service *messenger; 39struct GNUNET_MESSENGER_Service *messenger;
40 40
41static int 41static int
42check_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg) 42check_create (void *cls,
43 const struct GNUNET_MESSENGER_CreateMessage *msg)
43{ 44{
44 GNUNET_MQ_check_zero_termination(msg); 45 GNUNET_MQ_check_zero_termination(msg);
45 return GNUNET_OK; 46 return GNUNET_OK;
46} 47}
47 48
48static void 49static void
49handle_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg) 50handle_create (void *cls,
51 const struct GNUNET_MESSENGER_CreateMessage *msg)
50{ 52{
51 struct GNUNET_MESSENGER_Client *msg_client = cls; 53 struct GNUNET_MESSENGER_Client *msg_client = cls;
52 54
@@ -60,7 +62,8 @@ handle_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg)
60} 62}
61 63
62static void 64static void
63handle_update (void *cls, const struct GNUNET_MESSENGER_UpdateMessage *msg) 65handle_update (void *cls,
66 const struct GNUNET_MESSENGER_UpdateMessage *msg)
64{ 67{
65 struct GNUNET_MESSENGER_Client *msg_client = cls; 68 struct GNUNET_MESSENGER_Client *msg_client = cls;
66 69
@@ -70,7 +73,8 @@ handle_update (void *cls, const struct GNUNET_MESSENGER_UpdateMessage *msg)
70} 73}
71 74
72static void 75static void
73handle_destroy (void *cls, const struct GNUNET_MESSENGER_DestroyMessage *msg) 76handle_destroy (void *cls,
77 const struct GNUNET_MESSENGER_DestroyMessage *msg)
74{ 78{
75 struct GNUNET_MESSENGER_Client *msg_client = cls; 79 struct GNUNET_MESSENGER_Client *msg_client = cls;
76 80
@@ -78,14 +82,16 @@ handle_destroy (void *cls, const struct GNUNET_MESSENGER_DestroyMessage *msg)
78} 82}
79 83
80static int 84static int
81check_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) 85check_set_name (void *cls,
86 const struct GNUNET_MESSENGER_NameMessage *msg)
82{ 87{
83 GNUNET_MQ_check_zero_termination(msg); 88 GNUNET_MQ_check_zero_termination(msg);
84 return GNUNET_OK; 89 return GNUNET_OK;
85} 90}
86 91
87static void 92static void
88handle_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) 93handle_set_name (void *cls,
94 const struct GNUNET_MESSENGER_NameMessage *msg)
89{ 95{
90 struct GNUNET_MESSENGER_Client *msg_client = cls; 96 struct GNUNET_MESSENGER_Client *msg_client = cls;
91 97
@@ -99,7 +105,8 @@ handle_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg)
99} 105}
100 106
101static void 107static void
102handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 108handle_room_open (void *cls,
109 const struct GNUNET_MESSENGER_RoomMessage *msg)
103{ 110{
104 struct GNUNET_MESSENGER_Client *msg_client = cls; 111 struct GNUNET_MESSENGER_Client *msg_client = cls;
105 112
@@ -125,7 +132,8 @@ handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
125} 132}
126 133
127static void 134static void
128handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 135handle_room_entry (void *cls,
136 const struct GNUNET_MESSENGER_RoomMessage *msg)
129{ 137{
130 struct GNUNET_MESSENGER_Client *msg_client = cls; 138 struct GNUNET_MESSENGER_Client *msg_client = cls;
131 139
@@ -153,7 +161,8 @@ handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
153} 161}
154 162
155static void 163static void
156handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 164handle_room_close (void *cls,
165 const struct GNUNET_MESSENGER_RoomMessage *msg)
157{ 166{
158 struct GNUNET_MESSENGER_Client *msg_client = cls; 167 struct GNUNET_MESSENGER_Client *msg_client = cls;
159 168
@@ -179,7 +188,8 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
179} 188}
180 189
181static int 190static int
182check_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) 191check_send_message (void *cls,
192 const struct GNUNET_MESSENGER_SendMessage *msg)
183{ 193{
184 const uint16_t full_length = ntohs (msg->header.size); 194 const uint16_t full_length = ntohs (msg->header.size);
185 195
@@ -224,7 +234,8 @@ check_for_message:
224} 234}
225 235
226static void 236static void
227handle_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) 237handle_send_message (void *cls,
238 const struct GNUNET_MESSENGER_SendMessage *msg)
228{ 239{
229 struct GNUNET_MESSENGER_Client *msg_client = cls; 240 struct GNUNET_MESSENGER_Client *msg_client = cls;
230 241
@@ -271,7 +282,8 @@ end_handling:
271} 282}
272 283
273static void 284static void
274callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, 285callback_found_message (void *cls,
286 struct GNUNET_MESSENGER_SrvRoom *room,
275 const struct GNUNET_MESSENGER_Message *message, 287 const struct GNUNET_MESSENGER_Message *message,
276 const struct GNUNET_HashCode *hash) 288 const struct GNUNET_HashCode *hash)
277{ 289{
@@ -300,7 +312,8 @@ callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room,
300} 312}
301 313
302static void 314static void
303handle_get_message (void *cls, const struct GNUNET_MESSENGER_GetMessage *msg) 315handle_get_message (void *cls,
316 const struct GNUNET_MESSENGER_GetMessage *msg)
304{ 317{
305 struct GNUNET_MESSENGER_Client *msg_client = cls; 318 struct GNUNET_MESSENGER_Client *msg_client = cls;
306 319
@@ -341,7 +354,9 @@ end_handling:
341} 354}
342 355
343static void* 356static void*
344callback_client_connect (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq) 357callback_client_connect (void *cls,
358 struct GNUNET_SERVICE_Client *client,
359 struct GNUNET_MQ_Handle *mq)
345{ 360{
346 struct GNUNET_MESSENGER_Client *msg_client = GNUNET_new(struct GNUNET_MESSENGER_Client); 361 struct GNUNET_MESSENGER_Client *msg_client = GNUNET_new(struct GNUNET_MESSENGER_Client);
347 362
@@ -352,7 +367,9 @@ callback_client_connect (void *cls, struct GNUNET_SERVICE_Client *client, struct
352} 367}
353 368
354static void 369static void
355callback_client_disconnect (void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls) 370callback_client_disconnect (void *cls,
371 struct GNUNET_SERVICE_Client *client,
372 void *internal_cls)
356{ 373{
357 struct GNUNET_MESSENGER_Client *msg_client = internal_cls; 374 struct GNUNET_MESSENGER_Client *msg_client = internal_cls;
358 375
@@ -369,7 +386,9 @@ callback_client_disconnect (void *cls, struct GNUNET_SERVICE_Client *client, voi
369 * @param[in/out] service the initialized service 386 * @param[in/out] service the initialized service
370 */ 387 */
371static void 388static void
372run (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service) 389run (void *cls,
390 const struct GNUNET_CONFIGURATION_Handle *config,
391 struct GNUNET_SERVICE_Handle *service)
373{ 392{
374 messenger = create_service (config, service); 393 messenger = create_service (config, service);
375 394
diff --git a/src/messenger/gnunet-service-messenger_basement.c b/src/messenger/gnunet-service-messenger_basement.c
index f302c8d66..89aa103ee 100644
--- a/src/messenger/gnunet-service-messenger_basement.c
+++ b/src/messenger/gnunet-service-messenger_basement.c
@@ -40,7 +40,9 @@ count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels)
40} 40}
41 41
42int 42int
43should_connect_tunnel_to (size_t count, size_t src, size_t dst) 43should_connect_tunnel_to (size_t count,
44 size_t src,
45 size_t dst)
44{ 46{
45 if ((src + 1) % count == dst % count) 47 if ((src + 1) % count == dst % count)
46 return GNUNET_YES; 48 return GNUNET_YES;
@@ -49,7 +51,9 @@ should_connect_tunnel_to (size_t count, size_t src, size_t dst)
49} 51}
50 52
51int 53int
52required_connection_between (size_t count, size_t src, size_t dst) 54required_connection_between (size_t count,
55 size_t src,
56 size_t dst)
53{ 57{
54 if (GNUNET_YES == should_connect_tunnel_to (count, src, dst)) 58 if (GNUNET_YES == should_connect_tunnel_to (count, src, dst))
55 return GNUNET_YES; 59 return GNUNET_YES;
diff --git a/src/messenger/gnunet-service-messenger_basement.h b/src/messenger/gnunet-service-messenger_basement.h
index b19aec405..a097b482f 100644
--- a/src/messenger/gnunet-service-messenger_basement.h
+++ b/src/messenger/gnunet-service-messenger_basement.h
@@ -48,7 +48,9 @@ count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels);
48 * @return #GNUNET_YES or #GNUNET_NO based on topologic requirement 48 * @return #GNUNET_YES or #GNUNET_NO based on topologic requirement
49 */ 49 */
50int 50int
51should_connect_tunnel_to (size_t count, size_t src, size_t dst); 51should_connect_tunnel_to (size_t count,
52 size_t src,
53 size_t dst);
52 54
53/** 55/**
54 * Returns #GNUNET_YES or #GNUNET_NO to determine if the peers of index <i>src</i> and 56 * Returns #GNUNET_YES or #GNUNET_NO to determine if the peers of index <i>src</i> and
@@ -61,6 +63,8 @@ should_connect_tunnel_to (size_t count, size_t src, size_t dst);
61 * @return #GNUNET_YES or #GNUNET_NO based on topologic requirement 63 * @return #GNUNET_YES or #GNUNET_NO based on topologic requirement
62 */ 64 */
63int 65int
64required_connection_between (size_t count, size_t src, size_t dst); 66required_connection_between (size_t count,
67 size_t src,
68 size_t dst);
65 69
66#endif //GNUNET_SERVICE_MESSENGER_BASEMENT_H 70#endif //GNUNET_SERVICE_MESSENGER_BASEMENT_H
diff --git a/src/messenger/gnunet-service-messenger_ego_store.c b/src/messenger/gnunet-service-messenger_ego_store.c
index 3b069fcf5..c460ac1c7 100644
--- a/src/messenger/gnunet-service-messenger_ego_store.c
+++ b/src/messenger/gnunet-service-messenger_ego_store.c
@@ -28,7 +28,10 @@
28#include "gnunet-service-messenger_handle.h" 28#include "gnunet-service-messenger_handle.h"
29 29
30static void 30static void
31callback_update_ego (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *identifier) 31callback_update_ego (void *cls,
32 struct GNUNET_IDENTITY_Ego *ego,
33 void **ctx,
34 const char *identifier)
32{ 35{
33 if ((!ego) || (!identifier)) 36 if ((!ego) || (!identifier))
34 return; 37 return;
@@ -41,7 +44,8 @@ callback_update_ego (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, con
41} 44}
42 45
43void 46void
44init_ego_store(struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config) 47init_ego_store(struct GNUNET_MESSENGER_EgoStore *store,
48 const struct GNUNET_CONFIGURATION_Handle *config)
45{ 49{
46 GNUNET_assert ((store) && (config)); 50 GNUNET_assert ((store) && (config));
47 51
@@ -58,7 +62,9 @@ init_ego_store(struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONF
58 62
59 63
60static int 64static int
61iterate_destroy_egos (void *cls, const struct GNUNET_HashCode *key, void *value) 65iterate_destroy_egos (void *cls,
66 const struct GNUNET_HashCode *key,
67 void *value)
62{ 68{
63 struct GNUNET_MESSENGER_Ego *ego = value; 69 struct GNUNET_MESSENGER_Ego *ego = value;
64 GNUNET_free(ego); 70 GNUNET_free(ego);
@@ -112,7 +118,9 @@ clear_ego_store(struct GNUNET_MESSENGER_EgoStore *store)
112} 118}
113 119
114static void 120static void
115callback_ego_create (void *cls, const struct GNUNET_IDENTITY_PrivateKey *key, const char *emsg) 121callback_ego_create (void *cls,
122 const struct GNUNET_IDENTITY_PrivateKey *key,
123 const char *emsg)
116{ 124{
117 struct GNUNET_MESSENGER_EgoOperation *element = cls; 125 struct GNUNET_MESSENGER_EgoOperation *element = cls;
118 struct GNUNET_MESSENGER_EgoStore *store = element->store; 126 struct GNUNET_MESSENGER_EgoStore *store = element->store;
@@ -139,7 +147,8 @@ callback_ego_create (void *cls, const struct GNUNET_IDENTITY_PrivateKey *key, co
139} 147}
140 148
141void 149void
142create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, 150create_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
151 const char *identifier,
143 void *handle) 152 void *handle)
144{ 153{
145 GNUNET_assert ((store) && (identifier)); 154 GNUNET_assert ((store) && (identifier));
@@ -158,7 +167,8 @@ create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie
158} 167}
159 168
160static void 169static void
161callback_ego_lookup (void *cls, struct GNUNET_IDENTITY_Ego *ego) 170callback_ego_lookup (void *cls,
171 struct GNUNET_IDENTITY_Ego *ego)
162{ 172{
163 struct GNUNET_MESSENGER_EgoLookup *element = cls; 173 struct GNUNET_MESSENGER_EgoLookup *element = cls;
164 struct GNUNET_MESSENGER_EgoStore *store = element->store; 174 struct GNUNET_MESSENGER_EgoStore *store = element->store;
@@ -183,8 +193,10 @@ callback_ego_lookup (void *cls, struct GNUNET_IDENTITY_Ego *ego)
183} 193}
184 194
185void 195void
186lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, 196lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store,
187 GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls) 197 const char *identifier,
198 GNUNET_MESSENGER_EgoLookupCallback lookup,
199 void *cls)
188{ 200{
189 GNUNET_assert (store); 201 GNUNET_assert (store);
190 202
@@ -219,7 +231,8 @@ lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier
219} 231}
220 232
221struct GNUNET_MESSENGER_Ego* 233struct GNUNET_MESSENGER_Ego*
222update_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, 234update_store_ego(struct GNUNET_MESSENGER_EgoStore *store,
235 const char *identifier,
223 const struct GNUNET_IDENTITY_PrivateKey *key) 236 const struct GNUNET_IDENTITY_PrivateKey *key)
224{ 237{
225 GNUNET_assert ((store) && (identifier) && (key)); 238 GNUNET_assert ((store) && (identifier) && (key));
@@ -244,7 +257,8 @@ update_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier
244} 257}
245 258
246static void 259static void
247callback_ego_rename (void *cls, const char *emsg) 260callback_ego_rename (void *cls,
261 const char *emsg)
248{ 262{
249 struct GNUNET_MESSENGER_EgoOperation *element = cls; 263 struct GNUNET_MESSENGER_EgoOperation *element = cls;
250 struct GNUNET_MESSENGER_EgoStore *store = element->store; 264 struct GNUNET_MESSENGER_EgoStore *store = element->store;
@@ -277,7 +291,8 @@ callback_ego_rename (void *cls, const char *emsg)
277} 291}
278 292
279void 293void
280rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier, 294rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
295 const char *old_identifier,
281 const char *new_identifier) 296 const char *new_identifier)
282{ 297{
283 GNUNET_assert ((store) && (old_identifier) && (new_identifier)); 298 GNUNET_assert ((store) && (old_identifier) && (new_identifier));
diff --git a/src/messenger/gnunet-service-messenger_ego_store.h b/src/messenger/gnunet-service-messenger_ego_store.h
index 41f14fff2..4222a4e91 100644
--- a/src/messenger/gnunet-service-messenger_ego_store.h
+++ b/src/messenger/gnunet-service-messenger_ego_store.h
@@ -35,7 +35,8 @@ struct GNUNET_MESSENGER_Ego;
35struct GNUNET_MESSENGER_EgoStore; 35struct GNUNET_MESSENGER_EgoStore;
36 36
37typedef void 37typedef void
38(*GNUNET_MESSENGER_EgoLookupCallback) (void *cls, const char *identifier, 38(*GNUNET_MESSENGER_EgoLookupCallback) (void *cls,
39 const char *identifier,
39 const struct GNUNET_MESSENGER_Ego *ego); 40 const struct GNUNET_MESSENGER_Ego *ego);
40 41
41struct GNUNET_MESSENGER_EgoLookup 42struct GNUNET_MESSENGER_EgoLookup
@@ -87,7 +88,8 @@ struct GNUNET_MESSENGER_EgoStore
87 * @param[in] config Configuration handle 88 * @param[in] config Configuration handle
88 */ 89 */
89void 90void
90init_ego_store (struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config); 91init_ego_store (struct GNUNET_MESSENGER_EgoStore *store,
92 const struct GNUNET_CONFIGURATION_Handle *config);
91 93
92/** 94/**
93 * Clears an EGO-store, wipes its content and deallocates its memory. 95 * Clears an EGO-store, wipes its content and deallocates its memory.
@@ -107,7 +109,8 @@ clear_ego_store (struct GNUNET_MESSENGER_EgoStore *store);
107 * @param[in/out] handle Handle or NULL 109 * @param[in/out] handle Handle or NULL
108 */ 110 */
109void 111void
110create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, 112create_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
113 const char *identifier,
111 void *handle); 114 void *handle);
112 115
113/** 116/**
@@ -120,8 +123,10 @@ create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie
120 * @param[in] cls Closure 123 * @param[in] cls Closure
121 */ 124 */
122void 125void
123lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, 126lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
124 GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls); 127 const char *identifier,
128 GNUNET_MESSENGER_EgoLookupCallback lookup,
129 void *cls);
125 130
126/** 131/**
127 * Updates the registration of an EGO to a <i>store</i> under 132 * Updates the registration of an EGO to a <i>store</i> under
@@ -133,7 +138,8 @@ lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie
133 * @return Updated EGO 138 * @return Updated EGO
134 */ 139 */
135struct GNUNET_MESSENGER_Ego* 140struct GNUNET_MESSENGER_Ego*
136update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, 141update_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
142 const char *identifier,
137 const struct GNUNET_IDENTITY_PrivateKey *key); 143 const struct GNUNET_IDENTITY_PrivateKey *key);
138 144
139/** 145/**
@@ -146,7 +152,8 @@ update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie
146 * @param[in] new_identifier New identifier string 152 * @param[in] new_identifier New identifier string
147 */ 153 */
148void 154void
149rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier, 155rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
156 const char *old_identifier,
150 const char *new_identifier); 157 const char *new_identifier);
151 158
152#endif //GNUNET_SERVICE_MESSENGER_EGO_STORE_H 159#endif //GNUNET_SERVICE_MESSENGER_EGO_STORE_H
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;
diff --git a/src/messenger/gnunet-service-messenger_handle.h b/src/messenger/gnunet-service-messenger_handle.h
index d8ff3aaa8..97a984721 100644
--- a/src/messenger/gnunet-service-messenger_handle.h
+++ b/src/messenger/gnunet-service-messenger_handle.h
@@ -60,7 +60,8 @@ struct GNUNET_MESSENGER_SrvHandle
60 * @return New handle 60 * @return New handle
61 */ 61 */
62struct GNUNET_MESSENGER_SrvHandle* 62struct GNUNET_MESSENGER_SrvHandle*
63create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq); 63create_handle (struct GNUNET_MESSENGER_Service *service,
64 struct GNUNET_MQ_Handle *mq);
64 65
65/** 66/**
66 * Destroys a handle and frees its memory fully. 67 * Destroys a handle and frees its memory fully.
@@ -79,7 +80,9 @@ destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle);
79 * @param[out] dir Path to store data 80 * @param[out] dir Path to store data
80 */ 81 */
81void 82void
82get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir); 83get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle,
84 const char *name,
85 char **dir);
83 86
84/** 87/**
85 * Returns the member id of a given <i>handle</i> in a specific <i>room</i>. 88 * Returns the member id of a given <i>handle</i> in a specific <i>room</i>.
@@ -91,7 +94,8 @@ get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const c
91 * @return Member id or NULL 94 * @return Member id or NULL
92 */ 95 */
93const struct GNUNET_ShortHashCode* 96const struct GNUNET_ShortHashCode*
94get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); 97get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle,
98 const struct GNUNET_HashCode *key);
95 99
96/** 100/**
97 * Changes the member id of a given <i>handle</i> in a specific <i>room</i> to match a <i>unique_id</i> 101 * Changes the member id of a given <i>handle</i> in a specific <i>room</i> to match a <i>unique_id</i>
@@ -105,7 +109,8 @@ get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const str
105 * @return GNUNET_OK on success, otherwise GNUNET_SYSERR 109 * @return GNUNET_OK on success, otherwise GNUNET_SYSERR
106 */ 110 */
107int 111int
108change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, 112change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle,
113 const struct GNUNET_HashCode *key,
109 const struct GNUNET_ShortHashCode *unique_id); 114 const struct GNUNET_ShortHashCode *unique_id);
110 115
111/** 116/**
@@ -115,7 +120,8 @@ change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct
115 * @param[in] ego EGO key pair 120 * @param[in] ego EGO key pair
116 */ 121 */
117void 122void
118set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego); 123set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle,
124 const struct GNUNET_MESSENGER_Ego *ego);
119 125
120/** 126/**
121 * Returns the EGO used by a given <i>handle</i>. 127 * Returns the EGO used by a given <i>handle</i>.
@@ -133,7 +139,8 @@ get_handle_ego (const struct GNUNET_MESSENGER_SrvHandle *handle);
133 * @param[in] name Name (optionally: valid EGO name) 139 * @param[in] name Name (optionally: valid EGO name)
134 */ 140 */
135void 141void
136setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); 142setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
143 const char *name);
137 144
138/** 145/**
139 * Tries to change the key pair of an EGO of a <i>handle</i> under the same name and informs all rooms 146 * Tries to change the key pair of an EGO of a <i>handle</i> under the same name and informs all rooms
@@ -154,7 +161,8 @@ update_handle (struct GNUNET_MESSENGER_SrvHandle *handle);
154 * @param[in] name New name 161 * @param[in] name New name
155 */ 162 */
156void 163void
157set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); 164set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
165 const char *name);
158 166
159/** 167/**
160 * Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and opens the 168 * Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and opens the
@@ -165,7 +173,8 @@ set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name);
165 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 173 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
166 */ 174 */
167int 175int
168open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); 176open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
177 const struct GNUNET_HashCode *key);
169 178
170/** 179/**
171 * Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and enters the room 180 * Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and enters the room
@@ -177,7 +186,8 @@ open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET
177 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 186 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
178 */ 187 */
179int 188int
180entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, 189entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
190 const struct GNUNET_PeerIdentity *door,
181 const struct GNUNET_HashCode *key); 191 const struct GNUNET_HashCode *key);
182 192
183/** 193/**
@@ -189,7 +199,8 @@ entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE
189 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 199 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
190 */ 200 */
191int 201int
192close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); 202close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
203 const struct GNUNET_HashCode *key);
193 204
194/** 205/**
195 * Sends a <i>message</i> from a given <i>handle</i> to the room using a specific <i>key</i>. 206 * Sends a <i>message</i> from a given <i>handle</i> to the room using a specific <i>key</i>.
@@ -200,7 +211,8 @@ close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE
200 * @return #GNUNET_YES on success, #GNUNET_NO or #GNUNET_SYSERR otherwise. 211 * @return #GNUNET_YES on success, #GNUNET_NO or #GNUNET_SYSERR otherwise.
201 */ 212 */
202int 213int
203send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, 214send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
215 const struct GNUNET_HashCode *key,
204 const struct GNUNET_MESSENGER_Message *message); 216 const struct GNUNET_MESSENGER_Message *message);
205 217
206/** 218/**
@@ -213,9 +225,11 @@ send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNU
213 * @param[in] hash Hash of message 225 * @param[in] hash Hash of message
214 */ 226 */
215void 227void
216notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, 228notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
229 const struct GNUNET_HashCode *key,
217 const struct GNUNET_MESSENGER_MemberSession *session, 230 const struct GNUNET_MESSENGER_MemberSession *session,
218 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 231 const struct GNUNET_MESSENGER_Message *message,
232 const struct GNUNET_HashCode *hash);
219 233
220/** 234/**
221 * Loads member ids and other potential configuration from a given <i>handle</i> which 235 * Loads member ids and other potential configuration from a given <i>handle</i> which
diff --git a/src/messenger/gnunet-service-messenger_list_handles.c b/src/messenger/gnunet-service-messenger_list_handles.c
index adcbf6a42..c0ae18716 100644
--- a/src/messenger/gnunet-service-messenger_list_handles.c
+++ b/src/messenger/gnunet-service-messenger_list_handles.c
@@ -55,7 +55,8 @@ clear_list_handles (struct GNUNET_MESSENGER_ListHandles *handles)
55} 55}
56 56
57void 57void
58add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle) 58add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles,
59 struct GNUNET_MESSENGER_SrvHandle *handle)
59{ 60{
60 GNUNET_assert((handles) && (handle)); 61 GNUNET_assert((handles) && (handle));
61 62
@@ -67,7 +68,8 @@ add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MES
67} 68}
68 69
69int 70int
70remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle) 71remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles,
72 struct GNUNET_MESSENGER_SrvHandle *handle)
71{ 73{
72 GNUNET_assert((handles) && (handle)); 74 GNUNET_assert((handles) && (handle));
73 75
@@ -87,7 +89,8 @@ remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_
87} 89}
88 90
89struct GNUNET_MESSENGER_SrvHandle* 91struct GNUNET_MESSENGER_SrvHandle*
90find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key) 92find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles,
93 const struct GNUNET_HashCode *key)
91{ 94{
92 GNUNET_assert((handles) && (key)); 95 GNUNET_assert((handles) && (key));
93 96
diff --git a/src/messenger/gnunet-service-messenger_list_handles.h b/src/messenger/gnunet-service-messenger_list_handles.h
index 9f7ca725f..f4d7ca5c0 100644
--- a/src/messenger/gnunet-service-messenger_list_handles.h
+++ b/src/messenger/gnunet-service-messenger_list_handles.h
@@ -69,7 +69,8 @@ clear_list_handles (struct GNUNET_MESSENGER_ListHandles *handles);
69 * @param[in/out] handle Handle 69 * @param[in/out] handle Handle
70 */ 70 */
71void 71void
72add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle); 72add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles,
73 struct GNUNET_MESSENGER_SrvHandle *handle);
73 74
74/** 75/**
75 * Removes the first entry matching with a specific <i>handle</i> from the list of 76 * Removes the first entry matching with a specific <i>handle</i> from the list of
@@ -80,7 +81,8 @@ add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MES
80 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 81 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
81 */ 82 */
82int 83int
83remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle); 84remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles,
85 struct GNUNET_MESSENGER_SrvHandle *handle);
84 86
85/** 87/**
86 * Searches linearly through the list of <i>handles</i> for members of a specific room 88 * Searches linearly through the list of <i>handles</i> for members of a specific room
@@ -93,6 +95,7 @@ remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_
93 * @return First handle which is a current member 95 * @return First handle which is a current member
94 */ 96 */
95struct GNUNET_MESSENGER_SrvHandle* 97struct GNUNET_MESSENGER_SrvHandle*
96find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key); 98find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles,
99 const struct GNUNET_HashCode *key);
97 100
98#endif //GNUNET_SERVICE_MESSENGER_LIST_HANDLES_H 101#endif //GNUNET_SERVICE_MESSENGER_LIST_HANDLES_H
diff --git a/src/messenger/gnunet-service-messenger_list_messages.c b/src/messenger/gnunet-service-messenger_list_messages.c
index 2666ccdab..7092dc76f 100644
--- a/src/messenger/gnunet-service-messenger_list_messages.c
+++ b/src/messenger/gnunet-service-messenger_list_messages.c
@@ -52,7 +52,8 @@ clear_list_messages (struct GNUNET_MESSENGER_ListMessages *messages)
52} 52}
53 53
54void 54void
55add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash) 55add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
56 const struct GNUNET_HashCode *hash)
56{ 57{
57 GNUNET_assert((messages) && (hash)); 58 GNUNET_assert((messages) && (hash));
58 59
@@ -64,7 +65,8 @@ add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const stru
64} 65}
65 66
66void 67void
67copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_MESSENGER_ListMessages *origin) 68copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
69 const struct GNUNET_MESSENGER_ListMessages *origin)
68{ 70{
69 GNUNET_assert((messages) && (origin)); 71 GNUNET_assert((messages) && (origin));
70 72
@@ -75,7 +77,8 @@ copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct
75} 77}
76 78
77void 79void
78remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash) 80remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
81 const struct GNUNET_HashCode *hash)
79{ 82{
80 GNUNET_assert((messages) && (hash)); 83 GNUNET_assert((messages) && (hash));
81 84
@@ -91,7 +94,8 @@ remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const
91} 94}
92 95
93void 96void
94load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path) 97load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
98 const char *path)
95{ 99{
96 GNUNET_assert((messages) && (path)); 100 GNUNET_assert((messages) && (path));
97 101
@@ -125,7 +129,8 @@ load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *
125} 129}
126 130
127void 131void
128save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages, const char *path) 132save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages,
133 const char *path)
129{ 134{
130 GNUNET_assert((messages) && (path)); 135 GNUNET_assert((messages) && (path));
131 136
diff --git a/src/messenger/gnunet-service-messenger_list_messages.h b/src/messenger/gnunet-service-messenger_list_messages.h
index 93ec203ea..7abc8c00f 100644
--- a/src/messenger/gnunet-service-messenger_list_messages.h
+++ b/src/messenger/gnunet-service-messenger_list_messages.h
@@ -68,7 +68,8 @@ clear_list_messages (struct GNUNET_MESSENGER_ListMessages *messages);
68 * @param[in] hash Hash of message 68 * @param[in] hash Hash of message
69 */ 69 */
70void 70void
71add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash); 71add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
72 const struct GNUNET_HashCode *hash);
72 73
73/** 74/**
74 * Copies all message hashes from an <i>origin</i> to another list. 75 * Copies all message hashes from an <i>origin</i> to another list.
@@ -77,7 +78,8 @@ add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const stru
77 * @param[in] origin Source list of hashes 78 * @param[in] origin Source list of hashes
78 */ 79 */
79void 80void
80copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_MESSENGER_ListMessages *origin); 81copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
82 const struct GNUNET_MESSENGER_ListMessages *origin);
81 83
82/** 84/**
83 * Removes the first entry with a matching <i>hash</i> from the list. 85 * Removes the first entry with a matching <i>hash</i> from the list.
@@ -86,7 +88,8 @@ copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct
86 * @param[in] hash Hash of message 88 * @param[in] hash Hash of message
87 */ 89 */
88void 90void
89remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash); 91remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
92 const struct GNUNET_HashCode *hash);
90 93
91/** 94/**
92 * Loads the list of message hashes from a file under a given <i>path</i>. 95 * Loads the list of message hashes from a file under a given <i>path</i>.
@@ -95,7 +98,8 @@ remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const
95 * @param[in] path Path of file 98 * @param[in] path Path of file
96 */ 99 */
97void 100void
98load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path); 101load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
102 const char *path);
99 103
100/** 104/**
101 * Saves the list of message hashes to a file under a given <i>path</i>. 105 * Saves the list of message hashes to a file under a given <i>path</i>.
@@ -104,6 +108,7 @@ load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *
104 * @param[in] path Path of file 108 * @param[in] path Path of file
105 */ 109 */
106void 110void
107save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages, const char *path); 111save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages,
112 const char *path);
108 113
109#endif //GNUNET_SERVICE_MESSENGER_LIST_MESSAGES_H 114#endif //GNUNET_SERVICE_MESSENGER_LIST_MESSAGES_H
diff --git a/src/messenger/gnunet-service-messenger_member.c b/src/messenger/gnunet-service-messenger_member.c
index b0a735dbe..def57aef9 100644
--- a/src/messenger/gnunet-service-messenger_member.c
+++ b/src/messenger/gnunet-service-messenger_member.c
@@ -28,7 +28,8 @@
28#include "gnunet-service-messenger_member_session.h" 28#include "gnunet-service-messenger_member_session.h"
29 29
30struct GNUNET_MESSENGER_Member* 30struct GNUNET_MESSENGER_Member*
31create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) 31create_member (struct GNUNET_MESSENGER_MemberStore *store,
32 const struct GNUNET_ShortHashCode *id)
32{ 33{
33 GNUNET_assert (store); 34 GNUNET_assert (store);
34 35
@@ -50,7 +51,9 @@ create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_S
50} 51}
51 52
52static int 53static int
53iterate_destroy_session (void *cls, const struct GNUNET_HashCode *key, void *value) 54iterate_destroy_session (void *cls,
55 const struct GNUNET_HashCode *key,
56 void *value)
54{ 57{
55 struct GNUNET_MESSENGER_MemberSession *session = value; 58 struct GNUNET_MESSENGER_MemberSession *session = value;
56 destroy_member_session(session); 59 destroy_member_session(session);
@@ -77,7 +80,8 @@ get_member_id (const struct GNUNET_MESSENGER_Member *member)
77} 80}
78 81
79static int 82static int
80callback_scan_for_sessions (void *cls, const char *filename) 83callback_scan_for_sessions (void *cls,
84 const char *filename)
81{ 85{
82 struct GNUNET_MESSENGER_Member *member = cls; 86 struct GNUNET_MESSENGER_Member *member = cls;
83 87
@@ -95,7 +99,8 @@ callback_scan_for_sessions (void *cls, const char *filename)
95} 99}
96 100
97void 101void
98load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) 102load_member (struct GNUNET_MESSENGER_MemberStore *store,
103 const char *directory)
99{ 104{
100 GNUNET_assert ((store) && (directory)); 105 GNUNET_assert ((store) && (directory));
101 106
@@ -139,7 +144,9 @@ free_config:
139} 144}
140 145
141static int 146static int
142iterate_load_next_session (void *cls, const struct GNUNET_HashCode *key, void *value) 147iterate_load_next_session (void *cls,
148 const struct GNUNET_HashCode *key,
149 void *value)
143{ 150{
144 const char* sessions_directory = cls; 151 const char* sessions_directory = cls;
145 152
@@ -156,7 +163,8 @@ iterate_load_next_session (void *cls, const struct GNUNET_HashCode *key, void *v
156} 163}
157 164
158void 165void
159load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory) 166load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member,
167 const char *directory)
160{ 168{
161 GNUNET_assert ((member) && (directory)); 169 GNUNET_assert ((member) && (directory));
162 170
@@ -169,7 +177,9 @@ load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const c
169} 177}
170 178
171static int 179static int
172iterate_save_session (void *cls, const struct GNUNET_HashCode *key, void *value) 180iterate_save_session (void *cls,
181 const struct GNUNET_HashCode *key,
182 void *value)
173{ 183{
174 const char* sessions_directory = cls; 184 const char* sessions_directory = cls;
175 185
@@ -187,7 +197,8 @@ iterate_save_session (void *cls, const struct GNUNET_HashCode *key, void *value)
187} 197}
188 198
189void 199void
190save_member (struct GNUNET_MESSENGER_Member *member, const char *directory) 200save_member (struct GNUNET_MESSENGER_Member *member,
201 const char *directory)
191{ 202{
192 GNUNET_assert ((member) && (directory)); 203 GNUNET_assert ((member) && (directory));
193 204
@@ -221,7 +232,8 @@ save_member (struct GNUNET_MESSENGER_Member *member, const char *directory)
221} 232}
222 233
223static void 234static void
224sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_MESSENGER_MemberSession *next) 235sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session,
236 struct GNUNET_MESSENGER_MemberSession *next)
225{ 237{
226 GNUNET_assert((session) && (next)); 238 GNUNET_assert((session) && (next));
227 239
@@ -235,7 +247,9 @@ sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session,
235} 247}
236 248
237static int 249static int
238iterate_sync_session_contact (void *cls, const struct GNUNET_HashCode *key, void *value) 250iterate_sync_session_contact (void *cls,
251 const struct GNUNET_HashCode *key,
252 void *value)
239{ 253{
240 struct GNUNET_MESSENGER_MemberSession *session = value; 254 struct GNUNET_MESSENGER_MemberSession *session = value;
241 255
@@ -254,7 +268,8 @@ sync_member_contacts (struct GNUNET_MESSENGER_Member *member)
254} 268}
255 269
256struct GNUNET_MESSENGER_MemberSession* 270struct GNUNET_MESSENGER_MemberSession*
257get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key) 271get_member_session (const struct GNUNET_MESSENGER_Member *member,
272 const struct GNUNET_IDENTITY_PublicKey *public_key)
258{ 273{
259 GNUNET_assert ((member) && (public_key)); 274 GNUNET_assert ((member) && (public_key));
260 275
@@ -272,7 +287,9 @@ struct GNUNET_MESSENGER_ClosureSearchSession {
272}; 287};
273 288
274static int 289static int
275iterate_search_session (void *cls, const struct GNUNET_HashCode *key, void *value) 290iterate_search_session (void *cls,
291 const struct GNUNET_HashCode *key,
292 void *value)
276{ 293{
277 struct GNUNET_MESSENGER_ClosureSearchSession* search = cls; 294 struct GNUNET_MESSENGER_ClosureSearchSession* search = cls;
278 struct GNUNET_MESSENGER_MemberSession *session = value; 295 struct GNUNET_MESSENGER_MemberSession *session = value;
@@ -285,7 +302,8 @@ iterate_search_session (void *cls, const struct GNUNET_HashCode *key, void *valu
285} 302}
286 303
287static struct GNUNET_MESSENGER_MemberSession* 304static struct GNUNET_MESSENGER_MemberSession*
288try_member_session (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key) 305try_member_session (struct GNUNET_MESSENGER_Member *member,
306 const struct GNUNET_IDENTITY_PublicKey *public_key)
289{ 307{
290 struct GNUNET_MESSENGER_MemberSession* session = get_member_session(member, public_key); 308 struct GNUNET_MESSENGER_MemberSession* session = get_member_session(member, public_key);
291 309
@@ -301,7 +319,8 @@ try_member_session (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_
301} 319}
302 320
303struct GNUNET_MESSENGER_MemberSession* 321struct GNUNET_MESSENGER_MemberSession*
304get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message, 322get_member_session_of (struct GNUNET_MESSENGER_Member *member,
323 const struct GNUNET_MESSENGER_Message *message,
305 const struct GNUNET_HashCode *hash) 324 const struct GNUNET_HashCode *hash)
306{ 325{
307 GNUNET_assert ((member) && (message) && (hash) && 326 GNUNET_assert ((member) && (message) && (hash) &&
@@ -324,7 +343,8 @@ get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUN
324} 343}
325 344
326void 345void
327add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session) 346add_member_session (struct GNUNET_MESSENGER_Member *member,
347 struct GNUNET_MESSENGER_MemberSession *session)
328{ 348{
329 if (!session) 349 if (!session)
330 return; 350 return;
@@ -344,7 +364,8 @@ add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSEN
344} 364}
345 365
346void 366void
347remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session) 367remove_member_session (struct GNUNET_MESSENGER_Member *member,
368 struct GNUNET_MESSENGER_MemberSession *session)
348{ 369{
349 GNUNET_assert ((member) && (session) && (session->member == member)); 370 GNUNET_assert ((member) && (session) && (session->member == member));
350 371
@@ -364,7 +385,9 @@ struct GNUNET_MESSENGER_ClosureIterateSessions {
364}; 385};
365 386
366static int 387static int
367iterate_member_sessions_it (void *cls, const struct GNUNET_HashCode *key, void *value) 388iterate_member_sessions_it (void *cls,
389 const struct GNUNET_HashCode *key,
390 void *value)
368{ 391{
369 struct GNUNET_MESSENGER_ClosureIterateSessions *iterate = cls; 392 struct GNUNET_MESSENGER_ClosureIterateSessions *iterate = cls;
370 struct GNUNET_MESSENGER_MemberSession *session = value; 393 struct GNUNET_MESSENGER_MemberSession *session = value;
@@ -373,7 +396,9 @@ iterate_member_sessions_it (void *cls, const struct GNUNET_HashCode *key, void *
373} 396}
374 397
375int 398int
376iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void *cls) 399iterate_member_sessions (struct GNUNET_MESSENGER_Member *member,
400 GNUNET_MESSENGER_MemberIteratorCallback it,
401 void *cls)
377{ 402{
378 GNUNET_assert ((member) && (member->sessions) && (it)); 403 GNUNET_assert ((member) && (member->sessions) && (it));
379 404
diff --git a/src/messenger/gnunet-service-messenger_member.h b/src/messenger/gnunet-service-messenger_member.h
index fb2e57cfb..46269315a 100644
--- a/src/messenger/gnunet-service-messenger_member.h
+++ b/src/messenger/gnunet-service-messenger_member.h
@@ -52,7 +52,8 @@ struct GNUNET_MESSENGER_Member
52 * @return New member or NULL 52 * @return New member or NULL
53 */ 53 */
54struct GNUNET_MESSENGER_Member* 54struct GNUNET_MESSENGER_Member*
55create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); 55create_member (struct GNUNET_MESSENGER_MemberStore *store,
56 const struct GNUNET_ShortHashCode *id);
56 57
57/** 58/**
58 * Destroys a member and frees its memory fully. 59 * Destroys a member and frees its memory fully.
@@ -80,7 +81,8 @@ get_member_id (const struct GNUNET_MESSENGER_Member *member);
80 * @param[in] directory Path to a directory 81 * @param[in] directory Path to a directory
81 */ 82 */
82void 83void
83load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); 84load_member (struct GNUNET_MESSENGER_MemberStore *store,
85 const char *directory);
84 86
85/** 87/**
86 * Loads data about next sessions from a <i>directory</i> into an empty loaded 88 * Loads data about next sessions from a <i>directory</i> into an empty loaded
@@ -90,7 +92,8 @@ load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory);
90 * @param[in] directory Path to a directory 92 * @param[in] directory Path to a directory
91 */ 93 */
92void 94void
93load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory); 95load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member,
96 const char *directory);
94 97
95/** 98/**
96 * Saves data from a <i>member</i> into a directory which 99 * Saves data from a <i>member</i> into a directory which
@@ -100,7 +103,8 @@ load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const c
100 * @param[in] directory Path to a directory 103 * @param[in] directory Path to a directory
101 */ 104 */
102void 105void
103save_member (struct GNUNET_MESSENGER_Member *member, const char *directory); 106save_member (struct GNUNET_MESSENGER_Member *member,
107 const char *directory);
104 108
105/** 109/**
106 * Synchronizes contacts between all sessions from a given <i>member</i> 110 * Synchronizes contacts between all sessions from a given <i>member</i>
@@ -120,7 +124,8 @@ sync_member_contacts (struct GNUNET_MESSENGER_Member *member);
120 * @return Member session 124 * @return Member session
121 */ 125 */
122struct GNUNET_MESSENGER_MemberSession* 126struct GNUNET_MESSENGER_MemberSession*
123get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key); 127get_member_session (const struct GNUNET_MESSENGER_Member *member,
128 const struct GNUNET_IDENTITY_PublicKey *public_key);
124 129
125/** 130/**
126 * Returns the member session of a <i>member</i> using a public key which can verify 131 * Returns the member session of a <i>member</i> using a public key which can verify
@@ -133,7 +138,8 @@ get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct G
133 * @return Member session 138 * @return Member session
134 */ 139 */
135struct GNUNET_MESSENGER_MemberSession* 140struct GNUNET_MESSENGER_MemberSession*
136get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message, 141get_member_session_of (struct GNUNET_MESSENGER_Member *member,
142 const struct GNUNET_MESSENGER_Message *message,
137 const struct GNUNET_HashCode *hash); 143 const struct GNUNET_HashCode *hash);
138 144
139/** 145/**
@@ -143,7 +149,8 @@ get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUN
143 * @param[in/out] session Member session 149 * @param[in/out] session Member session
144 */ 150 */
145void 151void
146add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session); 152add_member_session (struct GNUNET_MESSENGER_Member *member,
153 struct GNUNET_MESSENGER_MemberSession *session);
147 154
148/** 155/**
149 * Removes a given member <i>session</i> from its <i>member</i>. 156 * Removes a given member <i>session</i> from its <i>member</i>.
@@ -152,7 +159,8 @@ add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSEN
152 * @param[in/out] session Member session 159 * @param[in/out] session Member session
153 */ 160 */
154void 161void
155remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session); 162remove_member_session (struct GNUNET_MESSENGER_Member *member,
163 struct GNUNET_MESSENGER_MemberSession *session);
156 164
157/** 165/**
158 * Iterate through all member sessions currently connected to a given <i>member</i> 166 * Iterate through all member sessions currently connected to a given <i>member</i>
@@ -165,6 +173,8 @@ remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MES
165 * @return Amount of sessions iterated through 173 * @return Amount of sessions iterated through
166 */ 174 */
167int 175int
168iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void* cls); 176iterate_member_sessions (struct GNUNET_MESSENGER_Member *member,
177 GNUNET_MESSENGER_MemberIteratorCallback it,
178 void* cls);
169 179
170#endif //GNUNET_SERVICE_MESSENGER_MEMBER_H 180#endif //GNUNET_SERVICE_MESSENGER_MEMBER_H
diff --git a/src/messenger/gnunet-service-messenger_member_session.c b/src/messenger/gnunet-service-messenger_member_session.c
index 690c703b2..03736941f 100644
--- a/src/messenger/gnunet-service-messenger_member_session.c
+++ b/src/messenger/gnunet-service-messenger_member_session.c
@@ -158,7 +158,9 @@ completion:
158} 158}
159 159
160static int 160static int
161iterate_copy_history (void *cls, const struct GNUNET_HashCode *key, void *value) 161iterate_copy_history (void *cls,
162 const struct GNUNET_HashCode *key,
163 void *value)
162{ 164{
163 struct GNUNET_MESSENGER_MemberSession *next = cls; 165 struct GNUNET_MESSENGER_MemberSession *next = cls;
164 166
@@ -460,7 +462,8 @@ struct GNUNET_MESSENGER_MemberSessionHistoryEntry
460}; 462};
461 463
462static void 464static void
463load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, const char *path) 465load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session,
466 const char *path)
464{ 467{
465 GNUNET_assert((session) && (path)); 468 GNUNET_assert((session) && (path));
466 469
@@ -502,7 +505,8 @@ load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, con
502} 505}
503 506
504void 507void
505load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory) 508load_member_session (struct GNUNET_MESSENGER_Member *member,
509 const char *directory)
506{ 510{
507 GNUNET_assert ((member) && (directory)); 511 GNUNET_assert ((member) && (directory));
508 512
@@ -571,7 +575,8 @@ free_config:
571} 575}
572 576
573static struct GNUNET_MESSENGER_MemberSession* 577static struct GNUNET_MESSENGER_MemberSession*
574get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_MESSENGER_MemberSession *next) 578get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session,
579 struct GNUNET_MESSENGER_MemberSession *next)
575{ 580{
576 if (!next) 581 if (!next)
577 return NULL; 582 return NULL;
@@ -589,7 +594,8 @@ get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session, str
589} 594}
590 595
591void 596void
592load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory) 597load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session,
598 const char *directory)
593{ 599{
594 GNUNET_assert ((session) && (directory)); 600 GNUNET_assert ((session) && (directory));
595 601
@@ -640,7 +646,9 @@ free_config:
640} 646}
641 647
642static int 648static int
643iterate_save_member_session_history_hentries (void *cls, const struct GNUNET_HashCode *key, void *value) 649iterate_save_member_session_history_hentries (void *cls,
650 const struct GNUNET_HashCode *key,
651 void *value)
644{ 652{
645 struct GNUNET_DISK_FileHandle *handle = cls; 653 struct GNUNET_DISK_FileHandle *handle = cls;
646 unsigned char ownership = value? GNUNET_YES : GNUNET_NO; 654 unsigned char ownership = value? GNUNET_YES : GNUNET_NO;
@@ -652,7 +660,8 @@ iterate_save_member_session_history_hentries (void *cls, const struct GNUNET_Has
652} 660}
653 661
654static void 662static void
655save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, const char *path) 663save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session,
664 const char *path)
656{ 665{
657 GNUNET_assert((session) && (path)); 666 GNUNET_assert((session) && (path));
658 667
@@ -678,7 +687,8 @@ save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, con
678} 687}
679 688
680void 689void
681save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory) 690save_member_session (struct GNUNET_MESSENGER_MemberSession *session,
691 const char *directory)
682{ 692{
683 GNUNET_assert ((session) && (directory)); 693 GNUNET_assert ((session) && (directory));
684 694
diff --git a/src/messenger/gnunet-service-messenger_member_session.h b/src/messenger/gnunet-service-messenger_member_session.h
index bf4d10f67..9ba801776 100644
--- a/src/messenger/gnunet-service-messenger_member_session.h
+++ b/src/messenger/gnunet-service-messenger_member_session.h
@@ -225,7 +225,8 @@ verify_member_session_as_sender (const struct GNUNET_MESSENGER_MemberSession *se
225 */ 225 */
226int 226int
227check_member_session_history (const struct GNUNET_MESSENGER_MemberSession *session, 227check_member_session_history (const struct GNUNET_MESSENGER_MemberSession *session,
228 const struct GNUNET_HashCode *hash, int ownership); 228 const struct GNUNET_HashCode *hash,
229 int ownership);
229 230
230/** 231/**
231 * Adds a given <i>message</i> to the history of a <i>session</i> using the messages 232 * Adds a given <i>message</i> to the history of a <i>session</i> using the messages
@@ -262,7 +263,8 @@ clear_member_session_history (struct GNUNET_MESSENGER_MemberSession *session,
262 * @param[in] directory Path to a directory 263 * @param[in] directory Path to a directory
263 */ 264 */
264void 265void
265load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory); 266load_member_session (struct GNUNET_MESSENGER_Member *member,
267 const char *directory);
266 268
267/** 269/**
268 * Loads the connection from one <i>session</i> to another through the 270 * Loads the connection from one <i>session</i> to another through the
@@ -273,7 +275,8 @@ load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directo
273 * @param[in] directory Path to a directory 275 * @param[in] directory Path to a directory
274 */ 276 */
275void 277void
276load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory); 278load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session,
279 const char *directory);
277 280
278/** 281/**
279 * Saves data from a member <i>session</i> into a <i>directory</i> which can be 282 * Saves data from a member <i>session</i> into a <i>directory</i> which can be
@@ -283,6 +286,7 @@ load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const
283 * @param[in] directory Path to a directory 286 * @param[in] directory Path to a directory
284 */ 287 */
285void 288void
286save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory); 289save_member_session (struct GNUNET_MESSENGER_MemberSession *session,
290 const char *directory);
287 291
288#endif //GNUNET_SERVICE_MESSENGER_MEMBER_SESSION_H 292#endif //GNUNET_SERVICE_MESSENGER_MEMBER_SESSION_H
diff --git a/src/messenger/gnunet-service-messenger_member_store.c b/src/messenger/gnunet-service-messenger_member_store.c
index 2925965d4..e96ee3883 100644
--- a/src/messenger/gnunet-service-messenger_member_store.c
+++ b/src/messenger/gnunet-service-messenger_member_store.c
@@ -30,7 +30,8 @@
30#include "gnunet-service-messenger_room.h" 30#include "gnunet-service-messenger_room.h"
31 31
32void 32void
33init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room) 33init_member_store (struct GNUNET_MESSENGER_MemberStore *store,
34 struct GNUNET_MESSENGER_SrvRoom *room)
34{ 35{
35 GNUNET_assert ((store) && (room)); 36 GNUNET_assert ((store) && (room));
36 37
@@ -39,7 +40,9 @@ init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MES
39} 40}
40 41
41static int 42static int
42iterate_destroy_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) 43iterate_destroy_members (void *cls,
44 const struct GNUNET_ShortHashCode *key,
45 void *value)
43{ 46{
44 struct GNUNET_MESSENGER_Member *member = value; 47 struct GNUNET_MESSENGER_Member *member = value;
45 destroy_member(member); 48 destroy_member(member);
@@ -75,7 +78,8 @@ get_member_store_key (const struct GNUNET_MESSENGER_MemberStore *store)
75} 78}
76 79
77static int 80static int
78callback_scan_for_members (void *cls, const char *filename) 81callback_scan_for_members (void *cls,
82 const char *filename)
79{ 83{
80 struct GNUNET_MESSENGER_MemberStore *store = cls; 84 struct GNUNET_MESSENGER_MemberStore *store = cls;
81 85
@@ -94,7 +98,9 @@ callback_scan_for_members (void *cls, const char *filename)
94} 98}
95 99
96static int 100static int
97iterate_load_next_member_sessions (void *cls, const struct GNUNET_ShortHashCode *id, void *value) 101iterate_load_next_member_sessions (void *cls,
102 const struct GNUNET_ShortHashCode *id,
103 void *value)
98{ 104{
99 const char *sync_dir = cls; 105 const char *sync_dir = cls;
100 106
@@ -114,7 +120,9 @@ iterate_load_next_member_sessions (void *cls, const struct GNUNET_ShortHashCode
114} 120}
115 121
116static int 122static int
117iterate_sync_member_contacts (void *cls, const struct GNUNET_ShortHashCode *id, void *value) 123iterate_sync_member_contacts (void *cls,
124 const struct GNUNET_ShortHashCode *id,
125 void *value)
118{ 126{
119 struct GNUNET_MESSENGER_Member *member = value; 127 struct GNUNET_MESSENGER_Member *member = value;
120 128
@@ -126,7 +134,8 @@ iterate_sync_member_contacts (void *cls, const struct GNUNET_ShortHashCode *id,
126} 134}
127 135
128void 136void
129load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) 137load_member_store (struct GNUNET_MESSENGER_MemberStore *store,
138 const char *directory)
130{ 139{
131 GNUNET_assert ((store) && (directory)); 140 GNUNET_assert ((store) && (directory));
132 141
@@ -143,7 +152,9 @@ load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc
143} 152}
144 153
145static int 154static int
146iterate_save_members (void *cls, const struct GNUNET_ShortHashCode *id, void *value) 155iterate_save_members (void *cls,
156 const struct GNUNET_ShortHashCode *id,
157 void *value)
147{ 158{
148 const char *save_dir = cls; 159 const char *save_dir = cls;
149 160
@@ -164,7 +175,8 @@ iterate_save_members (void *cls, const struct GNUNET_ShortHashCode *id, void *va
164} 175}
165 176
166void 177void
167save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) 178save_member_store (struct GNUNET_MESSENGER_MemberStore *store,
179 const char *directory)
168{ 180{
169 GNUNET_assert ((store) && (directory)); 181 GNUNET_assert ((store) && (directory));
170 182
@@ -179,7 +191,8 @@ save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc
179} 191}
180 192
181struct GNUNET_MESSENGER_Member* 193struct GNUNET_MESSENGER_Member*
182get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) 194get_store_member (const struct GNUNET_MESSENGER_MemberStore *store,
195 const struct GNUNET_ShortHashCode *id)
183{ 196{
184 GNUNET_assert ((store) && (store->members) && (id)); 197 GNUNET_assert ((store) && (store->members) && (id));
185 198
@@ -187,7 +200,8 @@ get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct
187} 200}
188 201
189struct GNUNET_MESSENGER_Member* 202struct GNUNET_MESSENGER_Member*
190get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message) 203get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store,
204 const struct GNUNET_MESSENGER_Message *message)
191{ 205{
192 if ((GNUNET_MESSENGER_KIND_INFO == message->header.kind) || 206 if ((GNUNET_MESSENGER_KIND_INFO == message->header.kind) ||
193 (GNUNET_MESSENGER_KIND_JOIN == message->header.kind)) 207 (GNUNET_MESSENGER_KIND_JOIN == message->header.kind))
@@ -197,7 +211,8 @@ get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GN
197} 211}
198 212
199struct GNUNET_MESSENGER_Member* 213struct GNUNET_MESSENGER_Member*
200add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) 214add_store_member (struct GNUNET_MESSENGER_MemberStore *store,
215 const struct GNUNET_ShortHashCode *id)
201{ 216{
202 GNUNET_assert ((store) && (store->members)); 217 GNUNET_assert ((store) && (store->members));
203 218
@@ -227,7 +242,9 @@ struct GNUNET_MESSENGER_ClosureIterateMembers {
227}; 242};
228 243
229static int 244static int
230iterate_store_members_it (void *cls, const struct GNUNET_ShortHashCode *key, void *value) 245iterate_store_members_it (void *cls,
246 const struct GNUNET_ShortHashCode *key,
247 void *value)
231{ 248{
232 struct GNUNET_MESSENGER_ClosureIterateMembers *iterate = cls; 249 struct GNUNET_MESSENGER_ClosureIterateMembers *iterate = cls;
233 struct GNUNET_MESSENGER_Member *member = value; 250 struct GNUNET_MESSENGER_Member *member = value;
@@ -236,7 +253,8 @@ iterate_store_members_it (void *cls, const struct GNUNET_ShortHashCode *key, voi
236} 253}
237 254
238int 255int
239iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it, 256iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store,
257 GNUNET_MESSENGER_MemberIteratorCallback it,
240 void* cls) 258 void* cls)
241{ 259{
242 GNUNET_assert ((store) && (store->members) && (it)); 260 GNUNET_assert ((store) && (store->members) && (it));
diff --git a/src/messenger/gnunet-service-messenger_member_store.h b/src/messenger/gnunet-service-messenger_member_store.h
index 859e4683d..af50f0d36 100644
--- a/src/messenger/gnunet-service-messenger_member_store.h
+++ b/src/messenger/gnunet-service-messenger_member_store.h
@@ -56,7 +56,8 @@ typedef int (*GNUNET_MESSENGER_MemberIteratorCallback) (
56 * @param room Room 56 * @param room Room
57 */ 57 */
58void 58void
59init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room); 59init_member_store (struct GNUNET_MESSENGER_MemberStore *store,
60 struct GNUNET_MESSENGER_SrvRoom *room);
60 61
61/** 62/**
62 * Clears a member <i>store</i>, wipes its content and deallocates its memory. 63 * Clears a member <i>store</i>, wipes its content and deallocates its memory.
@@ -91,7 +92,8 @@ get_member_store_key (const struct GNUNET_MESSENGER_MemberStore *store);
91 * @param[in] directory Path to a directory 92 * @param[in] directory Path to a directory
92 */ 93 */
93void 94void
94load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); 95load_member_store (struct GNUNET_MESSENGER_MemberStore *store,
96 const char *directory);
95 97
96/** 98/**
97 * Saves members from a member <i>store</i> into a directory. 99 * Saves members from a member <i>store</i> into a directory.
@@ -100,7 +102,8 @@ load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc
100 * @param[in] directory Path to a directory 102 * @param[in] directory Path to a directory
101 */ 103 */
102void 104void
103save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); 105save_member_store (struct GNUNET_MESSENGER_MemberStore *store,
106 const char *directory);
104 107
105/** 108/**
106 * Returns the member in a <i>store</i> identified by a given <i>id</i>. If the <i>store</i> 109 * Returns the member in a <i>store</i> identified by a given <i>id</i>. If the <i>store</i>
@@ -111,7 +114,8 @@ save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc
111 * @return Member or NULL 114 * @return Member or NULL
112 */ 115 */
113struct GNUNET_MESSENGER_Member* 116struct GNUNET_MESSENGER_Member*
114get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); 117get_store_member (const struct GNUNET_MESSENGER_MemberStore *store,
118 const struct GNUNET_ShortHashCode *id);
115 119
116/** 120/**
117 * Returns the member of a <i>store</i> using a sender id of a given <i>message</i>. 121 * Returns the member of a <i>store</i> using a sender id of a given <i>message</i>.
@@ -122,7 +126,8 @@ get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct
122 * @return Member or NULL 126 * @return Member or NULL
123 */ 127 */
124struct GNUNET_MESSENGER_Member* 128struct GNUNET_MESSENGER_Member*
125get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message); 129get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store,
130 const struct GNUNET_MESSENGER_Message *message);
126 131
127/** 132/**
128 * Adds a member to a <i>store</i> under a specific <i>id</i> and returns it on success. 133 * Adds a member to a <i>store</i> under a specific <i>id</i> and returns it on success.
@@ -132,7 +137,8 @@ get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GN
132 * @return Member or NULL 137 * @return Member or NULL
133 */ 138 */
134struct GNUNET_MESSENGER_Member* 139struct GNUNET_MESSENGER_Member*
135add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); 140add_store_member (struct GNUNET_MESSENGER_MemberStore *store,
141 const struct GNUNET_ShortHashCode *id);
136 142
137/** 143/**
138 * Iterate through all member sessions currently connected to the members of the given 144 * Iterate through all member sessions currently connected to the members of the given
@@ -145,7 +151,8 @@ add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNE
145 * @return Amount of members iterated through 151 * @return Amount of members iterated through
146 */ 152 */
147int 153int
148iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it, 154iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store,
155 GNUNET_MESSENGER_MemberIteratorCallback it,
149 void* cls); 156 void* cls);
150 157
151#endif //GNUNET_SERVICE_MESSENGER_MEMBER_STORE_H 158#endif //GNUNET_SERVICE_MESSENGER_MEMBER_STORE_H
diff --git a/src/messenger/gnunet-service-messenger_message_handle.c b/src/messenger/gnunet-service-messenger_message_handle.c
index 86f2b901a..701d78c89 100644
--- a/src/messenger/gnunet-service-messenger_message_handle.c
+++ b/src/messenger/gnunet-service-messenger_message_handle.c
@@ -27,7 +27,8 @@
27 27
28static void 28static void
29handle_session_switch (struct GNUNET_MESSENGER_MemberSession *session, 29handle_session_switch (struct GNUNET_MESSENGER_MemberSession *session,
30 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 30 const struct GNUNET_MESSENGER_Message *message,
31 const struct GNUNET_HashCode *hash)
31{ 32{
32 struct GNUNET_MESSENGER_MemberSession *next = switch_member_session(session, message, hash); 33 struct GNUNET_MESSENGER_MemberSession *next = switch_member_session(session, message, hash);
33 34
@@ -36,8 +37,10 @@ handle_session_switch (struct GNUNET_MESSENGER_MemberSession *session,
36} 37}
37 38
38void 39void
39handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 40handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room,
40 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 41 struct GNUNET_MESSENGER_MemberSession *session,
42 const struct GNUNET_MESSENGER_Message *message,
43 const struct GNUNET_HashCode *hash)
41{ 44{
42 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member (%s) joins room (%s).\n", 45 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member (%s) joins room (%s).\n",
43 GNUNET_sh2s (&(message->header.sender_id)), GNUNET_h2s(get_room_key(room))); 46 GNUNET_sh2s (&(message->header.sender_id)), GNUNET_h2s(get_room_key(room)));
@@ -54,8 +57,10 @@ handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
54} 57}
55 58
56void 59void
57handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 60handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room,
58 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 61 struct GNUNET_MESSENGER_MemberSession *session,
62 const struct GNUNET_MESSENGER_Message *message,
63 const struct GNUNET_HashCode *hash)
59{ 64{
60 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member (%s) leaves room (%s).\n", 65 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member (%s) leaves room (%s).\n",
61 GNUNET_sh2s (&(message->header.sender_id)), GNUNET_h2s(get_room_key(room))); 66 GNUNET_sh2s (&(message->header.sender_id)), GNUNET_h2s(get_room_key(room)));
@@ -64,8 +69,10 @@ handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE
64} 69}
65 70
66void 71void
67handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 72handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room,
68 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 73 struct GNUNET_MESSENGER_MemberSession *session,
74 const struct GNUNET_MESSENGER_Message *message,
75 const struct GNUNET_HashCode *hash)
69{ 76{
70 struct GNUNET_MESSENGER_Contact *contact = get_member_session_contact(session); 77 struct GNUNET_MESSENGER_Contact *contact = get_member_session_contact(session);
71 78
@@ -76,15 +83,19 @@ handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
76} 83}
77 84
78void 85void
79handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 86handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room,
80 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 87 struct GNUNET_MESSENGER_MemberSession *session,
88 const struct GNUNET_MESSENGER_Message *message,
89 const struct GNUNET_HashCode *hash)
81{ 90{
82 handle_session_switch (session, message, hash); 91 handle_session_switch (session, message, hash);
83} 92}
84 93
85void 94void
86handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 95handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
87 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 96 struct GNUNET_MESSENGER_MemberSession *session,
97 const struct GNUNET_MESSENGER_Message *message,
98 const struct GNUNET_HashCode *hash)
88{ 99{
89 if (GNUNET_NO == contains_list_tunnels (&(room->basement), &(message->body.peer.peer))) 100 if (GNUNET_NO == contains_list_tunnels (&(room->basement), &(message->body.peer.peer)))
90 add_to_list_tunnels (&(room->basement), &(message->body.peer.peer)); 101 add_to_list_tunnels (&(room->basement), &(message->body.peer.peer));
@@ -94,8 +105,10 @@ handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
94} 105}
95 106
96void 107void
97handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 108handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room,
98 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 109 struct GNUNET_MESSENGER_MemberSession *session,
110 const struct GNUNET_MESSENGER_Message *message,
111 const struct GNUNET_HashCode *hash)
99{ 112{
100 handle_session_switch (session, message, hash); 113 handle_session_switch (session, message, hash);
101 114
@@ -108,8 +121,10 @@ handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
108} 121}
109 122
110void 123void
111handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 124handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room,
112 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 125 struct GNUNET_MESSENGER_MemberSession *session,
126 const struct GNUNET_MESSENGER_Message *message,
127 const struct GNUNET_HashCode *hash)
113{ 128{
114 struct GNUNET_MESSENGER_ListTunnel *element = find_list_tunnels (&(room->basement), &(message->body.peer.peer), NULL); 129 struct GNUNET_MESSENGER_ListTunnel *element = find_list_tunnels (&(room->basement), &(message->body.peer.peer), NULL);
115 130
@@ -123,8 +138,10 @@ handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
123} 138}
124 139
125void 140void
126handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 141handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room,
127 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 142 struct GNUNET_MESSENGER_MemberSession *session,
143 const struct GNUNET_MESSENGER_Message *message,
144 const struct GNUNET_HashCode *hash)
128{ 145{
129 struct GNUNET_TIME_Relative delay = GNUNET_TIME_relative_ntoh (message->body.deletion.delay); 146 struct GNUNET_TIME_Relative delay = GNUNET_TIME_relative_ntoh (message->body.deletion.delay);
130 struct GNUNET_TIME_Absolute action = GNUNET_TIME_absolute_ntoh (message->header.timestamp); 147 struct GNUNET_TIME_Absolute action = GNUNET_TIME_absolute_ntoh (message->header.timestamp);
diff --git a/src/messenger/gnunet-service-messenger_message_handle.h b/src/messenger/gnunet-service-messenger_message_handle.h
index 844142b77..0e5be3408 100644
--- a/src/messenger/gnunet-service-messenger_message_handle.h
+++ b/src/messenger/gnunet-service-messenger_message_handle.h
@@ -45,8 +45,10 @@
45 * @param[in] hash Hash of the message 45 * @param[in] hash Hash of the message
46 */ 46 */
47void 47void
48handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 48handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room,
49 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 49 struct GNUNET_MESSENGER_MemberSession *session,
50 const struct GNUNET_MESSENGER_Message *message,
51 const struct GNUNET_HashCode *hash);
50 52
51/** 53/**
52 * Handles a received or sent leave message to make changes of current member information. 54 * Handles a received or sent leave message to make changes of current member information.
@@ -58,8 +60,10 @@ handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
58 * @param[in] hash Hash of the message 60 * @param[in] hash Hash of the message
59 */ 61 */
60void 62void
61handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 63handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room,
62 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 64 struct GNUNET_MESSENGER_MemberSession *session,
65 const struct GNUNET_MESSENGER_Message *message,
66 const struct GNUNET_HashCode *hash);
63 67
64/** 68/**
65 * Handles a received or sent name message to rename a current member. 69 * Handles a received or sent name message to rename a current member.
@@ -71,8 +75,10 @@ handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE
71 * @param[in] hash Hash of the message 75 * @param[in] hash Hash of the message
72 */ 76 */
73void 77void
74handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 78handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room,
75 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 79 struct GNUNET_MESSENGER_MemberSession *session,
80 const struct GNUNET_MESSENGER_Message *message,
81 const struct GNUNET_HashCode *hash);
76 82
77/** 83/**
78 * Handles a received or sent key message to change the key of a member and rearrange the contacts accordingly. 84 * Handles a received or sent key message to change the key of a member and rearrange the contacts accordingly.
@@ -84,8 +90,10 @@ handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
84 * @param[in] hash Hash of the message 90 * @param[in] hash Hash of the message
85 */ 91 */
86void 92void
87handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 93handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room,
88 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 94 struct GNUNET_MESSENGER_MemberSession *session,
95 const struct GNUNET_MESSENGER_Message *message,
96 const struct GNUNET_HashCode *hash);
89 97
90/** 98/**
91 * Handles a received or sent peer message to make changes of the basement in the room. 99 * Handles a received or sent peer message to make changes of the basement in the room.
@@ -97,8 +105,10 @@ handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENG
97 * @param[in] hash Hash of the message 105 * @param[in] hash Hash of the message
98 */ 106 */
99void 107void
100handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 108handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
101 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 109 struct GNUNET_MESSENGER_MemberSession *session,
110 const struct GNUNET_MESSENGER_Message *message,
111 const struct GNUNET_HashCode *hash);
102 112
103/** 113/**
104 * Handles a received or sent id message to change a members id. 114 * Handles a received or sent id message to change a members id.
@@ -110,8 +120,10 @@ handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
110 * @param[in] hash Hash of the message 120 * @param[in] hash Hash of the message
111 */ 121 */
112void 122void
113handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 123handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room,
114 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 124 struct GNUNET_MESSENGER_MemberSession *session,
125 const struct GNUNET_MESSENGER_Message *message,
126 const struct GNUNET_HashCode *hash);
115 127
116/** 128/**
117 * Handles a received or sent miss message to drop a peer from the basement in the room. 129 * Handles a received or sent miss message to drop a peer from the basement in the room.
@@ -123,8 +135,10 @@ handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
123 * @param[in] hash Hash of the message 135 * @param[in] hash Hash of the message
124 */ 136 */
125void 137void
126handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 138handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room,
127 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 139 struct GNUNET_MESSENGER_MemberSession *session,
140 const struct GNUNET_MESSENGER_Message *message,
141 const struct GNUNET_HashCode *hash);
128 142
129/** 143/**
130 * Handles a received or sent delete message to delete a specific message from the store. 144 * Handles a received or sent delete message to delete a specific message from the store.
@@ -136,7 +150,9 @@ handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
136 * @param[in] hash Hash of the message 150 * @param[in] hash Hash of the message
137 */ 151 */
138void 152void
139handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 153handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room,
140 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 154 struct GNUNET_MESSENGER_MemberSession *session,
155 const struct GNUNET_MESSENGER_Message *message,
156 const struct GNUNET_HashCode *hash);
141 157
142#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_HANDLE_H 158#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_HANDLE_H
diff --git a/src/messenger/gnunet-service-messenger_message_kind.c b/src/messenger/gnunet-service-messenger_message_kind.c
index 3edcade91..2449b9230 100644
--- a/src/messenger/gnunet-service-messenger_message_kind.c
+++ b/src/messenger/gnunet-service-messenger_message_kind.c
@@ -190,7 +190,8 @@ create_message_request (const struct GNUNET_HashCode *hash)
190} 190}
191 191
192struct GNUNET_MESSENGER_Message* 192struct GNUNET_MESSENGER_Message*
193create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) 193create_message_invite (const struct GNUNET_PeerIdentity *door,
194 const struct GNUNET_HashCode *key)
194{ 195{
195 if ((!door) || (!key)) 196 if ((!door) || (!key))
196 return NULL; 197 return NULL;
@@ -222,7 +223,8 @@ create_message_text (const char *text)
222} 223}
223 224
224struct GNUNET_MESSENGER_Message* 225struct GNUNET_MESSENGER_Message*
225create_message_delete (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) 226create_message_delete (const struct GNUNET_HashCode *hash,
227 const struct GNUNET_TIME_Relative delay)
226{ 228{
227 if (!hash) 229 if (!hash)
228 return NULL; 230 return NULL;
diff --git a/src/messenger/gnunet-service-messenger_message_kind.h b/src/messenger/gnunet-service-messenger_message_kind.h
index c098868c0..508f19074 100644
--- a/src/messenger/gnunet-service-messenger_message_kind.h
+++ b/src/messenger/gnunet-service-messenger_message_kind.h
@@ -146,7 +146,8 @@ create_message_request (const struct GNUNET_HashCode *hash);
146 * @return New message 146 * @return New message
147 */ 147 */
148struct GNUNET_MESSENGER_Message* 148struct GNUNET_MESSENGER_Message*
149create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); 149create_message_invite (const struct GNUNET_PeerIdentity *door,
150 const struct GNUNET_HashCode *key);
150 151
151/** 152/**
152 * Creates and allocates a new <i>text message containing a string representing text. 153 * Creates and allocates a new <i>text message containing a string representing text.
@@ -167,6 +168,7 @@ create_message_text (const char *text);
167 * @return New message 168 * @return New message
168 */ 169 */
169struct GNUNET_MESSENGER_Message* 170struct GNUNET_MESSENGER_Message*
170create_message_delete (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay); 171create_message_delete (const struct GNUNET_HashCode *hash,
172 const struct GNUNET_TIME_Relative delay);
171 173
172#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_KIND_H 174#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_KIND_H
diff --git a/src/messenger/gnunet-service-messenger_message_recv.c b/src/messenger/gnunet-service-messenger_message_recv.c
index b2a5052d2..bb6ee6f17 100644
--- a/src/messenger/gnunet-service-messenger_message_recv.c
+++ b/src/messenger/gnunet-service-messenger_message_recv.c
@@ -28,8 +28,10 @@
28#include "gnunet-service-messenger_operation.h" 28#include "gnunet-service-messenger_operation.h"
29 29
30static void 30static void
31forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 31forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room,
32 struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_CONTAINER_MultiHashMap *map) 32 struct GNUNET_MESSENGER_SrvTunnel *tunnel,
33 struct GNUNET_MESSENGER_MemberSession *session,
34 struct GNUNET_CONTAINER_MultiHashMap *map)
33{ 35{
34 if (session->prev) 36 if (session->prev)
35 forward_about_members (room, tunnel, session->prev, map); 37 forward_about_members (room, tunnel, session->prev, map);
@@ -54,8 +56,9 @@ forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESS
54} 56}
55 57
56static int 58static int
57iterate_forward_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, 59iterate_forward_members (void *cls,
58 struct GNUNET_MESSENGER_MemberSession *session) 60 const struct GNUNET_IDENTITY_PublicKey *public_key,
61 struct GNUNET_MESSENGER_MemberSession *session)
59{ 62{
60 struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; 63 struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
61 64
@@ -71,8 +74,10 @@ iterate_forward_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *publ
71} 74}
72 75
73int 76int
74recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 77recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room,
75 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 78 struct GNUNET_MESSENGER_SrvTunnel *tunnel,
79 const struct GNUNET_MESSENGER_Message *message,
80 const struct GNUNET_HashCode *hash)
76{ 81{
77 const uint32_t version = get_tunnel_messenger_version(tunnel); 82 const uint32_t version = get_tunnel_messenger_version(tunnel);
78 83
@@ -108,8 +113,10 @@ recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
108} 113}
109 114
110int 115int
111recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 116recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
112 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 117 struct GNUNET_MESSENGER_SrvTunnel *tunnel,
118 const struct GNUNET_MESSENGER_Message *message,
119 const struct GNUNET_HashCode *hash)
113{ 120{
114 struct GNUNET_PeerIdentity peer; 121 struct GNUNET_PeerIdentity peer;
115 GNUNET_PEER_resolve (tunnel->peer, &peer); 122 GNUNET_PEER_resolve (tunnel->peer, &peer);
@@ -126,7 +133,8 @@ recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
126} 133}
127 134
128static void 135static void
129callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, 136callback_found_message (void *cls,
137 struct GNUNET_MESSENGER_SrvRoom *room,
130 const struct GNUNET_MESSENGER_Message *message, 138 const struct GNUNET_MESSENGER_Message *message,
131 const struct GNUNET_HashCode *hash) 139 const struct GNUNET_HashCode *hash)
132{ 140{
@@ -152,8 +160,10 @@ callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room,
152 * It will only be forwarded if it can't be answered! 160 * It will only be forwarded if it can't be answered!
153 */ 161 */
154int 162int
155recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 163recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room,
156 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 164 struct GNUNET_MESSENGER_SrvTunnel *tunnel,
165 const struct GNUNET_MESSENGER_Message *message,
166 const struct GNUNET_HashCode *hash)
157{ 167{
158 struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); 168 struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room);
159 struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message); 169 struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message);
diff --git a/src/messenger/gnunet-service-messenger_message_recv.h b/src/messenger/gnunet-service-messenger_message_recv.h
index 9cb36c466..400c10245 100644
--- a/src/messenger/gnunet-service-messenger_message_recv.h
+++ b/src/messenger/gnunet-service-messenger_message_recv.h
@@ -46,8 +46,10 @@
46 * @return #GNUNET_NO to not forward the message 46 * @return #GNUNET_NO to not forward the message
47 */ 47 */
48int 48int
49recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 49recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room,
50 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 50 struct GNUNET_MESSENGER_SrvTunnel *tunnel,
51 const struct GNUNET_MESSENGER_Message *message,
52 const struct GNUNET_HashCode *hash);
51 53
52/** 54/**
53 * Handles a received peer message to link it to its origin tunnel if the peer identity matches. 55 * Handles a received peer message to link it to its origin tunnel if the peer identity matches.
@@ -60,8 +62,10 @@ recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
60 * @return #GNUNET_YES to forward the message 62 * @return #GNUNET_YES to forward the message
61 */ 63 */
62int 64int
63recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 65recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
64 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 66 struct GNUNET_MESSENGER_SrvTunnel *tunnel,
67 const struct GNUNET_MESSENGER_Message *message,
68 const struct GNUNET_HashCode *hash);
65 69
66/** 70/**
67 * Handles a received request message by checking for the requested message and forwarding it back 71 * Handles a received request message by checking for the requested message and forwarding it back
@@ -75,7 +79,9 @@ recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
75 * @return #GNUNET_YES or #GNUNET_NO depending on required forwarding 79 * @return #GNUNET_YES or #GNUNET_NO depending on required forwarding
76 */ 80 */
77int 81int
78recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 82recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room,
79 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 83 struct GNUNET_MESSENGER_SrvTunnel *tunnel,
84 const struct GNUNET_MESSENGER_Message *message,
85 const struct GNUNET_HashCode *hash);
80 86
81#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H 87#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H
diff --git a/src/messenger/gnunet-service-messenger_message_send.c b/src/messenger/gnunet-service-messenger_message_send.c
index a59a178cc..8cc2466d7 100644
--- a/src/messenger/gnunet-service-messenger_message_send.c
+++ b/src/messenger/gnunet-service-messenger_message_send.c
@@ -30,15 +30,19 @@
30#include "gnunet-service-messenger_operation.h" 30#include "gnunet-service-messenger_operation.h"
31 31
32void 32void
33send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 33send_message_join (struct GNUNET_MESSENGER_SrvRoom *room,
34 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 34 struct GNUNET_MESSENGER_SrvHandle *handle,
35 const struct GNUNET_MESSENGER_Message *message,
36 const struct GNUNET_HashCode *hash)
35{ 37{
36 check_room_peer_status(room, NULL); 38 check_room_peer_status(room, NULL);
37} 39}
38 40
39void 41void
40send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 42send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
41 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 43 struct GNUNET_MESSENGER_SrvHandle *handle,
44 const struct GNUNET_MESSENGER_Message *message,
45 const struct GNUNET_HashCode *hash)
42{ 46{
43 if (!room->peer_message) 47 if (!room->peer_message)
44 room->peer_message = GNUNET_new(struct GNUNET_HashCode); 48 room->peer_message = GNUNET_new(struct GNUNET_HashCode);
@@ -47,15 +51,19 @@ send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
47} 51}
48 52
49void 53void
50send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 54send_message_id (struct GNUNET_MESSENGER_SrvRoom *room,
51 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 55 struct GNUNET_MESSENGER_SrvHandle *handle,
56 const struct GNUNET_MESSENGER_Message *message,
57 const struct GNUNET_HashCode *hash)
52{ 58{
53 change_handle_member_id (handle, get_room_key(room), &(message->body.id.id)); 59 change_handle_member_id (handle, get_room_key(room), &(message->body.id.id));
54} 60}
55 61
56void 62void
57send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 63send_message_request (struct GNUNET_MESSENGER_SrvRoom *room,
58 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 64 struct GNUNET_MESSENGER_SrvHandle *handle,
65 const struct GNUNET_MESSENGER_Message *message,
66 const struct GNUNET_HashCode *hash)
59{ 67{
60 struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(room); 68 struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(room);
61 69
diff --git a/src/messenger/gnunet-service-messenger_message_send.h b/src/messenger/gnunet-service-messenger_message_send.h
index 63320ab17..232355c41 100644
--- a/src/messenger/gnunet-service-messenger_message_send.h
+++ b/src/messenger/gnunet-service-messenger_message_send.h
@@ -44,8 +44,10 @@
44 * @param[in] hash Hash of the message 44 * @param[in] hash Hash of the message
45 */ 45 */
46void 46void
47send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 47send_message_join (struct GNUNET_MESSENGER_SrvRoom *room,
48 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 48 struct GNUNET_MESSENGER_SrvHandle *handle,
49 const struct GNUNET_MESSENGER_Message *message,
50 const struct GNUNET_HashCode *hash);
49 51
50/** 52/**
51 * Handles a sent peer message to update the rooms peer message of this service. 53 * Handles a sent peer message to update the rooms peer message of this service.
@@ -57,8 +59,10 @@ send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
57 * @param[in] hash Hash of the message 59 * @param[in] hash Hash of the message
58 */ 60 */
59void 61void
60send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 62send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
61 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 63 struct GNUNET_MESSENGER_SrvHandle *handle,
64 const struct GNUNET_MESSENGER_Message *message,
65 const struct GNUNET_HashCode *hash);
62 66
63/** 67/**
64 * Handles a sent id message to update the handles member id in the room. 68 * Handles a sent id message to update the handles member id in the room.
@@ -70,8 +74,10 @@ send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
70 * @param[in] hash Hash of the message 74 * @param[in] hash Hash of the message
71 */ 75 */
72void 76void
73send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 77send_message_id (struct GNUNET_MESSENGER_SrvRoom *room,
74 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 78 struct GNUNET_MESSENGER_SrvHandle *handle,
79 const struct GNUNET_MESSENGER_Message *message,
80 const struct GNUNET_HashCode *hash);
75 81
76/** 82/**
77 * Handles a sent request message to trigger the request operation for this service. 83 * Handles a sent request message to trigger the request operation for this service.
@@ -83,7 +89,9 @@ send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_
83 * @param[in] hash Hash of the message 89 * @param[in] hash Hash of the message
84 */ 90 */
85void 91void
86send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 92send_message_request (struct GNUNET_MESSENGER_SrvRoom *room,
87 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 93 struct GNUNET_MESSENGER_SrvHandle *handle,
94 const struct GNUNET_MESSENGER_Message *message,
95 const struct GNUNET_HashCode *hash);
88 96
89#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_SEND_H 97#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_SEND_H
diff --git a/src/messenger/gnunet-service-messenger_message_state.c b/src/messenger/gnunet-service-messenger_message_state.c
index cdd2d9712..344962d11 100644
--- a/src/messenger/gnunet-service-messenger_message_state.c
+++ b/src/messenger/gnunet-service-messenger_message_state.c
@@ -65,8 +65,10 @@ get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state)
65} 65}
66 66
67void 67void
68update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested, 68update_message_state (struct GNUNET_MESSENGER_MessageState *state,
69 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 69 int requested,
70 const struct GNUNET_MESSENGER_Message *message,
71 const struct GNUNET_HashCode *hash)
70{ 72{
71 GNUNET_assert((state) && (message) && (hash)); 73 GNUNET_assert((state) && (message) && (hash));
72 74
@@ -83,7 +85,8 @@ update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested
83} 85}
84 86
85void 87void
86load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *path) 88load_message_state (struct GNUNET_MESSENGER_MessageState *state,
89 const char *path)
87{ 90{
88 GNUNET_assert((state) && (path)); 91 GNUNET_assert((state) && (path));
89 92
@@ -95,7 +98,8 @@ load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *pat
95} 98}
96 99
97void 100void
98save_message_state (const struct GNUNET_MESSENGER_MessageState *state, const char *path) 101save_message_state (const struct GNUNET_MESSENGER_MessageState *state,
102 const char *path)
99{ 103{
100 GNUNET_assert((state) && (path)); 104 GNUNET_assert((state) && (path));
101 105
diff --git a/src/messenger/gnunet-service-messenger_message_state.h b/src/messenger/gnunet-service-messenger_message_state.h
index dc8671df4..af52b26b6 100644
--- a/src/messenger/gnunet-service-messenger_message_state.h
+++ b/src/messenger/gnunet-service-messenger_message_state.h
@@ -51,13 +51,17 @@ const struct GNUNET_HashCode*
51get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state); 51get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state);
52 52
53void 53void
54update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested, 54update_message_state (struct GNUNET_MESSENGER_MessageState *state,
55 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 55 int requested,
56 const struct GNUNET_MESSENGER_Message *message,
57 const struct GNUNET_HashCode *hash);
56 58
57void 59void
58load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *path); 60load_message_state (struct GNUNET_MESSENGER_MessageState *state,
61 const char *path);
59 62
60void 63void
61save_message_state (const struct GNUNET_MESSENGER_MessageState *state, const char *path); 64save_message_state (const struct GNUNET_MESSENGER_MessageState *state,
65 const char *path);
62 66
63#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STATE_H 67#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STATE_H
diff --git a/src/messenger/gnunet-service-messenger_message_store.c b/src/messenger/gnunet-service-messenger_message_store.c
index 1984eba21..56448997a 100644
--- a/src/messenger/gnunet-service-messenger_message_store.c
+++ b/src/messenger/gnunet-service-messenger_message_store.c
@@ -42,7 +42,9 @@ init_message_store (struct GNUNET_MESSENGER_MessageStore *store)
42} 42}
43 43
44static int 44static int
45iterate_destroy_entries (void *cls, const struct GNUNET_HashCode *key, void *value) 45iterate_destroy_entries (void *cls,
46 const struct GNUNET_HashCode *key,
47 void *value)
46{ 48{
47 struct GNUNET_MESSENGER_MessageEntry *entry = value; 49 struct GNUNET_MESSENGER_MessageEntry *entry = value;
48 50
@@ -52,7 +54,9 @@ iterate_destroy_entries (void *cls, const struct GNUNET_HashCode *key, void *val
52} 54}
53 55
54static int 56static int
55iterate_destroy_messages (void *cls, const struct GNUNET_HashCode *key, void *value) 57iterate_destroy_messages (void *cls,
58 const struct GNUNET_HashCode *key,
59 void *value)
56{ 60{
57 struct GNUNET_MESSENGER_Message *message = value; 61 struct GNUNET_MESSENGER_Message *message = value;
58 62
@@ -62,7 +66,9 @@ iterate_destroy_messages (void *cls, const struct GNUNET_HashCode *key, void *va
62} 66}
63 67
64static int 68static int
65iterate_destroy_links (void *cls, const struct GNUNET_HashCode *key, void *value) 69iterate_destroy_links (void *cls,
70 const struct GNUNET_HashCode *key,
71 void *value)
66{ 72{
67 struct GNUNET_HashCode *previous = value; 73 struct GNUNET_HashCode *previous = value;
68 74
@@ -99,7 +105,8 @@ struct GNUNET_MESSENGER_MessageEntryStorage
99}; 105};
100 106
101static void 107static void
102load_message_store_entries (struct GNUNET_MESSENGER_MessageStore *store, const char *filename) 108load_message_store_entries (struct GNUNET_MESSENGER_MessageStore *store,
109 const char *filename)
103{ 110{
104 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ); 111 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ);
105 112
@@ -146,7 +153,8 @@ struct GNUNET_MESSENGER_MessageLinkStorage
146}; 153};
147 154
148static void 155static void
149load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store, const char *filename) 156load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store,
157 const char *filename)
150{ 158{
151 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ); 159 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ);
152 160
@@ -187,7 +195,8 @@ load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store, const cha
187} 195}
188 196
189void 197void
190load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory) 198load_message_store (struct GNUNET_MESSENGER_MessageStore *store,
199 const char *directory)
191{ 200{
192 GNUNET_assert((store) && (directory)); 201 GNUNET_assert((store) && (directory));
193 202
@@ -232,7 +241,9 @@ struct GNUNET_MESSENGER_ClosureMessageSave
232}; 241};
233 242
234static int 243static int
235iterate_save_entries (void *cls, const struct GNUNET_HashCode *key, void *value) 244iterate_save_entries (void *cls,
245 const struct GNUNET_HashCode *key,
246 void *value)
236{ 247{
237 struct GNUNET_MESSENGER_ClosureMessageSave *save = cls; 248 struct GNUNET_MESSENGER_ClosureMessageSave *save = cls;
238 struct GNUNET_MESSENGER_MessageEntry *entry = value; 249 struct GNUNET_MESSENGER_MessageEntry *entry = value;
@@ -248,7 +259,9 @@ iterate_save_entries (void *cls, const struct GNUNET_HashCode *key, void *value)
248} 259}
249 260
250static int 261static int
251iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value) 262iterate_save_messages (void *cls,
263 const struct GNUNET_HashCode *key,
264 void *value)
252{ 265{
253 struct GNUNET_MESSENGER_ClosureMessageSave *save = cls; 266 struct GNUNET_MESSENGER_ClosureMessageSave *save = cls;
254 267
@@ -279,7 +292,9 @@ iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value
279} 292}
280 293
281static int 294static int
282iterate_save_links (void *cls, const struct GNUNET_HashCode *key, void *value) 295iterate_save_links (void *cls,
296 const struct GNUNET_HashCode *key,
297 void *value)
283{ 298{
284 struct GNUNET_MESSENGER_ClosureMessageSave *save = cls; 299 struct GNUNET_MESSENGER_ClosureMessageSave *save = cls;
285 struct GNUNET_MESSENGER_MessageLink *link = value; 300 struct GNUNET_MESSENGER_MessageLink *link = value;
@@ -295,7 +310,8 @@ iterate_save_links (void *cls, const struct GNUNET_HashCode *key, void *value)
295} 310}
296 311
297void 312void
298save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory) 313save_message_store (struct GNUNET_MESSENGER_MessageStore *store,
314 const char *directory)
299{ 315{
300 GNUNET_assert((store) && (directory)); 316 GNUNET_assert((store) && (directory));
301 317
@@ -372,7 +388,8 @@ close_entries:
372} 388}
373 389
374int 390int
375contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) 391contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store,
392 const struct GNUNET_HashCode *hash)
376{ 393{
377 GNUNET_assert((store) && (hash)); 394 GNUNET_assert((store) && (hash));
378 395
@@ -383,7 +400,8 @@ contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const
383} 400}
384 401
385const struct GNUNET_MESSENGER_Message* 402const struct GNUNET_MESSENGER_Message*
386get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) 403get_store_message (struct GNUNET_MESSENGER_MessageStore *store,
404 const struct GNUNET_HashCode *hash)
387{ 405{
388 GNUNET_assert((store) && (hash)); 406 GNUNET_assert((store) && (hash));
389 407
@@ -444,7 +462,8 @@ free_buffer:
444} 462}
445 463
446const struct GNUNET_MESSENGER_MessageLink* 464const struct GNUNET_MESSENGER_MessageLink*
447get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, 465get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store,
466 const struct GNUNET_HashCode *hash,
448 int deleted_only) 467 int deleted_only)
449{ 468{
450 if (deleted_only) 469 if (deleted_only)
@@ -473,7 +492,8 @@ get_link:
473} 492}
474 493
475int 494int
476put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, 495put_store_message (struct GNUNET_MESSENGER_MessageStore *store,
496 const struct GNUNET_HashCode *hash,
477 struct GNUNET_MESSENGER_Message *message) 497 struct GNUNET_MESSENGER_Message *message)
478{ 498{
479 GNUNET_assert((store) && (hash) && (message)); 499 GNUNET_assert((store) && (hash) && (message));
@@ -483,7 +503,8 @@ put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU
483} 503}
484 504
485static void 505static void
486add_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, 506add_link (struct GNUNET_MESSENGER_MessageStore *store,
507 const struct GNUNET_HashCode *hash,
487 const struct GNUNET_MESSENGER_Message *message) 508 const struct GNUNET_MESSENGER_Message *message)
488{ 509{
489 struct GNUNET_MESSENGER_MessageLink *link = GNUNET_new(struct GNUNET_MESSENGER_MessageLink); 510 struct GNUNET_MESSENGER_MessageLink *link = GNUNET_new(struct GNUNET_MESSENGER_MessageLink);
@@ -503,7 +524,8 @@ add_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashC
503} 524}
504 525
505int 526int
506delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) 527delete_store_message (struct GNUNET_MESSENGER_MessageStore *store,
528 const struct GNUNET_HashCode *hash)
507{ 529{
508 GNUNET_assert((store) && (hash)); 530 GNUNET_assert((store) && (hash));
509 531
diff --git a/src/messenger/gnunet-service-messenger_message_store.h b/src/messenger/gnunet-service-messenger_message_store.h
index 87305826a..476d98dd5 100644
--- a/src/messenger/gnunet-service-messenger_message_store.h
+++ b/src/messenger/gnunet-service-messenger_message_store.h
@@ -81,7 +81,8 @@ clear_message_store (struct GNUNET_MESSENGER_MessageStore *store);
81 * @param[in] directory Path to a directory 81 * @param[in] directory Path to a directory
82 */ 82 */
83void 83void
84load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); 84load_message_store (struct GNUNET_MESSENGER_MessageStore *store,
85 const char *directory);
85 86
86/** 87/**
87 * Saves messages from a message <i>store</i> into a <i>directory</i>. 88 * Saves messages from a message <i>store</i> into a <i>directory</i>.
@@ -90,7 +91,8 @@ load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *dir
90 * @param[in] directory Path to a directory 91 * @param[in] directory Path to a directory
91 */ 92 */
92void 93void
93save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); 94save_message_store (struct GNUNET_MESSENGER_MessageStore *store,
95 const char *directory);
94 96
95/** 97/**
96 * Checks if a message matching a given <i>hash</i> is stored in a message <i>store</i>. 98 * Checks if a message matching a given <i>hash</i> is stored in a message <i>store</i>.
@@ -103,7 +105,8 @@ save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *dir
103 * @return #GNUNET_YES on match, otherwise #GNUNET_NO 105 * @return #GNUNET_YES on match, otherwise #GNUNET_NO
104 */ 106 */
105int 107int
106contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); 108contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store,
109 const struct GNUNET_HashCode *hash);
107 110
108/** 111/**
109 * Returns the message from a message <i>store</i> matching a given <i>hash</i>. If no matching 112 * Returns the message from a message <i>store</i> matching a given <i>hash</i>. If no matching
@@ -117,7 +120,8 @@ contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const
117 * @return Message or NULL 120 * @return Message or NULL
118 */ 121 */
119const struct GNUNET_MESSENGER_Message* 122const struct GNUNET_MESSENGER_Message*
120get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); 123get_store_message (struct GNUNET_MESSENGER_MessageStore *store,
124 const struct GNUNET_HashCode *hash);
121 125
122/** 126/**
123 * Returns the message link from a message <i>store</i> matching a given <i>hash</i>. If the 127 * Returns the message link from a message <i>store</i> matching a given <i>hash</i>. If the
@@ -133,7 +137,8 @@ get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU
133 * @return Message link or NULL 137 * @return Message link or NULL
134 */ 138 */
135const struct GNUNET_MESSENGER_MessageLink* 139const struct GNUNET_MESSENGER_MessageLink*
136get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, 140get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store,
141 const struct GNUNET_HashCode *hash,
137 int deleted_only); 142 int deleted_only);
138 143
139/** 144/**
@@ -145,7 +150,8 @@ get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struc
145 * @return #GNUNET_OK on success, otherwise #GNUNET_NO 150 * @return #GNUNET_OK on success, otherwise #GNUNET_NO
146 */ 151 */
147int 152int
148put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, 153put_store_message (struct GNUNET_MESSENGER_MessageStore *store,
154 const struct GNUNET_HashCode *hash,
149 struct GNUNET_MESSENGER_Message *message); 155 struct GNUNET_MESSENGER_Message *message);
150 156
151/** 157/**
@@ -157,6 +163,7 @@ put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU
157 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 163 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
158 */ 164 */
159int 165int
160delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); 166delete_store_message (struct GNUNET_MESSENGER_MessageStore *store,
167 const struct GNUNET_HashCode *hash);
161 168
162#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STORE_H 169#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STORE_H
diff --git a/src/messenger/gnunet-service-messenger_operation.c b/src/messenger/gnunet-service-messenger_operation.c
index d0c378699..a8744e577 100644
--- a/src/messenger/gnunet-service-messenger_operation.c
+++ b/src/messenger/gnunet-service-messenger_operation.c
@@ -58,7 +58,8 @@ static void
58callback_operation (void *cls); 58callback_operation (void *cls);
59 59
60struct GNUNET_MESSENGER_Operation* 60struct GNUNET_MESSENGER_Operation*
61load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path) 61load_operation (struct GNUNET_MESSENGER_OperationStore *store,
62 const char *path)
62{ 63{
63 GNUNET_assert((store) && (path)); 64 GNUNET_assert((store) && (path));
64 65
@@ -118,7 +119,8 @@ destroy_config:
118} 119}
119 120
120void 121void
121save_operation (const struct GNUNET_MESSENGER_Operation *op, const char *path) 122save_operation (const struct GNUNET_MESSENGER_Operation *op,
123 const char *path)
122{ 124{
123 GNUNET_assert((path) && (op)); 125 GNUNET_assert((path) && (op));
124 126
diff --git a/src/messenger/gnunet-service-messenger_operation.h b/src/messenger/gnunet-service-messenger_operation.h
index f1e06f4a7..485668548 100644
--- a/src/messenger/gnunet-service-messenger_operation.h
+++ b/src/messenger/gnunet-service-messenger_operation.h
@@ -86,7 +86,8 @@ destroy_operation (struct GNUNET_MESSENGER_Operation *op);
86 * @param[in] path Path of a configuration file 86 * @param[in] path Path of a configuration file
87 */ 87 */
88struct GNUNET_MESSENGER_Operation* 88struct GNUNET_MESSENGER_Operation*
89load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path); 89load_operation (struct GNUNET_MESSENGER_OperationStore *store,
90 const char *path);
90 91
91/** 92/**
92 * Saves data from an <i>operation</i> into a configuration file at a 93 * Saves data from an <i>operation</i> into a configuration file at a
@@ -97,7 +98,8 @@ load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path)
97 * @param[in] path Path of a configuration file 98 * @param[in] path Path of a configuration file
98 */ 99 */
99void 100void
100save_operation (const struct GNUNET_MESSENGER_Operation *op, const char *path); 101save_operation (const struct GNUNET_MESSENGER_Operation *op,
102 const char *path);
101 103
102/** 104/**
103 * Starts an inactive operation with a given <i>delay</i> in a 105 * Starts an inactive operation with a given <i>delay</i> in a
diff --git a/src/messenger/gnunet-service-messenger_operation_store.c b/src/messenger/gnunet-service-messenger_operation_store.c
index a32fbad2c..4f8419daa 100644
--- a/src/messenger/gnunet-service-messenger_operation_store.c
+++ b/src/messenger/gnunet-service-messenger_operation_store.c
@@ -29,7 +29,8 @@
29#include "gnunet-service-messenger_room.h" 29#include "gnunet-service-messenger_room.h"
30 30
31void 31void
32init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room) 32init_operation_store (struct GNUNET_MESSENGER_OperationStore *store,
33 struct GNUNET_MESSENGER_SrvRoom *room)
33{ 34{
34 GNUNET_assert((store) && (room)); 35 GNUNET_assert((store) && (room));
35 36
@@ -38,7 +39,9 @@ init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUN
38} 39}
39 40
40static int 41static int
41iterate_destroy_operations (void *cls, const struct GNUNET_HashCode *key, void *value) 42iterate_destroy_operations (void *cls,
43 const struct GNUNET_HashCode *key,
44 void *value)
42{ 45{
43 struct GNUNET_MESSENGER_Operation *op = value; 46 struct GNUNET_MESSENGER_Operation *op = value;
44 47
@@ -57,7 +60,8 @@ clear_operation_store (struct GNUNET_MESSENGER_OperationStore *store)
57} 60}
58 61
59static int 62static int
60callback_scan_for_operations (void *cls, const char *filename) 63callback_scan_for_operations (void *cls,
64 const char *filename)
61{ 65{
62 struct GNUNET_MESSENGER_OperationStore *store = cls; 66 struct GNUNET_MESSENGER_OperationStore *store = cls;
63 67
@@ -94,7 +98,9 @@ load_operation_store (struct GNUNET_MESSENGER_OperationStore *store,
94} 98}
95 99
96static int 100static int
97iterate_save_operations (void *cls, const struct GNUNET_HashCode *key, void *value) 101iterate_save_operations (void *cls,
102 const struct GNUNET_HashCode *key,
103 void *value)
98{ 104{
99 const char *save_dir = cls; 105 const char *save_dir = cls;
100 106
@@ -192,10 +198,12 @@ cancel_store_operation (struct GNUNET_MESSENGER_OperationStore *store,
192} 198}
193 199
194extern void 200extern void
195callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash); 201callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room,
202 const struct GNUNET_HashCode *hash);
196 203
197extern void 204extern void
198callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash); 205callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room,
206 const struct GNUNET_HashCode *hash);
199 207
200void 208void
201callback_store_operation (struct GNUNET_MESSENGER_OperationStore *store, 209callback_store_operation (struct GNUNET_MESSENGER_OperationStore *store,
diff --git a/src/messenger/gnunet-service-messenger_operation_store.h b/src/messenger/gnunet-service-messenger_operation_store.h
index 4c613437c..18eb7f8a1 100644
--- a/src/messenger/gnunet-service-messenger_operation_store.h
+++ b/src/messenger/gnunet-service-messenger_operation_store.h
@@ -48,7 +48,8 @@ struct GNUNET_MESSENGER_OperationStore
48 * @param[in/out] room Room 48 * @param[in/out] room Room
49 */ 49 */
50void 50void
51init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room); 51init_operation_store (struct GNUNET_MESSENGER_OperationStore *store,
52 struct GNUNET_MESSENGER_SrvRoom *room);
52 53
53/** 54/**
54 * Clears an operation <i>store</i>, stops all operations and deallocates its memory. 55 * Clears an operation <i>store</i>, stops all operations and deallocates its memory.
diff --git a/src/messenger/gnunet-service-messenger_room.c b/src/messenger/gnunet-service-messenger_room.c
index 73e94908f..920abb10e 100644
--- a/src/messenger/gnunet-service-messenger_room.c
+++ b/src/messenger/gnunet-service-messenger_room.c
@@ -43,7 +43,8 @@ static void
43idle_request_room_messages (void *cls); 43idle_request_room_messages (void *cls);
44 44
45struct GNUNET_MESSENGER_SrvRoom* 45struct GNUNET_MESSENGER_SrvRoom*
46create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) 46create_room (struct GNUNET_MESSENGER_SrvHandle *handle,
47 const struct GNUNET_HashCode *key)
47{ 48{
48 GNUNET_assert((handle) && (key)); 49 GNUNET_assert((handle) && (key));
49 50
@@ -78,7 +79,9 @@ create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_Hash
78} 79}
79 80
80static int 81static int
81iterate_destroy_tunnels (void *cls, const struct GNUNET_PeerIdentity *key, void *value) 82iterate_destroy_tunnels (void *cls,
83 const struct GNUNET_PeerIdentity *key,
84 void *value)
82{ 85{
83 struct GNUNET_MESSENGER_SrvTunnel *tunnel = value; 86 struct GNUNET_MESSENGER_SrvTunnel *tunnel = value;
84 destroy_tunnel (tunnel); 87 destroy_tunnel (tunnel);
@@ -150,7 +153,8 @@ get_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room)
150} 153}
151 154
152static int 155static int
153send_room_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 156send_room_info (struct GNUNET_MESSENGER_SrvRoom *room,
157 struct GNUNET_MESSENGER_SrvHandle *handle,
154 struct GNUNET_MESSENGER_SrvTunnel *tunnel) 158 struct GNUNET_MESSENGER_SrvTunnel *tunnel)
155{ 159{
156 if ((!handle) || (!is_tunnel_connected (tunnel))) 160 if ((!handle) || (!is_tunnel_connected (tunnel)))
@@ -160,7 +164,9 @@ send_room_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_S
160} 164}
161 165
162static void* 166static void*
163callback_room_connect (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *source) 167callback_room_connect (void *cls,
168 struct GNUNET_CADET_Channel *channel,
169 const struct GNUNET_PeerIdentity *source)
164{ 170{
165 struct GNUNET_MESSENGER_SrvRoom *room = cls; 171 struct GNUNET_MESSENGER_SrvRoom *room = cls;
166 172
@@ -197,7 +203,8 @@ callback_room_connect (void *cls, struct GNUNET_CADET_Channel *channel, const st
197} 203}
198 204
199static int 205static int
200join_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 206join_room (struct GNUNET_MESSENGER_SrvRoom *room,
207 struct GNUNET_MESSENGER_SrvHandle *handle,
201 struct GNUNET_MESSENGER_Member *member) 208 struct GNUNET_MESSENGER_Member *member)
202{ 209{
203 GNUNET_assert((room) && (handle) && (member)); 210 GNUNET_assert((room) && (handle) && (member));
@@ -228,8 +235,10 @@ struct GNUNET_MESSENGER_MemberNotify
228}; 235};
229 236
230static void 237static void
231notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify, struct GNUNET_MESSENGER_MemberSession *session, 238notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify,
232 struct GNUNET_CONTAINER_MultiHashMap *map, int check_permission) 239 struct GNUNET_MESSENGER_MemberSession *session,
240 struct GNUNET_CONTAINER_MultiHashMap *map,
241 int check_permission)
233{ 242{
234 if (session->prev) 243 if (session->prev)
235 notify_about_members (notify, session->prev, map, GNUNET_YES); 244 notify_about_members (notify, session->prev, map, GNUNET_YES);
@@ -258,7 +267,8 @@ notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify, struct GNUNE
258} 267}
259 268
260static int 269static int
261iterate_notify_about_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, 270iterate_notify_about_members (void *cls,
271 const struct GNUNET_IDENTITY_PublicKey *public_key,
262 struct GNUNET_MESSENGER_MemberSession *session) 272 struct GNUNET_MESSENGER_MemberSession *session)
263{ 273{
264 struct GNUNET_MESSENGER_MemberNotify *notify = cls; 274 struct GNUNET_MESSENGER_MemberNotify *notify = cls;
@@ -275,7 +285,8 @@ iterate_notify_about_members (void *cls, const struct GNUNET_IDENTITY_PublicKey
275} 285}
276 286
277static int 287static int
278join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) 288join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room,
289 struct GNUNET_MESSENGER_SrvHandle *handle)
279{ 290{
280 const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (handle, get_room_key(room)); 291 const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (handle, get_room_key(room));
281 292
@@ -306,16 +317,20 @@ join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
306} 317}
307 318
308extern int 319extern int
309check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header); 320check_tunnel_message (void *cls,
321 const struct GNUNET_MessageHeader *header);
310 322
311extern void 323extern void
312handle_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header); 324handle_tunnel_message (void *cls,
325 const struct GNUNET_MessageHeader *header);
313 326
314extern void 327extern void
315callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channel); 328callback_tunnel_disconnect (void *cls,
329 const struct GNUNET_CADET_Channel *channel);
316 330
317int 331int
318open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) 332open_room (struct GNUNET_MESSENGER_SrvRoom *room,
333 struct GNUNET_MESSENGER_SrvHandle *handle)
319{ 334{
320 GNUNET_assert((room) && (handle)); 335 GNUNET_assert((room) && (handle));
321 336
@@ -366,7 +381,8 @@ exit_open_room:
366} 381}
367 382
368int 383int
369enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 384enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room,
385 struct GNUNET_MESSENGER_SrvHandle *handle,
370 const struct GNUNET_PeerIdentity *door) 386 const struct GNUNET_PeerIdentity *door)
371{ 387{
372 GNUNET_assert((room) && (handle) && (door)); 388 GNUNET_assert((room) && (handle) && (door));
@@ -404,8 +420,11 @@ enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_Sr
404} 420}
405 421
406struct GNUNET_MQ_Envelope* 422struct GNUNET_MQ_Envelope*
407pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle, 423pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room,
408 struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode) 424 const struct GNUNET_MESSENGER_SrvHandle *handle,
425 struct GNUNET_MESSENGER_Message *message,
426 struct GNUNET_HashCode *hash,
427 int mode)
409{ 428{
410 GNUNET_assert((room) && (handle) && (message) && (hash)); 429 GNUNET_assert((room) && (handle) && (message) && (hash));
411 430
@@ -432,7 +451,9 @@ struct GNUNET_MESSENGER_ClosureSendRoom
432}; 451};
433 452
434static int 453static int
435iterate_send_room_message (void *cls, const struct GNUNET_PeerIdentity *key, void *value) 454iterate_send_room_message (void *cls,
455 const struct GNUNET_PeerIdentity *key,
456 void *value)
436{ 457{
437 struct GNUNET_MESSENGER_SrvTunnel *tunnel = value; 458 struct GNUNET_MESSENGER_SrvTunnel *tunnel = value;
438 459
@@ -466,14 +487,18 @@ iterate_send_room_message (void *cls, const struct GNUNET_PeerIdentity *key, voi
466 487
467int 488int
468update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, 489update_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
469 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 490 struct GNUNET_MESSENGER_Message *message,
491 const struct GNUNET_HashCode *hash);
470 492
471void 493void
472callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 494callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room,
473 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 495 struct GNUNET_MESSENGER_SrvHandle *handle,
496 const struct GNUNET_MESSENGER_Message *message,
497 const struct GNUNET_HashCode *hash);
474 498
475int 499int
476send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 500send_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
501 struct GNUNET_MESSENGER_SrvHandle *handle,
477 struct GNUNET_MESSENGER_Message *message) 502 struct GNUNET_MESSENGER_Message *message)
478{ 503{
479 GNUNET_assert((room) && (handle)); 504 GNUNET_assert((room) && (handle));
@@ -530,8 +555,10 @@ send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
530} 555}
531 556
532void 557void
533forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 558forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
534 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 559 struct GNUNET_MESSENGER_SrvTunnel *tunnel,
560 struct GNUNET_MESSENGER_Message *message,
561 const struct GNUNET_HashCode *hash)
535{ 562{
536 GNUNET_assert((room) && (tunnel)); 563 GNUNET_assert((room) && (tunnel));
537 564
@@ -554,7 +581,8 @@ forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE
554} 581}
555 582
556void 583void
557check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel) 584check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room,
585 struct GNUNET_MESSENGER_SrvTunnel *tunnel)
558{ 586{
559 if (!room->peer_message) 587 if (!room->peer_message)
560 return; 588 return;
@@ -592,7 +620,8 @@ resend_peer_message:
592} 620}
593 621
594void 622void
595merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) 623merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room,
624 struct GNUNET_MESSENGER_SrvHandle *handle)
596{ 625{
597 GNUNET_assert(room); 626 GNUNET_assert(room);
598 627
@@ -612,7 +641,8 @@ merge_next:
612} 641}
613 642
614void 643void
615callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash) 644callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room,
645 const struct GNUNET_HashCode *hash)
616{ 646{
617 if (GNUNET_OK != delete_store_message (get_room_message_store(room), hash)) 647 if (GNUNET_OK != delete_store_message (get_room_message_store(room), hash))
618 { 648 {
@@ -622,7 +652,8 @@ callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUN
622} 652}
623 653
624void 654void
625callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash) 655callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room,
656 const struct GNUNET_HashCode *hash)
626{ 657{
627 if (!room->host) 658 if (!room->host)
628 return; 659 return;
@@ -631,8 +662,10 @@ callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_
631} 662}
632 663
633int 664int
634delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 665delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
635 const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) 666 struct GNUNET_MESSENGER_MemberSession *session,
667 const struct GNUNET_HashCode *hash,
668 const struct GNUNET_TIME_Relative delay)
636{ 669{
637 GNUNET_assert((room) && (session) && (hash)); 670 GNUNET_assert((room) && (session) && (hash));
638 671
@@ -687,7 +720,8 @@ get_room_key (const struct GNUNET_MESSENGER_SrvRoom *room)
687} 720}
688 721
689const struct GNUNET_MESSENGER_SrvTunnel* 722const struct GNUNET_MESSENGER_SrvTunnel*
690get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer) 723get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room,
724 const struct GNUNET_PeerIdentity *peer)
691{ 725{
692 GNUNET_assert((room) && (peer)); 726 GNUNET_assert((room) && (peer));
693 727
@@ -695,9 +729,11 @@ get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNE
695} 729}
696 730
697static int 731static int
698request_room_message_step (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, 732request_room_message_step (struct GNUNET_MESSENGER_SrvRoom *room,
733 const struct GNUNET_HashCode *hash,
699 const struct GNUNET_MESSENGER_MemberSession *session, 734 const struct GNUNET_MESSENGER_MemberSession *session,
700 GNUNET_MESSENGER_MessageRequestCallback callback, void* cls) 735 GNUNET_MESSENGER_MessageRequestCallback callback,
736 void* cls)
701{ 737{
702 struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room); 738 struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room);
703 739
@@ -732,9 +768,11 @@ forward:
732} 768}
733 769
734int 770int
735request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, 771request_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
772 const struct GNUNET_HashCode *hash,
736 const struct GNUNET_MESSENGER_MemberSession *session, 773 const struct GNUNET_MESSENGER_MemberSession *session,
737 GNUNET_MESSENGER_MessageRequestCallback callback, void* cls) 774 GNUNET_MESSENGER_MessageRequestCallback callback,
775 void* cls)
738{ 776{
739 GNUNET_assert((room) && (hash)); 777 GNUNET_assert((room) && (hash));
740 778
@@ -747,7 +785,8 @@ request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET
747} 785}
748 786
749void 787void
750callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls) 788callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room,
789 void *cls)
751{ 790{
752 struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; 791 struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
753 792
@@ -766,8 +805,10 @@ callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls)
766} 805}
767 806
768int 807int
769callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, 808callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
770 struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash) 809 void *cls,
810 struct GNUNET_MESSENGER_Message *message,
811 struct GNUNET_HashCode *hash)
771{ 812{
772 if (GNUNET_MESSENGER_KIND_UNKNOWN == message->header.kind) 813 if (GNUNET_MESSENGER_KIND_UNKNOWN == message->header.kind)
773 { 814 {
@@ -826,8 +867,10 @@ idle_request_room_messages (void *cls)
826} 867}
827 868
828void 869void
829solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key, 870solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room,
830 const struct GNUNET_ShortHashCode *member_id, struct GNUNET_TIME_Absolute timestamp) 871 const struct GNUNET_IDENTITY_PublicKey *public_key,
872 const struct GNUNET_ShortHashCode *member_id,
873 struct GNUNET_TIME_Absolute timestamp)
831{ 874{
832 GNUNET_assert ((room) && (public_key) && (member_id)); 875 GNUNET_assert ((room) && (public_key) && (member_id));
833 876
@@ -945,7 +988,8 @@ finish_handling:
945 988
946int 989int
947update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, 990update_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
948 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 991 struct GNUNET_MESSENGER_Message *message,
992 const struct GNUNET_HashCode *hash)
949{ 993{
950 GNUNET_assert((room) && (message) && (hash)); 994 GNUNET_assert((room) && (message) && (hash));
951 995
@@ -1008,7 +1052,8 @@ struct GNUNET_MESSENGER_MemberUpdate
1008}; 1052};
1009 1053
1010static int 1054static int
1011iterate_update_member_sessions (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, 1055iterate_update_member_sessions (void *cls,
1056 const struct GNUNET_IDENTITY_PublicKey *public_key,
1012 struct GNUNET_MESSENGER_MemberSession *session) 1057 struct GNUNET_MESSENGER_MemberSession *session)
1013{ 1058{
1014 struct GNUNET_MESSENGER_MemberUpdate *update = cls; 1059 struct GNUNET_MESSENGER_MemberUpdate *update = cls;
@@ -1030,11 +1075,14 @@ iterate_update_member_sessions (void *cls, const struct GNUNET_IDENTITY_PublicKe
1030} 1075}
1031 1076
1032static void 1077static void
1033remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session); 1078remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room,
1079 struct GNUNET_MESSENGER_MemberSession *session);
1034 1080
1035void 1081void
1036callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 1082callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room,
1037 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 1083 struct GNUNET_MESSENGER_SrvHandle *handle,
1084 const struct GNUNET_MESSENGER_Message *message,
1085 const struct GNUNET_HashCode *hash)
1038{ 1086{
1039 struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); 1087 struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room);
1040 struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message); 1088 struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message);
@@ -1113,7 +1161,8 @@ callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUN
1113} 1161}
1114 1162
1115static void 1163static void
1116get_room_data_subdir (struct GNUNET_MESSENGER_SrvRoom *room, char **dir) 1164get_room_data_subdir (struct GNUNET_MESSENGER_SrvRoom *room,
1165 char **dir)
1117{ 1166{
1118 GNUNET_assert((room) && (dir)); 1167 GNUNET_assert((room) && (dir));
1119 1168
@@ -1178,7 +1227,8 @@ save_room (struct GNUNET_MESSENGER_SrvRoom *room)
1178} 1227}
1179 1228
1180static void 1229static void
1181remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session) 1230remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room,
1231 struct GNUNET_MESSENGER_MemberSession *session)
1182{ 1232{
1183 GNUNET_assert ((room) && (session)); 1233 GNUNET_assert ((room) && (session));
1184 1234
diff --git a/src/messenger/gnunet-service-messenger_room.h b/src/messenger/gnunet-service-messenger_room.h
index 31ec877af..4b3811104 100644
--- a/src/messenger/gnunet-service-messenger_room.h
+++ b/src/messenger/gnunet-service-messenger_room.h
@@ -89,7 +89,8 @@ struct GNUNET_MESSENGER_SrvRoom
89 * @return New room 89 * @return New room
90 */ 90 */
91struct GNUNET_MESSENGER_SrvRoom* 91struct GNUNET_MESSENGER_SrvRoom*
92create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); 92create_room (struct GNUNET_MESSENGER_SrvHandle *handle,
93 const struct GNUNET_HashCode *key);
93 94
94/** 95/**
95 * Destroys a room and frees its memory fully. 96 * Destroys a room and frees its memory fully.
@@ -139,7 +140,8 @@ get_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room);
139 * @return #GNUNET_YES on success, #GNUNET_NO on failure. 140 * @return #GNUNET_YES on success, #GNUNET_NO on failure.
140 */ 141 */
141int 142int
142open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle); 143open_room (struct GNUNET_MESSENGER_SrvRoom *room,
144 struct GNUNET_MESSENGER_SrvHandle *handle);
143 145
144/** 146/**
145 * Connects a tunnel to a hosting peer of a <i>room</i> through a so called <i>door</i> which is represented by 147 * Connects a tunnel to a hosting peer of a <i>room</i> through a so called <i>door</i> which is represented by
@@ -152,7 +154,8 @@ open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHan
152 * @return #GNUNET_YES on success, #GNUNET_NO on failure. 154 * @return #GNUNET_YES on success, #GNUNET_NO on failure.
153 */ 155 */
154int 156int
155enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 157enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room,
158 struct GNUNET_MESSENGER_SrvHandle *handle,
156 const struct GNUNET_PeerIdentity *door); 159 const struct GNUNET_PeerIdentity *door);
157 160
158/** 161/**
@@ -173,8 +176,11 @@ enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_Sr
173 * @return New envelope or NULL 176 * @return New envelope or NULL
174 */ 177 */
175struct GNUNET_MQ_Envelope* 178struct GNUNET_MQ_Envelope*
176pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle, 179pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room,
177 struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode); 180 const struct GNUNET_MESSENGER_SrvHandle *handle,
181 struct GNUNET_MESSENGER_Message *message,
182 struct GNUNET_HashCode *hash,
183 int mode);
178 184
179/** 185/**
180 * Sends a <i>message</i> from a given <i>handle</i> into a <i>room</i>. The <i>hash</i> parameter will be 186 * Sends a <i>message</i> from a given <i>handle</i> into a <i>room</i>. The <i>hash</i> parameter will be
@@ -192,7 +198,8 @@ pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNU
192 * @return #GNUNET_YES on success, #GNUNET_NO or #GNUNET_SYSERR otherwise. 198 * @return #GNUNET_YES on success, #GNUNET_NO or #GNUNET_SYSERR otherwise.
193 */ 199 */
194int 200int
195send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 201send_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
202 struct GNUNET_MESSENGER_SrvHandle *handle,
196 struct GNUNET_MESSENGER_Message *message); 203 struct GNUNET_MESSENGER_Message *message);
197 204
198/** 205/**
@@ -204,8 +211,10 @@ send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
204 * @param[in] hash Hash of message 211 * @param[in] hash Hash of message
205 */ 212 */
206void 213void
207forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, 214forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
208 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 215 struct GNUNET_MESSENGER_SrvTunnel *tunnel,
216 struct GNUNET_MESSENGER_Message *message,
217 const struct GNUNET_HashCode *hash);
209 218
210/** 219/**
211 * Checks the current state of opening a given <i>room</i> from this peer and re-publishes it 220 * Checks the current state of opening a given <i>room</i> from this peer and re-publishes it
@@ -216,7 +225,8 @@ forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE
216 * @param[in/out] tunnel Tunnel 225 * @param[in/out] tunnel Tunnel
217 */ 226 */
218void 227void
219check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel); 228check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room,
229 struct GNUNET_MESSENGER_SrvTunnel *tunnel);
220 230
221/** 231/**
222 * Reduces all current forks inside of the message history of a <i>room</i> to one remaining last message 232 * Reduces all current forks inside of the message history of a <i>room</i> to one remaining last message
@@ -226,7 +236,8 @@ check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MES
226 * @param[in/out] handle Handle 236 * @param[in/out] handle Handle
227 */ 237 */
228void 238void
229merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle); 239merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room,
240 struct GNUNET_MESSENGER_SrvHandle *handle);
230 241
231/** 242/**
232 * Deletes a message from the <i>room</i> with a given <i>hash</i> in a specific <i>delay</i> if 243 * Deletes a message from the <i>room</i> with a given <i>hash</i> in a specific <i>delay</i> if
@@ -239,8 +250,10 @@ merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_M
239 * @return #GNUNET_YES on success, #GNUNET_NO if permission gets denied, #GNUNET_SYSERR on operation failure 250 * @return #GNUNET_YES on success, #GNUNET_NO if permission gets denied, #GNUNET_SYSERR on operation failure
240 */ 251 */
241int 252int
242delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, 253delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
243 const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay); 254 struct GNUNET_MESSENGER_MemberSession *session,
255 const struct GNUNET_HashCode *hash,
256 const struct GNUNET_TIME_Relative delay);
244 257
245/** 258/**
246 * Returns the CADET handle from a rooms service. 259 * Returns the CADET handle from a rooms service.
@@ -269,7 +282,8 @@ get_room_key (const struct GNUNET_MESSENGER_SrvRoom *room);
269 * @return Tunnel or NULL 282 * @return Tunnel or NULL
270 */ 283 */
271const struct GNUNET_MESSENGER_SrvTunnel* 284const struct GNUNET_MESSENGER_SrvTunnel*
272get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer); 285get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room,
286 const struct GNUNET_PeerIdentity *peer);
273 287
274/** 288/**
275 * Method called whenever a <i>message</i> is found during a request in a <i>room</i>. 289 * Method called whenever a <i>message</i> is found during a request in a <i>room</i>.
@@ -280,7 +294,8 @@ get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNE
280 * @param[in] hash Hash of message 294 * @param[in] hash Hash of message
281 */ 295 */
282typedef void (GNUNET_MESSENGER_MessageRequestCallback) ( 296typedef void (GNUNET_MESSENGER_MessageRequestCallback) (
283 void *cls, struct GNUNET_MESSENGER_SrvRoom *room, 297 void *cls,
298 struct GNUNET_MESSENGER_SrvRoom *room,
284 const struct GNUNET_MESSENGER_Message *message, 299 const struct GNUNET_MESSENGER_Message *message,
285 const struct GNUNET_HashCode *hash 300 const struct GNUNET_HashCode *hash
286); 301);
@@ -301,9 +316,11 @@ typedef void (GNUNET_MESSENGER_MessageRequestCallback) (
301 * @return #GNUNET_YES if the request could be processed, otherwise #GNUNET_NO 316 * @return #GNUNET_YES if the request could be processed, otherwise #GNUNET_NO
302 */ 317 */
303int 318int
304request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, 319request_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
320 const struct GNUNET_HashCode *hash,
305 const struct GNUNET_MESSENGER_MemberSession *session, 321 const struct GNUNET_MESSENGER_MemberSession *session,
306 GNUNET_MESSENGER_MessageRequestCallback callback, void* cls); 322 GNUNET_MESSENGER_MessageRequestCallback callback,
323 void* cls);
307 324
308/** 325/**
309 * Checks for potential collisions with member ids and solves them changing active handles ids if they 326 * Checks for potential collisions with member ids and solves them changing active handles ids if they
@@ -315,8 +332,10 @@ request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET
315 * @param[in] timestamp Timestamp 332 * @param[in] timestamp Timestamp
316 */ 333 */
317void 334void
318solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key, 335solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room,
319 const struct GNUNET_ShortHashCode *member_id, struct GNUNET_TIME_Absolute timestamp); 336 const struct GNUNET_IDENTITY_PublicKey *public_key,
337 const struct GNUNET_ShortHashCode *member_id,
338 struct GNUNET_TIME_Absolute timestamp);
320 339
321/** 340/**
322 * Rebuilds the decentralized structure for a <i>room</i> by ensuring all required connections are made 341 * Rebuilds the decentralized structure for a <i>room</i> by ensuring all required connections are made
diff --git a/src/messenger/gnunet-service-messenger_service.c b/src/messenger/gnunet-service-messenger_service.c
index 8c63e9bf4..91165cf63 100644
--- a/src/messenger/gnunet-service-messenger_service.c
+++ b/src/messenger/gnunet-service-messenger_service.c
@@ -41,7 +41,8 @@ callback_shutdown_service (void *cls)
41} 41}
42 42
43struct GNUNET_MESSENGER_Service* 43struct GNUNET_MESSENGER_Service*
44create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle) 44create_service (const struct GNUNET_CONFIGURATION_Handle *config,
45 struct GNUNET_SERVICE_Handle *service_handle)
45{ 46{
46 GNUNET_assert((config) && (service_handle)); 47 GNUNET_assert((config) && (service_handle));
47 48
@@ -88,7 +89,9 @@ create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_
88} 89}
89 90
90static int 91static int
91iterate_destroy_rooms (void *cls, const struct GNUNET_HashCode *key, void *value) 92iterate_destroy_rooms (void *cls,
93 const struct GNUNET_HashCode *key,
94 void *value)
92{ 95{
93 struct GNUNET_MESSENGER_SrvRoom *room = value; 96 struct GNUNET_MESSENGER_SrvRoom *room = value;
94 destroy_room (room); 97 destroy_room (room);
@@ -151,7 +154,8 @@ get_service_contact_store (struct GNUNET_MESSENGER_Service *service)
151} 154}
152 155
153struct GNUNET_MESSENGER_SrvHandle* 156struct GNUNET_MESSENGER_SrvHandle*
154add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq) 157add_service_handle (struct GNUNET_MESSENGER_Service *service,
158 struct GNUNET_MQ_Handle *mq)
155{ 159{
156 GNUNET_assert((service) && (mq)); 160 GNUNET_assert((service) && (mq));
157 161
@@ -166,7 +170,8 @@ add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_H
166} 170}
167 171
168void 172void
169remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle) 173remove_service_handle (struct GNUNET_MESSENGER_Service *service,
174 struct GNUNET_MESSENGER_SrvHandle *handle)
170{ 175{
171 GNUNET_assert((service) && (handle)); 176 GNUNET_assert((service) && (handle));
172 177
@@ -178,7 +183,8 @@ remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_M
178} 183}
179 184
180int 185int
181get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer) 186get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service,
187 struct GNUNET_PeerIdentity *peer)
182{ 188{
183 GNUNET_assert((service) && (peer)); 189 GNUNET_assert((service) && (peer));
184 190
@@ -186,7 +192,8 @@ get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struc
186} 192}
187 193
188struct GNUNET_MESSENGER_SrvRoom* 194struct GNUNET_MESSENGER_SrvRoom*
189get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key) 195get_service_room (const struct GNUNET_MESSENGER_Service *service,
196 const struct GNUNET_HashCode *key)
190{ 197{
191 GNUNET_assert((service) && (key)); 198 GNUNET_assert((service) && (key));
192 199
@@ -194,7 +201,8 @@ get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct G
194} 201}
195 202
196int 203int
197open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, 204open_service_room (struct GNUNET_MESSENGER_Service *service,
205 struct GNUNET_MESSENGER_SrvHandle *handle,
198 const struct GNUNET_HashCode *key) 206 const struct GNUNET_HashCode *key)
199{ 207{
200 GNUNET_assert((service) && (handle) && (key)); 208 GNUNET_assert((service) && (handle) && (key));
@@ -217,8 +225,10 @@ open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSE
217} 225}
218 226
219int 227int
220entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, 228entry_service_room (struct GNUNET_MESSENGER_Service *service,
221 const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) 229 struct GNUNET_MESSENGER_SrvHandle *handle,
230 const struct GNUNET_PeerIdentity *door,
231 const struct GNUNET_HashCode *key)
222{ 232{
223 GNUNET_assert((service) && (handle) && (door) && (key)); 233 GNUNET_assert((service) && (handle) && (door) && (key));
224 234
@@ -250,7 +260,8 @@ entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS
250} 260}
251 261
252int 262int
253close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, 263close_service_room (struct GNUNET_MESSENGER_Service *service,
264 struct GNUNET_MESSENGER_SrvHandle *handle,
254 const struct GNUNET_HashCode *key) 265 const struct GNUNET_HashCode *key)
255{ 266{
256 GNUNET_assert((service) && (handle) && (key)); 267 GNUNET_assert((service) && (handle) && (key));
@@ -290,9 +301,11 @@ close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS
290} 301}
291 302
292void 303void
293handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, 304handle_service_message (struct GNUNET_MESSENGER_Service *service,
305 struct GNUNET_MESSENGER_SrvRoom *room,
294 const struct GNUNET_MESSENGER_MemberSession *session, 306 const struct GNUNET_MESSENGER_MemberSession *session,
295 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 307 const struct GNUNET_MESSENGER_Message *message,
308 const struct GNUNET_HashCode *hash)
296{ 309{
297 GNUNET_assert((service) && (room) && (session) && (message) && (hash)); 310 GNUNET_assert((service) && (room) && (session) && (message) && (hash));
298 311
diff --git a/src/messenger/gnunet-service-messenger_service.h b/src/messenger/gnunet-service-messenger_service.h
index aa43fa457..d364a93c0 100644
--- a/src/messenger/gnunet-service-messenger_service.h
+++ b/src/messenger/gnunet-service-messenger_service.h
@@ -68,7 +68,8 @@ struct GNUNET_MESSENGER_Service
68 * @return New service 68 * @return New service
69 */ 69 */
70struct GNUNET_MESSENGER_Service* 70struct GNUNET_MESSENGER_Service*
71create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle); 71create_service (const struct GNUNET_CONFIGURATION_Handle *config,
72 struct GNUNET_SERVICE_Handle *service_handle);
72 73
73/** 74/**
74 * Destroys a <i>service</i> and frees its memory fully. 75 * Destroys a <i>service</i> and frees its memory fully.
@@ -104,7 +105,8 @@ get_service_contact_store (struct GNUNET_MESSENGER_Service *service);
104 * @return New handle 105 * @return New handle
105 */ 106 */
106struct GNUNET_MESSENGER_SrvHandle* 107struct GNUNET_MESSENGER_SrvHandle*
107add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq); 108add_service_handle (struct GNUNET_MESSENGER_Service *service,
109 struct GNUNET_MQ_Handle *mq);
108 110
109/** 111/**
110 * Removes a <i>handle</i> from a <i>service</i> and destroys it. 112 * Removes a <i>handle</i> from a <i>service</i> and destroys it.
@@ -113,7 +115,8 @@ add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_H
113 * @param[in/out] handle Handle 115 * @param[in/out] handle Handle
114 */ 116 */
115void 117void
116remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle); 118remove_service_handle (struct GNUNET_MESSENGER_Service *service,
119 struct GNUNET_MESSENGER_SrvHandle *handle);
117 120
118/** 121/**
119 * Tries to write the peer identity of the peer running a <i>service</i> on to the <i>peer</i> 122 * Tries to write the peer identity of the peer running a <i>service</i> on to the <i>peer</i>
@@ -124,7 +127,8 @@ remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_M
124 * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR 127 * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR
125 */ 128 */
126int 129int
127get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer); 130get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service,
131 struct GNUNET_PeerIdentity *peer);
128 132
129/** 133/**
130 * Returns the room identified by a given <i>key</i> for a <i>service</i>. If the service doesn't know any room 134 * Returns the room identified by a given <i>key</i> for a <i>service</i>. If the service doesn't know any room
@@ -135,7 +139,8 @@ get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struc
135 * @return Room or NULL 139 * @return Room or NULL
136 */ 140 */
137struct GNUNET_MESSENGER_SrvRoom* 141struct GNUNET_MESSENGER_SrvRoom*
138get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key); 142get_service_room (const struct GNUNET_MESSENGER_Service *service,
143 const struct GNUNET_HashCode *key);
139 144
140/** 145/**
141 * Tries to open a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will be 146 * Tries to open a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will be
@@ -147,7 +152,8 @@ get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct G
147 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 152 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
148 */ 153 */
149int 154int
150open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, 155open_service_room (struct GNUNET_MESSENGER_Service *service,
156 struct GNUNET_MESSENGER_SrvHandle *handle,
151 const struct GNUNET_HashCode *key); 157 const struct GNUNET_HashCode *key);
152 158
153/** 159/**
@@ -164,8 +170,10 @@ open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSE
164 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 170 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
165 */ 171 */
166int 172int
167entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, 173entry_service_room (struct GNUNET_MESSENGER_Service *service,
168 const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); 174 struct GNUNET_MESSENGER_SrvHandle *handle,
175 const struct GNUNET_PeerIdentity *door,
176 const struct GNUNET_HashCode *key);
169 177
170/** 178/**
171 * Tries to close a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will 179 * Tries to close a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will
@@ -180,7 +188,8 @@ entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS
180 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 188 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
181 */ 189 */
182int 190int
183close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, 191close_service_room (struct GNUNET_MESSENGER_Service *service,
192 struct GNUNET_MESSENGER_SrvHandle *handle,
184 const struct GNUNET_HashCode *key); 193 const struct GNUNET_HashCode *key);
185 194
186/** 195/**
@@ -194,8 +203,10 @@ close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS
194 * @param[in] hash Hash of message 203 * @param[in] hash Hash of message
195 */ 204 */
196void 205void
197handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, 206handle_service_message (struct GNUNET_MESSENGER_Service *service,
207 struct GNUNET_MESSENGER_SrvRoom *room,
198 const struct GNUNET_MESSENGER_MemberSession *session, 208 const struct GNUNET_MESSENGER_MemberSession *session,
199 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 209 const struct GNUNET_MESSENGER_Message *message,
210 const struct GNUNET_HashCode *hash);
200 211
201#endif //GNUNET_SERVICE_MESSENGER_SERVICE_H 212#endif //GNUNET_SERVICE_MESSENGER_SERVICE_H
diff --git a/src/messenger/gnunet-service-messenger_tunnel.c b/src/messenger/gnunet-service-messenger_tunnel.c
index b9d063813..fdd6429e6 100644
--- a/src/messenger/gnunet-service-messenger_tunnel.c
+++ b/src/messenger/gnunet-service-messenger_tunnel.c
@@ -33,7 +33,8 @@
33#include "messenger_api_util.h" 33#include "messenger_api_util.h"
34 34
35struct GNUNET_MESSENGER_SrvTunnel* 35struct GNUNET_MESSENGER_SrvTunnel*
36create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door) 36create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room,
37 const struct GNUNET_PeerIdentity *door)
37{ 38{
38 GNUNET_assert((room) && (door)); 39 GNUNET_assert((room) && (door));
39 40
@@ -72,7 +73,8 @@ destroy_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel)
72} 73}
73 74
74void 75void
75bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel) 76bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
77 struct GNUNET_CADET_Channel *channel)
76{ 78{
77 GNUNET_assert(tunnel); 79 GNUNET_assert(tunnel);
78 80
@@ -83,10 +85,12 @@ bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Chan
83} 85}
84 86
85extern void 87extern void
86callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls); 88callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room,
89 void *cls);
87 90
88void 91void
89callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channel) 92callback_tunnel_disconnect (void *cls,
93 const struct GNUNET_CADET_Channel *channel)
90{ 94{
91 struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; 95 struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
92 96
@@ -99,11 +103,14 @@ callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channe
99} 103}
100 104
101extern int 105extern int
102callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, 106callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
103 struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash); 107 void *cls,
108 struct GNUNET_MESSENGER_Message *message,
109 struct GNUNET_HashCode *hash);
104 110
105int 111int
106check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header) 112check_tunnel_message (void *cls,
113 const struct GNUNET_MessageHeader *header)
107{ 114{
108 struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; 115 struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
109 116
@@ -137,14 +144,18 @@ check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header)
137 144
138extern int 145extern int
139update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, 146update_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
140 struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 147 struct GNUNET_MESSENGER_Message *message,
148 const struct GNUNET_HashCode *hash);
141 149
142extern void 150extern void
143callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, 151callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room,
144 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 152 struct GNUNET_MESSENGER_SrvHandle *handle,
153 const struct GNUNET_MESSENGER_Message *message,
154 const struct GNUNET_HashCode *hash);
145 155
146static void 156static void
147update_tunnel_last_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_HashCode *hash) 157update_tunnel_last_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
158 const struct GNUNET_HashCode *hash)
148{ 159{
149 struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(tunnel->room); 160 struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(tunnel->room);
150 161
@@ -281,7 +292,8 @@ callback_tunnel_sent (void *cls)
281} 292}
282 293
283void 294void
284send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env, 295send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
296 struct GNUNET_MQ_Envelope *env,
285 const struct GNUNET_HashCode *hash) 297 const struct GNUNET_HashCode *hash)
286{ 298{
287 GNUNET_assert((tunnel) && (env) && (hash)); 299 GNUNET_assert((tunnel) && (env) && (hash));
@@ -299,7 +311,9 @@ send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_M
299} 311}
300 312
301int 313int
302send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message) 314send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
315 void *handle,
316 struct GNUNET_MESSENGER_Message *message)
303{ 317{
304 GNUNET_assert((tunnel) && (handle)); 318 GNUNET_assert((tunnel) && (handle));
305 319
@@ -325,7 +339,8 @@ send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, st
325} 339}
326 340
327void 341void
328forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, 342forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
343 const struct GNUNET_MESSENGER_Message *message,
329 const struct GNUNET_HashCode *hash) 344 const struct GNUNET_HashCode *hash)
330{ 345{
331 GNUNET_assert((tunnel) && (message) && (hash)); 346 GNUNET_assert((tunnel) && (message) && (hash));
@@ -353,7 +368,8 @@ get_tunnel_peer_message (const struct GNUNET_MESSENGER_SrvTunnel *tunnel)
353} 368}
354 369
355void 370void
356get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer) 371get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel,
372 struct GNUNET_PeerIdentity *peer)
357{ 373{
358 GNUNET_assert(tunnel); 374 GNUNET_assert(tunnel);
359 375
@@ -369,7 +385,8 @@ get_tunnel_messenger_version (const struct GNUNET_MESSENGER_SrvTunnel *tunnel)
369} 385}
370 386
371int 387int
372update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version) 388update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
389 uint32_t version)
373{ 390{
374 GNUNET_assert(tunnel); 391 GNUNET_assert(tunnel);
375 392
diff --git a/src/messenger/gnunet-service-messenger_tunnel.h b/src/messenger/gnunet-service-messenger_tunnel.h
index 96d98546d..7bd749281 100644
--- a/src/messenger/gnunet-service-messenger_tunnel.h
+++ b/src/messenger/gnunet-service-messenger_tunnel.h
@@ -55,7 +55,8 @@ struct GNUNET_MESSENGER_SrvTunnel
55 * @return New tunnel 55 * @return New tunnel
56 */ 56 */
57struct GNUNET_MESSENGER_SrvTunnel* 57struct GNUNET_MESSENGER_SrvTunnel*
58create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door); 58create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room,
59 const struct GNUNET_PeerIdentity *door);
59 60
60/** 61/**
61 * Destroys a <i>tunnel</i> and frees its memory fully. 62 * Destroys a <i>tunnel</i> and frees its memory fully.
@@ -73,7 +74,8 @@ destroy_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel);
73 * @param[in/out] channel CADET channel 74 * @param[in/out] channel CADET channel
74 */ 75 */
75void 76void
76bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel); 77bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
78 struct GNUNET_CADET_Channel *channel);
77 79
78/** 80/**
79 * Tries to connect a <i>tunnel</i> by creating a new CADET channel and binding it. 81 * Tries to connect a <i>tunnel</i> by creating a new CADET channel and binding it.
@@ -112,7 +114,8 @@ is_tunnel_connected (const struct GNUNET_MESSENGER_SrvTunnel *tunnel);
112 * @param[in] hash Hash of message 114 * @param[in] hash Hash of message
113 */ 115 */
114void 116void
115send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env, 117send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
118 struct GNUNET_MQ_Envelope *env,
116 const struct GNUNET_HashCode *hash); 119 const struct GNUNET_HashCode *hash);
117 120
118/** 121/**
@@ -126,7 +129,9 @@ send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_M
126 * @return #GNUNET_YES on success, GNUNET_NO otherwise 129 * @return #GNUNET_YES on success, GNUNET_NO otherwise
127 */ 130 */
128int 131int
129send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message); 132send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
133 void *handle,
134 struct GNUNET_MESSENGER_Message *message);
130 135
131/** 136/**
132 * Forwards a given <i>message</i> with a known <i>hash</i> through a <i>tunnel</i>. 137 * Forwards a given <i>message</i> with a known <i>hash</i> through a <i>tunnel</i>.
@@ -136,7 +141,8 @@ send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, st
136 * @param[in] hash Hash of message 141 * @param[in] hash Hash of message
137 */ 142 */
138void 143void
139forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, 144forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
145 const struct GNUNET_MESSENGER_Message *message,
140 const struct GNUNET_HashCode *hash); 146 const struct GNUNET_HashCode *hash);
141 147
142/** 148/**
@@ -158,7 +164,8 @@ get_tunnel_peer_message (const struct GNUNET_MESSENGER_SrvTunnel *tunnel);
158 * @param[out] peer Peer identity 164 * @param[out] peer Peer identity
159 */ 165 */
160void 166void
161get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer); 167get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel,
168 struct GNUNET_PeerIdentity *peer);
162 169
163/** 170/**
164 * Returns the current messenger version the peer connected via a given <i>tunnel</i> 171 * Returns the current messenger version the peer connected via a given <i>tunnel</i>
@@ -181,6 +188,7 @@ get_tunnel_messenger_version (const struct GNUNET_MESSENGER_SrvTunnel *tunnel);
181 * @param[in] version Version of messenger 188 * @param[in] version Version of messenger
182 */ 189 */
183int 190int
184update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version); 191update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
192 uint32_t version);
185 193
186#endif //GNUNET_SERVICE_MESSENGER_TUNNEL_H 194#endif //GNUNET_SERVICE_MESSENGER_TUNNEL_H
diff --git a/src/messenger/messenger_api.c b/src/messenger/messenger_api.c
index f7c73f769..ef6244e19 100644
--- a/src/messenger/messenger_api.c
+++ b/src/messenger/messenger_api.c
@@ -70,14 +70,16 @@ GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind)
70} 70}
71 71
72static int 72static int
73check_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) 73check_get_name (void *cls,
74 const struct GNUNET_MESSENGER_NameMessage *msg)
74{ 75{
75 GNUNET_MQ_check_zero_termination(msg); 76 GNUNET_MQ_check_zero_termination(msg);
76 return GNUNET_OK; 77 return GNUNET_OK;
77} 78}
78 79
79static void 80static void
80handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) 81handle_get_name (void *cls,
82 const struct GNUNET_MESSENGER_NameMessage *msg)
81{ 83{
82 struct GNUNET_MESSENGER_Handle *handle = cls; 84 struct GNUNET_MESSENGER_Handle *handle = cls;
83 85
@@ -89,7 +91,8 @@ handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg)
89} 91}
90 92
91static int 93static int
92check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) 94check_get_key (void *cls,
95 const struct GNUNET_MESSENGER_KeyMessage *msg)
93{ 96{
94 const uint16_t full_length = ntohs (msg->header.size); 97 const uint16_t full_length = ntohs (msg->header.size);
95 98
@@ -107,7 +110,8 @@ check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg)
107} 110}
108 111
109static void 112static void
110handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) 113handle_get_key (void *cls,
114 const struct GNUNET_MESSENGER_KeyMessage *msg)
111{ 115{
112 struct GNUNET_MESSENGER_Handle *handle = cls; 116 struct GNUNET_MESSENGER_Handle *handle = cls;
113 117
@@ -129,7 +133,8 @@ handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg)
129} 133}
130 134
131static void 135static void
132handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg) 136handle_member_id (void *cls,
137 const struct GNUNET_MESSENGER_MemberMessage *msg)
133{ 138{
134 struct GNUNET_MESSENGER_Handle *handle = cls; 139 struct GNUNET_MESSENGER_Handle *handle = cls;
135 140
@@ -150,7 +155,8 @@ handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg)
150} 155}
151 156
152static void 157static void
153handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 158handle_room_open (void *cls,
159 const struct GNUNET_MESSENGER_RoomMessage *msg)
154{ 160{
155 struct GNUNET_MESSENGER_Handle *handle = cls; 161 struct GNUNET_MESSENGER_Handle *handle = cls;
156 162
@@ -162,7 +168,8 @@ handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
162} 168}
163 169
164static void 170static void
165handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 171handle_room_entry (void *cls,
172 const struct GNUNET_MESSENGER_RoomMessage *msg)
166{ 173{
167 struct GNUNET_MESSENGER_Handle *handle = cls; 174 struct GNUNET_MESSENGER_Handle *handle = cls;
168 175
@@ -175,7 +182,8 @@ handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
175} 182}
176 183
177static void 184static void
178handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) 185handle_room_close (void *cls,
186 const struct GNUNET_MESSENGER_RoomMessage *msg)
179{ 187{
180 struct GNUNET_MESSENGER_Handle *handle = cls; 188 struct GNUNET_MESSENGER_Handle *handle = cls;
181 189
@@ -187,7 +195,8 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
187} 195}
188 196
189static int 197static int
190check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) 198check_recv_message (void *cls,
199 const struct GNUNET_MESSENGER_RecvMessage *msg)
191{ 200{
192 const uint16_t full_length = ntohs (msg->header.size); 201 const uint16_t full_length = ntohs (msg->header.size);
193 202
@@ -209,7 +218,8 @@ check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg)
209} 218}
210 219
211static void 220static void
212handle_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) 221handle_recv_message (void *cls,
222 const struct GNUNET_MESSENGER_RecvMessage *msg)
213{ 223{
214 struct GNUNET_MESSENGER_Handle *handle = cls; 224 struct GNUNET_MESSENGER_Handle *handle = cls;
215 225
@@ -255,7 +265,8 @@ static void
255reconnect (struct GNUNET_MESSENGER_Handle *handle); 265reconnect (struct GNUNET_MESSENGER_Handle *handle);
256 266
257static void 267static void
258send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) 268send_open_room (struct GNUNET_MESSENGER_Handle *handle,
269 struct GNUNET_MESSENGER_Room *room)
259{ 270{
260 struct GNUNET_MESSENGER_RoomMessage *msg; 271 struct GNUNET_MESSENGER_RoomMessage *msg;
261 struct GNUNET_MQ_Envelope *env; 272 struct GNUNET_MQ_Envelope *env;
@@ -266,7 +277,8 @@ send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_
266} 277}
267 278
268static void 279static void
269send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room, 280send_enter_room (struct GNUNET_MESSENGER_Handle *handle,
281 struct GNUNET_MESSENGER_Room *room,
270 const struct GNUNET_PeerIdentity *door) 282 const struct GNUNET_PeerIdentity *door)
271{ 283{
272 struct GNUNET_MESSENGER_RoomMessage *msg; 284 struct GNUNET_MESSENGER_RoomMessage *msg;
@@ -279,7 +291,8 @@ send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER
279} 291}
280 292
281static void 293static void
282send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) 294send_close_room (struct GNUNET_MESSENGER_Handle *handle,
295 struct GNUNET_MESSENGER_Room *room)
283{ 296{
284 struct GNUNET_MESSENGER_RoomMessage *msg; 297 struct GNUNET_MESSENGER_RoomMessage *msg;
285 struct GNUNET_MQ_Envelope *env; 298 struct GNUNET_MQ_Envelope *env;
@@ -290,7 +303,9 @@ send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER
290} 303}
291 304
292static int 305static int
293iterate_reset_room (void *cls, const struct GNUNET_HashCode *key, void *value) 306iterate_reset_room (void *cls,
307 const struct GNUNET_HashCode *key,
308 void *value)
294{ 309{
295 struct GNUNET_MESSENGER_Handle *handle = cls; 310 struct GNUNET_MESSENGER_Handle *handle = cls;
296 struct GNUNET_MESSENGER_Room *room = value; 311 struct GNUNET_MESSENGER_Room *room = value;
@@ -329,7 +344,9 @@ callback_reconnect (void *cls)
329} 344}
330 345
331static int 346static int
332iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value) 347iterate_close_room (void *cls,
348 const struct GNUNET_HashCode *key,
349 void *value)
333{ 350{
334 struct GNUNET_MESSENGER_Handle *handle = cls; 351 struct GNUNET_MESSENGER_Handle *handle = cls;
335 struct GNUNET_MESSENGER_Room *room = value; 352 struct GNUNET_MESSENGER_Room *room = value;
@@ -340,7 +357,8 @@ iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value)
340} 357}
341 358
342static void 359static void
343callback_mq_error (void *cls, enum GNUNET_MQ_Error error) 360callback_mq_error (void *cls,
361 enum GNUNET_MQ_Error error)
344{ 362{
345 struct GNUNET_MESSENGER_Handle *handle = cls; 363 struct GNUNET_MESSENGER_Handle *handle = cls;
346 364
@@ -402,9 +420,12 @@ reconnect (struct GNUNET_MESSENGER_Handle *handle)
402} 420}
403 421
404struct GNUNET_MESSENGER_Handle* 422struct GNUNET_MESSENGER_Handle*
405GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, 423GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
406 GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls, 424 const char *name,
407 GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls) 425 GNUNET_MESSENGER_IdentityCallback identity_callback,
426 void *identity_cls,
427 GNUNET_MESSENGER_MessageCallback msg_callback,
428 void *msg_cls)
408{ 429{
409 struct GNUNET_MESSENGER_Handle *handle = create_handle (cfg, identity_callback, identity_cls, msg_callback, msg_cls); 430 struct GNUNET_MESSENGER_Handle *handle = create_handle (cfg, identity_callback, identity_cls, msg_callback, msg_cls);
410 431
@@ -475,7 +496,8 @@ GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle)
475} 496}
476 497
477int 498int
478GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) 499GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle,
500 const char *name)
479{ 501{
480 if (!handle) 502 if (!handle)
481 return GNUNET_SYSERR; 503 return GNUNET_SYSERR;
@@ -517,7 +539,8 @@ GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle)
517} 539}
518 540
519struct GNUNET_MESSENGER_Room* 541struct GNUNET_MESSENGER_Room*
520GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) 542GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle,
543 const struct GNUNET_HashCode *key)
521{ 544{
522 if ((!handle) || (!key)) 545 if ((!handle) || (!key))
523 return NULL; 546 return NULL;
@@ -541,7 +564,8 @@ GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct
541} 564}
542 565
543struct GNUNET_MESSENGER_Room* 566struct GNUNET_MESSENGER_Room*
544GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, 567GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle,
568 const struct GNUNET_PeerIdentity *door,
545 const struct GNUNET_HashCode *key) 569 const struct GNUNET_HashCode *key)
546{ 570{
547 if ((!handle) || (!door) || (!key)) 571 if ((!handle) || (!door) || (!key))
@@ -583,7 +607,9 @@ struct GNUNET_MESSENGER_RoomFind
583}; 607};
584 608
585static int 609static int
586iterate_find_room (void* cls, const struct GNUNET_HashCode *key, void *value) 610iterate_find_room (void* cls,
611 const struct GNUNET_HashCode *key,
612 void *value)
587{ 613{
588 struct GNUNET_MESSENGER_RoomFind *find = cls; 614 struct GNUNET_MESSENGER_RoomFind *find = cls;
589 struct GNUNET_MESSENGER_Room *room = value; 615 struct GNUNET_MESSENGER_Room *room = value;
@@ -602,8 +628,10 @@ iterate_find_room (void* cls, const struct GNUNET_HashCode *key, void *value)
602} 628}
603 629
604int 630int
605GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, 631GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle,
606 GNUNET_MESSENGER_MemberCallback callback, void *cls) 632 const struct GNUNET_MESSENGER_Contact *contact,
633 GNUNET_MESSENGER_MemberCallback callback,
634 void *cls)
607{ 635{
608 if (!handle) 636 if (!handle)
609 return GNUNET_SYSERR; 637 return GNUNET_SYSERR;
@@ -628,7 +656,8 @@ GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room)
628} 656}
629 657
630const struct GNUNET_MESSENGER_Contact* 658const struct GNUNET_MESSENGER_Contact*
631GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) 659GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room,
660 const struct GNUNET_HashCode *hash)
632{ 661{
633 if ((!room) || (!hash)) 662 if ((!room) || (!hash))
634 return NULL; 663 return NULL;
@@ -655,7 +684,8 @@ GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact
655} 684}
656 685
657void 686void
658GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, 687GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room,
688 const struct GNUNET_MESSENGER_Message *message,
659 const struct GNUNET_MESSENGER_Contact *contact) 689 const struct GNUNET_MESSENGER_Contact *contact)
660{ 690{
661 if ((!room) || (!message)) 691 if ((!room) || (!message))
@@ -723,7 +753,8 @@ GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct
723} 753}
724 754
725const struct GNUNET_MESSENGER_Message* 755const struct GNUNET_MESSENGER_Message*
726GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) 756GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room,
757 const struct GNUNET_HashCode *hash)
727{ 758{
728 if ((!room) || (!hash)) 759 if ((!room) || (!hash))
729 return NULL; 760 return NULL;
@@ -745,7 +776,8 @@ GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const st
745} 776}
746 777
747int 778int
748GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, 779GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room,
780 GNUNET_MESSENGER_MemberCallback callback,
749 void *cls) 781 void *cls)
750{ 782{
751 if (!room) 783 if (!room)
diff --git a/src/messenger/messenger_api_contact.c b/src/messenger/messenger_api_contact.c
index 04e1f60c1..cbca17640 100644
--- a/src/messenger/messenger_api_contact.c
+++ b/src/messenger/messenger_api_contact.c
@@ -60,7 +60,8 @@ get_contact_name (const struct GNUNET_MESSENGER_Contact *contact)
60} 60}
61 61
62void 62void
63set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name) 63set_contact_name (struct GNUNET_MESSENGER_Contact *contact,
64 const char *name)
64{ 65{
65 GNUNET_assert(contact); 66 GNUNET_assert(contact);
66 67
@@ -98,7 +99,8 @@ decrease_contact_rc (struct GNUNET_MESSENGER_Contact *contact)
98} 99}
99 100
100void 101void
101get_context_from_member (const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, 102get_context_from_member (const struct GNUNET_HashCode *key,
103 const struct GNUNET_ShortHashCode *id,
102 struct GNUNET_HashCode *context) 104 struct GNUNET_HashCode *context)
103{ 105{
104 GNUNET_assert((key) && (id) && (context)); 106 GNUNET_assert((key) && (id) && (context));
diff --git a/src/messenger/messenger_api_contact.h b/src/messenger/messenger_api_contact.h
index e94d1fcd0..b5410f998 100644
--- a/src/messenger/messenger_api_contact.h
+++ b/src/messenger/messenger_api_contact.h
@@ -71,7 +71,8 @@ get_contact_name (const struct GNUNET_MESSENGER_Contact *contact);
71 * @param[in] name Name 71 * @param[in] name Name
72 */ 72 */
73void 73void
74set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name); 74set_contact_name (struct GNUNET_MESSENGER_Contact *contact,
75 const char *name);
75 76
76/** 77/**
77 * Returns the public key of a given <i>contact</i>. 78 * Returns the public key of a given <i>contact</i>.
@@ -108,7 +109,8 @@ decrease_contact_rc (struct GNUNET_MESSENGER_Contact *contact);
108 * @param[out] hash Member context 109 * @param[out] hash Member context
109 */ 110 */
110void 111void
111get_context_from_member (const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, 112get_context_from_member (const struct GNUNET_HashCode *key,
113 const struct GNUNET_ShortHashCode *id,
112 struct GNUNET_HashCode *context); 114 struct GNUNET_HashCode *context);
113 115
114#endif //GNUNET_MESSENGER_API_CONTACT_H 116#endif //GNUNET_MESSENGER_API_CONTACT_H
diff --git a/src/messenger/messenger_api_contact_store.c b/src/messenger/messenger_api_contact_store.c
index 6a517c2e0..1c10a8fbf 100644
--- a/src/messenger/messenger_api_contact_store.c
+++ b/src/messenger/messenger_api_contact_store.c
@@ -38,7 +38,9 @@ init_contact_store (struct GNUNET_MESSENGER_ContactStore *store)
38} 38}
39 39
40static int 40static int
41iterate_destroy_contacts (void *cls, const struct GNUNET_HashCode *key, void *value) 41iterate_destroy_contacts (void *cls,
42 const struct GNUNET_HashCode *key,
43 void *value)
42{ 44{
43 struct GNUNET_MESSENGER_Contact *contact = value; 45 struct GNUNET_MESSENGER_Contact *contact = value;
44 destroy_contact (contact); 46 destroy_contact (contact);
@@ -58,7 +60,8 @@ clear_contact_store (struct GNUNET_MESSENGER_ContactStore *store)
58} 60}
59 61
60static struct GNUNET_CONTAINER_MultiHashMap* 62static struct GNUNET_CONTAINER_MultiHashMap*
61select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, 63select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store,
64 const struct GNUNET_HashCode *context,
62 struct GNUNET_HashCode *hash) 65 struct GNUNET_HashCode *hash)
63{ 66{
64 const struct GNUNET_IDENTITY_PublicKey *anonymous = get_anonymous_public_key (); 67 const struct GNUNET_IDENTITY_PublicKey *anonymous = get_anonymous_public_key ();
@@ -76,7 +79,8 @@ select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store, const str
76} 79}
77 80
78struct GNUNET_MESSENGER_Contact* 81struct GNUNET_MESSENGER_Contact*
79get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, 82get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store,
83 const struct GNUNET_HashCode *context,
80 const struct GNUNET_HashCode *key_hash) 84 const struct GNUNET_HashCode *key_hash)
81{ 85{
82 GNUNET_assert ((store) && (store->contacts) && (context) && (key_hash)); 86 GNUNET_assert ((store) && (store->contacts) && (context) && (key_hash));
@@ -92,7 +96,8 @@ get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct
92} 96}
93 97
94struct GNUNET_MESSENGER_Contact* 98struct GNUNET_MESSENGER_Contact*
95get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, 99get_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
100 const struct GNUNET_HashCode *context,
96 const struct GNUNET_IDENTITY_PublicKey *pubkey) 101 const struct GNUNET_IDENTITY_PublicKey *pubkey)
97{ 102{
98 GNUNET_assert ((store) && (store->contacts) && (context) && (pubkey)); 103 GNUNET_assert ((store) && (store->contacts) && (context) && (pubkey));
@@ -130,8 +135,10 @@ get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNU
130} 135}
131 136
132void 137void
133update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, 138update_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
134 const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *next_context, 139 struct GNUNET_MESSENGER_Contact* contact,
140 const struct GNUNET_HashCode *context,
141 const struct GNUNET_HashCode *next_context,
135 const struct GNUNET_IDENTITY_PublicKey *pubkey) 142 const struct GNUNET_IDENTITY_PublicKey *pubkey)
136{ 143{
137 GNUNET_assert ((store) && (store->contacts) && (contact) && (pubkey)); 144 GNUNET_assert ((store) && (store->contacts) && (contact) && (pubkey));
@@ -163,7 +170,8 @@ update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET
163} 170}
164 171
165void 172void
166remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, 173remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
174 struct GNUNET_MESSENGER_Contact* contact,
167 const struct GNUNET_HashCode *context) 175 const struct GNUNET_HashCode *context)
168{ 176{
169 GNUNET_assert ((store) && (store->contacts) && (contact)); 177 GNUNET_assert ((store) && (store->contacts) && (contact));
diff --git a/src/messenger/messenger_api_contact_store.h b/src/messenger/messenger_api_contact_store.h
index f2dad9f84..bdab2ceeb 100644
--- a/src/messenger/messenger_api_contact_store.h
+++ b/src/messenger/messenger_api_contact_store.h
@@ -68,7 +68,8 @@ clear_contact_store (struct GNUNET_MESSENGER_ContactStore *store);
68 * @param[in] key_hash Hash of public key 68 * @param[in] key_hash Hash of public key
69 */ 69 */
70struct GNUNET_MESSENGER_Contact* 70struct GNUNET_MESSENGER_Contact*
71get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, 71get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store,
72 const struct GNUNET_HashCode *context,
72 const struct GNUNET_HashCode *key_hash); 73 const struct GNUNET_HashCode *key_hash);
73 74
74/** 75/**
@@ -87,7 +88,8 @@ get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct
87 * @param[in] pubkey Public key of EGO 88 * @param[in] pubkey Public key of EGO
88 */ 89 */
89struct GNUNET_MESSENGER_Contact* 90struct GNUNET_MESSENGER_Contact*
90get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, 91get_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
92 const struct GNUNET_HashCode *context,
91 const struct GNUNET_IDENTITY_PublicKey *pubkey); 93 const struct GNUNET_IDENTITY_PublicKey *pubkey);
92 94
93/** 95/**
@@ -103,8 +105,10 @@ get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNU
103 * @param[in] pubkey Public key of EGO 105 * @param[in] pubkey Public key of EGO
104 */ 106 */
105void 107void
106update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, 108update_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
107 const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *next_context, 109 struct GNUNET_MESSENGER_Contact* contact,
110 const struct GNUNET_HashCode *context,
111 const struct GNUNET_HashCode *next_context,
108 const struct GNUNET_IDENTITY_PublicKey *pubkey); 112 const struct GNUNET_IDENTITY_PublicKey *pubkey);
109 113
110/** 114/**
@@ -116,7 +120,8 @@ update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET
116 * @param[in] context Member context 120 * @param[in] context Member context
117 */ 121 */
118void 122void
119remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, 123remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
124 struct GNUNET_MESSENGER_Contact* contact,
120 const struct GNUNET_HashCode *context); 125 const struct GNUNET_HashCode *context);
121 126
122#endif //GNUNET_MESSENGER_API_CONTACT_STORE_H 127#endif //GNUNET_MESSENGER_API_CONTACT_STORE_H
diff --git a/src/messenger/messenger_api_handle.c b/src/messenger/messenger_api_handle.c
index ab57f82cc..516807e13 100644
--- a/src/messenger/messenger_api_handle.c
+++ b/src/messenger/messenger_api_handle.c
@@ -28,8 +28,11 @@
28#include "messenger_api_util.h" 28#include "messenger_api_util.h"
29 29
30struct GNUNET_MESSENGER_Handle* 30struct GNUNET_MESSENGER_Handle*
31create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback, 31create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg,
32 void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls) 32 GNUNET_MESSENGER_IdentityCallback identity_callback,
33 void *identity_cls,
34 GNUNET_MESSENGER_MessageCallback msg_callback,
35 void *msg_cls)
33{ 36{
34 GNUNET_assert(cfg); 37 GNUNET_assert(cfg);
35 38
@@ -58,7 +61,9 @@ create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_I
58} 61}
59 62
60static int 63static int
61iterate_destroy_room (void *cls, const struct GNUNET_HashCode *key, void *value) 64iterate_destroy_room (void *cls,
65 const struct GNUNET_HashCode *key,
66 void *value)
62{ 67{
63 struct GNUNET_MESSENGER_Room *room = value; 68 struct GNUNET_MESSENGER_Room *room = value;
64 69
@@ -97,7 +102,8 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle)
97} 102}
98 103
99void 104void
100set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) 105set_handle_name (struct GNUNET_MESSENGER_Handle *handle,
106 const char *name)
101{ 107{
102 GNUNET_assert(handle); 108 GNUNET_assert(handle);
103 109
@@ -116,7 +122,8 @@ get_handle_name (const struct GNUNET_MESSENGER_Handle *handle)
116} 122}
117 123
118void 124void
119set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey) 125set_handle_key (struct GNUNET_MESSENGER_Handle *handle,
126 const struct GNUNET_IDENTITY_PublicKey *pubkey)
120{ 127{
121 GNUNET_assert(handle); 128 GNUNET_assert(handle);
122 129
@@ -146,7 +153,8 @@ get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle)
146} 153}
147 154
148struct GNUNET_MESSENGER_Contact* 155struct GNUNET_MESSENGER_Contact*
149get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) 156get_handle_contact (struct GNUNET_MESSENGER_Handle *handle,
157 const struct GNUNET_HashCode *key)
150{ 158{
151 GNUNET_assert((handle) && (key)); 159 GNUNET_assert((handle) && (key));
152 160
@@ -162,7 +170,8 @@ get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_
162} 170}
163 171
164void 172void
165open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) 173open_handle_room (struct GNUNET_MESSENGER_Handle *handle,
174 const struct GNUNET_HashCode *key)
166{ 175{
167 GNUNET_assert((handle) && (key)); 176 GNUNET_assert((handle) && (key));
168 177
@@ -173,7 +182,8 @@ open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_Ha
173} 182}
174 183
175void 184void
176entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, 185entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle,
186 const struct GNUNET_PeerIdentity *door,
177 const struct GNUNET_HashCode *key) 187 const struct GNUNET_HashCode *key)
178{ 188{
179 GNUNET_assert((handle) && (door) && (key)); 189 GNUNET_assert((handle) && (door) && (key));
@@ -185,7 +195,8 @@ entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNE
185} 195}
186 196
187void 197void
188close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) 198close_handle_room (struct GNUNET_MESSENGER_Handle *handle,
199 const struct GNUNET_HashCode *key)
189{ 200{
190 GNUNET_assert((handle) && (key)); 201 GNUNET_assert((handle) && (key));
191 202
diff --git a/src/messenger/messenger_api_handle.h b/src/messenger/messenger_api_handle.h
index e6ca474f2..6a43f13a6 100644
--- a/src/messenger/messenger_api_handle.h
+++ b/src/messenger/messenger_api_handle.h
@@ -71,8 +71,11 @@ struct GNUNET_MESSENGER_Handle
71 * @return New handle 71 * @return New handle
72 */ 72 */
73struct GNUNET_MESSENGER_Handle* 73struct GNUNET_MESSENGER_Handle*
74create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback, 74create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg,
75 void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls); 75 GNUNET_MESSENGER_IdentityCallback identity_callback,
76 void *identity_cls,
77 GNUNET_MESSENGER_MessageCallback msg_callback,
78 void *msg_cls);
76 79
77/** 80/**
78 * Destroys a <i>handle</i> and frees its memory fully from the client API. 81 * Destroys a <i>handle</i> and frees its memory fully from the client API.
@@ -89,7 +92,8 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle);
89 * @param[in] name New name 92 * @param[in] name New name
90 */ 93 */
91void 94void
92set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); 95set_handle_name (struct GNUNET_MESSENGER_Handle *handle,
96 const char *name);
93 97
94/** 98/**
95 * Returns the current name of a given <i>handle</i> or NULL if no valid name was assigned yet. 99 * Returns the current name of a given <i>handle</i> or NULL if no valid name was assigned yet.
@@ -107,7 +111,8 @@ get_handle_name (const struct GNUNET_MESSENGER_Handle *handle);
107 * @param[in] pubkey Public key 111 * @param[in] pubkey Public key
108 */ 112 */
109void 113void
110set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey); 114set_handle_key (struct GNUNET_MESSENGER_Handle *handle,
115 const struct GNUNET_IDENTITY_PublicKey *pubkey);
111 116
112/** 117/**
113 * Returns the public key of a given <i>handle</i>. 118 * Returns the public key of a given <i>handle</i>.
@@ -136,7 +141,8 @@ get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle);
136 * @return Contact 141 * @return Contact
137 */ 142 */
138struct GNUNET_MESSENGER_Contact* 143struct GNUNET_MESSENGER_Contact*
139get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); 144get_handle_contact (struct GNUNET_MESSENGER_Handle *handle,
145 const struct GNUNET_HashCode *key);
140 146
141/** 147/**
142 * Marks a room known to a <i>handle</i> identified by a given <i>key</i> as open. 148 * Marks a room known to a <i>handle</i> identified by a given <i>key</i> as open.
@@ -145,7 +151,8 @@ get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_
145 * @param[in] key Key of room 151 * @param[in] key Key of room
146 */ 152 */
147void 153void
148open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); 154open_handle_room (struct GNUNET_MESSENGER_Handle *handle,
155 const struct GNUNET_HashCode *key);
149 156
150/** 157/**
151 * Adds a tunnel for a room known to a <i>handle</i> identified by a given <i>key</i> to a 158 * Adds a tunnel for a room known to a <i>handle</i> identified by a given <i>key</i> to a
@@ -156,7 +163,8 @@ open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_Ha
156 * @param[in] key Key of room 163 * @param[in] key Key of room
157 */ 164 */
158void 165void
159entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, 166entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle,
167 const struct GNUNET_PeerIdentity *door,
160 const struct GNUNET_HashCode *key); 168 const struct GNUNET_HashCode *key);
161 169
162/** 170/**
@@ -166,6 +174,7 @@ entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNE
166 * @param[in] key Key of room 174 * @param[in] key Key of room
167 */ 175 */
168void 176void
169close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); 177close_handle_room (struct GNUNET_MESSENGER_Handle *handle,
178 const struct GNUNET_HashCode *key);
170 179
171#endif //GNUNET_MESSENGER_API_HANDLE_H 180#endif //GNUNET_MESSENGER_API_HANDLE_H
diff --git a/src/messenger/messenger_api_list_tunnels.c b/src/messenger/messenger_api_list_tunnels.c
index 990e36878..7e77d8f2f 100644
--- a/src/messenger/messenger_api_list_tunnels.c
+++ b/src/messenger/messenger_api_list_tunnels.c
@@ -53,14 +53,16 @@ clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels)
53} 53}
54 54
55static int 55static int
56compare_list_tunnels (void *cls, struct GNUNET_MESSENGER_ListTunnel *element0, 56compare_list_tunnels (void *cls,
57 struct GNUNET_MESSENGER_ListTunnel *element0,
57 struct GNUNET_MESSENGER_ListTunnel *element1) 58 struct GNUNET_MESSENGER_ListTunnel *element1)
58{ 59{
59 return ((int) element0->peer) - ((int) element1->peer); 60 return ((int) element0->peer) - ((int) element1->peer);
60} 61}
61 62
62void 63void
63add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) 64add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
65 const struct GNUNET_PeerIdentity *peer)
64{ 66{
65 GNUNET_assert((tunnels) && (peer)); 67 GNUNET_assert((tunnels) && (peer));
66 68
@@ -73,7 +75,9 @@ add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct
73} 75}
74 76
75struct GNUNET_MESSENGER_ListTunnel* 77struct GNUNET_MESSENGER_ListTunnel*
76find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index) 78find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
79 const struct GNUNET_PeerIdentity *peer,
80 size_t *index)
77{ 81{
78 GNUNET_assert((tunnels) && (peer)); 82 GNUNET_assert((tunnels) && (peer));
79 83
@@ -98,7 +102,8 @@ find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GN
98} 102}
99 103
100int 104int
101contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) 105contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
106 const struct GNUNET_PeerIdentity *peer)
102{ 107{
103 GNUNET_assert((tunnels) && (peer)); 108 GNUNET_assert((tunnels) && (peer));
104 109
@@ -106,7 +111,8 @@ contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struc
106} 111}
107 112
108struct GNUNET_MESSENGER_ListTunnel* 113struct GNUNET_MESSENGER_ListTunnel*
109remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element) 114remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
115 struct GNUNET_MESSENGER_ListTunnel *element)
110{ 116{
111 GNUNET_assert((tunnels) && (element)); 117 GNUNET_assert((tunnels) && (element));
112 118
@@ -120,7 +126,8 @@ remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct G
120} 126}
121 127
122void 128void
123load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path) 129load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
130 const char *path)
124{ 131{
125 GNUNET_assert((tunnels) && (path)); 132 GNUNET_assert((tunnels) && (path));
126 133
@@ -154,7 +161,8 @@ load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *pat
154} 161}
155 162
156void 163void
157save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path) 164save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
165 const char *path)
158{ 166{
159 GNUNET_assert((tunnels) && (path)); 167 GNUNET_assert((tunnels) && (path));
160 168
diff --git a/src/messenger/messenger_api_list_tunnels.h b/src/messenger/messenger_api_list_tunnels.h
index c952da3c2..0e086ee5e 100644
--- a/src/messenger/messenger_api_list_tunnels.h
+++ b/src/messenger/messenger_api_list_tunnels.h
@@ -67,7 +67,8 @@ clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels);
67 * @param[in] peer Peer identity of tunnel 67 * @param[in] peer Peer identity of tunnel
68 */ 68 */
69void 69void
70add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer); 70add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
71 const struct GNUNET_PeerIdentity *peer);
71 72
72/** 73/**
73 * Searches linearly through the list of tunnels peer identities for matching a 74 * Searches linearly through the list of tunnels peer identities for matching a
@@ -85,7 +86,9 @@ add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct
85 * @return Element in the list with matching peer identity 86 * @return Element in the list with matching peer identity
86 */ 87 */
87struct GNUNET_MESSENGER_ListTunnel* 88struct GNUNET_MESSENGER_ListTunnel*
88find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index); 89find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
90 const struct GNUNET_PeerIdentity *peer,
91 size_t *index);
89 92
90/** 93/**
91 * Tests linearly if the list of tunnels peer identities contains a specific 94 * Tests linearly if the list of tunnels peer identities contains a specific
@@ -96,7 +99,8 @@ find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GN
96 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 99 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
97 */ 100 */
98int 101int
99contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer); 102contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
103 const struct GNUNET_PeerIdentity *peer);
100 104
101/** 105/**
102 * Removes a specific <i>element</i> from the list of tunnels peer identities and returns 106 * Removes a specific <i>element</i> from the list of tunnels peer identities and returns
@@ -107,7 +111,8 @@ contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struc
107 * @return Next element in the list 111 * @return Next element in the list
108 */ 112 */
109struct GNUNET_MESSENGER_ListTunnel* 113struct GNUNET_MESSENGER_ListTunnel*
110remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element); 114remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
115 struct GNUNET_MESSENGER_ListTunnel *element);
111 116
112/** 117/**
113 * Loads the list of tunnels peer identities from a file under a given <i>path</i>. 118 * Loads the list of tunnels peer identities from a file under a given <i>path</i>.
@@ -116,7 +121,8 @@ remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct G
116 * @param[in] path Path of file 121 * @param[in] path Path of file
117 */ 122 */
118void 123void
119load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path); 124load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
125 const char *path);
120 126
121/** 127/**
122 * Saves the list of tunnels peer identities to a file under a given <i>path</i>. 128 * Saves the list of tunnels peer identities to a file under a given <i>path</i>.
@@ -125,6 +131,7 @@ load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *pat
125 * @param[in] path Path of file 131 * @param[in] path Path of file
126 */ 132 */
127void 133void
128save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path); 134save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
135 const char *path);
129 136
130#endif //GNUNET_MESSENGER_API_LIST_TUNNELS_H 137#endif //GNUNET_MESSENGER_API_LIST_TUNNELS_H
diff --git a/src/messenger/messenger_api_message.c b/src/messenger/messenger_api_message.c
index c7364d51c..05bf654fb 100644
--- a/src/messenger/messenger_api_message.c
+++ b/src/messenger/messenger_api_message.c
@@ -103,7 +103,8 @@ copy_message (const struct GNUNET_MESSENGER_Message *message)
103} 103}
104 104
105static void 105static void
106destroy_message_body (enum GNUNET_MESSENGER_MessageKind kind, struct GNUNET_MESSENGER_MessageBody *body) 106destroy_message_body (enum GNUNET_MESSENGER_MessageKind kind,
107 struct GNUNET_MESSENGER_MessageBody *body)
107{ 108{
108 switch (kind) 109 switch (kind)
109 { 110 {
@@ -150,7 +151,8 @@ is_message_session_bound (const struct GNUNET_MESSENGER_Message *message)
150} 151}
151 152
152static void 153static void
153fold_short_message (const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_ShortMessage *shortened) 154fold_short_message (const struct GNUNET_MESSENGER_Message *message,
155 struct GNUNET_MESSENGER_ShortMessage *shortened)
154{ 156{
155 shortened->kind = message->header.kind; 157 shortened->kind = message->header.kind;
156 158
@@ -158,7 +160,8 @@ fold_short_message (const struct GNUNET_MESSENGER_Message *message, struct GNUNE
158} 160}
159 161
160static void 162static void
161unfold_short_message (struct GNUNET_MESSENGER_ShortMessage *shortened, struct GNUNET_MESSENGER_Message *message) 163unfold_short_message (struct GNUNET_MESSENGER_ShortMessage *shortened,
164 struct GNUNET_MESSENGER_Message *message)
162{ 165{
163 destroy_message_body (message->header.kind, &(message->body)); 166 destroy_message_body (message->header.kind, &(message->body));
164 167
@@ -231,7 +234,8 @@ get_message_kind_size (enum GNUNET_MESSENGER_MessageKind kind)
231} 234}
232 235
233static uint16_t 236static uint16_t
234get_message_body_size (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_MESSENGER_MessageBody *body) 237get_message_body_size (enum GNUNET_MESSENGER_MessageKind kind,
238 const struct GNUNET_MESSENGER_MessageBody *body)
235{ 239{
236 uint16_t length = 0; 240 uint16_t length = 0;
237 241
@@ -283,7 +287,8 @@ get_message_size (const struct GNUNET_MESSENGER_Message *message,
283} 287}
284 288
285static uint16_t 289static uint16_t
286get_short_message_size (const struct GNUNET_MESSENGER_ShortMessage *message, int include_body) 290get_short_message_size (const struct GNUNET_MESSENGER_ShortMessage *message,
291 int include_body)
287{ 292{
288 const uint16_t minimum_size = sizeof(struct GNUNET_HashCode) + sizeof(kind_t); 293 const uint16_t minimum_size = sizeof(struct GNUNET_HashCode) + sizeof(kind_t);
289 294
@@ -370,8 +375,11 @@ calc_padded_length (uint16_t length)
370} while (0) 375} while (0)
371 376
372static void 377static void
373encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_MESSENGER_MessageBody *body, 378encode_message_body (enum GNUNET_MESSENGER_MessageKind kind,
374 uint16_t length, char *buffer, uint16_t offset) 379 const struct GNUNET_MESSENGER_MessageBody *body,
380 uint16_t length,
381 char *buffer,
382 uint16_t offset)
375{ 383{
376 uint32_t version; 384 uint32_t version;
377 switch (kind) 385 switch (kind)
@@ -445,7 +453,9 @@ encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET
445} 453}
446 454
447void 455void
448encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, 456encode_message (const struct GNUNET_MESSENGER_Message *message,
457 uint16_t length,
458 char *buffer,
449 int include_signature) 459 int include_signature)
450{ 460{
451 GNUNET_assert((message) && (buffer)); 461 GNUNET_assert((message) && (buffer));
@@ -466,7 +476,9 @@ encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length,
466} 476}
467 477
468static void 478static void
469encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, char *buffer) 479encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message,
480 uint16_t length,
481 char *buffer)
470{ 482{
471 struct GNUNET_HashCode hash; 483 struct GNUNET_HashCode hash;
472 uint16_t offset = sizeof(hash); 484 uint16_t offset = sizeof(hash);
@@ -512,8 +524,11 @@ encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, uint1
512} while (0) 524} while (0)
513 525
514static uint16_t 526static uint16_t
515decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESSENGER_MessageBody *body, 527decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind,
516 uint16_t length, const char *buffer, uint16_t offset) 528 struct GNUNET_MESSENGER_MessageBody *body,
529 uint16_t length,
530 const char *buffer,
531 uint16_t offset)
517{ 532{
518 uint16_t padding = 0; 533 uint16_t padding = 0;
519 534
@@ -593,8 +608,11 @@ decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESS
593} 608}
594 609
595int 610int
596decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, 611decode_message (struct GNUNET_MESSENGER_Message *message,
597 int include_signature, uint16_t *padding) 612 uint16_t length,
613 const char *buffer,
614 int include_signature,
615 uint16_t *padding)
598{ 616{
599 GNUNET_assert((message) && (buffer) && (length >= get_message_kind_size(GNUNET_MESSENGER_KIND_UNKNOWN))); 617 GNUNET_assert((message) && (buffer) && (length >= get_message_kind_size(GNUNET_MESSENGER_KIND_UNKNOWN)));
600 618
@@ -638,7 +656,9 @@ decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const
638} 656}
639 657
640static int 658static int
641decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, const char *buffer) 659decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message,
660 uint16_t length,
661 const char *buffer)
642{ 662{
643 struct GNUNET_HashCode expected, hash; 663 struct GNUNET_HashCode expected, hash;
644 uint16_t offset = sizeof(hash); 664 uint16_t offset = sizeof(hash);
@@ -675,7 +695,9 @@ decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message, uint16_t le
675} 695}
676 696
677void 697void
678hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, 698hash_message (const struct GNUNET_MESSENGER_Message *message,
699 uint16_t length,
700 const char *buffer,
679 struct GNUNET_HashCode *hash) 701 struct GNUNET_HashCode *hash)
680{ 702{
681 GNUNET_assert((message) && (buffer) && (hash)); 703 GNUNET_assert((message) && (buffer) && (hash));
@@ -688,8 +710,11 @@ hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, c
688} 710}
689 711
690void 712void
691sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, 713sign_message (struct GNUNET_MESSENGER_Message *message,
692 const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Ego *ego) 714 uint16_t length,
715 char *buffer,
716 const struct GNUNET_HashCode *hash,
717 const struct GNUNET_MESSENGER_Ego *ego)
693{ 718{
694 GNUNET_assert((message) && (buffer) && (hash) && (ego)); 719 GNUNET_assert((message) && (buffer) && (hash) && (ego));
695 720
@@ -706,7 +731,8 @@ sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *b
706} 731}
707 732
708int 733int
709verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, 734verify_message (const struct GNUNET_MESSENGER_Message *message,
735 const struct GNUNET_HashCode *hash,
710 const struct GNUNET_IDENTITY_PublicKey *key) 736 const struct GNUNET_IDENTITY_PublicKey *key)
711{ 737{
712 GNUNET_assert((message) && (hash) && (key)); 738 GNUNET_assert((message) && (hash) && (key));
@@ -726,7 +752,8 @@ verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNU
726} 752}
727 753
728int 754int
729encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key) 755encrypt_message (struct GNUNET_MESSENGER_Message *message,
756 const struct GNUNET_IDENTITY_PublicKey *key)
730{ 757{
731 GNUNET_assert((message) && (key)); 758 GNUNET_assert((message) && (key));
732 759
@@ -760,7 +787,8 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I
760} 787}
761 788
762int 789int
763decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key) 790decrypt_message (struct GNUNET_MESSENGER_Message *message,
791 const struct GNUNET_IDENTITY_PrivateKey *key)
764{ 792{
765 GNUNET_assert((message) && (key)); 793 GNUNET_assert((message) && (key));
766 794
@@ -788,8 +816,10 @@ decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I
788} 816}
789 817
790struct GNUNET_MQ_Envelope* 818struct GNUNET_MQ_Envelope*
791pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, 819pack_message (struct GNUNET_MESSENGER_Message *message,
792 const struct GNUNET_MESSENGER_Ego *ego, int mode) 820 struct GNUNET_HashCode *hash,
821 const struct GNUNET_MESSENGER_Ego *ego,
822 int mode)
793{ 823{
794 GNUNET_assert(message); 824 GNUNET_assert(message);
795 825
diff --git a/src/messenger/messenger_api_message.h b/src/messenger/messenger_api_message.h
index 7ce30dc92..6aebf4014 100644
--- a/src/messenger/messenger_api_message.h
+++ b/src/messenger/messenger_api_message.h
@@ -107,7 +107,9 @@ get_message_size (const struct GNUNET_MESSENGER_Message *message,
107 * @param[in] encode_signature Flag to include signature 107 * @param[in] encode_signature Flag to include signature
108 */ 108 */
109void 109void
110encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, 110encode_message (const struct GNUNET_MESSENGER_Message *message,
111 uint16_t length,
112 char *buffer,
111 int include_signature); 113 int include_signature);
112 114
113/** 115/**
@@ -125,8 +127,11 @@ encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length,
125 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 127 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
126 */ 128 */
127int 129int
128decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, 130decode_message (struct GNUNET_MESSENGER_Message *message,
129 int include_signature, uint16_t *padding); 131 uint16_t length,
132 const char *buffer,
133 int include_signature,
134 uint16_t *padding);
130 135
131/** 136/**
132 * Calculates a <i>hash</i> of a given <i>buffer</i> with a <i>length</i> in bytes 137 * Calculates a <i>hash</i> of a given <i>buffer</i> with a <i>length</i> in bytes
@@ -138,7 +143,9 @@ decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const
138 * @param[out] hash Hash 143 * @param[out] hash Hash
139 */ 144 */
140void 145void
141hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, 146hash_message (const struct GNUNET_MESSENGER_Message *message,
147 uint16_t length,
148 const char *buffer,
142 struct GNUNET_HashCode *hash); 149 struct GNUNET_HashCode *hash);
143 150
144/** 151/**
@@ -152,8 +159,11 @@ hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, c
152 * @param[in] ego EGO 159 * @param[in] ego EGO
153 */ 160 */
154void 161void
155sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, 162sign_message (struct GNUNET_MESSENGER_Message *message,
156 const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Ego *ego); 163 uint16_t length,
164 char *buffer,
165 const struct GNUNET_HashCode *hash,
166 const struct GNUNET_MESSENGER_Ego *ego);
157 167
158/** 168/**
159 * Verifies the signature of a given <i>message</i> and its <i>hash</i> with a specific 169 * Verifies the signature of a given <i>message</i> and its <i>hash</i> with a specific
@@ -166,7 +176,8 @@ sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *b
166 * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR 176 * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR
167 */ 177 */
168int 178int
169verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, 179verify_message (const struct GNUNET_MESSENGER_Message *message,
180 const struct GNUNET_HashCode *hash,
170 const struct GNUNET_IDENTITY_PublicKey *key); 181 const struct GNUNET_IDENTITY_PublicKey *key);
171 182
172/** 183/**
@@ -179,7 +190,8 @@ verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNU
179 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 190 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
180 */ 191 */
181int 192int
182encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key); 193encrypt_message (struct GNUNET_MESSENGER_Message *message,
194 const struct GNUNET_IDENTITY_PublicKey *key);
183 195
184/** 196/**
185 * Decrypts a private <i>message</i> using a given private <i>key</i> and replaces its body 197 * Decrypts a private <i>message</i> using a given private <i>key</i> and replaces its body
@@ -191,7 +203,8 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I
191 * @return #GNUNET_YES on success, otherwise #GNUNET_NO 203 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
192 */ 204 */
193int 205int
194decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key); 206decrypt_message (struct GNUNET_MESSENGER_Message *message,
207 const struct GNUNET_IDENTITY_PrivateKey *key);
195 208
196#define GNUNET_MESSENGER_PACK_MODE_ENVELOPE 0x1 209#define GNUNET_MESSENGER_PACK_MODE_ENVELOPE 0x1
197#define GNUNET_MESSENGER_PACK_MODE_UNKNOWN 0x0 210#define GNUNET_MESSENGER_PACK_MODE_UNKNOWN 0x0
@@ -209,8 +222,10 @@ decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I
209 * @return Envelope or NULL 222 * @return Envelope or NULL
210 */ 223 */
211struct GNUNET_MQ_Envelope* 224struct GNUNET_MQ_Envelope*
212pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, 225pack_message (struct GNUNET_MESSENGER_Message *message,
213 const struct GNUNET_MESSENGER_Ego *ego, int mode); 226 struct GNUNET_HashCode *hash,
227 const struct GNUNET_MESSENGER_Ego *ego,
228 int mode);
214 229
215/** 230/**
216 * Returns if a specific kind of message should be sent by a client. The function returns 231 * Returns if a specific kind of message should be sent by a client. The function returns
diff --git a/src/messenger/messenger_api_room.c b/src/messenger/messenger_api_room.c
index 0d9237a2e..6e2d33f48 100644
--- a/src/messenger/messenger_api_room.c
+++ b/src/messenger/messenger_api_room.c
@@ -28,7 +28,8 @@
28#include "messenger_api_handle.h" 28#include "messenger_api_handle.h"
29 29
30struct GNUNET_MESSENGER_Room* 30struct GNUNET_MESSENGER_Room*
31create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) 31create_room (struct GNUNET_MESSENGER_Handle *handle,
32 const struct GNUNET_HashCode *key)
32{ 33{
33 GNUNET_assert((handle) && (key)); 34 GNUNET_assert((handle) && (key));
34 35
@@ -49,7 +50,9 @@ create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCod
49} 50}
50 51
51static int 52static int
52iterate_destroy_message (void *cls, const struct GNUNET_HashCode *key, void *value) 53iterate_destroy_message (void *cls,
54 const struct GNUNET_HashCode *key,
55 void *value)
53{ 56{
54 struct GNUNET_MESSENGER_RoomMessageEntry *entry = value; 57 struct GNUNET_MESSENGER_RoomMessageEntry *entry = value;
55 58
@@ -83,7 +86,8 @@ destroy_room (struct GNUNET_MESSENGER_Room *room)
83} 86}
84 87
85const struct GNUNET_MESSENGER_Message* 88const struct GNUNET_MESSENGER_Message*
86get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) 89get_room_message (const struct GNUNET_MESSENGER_Room *room,
90 const struct GNUNET_HashCode *hash)
87{ 91{
88 GNUNET_assert((room) && (hash)); 92 GNUNET_assert((room) && (hash));
89 93
@@ -95,7 +99,8 @@ get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_
95} 99}
96 100
97struct GNUNET_MESSENGER_Contact* 101struct GNUNET_MESSENGER_Contact*
98get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) 102get_room_sender (const struct GNUNET_MESSENGER_Room *room,
103 const struct GNUNET_HashCode *hash)
99{ 104{
100 GNUNET_assert((room) && (hash)); 105 GNUNET_assert((room) && (hash));
101 106
@@ -107,8 +112,10 @@ get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_H
107} 112}
108 113
109static struct GNUNET_MESSENGER_Contact* 114static struct GNUNET_MESSENGER_Contact*
110handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, 115handle_join_message (struct GNUNET_MESSENGER_Room *room,
111 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 116 struct GNUNET_MESSENGER_Contact *sender,
117 const struct GNUNET_MESSENGER_Message *message,
118 const struct GNUNET_HashCode *hash)
112{ 119{
113 if (!sender) 120 if (!sender)
114 { 121 {
@@ -129,8 +136,10 @@ handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
129} 136}
130 137
131static void 138static void
132handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, 139handle_leave_message (struct GNUNET_MESSENGER_Room *room,
133 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 140 struct GNUNET_MESSENGER_Contact *sender,
141 const struct GNUNET_MESSENGER_Message *message,
142 const struct GNUNET_HashCode *hash)
134{ 143{
135 if ((!sender) || 144 if ((!sender) ||
136 (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove(room->members, &(message->header.sender_id), sender))) 145 (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove(room->members, &(message->header.sender_id), sender)))
@@ -144,8 +153,10 @@ handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGE
144} 153}
145 154
146static void 155static void
147handle_name_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, 156handle_name_message (struct GNUNET_MESSENGER_Room *room,
148 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 157 struct GNUNET_MESSENGER_Contact *sender,
158 const struct GNUNET_MESSENGER_Message *message,
159 const struct GNUNET_HashCode *hash)
149{ 160{
150 if (!sender) 161 if (!sender)
151 return; 162 return;
@@ -154,8 +165,10 @@ handle_name_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
154} 165}
155 166
156static void 167static void
157handle_key_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, 168handle_key_message (struct GNUNET_MESSENGER_Room *room,
158 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 169 struct GNUNET_MESSENGER_Contact *sender,
170 const struct GNUNET_MESSENGER_Message *message,
171 const struct GNUNET_HashCode *hash)
159{ 172{
160 if (!sender) 173 if (!sender)
161 return; 174 return;
@@ -169,8 +182,10 @@ handle_key_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_
169} 182}
170 183
171static void 184static void
172handle_id_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, 185handle_id_message (struct GNUNET_MESSENGER_Room *room,
173 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 186 struct GNUNET_MESSENGER_Contact *sender,
187 const struct GNUNET_MESSENGER_Message *message,
188 const struct GNUNET_HashCode *hash)
174{ 189{
175 if ((!sender) || 190 if ((!sender) ||
176 (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove(room->members, &(message->header.sender_id), sender)) || 191 (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove(room->members, &(message->header.sender_id), sender)) ||
@@ -188,8 +203,10 @@ handle_id_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_C
188} 203}
189 204
190static void 205static void
191handle_miss_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, 206handle_miss_message (struct GNUNET_MESSENGER_Room *room,
192 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 207 struct GNUNET_MESSENGER_Contact *sender,
208 const struct GNUNET_MESSENGER_Message *message,
209 const struct GNUNET_HashCode *hash)
193{ 210{
194 if ((room->contact_id) && (0 == GNUNET_memcmp(&(message->header.sender_id), room->contact_id))) 211 if ((room->contact_id) && (0 == GNUNET_memcmp(&(message->header.sender_id), room->contact_id)))
195 { 212 {
@@ -201,8 +218,10 @@ handle_miss_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
201} 218}
202 219
203static void 220static void
204handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, 221handle_delete_message (struct GNUNET_MESSENGER_Room *room,
205 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 222 struct GNUNET_MESSENGER_Contact *sender,
223 const struct GNUNET_MESSENGER_Message *message,
224 const struct GNUNET_HashCode *hash)
206{ 225{
207 struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_CONTAINER_multihashmap_get ( 226 struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_CONTAINER_multihashmap_get (
208 room->messages, &(message->body.deletion.hash) 227 room->messages, &(message->body.deletion.hash)
@@ -217,8 +236,10 @@ handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENG
217} 236}
218 237
219struct GNUNET_MESSENGER_Contact* 238struct GNUNET_MESSENGER_Contact*
220handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, 239handle_room_message (struct GNUNET_MESSENGER_Room *room,
221 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) 240 struct GNUNET_MESSENGER_Contact *sender,
241 const struct GNUNET_MESSENGER_Message *message,
242 const struct GNUNET_HashCode *hash)
222{ 243{
223 if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (room->messages, hash)) 244 if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (room->messages, hash))
224 return sender; 245 return sender;
@@ -276,7 +297,9 @@ struct GNUNET_MESSENGER_MemberCall
276}; 297};
277 298
278static int 299static int
279iterate_local_members (void* cls, const struct GNUNET_ShortHashCode *key, void *value) 300iterate_local_members (void* cls,
301 const struct GNUNET_ShortHashCode *key,
302 void *value)
280{ 303{
281 struct GNUNET_MESSENGER_MemberCall *call = cls; 304 struct GNUNET_MESSENGER_MemberCall *call = cls;
282 struct GNUNET_MESSENGER_Contact *contact = value; 305 struct GNUNET_MESSENGER_Contact *contact = value;
@@ -285,7 +308,8 @@ iterate_local_members (void* cls, const struct GNUNET_ShortHashCode *key, void *
285} 308}
286 309
287int 310int
288iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, 311iterate_room_members (struct GNUNET_MESSENGER_Room *room,
312 GNUNET_MESSENGER_MemberCallback callback,
289 void* cls) 313 void* cls)
290{ 314{
291 GNUNET_assert(room); 315 GNUNET_assert(room);
@@ -311,7 +335,9 @@ struct GNUNET_MESSENGER_MemberFind
311}; 335};
312 336
313static int 337static int
314iterate_find_member (void* cls, const struct GNUNET_ShortHashCode *key, void *value) 338iterate_find_member (void* cls,
339 const struct GNUNET_ShortHashCode *key,
340 void *value)
315{ 341{
316 struct GNUNET_MESSENGER_MemberFind *find = cls; 342 struct GNUNET_MESSENGER_MemberFind *find = cls;
317 struct GNUNET_MESSENGER_Contact *contact = value; 343 struct GNUNET_MESSENGER_Contact *contact = value;
@@ -326,7 +352,8 @@ iterate_find_member (void* cls, const struct GNUNET_ShortHashCode *key, void *va
326} 352}
327 353
328int 354int
329find_room_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact) 355find_room_member (const struct GNUNET_MESSENGER_Room *room,
356 const struct GNUNET_MESSENGER_Contact *contact)
330{ 357{
331 GNUNET_assert(room); 358 GNUNET_assert(room);
332 359
diff --git a/src/messenger/messenger_api_room.h b/src/messenger/messenger_api_room.h
index 634052272..320312f0c 100644
--- a/src/messenger/messenger_api_room.h
+++ b/src/messenger/messenger_api_room.h
@@ -64,7 +64,8 @@ struct GNUNET_MESSENGER_Room
64 * @return New room 64 * @return New room
65 */ 65 */
66struct GNUNET_MESSENGER_Room* 66struct GNUNET_MESSENGER_Room*
67create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); 67create_room (struct GNUNET_MESSENGER_Handle *handle,
68 const struct GNUNET_HashCode *key);
68 69
69/** 70/**
70 * Destroys a room and frees its memory fully from the client API. 71 * Destroys a room and frees its memory fully from the client API.
@@ -83,7 +84,8 @@ destroy_room (struct GNUNET_MESSENGER_Room *room);
83 * @return Message or NULL 84 * @return Message or NULL
84 */ 85 */
85const struct GNUNET_MESSENGER_Message* 86const struct GNUNET_MESSENGER_Message*
86get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); 87get_room_message (const struct GNUNET_MESSENGER_Room *room,
88 const struct GNUNET_HashCode *hash);
87 89
88/** 90/**
89 * Returns a messages sender locally stored from a map for a given <i>hash</i> in a <i>room</i>. If no 91 * Returns a messages sender locally stored from a map for a given <i>hash</i> in a <i>room</i>. If no
@@ -94,7 +96,8 @@ get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_
94 * @return Contact of sender or NULL 96 * @return Contact of sender or NULL
95 */ 97 */
96struct GNUNET_MESSENGER_Contact* 98struct GNUNET_MESSENGER_Contact*
97get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); 99get_room_sender (const struct GNUNET_MESSENGER_Room *room,
100 const struct GNUNET_HashCode *hash);
98 101
99/** 102/**
100 * Handles a <i>message</i> with a given <i>hash</i> in a <i>room</i> for the client API to update 103 * Handles a <i>message</i> with a given <i>hash</i> in a <i>room</i> for the client API to update
@@ -110,8 +113,10 @@ get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_H
110 * @return Contact of sender 113 * @return Contact of sender
111 */ 114 */
112struct GNUNET_MESSENGER_Contact* 115struct GNUNET_MESSENGER_Contact*
113handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, 116handle_room_message (struct GNUNET_MESSENGER_Room *room,
114 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); 117 struct GNUNET_MESSENGER_Contact *sender,
118 const struct GNUNET_MESSENGER_Message *message,
119 const struct GNUNET_HashCode *hash);
115 120
116/** 121/**
117 * Iterates through all members of a given <i>room</i> to forward each of them to a selected 122 * Iterates through all members of a given <i>room</i> to forward each of them to a selected
@@ -123,7 +128,8 @@ handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
123 * @return Amount of members iterated 128 * @return Amount of members iterated
124 */ 129 */
125int 130int
126iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, 131iterate_room_members (struct GNUNET_MESSENGER_Room *room,
132 GNUNET_MESSENGER_MemberCallback callback,
127 void* cls); 133 void* cls);
128 134
129/** 135/**
@@ -135,6 +141,7 @@ iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_Membe
135 * @return #GNUNET_YES if found, otherwise #GNUNET_NO 141 * @return #GNUNET_YES if found, otherwise #GNUNET_NO
136 */ 142 */
137int 143int
138find_room_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact); 144find_room_member (const struct GNUNET_MESSENGER_Room *room,
145 const struct GNUNET_MESSENGER_Contact *contact);
139 146
140#endif //GNUNET_MESSENGER_API_ROOM_H 147#endif //GNUNET_MESSENGER_API_ROOM_H
diff --git a/src/messenger/messenger_api_util.c b/src/messenger/messenger_api_util.c
index 4ad00c45e..52b4e934a 100644
--- a/src/messenger/messenger_api_util.c
+++ b/src/messenger/messenger_api_util.c
@@ -45,7 +45,8 @@ delayed_disconnect_channel (struct GNUNET_CADET_Channel *channel)
45} 45}
46 46
47int 47int
48generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members) 48generate_free_member_id (struct GNUNET_ShortHashCode *id,
49 const struct GNUNET_CONTAINER_MultiShortmap *members)
49{ 50{
50 GNUNET_assert(id); 51 GNUNET_assert(id);
51 52
@@ -84,7 +85,8 @@ get_anonymous_public_key ()
84} 85}
85 86
86void 87void
87convert_messenger_key_to_port(const struct GNUNET_HashCode *key, struct GNUNET_HashCode *port) 88convert_messenger_key_to_port(const struct GNUNET_HashCode *key,
89 struct GNUNET_HashCode *port)
88{ 90{
89 static uint32_t version_value = 0; 91 static uint32_t version_value = 0;
90 static struct GNUNET_HashCode version; 92 static struct GNUNET_HashCode version;
diff --git a/src/messenger/messenger_api_util.h b/src/messenger/messenger_api_util.h
index af562a1e8..af64790b6 100644
--- a/src/messenger/messenger_api_util.h
+++ b/src/messenger/messenger_api_util.h
@@ -51,7 +51,8 @@ delayed_disconnect_channel (struct GNUNET_CADET_Channel *channel);
51 * @return #GNUNET_YES on success, #GNUNET_NO on failure 51 * @return #GNUNET_YES on success, #GNUNET_NO on failure
52 */ 52 */
53int 53int
54generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members); 54generate_free_member_id (struct GNUNET_ShortHashCode *id,
55 const struct GNUNET_CONTAINER_MultiShortmap *members);
55 56
56/** 57/**
57 * Returns the public identity key of #GNUNET_IDENTITY_ego_get_anonymous() without 58 * Returns the public identity key of #GNUNET_IDENTITY_ego_get_anonymous() without
@@ -73,6 +74,7 @@ get_anonymous_public_key ();
73 * @param[out] port CADET service port 74 * @param[out] port CADET service port
74 */ 75 */
75void 76void
76convert_messenger_key_to_port(const struct GNUNET_HashCode *key, struct GNUNET_HashCode *port); 77convert_messenger_key_to_port(const struct GNUNET_HashCode *key,
78 struct GNUNET_HashCode *port);
77 79
78#endif //GNUNET_SERVICE_MESSENGER_UTIL_H 80#endif //GNUNET_SERVICE_MESSENGER_UTIL_H
diff --git a/src/messenger/test_messenger.c b/src/messenger/test_messenger.c
index fb3e3e1bc..5784dfd82 100644
--- a/src/messenger/test_messenger.c
+++ b/src/messenger/test_messenger.c
@@ -100,7 +100,8 @@ static int identity_counter = 0;
100 * @param handle Handle of messenger service 100 * @param handle Handle of messenger service
101 */ 101 */
102static void 102static void
103on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) 103on_identity (void *cls,
104 struct GNUNET_MESSENGER_Handle *handle)
104{ 105{
105 if (op_task) 106 if (op_task)
106 { 107 {
@@ -150,7 +151,9 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
150 * @param peer Peer for testing 151 * @param peer Peer for testing
151 */ 152 */
152static void 153static void
153run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) 154run (void *cls,
155 const struct GNUNET_CONFIGURATION_Handle *cfg,
156 struct GNUNET_TESTING_Peer *peer)
154{ 157{
155 die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); 158 die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL);
156 159
@@ -168,7 +171,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TES
168 * @return 0 ok, 1 on error 171 * @return 0 ok, 1 on error
169 */ 172 */
170int 173int
171main (int argc, char **argv) 174main (int argc,
175 char **argv)
172{ 176{
173 if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL)) 177 if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL))
174 return 1; 178 return 1;
diff --git a/src/messenger/test_messenger_adapt.c b/src/messenger/test_messenger_adapt.c
index 90e8ac28d..3230af6b7 100644
--- a/src/messenger/test_messenger_adapt.c
+++ b/src/messenger/test_messenger_adapt.c
@@ -33,7 +33,8 @@
33 * @return 0 ok, 1 on error 33 * @return 0 ok, 1 on error
34 */ 34 */
35int 35int
36main (int argc, char **argv) 36main (int argc,
37 char **argv)
37{ 38{
38 unsigned int doors [] = { 5, 1, 2, 3, 6, 7, 8, 4 }; 39 unsigned int doors [] = { 5, 1, 2, 3, 6, 7, 8, 4 };
39 unsigned int stages [] = { 0x21, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x21 }; 40 unsigned int stages [] = { 0x21, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x21 };
diff --git a/src/messenger/test_messenger_anonymous.c b/src/messenger/test_messenger_anonymous.c
index a70121a30..8cb339f0e 100644
--- a/src/messenger/test_messenger_anonymous.c
+++ b/src/messenger/test_messenger_anonymous.c
@@ -96,7 +96,8 @@ end_operation (void *cls)
96 * @param handle Handle of messenger service 96 * @param handle Handle of messenger service
97 */ 97 */
98static void 98static void
99on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) 99on_identity (void *cls,
100 struct GNUNET_MESSENGER_Handle *handle)
100{ 101{
101 if (op_task) 102 if (op_task)
102 { 103 {
@@ -144,7 +145,9 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
144 * @param peer Peer for testing 145 * @param peer Peer for testing
145 */ 146 */
146static void 147static void
147run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) 148run (void *cls,
149 const struct GNUNET_CONFIGURATION_Handle *cfg,
150 struct GNUNET_TESTING_Peer *peer)
148{ 151{
149 die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); 152 die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL);
150 153
@@ -160,7 +163,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TES
160 * @return 0 ok, 1 on error 163 * @return 0 ok, 1 on error
161 */ 164 */
162int 165int
163main (int argc, char **argv) 166main (int argc,
167 char **argv)
164{ 168{
165 if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL)) 169 if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL))
166 return 1; 170 return 1;
diff --git a/src/messenger/test_messenger_async_client.c b/src/messenger/test_messenger_async_client.c
index 1067b9a6d..8404195dc 100644
--- a/src/messenger/test_messenger_async_client.c
+++ b/src/messenger/test_messenger_async_client.c
@@ -33,7 +33,8 @@
33 * @return 0 ok, 1 on error 33 * @return 0 ok, 1 on error
34 */ 34 */
35int 35int
36main (int argc, char **argv) 36main (int argc,
37 char **argv)
37{ 38{
38 unsigned int doors [] = { 0, 1 }; 39 unsigned int doors [] = { 0, 1 };
39 unsigned int stages [] = { 0x10, 0x20 }; 40 unsigned int stages [] = { 0x10, 0x20 };
diff --git a/src/messenger/test_messenger_async_p2p.c b/src/messenger/test_messenger_async_p2p.c
index d827aae16..25746f7ff 100644
--- a/src/messenger/test_messenger_async_p2p.c
+++ b/src/messenger/test_messenger_async_p2p.c
@@ -33,7 +33,8 @@
33 * @return 0 ok, 1 on error 33 * @return 0 ok, 1 on error
34 */ 34 */
35int 35int
36main (int argc, char **argv) 36main (int argc,
37 char **argv)
37{ 38{
38 unsigned int doors [] = { 2, 1 }; 39 unsigned int doors [] = { 2, 1 };
39 unsigned int stages [] = { 0x30, 0x30 }; 40 unsigned int stages [] = { 0x30, 0x30 };
diff --git a/src/messenger/test_messenger_growth.c b/src/messenger/test_messenger_growth.c
index 3781f3ee5..c3f243cbf 100644
--- a/src/messenger/test_messenger_growth.c
+++ b/src/messenger/test_messenger_growth.c
@@ -33,7 +33,8 @@
33 * @return 0 ok, 1 on error 33 * @return 0 ok, 1 on error
34 */ 34 */
35int 35int
36main (int argc, char **argv) 36main (int argc,
37 char **argv)
37{ 38{
38 unsigned int doors [] = { 0, 1, 1, 1, 1, 1, 1, 1 }; 39 unsigned int doors [] = { 0, 1, 1, 1, 1, 1, 1, 1 };
39 unsigned int stages [] = { 0x01, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21 }; 40 unsigned int stages [] = { 0x01, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21 };
diff --git a/src/messenger/test_messenger_ring.c b/src/messenger/test_messenger_ring.c
index 07cfd0c47..777d79eb8 100644
--- a/src/messenger/test_messenger_ring.c
+++ b/src/messenger/test_messenger_ring.c
@@ -33,7 +33,8 @@
33 * @return 0 ok, 1 on error 33 * @return 0 ok, 1 on error
34 */ 34 */
35int 35int
36main (int argc, char **argv) 36main (int argc,
37 char **argv)
37{ 38{
38 unsigned int doors [] = { 8, 1, 2, 3, 4, 5, 6, 7 }; 39 unsigned int doors [] = { 8, 1, 2, 3, 4, 5, 6, 7 };
39 unsigned int stages [] = { 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21 }; 40 unsigned int stages [] = { 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21 };
diff --git a/src/messenger/test_messenger_server.c b/src/messenger/test_messenger_server.c
index 1cf2fcc27..61e96e879 100644
--- a/src/messenger/test_messenger_server.c
+++ b/src/messenger/test_messenger_server.c
@@ -33,7 +33,8 @@
33 * @return 0 ok, 1 on error 33 * @return 0 ok, 1 on error
34 */ 34 */
35int 35int
36main (int argc, char **argv) 36main (int argc,
37 char **argv)
37{ 38{
38 unsigned int doors [] = { 0, 1, 1, 1, 1, 1, 1, 1 }; 39 unsigned int doors [] = { 0, 1, 1, 1, 1, 1, 1, 1 };
39 unsigned int stages [] = { 0x01, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; 40 unsigned int stages [] = { 0x01, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
diff --git a/src/messenger/test_messenger_sync_client.c b/src/messenger/test_messenger_sync_client.c
index 99f26b018..02d90a61d 100644
--- a/src/messenger/test_messenger_sync_client.c
+++ b/src/messenger/test_messenger_sync_client.c
@@ -33,7 +33,8 @@
33 * @return 0 ok, 1 on error 33 * @return 0 ok, 1 on error
34 */ 34 */
35int 35int
36main (int argc, char **argv) 36main (int argc,
37 char **argv)
37{ 38{
38 unsigned int doors [] = { 0, 1 }; 39 unsigned int doors [] = { 0, 1 };
39 unsigned int stages [] = { 0x01, 0x20 }; 40 unsigned int stages [] = { 0x01, 0x20 };
diff --git a/src/messenger/test_messenger_sync_p2p.c b/src/messenger/test_messenger_sync_p2p.c
index 77ce280a1..0a900a39e 100644
--- a/src/messenger/test_messenger_sync_p2p.c
+++ b/src/messenger/test_messenger_sync_p2p.c
@@ -33,7 +33,8 @@
33 * @return 0 ok, 1 on error 33 * @return 0 ok, 1 on error
34 */ 34 */
35int 35int
36main (int argc, char **argv) 36main (int argc,
37 char **argv)
37{ 38{
38 unsigned int doors [] = { 2, 1 }; 39 unsigned int doors [] = { 2, 1 };
39 unsigned int stages [] = { 0x21, 0x21 }; 40 unsigned int stages [] = { 0x21, 0x21 };
diff --git a/src/messenger/test_messenger_worst_client.c b/src/messenger/test_messenger_worst_client.c
index 63826631c..a3d5aafec 100644
--- a/src/messenger/test_messenger_worst_client.c
+++ b/src/messenger/test_messenger_worst_client.c
@@ -33,7 +33,8 @@
33 * @return 0 ok, 1 on error 33 * @return 0 ok, 1 on error
34 */ 34 */
35int 35int
36main (int argc, char **argv) 36main (int argc,
37 char **argv)
37{ 38{
38 unsigned int doors [] = { 0, 1 }; 39 unsigned int doors [] = { 0, 1 };
39 unsigned int stages [] = { 0x10, 0x02 }; 40 unsigned int stages [] = { 0x10, 0x02 };
diff --git a/src/messenger/test_messenger_worst_p2p.c b/src/messenger/test_messenger_worst_p2p.c
index c89288eea..89e54cfbd 100644
--- a/src/messenger/test_messenger_worst_p2p.c
+++ b/src/messenger/test_messenger_worst_p2p.c
@@ -33,7 +33,8 @@
33 * @return 0 ok, 1 on error 33 * @return 0 ok, 1 on error
34 */ 34 */
35int 35int
36main (int argc, char **argv) 36main (int argc,
37 char **argv)
37{ 38{
38 unsigned int doors [] = { 2, 1 }; 39 unsigned int doors [] = { 2, 1 };
39 unsigned int stages [] = { 0x12, 0x12 }; 40 unsigned int stages [] = { 0x12, 0x12 };
diff --git a/src/messenger/testing_messenger_barrier.c b/src/messenger/testing_messenger_barrier.c
index 618d255b7..a95ea9ef1 100644
--- a/src/messenger/testing_messenger_barrier.c
+++ b/src/messenger/testing_messenger_barrier.c
@@ -61,7 +61,8 @@ GNUNET_init_barrier (unsigned int requirement,
61} 61}
62 62
63static void 63static void
64exit_status (struct GNUNET_BarrierHandle *barrier, int status); 64exit_status (struct GNUNET_BarrierHandle *barrier,
65 int status);
65 66
66static void 67static void
67cancel_barrier (void *cls) 68cancel_barrier (void *cls)
@@ -96,7 +97,8 @@ struct GNUNET_BarrierWaitHandle
96}; 97};
97 98
98static void 99static void
99exit_status (struct GNUNET_BarrierHandle *barrier, int status) 100exit_status (struct GNUNET_BarrierHandle *barrier,
101 int status)
100{ 102{
101 struct GNUNET_BarrierWaitHandle *waiting = barrier->head; 103 struct GNUNET_BarrierWaitHandle *waiting = barrier->head;
102 while (waiting) 104 while (waiting)
diff --git a/src/messenger/testing_messenger_setup.c b/src/messenger/testing_messenger_setup.c
index 98241fa08..3cde8c9bb 100644
--- a/src/messenger/testing_messenger_setup.c
+++ b/src/messenger/testing_messenger_setup.c
@@ -204,7 +204,9 @@ end_error_cb (void *cls)
204} 204}
205 205
206static void 206static void
207barrier2_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status) 207barrier2_wait_cb (void *cls,
208 struct GNUNET_BarrierWaitHandle *waiting,
209 int status)
208{ 210{
209 struct test_peer *peer = cls; 211 struct test_peer *peer = cls;
210 212
@@ -215,7 +217,9 @@ barrier2_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int statu
215} 217}
216 218
217static void 219static void
218barrier_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status) 220barrier_wait_cb (void *cls,
221 struct GNUNET_BarrierWaitHandle *waiting,
222 int status)
219{ 223{
220 struct test_peer *peer = cls; 224 struct test_peer *peer = cls;
221 225
@@ -259,8 +263,11 @@ barrier_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status
259 * @param flags Flags of message 263 * @param flags Flags of message
260 */ 264 */
261static void 265static void
262on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, 266on_message (void *cls,
263 const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, 267 struct GNUNET_MESSENGER_Room *room,
268 const struct GNUNET_MESSENGER_Contact *sender,
269 const struct GNUNET_MESSENGER_Message *message,
270 const struct GNUNET_HashCode *hash,
264 enum GNUNET_MESSENGER_MessageFlags flags) 271 enum GNUNET_MESSENGER_MessageFlags flags)
265{ 272{
266 struct test_peer *peer = cls; 273 struct test_peer *peer = cls;
@@ -340,7 +347,9 @@ second_stage (void *cls)
340} 347}
341 348
342static void 349static void
343on_peer (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, 350on_peer (void *cb_cls,
351 struct GNUNET_TESTBED_Operation *op,
352 const struct GNUNET_TESTBED_PeerInformation *pinfo,
344 const char *emsg) 353 const char *emsg)
345{ 354{
346 struct test_peer *peer = cb_cls; 355 struct test_peer *peer = cb_cls;
@@ -396,7 +405,8 @@ on_peer (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_
396 * @param event Information about the event 405 * @param event Information about the event
397 */ 406 */
398static void 407static void
399run (void *cls, const struct GNUNET_TESTBED_EventInformation *event) 408run (void *cls,
409 const struct GNUNET_TESTBED_EventInformation *event)
400{ 410{
401 struct test_properties *properties = cls; 411 struct test_properties *properties = cls;
402 412
@@ -420,7 +430,9 @@ run (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
420} 430}
421 431
422static void 432static void
423barrier2_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) 433barrier2_cb (void *cls,
434 struct GNUNET_BarrierHandle *barrier,
435 int status)
424{ 436{
425 struct test_properties *properties = cls; 437 struct test_properties *properties = cls;
426 438
@@ -449,7 +461,9 @@ barrier2_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status)
449} 461}
450 462
451static void 463static void
452barrier_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) 464barrier_cb (void *cls,
465 struct GNUNET_BarrierHandle *barrier,
466 int status)
453{ 467{
454 struct test_properties *properties = cls; 468 struct test_properties *properties = cls;
455 469
@@ -485,8 +499,12 @@ barrier_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status)
485} 499}
486 500
487static void 501static void
488init (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, 502init (void *cls,
489 unsigned int links_succeeded, unsigned int links_failed) 503 struct GNUNET_TESTBED_RunHandle *h,
504 unsigned int num_peers,
505 struct GNUNET_TESTBED_Peer **peers,
506 unsigned int links_succeeded,
507 unsigned int links_failed)
490{ 508{
491 struct test_properties *properties = cls; 509 struct test_properties *properties = cls;
492 510
@@ -500,7 +518,8 @@ init (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, str
500} 518}
501 519
502int 520int
503GNUNET_run_messenger_setup (const char* test_name, const struct test_configuration *cfg) 521GNUNET_run_messenger_setup (const char* test_name,
522 const struct test_configuration *cfg)
504{ 523{
505 struct test_properties properties; 524 struct test_properties properties;
506 memset(&properties, 0, sizeof(properties)); 525 memset(&properties, 0, sizeof(properties));
diff --git a/src/messenger/testing_messenger_setup.h b/src/messenger/testing_messenger_setup.h
index 5e6b5d461..e5ae0c151 100644
--- a/src/messenger/testing_messenger_setup.h
+++ b/src/messenger/testing_messenger_setup.h
@@ -34,6 +34,7 @@ struct test_configuration
34}; 34};
35 35
36int 36int
37GNUNET_run_messenger_setup (const char* test_name, const struct test_configuration *cfg); 37GNUNET_run_messenger_setup (const char* test_name,
38 const struct test_configuration *cfg);
38 39
39#endif /* GNUNET_TESTING_MESSENGER_SETUP_H_ */ 40#endif /* GNUNET_TESTING_MESSENGER_SETUP_H_ */