diff options
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 | */ |
529 | typedef void | 529 | typedef 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 | */ |
545 | typedef void | 546 | typedef 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 | */ |
560 | typedef int | 562 | typedef 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 | */ |
576 | struct GNUNET_MESSENGER_Handle* | 579 | struct GNUNET_MESSENGER_Handle* |
577 | GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, | 580 | GNUNET_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 | */ |
621 | int | 627 | int |
622 | GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); | 628 | GNUNET_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 | */ |
649 | struct GNUNET_MESSENGER_Room* | 656 | struct GNUNET_MESSENGER_Room* |
650 | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); | 657 | GNUNET_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 | */ |
670 | struct GNUNET_MESSENGER_Room* | 678 | struct GNUNET_MESSENGER_Room* |
671 | GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, | 679 | GNUNET_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 | */ |
697 | int | 706 | int |
698 | GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, | 707 | GNUNET_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 | */ |
719 | const struct GNUNET_MESSENGER_Contact* | 730 | const struct GNUNET_MESSENGER_Contact* |
720 | GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); | 731 | GNUNET_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 | */ |
758 | void | 770 | void |
759 | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 771 | GNUNET_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 | */ |
769 | const struct GNUNET_MESSENGER_Message* | 782 | const struct GNUNET_MESSENGER_Message* |
770 | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); | 783 | GNUNET_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 | */ |
782 | int | 796 | int |
783 | GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, | 797 | GNUNET_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 | */ |
44 | void | 44 | void |
45 | on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, | 45 | on_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 | ||
126 | static int | 129 | static int |
127 | iterate_send_private_message (void *cls, struct GNUNET_MESSENGER_Room *room, | 130 | iterate_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 | */ |
228 | static void | 232 | static void |
229 | on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | 233 | on_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 | */ |
294 | static void | 299 | static void |
295 | run (void *cls, char *const*args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | 300 | run (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 | */ |
309 | int | 317 | int |
310 | main (int argc, char **argv) | 318 | main (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 | |||
39 | struct GNUNET_MESSENGER_Service *messenger; | 39 | struct GNUNET_MESSENGER_Service *messenger; |
40 | 40 | ||
41 | static int | 41 | static int |
42 | check_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg) | 42 | check_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 | ||
48 | static void | 49 | static void |
49 | handle_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg) | 50 | handle_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 | ||
62 | static void | 64 | static void |
63 | handle_update (void *cls, const struct GNUNET_MESSENGER_UpdateMessage *msg) | 65 | handle_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 | ||
72 | static void | 75 | static void |
73 | handle_destroy (void *cls, const struct GNUNET_MESSENGER_DestroyMessage *msg) | 76 | handle_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 | ||
80 | static int | 84 | static int |
81 | check_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) | 85 | check_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 | ||
87 | static void | 92 | static void |
88 | handle_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) | 93 | handle_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 | ||
101 | static void | 107 | static void |
102 | handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | 108 | handle_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 | ||
127 | static void | 134 | static void |
128 | handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | 135 | handle_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 | ||
155 | static void | 163 | static void |
156 | handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | 164 | handle_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 | ||
181 | static int | 190 | static int |
182 | check_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) | 191 | check_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 | ||
226 | static void | 236 | static void |
227 | handle_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) | 237 | handle_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 | ||
273 | static void | 284 | static void |
274 | callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, | 285 | callback_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 | ||
302 | static void | 314 | static void |
303 | handle_get_message (void *cls, const struct GNUNET_MESSENGER_GetMessage *msg) | 315 | handle_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 | ||
343 | static void* | 356 | static void* |
344 | callback_client_connect (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq) | 357 | callback_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 | ||
354 | static void | 369 | static void |
355 | callback_client_disconnect (void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls) | 370 | callback_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 | */ |
371 | static void | 388 | static void |
372 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service) | 389 | run (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 | ||
42 | int | 42 | int |
43 | should_connect_tunnel_to (size_t count, size_t src, size_t dst) | 43 | should_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 | ||
51 | int | 53 | int |
52 | required_connection_between (size_t count, size_t src, size_t dst) | 54 | required_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 | */ |
50 | int | 50 | int |
51 | should_connect_tunnel_to (size_t count, size_t src, size_t dst); | 51 | should_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 | */ |
63 | int | 65 | int |
64 | required_connection_between (size_t count, size_t src, size_t dst); | 66 | required_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 | ||
30 | static void | 30 | static void |
31 | callback_update_ego (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *identifier) | 31 | callback_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 | ||
43 | void | 46 | void |
44 | init_ego_store(struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config) | 47 | init_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 | ||
60 | static int | 64 | static int |
61 | iterate_destroy_egos (void *cls, const struct GNUNET_HashCode *key, void *value) | 65 | iterate_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 | ||
114 | static void | 120 | static void |
115 | callback_ego_create (void *cls, const struct GNUNET_IDENTITY_PrivateKey *key, const char *emsg) | 121 | callback_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 | ||
141 | void | 149 | void |
142 | create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | 150 | create_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 | ||
160 | static void | 169 | static void |
161 | callback_ego_lookup (void *cls, struct GNUNET_IDENTITY_Ego *ego) | 170 | callback_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 | ||
185 | void | 195 | void |
186 | lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | 196 | lookup_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 | ||
221 | struct GNUNET_MESSENGER_Ego* | 233 | struct GNUNET_MESSENGER_Ego* |
222 | update_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | 234 | update_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 | ||
246 | static void | 259 | static void |
247 | callback_ego_rename (void *cls, const char *emsg) | 260 | callback_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 | ||
279 | void | 293 | void |
280 | rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier, | 294 | rename_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; | |||
35 | struct GNUNET_MESSENGER_EgoStore; | 35 | struct GNUNET_MESSENGER_EgoStore; |
36 | 36 | ||
37 | typedef void | 37 | typedef 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 | ||
41 | struct GNUNET_MESSENGER_EgoLookup | 42 | struct 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 | */ |
89 | void | 90 | void |
90 | init_ego_store (struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config); | 91 | init_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 | */ |
109 | void | 111 | void |
110 | create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | 112 | create_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 | */ |
122 | void | 125 | void |
123 | lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | 126 | lookup_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 | */ |
135 | struct GNUNET_MESSENGER_Ego* | 140 | struct GNUNET_MESSENGER_Ego* |
136 | update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | 141 | update_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 | */ |
148 | void | 154 | void |
149 | rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier, | 155 | rename_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 | ||
33 | struct GNUNET_MESSENGER_SrvHandle* | 33 | struct GNUNET_MESSENGER_SrvHandle* |
34 | create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq) | 34 | create_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 | ||
51 | int | 52 | int |
52 | iterate_free_member_ids (void *cls, const struct GNUNET_HashCode *key, void *value) | 53 | iterate_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 | ||
76 | void | 79 | void |
77 | get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir) | 80 | get_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 | ||
89 | static int | 94 | static int |
90 | create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) | 95 | create_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 | ||
114 | const struct GNUNET_ShortHashCode* | 120 | const struct GNUNET_ShortHashCode* |
115 | get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) | 121 | get_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 | ||
122 | int | 129 | int |
123 | change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | 130 | change_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 | ||
167 | static void | 175 | static void |
168 | change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) | 176 | change_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 | ||
194 | static void | 203 | static void |
195 | change_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego) | 204 | change_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 | ||
224 | static int | 234 | static int |
225 | iterate_send_message (void *cls, const struct GNUNET_HashCode *key, void *value) | 235 | iterate_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 | ||
234 | void | 246 | void |
235 | set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego) | 247 | set_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 | ||
273 | static void | 286 | static void |
274 | callback_setup_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) | 287 | callback_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 | ||
287 | void | 302 | void |
288 | setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) | 303 | setup_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 | ||
297 | static void | 313 | static void |
298 | callback_update_handle (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) | 314 | callback_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 | ||
328 | static void | 346 | static void |
329 | callback_set_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) | 347 | callback_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 | ||
385 | void | 405 | void |
386 | set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) | 406 | set_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 | ||
405 | int | 426 | int |
406 | open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) | 427 | open_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 | ||
416 | int | 438 | int |
417 | entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, | 439 | entry_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 | ||
428 | int | 451 | int |
429 | close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) | 452 | close_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 | ||
439 | int | 463 | int |
440 | send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | 464 | send_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 | ||
477 | static const struct GNUNET_MESSENGER_MemberSession* | 502 | static const struct GNUNET_MESSENGER_MemberSession* |
478 | get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) | 503 | get_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 | ||
499 | void | 525 | void |
500 | notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | 526 | notify_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 | ||
565 | static int | 593 | static int |
566 | callback_scan_for_rooms (void *cls, const char *filename) | 594 | callback_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 | ||
608 | static int | 637 | static int |
609 | iterate_save_rooms (void *cls, const struct GNUNET_HashCode *key, void *value) | 638 | iterate_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 | */ |
62 | struct GNUNET_MESSENGER_SrvHandle* | 62 | struct GNUNET_MESSENGER_SrvHandle* |
63 | create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq); | 63 | create_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 | */ |
81 | void | 82 | void |
82 | get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir); | 83 | get_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 | */ |
93 | const struct GNUNET_ShortHashCode* | 96 | const struct GNUNET_ShortHashCode* |
94 | get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); | 97 | get_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 | */ |
107 | int | 111 | int |
108 | change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | 112 | change_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 | */ |
117 | void | 122 | void |
118 | set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego); | 123 | set_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 | */ |
135 | void | 141 | void |
136 | setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); | 142 | setup_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 | */ |
156 | void | 163 | void |
157 | set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); | 164 | set_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 | */ |
167 | int | 175 | int |
168 | open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); | 176 | open_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 | */ |
179 | int | 188 | int |
180 | entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, | 189 | entry_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 | */ |
191 | int | 201 | int |
192 | close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); | 202 | close_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 | */ |
202 | int | 213 | int |
203 | send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | 214 | send_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 | */ |
215 | void | 227 | void |
216 | notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | 228 | notify_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 | ||
57 | void | 57 | void |
58 | add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle) | 58 | add_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 | ||
69 | int | 70 | int |
70 | remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle) | 71 | remove_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 | ||
89 | struct GNUNET_MESSENGER_SrvHandle* | 91 | struct GNUNET_MESSENGER_SrvHandle* |
90 | find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key) | 92 | find_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 | */ |
71 | void | 71 | void |
72 | add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle); | 72 | add_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 | */ |
82 | int | 83 | int |
83 | remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle); | 84 | remove_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 | */ |
95 | struct GNUNET_MESSENGER_SrvHandle* | 97 | struct GNUNET_MESSENGER_SrvHandle* |
96 | find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key); | 98 | find_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 | ||
54 | void | 54 | void |
55 | add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash) | 55 | add_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 | ||
66 | void | 67 | void |
67 | copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_MESSENGER_ListMessages *origin) | 68 | copy_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 | ||
77 | void | 79 | void |
78 | remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash) | 80 | remove_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 | ||
93 | void | 96 | void |
94 | load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path) | 97 | load_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 | ||
127 | void | 131 | void |
128 | save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages, const char *path) | 132 | save_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 | */ |
70 | void | 70 | void |
71 | add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash); | 71 | add_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 | */ |
79 | void | 80 | void |
80 | copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_MESSENGER_ListMessages *origin); | 81 | copy_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 | */ |
88 | void | 90 | void |
89 | remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash); | 91 | remove_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 | */ |
97 | void | 100 | void |
98 | load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path); | 101 | load_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 | */ |
106 | void | 110 | void |
107 | save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages, const char *path); | 111 | save_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 | ||
30 | struct GNUNET_MESSENGER_Member* | 30 | struct GNUNET_MESSENGER_Member* |
31 | create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) | 31 | create_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 | ||
52 | static int | 53 | static int |
53 | iterate_destroy_session (void *cls, const struct GNUNET_HashCode *key, void *value) | 54 | iterate_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 | ||
79 | static int | 82 | static int |
80 | callback_scan_for_sessions (void *cls, const char *filename) | 83 | callback_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 | ||
97 | void | 101 | void |
98 | load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) | 102 | load_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 | ||
141 | static int | 146 | static int |
142 | iterate_load_next_session (void *cls, const struct GNUNET_HashCode *key, void *value) | 147 | iterate_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 | ||
158 | void | 165 | void |
159 | load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory) | 166 | load_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 | ||
171 | static int | 179 | static int |
172 | iterate_save_session (void *cls, const struct GNUNET_HashCode *key, void *value) | 180 | iterate_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 | ||
189 | void | 199 | void |
190 | save_member (struct GNUNET_MESSENGER_Member *member, const char *directory) | 200 | save_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 | ||
223 | static void | 234 | static void |
224 | sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_MESSENGER_MemberSession *next) | 235 | sync_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 | ||
237 | static int | 249 | static int |
238 | iterate_sync_session_contact (void *cls, const struct GNUNET_HashCode *key, void *value) | 250 | iterate_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 | ||
256 | struct GNUNET_MESSENGER_MemberSession* | 270 | struct GNUNET_MESSENGER_MemberSession* |
257 | get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key) | 271 | get_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 | ||
274 | static int | 289 | static int |
275 | iterate_search_session (void *cls, const struct GNUNET_HashCode *key, void *value) | 290 | iterate_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 | ||
287 | static struct GNUNET_MESSENGER_MemberSession* | 304 | static struct GNUNET_MESSENGER_MemberSession* |
288 | try_member_session (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key) | 305 | try_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 | ||
303 | struct GNUNET_MESSENGER_MemberSession* | 321 | struct GNUNET_MESSENGER_MemberSession* |
304 | get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message, | 322 | get_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 | ||
326 | void | 345 | void |
327 | add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session) | 346 | add_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 | ||
346 | void | 366 | void |
347 | remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session) | 367 | remove_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 | ||
366 | static int | 387 | static int |
367 | iterate_member_sessions_it (void *cls, const struct GNUNET_HashCode *key, void *value) | 388 | iterate_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 | ||
375 | int | 398 | int |
376 | iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void *cls) | 399 | iterate_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 | */ |
54 | struct GNUNET_MESSENGER_Member* | 54 | struct GNUNET_MESSENGER_Member* |
55 | create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); | 55 | create_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 | */ |
82 | void | 83 | void |
83 | load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); | 84 | load_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 | */ |
92 | void | 94 | void |
93 | load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory); | 95 | load_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 | */ |
102 | void | 105 | void |
103 | save_member (struct GNUNET_MESSENGER_Member *member, const char *directory); | 106 | save_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 | */ |
122 | struct GNUNET_MESSENGER_MemberSession* | 126 | struct GNUNET_MESSENGER_MemberSession* |
123 | get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key); | 127 | get_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 | */ |
135 | struct GNUNET_MESSENGER_MemberSession* | 140 | struct GNUNET_MESSENGER_MemberSession* |
136 | get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message, | 141 | get_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 | */ |
145 | void | 151 | void |
146 | add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session); | 152 | add_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 | */ |
154 | void | 161 | void |
155 | remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session); | 162 | remove_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 | */ |
167 | int | 175 | int |
168 | iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void* cls); | 176 | iterate_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 | ||
160 | static int | 160 | static int |
161 | iterate_copy_history (void *cls, const struct GNUNET_HashCode *key, void *value) | 161 | iterate_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 | ||
462 | static void | 464 | static void |
463 | load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, const char *path) | 465 | load_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 | ||
504 | void | 507 | void |
505 | load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory) | 508 | load_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 | ||
573 | static struct GNUNET_MESSENGER_MemberSession* | 577 | static struct GNUNET_MESSENGER_MemberSession* |
574 | get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_MESSENGER_MemberSession *next) | 578 | get_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 | ||
591 | void | 596 | void |
592 | load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory) | 597 | load_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 | ||
642 | static int | 648 | static int |
643 | iterate_save_member_session_history_hentries (void *cls, const struct GNUNET_HashCode *key, void *value) | 649 | iterate_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 | ||
654 | static void | 662 | static void |
655 | save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, const char *path) | 663 | save_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 | ||
680 | void | 689 | void |
681 | save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory) | 690 | save_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 | */ |
226 | int | 226 | int |
227 | check_member_session_history (const struct GNUNET_MESSENGER_MemberSession *session, | 227 | check_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 | */ |
264 | void | 265 | void |
265 | load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory); | 266 | load_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 | */ |
275 | void | 277 | void |
276 | load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory); | 278 | load_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 | */ |
285 | void | 288 | void |
286 | save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory); | 289 | save_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 | ||
32 | void | 32 | void |
33 | init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room) | 33 | init_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 | ||
41 | static int | 42 | static int |
42 | iterate_destroy_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) | 43 | iterate_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 | ||
77 | static int | 80 | static int |
78 | callback_scan_for_members (void *cls, const char *filename) | 81 | callback_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 | ||
96 | static int | 100 | static int |
97 | iterate_load_next_member_sessions (void *cls, const struct GNUNET_ShortHashCode *id, void *value) | 101 | iterate_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 | ||
116 | static int | 122 | static int |
117 | iterate_sync_member_contacts (void *cls, const struct GNUNET_ShortHashCode *id, void *value) | 123 | iterate_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 | ||
128 | void | 136 | void |
129 | load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) | 137 | load_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 | ||
145 | static int | 154 | static int |
146 | iterate_save_members (void *cls, const struct GNUNET_ShortHashCode *id, void *value) | 155 | iterate_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 | ||
166 | void | 177 | void |
167 | save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) | 178 | save_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 | ||
181 | struct GNUNET_MESSENGER_Member* | 193 | struct GNUNET_MESSENGER_Member* |
182 | get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) | 194 | get_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 | ||
189 | struct GNUNET_MESSENGER_Member* | 202 | struct GNUNET_MESSENGER_Member* |
190 | get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message) | 203 | get_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 | ||
199 | struct GNUNET_MESSENGER_Member* | 213 | struct GNUNET_MESSENGER_Member* |
200 | add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) | 214 | add_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 | ||
229 | static int | 244 | static int |
230 | iterate_store_members_it (void *cls, const struct GNUNET_ShortHashCode *key, void *value) | 245 | iterate_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 | ||
238 | int | 255 | int |
239 | iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it, | 256 | iterate_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 | */ |
58 | void | 58 | void |
59 | init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room); | 59 | init_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 | */ |
93 | void | 94 | void |
94 | load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); | 95 | load_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 | */ |
102 | void | 104 | void |
103 | save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); | 105 | save_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 | */ |
113 | struct GNUNET_MESSENGER_Member* | 116 | struct GNUNET_MESSENGER_Member* |
114 | get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); | 117 | get_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 | */ |
124 | struct GNUNET_MESSENGER_Member* | 128 | struct GNUNET_MESSENGER_Member* |
125 | get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message); | 129 | get_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 | */ |
134 | struct GNUNET_MESSENGER_Member* | 139 | struct GNUNET_MESSENGER_Member* |
135 | add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); | 140 | add_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 | */ |
147 | int | 153 | int |
148 | iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it, | 154 | iterate_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 | ||
28 | static void | 28 | static void |
29 | handle_session_switch (struct GNUNET_MESSENGER_MemberSession *session, | 29 | handle_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 | ||
38 | void | 39 | void |
39 | handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 40 | handle_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 | ||
56 | void | 59 | void |
57 | handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 60 | handle_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 | ||
66 | void | 71 | void |
67 | handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 72 | handle_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 | ||
78 | void | 85 | void |
79 | handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 86 | handle_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 | ||
85 | void | 94 | void |
86 | handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 95 | handle_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 | ||
96 | void | 107 | void |
97 | handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 108 | handle_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 | ||
110 | void | 123 | void |
111 | handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 124 | handle_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 | ||
125 | void | 140 | void |
126 | handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 141 | handle_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 | */ |
47 | void | 47 | void |
48 | handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 48 | handle_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 | */ |
60 | void | 62 | void |
61 | handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 63 | handle_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 | */ |
73 | void | 77 | void |
74 | handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 78 | handle_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 | */ |
86 | void | 92 | void |
87 | handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 93 | handle_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 | */ |
99 | void | 107 | void |
100 | handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 108 | handle_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 | */ |
112 | void | 122 | void |
113 | handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 123 | handle_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 | */ |
125 | void | 137 | void |
126 | handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 138 | handle_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 | */ |
138 | void | 152 | void |
139 | handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 153 | handle_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 | ||
192 | struct GNUNET_MESSENGER_Message* | 192 | struct GNUNET_MESSENGER_Message* |
193 | create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) | 193 | create_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 | ||
224 | struct GNUNET_MESSENGER_Message* | 225 | struct GNUNET_MESSENGER_Message* |
225 | create_message_delete (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) | 226 | create_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 | */ |
148 | struct GNUNET_MESSENGER_Message* | 148 | struct GNUNET_MESSENGER_Message* |
149 | create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); | 149 | create_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 | */ |
169 | struct GNUNET_MESSENGER_Message* | 170 | struct GNUNET_MESSENGER_Message* |
170 | create_message_delete (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay); | 171 | create_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 | ||
30 | static void | 30 | static void |
31 | forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 31 | forward_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 | ||
56 | static int | 58 | static int |
57 | iterate_forward_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, | 59 | iterate_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 | ||
73 | int | 76 | int |
74 | recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 77 | recv_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 | ||
110 | int | 115 | int |
111 | recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 116 | recv_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 | ||
128 | static void | 135 | static void |
129 | callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, | 136 | callback_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 | */ |
154 | int | 162 | int |
155 | recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 163 | recv_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 | */ |
48 | int | 48 | int |
49 | recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 49 | recv_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 | */ |
62 | int | 64 | int |
63 | recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 65 | recv_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 | */ |
77 | int | 81 | int |
78 | recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 82 | recv_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 | ||
32 | void | 32 | void |
33 | send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 33 | send_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 | ||
39 | void | 41 | void |
40 | send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 42 | send_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 | ||
49 | void | 53 | void |
50 | send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 54 | send_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 | ||
56 | void | 62 | void |
57 | send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 63 | send_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 | */ |
46 | void | 46 | void |
47 | send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 47 | send_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 | */ |
59 | void | 61 | void |
60 | send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 62 | send_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 | */ |
72 | void | 76 | void |
73 | send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 77 | send_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 | */ |
85 | void | 91 | void |
86 | send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 92 | send_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 | ||
67 | void | 67 | void |
68 | update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested, | 68 | update_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 | ||
85 | void | 87 | void |
86 | load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *path) | 88 | load_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 | ||
97 | void | 100 | void |
98 | save_message_state (const struct GNUNET_MESSENGER_MessageState *state, const char *path) | 101 | save_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* | |||
51 | get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state); | 51 | get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state); |
52 | 52 | ||
53 | void | 53 | void |
54 | update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested, | 54 | update_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 | ||
57 | void | 59 | void |
58 | load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *path); | 60 | load_message_state (struct GNUNET_MESSENGER_MessageState *state, |
61 | const char *path); | ||
59 | 62 | ||
60 | void | 63 | void |
61 | save_message_state (const struct GNUNET_MESSENGER_MessageState *state, const char *path); | 64 | save_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 | ||
44 | static int | 44 | static int |
45 | iterate_destroy_entries (void *cls, const struct GNUNET_HashCode *key, void *value) | 45 | iterate_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 | ||
54 | static int | 56 | static int |
55 | iterate_destroy_messages (void *cls, const struct GNUNET_HashCode *key, void *value) | 57 | iterate_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 | ||
64 | static int | 68 | static int |
65 | iterate_destroy_links (void *cls, const struct GNUNET_HashCode *key, void *value) | 69 | iterate_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 | ||
101 | static void | 107 | static void |
102 | load_message_store_entries (struct GNUNET_MESSENGER_MessageStore *store, const char *filename) | 108 | load_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 | ||
148 | static void | 155 | static void |
149 | load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store, const char *filename) | 156 | load_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 | ||
189 | void | 197 | void |
190 | load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory) | 198 | load_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 | ||
234 | static int | 243 | static int |
235 | iterate_save_entries (void *cls, const struct GNUNET_HashCode *key, void *value) | 244 | iterate_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 | ||
250 | static int | 261 | static int |
251 | iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value) | 262 | iterate_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 | ||
281 | static int | 294 | static int |
282 | iterate_save_links (void *cls, const struct GNUNET_HashCode *key, void *value) | 295 | iterate_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 | ||
297 | void | 312 | void |
298 | save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory) | 313 | save_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 | ||
374 | int | 390 | int |
375 | contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) | 391 | contains_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 | ||
385 | const struct GNUNET_MESSENGER_Message* | 402 | const struct GNUNET_MESSENGER_Message* |
386 | get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) | 403 | get_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 | ||
446 | const struct GNUNET_MESSENGER_MessageLink* | 464 | const struct GNUNET_MESSENGER_MessageLink* |
447 | get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | 465 | get_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 | ||
475 | int | 494 | int |
476 | put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | 495 | put_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 | ||
485 | static void | 505 | static void |
486 | add_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | 506 | add_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 | ||
505 | int | 526 | int |
506 | delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) | 527 | delete_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 | */ |
83 | void | 83 | void |
84 | load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); | 84 | load_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 | */ |
92 | void | 93 | void |
93 | save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); | 94 | save_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 | */ |
105 | int | 107 | int |
106 | contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); | 108 | contains_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 | */ |
119 | const struct GNUNET_MESSENGER_Message* | 122 | const struct GNUNET_MESSENGER_Message* |
120 | get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); | 123 | get_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 | */ |
135 | const struct GNUNET_MESSENGER_MessageLink* | 139 | const struct GNUNET_MESSENGER_MessageLink* |
136 | get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | 140 | get_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 | */ |
147 | int | 152 | int |
148 | put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | 153 | put_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 | */ |
159 | int | 165 | int |
160 | delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); | 166 | delete_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 | |||
58 | callback_operation (void *cls); | 58 | callback_operation (void *cls); |
59 | 59 | ||
60 | struct GNUNET_MESSENGER_Operation* | 60 | struct GNUNET_MESSENGER_Operation* |
61 | load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path) | 61 | load_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 | ||
120 | void | 121 | void |
121 | save_operation (const struct GNUNET_MESSENGER_Operation *op, const char *path) | 122 | save_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 | */ |
88 | struct GNUNET_MESSENGER_Operation* | 88 | struct GNUNET_MESSENGER_Operation* |
89 | load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path); | 89 | load_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 | */ |
99 | void | 100 | void |
100 | save_operation (const struct GNUNET_MESSENGER_Operation *op, const char *path); | 101 | save_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 | ||
31 | void | 31 | void |
32 | init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room) | 32 | init_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 | ||
40 | static int | 41 | static int |
41 | iterate_destroy_operations (void *cls, const struct GNUNET_HashCode *key, void *value) | 42 | iterate_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 | ||
59 | static int | 62 | static int |
60 | callback_scan_for_operations (void *cls, const char *filename) | 63 | callback_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 | ||
96 | static int | 100 | static int |
97 | iterate_save_operations (void *cls, const struct GNUNET_HashCode *key, void *value) | 101 | iterate_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 | ||
194 | extern void | 200 | extern void |
195 | callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash); | 201 | callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, |
202 | const struct GNUNET_HashCode *hash); | ||
196 | 203 | ||
197 | extern void | 204 | extern void |
198 | callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash); | 205 | callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, |
206 | const struct GNUNET_HashCode *hash); | ||
199 | 207 | ||
200 | void | 208 | void |
201 | callback_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | 209 | callback_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 | */ |
50 | void | 50 | void |
51 | init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room); | 51 | init_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 | |||
43 | idle_request_room_messages (void *cls); | 43 | idle_request_room_messages (void *cls); |
44 | 44 | ||
45 | struct GNUNET_MESSENGER_SrvRoom* | 45 | struct GNUNET_MESSENGER_SrvRoom* |
46 | create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) | 46 | create_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 | ||
80 | static int | 81 | static int |
81 | iterate_destroy_tunnels (void *cls, const struct GNUNET_PeerIdentity *key, void *value) | 82 | iterate_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 | ||
152 | static int | 155 | static int |
153 | send_room_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 156 | send_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 | ||
162 | static void* | 166 | static void* |
163 | callback_room_connect (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *source) | 167 | callback_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 | ||
199 | static int | 205 | static int |
200 | join_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 206 | join_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 | ||
230 | static void | 237 | static void |
231 | notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify, struct GNUNET_MESSENGER_MemberSession *session, | 238 | notify_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 | ||
260 | static int | 269 | static int |
261 | iterate_notify_about_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, | 270 | iterate_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 | ||
277 | static int | 287 | static int |
278 | join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) | 288 | join_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 | ||
308 | extern int | 319 | extern int |
309 | check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header); | 320 | check_tunnel_message (void *cls, |
321 | const struct GNUNET_MessageHeader *header); | ||
310 | 322 | ||
311 | extern void | 323 | extern void |
312 | handle_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header); | 324 | handle_tunnel_message (void *cls, |
325 | const struct GNUNET_MessageHeader *header); | ||
313 | 326 | ||
314 | extern void | 327 | extern void |
315 | callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channel); | 328 | callback_tunnel_disconnect (void *cls, |
329 | const struct GNUNET_CADET_Channel *channel); | ||
316 | 330 | ||
317 | int | 331 | int |
318 | open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) | 332 | open_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 | ||
368 | int | 383 | int |
369 | enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 384 | enter_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 | ||
406 | struct GNUNET_MQ_Envelope* | 422 | struct GNUNET_MQ_Envelope* |
407 | pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle, | 423 | pack_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 | ||
434 | static int | 453 | static int |
435 | iterate_send_room_message (void *cls, const struct GNUNET_PeerIdentity *key, void *value) | 454 | iterate_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 | ||
467 | int | 488 | int |
468 | update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, | 489 | update_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 | ||
471 | void | 493 | void |
472 | callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 494 | callback_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 | ||
475 | int | 499 | int |
476 | send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 500 | send_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 | ||
532 | void | 557 | void |
533 | forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 558 | forward_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 | ||
556 | void | 583 | void |
557 | check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel) | 584 | check_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 | ||
594 | void | 622 | void |
595 | merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) | 623 | merge_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 | ||
614 | void | 643 | void |
615 | callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash) | 644 | callback_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 | ||
624 | void | 654 | void |
625 | callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash) | 655 | callback_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 | ||
633 | int | 664 | int |
634 | delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 665 | delete_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 | ||
689 | const struct GNUNET_MESSENGER_SrvTunnel* | 722 | const struct GNUNET_MESSENGER_SrvTunnel* |
690 | get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer) | 723 | get_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 | ||
697 | static int | 731 | static int |
698 | request_room_message_step (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, | 732 | request_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 | ||
734 | int | 770 | int |
735 | request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, | 771 | request_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 | ||
749 | void | 787 | void |
750 | callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls) | 788 | callback_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 | ||
768 | int | 807 | int |
769 | callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, | 808 | callback_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 | ||
828 | void | 869 | void |
829 | solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key, | 870 | solve_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 | ||
946 | int | 989 | int |
947 | update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, | 990 | update_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 | ||
1010 | static int | 1054 | static int |
1011 | iterate_update_member_sessions (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, | 1055 | iterate_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 | ||
1032 | static void | 1077 | static void |
1033 | remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session); | 1078 | remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, |
1079 | struct GNUNET_MESSENGER_MemberSession *session); | ||
1034 | 1080 | ||
1035 | void | 1081 | void |
1036 | callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 1082 | callback_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 | ||
1115 | static void | 1163 | static void |
1116 | get_room_data_subdir (struct GNUNET_MESSENGER_SrvRoom *room, char **dir) | 1164 | get_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 | ||
1180 | static void | 1229 | static void |
1181 | remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session) | 1230 | remove_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 | */ |
91 | struct GNUNET_MESSENGER_SrvRoom* | 91 | struct GNUNET_MESSENGER_SrvRoom* |
92 | create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); | 92 | create_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 | */ |
141 | int | 142 | int |
142 | open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle); | 143 | open_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 | */ |
154 | int | 156 | int |
155 | enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 157 | enter_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 | */ |
175 | struct GNUNET_MQ_Envelope* | 178 | struct GNUNET_MQ_Envelope* |
176 | pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle, | 179 | pack_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 | */ |
194 | int | 200 | int |
195 | send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 201 | send_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 | */ |
206 | void | 213 | void |
207 | forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 214 | forward_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 | */ |
218 | void | 227 | void |
219 | check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel); | 228 | check_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 | */ |
228 | void | 238 | void |
229 | merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle); | 239 | merge_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 | */ |
241 | int | 252 | int |
242 | delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | 253 | delete_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 | */ |
271 | const struct GNUNET_MESSENGER_SrvTunnel* | 284 | const struct GNUNET_MESSENGER_SrvTunnel* |
272 | get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer); | 285 | get_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 | */ |
282 | typedef void (GNUNET_MESSENGER_MessageRequestCallback) ( | 296 | typedef 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 | */ |
303 | int | 318 | int |
304 | request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, | 319 | request_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 | */ |
317 | void | 334 | void |
318 | solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key, | 335 | solve_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 | ||
43 | struct GNUNET_MESSENGER_Service* | 43 | struct GNUNET_MESSENGER_Service* |
44 | create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle) | 44 | create_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 | ||
90 | static int | 91 | static int |
91 | iterate_destroy_rooms (void *cls, const struct GNUNET_HashCode *key, void *value) | 92 | iterate_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 | ||
153 | struct GNUNET_MESSENGER_SrvHandle* | 156 | struct GNUNET_MESSENGER_SrvHandle* |
154 | add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq) | 157 | add_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 | ||
168 | void | 172 | void |
169 | remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle) | 173 | remove_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 | ||
180 | int | 185 | int |
181 | get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer) | 186 | get_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 | ||
188 | struct GNUNET_MESSENGER_SrvRoom* | 194 | struct GNUNET_MESSENGER_SrvRoom* |
189 | get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key) | 195 | get_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 | ||
196 | int | 203 | int |
197 | open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 204 | open_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 | ||
219 | int | 227 | int |
220 | entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 228 | entry_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 | ||
252 | int | 262 | int |
253 | close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 263 | close_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 | ||
292 | void | 303 | void |
293 | handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, | 304 | handle_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 | */ |
70 | struct GNUNET_MESSENGER_Service* | 70 | struct GNUNET_MESSENGER_Service* |
71 | create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle); | 71 | create_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 | */ |
106 | struct GNUNET_MESSENGER_SrvHandle* | 107 | struct GNUNET_MESSENGER_SrvHandle* |
107 | add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq); | 108 | add_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 | */ |
115 | void | 117 | void |
116 | remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle); | 118 | remove_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 | */ |
126 | int | 129 | int |
127 | get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer); | 130 | get_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 | */ |
137 | struct GNUNET_MESSENGER_SrvRoom* | 141 | struct GNUNET_MESSENGER_SrvRoom* |
138 | get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key); | 142 | get_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 | */ |
149 | int | 154 | int |
150 | open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 155 | open_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 | */ |
166 | int | 172 | int |
167 | entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 173 | entry_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 | */ |
182 | int | 190 | int |
183 | close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 191 | close_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 | */ |
196 | void | 205 | void |
197 | handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, | 206 | handle_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 | ||
35 | struct GNUNET_MESSENGER_SrvTunnel* | 35 | struct GNUNET_MESSENGER_SrvTunnel* |
36 | create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door) | 36 | create_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 | ||
74 | void | 75 | void |
75 | bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel) | 76 | bind_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 | ||
85 | extern void | 87 | extern void |
86 | callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls); | 88 | callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, |
89 | void *cls); | ||
87 | 90 | ||
88 | void | 91 | void |
89 | callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channel) | 92 | callback_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 | ||
101 | extern int | 105 | extern int |
102 | callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, | 106 | callback_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 | ||
105 | int | 111 | int |
106 | check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header) | 112 | check_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 | ||
138 | extern int | 145 | extern int |
139 | update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, | 146 | update_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 | ||
142 | extern void | 150 | extern void |
143 | callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 151 | callback_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 | ||
146 | static void | 156 | static void |
147 | update_tunnel_last_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_HashCode *hash) | 157 | update_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 | ||
283 | void | 294 | void |
284 | send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env, | 295 | send_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 | ||
301 | int | 313 | int |
302 | send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message) | 314 | send_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 | ||
327 | void | 341 | void |
328 | forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, | 342 | forward_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 | ||
355 | void | 370 | void |
356 | get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer) | 371 | get_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 | ||
371 | int | 387 | int |
372 | update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version) | 388 | update_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 | */ |
57 | struct GNUNET_MESSENGER_SrvTunnel* | 57 | struct GNUNET_MESSENGER_SrvTunnel* |
58 | create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door); | 58 | create_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 | */ |
75 | void | 76 | void |
76 | bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel); | 77 | bind_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 | */ |
114 | void | 116 | void |
115 | send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env, | 117 | send_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 | */ |
128 | int | 131 | int |
129 | send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message); | 132 | send_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 | */ |
138 | void | 143 | void |
139 | forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, | 144 | forward_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 | */ |
160 | void | 166 | void |
161 | get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer); | 167 | get_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 | */ |
183 | int | 190 | int |
184 | update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version); | 191 | update_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 | ||
72 | static int | 72 | static int |
73 | check_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) | 73 | check_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 | ||
79 | static void | 80 | static void |
80 | handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) | 81 | handle_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 | ||
91 | static int | 93 | static int |
92 | check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) | 94 | check_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 | ||
109 | static void | 112 | static void |
110 | handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) | 113 | handle_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 | ||
131 | static void | 135 | static void |
132 | handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg) | 136 | handle_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 | ||
152 | static void | 157 | static void |
153 | handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | 158 | handle_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 | ||
164 | static void | 170 | static void |
165 | handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | 171 | handle_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 | ||
177 | static void | 184 | static void |
178 | handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | 185 | handle_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 | ||
189 | static int | 197 | static int |
190 | check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) | 198 | check_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 | ||
211 | static void | 220 | static void |
212 | handle_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) | 221 | handle_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 | |||
255 | reconnect (struct GNUNET_MESSENGER_Handle *handle); | 265 | reconnect (struct GNUNET_MESSENGER_Handle *handle); |
256 | 266 | ||
257 | static void | 267 | static void |
258 | send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) | 268 | send_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 | ||
268 | static void | 279 | static void |
269 | send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room, | 280 | send_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 | ||
281 | static void | 293 | static void |
282 | send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) | 294 | send_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 | ||
292 | static int | 305 | static int |
293 | iterate_reset_room (void *cls, const struct GNUNET_HashCode *key, void *value) | 306 | iterate_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 | ||
331 | static int | 346 | static int |
332 | iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value) | 347 | iterate_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 | ||
342 | static void | 359 | static void |
343 | callback_mq_error (void *cls, enum GNUNET_MQ_Error error) | 360 | callback_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 | ||
404 | struct GNUNET_MESSENGER_Handle* | 422 | struct GNUNET_MESSENGER_Handle* |
405 | GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, | 423 | GNUNET_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 | ||
477 | int | 498 | int |
478 | GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) | 499 | GNUNET_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 | ||
519 | struct GNUNET_MESSENGER_Room* | 541 | struct GNUNET_MESSENGER_Room* |
520 | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) | 542 | GNUNET_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 | ||
543 | struct GNUNET_MESSENGER_Room* | 566 | struct GNUNET_MESSENGER_Room* |
544 | GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, | 567 | GNUNET_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 | ||
585 | static int | 609 | static int |
586 | iterate_find_room (void* cls, const struct GNUNET_HashCode *key, void *value) | 610 | iterate_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 | ||
604 | int | 630 | int |
605 | GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, | 631 | GNUNET_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 | ||
630 | const struct GNUNET_MESSENGER_Contact* | 658 | const struct GNUNET_MESSENGER_Contact* |
631 | GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) | 659 | GNUNET_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 | ||
657 | void | 686 | void |
658 | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 687 | GNUNET_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 | ||
725 | const struct GNUNET_MESSENGER_Message* | 755 | const struct GNUNET_MESSENGER_Message* |
726 | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) | 756 | GNUNET_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 | ||
747 | int | 778 | int |
748 | GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, | 779 | GNUNET_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 | ||
62 | void | 62 | void |
63 | set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name) | 63 | set_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 | ||
100 | void | 101 | void |
101 | get_context_from_member (const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, | 102 | get_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 | */ |
73 | void | 73 | void |
74 | set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name); | 74 | set_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 | */ |
110 | void | 111 | void |
111 | get_context_from_member (const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, | 112 | get_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 | ||
40 | static int | 40 | static int |
41 | iterate_destroy_contacts (void *cls, const struct GNUNET_HashCode *key, void *value) | 41 | iterate_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 | ||
60 | static struct GNUNET_CONTAINER_MultiHashMap* | 62 | static struct GNUNET_CONTAINER_MultiHashMap* |
61 | select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, | 63 | select_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 | ||
78 | struct GNUNET_MESSENGER_Contact* | 81 | struct GNUNET_MESSENGER_Contact* |
79 | get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, | 82 | get_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 | ||
94 | struct GNUNET_MESSENGER_Contact* | 98 | struct GNUNET_MESSENGER_Contact* |
95 | get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, | 99 | get_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 | ||
132 | void | 137 | void |
133 | update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, | 138 | update_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 | ||
165 | void | 172 | void |
166 | remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, | 173 | remove_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 | */ |
70 | struct GNUNET_MESSENGER_Contact* | 70 | struct GNUNET_MESSENGER_Contact* |
71 | get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, | 71 | get_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 | */ |
89 | struct GNUNET_MESSENGER_Contact* | 90 | struct GNUNET_MESSENGER_Contact* |
90 | get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, | 91 | get_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 | */ |
105 | void | 107 | void |
106 | update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, | 108 | update_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 | */ |
118 | void | 122 | void |
119 | remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, | 123 | remove_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 | ||
30 | struct GNUNET_MESSENGER_Handle* | 30 | struct GNUNET_MESSENGER_Handle* |
31 | create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback, | 31 | create_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 | ||
60 | static int | 63 | static int |
61 | iterate_destroy_room (void *cls, const struct GNUNET_HashCode *key, void *value) | 64 | iterate_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 | ||
99 | void | 104 | void |
100 | set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) | 105 | set_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 | ||
118 | void | 124 | void |
119 | set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey) | 125 | set_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 | ||
148 | struct GNUNET_MESSENGER_Contact* | 155 | struct GNUNET_MESSENGER_Contact* |
149 | get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) | 156 | get_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 | ||
164 | void | 172 | void |
165 | open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) | 173 | open_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 | ||
175 | void | 184 | void |
176 | entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, | 185 | entry_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 | ||
187 | void | 197 | void |
188 | close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) | 198 | close_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 | */ |
73 | struct GNUNET_MESSENGER_Handle* | 73 | struct GNUNET_MESSENGER_Handle* |
74 | create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback, | 74 | create_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 | */ |
91 | void | 94 | void |
92 | set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); | 95 | set_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 | */ |
109 | void | 113 | void |
110 | set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey); | 114 | set_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 | */ |
138 | struct GNUNET_MESSENGER_Contact* | 143 | struct GNUNET_MESSENGER_Contact* |
139 | get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); | 144 | get_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 | */ |
147 | void | 153 | void |
148 | open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); | 154 | open_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 | */ |
158 | void | 165 | void |
159 | entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, | 166 | entry_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 | */ |
168 | void | 176 | void |
169 | close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); | 177 | close_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 | ||
55 | static int | 55 | static int |
56 | compare_list_tunnels (void *cls, struct GNUNET_MESSENGER_ListTunnel *element0, | 56 | compare_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 | ||
62 | void | 63 | void |
63 | add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) | 64 | add_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 | ||
75 | struct GNUNET_MESSENGER_ListTunnel* | 77 | struct GNUNET_MESSENGER_ListTunnel* |
76 | find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index) | 78 | find_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 | ||
100 | int | 104 | int |
101 | contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) | 105 | contains_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 | ||
108 | struct GNUNET_MESSENGER_ListTunnel* | 113 | struct GNUNET_MESSENGER_ListTunnel* |
109 | remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element) | 114 | remove_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 | ||
122 | void | 128 | void |
123 | load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path) | 129 | load_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 | ||
156 | void | 163 | void |
157 | save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path) | 164 | save_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 | */ |
69 | void | 69 | void |
70 | add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer); | 70 | add_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 | */ |
87 | struct GNUNET_MESSENGER_ListTunnel* | 88 | struct GNUNET_MESSENGER_ListTunnel* |
88 | find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index); | 89 | find_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 | */ |
98 | int | 101 | int |
99 | contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer); | 102 | contains_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 | */ |
109 | struct GNUNET_MESSENGER_ListTunnel* | 113 | struct GNUNET_MESSENGER_ListTunnel* |
110 | remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element); | 114 | remove_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 | */ |
118 | void | 123 | void |
119 | load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path); | 124 | load_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 | */ |
127 | void | 133 | void |
128 | save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path); | 134 | save_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 | ||
105 | static void | 105 | static void |
106 | destroy_message_body (enum GNUNET_MESSENGER_MessageKind kind, struct GNUNET_MESSENGER_MessageBody *body) | 106 | destroy_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 | ||
152 | static void | 153 | static void |
153 | fold_short_message (const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_ShortMessage *shortened) | 154 | fold_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 | ||
160 | static void | 162 | static void |
161 | unfold_short_message (struct GNUNET_MESSENGER_ShortMessage *shortened, struct GNUNET_MESSENGER_Message *message) | 163 | unfold_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 | ||
233 | static uint16_t | 236 | static uint16_t |
234 | get_message_body_size (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_MESSENGER_MessageBody *body) | 237 | get_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 | ||
285 | static uint16_t | 289 | static uint16_t |
286 | get_short_message_size (const struct GNUNET_MESSENGER_ShortMessage *message, int include_body) | 290 | get_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 | ||
372 | static void | 377 | static void |
373 | encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_MESSENGER_MessageBody *body, | 378 | encode_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 | ||
447 | void | 455 | void |
448 | encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, | 456 | encode_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 | ||
468 | static void | 478 | static void |
469 | encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, char *buffer) | 479 | encode_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 | ||
514 | static uint16_t | 526 | static uint16_t |
515 | decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESSENGER_MessageBody *body, | 527 | decode_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 | ||
595 | int | 610 | int |
596 | decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, | 611 | decode_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 | ||
640 | static int | 658 | static int |
641 | decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, const char *buffer) | 659 | decode_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 | ||
677 | void | 697 | void |
678 | hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, | 698 | hash_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 | ||
690 | void | 712 | void |
691 | sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, | 713 | sign_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 | ||
708 | int | 733 | int |
709 | verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, | 734 | verify_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 | ||
728 | int | 754 | int |
729 | encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key) | 755 | encrypt_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 | ||
762 | int | 789 | int |
763 | decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key) | 790 | decrypt_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 | ||
790 | struct GNUNET_MQ_Envelope* | 818 | struct GNUNET_MQ_Envelope* |
791 | pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, | 819 | pack_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 | */ |
109 | void | 109 | void |
110 | encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, | 110 | encode_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 | */ |
127 | int | 129 | int |
128 | decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, | 130 | decode_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 | */ |
140 | void | 145 | void |
141 | hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, | 146 | hash_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 | */ |
154 | void | 161 | void |
155 | sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, | 162 | sign_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 | */ |
168 | int | 178 | int |
169 | verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, | 179 | verify_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 | */ |
181 | int | 192 | int |
182 | encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key); | 193 | encrypt_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 | */ |
193 | int | 205 | int |
194 | decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key); | 206 | decrypt_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 | */ |
211 | struct GNUNET_MQ_Envelope* | 224 | struct GNUNET_MQ_Envelope* |
212 | pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, | 225 | pack_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 | ||
30 | struct GNUNET_MESSENGER_Room* | 30 | struct GNUNET_MESSENGER_Room* |
31 | create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) | 31 | create_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 | ||
51 | static int | 52 | static int |
52 | iterate_destroy_message (void *cls, const struct GNUNET_HashCode *key, void *value) | 53 | iterate_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 | ||
85 | const struct GNUNET_MESSENGER_Message* | 88 | const struct GNUNET_MESSENGER_Message* |
86 | get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) | 89 | get_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 | ||
97 | struct GNUNET_MESSENGER_Contact* | 101 | struct GNUNET_MESSENGER_Contact* |
98 | get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) | 102 | get_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 | ||
109 | static struct GNUNET_MESSENGER_Contact* | 114 | static struct GNUNET_MESSENGER_Contact* |
110 | handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 115 | handle_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 | ||
131 | static void | 138 | static void |
132 | handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 139 | handle_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 | ||
146 | static void | 155 | static void |
147 | handle_name_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 156 | handle_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 | ||
156 | static void | 167 | static void |
157 | handle_key_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 168 | handle_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 | ||
171 | static void | 184 | static void |
172 | handle_id_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 185 | handle_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 | ||
190 | static void | 205 | static void |
191 | handle_miss_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 206 | handle_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 | ||
203 | static void | 220 | static void |
204 | handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 221 | handle_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 | ||
219 | struct GNUNET_MESSENGER_Contact* | 238 | struct GNUNET_MESSENGER_Contact* |
220 | handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 239 | handle_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 | ||
278 | static int | 299 | static int |
279 | iterate_local_members (void* cls, const struct GNUNET_ShortHashCode *key, void *value) | 300 | iterate_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 | ||
287 | int | 310 | int |
288 | iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, | 311 | iterate_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 | ||
313 | static int | 337 | static int |
314 | iterate_find_member (void* cls, const struct GNUNET_ShortHashCode *key, void *value) | 338 | iterate_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 | ||
328 | int | 354 | int |
329 | find_room_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact) | 355 | find_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 | */ |
66 | struct GNUNET_MESSENGER_Room* | 66 | struct GNUNET_MESSENGER_Room* |
67 | create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); | 67 | create_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 | */ |
85 | const struct GNUNET_MESSENGER_Message* | 86 | const struct GNUNET_MESSENGER_Message* |
86 | get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); | 87 | get_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 | */ |
96 | struct GNUNET_MESSENGER_Contact* | 98 | struct GNUNET_MESSENGER_Contact* |
97 | get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); | 99 | get_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 | */ |
112 | struct GNUNET_MESSENGER_Contact* | 115 | struct GNUNET_MESSENGER_Contact* |
113 | handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | 116 | handle_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 | */ |
125 | int | 130 | int |
126 | iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, | 131 | iterate_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 | */ |
137 | int | 143 | int |
138 | find_room_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact); | 144 | find_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 | ||
47 | int | 47 | int |
48 | generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members) | 48 | generate_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 | ||
86 | void | 87 | void |
87 | convert_messenger_key_to_port(const struct GNUNET_HashCode *key, struct GNUNET_HashCode *port) | 88 | convert_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 | */ |
53 | int | 53 | int |
54 | generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members); | 54 | generate_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 | */ |
75 | void | 76 | void |
76 | convert_messenger_key_to_port(const struct GNUNET_HashCode *key, struct GNUNET_HashCode *port); | 77 | convert_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 | */ |
102 | static void | 102 | static void |
103 | on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | 103 | on_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 | */ |
152 | static void | 153 | static void |
153 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) | 154 | run (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 | */ |
170 | int | 173 | int |
171 | main (int argc, char **argv) | 174 | main (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 | */ |
35 | int | 35 | int |
36 | main (int argc, char **argv) | 36 | main (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 | */ |
98 | static void | 98 | static void |
99 | on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | 99 | on_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 | */ |
146 | static void | 147 | static void |
147 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) | 148 | run (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 | */ |
162 | int | 165 | int |
163 | main (int argc, char **argv) | 166 | main (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 | */ |
35 | int | 35 | int |
36 | main (int argc, char **argv) | 36 | main (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 | */ |
35 | int | 35 | int |
36 | main (int argc, char **argv) | 36 | main (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 | */ |
35 | int | 35 | int |
36 | main (int argc, char **argv) | 36 | main (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 | */ |
35 | int | 35 | int |
36 | main (int argc, char **argv) | 36 | main (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 | */ |
35 | int | 35 | int |
36 | main (int argc, char **argv) | 36 | main (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 | */ |
35 | int | 35 | int |
36 | main (int argc, char **argv) | 36 | main (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 | */ |
35 | int | 35 | int |
36 | main (int argc, char **argv) | 36 | main (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 | */ |
35 | int | 35 | int |
36 | main (int argc, char **argv) | 36 | main (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 | */ |
35 | int | 35 | int |
36 | main (int argc, char **argv) | 36 | main (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 | ||
63 | static void | 63 | static void |
64 | exit_status (struct GNUNET_BarrierHandle *barrier, int status); | 64 | exit_status (struct GNUNET_BarrierHandle *barrier, |
65 | int status); | ||
65 | 66 | ||
66 | static void | 67 | static void |
67 | cancel_barrier (void *cls) | 68 | cancel_barrier (void *cls) |
@@ -96,7 +97,8 @@ struct GNUNET_BarrierWaitHandle | |||
96 | }; | 97 | }; |
97 | 98 | ||
98 | static void | 99 | static void |
99 | exit_status (struct GNUNET_BarrierHandle *barrier, int status) | 100 | exit_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 | ||
206 | static void | 206 | static void |
207 | barrier2_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status) | 207 | barrier2_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 | ||
217 | static void | 219 | static void |
218 | barrier_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status) | 220 | barrier_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 | */ |
261 | static void | 265 | static void |
262 | on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, | 266 | on_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 | ||
342 | static void | 349 | static void |
343 | on_peer (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, | 350 | on_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 | */ |
398 | static void | 407 | static void |
399 | run (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | 408 | run (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 | ||
422 | static void | 432 | static void |
423 | barrier2_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) | 433 | barrier2_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 | ||
451 | static void | 463 | static void |
452 | barrier_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) | 464 | barrier_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 | ||
487 | static void | 501 | static void |
488 | init (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, | 502 | init (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 | ||
502 | int | 520 | int |
503 | GNUNET_run_messenger_setup (const char* test_name, const struct test_configuration *cfg) | 521 | GNUNET_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 | ||
36 | int | 36 | int |
37 | GNUNET_run_messenger_setup (const char* test_name, const struct test_configuration *cfg); | 37 | GNUNET_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_ */ |