GNUnet 0.26.2-16-ge86b66bd5
 
Loading...
Searching...
No Matches
messenger_api_room.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2025 GNUnet e.V.
4
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
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
26#include "messenger_api_room.h"
27
28#include "gnunet_common.h"
32#include "gnunet_time_lib.h"
33#include "gnunet_util_lib.h"
34
35#include "messenger_api.h"
38#include "messenger_api_epoch.h"
45
46#include <stdbool.h>
47#include <stdint.h>
48#include <string.h>
49
52 const union GNUNET_MESSENGER_RoomKey *key)
53{
54 struct GNUNET_MESSENGER_Room *room;
55
56 GNUNET_assert ((handle) && (key));
57
58 room = GNUNET_new (struct GNUNET_MESSENGER_Room);
59 room->handle = handle;
60
61 GNUNET_memcpy (&(room->key), key, sizeof(*key));
62
63 room->keys_head = NULL;
64 room->keys_tail = NULL;
65
66 memset (&(room->last_message), 0, sizeof(room->last_message));
67 memset (&(room->last_epoch), 0, sizeof(room->last_epoch));
68
69 room->joined = GNUNET_NO;
70 room->opened = GNUNET_NO;
73
74 room->sender_id = NULL;
75
76 init_list_tunnels (&(room->entries));
77
82
86
87 init_queue_messages (&(room->queue));
88 room->queue_task = NULL;
89
90 room->request_task = NULL;
91
92 room->control = create_message_control (room);
93
94 return room;
95}
96
97
100 const struct GNUNET_HashCode *key,
101 void *value)
102{
103 struct GNUNET_MESSENGER_RoomAction *action;
104
106
107 action = value;
108
109 if (action->task)
110 GNUNET_SCHEDULER_cancel (action->task);
111
112 GNUNET_free (action);
113 return GNUNET_YES;
114}
115
116
119 const struct GNUNET_HashCode *key,
120 void *value)
121{
123
125
126 entry = value;
127
128 destroy_message (entry->message);
129 GNUNET_free (entry);
130 return GNUNET_YES;
131}
132
133
136 const struct GNUNET_HashCode *key,
137 void *value)
138{
139 struct GNUNET_HashCode *hash;
140
142
143 hash = value;
144
145 GNUNET_free (hash);
146 return GNUNET_YES;
147}
148
149
152 const struct GNUNET_ShortHashCode *key,
153 void *value)
154{
155 struct GNUNET_MESSENGER_RoomSubscription *subscription;
156
158
159 subscription = value;
160
161 if (subscription->task)
162 GNUNET_SCHEDULER_cancel (subscription->task);
163
164 if (subscription->message)
165 destroy_message (subscription->message);
166
167 GNUNET_free (subscription);
168 return GNUNET_YES;
169}
170
171
174 const struct GNUNET_HashCode *key,
175 void *value)
176{
177 struct GNUNET_MESSENGER_Epoch *epoch;
178
180
181 epoch = value;
182
183 destroy_epoch (epoch);
184 return GNUNET_YES;
185}
186
187
188static void
191{
192 struct GNUNET_MESSENGER_RoomEncryptionKey *encryption_key;
193
194 GNUNET_assert ((head) && (tail));
195
196 do
197 {
198 encryption_key = head;
199
200 GNUNET_CONTAINER_DLL_remove (head, tail, encryption_key);
201
202 if (encryption_key->query)
203 GNUNET_NAMESTORE_cancel (encryption_key->query);
204
205 GNUNET_CRYPTO_hpke_sk_clear (&(encryption_key->key));
206 GNUNET_free (encryption_key);
207 }
208 while (head);
209}
210
211
212void
214{
215 GNUNET_assert (room);
216
218
219 if (room->actions)
220 {
223
225 }
226
227 if (room->request_task)
229
230 if (room->queue_task)
232
233 clear_queue_messages (&(room->queue));
234 clear_list_tunnels (&(room->entries));
235
236 if (room->requests)
238
239 if (room->epochs)
240 {
243 NULL);
244
246 }
247
248 if (room->subscriptions)
249 {
252 NULL);
253
255 }
256
257 if (room->messages)
258 {
261
263 }
264
265 if (room->members)
267
268 if (room->links)
269 {
272
274 }
275
276 if (room->sender_id)
277 GNUNET_free (room->sender_id);
278
279 if (room->keys_head)
281
282 GNUNET_free (room);
283}
284
285
286const struct GNUNET_HashCode*
288{
289 GNUNET_assert (room);
290
291 return &(room->key.hash);
292}
293
294
297{
298 GNUNET_assert (room);
299
300 return room->key.code.public_bit? GNUNET_YES : GNUNET_NO;
301}
302
303
304const struct GNUNET_CRYPTO_HpkePublicKey*
306{
307 static struct GNUNET_CRYPTO_HpkePublicKey public_key;
308
309 GNUNET_assert (room);
310
311 if (! room->keys_tail)
312 return NULL;
313
315 &(room->keys_tail->key), &public_key));
316
317 return &public_key;
318}
319
320
321static void
323 enum GNUNET_ErrorCode ec)
324{
325 struct GNUNET_MESSENGER_RoomEncryptionKey *encryption_key;
326
327 GNUNET_assert (cls);
328
329 encryption_key = cls;
330
331 if (GNUNET_EC_NONE != ec)
333 "Error writing encryption key record: %d\n", (int) ec);
334
335 encryption_key->query = NULL;
336}
337
338
341 const struct GNUNET_CRYPTO_HpkePrivateKey *key)
342{
343 struct GNUNET_MESSENGER_RoomEncryptionKey *encryption_key;
344
345 GNUNET_assert (room);
346
347 if (key)
348 {
349 encryption_key = room->keys_tail;
350
351 while (encryption_key)
352 {
353 if (0 == GNUNET_memcmp_priv (key, &(encryption_key->key)))
354 return GNUNET_SYSERR;
355
356 encryption_key = encryption_key->prev;
357 }
358 }
359
360 encryption_key = GNUNET_malloc (sizeof(struct
362
363 if (! encryption_key)
364 return GNUNET_SYSERR;
365
366 if (key)
367 GNUNET_memcpy (&(encryption_key->key), key, sizeof (struct
370 GNUNET_CRYPTO_HPKE_KEY_TYPE_X25519, &(encryption_key->key)))
371 {
372 GNUNET_free (encryption_key);
373 return GNUNET_SYSERR;
374 }
375
376 encryption_key->query = NULL;
377
378 encryption_key->prev = NULL;
379 encryption_key->next = NULL;
380
381 if (key)
383 keys_tail, encryption_key);
384 else
385 {
387 get_room_handle (room),
388 get_room_key (room),
389 &(encryption_key->key),
391 encryption_key,
392 &(encryption_key->query));
393
395 encryption_key);
396 }
397
398 return GNUNET_OK;
399}
400
401
404{
405 GNUNET_assert (entry);
406
408 return GNUNET_YES;
409 else
410 return GNUNET_NO;
411}
412
413
414static struct GNUNET_MESSENGER_Epoch*
416 const struct GNUNET_HashCode *hash,
418 entry,
419 const struct GNUNET_MESSENGER_Contact *contact)
420{
421 struct GNUNET_MESSENGER_Epoch *room_epoch;
422
423 GNUNET_assert ((room) && (hash) && (entry));
424
425 room_epoch = get_room_epoch (
426 room, &(entry->epoch),
428
429 if (! room_epoch)
430 return NULL;
431
433 return NULL;
434
436 room_epoch,
438 return NULL;
439
441 room_epoch, contact? contact : entry->sender))
442 return NULL;
443
444 return room_epoch;
445}
446
447
448static void
450 const struct GNUNET_HashCode *hash,
452 entry)
453{
454 const struct GNUNET_HashCode *target_hash;
456
457 target_hash = &(entry->message->body.deletion.hash);
458
460 {
461 struct GNUNET_TIME_Relative delay;
462
463 delay = get_message_timeout (entry->message);
464
465 link_room_deletion (room, target_hash, delay, delete_room_message);
466 }
467
468 target = GNUNET_CONTAINER_multihashmap_get (room->messages, target_hash);
469 if (! target)
470 return;
471
472 if ((target->sender != entry->sender) &&
473 (! (GNUNET_MESSENGER_FLAG_SENT & entry->flags)))
474 return;
475
477 callback_room_message (room, target_hash);
478
479 switch (target->message->header.kind)
480 {
482 {
483 struct GNUNET_MESSENGER_Epoch *epoch;
484 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
485
486 epoch = get_room_message_epoch (room, target_hash);
487
488 if (! epoch)
489 break;
490
491 announcement = get_epoch_announcement (
492 epoch,
494 GNUNET_NO);
495
496 if (! announcement)
497 break;
498
500 announcement,
501 target_hash,
502 target->message,
503 target->sender);
504 break;
505 }
506 default:
507 break;
508 }
509
511 room->messages, target_hash, target))
512 {
513 destroy_message (target->message);
514 GNUNET_free (target);
515 }
516}
517
518
519static void
521 const struct GNUNET_HashCode *hash,
522 const struct
524{
525 struct GNUNET_MESSENGER_Epoch *epoch;
526 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
528
529 GNUNET_assert ((room) && (hash) && (entry));
530
531 epoch = get_room_availble_epoch_entry (room, hash, entry, NULL);
532
533 if (! epoch)
534 return;
535
536 identifier = &(entry->message->body.announcement.identifier);
537
539 sent = GNUNET_YES;
540 else
541 sent = GNUNET_NO;
542
543 if (identifier->code.group_bit)
544 {
545 struct GNUNET_MESSENGER_EpochGroup *group;
546
548
549 if (! group)
550 return;
551
553 group,
554 entry->message,
555 hash,
556 entry->sender,
557 sent);
558 }
559 else
560 {
561 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
562
564
565 if (! announcement)
566 return;
567
569 announcement,
570 entry->message,
571 hash,
572 entry->sender,
573 sent);
574 }
575}
576
577
578static void
580 const struct GNUNET_HashCode *hash,
582 entry)
583{
584 const struct GNUNET_MESSENGER_RoomMessageEntry *event_entry;
585 struct GNUNET_MESSENGER_Epoch *epoch;
586 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
587 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
589
590 GNUNET_assert ((room) && (hash) && (entry));
591
593 room->messages, &(entry->message->body.appeal.event));
594
595 if (! event_entry)
596 return;
597
599 return;
600
602 room, hash, event_entry, entry->sender);
603
604 if (! epoch)
605 return;
606
607 identifier = &(event_entry->message->body.announcement.identifier);
608
609 if (identifier->code.group_bit)
610 return;
611
612 announcement = get_epoch_announcement (epoch, identifier, GNUNET_NO);
613
614 if (! announcement)
615 return;
616
618 return;
619
620 if (GNUNET_YES != is_epoch_member (epoch, entry->sender))
621 return;
622
623 if (GNUNET_YES == is_epoch_announcement_member (announcement, entry->sender))
624 return;
625
626 key = get_epoch_announcement_key (announcement);
627
628 if (! key)
629 return;
630
631 send_epoch_announcement_access (announcement, hash);
632}
633
634
635static void
637 const struct GNUNET_HashCode *hash)
638{
639 const struct GNUNET_MESSENGER_RoomMessageEntry *entry;
640
641 GNUNET_assert ((room) && (hash));
642
643 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
644
645 if ((! entry) || (! entry->message))
646 return;
647
648 if ((entry->flags & GNUNET_MESSENGER_FLAG_UPDATE) ||
650 goto skip_delayed_handling;
651
652 switch (entry->message->header.kind)
653 {
655 handle_room_delayed_deletion (room, hash, entry);
656 break;
658 handle_room_delayed_announcement (room, hash, entry);
659 break;
661 handle_room_delayed_appeal (room, hash, entry);
662 break;
663 default:
664 break;
665 }
666
667skip_delayed_handling:
669 callback_room_message (room, hash);
670}
671
672
673static void
675{
676 struct GNUNET_MESSENGER_RoomAction *action;
677 struct GNUNET_MESSENGER_Room *room;
678
679 GNUNET_assert (cls);
680
681 action = cls;
682 action->task = NULL;
683
684 room = action->room;
685
687 room->actions, &(action->hash), action))
688 handle_room_delayed_action (room, &(action->hash));
689
690 GNUNET_free (action);
691}
692
693
694void
696 const struct GNUNET_HashCode *hash,
697 const struct GNUNET_TIME_Relative delay)
698{
699 struct GNUNET_MESSENGER_RoomAction *action;
700
701 GNUNET_assert ((room) && (hash));
702
703 action = GNUNET_new (struct GNUNET_MESSENGER_RoomAction);
704
705 if (! action)
706 return;
707
709 room->actions, hash, action,
711 {
712 GNUNET_free (action);
713 return;
714 }
715
716 GNUNET_memcpy (&(action->hash), hash, sizeof(action->hash));
717
718 action->room = room;
720 delay,
723 action);
724}
725
726
727void
741
742
752
755 const struct GNUNET_HashCode *hash,
756 void *value)
757{
759 struct GNUNET_MESSENGER_RoomAction *action;
760 struct GNUNET_MESSENGER_Room *room;
761 const struct GNUNET_MESSENGER_Message *message;
762
763 GNUNET_assert ((cls) && (hash) && (value));
764
765 cancel = cls;
766 action = value;
767 room = action->room;
768
769 message = get_room_message (room, hash);
770
771 if ((! message) || (message->header.kind != cancel->kind))
772 return GNUNET_YES;
773
774 if (cancel->epoch_hash)
775 {
776 const struct GNUNET_MESSENGER_Epoch *epoch;
777
779
780 if ((! epoch) || (0 != GNUNET_CRYPTO_hash_cmp (&(epoch->hash), cancel->
781 epoch_hash)))
782 return GNUNET_YES;
783 }
784
785 if (cancel->identifier)
786 {
787 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
788
789 identifier = get_room_message_epoch_identifier (room, hash);
790
791 if ((! identifier) || (0 != GNUNET_memcmp (identifier, cancel->identifier)))
792 return GNUNET_YES;
793 }
794
795 if ((cancel->contact) && (cancel->contact != get_room_sender (room, hash)))
796 return GNUNET_YES;
797
800 return GNUNET_YES;
801}
802
803
806 const struct GNUNET_HashCode *hash,
807 void *value)
808{
809 struct GNUNET_MESSENGER_Room *room;
810
811 GNUNET_assert ((cls) && (hash));
812
813 room = cls;
814
815 cancel_room_action (room, hash);
816 return GNUNET_YES;
817}
818
819
820void
823 const struct GNUNET_HashCode *epoch_hash,
824 const union GNUNET_MESSENGER_EpochIdentifier *identifier
825 ,
826 const struct GNUNET_MESSENGER_Contact *contact)
827{
829
830 GNUNET_assert (room);
831
832 cancel.kind = kind;
833 cancel.epoch_hash = epoch_hash;
834 cancel.identifier = identifier;
835 cancel.contact = contact;
836
838
839 if (! cancel.map)
840 return;
841
844 &cancel);
845
848 room);
849
851}
852
853
856{
857 GNUNET_assert (room);
858
859 if (! get_room_sender_id (room))
860 return GNUNET_NO;
861
862 if ((GNUNET_YES == room->opened) || (room->entries.head))
863 return GNUNET_YES;
864 else
865 return GNUNET_NO;
866}
867
868
871{
872 GNUNET_assert (room);
873
874 return room->handle;
875}
876
877
878const struct GNUNET_ShortHashCode*
880{
881 GNUNET_assert (room);
882
883 return room->sender_id;
884}
885
886
887void
889 const struct GNUNET_ShortHashCode *id)
890{
891 GNUNET_assert (room);
892
893 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Set member id for room: %s\n",
894 GNUNET_h2s (get_room_key (room)));
895
896 if (! id)
897 {
898 if (room->sender_id)
899 GNUNET_free (room->sender_id);
900
901 room->sender_id = NULL;
902 return;
903 }
904
905 if (! room->sender_id)
907
908 GNUNET_memcpy (room->sender_id, id, sizeof(struct GNUNET_ShortHashCode));
909}
910
911
914 const struct GNUNET_HashCode *hash,
915 enum GNUNET_GenericReturnValue recent)
916{
917 struct GNUNET_MESSENGER_Epoch *epoch;
918
919 GNUNET_assert ((room) && (hash));
920
921 if (GNUNET_is_zero (hash))
922 return NULL;
923
925
926 if (epoch)
927 return epoch;
928
929 if (GNUNET_YES == recent)
930 epoch = create_new_epoch (room, hash);
931 else
932 epoch = create_epoch (room, hash);
933
934 if (! epoch)
935 return NULL;
936
938 hash,
939 epoch,
941 {
942 destroy_epoch (epoch);
943 return NULL;
944 }
945
946 return epoch;
947}
948
949
950void
952 struct GNUNET_MESSENGER_Epoch *epoch,
954 announcement)
955{
956 struct GNUNET_MESSENGER_EpochAnnouncement *epoch_announcement;
957
958 GNUNET_assert ((room) && (epoch) && (announcement) && (! (*announcement)));
959
960 epoch_announcement = create_epoch_announcement (epoch, NULL, GNUNET_YES);
961
962 if (! epoch_announcement)
963 return;
964
966 &(epoch_announcement->
968 epoch_announcement,
970 {
971 destroy_epoch_announcement (epoch_announcement);
972 return;
973 }
974
975 if (! get_epoch_announcement_key (epoch_announcement))
976 set_epoch_announcement_key (epoch_announcement, NULL, GNUNET_YES);
977
978 *announcement = epoch_announcement;
979
980 send_epoch_announcement (epoch_announcement);
981}
982
983
986 const struct GNUNET_HashCode *hash)
987{
989
990 GNUNET_assert ((room) && (hash));
991
992 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
993
994 if (! entry)
995 return NULL;
996
997 return get_room_epoch (room, &(entry->epoch),
999}
1000
1001
1004 const struct GNUNET_HashCode *hash)
1005{
1007
1008 GNUNET_assert ((room) && (hash));
1009
1010 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
1011
1012 if ((! entry) || (! entry->message))
1013 return NULL;
1014
1015 switch (entry->message->header.kind)
1016 {
1018 return &(entry->message->body.announcement.identifier);
1020 return &(entry->message->body.secret.identifier);
1023 &(entry->message->body.appeal.
1024 event));
1027 &(entry->message->body.access.
1028 event));
1030 return &(entry->message->body.revolution.identifier);
1032 return &(entry->message->body.group.identifier);
1034 return &(entry->message->body.authorization.identifier);
1035 default:
1036 return NULL;
1037 }
1038}
1039
1040
1041const struct GNUNET_MESSENGER_Message*
1043 const struct GNUNET_HashCode *hash)
1044{
1046
1047 GNUNET_assert ((room) && (hash));
1048
1049 if (! (room->messages))
1050 return NULL;
1051
1052 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
1053
1054 if ((! entry) || (GNUNET_YES != entry->completed))
1055 return NULL;
1056
1057 return entry->message;
1058}
1059
1060
1063 const struct GNUNET_HashCode *hash)
1064{
1066
1067 GNUNET_assert ((room) && (hash));
1068
1069 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
1070
1071 if (! entry)
1072 return GNUNET_SYSERR;
1073
1074 if (GNUNET_MESSENGER_FLAG_SENT & entry->flags)
1075 return GNUNET_YES;
1076 else
1077 return GNUNET_NO;
1078}
1079
1080
1083 const struct GNUNET_HashCode *hash)
1084{
1086
1087 GNUNET_assert ((room) && (hash));
1088
1089 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
1090
1091 if ((! entry) || (GNUNET_YES != entry->completed))
1092 return NULL;
1093
1094 return entry->sender;
1095}
1096
1097
1100 const struct GNUNET_HashCode *hash)
1101{
1103
1104 GNUNET_assert ((room) && (hash));
1105
1106 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
1107
1108 if ((! entry) || (GNUNET_YES != entry->completed))
1109 return NULL;
1110
1111 return entry->recipient;
1112}
1113
1114
1115const struct GNUNET_HashCode*
1117 const struct GNUNET_HashCode *hash)
1118{
1120
1121 GNUNET_assert ((room) && (hash));
1122
1123 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
1124
1125 if (! entry)
1126 return NULL;
1127
1128 return &(entry->epoch);
1129}
1130
1131
1132void
1134 const struct GNUNET_HashCode *hash,
1135 const struct GNUNET_TIME_Relative delay)
1136{
1137 struct GNUNET_MESSENGER_Message *message;
1138
1139 GNUNET_assert ((room) && (hash));
1140
1141 message = create_message_deletion (hash, delay);
1142
1143 if (! message)
1144 {
1146 "Sending deletion aborted: Message creation failed!\n");
1147 return;
1148 }
1149
1150 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
1151}
1152
1153
1154void
1156 const struct GNUNET_HashCode *hash)
1157{
1160
1161 GNUNET_assert ((room) && (hash));
1162
1163 handle = room->handle;
1164 if (! handle)
1165 return;
1166
1167 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
1168 if (! entry)
1169 return;
1170
1171 if (handle->msg_callback)
1172 handle->msg_callback (handle->msg_cls, room,
1173 entry->sender,
1174 entry->recipient,
1175 entry->message,
1176 hash,
1177 entry->flags);
1178
1181}
1182
1183
1184static enum GNUNET_GenericReturnValue
1186 identifier,
1187 const union GNUNET_MESSENGER_EpochIdentifier *other)
1188{
1189 uint32_t level, other_level;
1190
1191 GNUNET_assert ((identifier) && (other));
1192
1193 level = (uint32_t) identifier->code.level_bits;
1194 other_level = (uint32_t) other->code.level_bits;
1195
1196 if (level > other_level)
1197 return GNUNET_YES;
1198 else
1199 return GNUNET_NO;
1200}
1201
1202
1203static enum GNUNET_GenericReturnValue
1205 const struct GNUNET_HashCode *key,
1206 void *value)
1207{
1208 struct GNUNET_MESSENGER_Room *room;
1209
1210 GNUNET_assert ((cls) && (key));
1211
1212 room = cls;
1214
1215 return GNUNET_YES;
1216}
1217
1218
1219static void
1221{
1222 struct GNUNET_MESSENGER_Room *room;
1223
1224 GNUNET_assert (cls);
1225
1226 room = cls;
1227 room->request_task = NULL;
1228
1229 if ((GNUNET_YES != room->joined) || (! get_room_sender_id (room)))
1230 {
1231 struct GNUNET_TIME_Relative delay;
1233 delay = GNUNET_TIME_relative_multiply (delay, 100);
1234
1236 delay,
1239 room);
1240 return;
1241 }
1242
1244 room->requests,
1246 room);
1247
1249}
1250
1251
1252void
1254 const struct GNUNET_HashCode *hash)
1255{
1256 GNUNET_assert ((room) && (hash));
1257
1258 if (GNUNET_is_zero (hash))
1259 return;
1260
1261 if (get_room_message (room, hash))
1262 return;
1263
1265 room->requests,
1266 hash, NULL,
1268 return;
1269
1270 if (room->request_task)
1271 return;
1272
1276 room);
1277}
1278
1279
1280static void
1282 const struct GNUNET_HashCode *hash,
1283 struct GNUNET_MESSENGER_RoomMessageEntry *entry);
1284
1285
1286static void
1288 const struct GNUNET_HashCode *hash,
1290{
1291 GNUNET_assert ((room) && (hash) && (entry));
1292
1293 if (! entry->sender)
1294 {
1295 struct GNUNET_MESSENGER_ContactStore *store;
1296 struct GNUNET_HashCode context;
1297
1298 store = get_handle_contact_store (room->handle);
1299
1301 &(entry->message->header.sender_id),
1302 &context);
1303
1304 entry->sender = get_store_contact (store, &context,
1305 &(entry->message->body.join.key));
1306 }
1307
1308 if (! entry->sender)
1309 return;
1310
1312 room->members, &(entry->message->header.sender_id), entry->sender)) &&
1314 room->members,
1315 &(entry->message->header.sender_id),
1316 entry->sender,
1318 increase_contact_rc (entry->sender);
1319
1321 entry->sender, get_room_key (room), &(entry->message->body.join.hpke_key));
1322
1323 if ((get_room_sender_id (room)) &&
1324 (0 == GNUNET_memcmp (&(entry->message->header.sender_id),
1325 get_room_sender_id (room))) &&
1326 (0 == GNUNET_memcmp (&(entry->message->body.join.key), get_handle_pubkey (
1327 room->handle))))
1328 room->joined = GNUNET_YES;
1329
1330 require_message_from_room (room, &(entry->message->body.join.epoch));
1331}
1332
1333
1334static enum GNUNET_GenericReturnValue
1336 const struct GNUNET_HashCode *key,
1337 void *value)
1338{
1339 struct GNUNET_MESSENGER_Contact *contact;
1340 struct GNUNET_MESSENGER_Epoch *epoch;
1341
1342 GNUNET_assert ((cls) && (value));
1343
1344 contact = cls;
1345 epoch = value;
1346
1347 invalidate_epoch_keys_by_member (epoch, contact);
1348 return GNUNET_YES;
1349}
1350
1351
1352static void
1354 const struct GNUNET_HashCode *hash,
1356{
1357 GNUNET_assert ((room) && (hash) && (entry));
1358
1359 if ((! entry->sender) ||
1361 room->members,
1362 &(entry->message->header.sender_id),
1363 entry->sender)))
1364 return;
1365
1369 entry->sender);
1370
1371 if (GNUNET_YES == decrease_contact_rc (entry->sender))
1373 "A contact does not share any room with you anymore!\n");
1374
1376}
1377
1378
1379static void
1381 const struct GNUNET_HashCode *hash,
1383{
1384 GNUNET_assert ((room) && (hash) && (entry));
1385
1386 if (GNUNET_MESSENGER_FLAG_SENT & entry->flags)
1387 {
1388 const char *handle_name;
1389
1391 "Set rule for using handle name in room: %s\n",
1393
1394 handle_name = get_handle_name (room->handle);
1395
1396 if ((handle_name) && (0 == strcmp (handle_name,
1397 entry->message->body.name.name)))
1399 }
1400
1401 if (! entry->sender)
1402 return;
1403
1404 set_contact_name (entry->sender, entry->message->body.name.name);
1405}
1406
1407
1408static void
1410 const struct GNUNET_HashCode *hash,
1412{
1413 struct GNUNET_HashCode context;
1414 struct GNUNET_MESSENGER_ContactStore *store;
1415
1416 GNUNET_assert ((room) && (hash) && (entry));
1417
1418 if (! entry->sender)
1419 return;
1420
1422 get_room_key (room),
1423 &(entry->message->header.sender_id),
1424 &context);
1425
1426 store = get_handle_contact_store (room->handle);
1427
1428 update_store_contact (store, entry->sender, &context, &context,
1429 &(entry->message->body.key.key));
1430
1432 entry->sender, get_room_key (room), &(entry->message->body.key.hpke_key));
1433}
1434
1435
1436static void
1438 const struct GNUNET_HashCode *hash,
1440{
1441 struct GNUNET_HashCode context, next_context;
1442 struct GNUNET_MESSENGER_ContactStore *store;
1443
1444 GNUNET_assert ((room) && (hash) && (entry));
1445
1446 if (GNUNET_MESSENGER_FLAG_SENT & entry->flags)
1447 set_room_sender_id (room, &(entry->message->body.id.id));
1448
1449 if ((! entry->sender) ||
1451 room->members, &(entry->message->header.sender_id),
1452 entry->sender)) ||
1454 room->members, &(entry->message->body.id.id),
1455 entry->sender,
1457 return;
1458
1460 sender_id),
1461 &context);
1463 &next_context);
1464
1465 store = get_handle_contact_store (room->handle);
1466
1467 update_store_contact (store, entry->sender, &context, &next_context,
1468 get_contact_key (entry->sender));
1469}
1470
1471
1472static void
1474 const struct GNUNET_HashCode *hash,
1476{
1477 struct GNUNET_MESSENGER_ListTunnel *match;
1478
1479 GNUNET_assert ((room) && (hash) && (entry));
1480
1481 if (0 == (GNUNET_MESSENGER_FLAG_SENT & entry->flags))
1482 return;
1483
1484 match = find_list_tunnels (
1485 &(room->entries),
1486 &(entry->message->body.miss.peer),
1487 NULL);
1488
1489 if (match)
1490 remove_from_list_tunnels (&(room->entries), match);
1491}
1492
1493
1494static void
1496 const struct GNUNET_HashCode *hash,
1498{
1499 GNUNET_assert ((room) && (hash) && (entry));
1500
1501 require_message_from_room (room, &(entry->message->body.merge.epochs[0]));
1502 require_message_from_room (room, &(entry->message->body.merge.epochs[1]));
1503}
1504
1505
1506static void
1508 const struct GNUNET_HashCode *hash,
1510{
1511 const struct GNUNET_MESSENGER_RoomEncryptionKey *encryption_key;
1512 struct GNUNET_MESSENGER_Message *private_message;
1513
1514 GNUNET_assert ((room) && (hash) && (entry));
1515
1516 encryption_key = room->keys_tail;
1517
1518 if (! encryption_key)
1519 return;
1520
1521 private_message = copy_message (entry->message);
1522
1523 if (! private_message)
1524 return;
1525
1526 while (encryption_key)
1527 {
1528 if (GNUNET_YES == decrypt_message (private_message, &(encryption_key->key)))
1529 break;
1530
1531 encryption_key = encryption_key->prev;
1532 }
1533
1534 if (! encryption_key)
1535 {
1536 destroy_message (private_message);
1537 private_message = NULL;
1538 }
1539
1540 if (! private_message)
1541 return;
1542
1543 destroy_message (entry->message);
1544
1545 entry->recipient = get_handle_contact (room->handle, get_room_key (room));
1546
1547 entry->message = private_message;
1549
1550 if ((entry->sender) && (entry->recipient))
1551 handle_message (room, hash, entry);
1552}
1553
1554
1555static void
1557 const struct GNUNET_HashCode *hash,
1559{
1560 struct GNUNET_TIME_Relative delay;
1561
1562 GNUNET_assert ((room) && (hash) && (entry));
1563
1564 delay = get_message_timeout (entry->message);
1565
1566 delay_room_action (room, hash, delay);
1567}
1568
1569
1570static void
1572 const struct GNUNET_HashCode *hash,
1574{
1575 const struct GNUNET_HashCode *original_hash;
1576 struct GNUNET_MESSENGER_RoomMessageEntry *original;
1577 struct GNUNET_MESSENGER_Message *original_message;
1578
1579 GNUNET_assert ((room) && (hash) && (entry));
1580
1581 if (! (GNUNET_MESSENGER_FLAG_SENT & entry->flags))
1582 return;
1583
1584 original_hash = &(entry->message->body.transcript.hash);
1585
1586 original = GNUNET_CONTAINER_multihashmap_get (room->messages, original_hash);
1587
1588 if (original)
1589 goto read_transcript;
1590
1592
1593 if (! original)
1594 return;
1595
1596 original->sender = NULL;
1597 original->recipient = NULL;
1598
1599 original->message = NULL;
1601 original->completed = GNUNET_NO;
1602
1604 room->messages, original_hash, original,
1606 {
1607 GNUNET_free (original);
1608 return;
1609 }
1610
1611read_transcript:
1612 original_message = copy_message (entry->message);
1613
1614 if (! original_message)
1615 return;
1616
1617 if (GNUNET_YES != read_transcript_message (original_message))
1618 {
1619 destroy_message (original_message);
1620 return;
1621 }
1622
1623 {
1624 struct GNUNET_MESSENGER_ContactStore *store;
1625
1626 store = get_handle_contact_store (room->handle);
1627 original->recipient = get_store_contact (
1628 store, NULL,
1629 &(entry->message->body.transcript.key));
1630 }
1631
1632 if (original->message)
1633 {
1636
1637 copy_message_header (original_message, &(original->message->header));
1638 destroy_message (original->message);
1639 }
1640
1641 original->message = original_message;
1642
1643 link_room_message (room, hash, original_hash);
1644 link_room_message (room, original_hash, hash);
1645
1646 if ((original->sender) && (original->recipient))
1647 {
1649 handle_message (room, original_hash, original);
1650 }
1651}
1652
1653
1654static void
1656 const struct GNUNET_HashCode *hash,
1658{
1659 struct GNUNET_MESSENGER_Epoch *epoch;
1660 const union GNUNET_MESSENGER_EpochNonce *nonce;
1661 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1662 enum GNUNET_GenericReturnValue sent;
1663
1664 GNUNET_assert ((room) && (hash) && (entry));
1665
1666 epoch = get_room_availble_epoch_entry (room, hash, entry, NULL);
1667
1668 if (! epoch)
1669 return;
1670
1671 nonce = &(entry->message->body.announcement.nonce);
1672
1674 epoch->nonces, &(nonce->hash)))
1675 {
1677 "Unsafe announcement: Nonce (%s) has already been used in this epoch! [%s]\n",
1678 GNUNET_sh2s (&(nonce->hash)), GNUNET_h2s (&(epoch->hash)));
1679 return;
1680 }
1681
1682 GNUNET_CONTAINER_multishortmap_put (epoch->nonces, &(nonce->hash), NULL,
1684
1685 identifier = &(entry->message->body.announcement.identifier);
1686
1687 if (GNUNET_MESSENGER_FLAG_SENT & entry->flags)
1688 sent = GNUNET_YES;
1689 else
1690 sent = GNUNET_NO;
1691
1692 if (identifier->code.group_bit)
1693 {
1694 struct GNUNET_MESSENGER_EpochGroup *group;
1695
1697
1698 if (! group)
1699 return;
1700
1702 group,
1703 entry->message,
1704 hash,
1705 entry->sender,
1706 sent);
1707 }
1708 else
1709 {
1710 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
1711
1713
1714 if (! announcement)
1715 return;
1716
1718 announcement,
1719 entry->message,
1720 hash,
1721 entry->sender,
1722 sent);
1723 }
1724}
1725
1726
1727static void
1729 const struct GNUNET_HashCode *hash,
1731{
1732 struct GNUNET_MESSENGER_Epoch *epoch;
1733 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1734 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
1735
1736 GNUNET_assert ((room) && (hash) && (entry));
1737
1738 epoch = get_room_availble_epoch_entry (room, hash, entry, NULL);
1739
1740 if (! epoch)
1741 return;
1742
1744
1746 return;
1747
1749
1750 if (! announcement)
1751 return;
1752
1754 announcement, entry->message, hash);
1755}
1756
1757
1758static void
1760 const struct GNUNET_HashCode *hash,
1762{
1763 const struct GNUNET_MESSENGER_RoomMessageEntry *event_entry;
1764 struct GNUNET_MESSENGER_Epoch *epoch;
1765 const struct GNUNET_MESSENGER_Contact *contact;
1766 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1767 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
1769
1770 GNUNET_assert ((room) && (hash) && (entry));
1771
1772 event_entry = GNUNET_CONTAINER_multihashmap_get (
1773 room->messages, &(entry->message->body.appeal.event));
1774
1775 if (! event_entry)
1776 return;
1777
1779 return;
1780
1782 room, hash, event_entry, entry->sender);
1783
1784 if (! epoch)
1785 return;
1786
1787 contact = get_handle_contact (room->handle, get_room_key (room));
1788
1789 if (! contact)
1790 return;
1791
1792 if (GNUNET_YES != is_epoch_member (epoch, contact))
1793 return;
1794
1795 identifier = &(event_entry->message->body.announcement.identifier);
1796
1797 if (identifier->code.group_bit)
1798 return;
1799
1800 announcement = get_epoch_announcement (epoch, identifier, GNUNET_NO);
1801
1802 if (! announcement)
1803 return;
1804
1805 if (GNUNET_YES == is_epoch_announcement_member (announcement, entry->sender))
1806 {
1808 "Appealing contact is already member of epoch announcement! [%s]\n",
1809 GNUNET_sh2s (&(identifier->hash)));
1810 return;
1811 }
1812
1813 if (contact == event_entry->sender)
1815 else
1816 {
1818
1820 return;
1821
1823 timeout, get_epoch_position_factor (epoch, contact, NULL));
1824 }
1825
1826 if (GNUNET_MESSENGER_FLAG_SENT & entry->flags)
1827 set_epoch_announcement_appeal (announcement,
1828 get_message_timeout (entry->message));
1829
1830 delay_room_action (room, hash, timeout);
1831}
1832
1833
1834static void
1836 const struct GNUNET_HashCode *hash,
1838{
1839 const struct GNUNET_MESSENGER_RoomMessageEntry *event_entry;
1840 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1841 struct GNUNET_MESSENGER_Epoch *epoch;
1842
1843 GNUNET_assert ((room) && (hash) && (entry));
1844
1845 if (! (GNUNET_MESSENGER_FLAG_RECENT & entry->flags))
1846 return;
1847
1848 event_entry = GNUNET_CONTAINER_multihashmap_get (
1849 room->messages, &(entry->message->body.access.event));
1850
1851 if (! event_entry)
1852 return;
1853
1854 switch (event_entry->message->header.kind)
1855 {
1857 {
1858 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
1859 enum GNUNET_GenericReturnValue appealed;
1860
1861 if (GNUNET_MESSENGER_FLAG_SENT & event_entry->flags)
1862 appealed = GNUNET_YES;
1863 else
1864 appealed = GNUNET_NO;
1865
1866 event_entry = GNUNET_CONTAINER_multihashmap_get (room->messages,
1867 &(event_entry->message->
1868 body.appeal.event));
1869
1870 if (! event_entry)
1871 return;
1872
1874 kind)
1875 return;
1876
1877 identifier = &(event_entry->message->body.announcement.identifier);
1878 epoch = get_room_availble_epoch_entry (room, hash, event_entry, entry->
1879 sender);
1880
1881 if (! epoch)
1882 return;
1883
1885
1886 if (! announcement)
1887 return;
1888
1889 if (GNUNET_YES != appealed)
1890 {
1891 const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key;
1892
1893 shared_key = get_epoch_announcement_key (announcement);
1894
1895 if ((shared_key) && (GNUNET_OK == verify_message_by_key (entry->message,
1896 shared_key)))
1897 cancel_room_action (room, &(entry->message->body.access.event));
1898
1899 return;
1900 }
1901
1902 handle_epoch_announcement_access (announcement, entry->message, hash);
1903 break;
1904 }
1906 {
1907 struct GNUNET_MESSENGER_EpochGroup *group;
1908 const struct GNUNET_HashCode *partner_hash;
1909 const struct GNUNET_MESSENGER_RoomMessageEntry *init_entry;
1910
1911 identifier = &(event_entry->message->body.group.identifier);
1912 epoch = get_room_availble_epoch_entry (room, hash, event_entry, entry->
1913 sender);
1914
1915 if (! epoch)
1916 return;
1917
1918 if ((epoch->main_announcement) &&
1919 (GNUNET_YES != is_epoch_identifier_upper (identifier, &(epoch->
1920 main_announcement
1921 ->identifier))
1922 ))
1923 return;
1924
1925 if ((epoch->main_group) &&
1926 (GNUNET_YES != is_epoch_identifier_upper (identifier, &(epoch->
1927 main_group->
1928 identifier))))
1929 return;
1930
1931 partner_hash = &(event_entry->message->body.group.partner);
1932 init_entry = GNUNET_CONTAINER_multihashmap_get (room->messages,
1933 &(event_entry->message->
1934 body.group.initiator));
1935
1936 if ((! init_entry) || (event_entry->sender != init_entry->sender))
1937 return;
1938
1940 )
1941 return;
1942
1943 event_entry = GNUNET_CONTAINER_multihashmap_get (room->messages,
1944 partner_hash);
1945
1946 if (! event_entry)
1947 return;
1948
1950 kind)
1951 return;
1952
1953 if (! (GNUNET_MESSENGER_FLAG_SENT & event_entry->flags))
1954 return;
1955
1956 {
1957 struct GNUNET_HashCode main_hash;
1958 enum GNUNET_GenericReturnValue has_hash;
1959
1960 if (epoch->main_group)
1961 has_hash = get_epoch_group_member_hash (epoch->main_group, &main_hash,
1962 GNUNET_NO);
1963 else if (epoch->main_announcement)
1964 has_hash = get_epoch_announcement_member_hash (epoch->
1965 main_announcement, &
1966 main_hash, GNUNET_NO);
1967 else
1968 return;
1969
1970 if ((GNUNET_OK != has_hash) ||
1971 (0 != GNUNET_CRYPTO_hash_cmp (&main_hash, partner_hash)))
1972 return;
1973 }
1974
1975 group = get_epoch_group (epoch, identifier, GNUNET_NO);
1976
1977 if (! group)
1978 return;
1979
1980 handle_epoch_group_access (group, entry->message, hash);
1981 break;
1982 }
1983 default:
1984 return;
1985 }
1986}
1987
1988
1989static void
1991 const struct GNUNET_HashCode *hash,
1993{
1994 struct GNUNET_MESSENGER_Epoch *epoch;
1995 const union GNUNET_MESSENGER_EpochNonce *nonce;
1996 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
1997
1998 GNUNET_assert ((room) && (hash) && (entry));
1999
2000 epoch = get_room_availble_epoch_entry (room, hash, entry, entry->sender);
2001
2002 if (! epoch)
2003 return;
2004
2005 nonce = &(entry->message->body.announcement.nonce);
2006
2008 nonce->hash)))
2009 {
2011 "Unsafe revolution: Nonce (%s) has already been used in this epoch! [%s]\n",
2012 GNUNET_sh2s (&(nonce->hash)), GNUNET_h2s (&(epoch->hash)));
2013 return;
2014 }
2015
2016 GNUNET_CONTAINER_multishortmap_put (epoch->nonces, &(nonce->hash), NULL,
2018
2019 identifier = &(entry->message->body.revolution.identifier);
2020
2021 if (identifier->code.group_bit)
2022 {
2023 struct GNUNET_MESSENGER_EpochGroup *group;
2025
2026 group = get_epoch_group (epoch, identifier, GNUNET_YES);
2027
2028 if (! group)
2029 return;
2030
2031 key = get_epoch_group_key (group);
2032
2033 if (! key)
2034 return;
2035
2036 if (GNUNET_OK != verify_message_by_key (entry->message, key))
2037 return;
2038
2039 invalidate_epoch_group (group, NULL);
2040 }
2041 else
2042 {
2043 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
2045
2046 announcement = get_epoch_announcement (epoch, identifier, GNUNET_YES);
2047
2048 if (! announcement)
2049 return;
2050
2051 key = get_epoch_announcement_key (announcement);
2052
2053 if (! key)
2054 return;
2055
2056 if (GNUNET_OK != verify_message_by_key (entry->message, key))
2057 return;
2058
2059 invalidate_epoch_announcement (announcement, NULL);
2060 }
2061}
2062
2063
2064static void
2066 const struct GNUNET_HashCode *hash,
2068{
2069 struct GNUNET_MESSENGER_Epoch *epoch;
2070 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
2071 struct GNUNET_MESSENGER_EpochGroup *group;
2072
2073 GNUNET_assert ((room) && (hash) && (entry));
2074
2075 epoch = get_room_availble_epoch_entry (room, hash, entry, entry->sender);
2076
2077 if (! epoch)
2078 return;
2079
2080 identifier = &(entry->message->body.group.identifier);
2082
2083 if (! (GNUNET_MESSENGER_FLAG_SENT & entry->flags))
2084 return;
2085
2087
2088 set_epoch_group_key (group, NULL, GNUNET_YES);
2089 send_epoch_group_access (group, hash);
2090}
2091
2092
2093static void
2095 const struct GNUNET_HashCode *hash,
2097{
2098 struct GNUNET_MESSENGER_Epoch *epoch;
2099 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
2100 struct GNUNET_MESSENGER_EpochGroup *auth_group;
2101 const struct GNUNET_CRYPTO_SymmetricSessionKey *group_key;
2102 const struct GNUNET_MESSENGER_RoomMessageEntry *event_entry;
2103 struct GNUNET_CRYPTO_SymmetricSessionKey shared_key;
2104
2105 GNUNET_assert ((room) && (hash) && (entry));
2106
2107 epoch = get_room_availble_epoch_entry (room, hash, entry, entry->sender);
2108
2109 if (! epoch)
2110 return;
2111
2112 identifier = &(entry->message->body.authorization.identifier);
2113 auth_group = get_epoch_group (epoch, identifier, GNUNET_NO);
2114
2115 if (! auth_group)
2116 return;
2117
2118 group_key = get_epoch_group_key (auth_group);
2119
2120 if (! group_key)
2121 return;
2122
2123 event_entry = GNUNET_CONTAINER_multihashmap_get (
2124 room->messages, &(entry->message->body.authorization.event));
2125
2126 if (! event_entry)
2127 return;
2128
2129 switch (event_entry->message->header.kind)
2130 {
2132 {
2133 identifier = &(event_entry->message->body.announcement.identifier);
2134
2135 if (0 == GNUNET_memcmp (identifier, &(auth_group->identifier)))
2136 return;
2137
2138 if (identifier->code.group_bit)
2139 {
2140 struct GNUNET_MESSENGER_EpochGroup *group;
2141 uint32_t next_level;
2142
2144 identifier, &(auth_group->identifier)))
2145 return;
2146
2148
2149 if (! group)
2150 return;
2151
2152 next_level = get_epoch_group_level (auth_group) + 1;
2153
2154 if (next_level != get_epoch_group_level (group))
2155 return;
2156
2158 entry->message, group_key, &shared_key))
2159 return;
2160
2161 if (get_epoch_group_key (group))
2162 return;
2163
2166 }
2167 else
2168 {
2169 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
2170
2172
2173 if (! announcement)
2174 return;
2175
2177 entry->message, group_key, &shared_key))
2178 return;
2179
2181 event_entry->message, &shared_key))
2182 return;
2183
2184 if (get_epoch_announcement_key (announcement))
2185 return;
2186
2188 send_epoch_announcement (announcement);
2189 }
2190
2191 break;
2192 }
2194 {
2195 struct GNUNET_MESSENGER_EpochGroup *group;
2196 const struct GNUNET_HashCode *announcement_hash;
2197 uint32_t next_level;
2198
2199 identifier = &(event_entry->message->body.group.identifier);
2200
2201 if ((0 == GNUNET_memcmp (identifier, &(auth_group->identifier))) ||
2202 (GNUNET_YES != is_epoch_identifier_upper (identifier, &(auth_group->
2203 identifier))))
2204 return;
2205
2206 if (! (identifier->code.group_bit))
2207 return;
2208
2209 group = get_epoch_group (epoch, identifier, GNUNET_NO);
2210
2211 if (! group)
2212 return;
2213
2214 next_level = get_epoch_group_level (auth_group) + 1;
2215
2216 if (next_level != get_epoch_group_level (group))
2217 return;
2218
2219 if (event_entry->sender == entry->sender)
2220 announcement_hash = &(event_entry->message->body.group.initiator);
2221 else
2222 announcement_hash = &(event_entry->message->body.group.partner);
2223
2224 event_entry = GNUNET_CONTAINER_multihashmap_get (room->messages,
2225 announcement_hash);
2226
2227 if (! event_entry)
2228 return;
2229
2231 kind)
2232 return;
2233
2234 identifier = &(event_entry->message->body.announcement.identifier);
2235
2236 if (0 != GNUNET_memcmp (identifier, &(auth_group->identifier)))
2237 return;
2238
2240 entry->message, group_key, &shared_key))
2241 return;
2242
2243 if (get_epoch_group_key (group))
2244 return;
2245
2246 set_epoch_group_key (group, &shared_key, GNUNET_YES);
2248 break;
2249 }
2250 default:
2251 break;
2252 }
2253}
2254
2255
2256static void
2258 const struct GNUNET_HashCode *hash,
2260{
2261 GNUNET_assert ((room) && (hash) && (entry));
2262
2263 switch (entry->message->header.kind)
2264 {
2266 handle_join_message (room, hash, entry);
2267 break;
2269 handle_leave_message (room, hash, entry);
2270 break;
2272 handle_name_message (room, hash, entry);
2273 break;
2275 handle_key_message (room, hash, entry);
2276 break;
2278 handle_id_message (room, hash, entry);
2279 break;
2281 handle_miss_message (room, hash, entry);
2282 break;
2284 handle_merge_message (room, hash, entry);
2285 break;
2287 handle_private_message (room, hash, entry);
2288 break;
2290 handle_delete_message (room, hash, entry);
2291 break;
2293 handle_transcript_message (room, hash, entry);
2294 break;
2296 handle_announcement_message (room, hash, entry);
2297 break;
2299 handle_secret_message (room, hash, entry);
2300 break;
2302 handle_appeal_message (room, hash, entry);
2303 break;
2305 handle_access_message (room, hash, entry);
2306 break;
2308 handle_revolution_message (room, hash, entry);
2309 break;
2311 handle_group_message (room, hash, entry);
2312 break;
2314 handle_authorization_message (room, hash, entry);
2315 break;
2316 default:
2317 break;
2318 }
2319
2320 if (GNUNET_YES == is_epoch_message (entry->message))
2321 {
2322 struct GNUNET_MESSENGER_Epoch *epoch;
2323
2324 epoch = get_room_epoch (room, &(entry->epoch), GNUNET_NO);
2325
2326 if ((! epoch) || (get_epoch_size (epoch)))
2327 return;
2328
2329 reset_epoch_size (epoch);
2330 }
2331
2334}
2335
2336
2337void
2339 struct GNUNET_MESSENGER_Contact *sender,
2340 const struct GNUNET_MESSENGER_Message *message,
2341 const struct GNUNET_HashCode *hash,
2342 const struct GNUNET_HashCode *epoch,
2344{
2346
2347 GNUNET_assert ((room) && (message) && (hash));
2348
2349 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
2350
2351 if (entry)
2352 goto update_entry;
2353
2355
2356 if (! entry)
2357 return;
2358
2359 entry->sender = NULL;
2360 entry->recipient = NULL;
2361
2362 entry->message = NULL;
2363
2364 GNUNET_memcpy (&(entry->epoch), epoch, sizeof (entry->epoch));
2365
2367 entry->completed = GNUNET_NO;
2368
2370 room->messages, hash, entry,
2372 {
2373 GNUNET_free (entry);
2374 return;
2375 }
2376
2377update_entry:
2378 entry->sender = sender;
2379 entry->flags = flags;
2380
2381 if (entry->message)
2382 {
2385
2387 }
2388 else
2389 entry->message = copy_message (message);
2390
2391 entry->completed = GNUNET_YES;
2392 handle_message (room, hash, entry);
2393}
2394
2395
2398 const struct GNUNET_HashCode *hash)
2399{
2401
2402 GNUNET_assert ((room) && (hash));
2403
2404 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
2405
2406 if ((! entry) || (! entry->message))
2407 return GNUNET_SYSERR;
2408
2410 return GNUNET_NO;
2411
2413 handle_message (room, hash, entry);
2414 return GNUNET_YES;
2415}
2416
2417
2420 const struct GNUNET_HashCode *hash,
2422 enum GNUNET_GenericReturnValue update)
2423{
2425 struct GNUNET_MESSENGER_Message *secret_message;
2426
2427 GNUNET_assert ((room) && (hash) && (key));
2428
2429 entry = GNUNET_CONTAINER_multihashmap_get (room->messages, hash);
2430
2431 if ((! entry) || (! entry->message) ||
2433 return GNUNET_SYSERR;
2434
2435 secret_message = copy_message (entry->message);
2436
2437 if (! secret_message)
2438 return GNUNET_NO;
2439
2440 if (GNUNET_YES != decrypt_secret_message (secret_message, key))
2441 {
2442 destroy_message (secret_message);
2443 secret_message = NULL;
2444 }
2445
2446 if (! secret_message)
2447 return GNUNET_NO;
2448
2449 destroy_message (entry->message);
2450
2451 entry->message = secret_message;
2453
2454 if (GNUNET_YES == update)
2456
2457 if (entry->sender)
2458 handle_message (room, hash, entry);
2459
2460 return GNUNET_YES;
2461}
2462
2463
2464void
2466 const struct GNUNET_HashCode *hash,
2467 const struct GNUNET_HashCode *epoch)
2468{
2469 GNUNET_assert ((room) && (hash) && (epoch));
2470
2471 GNUNET_memcpy (&(room->last_message), hash, sizeof(room->last_message));
2472
2473 if (epoch)
2474 GNUNET_memcpy (&(room->last_epoch), epoch, sizeof(room->last_epoch));
2475}
2476
2477
2478void
2480 struct GNUNET_HashCode *hash)
2481{
2482 GNUNET_assert (room);
2483
2484 GNUNET_memcpy (hash, &(room->last_message), sizeof(room->last_message));
2485}
2486
2487
2494
2495static enum GNUNET_GenericReturnValue
2497 const struct GNUNET_ShortHashCode *key,
2498 void *value)
2499{
2501 struct GNUNET_MESSENGER_Contact *contact;
2502
2503 GNUNET_assert ((cls) && (value));
2504
2505 call = cls;
2506 contact = value;
2507
2508 return call->callback (call->cls, call->room, contact);
2509}
2510
2511
2512int
2515 void *cls)
2516{
2518
2520
2521 if (! callback)
2523
2524 call.room = room;
2525 call.callback = callback;
2526 call.cls = cls;
2527
2529
2532 &call);
2533}
2534
2535
2541
2542static enum GNUNET_GenericReturnValue
2544 const struct GNUNET_ShortHashCode *key,
2545 void *value)
2546{
2547 struct GNUNET_MESSENGER_MemberFind *find;
2548 struct GNUNET_MESSENGER_Contact *contact;
2549
2550 GNUNET_assert ((cls) && (value));
2551
2552 find = cls;
2553 contact = value;
2554
2555 if (contact == find->contact)
2556 {
2557 find->result = GNUNET_YES;
2558 return GNUNET_NO;
2559 }
2560
2561 return GNUNET_YES;
2562}
2563
2564
2567 const struct GNUNET_MESSENGER_Contact *contact)
2568{
2569 struct GNUNET_MESSENGER_MemberFind find;
2570
2571 GNUNET_assert (room);
2572
2573 find.contact = contact;
2574 find.result = GNUNET_NO;
2575
2577 room->members, iterate_find_member, &find);
2578
2579 return find.result;
2580}
2581
2582
2583static enum GNUNET_GenericReturnValue
2585 const struct GNUNET_HashCode *key,
2586 void *value)
2587{
2588 const struct GNUNET_HashCode **result;
2589 struct GNUNET_HashCode *hash;
2590
2591 GNUNET_assert ((cls) && (value));
2592
2593 result = cls;
2594 hash = value;
2595
2596 if (0 == GNUNET_CRYPTO_hash_cmp (hash, *result))
2597 {
2598 *result = NULL;
2599 return GNUNET_NO;
2600 }
2601
2602 return GNUNET_YES;
2603}
2604
2605
2606void
2608 const struct GNUNET_HashCode *hash,
2609 const struct GNUNET_HashCode *other)
2610{
2611 const struct GNUNET_HashCode **result;
2612 struct GNUNET_HashCode *value;
2613
2614 GNUNET_assert ((room) && (hash) && (other));
2615
2616 result = &other;
2619
2620 if (! *result)
2621 return;
2622
2623 value = GNUNET_memdup (other, sizeof(struct GNUNET_HashCode));
2624 if (! value)
2625 return;
2626
2628 room->links, hash, value,
2631}
2632
2633
2640
2641
2642static enum GNUNET_GenericReturnValue
2644 const struct GNUNET_HashCode *key,
2645 void *value)
2646{
2647 struct GNUNET_HashCode **linked;
2648 struct GNUNET_HashCode *hash;
2649
2650 GNUNET_assert ((cls) && (value));
2651
2652 linked = cls;
2653 hash = value;
2654
2655 if (0 != GNUNET_CRYPTO_hash_cmp (*linked, hash))
2656 return GNUNET_YES;
2657
2658 *linked = hash;
2659 return GNUNET_NO;
2660}
2661
2662
2663static enum GNUNET_GenericReturnValue
2665 const struct GNUNET_HashCode *key,
2666 void *value)
2667{
2669 struct GNUNET_HashCode *hash;
2670 struct GNUNET_HashCode key_value;
2671 struct GNUNET_HashCode *linked;
2672
2673 GNUNET_assert ((cls) && (key) && (value));
2674
2675 info = cls;
2676 hash = value;
2677
2678 GNUNET_memcpy (&key_value, key, sizeof (key_value));
2679
2680 linked = &key_value;
2682 clear_linked_hash, &linked);
2683
2684 if ((linked != &key_value) &&
2686 hash, linked)))
2687 GNUNET_free (linked);
2688
2689 if (info->deletion)
2690 info->deletion (info->room, hash, info->delay);
2691
2692 GNUNET_free (hash);
2693 return GNUNET_YES;
2694}
2695
2696
2697void
2699 const struct GNUNET_HashCode *hash,
2700 const struct GNUNET_TIME_Relative delay,
2702{
2704
2705 GNUNET_assert ((room) && (hash));
2706
2707 info.room = room;
2708 info.delay = delay;
2709 info.deletion = deletion;
2710
2714}
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition gnunet-arm.c:118
static struct GNUNET_CONVERSATION_Call * call
Call handle (for active outgoing call).
struct GNUNET_HashCode key
The key used in the DHT.
static pa_context * context
Pulseaudio context.
static char * value
Value of the record to add/remove.
static int result
Global testing status.
#define info
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition gnunet-vpn.c:35
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
GNUNET_ErrorCode
Taler error codes.
@ GNUNET_EC_NONE
No error (success).
API that can be used to store naming information on a GNUnet node;.
API to schedule computations using continuation passing style.
Functions related to time.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_before(head, tail, other, element)
Insert an element into a DLL before the given other element.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
int GNUNET_CRYPTO_hash_cmp(const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2)
Compare function for HashCodes, producing a total ordering of all hashcodes.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_contains(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
int GNUNET_CONTAINER_multihashmap_remove_all(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Remove all entries for the given key from the map.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
struct GNUNET_CONTAINER_MultiShortmap * GNUNET_CONTAINER_multishortmap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multishortmap_put(struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
int GNUNET_CONTAINER_multishortmap_iterate(struct GNUNET_CONTAINER_MultiShortmap *map, GNUNET_CONTAINER_ShortmapIterator it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
int GNUNET_CONTAINER_multishortmap_contains_value(const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, const void *value)
Check if the map contains the given value under the given key.
void GNUNET_CONTAINER_multishortmap_destroy(struct GNUNET_CONTAINER_MultiShortmap *map)
Destroy a hash map.
unsigned int GNUNET_CONTAINER_multihashmap_clear(struct GNUNET_CONTAINER_MultiHashMap *map)
Remove all entries from the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_get_multiple(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
int GNUNET_CONTAINER_multishortmap_remove(struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, const void *value)
Remove the given key-value pair from the map.
int GNUNET_CONTAINER_multishortmap_contains(const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE...
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE
If a value with the given key exists, replace it.
#define GNUNET_is_zero(a)
Check that memory in a is all zeros.
#define GNUNET_log(kind,...)
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_sk_create(enum GNUNET_CRYPTO_HpkeKeyType type, struct GNUNET_CRYPTO_HpkePrivateKey *pk)
Create a new GNUNET_CRYPTO_HpkePrivateKey of specific type.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_sk_get_public(const struct GNUNET_CRYPTO_HpkePrivateKey *privkey, struct GNUNET_CRYPTO_HpkePublicKey *key)
Retrieves the GNUNET_CRYPTO_HpkePublicKey representation of a GNUNET_CRYPTO_HpkePrivateKey.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
void GNUNET_CRYPTO_hpke_sk_clear(struct GNUNET_CRYPTO_HpkePrivateKey *key)
Clear memory that was used to store a GNUNET_CRYPTO_HpkePrivateKey.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
#define GNUNET_memcmp_priv(a, b)
Compare memory in a and b in constant time, suitable for private data.
@ GNUNET_SCHEDULER_PRIORITY_HIGH
Run with high priority (important requests).
@ GNUNET_SCHEDULER_PRIORITY_BACKGROUND
Run as background job (higher than idle, lower than default).
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
@ GNUNET_CRYPTO_HPKE_KEY_TYPE_X25519
Type for X25519 hybrid public key encryption.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
const char * GNUNET_sh2s(const struct GNUNET_ShortHashCode *shc)
Convert a short hash value to a string (for printing debug messages).
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_memdup(buf, size)
Allocate and initialize a block of memory.
GNUNET_MESSENGER_MessageKind
Enum for the different supported kinds of messages.
GNUNET_MESSENGER_MessageFlags
Enum for the different supported flags used by message handling.
enum GNUNET_GenericReturnValue(* GNUNET_MESSENGER_MemberCallback)(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
Method called for each member in a room during iteration.
@ GNUNET_MESSENGER_KIND_MISS
The miss kind.
@ GNUNET_MESSENGER_KIND_AUTHORIZATION
The authorization kind.
@ GNUNET_MESSENGER_KIND_ANNOUNCEMENT
The announcement kind.
@ GNUNET_MESSENGER_KIND_PRIVATE
The private kind.
@ GNUNET_MESSENGER_KIND_APPEAL
The appeal kind.
@ GNUNET_MESSENGER_KIND_NAME
The name kind.
@ GNUNET_MESSENGER_KIND_ACCESS
The access kind.
@ GNUNET_MESSENGER_KIND_LEAVE
The leave kind.
@ GNUNET_MESSENGER_KIND_REVOLUTION
The revolution kind.
@ GNUNET_MESSENGER_KIND_TRANSCRIPT
The transcript kind.
@ GNUNET_MESSENGER_KIND_KEY
The key kind.
@ GNUNET_MESSENGER_KIND_SECRET
The secret kind.
@ GNUNET_MESSENGER_KIND_JOIN
The join kind.
@ GNUNET_MESSENGER_KIND_DELETION
The deletion kind.
@ GNUNET_MESSENGER_KIND_MERGE
The merge kind.
@ GNUNET_MESSENGER_KIND_GROUP
The group kind.
@ GNUNET_MESSENGER_KIND_ID
The id kind.
@ GNUNET_MESSENGER_FLAG_SECRET
The secret flag.
@ GNUNET_MESSENGER_FLAG_PRIVATE
The private flag.
@ GNUNET_MESSENGER_FLAG_SENT
The sent flag.
@ GNUNET_MESSENGER_FLAG_UPDATE
The update flag.
@ GNUNET_MESSENGER_FLAG_NONE
The none flag.
@ GNUNET_MESSENGER_FLAG_DELETE
The delete flag.
@ GNUNET_MESSENGER_FLAG_RECENT
The recent flag.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition scheduler.c:986
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed_with_priority(struct GNUNET_TIME_Relative delay, enum GNUNET_SCHEDULER_Priority priority, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition scheduler.c:1213
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_with_priority(enum GNUNET_SCHEDULER_Priority prio, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified priority.
Definition scheduler.c:1237
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_zero_(void)
Return relative time of 0ms.
Definition time.c:133
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_millisecond_(void)
Return relative time of 1ms.
Definition time.c:160
bool GNUNET_TIME_relative_is_zero(struct GNUNET_TIME_Relative rel)
Test if rel is zero.
Definition time.c:660
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply_double(struct GNUNET_TIME_Relative rel, double factor)
Multiply relative time by a given factor.
Definition time.c:506
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition time.c:486
void enqueue_message_to_room(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *epoch, struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_Message *transcript, enum GNUNET_GenericReturnValue sync)
Enqueus a message and its optional transcript for sending it to a given room and epoch.
void request_message_from_room(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Requests a specific message from a given room which can be identified by its hash.
enum GNUNET_GenericReturnValue decrease_contact_rc(struct GNUNET_MESSENGER_Contact *contact)
Decreases the reference counter if possible (can not underflow!) of a given contact and returns GNUNE...
void set_contact_name(struct GNUNET_MESSENGER_Contact *contact, const char *name)
Changes the current name of a given contact by copying it from the parameter name.
void increase_contact_rc(struct GNUNET_MESSENGER_Contact *contact)
Increases the reference counter of a given contact which is zero as default.
const struct GNUNET_CRYPTO_BlindablePublicKey * get_contact_key(const struct GNUNET_MESSENGER_Contact *contact)
Returns the blindable public key of a given contact.
void set_contact_encryption_key(struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_HashCode *key, const struct GNUNET_CRYPTO_HpkePublicKey *encryption_key)
Sets or replaces the encryption_key of a given contact for a specified room that is identified via it...
void get_context_from_member(const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, struct GNUNET_HashCode *context)
Calculates the context hash of a member in a room and returns it.
struct GNUNET_MESSENGER_Contact * get_store_contact(struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, const struct GNUNET_CRYPTO_BlindablePublicKey *pubkey)
Returns a contact using a specific public key.
void update_store_contact(struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *next_context, const struct GNUNET_CRYPTO_BlindablePublicKey *pubkey)
Moves a contact from the store to another location matching a given public key and member context.
void invalidate_epoch_keys_by_member(struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact)
Invalidates all announced epoch and group keys by a specific contact inside a given epoch.
uint32_t get_epoch_size(const struct GNUNET_MESSENGER_Epoch *epoch)
Returns the amount of members by a given epoch or zero as long as it's not fully initialized yet.
struct GNUNET_MESSENGER_Epoch * create_new_epoch(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Creates and allocates a new epoch in a given room which can be identified by a specific hash.
struct GNUNET_MESSENGER_Epoch * create_epoch(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Creates and allocates an epoch in a given room which can be identified by a specific hash.
struct GNUNET_MESSENGER_EpochGroup * get_epoch_group(struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid)
Returns the epoch group of a given epoch using a specific unique identifier or NULL.
enum GNUNET_GenericReturnValue delay_epoch_message_for_its_members(struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_HashCode *hash)
Adds a message with a given hash to a list that can be delayed in processing for the members of a spe...
enum GNUNET_GenericReturnValue is_epoch_member(const struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact)
Returns whether a specific contact is member of a given epoch.
void set_epoch_proposal_group(struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_HashCode *hash)
Sets the current group of proposal for a given epoch to the group specified by a message identified b...
void destroy_epoch(struct GNUNET_MESSENGER_Epoch *epoch)
Destroys an epoch and frees its memory fully from the client API.
struct GNUNET_MESSENGER_EpochAnnouncement * get_epoch_announcement(struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid)
Returns the epoch announcement of a given epoch using a specific unique identifier or NULL.
void reset_epoch_size(struct GNUNET_MESSENGER_Epoch *epoch)
Resets the amount of members by a given epoch to recalculate the exact amount.
double get_epoch_position_factor(const struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_MESSENGER_EpochMembership *membership)
Returns a relative member position of a specific contact inside a given epoch in relation to its list...
enum GNUNET_GenericReturnValue send_epoch_announcement_access(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *event)
Tries to send an access message by the client responding to a previous event in regards to a given ep...
enum GNUNET_GenericReturnValue send_epoch_announcement(struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Tries to send an announcement message by the client for a given epoch announcement using its secret k...
enum GNUNET_GenericReturnValue get_epoch_announcement_member_hash(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue other)
Provides an announcement hash of a member from a given epoch announcement.
void set_epoch_announcement_appeal(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, struct GNUNET_TIME_Relative timeout)
Sets a specified timeout for a given epoch announcement of the client for its own appeal of the annou...
struct GNUNET_MESSENGER_EpochAnnouncement * create_epoch_announcement(struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid)
Creates and allocates a new epoch announcement for a given epoch using a specific announcement identi...
const struct GNUNET_CRYPTO_SymmetricSessionKey * get_epoch_announcement_key(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Returns the secret key of a given epoch announcement or NULL.
void set_epoch_announcement_key(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, enum GNUNET_GenericReturnValue write_record)
Sets the secret key of a given epoch announcement to a shared key.
enum GNUNET_GenericReturnValue revoke_epoch_announcement_member(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_Contact *contact)
Revokes an announcement message with its hash from a given epoch announcement removing the caused con...
void destroy_epoch_announcement(struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Destroys a given epoch announcement and frees its resources.
enum GNUNET_GenericReturnValue is_epoch_announcement_member(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Contact *contact)
Returns whether a specific contact is confirmed member of a given epoch announcement.
void handle_epoch_announcement(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *sender, enum GNUNET_GenericReturnValue sent)
Handles an announcement message with hash from its sender inside a given epoch announcement as first ...
void invalidate_epoch_announcement(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Contact *contact)
Invalidates a given epoch announcement by a specific contact.
void handle_epoch_announcement_access(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles an access message with hash from its sender inside a given epoch announcement.
void handle_epoch_announcement_message(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles an encrypted message with hash by a given epoch announcement using its secret key for decrypt...
void handle_epoch_announcement_delay(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *sender, enum GNUNET_GenericReturnValue sent)
Handles an announcement message with hash from its sender inside a given epoch announcement as second...
enum GNUNET_GenericReturnValue send_epoch_group_announcement(struct GNUNET_MESSENGER_EpochGroup *group)
Tries to send an announcement message by the client for a given epoch group using its secret key.
void handle_epoch_group_announcement_delay(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *sender, enum GNUNET_GenericReturnValue sent)
Handles an announcement message with hash from its sender inside a given epoch group as second stage ...
void invalidate_epoch_group(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_Contact *contact)
Invalidates a given epoch group by a specific contact.
void handle_epoch_group_access(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Handles an access message with hash from its sender inside a given epoch group.
enum GNUNET_GenericReturnValue send_epoch_group_access(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_HashCode *event)
Tries to send an access message by the client responding to a previous event in regards to a given ep...
uint32_t get_epoch_group_level(const struct GNUNET_MESSENGER_EpochGroup *group)
Returns the group level of a given epoch group.
void set_epoch_group_key(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, enum GNUNET_GenericReturnValue write_record)
Sets the secret key of a given epoch group to a shared key.
void handle_epoch_group_announcement(struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *sender, enum GNUNET_GenericReturnValue sent)
Handles an announcement message with hash from its sender inside a given epoch group as first stage.
const struct GNUNET_CRYPTO_SymmetricSessionKey * get_epoch_group_key(const struct GNUNET_MESSENGER_EpochGroup *group)
Returns the secret key of a given epoch group or NULL.
enum GNUNET_GenericReturnValue get_epoch_group_member_hash(const struct GNUNET_MESSENGER_EpochGroup *group, struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue other)
Provides an announcement hash of a member from a given epoch group.
struct GNUNET_MESSENGER_ContactStore * get_handle_contact_store(struct GNUNET_MESSENGER_Handle *handle)
Returns the used contact store of a given handle.
struct GNUNET_MESSENGER_Contact * get_handle_contact(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Returns the contact of a given handle in a room identified by a given key.
const struct GNUNET_CRYPTO_BlindablePublicKey * get_handle_pubkey(const struct GNUNET_MESSENGER_Handle *handle)
Returns the public key of a given handle.
const char * get_handle_name(const struct GNUNET_MESSENGER_Handle *handle)
Returns the current name of a given handle or NULL if no valid name was assigned yet.
enum GNUNET_GenericReturnValue store_handle_encryption_key(const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key, const struct GNUNET_CRYPTO_HpkePrivateKey *encryption_key, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls, struct GNUNET_NAMESTORE_QueueEntry **query)
Stores an encryption_key for a given room from a handle identified by its key/i>.
void init_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels)
Initializes list of tunnels peer identities as empty list.
struct GNUNET_MESSENGER_ListTunnel * find_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index)
Searches linearly through the list of tunnels peer identities for matching a specific peer identity a...
void clear_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels)
Clears the list of tunnels peer identities.
struct GNUNET_MESSENGER_ListTunnel * remove_from_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element)
Removes a specific element from the list of tunnels peer identities and returns the next element in t...
struct GNUNET_TIME_Relative get_message_timeout(const struct GNUNET_MESSENGER_Message *message)
Return the relative timeout of the content from a given message that controls when a delayed handling...
enum GNUNET_GenericReturnValue verify_message_by_key(const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
Verifies the hmac of a given message body with a specific shared key.
struct GNUNET_MESSENGER_Message * copy_message(const struct GNUNET_MESSENGER_Message *message)
Creates and allocates a copy of a given message.
enum GNUNET_GenericReturnValue extract_authorization_message_key(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_SymmetricSessionKey *key, struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key)
Extracts the shared epoch or group key from an authorization message using a previously exchanged sha...
enum GNUNET_GenericReturnValue decrypt_message(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_HpkePrivateKey *hpke_key)
Decrypts a private message using a given private key and replaces its body and kind with the inner en...
enum GNUNET_GenericReturnValue is_epoch_message(const struct GNUNET_MESSENGER_Message *message)
Returns whether a certain kind of message from storage contains some specific details that might be r...
enum GNUNET_GenericReturnValue decrypt_secret_message(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
Decrypts a secret message using a given shared key and replaces its body and kind with the inner encr...
void copy_message_header(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_MESSENGER_MessageHeader *header)
Copy message header details from another message to a given message.
void destroy_message(struct GNUNET_MESSENGER_Message *message)
Destroys a message and frees its memory fully.
enum GNUNET_GenericReturnValue read_transcript_message(struct GNUNET_MESSENGER_Message *message)
Read the original message from a transcript message and replaces its body and kind with the inner enc...
struct GNUNET_MESSENGER_MessageControl * create_message_control(struct GNUNET_MESSENGER_Room *room)
Creates and allocates a new message control for a room of the client API.
void destroy_message_control(struct GNUNET_MESSENGER_MessageControl *control)
Destroys a message control and frees its memory fully from the client API.
struct GNUNET_MESSENGER_Message * create_message_deletion(const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
Creates and allocates a new deletion message containing the hash of a message to delete after a speci...
void init_queue_messages(struct GNUNET_MESSENGER_QueueMessages *messages)
Initializes queue of messages as empty queue.
void clear_queue_messages(struct GNUNET_MESSENGER_QueueMessages *messages)
Clears the queue of messages.
static enum GNUNET_GenericReturnValue is_epoch_identifier_upper(const union GNUNET_MESSENGER_EpochIdentifier *identifier, const union GNUNET_MESSENGER_EpochIdentifier *other)
static void handle_name_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static enum GNUNET_GenericReturnValue iterate_room_request(void *cls, const struct GNUNET_HashCode *key, void *value)
enum GNUNET_GenericReturnValue find_room_member(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
Checks through all members of a given room if a specific contact is found and returns a result depend...
struct GNUNET_MESSENGER_Epoch * get_room_message_epoch(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns the epoch of a local message with a given hash in a room.
static void clear_room_encryption_keys(struct GNUNET_MESSENGER_RoomEncryptionKey *head, struct GNUNET_MESSENGER_RoomEncryptionKey *tail)
void generate_room_epoch_announcement(struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Epoch *epoch, struct GNUNET_MESSENGER_EpochAnnouncement **announcement)
Generate a new announcement for a given epoch in a room under a random and unique announcement identi...
struct GNUNET_MESSENGER_Room * create_room(struct GNUNET_MESSENGER_Handle *handle, const union GNUNET_MESSENGER_RoomKey *key)
Creates and allocates a new room for a handle with a given key for the client API.
void copy_room_last_message(const struct GNUNET_MESSENGER_Room *room, struct GNUNET_HashCode *hash)
Copies the last message hash of a room into a given hash variable.
static enum GNUNET_GenericReturnValue iterate_destroy_epoch(void *cls, const struct GNUNET_HashCode *key, void *value)
static enum GNUNET_GenericReturnValue delete_linked_hash(void *cls, const struct GNUNET_HashCode *key, void *value)
void cancel_room_actions_by(struct GNUNET_MESSENGER_Room *room, enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_HashCode *epoch_hash, const union GNUNET_MESSENGER_EpochIdentifier *identifier, const struct GNUNET_MESSENGER_Contact *contact)
Searches queued actions to handle messages of a specific message kind in a room with any delay and ca...
static void handle_appeal_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_authorization_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_id_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
struct GNUNET_MESSENGER_Contact * get_room_sender(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns a messages sender locally stored from a map for a given hash in a room.
void set_room_sender_id(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_ShortHashCode *id)
Sets the member id of the room's sender to a specific id or NULL.
const struct GNUNET_CRYPTO_HpkePublicKey * get_room_encryption_key(const struct GNUNET_MESSENGER_Room *room)
Returns the latest encryption key stored in memory by the current user for a given room.
void handle_room_message(struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, const struct GNUNET_HashCode *epoch, enum GNUNET_MESSENGER_MessageFlags flags)
Handles a message with a given hash in a room for the client API to update members and its informatio...
void link_room_deletion(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay, GNUNET_MESSENGER_RoomLinkDeletion deletion)
Delete all remaining links to a certain message identified by its hash inside a given room and cause ...
void cancel_room_action(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Cancels the delayed handling of a message in a room under a given hash in case it has been queued usi...
enum GNUNET_GenericReturnValue is_room_message_sent(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns whether a message is sent by the handle of the given room itself or another client that is us...
const struct GNUNET_MESSENGER_Message * get_room_message(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns a message locally stored from a map for a given hash in a room.
static void handle_secret_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
struct GNUNET_MESSENGER_Epoch * get_room_epoch(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue recent)
Returns the epoch in a given room from a specific epoch hash that represents the exact message the ep...
enum GNUNET_GenericReturnValue update_room_secret_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_SymmetricSessionKey *key, enum GNUNET_GenericReturnValue update)
Updates a secret message with a given hash in a room for the client API trying to decrypt it with the...
static enum GNUNET_GenericReturnValue iterate_destroy_subscription(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
static enum GNUNET_GenericReturnValue iterate_cancel_action_by(void *cls, const struct GNUNET_HashCode *hash, void *value)
static void handle_announcement_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
enum GNUNET_GenericReturnValue update_room_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Updates any message with a given hash in a room for the client API to force handling the message agai...
static void handle_access_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_private_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_room_request_task(void *cls)
enum GNUNET_GenericReturnValue is_room_public(const struct GNUNET_MESSENGER_Room *room)
Returns whether a given room is public or using epoch keys to encrypt private traffic and sync those ...
static void handle_group_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
enum GNUNET_GenericReturnValue add_room_encryption_key(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_CRYPTO_HpkePrivateKey *key)
Adds an encryption key by the current user to memory of a given room and will be placed to the second...
static enum GNUNET_GenericReturnValue iterate_destroy_action(void *cls, const struct GNUNET_HashCode *key, void *value)
static enum GNUNET_GenericReturnValue iterate_find_member(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
static void handle_room_delayed_announcement(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry)
void delete_room_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
Deletes a message with a given hash inside a room under a specific delay.
void update_room_last_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_HashCode *epoch)
Updates the last message hash and its epoch of a room for the client API so that new messages can poi...
static struct GNUNET_MESSENGER_Epoch * get_room_availble_epoch_entry(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry, const struct GNUNET_MESSENGER_Contact *contact)
static void handle_revolution_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
enum GNUNET_GenericReturnValue is_room_available(const struct GNUNET_MESSENGER_Room *room)
Checks whether a room is available to send messages.
void callback_room_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Executes the message callback for a given hash in a room.
const union GNUNET_MESSENGER_EpochIdentifier * get_room_message_epoch_identifier(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns the epoch identifier a local message with a given hash is targeting in a room with its specif...
static void handle_join_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_room_action_task(void *cls)
static void handle_leave_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_miss_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_transcript_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static enum GNUNET_GenericReturnValue iterate_destroy_link(void *cls, const struct GNUNET_HashCode *key, void *value)
static enum GNUNET_GenericReturnValue is_message_entry_recent(const struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_key_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static enum GNUNET_GenericReturnValue iterate_room_epoch_member_invalidation(void *cls, const struct GNUNET_HashCode *key, void *value)
static void handle_delete_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
const struct GNUNET_HashCode * get_room_key(const struct GNUNET_MESSENGER_Room *room)
Return a the hash representation of a given room.
static enum GNUNET_GenericReturnValue iterate_cancel_action(void *cls, const struct GNUNET_HashCode *hash, void *value)
static enum GNUNET_GenericReturnValue iterate_destroy_message(void *cls, const struct GNUNET_HashCode *key, void *value)
struct GNUNET_MESSENGER_Handle * get_room_handle(struct GNUNET_MESSENGER_Room *room)
Returns the messenger handle of the room.
static void handle_room_delayed_appeal(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry)
const struct GNUNET_ShortHashCode * get_room_sender_id(const struct GNUNET_MESSENGER_Room *room)
Returns the member id of the room's sender.
static void handle_room_delayed_deletion(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static void handle_room_delayed_action(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
static void handle_merge_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_RoomMessageEntry *entry)
static enum GNUNET_GenericReturnValue clear_linked_hash(void *cls, const struct GNUNET_HashCode *key, void *value)
static void cont_write_encryption_key_record(void *cls, enum GNUNET_ErrorCode ec)
static enum GNUNET_GenericReturnValue iterate_local_members(void *cls, const struct GNUNET_ShortHashCode *key, void *value)
void link_room_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_HashCode *other)
Links a message identified by its hash inside a given room with another message identified by its oth...
const struct GNUNET_HashCode * get_room_epoch_hash(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns the messages epoch hash that is locally stored for a message of a given hash in a room.
void delay_room_action(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
Enqueues delayed handling of a message in a room under a given hash once a specific delay has timed o...
int iterate_room_members(struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls)
Iterates through all members of a given room to forward each of them to a selected callback with a cu...
void destroy_room(struct GNUNET_MESSENGER_Room *room)
Destroys a room and frees its memory fully from the client API.
static enum GNUNET_GenericReturnValue find_linked_hash(void *cls, const struct GNUNET_HashCode *key, void *value)
struct GNUNET_MESSENGER_Contact * get_room_recipient(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns a messages recipient locally stored from a map for a given hash in a room.
void require_message_from_room(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Requires a specific message in a given room which can be identified by its hash.
void(* GNUNET_MESSENGER_RoomLinkDeletion)(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
Internal representation of the hash map.
A public key used for decryption.
A public key used for encryption.
A 512-bit hashcode.
struct GNUNET_CRYPTO_SymmetricSessionKey * shared_key
union GNUNET_MESSENGER_EpochIdentifier identifier
struct GNUNET_CRYPTO_SymmetricSessionKey * shared_key
struct GNUNET_MESSENGER_Epoch * epoch
union GNUNET_MESSENGER_EpochIdentifier identifier
struct GNUNET_MESSENGER_Room * room
struct GNUNET_CONTAINER_MultiShortmap * announcements
struct GNUNET_MESSENGER_EpochGroup * main_group
struct GNUNET_CONTAINER_MultiShortmap * nonces
struct GNUNET_MESSENGER_EpochAnnouncement * main_announcement
struct GNUNET_HashCode hash
struct GNUNET_MESSENGER_ListTunnel * head
GNUNET_MESSENGER_MemberCallback callback
struct GNUNET_MESSENGER_Room * room
const struct GNUNET_MESSENGER_Contact * contact
enum GNUNET_GenericReturnValue result
struct GNUNET_HashCode event
The hash of the linked announcement or group message event.
union GNUNET_MESSENGER_EpochNonce nonce
The nonce of the announcement.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
struct GNUNET_HashCode event
The hash of the linked announcement message event.
struct GNUNET_HashCode event
The hash of the linked group message event.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
struct GNUNET_MESSENGER_MessageAnnouncement announcement
struct GNUNET_MESSENGER_MessageGroup group
struct GNUNET_MESSENGER_MessageSecret secret
struct GNUNET_MESSENGER_MessageDeletion deletion
struct GNUNET_MESSENGER_MessageMerge merge
struct GNUNET_MESSENGER_MessageId id
struct GNUNET_MESSENGER_MessageName name
struct GNUNET_MESSENGER_MessageLeave leave
struct GNUNET_MESSENGER_MessageTranscript transcript
struct GNUNET_MESSENGER_MessageRevolution revolution
struct GNUNET_MESSENGER_MessageKey key
struct GNUNET_MESSENGER_MessageAccess access
struct GNUNET_MESSENGER_MessageAuthorization authorization
struct GNUNET_MESSENGER_MessageAppeal appeal
struct GNUNET_MESSENGER_MessageMiss miss
struct GNUNET_MESSENGER_MessageJoin join
struct GNUNET_HashCode hash
The hash of the message to delete.
struct GNUNET_HashCode initiator
The hash of the initiator group announcement.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
struct GNUNET_HashCode partner
The hash of the partner group announcement.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.
struct GNUNET_ShortHashCode sender_id
The senders id inside of the room the message was sent in.
struct GNUNET_ShortHashCode id
The new id which will replace the senders id in a room.
struct GNUNET_CRYPTO_BlindablePublicKey key
The senders blindable public key to verify its signatures.
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
struct GNUNET_CRYPTO_HpkePublicKey hpke_key
The senders HPKE public key to encrypt private messages with.
struct GNUNET_CRYPTO_BlindablePublicKey key
The new blindable public key which replaces the current senders public key.
struct GNUNET_CRYPTO_HpkePublicKey hpke_key
The new HPKE public key which replaces the current senders HPKE public key.
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
struct GNUNET_HashCode epochs[2]
The previous epochs the message was sent from.
struct GNUNET_PeerIdentity peer
The peer identity of a disconnected door to a room.
char * name
The new name which replaces the current senders name.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
struct GNUNET_HashCode hash
The hash of the original message.
struct GNUNET_CRYPTO_BlindablePublicKey key
The key from the recipient of the original message.
struct GNUNET_MESSENGER_MessageHeader header
Header.
struct GNUNET_MESSENGER_MessageBody body
Body.
struct GNUNET_HashCode hash
struct GNUNET_MESSENGER_Room * room
const struct GNUNET_HashCode * epoch_hash
const struct GNUNET_MESSENGER_Contact * contact
enum GNUNET_MESSENGER_MessageKind kind
const union GNUNET_MESSENGER_EpochIdentifier * identifier
struct GNUNET_CONTAINER_MultiHashMap * map
struct GNUNET_NAMESTORE_QueueEntry * query
struct GNUNET_CRYPTO_HpkePrivateKey key
struct GNUNET_MESSENGER_RoomEncryptionKey * prev
struct GNUNET_MESSENGER_RoomEncryptionKey * next
struct GNUNET_MESSENGER_Room * room
GNUNET_MESSENGER_RoomLinkDeletion deletion
struct GNUNET_MESSENGER_Contact * recipient
enum GNUNET_MESSENGER_MessageFlags flags
struct GNUNET_MESSENGER_Message * message
struct GNUNET_MESSENGER_Contact * sender
enum GNUNET_GenericReturnValue completed
struct GNUNET_SCHEDULER_Task * task
struct GNUNET_MESSENGER_Message * message
struct GNUNET_CONTAINER_MultiHashMap * links
struct GNUNET_MESSENGER_RoomEncryptionKey * keys_tail
struct GNUNET_CONTAINER_MultiShortmap * subscriptions
struct GNUNET_MESSENGER_Handle * handle
enum GNUNET_GenericReturnValue opened
union GNUNET_MESSENGER_RoomKey key
enum GNUNET_GenericReturnValue wait_for_sync
struct GNUNET_CONTAINER_MultiShortmap * members
struct GNUNET_MESSENGER_MessageControl * control
struct GNUNET_SCHEDULER_Task * request_task
struct GNUNET_CONTAINER_MultiHashMap * requests
struct GNUNET_SCHEDULER_Task * queue_task
struct GNUNET_CONTAINER_MultiHashMap * epochs
struct GNUNET_HashCode last_epoch
struct GNUNET_CONTAINER_MultiHashMap * messages
struct GNUNET_CONTAINER_MultiHashMap * actions
enum GNUNET_GenericReturnValue use_handle_name
struct GNUNET_MESSENGER_QueueMessages queue
enum GNUNET_GenericReturnValue joined
struct GNUNET_MESSENGER_ListTunnels entries
struct GNUNET_MESSENGER_RoomEncryptionKey * keys_head
struct GNUNET_ShortHashCode * sender_id
struct GNUNET_HashCode last_message
A 256-bit hashcode.
Time for relative time used by GNUnet, in microseconds.
An epoch identifier unifies an epoch identifier code and its 256bit hash representation.
struct GNUNET_MESSENGER_EpochIdentifierCode code
An epoch nonce unifies the epoch nonce data and its 256bit hash representation.
struct GNUNET_ShortHashCode hash
A room key unifies a room key code and its 512bit hash representation.
struct GNUNET_MESSENGER_RoomKeyCode code