GNUnet 0.26.2-14-ga82e62fdc
 
Loading...
Searching...
No Matches
messenger_api.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2026 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 "gnunet_common.h"
28
30#include "gnunet_time_lib.h"
31#include "gnunet_util_lib.h"
32
33#include "messenger_api.h"
36#include "messenger_api_epoch.h"
42#include "messenger_api_room.h"
43#include "messenger_api_util.h"
44
45const char*
47{
48 switch (kind)
49 {
51 return "INFO";
53 return "JOIN";
55 return "LEAVE";
57 return "NAME";
59 return "KEY";
61 return "PEER";
63 return "ID";
65 return "MISS";
67 return "MERGE";
69 return "REQUEST";
71 return "INVITE";
73 return "TEXT";
75 return "FILE";
77 return "PRIVATE";
79 return "DELETION";
81 return "CONNECTION";
83 return "TICKET";
85 return "TRANSCRIPT";
87 return "TAG";
89 return "SUBSCRIPTION";
91 return "TALK";
93 return "ANNOUNCEMENT";
95 return "SECRET";
97 return "APPEAL";
99 return "ACCESS";
101 return "REVOLUTION";
103 return "GROUP";
105 return "AUTHORIZATION";
106 default:
107 return "UNKNOWN";
108 }
109}
110
111
112void
114 const char *input,
116 enum GNUNET_GenericReturnValue is_group,
117 enum GNUNET_GenericReturnValue is_feed)
118{
120
121 if (input)
123 input, strlen (input), &(key->hash));
124 else
127 &(key->hash), sizeof (key->hash));
128
129 key->code.public_bit = GNUNET_YES == is_public? 1 : 0;
130 key->code.group_bit = GNUNET_YES == is_group? 1 : 0;
131 key->code.feed_bit = GNUNET_YES == is_feed? 1 : 0;
132 key->code.unused_bits = 0;
133}
134
135
136static void
138
139static void
141 const struct GNUNET_MESSENGER_RoomMessage *msg)
142{
144 const struct GNUNET_HashCode *key;
145 const struct GNUNET_HashCode *prev;
146 const struct GNUNET_HashCode *epoch;
147 struct GNUNET_MESSENGER_Room *room;
148
149 GNUNET_assert ((cls) && (msg));
150
151 handle = cls;
152
153 key = &(msg->key);
154 prev = &(msg->previous);
155 epoch = &(msg->epoch);
156
157 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Opened room: %s\n", GNUNET_h2s (key));
158
160
162
163 if (! room)
164 return;
165
166 update_room_last_message (room, prev, epoch);
168}
169
170
171static void
173 const struct GNUNET_MESSENGER_RoomMessage *msg)
174{
176 const struct GNUNET_PeerIdentity *door;
177 const struct GNUNET_HashCode *key;
178 const struct GNUNET_HashCode *prev;
179 const struct GNUNET_HashCode *epoch;
180 struct GNUNET_MESSENGER_Room *room;
181
182 GNUNET_assert ((cls) && (msg));
183
184 handle = cls;
185
186 door = &(msg->door);
187 key = &(msg->key);
188 prev = &(msg->previous);
189 epoch = &(msg->epoch);
190
191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Entered room: %s\n", GNUNET_h2s (key));
192
194
196
197 if (! room)
198 return;
199
200 update_room_last_message (room, prev, epoch);
202}
203
204
205static void
207 const struct GNUNET_MESSENGER_RoomMessage *msg)
208{
210 const struct GNUNET_HashCode *key;
211 const struct GNUNET_HashCode *prev;
212 const struct GNUNET_HashCode *epoch;
213 struct GNUNET_MESSENGER_Room *room;
214
215 GNUNET_assert ((cls) && (msg));
216
217 handle = cls;
218
219 key = &(msg->key);
220 prev = &(msg->previous);
221 epoch = &(msg->epoch);
222
224
225 if (room)
226 update_room_last_message (room, prev, epoch);
227
228 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Closed room: %s\n", GNUNET_h2s (key));
229
231}
232
233
234static void
236 const struct GNUNET_MESSENGER_RoomMessage *msg)
237{
239 const struct GNUNET_HashCode *key;
240 const struct GNUNET_HashCode *prev;
241 const struct GNUNET_HashCode *epoch;
242 struct GNUNET_MESSENGER_Room *room;
243
244 GNUNET_assert ((cls) && (msg));
245
246 handle = cls;
247
248 key = &(msg->key);
249 prev = &(msg->previous);
250 epoch = &(msg->epoch);
251
253
254 if (! room)
255 return;
256
257 update_room_last_message (room, prev, epoch);
258
259 room->wait_for_sync = GNUNET_NO;
261}
262
263
264static const struct GNUNET_CRYPTO_HpkePublicKey*
266{
267 const struct GNUNET_CRYPTO_HpkePublicKey *key;
268
269 GNUNET_assert (room);
270
272
273 if (! key)
274 {
275 if (GNUNET_OK != add_room_encryption_key (room, NULL))
276 {
278 "Could not generate encryption key: %s\n",
279 GNUNET_h2s (get_room_key (room)));
280 return NULL;
281 }
282
284 }
285
287 return key;
288}
289
290
291static void
294{
296 const struct GNUNET_HashCode *key;
297 const struct GNUNET_ShortHashCode *id;
298 struct GNUNET_MESSENGER_Room *room;
299 struct GNUNET_MESSENGER_Message *message;
300 uint32_t reset;
301
302 GNUNET_assert ((cls) && (msg));
303
304 handle = cls;
305
306 key = &(msg->key);
307 id = &(msg->id);
308 reset = msg->reset;
309
310 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Changed member id in room: %s\n",
311 GNUNET_h2s (key));
312
314
315 if (! room)
316 {
317 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Room is unknown to handle: %s\n",
318 GNUNET_h2s (key));
319 return;
320 }
321
322 if ((! get_room_sender_id (room)) || (GNUNET_YES == reset))
323 {
324 set_room_sender_id (room, id);
325 message = create_message_join (
327 }
328 else
329 message = create_message_id (id);
330
331 if (! message)
332 return;
333
334 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
335}
336
337
340 const struct GNUNET_MESSENGER_RecvMessage *msg)
341{
342 struct GNUNET_MESSENGER_Message message;
343 uint16_t full_length, length;
344 const char *buffer;
345
347
348 full_length = ntohs (msg->header.size);
349
350 if (full_length < sizeof(*msg))
351 {
353 "Receiving failed: Message invalid!\n");
354 return GNUNET_NO;
355 }
356
357 length = full_length - sizeof(*msg);
358 buffer = ((const char*) msg) + sizeof(*msg);
359
361 GNUNET_YES))
362 {
364 "Receiving failed: Message too short!\n");
365 return GNUNET_NO;
366 }
367
368 if (GNUNET_YES != decode_message (&message, length, buffer, GNUNET_YES, NULL))
369 {
371 "Receiving failed: Message decoding failed!\n");
372 return GNUNET_NO;
373 }
374
375 cleanup_message (&message);
376 return GNUNET_OK;
377}
378
379
380static void
382 const struct GNUNET_MESSENGER_RecvMessage *msg)
383{
385 const struct GNUNET_HashCode *key;
386 const struct GNUNET_HashCode *sender;
387 const struct GNUNET_HashCode *context;
388 const struct GNUNET_HashCode *hash;
389 const struct GNUNET_HashCode *epoch;
391 struct GNUNET_MESSENGER_Message message;
392 struct GNUNET_MESSENGER_Room *room;
393 uint16_t length;
394 const char *buffer;
395
396 GNUNET_assert ((cls) && (msg));
397
398 handle = cls;
399
400 key = &(msg->key);
401 sender = &(msg->sender);
402 context = &(msg->context);
403 hash = &(msg->hash);
404 epoch = &(msg->epoch);
405
406 flags = (enum GNUNET_MESSENGER_MessageFlags) (msg->flags);
407
408 length = ntohs (msg->header.size) - sizeof(*msg);
409 buffer = ((const char*) msg) + sizeof(*msg);
410
411 decode_message (&message, length, buffer, GNUNET_YES, NULL);
412
414 "Receiving message: %s during epoch '%s'\n",
416 GNUNET_h2s (epoch));
417
419
420 if (! room)
421 {
422 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Unknown room for this client: %s\n",
423 GNUNET_h2s (key));
424
425 goto skip_message;
426 }
427
429 "Raw contact from sender and context: (%s : %s)\n",
431
433 sender,
434 context,
435 hash,
436 epoch,
437 &message,
438 flags);
439
440skip_message:
441 cleanup_message (&message);
442}
443
444
445static void
447 const struct GNUNET_MESSENGER_GetMessage *msg)
448{
450 const struct GNUNET_HashCode *key;
451 const struct GNUNET_HashCode *hash;
452 struct GNUNET_MESSENGER_Room *room;
453
454 GNUNET_assert ((cls) && (msg));
455
456 handle = cls;
457
458 key = &(msg->key);
459 hash = &(msg->hash);
460
461 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Missing message in room: %s\n",
462 GNUNET_h2s (hash));
463
465
466 if (! room)
467 {
469 "Miss in unknown room for this client: %s\n", GNUNET_h2s (key));
470 return;
471 }
472
473 if (! get_room_sender_id (room))
474 return;
475
476 {
477 struct GNUNET_MESSENGER_Message *message;
478
479 message = create_message_request (hash);
480 if (! message)
481 return;
482
483 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
484 }
485}
486
487
488static void
490
491static void
493 struct GNUNET_MESSENGER_Room *room)
494{
497 struct GNUNET_MQ_Envelope *env;
498 char *msg_buffer;
499 ssize_t len;
500
501 GNUNET_assert ((handle) && (handle->mq) && (room));
502
504
506 "Open room (%s) by member using key: %s\n",
507 GNUNET_h2s (get_room_key (room)),
509
511
512 env = GNUNET_MQ_msg_extra (msg, len > 0 ? len : 0,
514 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
515 copy_room_last_message (room, &(msg->previous));
516
517 msg_buffer = ((char*) msg) + sizeof(*msg);
518
519 if (len > 0)
521
523}
524
525
526static void
528 struct GNUNET_MESSENGER_Room *room,
529 const struct GNUNET_PeerIdentity *door)
530{
533 struct GNUNET_MQ_Envelope *env;
534 char *msg_buffer;
535 ssize_t len;
536
537 GNUNET_assert ((handle) && (handle->mq) && (room) && (door));
538
540
541 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Enter room (%s) via door: %s (%s)\n",
542 GNUNET_h2s (get_room_key (room)),
543 GNUNET_i2s (door),
545
547
548 env = GNUNET_MQ_msg_extra (msg, len > 0 ? len : 0,
550 GNUNET_memcpy (&(msg->door), door, sizeof(*door));
551 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
552 copy_room_last_message (room, &(msg->previous));
553
554 msg_buffer = ((char*) msg) + sizeof(*msg);
555
556 if (len > 0)
558
560}
561
562
563static void
565 struct GNUNET_MESSENGER_Room *room)
566{
568 struct GNUNET_MQ_Envelope *env;
569
570 GNUNET_assert ((handle) && (handle->mq) && (room));
571
572 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Close room (%s)!\n",
573 GNUNET_h2s (get_room_key (room)));
574
576
577 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
578 copy_room_last_message (room, &(msg->previous));
579
581}
582
583
584static void
586 struct GNUNET_MESSENGER_Room *room)
587{
589 struct GNUNET_MQ_Envelope *env;
590
591 GNUNET_assert ((handle) && (handle->mq) && (room));
592
593 if (GNUNET_YES == room->wait_for_sync)
594 return;
595
597
598 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sync room (%s)!\n",
599 GNUNET_h2s (get_room_key (room)));
600
602
603 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
604 copy_room_last_message (room, &(msg->previous));
605
607}
608
609
612 const struct GNUNET_HashCode *key,
613 void *value)
614{
616 struct GNUNET_MESSENGER_Room *room;
617 struct GNUNET_MESSENGER_ListTunnel *entry;
618
619 GNUNET_assert ((cls) && (value));
620
621 handle = cls;
622 room = value;
623
624 if (GNUNET_YES == room->opened)
625 send_open_room (handle, room);
626
627 entry = room->entries.head;
628 while (entry)
629 {
630 struct GNUNET_PeerIdentity door;
631
632 GNUNET_PEER_resolve (entry->peer, &door);
633 send_enter_room (handle, room, &door);
634
635 entry = entry->next;
636 }
637
638 return GNUNET_YES;
639}
640
641
642static void
644{
646
647 GNUNET_assert (cls);
648
649 handle = cls;
650
651 handle->reconnect_task = NULL;
652 handle->reconnect_time = GNUNET_TIME_STD_BACKOFF (handle->reconnect_time);
653
654 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Reconnect messenger!\n");
655
657
659 handle);
660}
661
662
665 const struct GNUNET_HashCode *key,
666 void *value)
667{
669 struct GNUNET_MESSENGER_Room *room;
670
671 GNUNET_assert ((cls) && (value));
672
673 handle = cls;
674 room = value;
675
676 send_close_room (handle, room);
677
678 return GNUNET_YES;
679}
680
681
682static void
684 enum GNUNET_MQ_Error error)
685{
687
688 GNUNET_assert (cls);
689
690 handle = cls;
691
692 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MQ_Error: %u\n", error);
693
695 handle);
696
697 if (handle->mq)
698 {
700 handle->mq = NULL;
701 }
702
703 handle->reconnect_task = GNUNET_SCHEDULER_add_delayed (handle->reconnect_time,
705 handle);
706}
707
708
709static void
760
761
764 const char *name,
766 const struct GNUNET_HashCode *secret,
768 void *msg_cls)
769{
771
773
775
777
778 if (handle->mq)
779 {
781 struct GNUNET_MQ_Envelope *env;
782
784
787
788 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connect handle!\n");
789
792 return handle;
793 }
794 else
795 {
797 return NULL;
798 }
799}
800
801
802void
818
819
820static void
822{
823 struct GNUNET_MESSENGER_Room *room;
824
825 GNUNET_assert (cls);
826
827 room = cls;
828
829 room->opened = GNUNET_NO;
830 clear_list_tunnels (&(room->entries));
831
832 send_close_room (room->handle, room);
833}
834
835
836static void
838{
839 struct GNUNET_MESSENGER_RoomSubscription *subscription;
840 struct GNUNET_MESSENGER_Room *room;
841 struct GNUNET_MESSENGER_Message *message;
842 const struct GNUNET_ShortHashCode *discourse;
843
844 GNUNET_assert (cls);
845
846 subscription = cls;
847 subscription->task = NULL;
848
849 room = subscription->room;
850 message = subscription->message;
851
852 subscription->message = NULL;
853
854 discourse = &(message->body.subscription.discourse);
855
857 discourse,
858 subscription))
859 {
860 destroy_message (message);
861 return;
862 }
863
864 GNUNET_free (subscription);
865
866 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
867}
868
869
870static void
872 struct GNUNET_MESSENGER_Message *message)
873{
874 const struct GNUNET_ShortHashCode *discourse;
875 struct GNUNET_MESSENGER_RoomSubscription *subscription;
876 struct GNUNET_TIME_Relative time;
877 uint32_t flags;
878
879 GNUNET_assert ((room) && (message));
880
881 flags = message->body.subscription.flags;
882
883 discourse = &(message->body.subscription.discourse);
884
886 discourse);
887
889 goto active_subscription;
890
891 if (! subscription)
892 return;
893
894 if (subscription->task)
895 GNUNET_SCHEDULER_cancel (subscription->task);
896
897 if (subscription->message)
898 destroy_message (subscription->message);
899
901 discourse,
902 subscription))
903 {
904 subscription->task = NULL;
905 subscription->message = NULL;
906 return;
907 }
908
909 GNUNET_free (subscription);
910 return;
911
912active_subscription:
914 return;
915
917
918 if (! subscription)
919 {
920 subscription = GNUNET_new (struct GNUNET_MESSENGER_RoomSubscription);
921
923 room->subscriptions, discourse, subscription,
925 {
926 GNUNET_free (subscription);
927 return;
928 }
929
930 subscription->room = room;
931 }
932 else
933 {
934 if (subscription->task)
935 GNUNET_SCHEDULER_cancel (subscription->task);
936
937 if (subscription->message)
938 destroy_message (subscription->message);
939 }
940
941 subscription->message = create_message_subscription (discourse, time,
942 flags);
943
944 if (! subscription->message)
945 {
946 subscription->task = NULL;
947 return;
948 }
949
950 {
951 struct GNUNET_TIME_Relative delay;
952 delay = GNUNET_TIME_relative_multiply_double (time, 0.9);
953
956 keep_subscription_alive, subscription);
957 }
958}
959
960
961static void
963 struct GNUNET_MESSENGER_Message *message,
965 const struct GNUNET_HashCode *epoch,
966 struct GNUNET_HashCode *hash)
967{
968 const struct GNUNET_ShortHashCode *sender_id;
970 struct GNUNET_MQ_Envelope *env;
971 uint16_t msg_length;
972 char *msg_buffer;
973
974 GNUNET_assert ((room) && (message) && (key) && (hash));
975
976 sender_id = get_room_sender_id (room);
977
978 if (GNUNET_NO == is_service_message (message))
979 {
980 struct GNUNET_MESSENGER_Epoch *last_epoch;
981 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
982 const struct GNUNET_CRYPTO_SymmetricSessionKey *epoch_key;
983
984 last_epoch = get_room_epoch (room, epoch, GNUNET_YES);
985
986 if (! last_epoch)
987 goto send_message;
988
989 announcement = get_epoch_announcement (last_epoch, NULL, GNUNET_YES);
990
991 if ((! announcement) && (GNUNET_YES != is_room_public (room)))
992 generate_room_epoch_announcement (room, last_epoch, &announcement);
993
994 if (announcement)
995 epoch_key = get_epoch_announcement_key (announcement);
996 else
997 epoch_key = NULL;
998
999 if (! epoch_key)
1000 goto send_message;
1001
1002 if (GNUNET_YES != encrypt_secret_message (message, &(announcement->
1003 identifier), epoch_key)
1004 )
1005 {
1006 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Encrypting message (%s) failed!\n",
1007 GNUNET_h2s (hash));
1008 return;
1009 }
1010 }
1011
1013 if (GNUNET_YES == is_epoch_message (message))
1016 else
1019
1020 GNUNET_memcpy (&(message->header.sender_id), sender_id,
1021 sizeof(message->header.sender_id));
1022
1023 if (0 == GNUNET_CRYPTO_hash_cmp (epoch, &(room->last_epoch)))
1024 copy_room_last_message (room, &(message->header.previous));
1025 else
1026 GNUNET_memcpy (&(message->header.previous), epoch,
1027 sizeof(message->header.previous));
1028
1029 switch (message->header.kind)
1030 {
1032 {
1033 GNUNET_memcpy (&(message->body.join.epoch), epoch,
1034 sizeof(message->body.join.epoch));
1035 break;
1036 }
1038 {
1039 GNUNET_memcpy (&(message->body.leave.epoch), epoch,
1040 sizeof(message->body.leave.epoch));
1041 break;
1042 }
1043 default:
1044 break;
1045 }
1046
1047 message->header.signature.type = key->type;
1048
1049 msg_length = get_message_size (message, GNUNET_YES);
1050
1052 msg, msg_length,
1054
1055 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
1056
1057 msg_buffer = ((char*) msg) + sizeof(*msg);
1058 encode_message (message, msg_length, msg_buffer, GNUNET_YES);
1059
1060 hash_message (message, msg_length, msg_buffer, hash);
1061 sign_message (message, msg_length, msg_buffer, hash, key);
1062
1063 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send message (%s)!\n",
1064 GNUNET_h2s (hash));
1065
1066 if (! get_message_discourse (message))
1067 {
1068 const struct GNUNET_HashCode *epoch;
1069
1070 switch (message->header.kind)
1071 {
1074 epoch = hash;
1075 break;
1076 default:
1077 epoch = &(room->last_epoch);
1078 break;
1079 }
1080
1081 update_room_last_message (room, hash, epoch);
1082 }
1083
1084 switch (message->header.kind)
1085 {
1088 break;
1090 handle_discourse_subscription (room, message);
1091 break;
1092 default:
1093 break;
1094 }
1095
1096 GNUNET_MQ_send (room->handle->mq, env);
1097}
1098
1099
1100void
1102 const struct GNUNET_HashCode *epoch,
1103 struct GNUNET_MESSENGER_Message *message,
1104 struct GNUNET_MESSENGER_Message *transcript,
1105 enum GNUNET_GenericReturnValue sync)
1106{
1108 const struct GNUNET_CRYPTO_HpkePublicKey *transcript_key;
1109
1110 GNUNET_assert ((room) && (message));
1111
1112 key = get_handle_key (room->handle);
1113
1114 if (! epoch)
1115 epoch = &(room->last_epoch);
1116
1117 transcript_key = get_valid_encryption_key_for_room (room);
1118
1119 enqueue_to_messages (&(room->queue),
1120 key,
1121 transcript_key,
1122 epoch,
1123 message,
1124 transcript);
1125
1126 if (GNUNET_YES != is_room_available (room))
1127 return;
1128
1129 if ((GNUNET_YES == sync) ||
1130 (GNUNET_YES == is_message_session_bound (message)))
1131 send_sync_room (room->handle, room);
1132 else if (GNUNET_YES != room->wait_for_sync)
1134}
1135
1136
1137static void
1139{
1140 struct GNUNET_MESSENGER_Room *room;
1141 struct GNUNET_MESSENGER_Message *message;
1142 struct GNUNET_MESSENGER_Message *transcript;
1144 struct GNUNET_CRYPTO_HpkePublicKey transcript_key;
1145 struct GNUNET_HashCode epoch;
1146 struct GNUNET_HashCode hash;
1147
1148 GNUNET_assert (cls);
1149
1150 room = cls;
1151
1152 GNUNET_assert (room->handle);
1153
1154 room->queue_task = NULL;
1155
1156 if ((GNUNET_YES != is_room_available (room)) || (! (room->handle->mq)))
1157 goto next_message;
1158
1159 message = NULL;
1160 transcript = NULL;
1161 memset (&key, 0, sizeof(key));
1162 memset (&transcript_key, 0, sizeof(transcript_key));
1163
1164 message = dequeue_from_messages (&(room->queue),
1165 &key,
1166 &transcript_key,
1167 &epoch,
1168 &transcript);
1169
1170 if (! message)
1171 {
1172 if (transcript)
1173 destroy_message (transcript);
1174
1175 return;
1176 }
1177
1178 send_message_to_room (room, message, &key, &epoch, &hash);
1179 destroy_message (message);
1180
1181 if (! transcript)
1182 {
1184 goto next_message;
1185 }
1186
1187 GNUNET_memcpy (&(transcript->body.transcript.hash), &hash, sizeof(hash));
1188
1189 if (GNUNET_YES == encrypt_message (transcript, &transcript_key))
1190 {
1191 struct GNUNET_HashCode other;
1192 send_message_to_room (room, transcript, &key, &epoch, &other);
1193
1195
1196 link_room_message (room, &hash, &other);
1197 link_room_message (room, &other, &hash);
1198 }
1199 else
1200 {
1202
1204 "Sending transcript aborted: Encryption failed!\n");
1205 }
1206
1207 destroy_message (transcript);
1208
1210 if (! room->queue.head)
1211 return;
1212
1215}
1216
1217
1218static void
1220{
1221 if ((GNUNET_YES != is_room_available (room)) || (! (room->handle)))
1222 return;
1223
1224 if (room->handle->mq)
1226 else if (! (room->queue_task))
1229}
1230
1231
1232const char*
1234{
1235 if (! handle)
1236 return NULL;
1237
1238 return get_handle_name (handle);
1239}
1240
1241
1242static enum GNUNET_GenericReturnValue
1244 struct GNUNET_MESSENGER_Room *room,
1245 const struct GNUNET_MESSENGER_Contact *contact)
1246{
1247 const struct GNUNET_MESSENGER_Handle *handle;
1248 struct GNUNET_MESSENGER_Message *message;
1249 const char *name;
1250
1251 GNUNET_assert ((cls) && (room));
1252
1253 handle = cls;
1254
1255 if (GNUNET_YES != room->use_handle_name)
1256 return GNUNET_YES;
1257
1259 if (! name)
1260 return GNUNET_YES;
1261
1262 message = create_message_name (name);
1263 if (! message)
1264 return GNUNET_NO;
1265
1266 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
1267 return GNUNET_YES;
1268}
1269
1270
1273 const char *name)
1274{
1275 if (! handle)
1276 return GNUNET_SYSERR;
1277
1278 set_handle_name (handle, strlen (name) > 0 ? name : NULL);
1280 return GNUNET_YES;
1281}
1282
1283
1284static const struct GNUNET_CRYPTO_BlindablePublicKey*
1286 )
1287{
1288 if (0 == GNUNET_memcmp (public_key, get_anonymous_public_key ()))
1289 return NULL;
1290
1291 return public_key;
1292}
1293
1294
1297{
1298 if (! handle)
1299 return NULL;
1300
1302}
1303
1304
1305static enum GNUNET_GenericReturnValue
1307 struct GNUNET_MESSENGER_Room *room,
1308 const struct GNUNET_MESSENGER_Contact *contact)
1309{
1311 struct GNUNET_MESSENGER_Message *message;
1312
1313 GNUNET_assert ((cls) && (room));
1314
1315 key = cls;
1316
1317 add_room_encryption_key (room, NULL);
1318
1320 if (! message)
1321 return GNUNET_NO;
1322
1323 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
1324 return GNUNET_YES;
1325}
1326
1327
1331{
1332 if (! handle)
1333 return GNUNET_SYSERR;
1334
1335 if (! key)
1336 {
1338 set_handle_key (handle, NULL);
1339 return GNUNET_YES;
1340 }
1341
1343 return GNUNET_SYSERR;
1344
1345 {
1347 GNUNET_memcpy (&priv, key, sizeof (priv));
1348
1351 }
1352
1354 return GNUNET_YES;
1355}
1356
1357
1360 const union GNUNET_MESSENGER_RoomKey *key)
1361{
1362 struct GNUNET_MESSENGER_Room *room;
1363
1364 if ((! handle) || (! key))
1365 return NULL;
1366
1367 if ((key->code.feed_bit) && (! key->code.group_bit))
1368 {
1370 "Personal rooms containing private feeds should not be opened!")
1371 ;
1372 return NULL;
1373 }
1374
1375 room = get_handle_room (handle, &(key->hash), GNUNET_YES);
1376
1377 if (! room)
1378 return NULL;
1379
1380 send_open_room (handle, room);
1381 return room;
1382}
1383
1384
1387 const struct GNUNET_PeerIdentity *door,
1388 const union GNUNET_MESSENGER_RoomKey *key)
1389{
1390 struct GNUNET_MESSENGER_Room *room;
1391
1392 if ((! handle) || (! door) || (! key))
1393 return NULL;
1394
1395 room = get_handle_room (handle, &(key->hash), GNUNET_YES);
1396
1397 if (! room)
1398 return NULL;
1399
1400 send_enter_room (handle, room, door);
1401 return room;
1402}
1403
1404
1405void
1407{
1408 struct GNUNET_MESSENGER_Message *message;
1409
1410 if (! room)
1411 return;
1412
1413 message = create_message_leave ();
1414
1415 if (! message)
1416 return;
1417
1418 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_YES);
1419}
1420
1421
1429
1430static enum GNUNET_GenericReturnValue
1432 const struct GNUNET_HashCode *key,
1433 void *value)
1434{
1435 struct GNUNET_MESSENGER_RoomFind *find;
1436 struct GNUNET_MESSENGER_Room *room;
1438
1439 GNUNET_assert ((cls) && (value));
1440
1441 find = cls;
1442 room = value;
1444
1445 if ((! find->contact) ||
1446 (GNUNET_YES == find_room_member (room, find->contact)))
1447 find->counter--;
1448
1449 if (find->callback)
1450 result = find->callback (find->cls, room, find->contact);
1451
1452 if (find->counter <= 0)
1453 result = GNUNET_NO;
1454
1455 return result;
1456}
1457
1458
1459int
1461 const struct GNUNET_MESSENGER_Contact *contact,
1463 void *cls)
1464{
1465 struct GNUNET_MESSENGER_RoomFind find;
1466
1467 if (! handle)
1468 return GNUNET_SYSERR;
1469
1470 find.contact = contact;
1471 find.callback = callback;
1472 find.counter = (contact? contact->rc : SIZE_MAX);
1473 find.cls = cls;
1474
1475 if (find.counter <= 0)
1476 return 0;
1477
1479 iterate_find_room, &find);
1480}
1481
1482
1483const struct GNUNET_HashCode*
1485{
1486 if (! room)
1487 return NULL;
1488
1489 return get_room_key (room);
1490}
1491
1492
1493const struct GNUNET_MESSENGER_Contact*
1495 const struct GNUNET_HashCode *hash)
1496{
1497 if ((! room) || (! hash))
1498 return NULL;
1499
1500 return get_room_sender (room, hash);
1501}
1502
1503
1504const struct GNUNET_MESSENGER_Contact*
1506 const struct GNUNET_HashCode *hash)
1507{
1508 if ((! room) || (! hash))
1509 return NULL;
1510
1511 return get_room_recipient (room, hash);
1512}
1513
1514
1515const char*
1517 GNUNET_MESSENGER_Contact *contact)
1518{
1519 if (! contact)
1520 return NULL;
1521
1522 return get_contact_name (contact);
1523}
1524
1525
1528 GNUNET_MESSENGER_Contact *contact)
1529{
1530 if (! contact)
1531 return NULL;
1532
1533 return get_non_anonymous_key (get_contact_key (contact));
1534}
1535
1536
1537size_t
1539 GNUNET_MESSENGER_Contact *contact)
1540{
1541 if (! contact)
1542 return 0;
1543
1544 return get_contact_id (contact);
1545}
1546
1547
1548static void
1550 struct GNUNET_MESSENGER_Message *message,
1552 public_key,
1553 const struct GNUNET_CRYPTO_HpkePublicKey *
1554 encryption_key)
1555{
1556 struct GNUNET_MESSENGER_Message *transcript;
1558 const char *handle_name;
1559 char *original_name;
1560
1561 GNUNET_assert ((room) && (message));
1562 GNUNET_assert ((! public_key) == (! encryption_key));
1563
1564 transcript = NULL;
1565
1566 if (GNUNET_MESSENGER_KIND_NAME != message->header.kind)
1567 goto skip_naming;
1568
1569 original_name = message->body.name.name;
1571 "Apply rule for using handle name in room: %s\n", GNUNET_h2s (
1572 get_room_key (room)));
1573
1574 handle_name = get_handle_name (room->handle);
1575
1576 if ((handle_name) && (GNUNET_YES == room->use_handle_name) &&
1577 ((! original_name) || (0 == strlen (original_name))))
1578 {
1579 if (original_name)
1580 GNUNET_free (original_name);
1581
1582 message->body.name.name = GNUNET_strdup (handle_name);
1583 }
1584
1585skip_naming:
1586 if ((! public_key) || (! encryption_key))
1587 goto skip_encryption;
1588
1590
1591 if (0 != GNUNET_memcmp (pubkey, public_key))
1592 transcript = transcribe_message (message, public_key);
1593
1594 if (GNUNET_YES != encrypt_message (message, encryption_key))
1595 {
1597 "Sending message aborted: Encryption failed!\n");
1598
1599 if (transcript)
1600 destroy_message (transcript);
1601
1602 destroy_message (message);
1603 return;
1604 }
1605
1606skip_encryption:
1607 enqueue_message_to_room (room, NULL, message, transcript, GNUNET_NO);
1608}
1609
1610
1611void
1613 const struct GNUNET_MESSENGER_Message *message,
1614 const struct GNUNET_MESSENGER_Contact *contact)
1615{
1616 const struct GNUNET_CRYPTO_BlindablePublicKey *public_key;
1617 const struct GNUNET_CRYPTO_HpkePublicKey *encryption_key;
1618
1619 if ((! room) || (! message))
1620 return;
1621
1622 switch (filter_message_sending (message))
1623 {
1624 case GNUNET_SYSERR:
1626 "Sending message aborted: This kind of message is reserved for the service!\n");
1627 return;
1628 case GNUNET_NO:
1630 "Sending message aborted: This kind of message could cause issues!\n");
1631 return;
1632 default:
1633 break;
1634 }
1635
1636 if (contact)
1637 {
1638 public_key = get_non_anonymous_key (
1639 get_contact_key (contact));
1640
1641 if (! public_key)
1642 {
1644 "Sending message aborted: Invalid key!\n");
1645 return;
1646 }
1647
1648 encryption_key = get_contact_encryption_key (
1649 contact, get_room_key (room));
1650
1651 if (! encryption_key)
1652 {
1654 "Sending message aborted: Missing encryption key!\n");
1655 return;
1656 }
1657 }
1658 else
1659 {
1660 public_key = NULL;
1661 encryption_key = NULL;
1662 }
1663
1665 room, copy_message (message), public_key, encryption_key);
1666}
1667
1668
1669void
1671 const struct GNUNET_HashCode *hash,
1672 const struct GNUNET_TIME_Relative delay)
1673{
1674 const struct GNUNET_MESSENGER_Message *message;
1675
1676 if ((! room) || (! hash))
1677 return;
1678
1679 message = get_room_message (room, hash);
1680
1681 if ((message) && (GNUNET_YES == is_epoch_message (message)))
1682 {
1684 "Deletion of message is not allowed!\n");
1685 return;
1686 }
1687
1688 delete_room_message (room, hash, delay);
1689}
1690
1691
1692void
1694 const struct GNUNET_HashCode *hash)
1695{
1697 struct GNUNET_MQ_Envelope *env;
1698
1699 GNUNET_assert ((room) && (hash));
1700
1701 if (GNUNET_is_zero (hash))
1702 return;
1703
1704 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request message (%s)!\n",
1705 GNUNET_h2s (hash));
1706
1708 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
1709 GNUNET_memcpy (&(msg->hash), hash, sizeof(*hash));
1710 GNUNET_MQ_send (room->handle->mq, env);
1711}
1712
1713
1714const struct GNUNET_MESSENGER_Message*
1716 const struct GNUNET_HashCode *hash)
1717{
1718 const struct GNUNET_MESSENGER_Message *message;
1719
1720 if ((! room) || (! hash) || (GNUNET_is_zero (hash)))
1721 return NULL;
1722
1723 message = get_room_message (room, hash);
1724
1725 if (! message)
1726 {
1727 if ((GNUNET_YES == room->joined) && (get_room_sender_id (room)))
1728 request_message_from_room (room, hash);
1729 else
1730 require_message_from_room (room, hash);
1731 }
1732
1733 return message;
1734}
1735
1736
1737int
1740 void *cls)
1741{
1742 if (! room)
1743 return GNUNET_SYSERR;
1744
1745 return iterate_room_members (room, callback, cls);
1746}
struct GNUNET_MQ_MessageHandlers handlers[]
Definition 003.c:1
struct GNUNET_MessageHeader * msg
Definition 005.c:2
struct GNUNET_MQ_Envelope * env
Definition 005.c:1
static enum GNUNET_GenericReturnValue recv_message(void *cls, const struct GNUNET_MessageHeader *msg)
We have received a full message, pass to the MQ dispatcher.
Definition client.c:335
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition gnunet-arm.c:108
struct GNUNET_HashCode key
The key used in the DHT.
static pa_context * context
Pulseaudio context.
static struct GNUNET_CRYPTO_BlindablePublicKey pubkey
Public key of the zone to look in.
static char * name
Name (label) of the records to list.
static int reset
Reset argument.
static struct GNUNET_IDENTITY_Handle * id
Handle to IDENTITY.
static char * value
Value of the record to add/remove.
static int is_public
Is record public (opposite of GNUNET_GNSRECORD_RF_PRIVATE)
static int result
Global testing status.
static struct GNUNET_NSE_FloodMessage next_message
Message for the next round, if we got any.
static void send_message(struct PeerContext *peer_ctx, struct GNUNET_MQ_Envelope *ev, const char *type)
Send a message to another peer.
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...
Functions related to time.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition client.c:1060
void GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length)
Fill block with a random values.
void GNUNET_CRYPTO_private_key_clear(struct GNUNET_CRYPTO_BlindablePrivateKey *pk)
Clear memory that was used to store a private key.
Definition crypto_pkey.c:47
@ GNUNET_CRYPTO_QUALITY_STRONG
High-quality operations are desired.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition crypto_hash.c:41
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.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
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.
void * GNUNET_CONTAINER_multishortmap_get(const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key)
Given a key find a value in the map matching the 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.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE...
#define GNUNET_is_zero(a)
Check that memory in a is all zeros.
#define GNUNET_log(kind,...)
char * GNUNET_CRYPTO_blindable_public_key_to_string(const struct GNUNET_CRYPTO_BlindablePublicKey *key)
Creates a (Base32) string representation of the public key.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
ssize_t GNUNET_CRYPTO_write_blindable_pk_to_buffer(const struct GNUNET_CRYPTO_BlindablePublicKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_BlindablePublicKey to a compact buffer.
ssize_t GNUNET_CRYPTO_blindable_sk_get_length(const struct GNUNET_CRYPTO_BlindablePrivateKey *key)
Get the compacted length of a GNUNET_CRYPTO_BlindablePrivateKey.
Definition crypto_pkey.c:64
GNUNET_GenericReturnValue
Named constants for return values.
ssize_t GNUNET_CRYPTO_blindable_pk_get_length(const struct GNUNET_CRYPTO_BlindablePublicKey *key)
Get the compacted length of a GNUNET_CRYPTO_BlindablePublicKey.
Definition crypto_pkey.c:85
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
@ GNUNET_SCHEDULER_PRIORITY_HIGH
Run with high priority (important requests).
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
const char * GNUNET_h2s_full(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
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_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MESSENGER_delete_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
Delete a message identified by its hash from a room.
struct GNUNET_MESSENGER_Handle * GNUNET_MESSENGER_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, const struct GNUNET_CRYPTO_BlindablePrivateKey *key, const struct GNUNET_HashCode *secret, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
Set up a handle for the messenger related functions and connects to all necessary services.
int GNUNET_MESSENGER_iterate_members(struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls)
Iterates through all members of a given room and calls a selected callback for each of them with a pr...
int GNUNET_MESSENGER_find_rooms(const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, GNUNET_MESSENGER_MemberCallback callback, void *cls)
Searches for a specific contact in a given room and calls a selected callback with a given closure fo...
const struct GNUNET_HashCode * GNUNET_MESSENGER_room_get_key(const struct GNUNET_MESSENGER_Room *room)
Get the key of a given room.
GNUNET_MESSENGER_MessageKind
Enum for the different supported kinds of messages.
const struct GNUNET_MESSENGER_Contact * GNUNET_MESSENGER_get_recipient(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Get the contact of a member in a room which has been targeted as recipient of a specific message iden...
const char * GNUNET_MESSENGER_name_of_kind(enum GNUNET_MESSENGER_MessageKind kind)
Get the name of a message kind.
GNUNET_MESSENGER_MessageFlags
Enum for the different supported flags used by message handling.
void(* GNUNET_MESSENGER_MessageCallback)(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Contact *recipient, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags)
Method called whenever a message is sent or received from a room.
const char * GNUNET_MESSENGER_contact_get_name(const struct GNUNET_MESSENGER_Contact *contact)
Get the name used by the contact.
const struct GNUNET_MESSENGER_Contact * GNUNET_MESSENGER_get_sender(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Get the contact of a member in a room which sent a specific message identified with a given hash.
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_enter_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const union GNUNET_MESSENGER_RoomKey *key)
Enter a room to send and receive messages through a door opened using GNUNET_MESSENGER_open_room.
const struct GNUNET_CRYPTO_BlindablePublicKey * GNUNET_MESSENGER_contact_get_key(const struct GNUNET_MESSENGER_Contact *contact)
Get the public key used by the contact or NULL if the anonymous key was used.
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_key(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_CRYPTO_BlindablePrivateKey *key)
Set the private key used by the messenger or NULL if the anonymous key should be used instead.
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_open_room(struct GNUNET_MESSENGER_Handle *handle, const union GNUNET_MESSENGER_RoomKey *key)
Open a room to send and receive messages.
const struct GNUNET_MESSENGER_Message * GNUNET_MESSENGER_get_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Get the message in a room identified by its hash and requests it if necessary.
void GNUNET_MESSENGER_disconnect(struct GNUNET_MESSENGER_Handle *handle)
Disconnect all of the messengers used services and clears up its used memory.
const struct GNUNET_CRYPTO_BlindablePublicKey * GNUNET_MESSENGER_get_key(const struct GNUNET_MESSENGER_Handle *handle)
Get the public key used by the messenger or NULL if the anonymous key was used.
size_t GNUNET_MESSENGER_contact_get_id(const struct GNUNET_MESSENGER_Contact *contact)
Get the locally unique id of the contact.
#define GNUNET_MESSENGER_SERVICE_NAME
Identifier of GNUnet MESSENGER Service.
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.
const char * GNUNET_MESSENGER_get_name(const struct GNUNET_MESSENGER_Handle *handle)
Get the name (if specified, otherwise NULL) used by the messenger.
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_name(struct GNUNET_MESSENGER_Handle *handle, const char *name)
Set the name for the messenger handle and sends messages renaming your contact in currently open room...
void GNUNET_MESSENGER_close_room(struct GNUNET_MESSENGER_Room *room)
Close a room which was entered, opened or both in various order and variety.
void GNUNET_MESSENGER_send_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_MESSENGER_Contact *contact)
Send a message into a room.
void GNUNET_MESSENGER_create_room_key(union GNUNET_MESSENGER_RoomKey *key, const char *input, enum GNUNET_GenericReturnValue is_public, enum GNUNET_GenericReturnValue is_group, enum GNUNET_GenericReturnValue is_feed)
Creates a room key from given optional input string using certain properties for this targeted room.
@ GNUNET_MESSENGER_KIND_INFO
The info kind.
@ GNUNET_MESSENGER_KIND_MISS
The miss kind.
@ GNUNET_MESSENGER_KIND_INVITE
The invite 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_TAG
The tag kind.
@ GNUNET_MESSENGER_KIND_FILE
The file kind.
@ GNUNET_MESSENGER_KIND_APPEAL
The appeal kind.
@ GNUNET_MESSENGER_KIND_REQUEST
The request 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_TALK
The talk kind.
@ GNUNET_MESSENGER_KIND_REVOLUTION
The revolution kind.
@ GNUNET_MESSENGER_KIND_PEER
The peer kind.
@ GNUNET_MESSENGER_KIND_UNKNOWN
The unknown kind.
@ GNUNET_MESSENGER_KIND_TRANSCRIPT
The transcript kind.
@ GNUNET_MESSENGER_KIND_KEY
The key kind.
@ GNUNET_MESSENGER_KIND_TEXT
The text kind.
@ GNUNET_MESSENGER_KIND_SECRET
The secret kind.
@ GNUNET_MESSENGER_KIND_JOIN
The join kind.
@ GNUNET_MESSENGER_KIND_SUBSCRIBTION
The subscription kind.
@ GNUNET_MESSENGER_KIND_DELETION
The deletion kind.
@ GNUNET_MESSENGER_KIND_CONNECTION
The connection kind.
@ GNUNET_MESSENGER_KIND_TICKET
The ticket 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_SUBSCRIPTION_KEEP_ALIVE
The keep alive flag.
@ GNUNET_MESSENGER_FLAG_SUBSCRIPTION_UNSUBSCRIBE
The unsubscribe flag.
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition mq.c:305
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
void GNUNET_MQ_notify_sent(struct GNUNET_MQ_Envelope *ev, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
Call a callback once the envelope has been sent, that is, sending it can not be canceled anymore.
Definition mq.c:655
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition mq.c:700
void GNUNET_PEER_resolve(GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid)
Convert an interned PID to a normal peer identity.
Definition peer.c:220
#define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_OPEN
#define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_SEND_MESSAGE
#define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE
#define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_CREATE
#define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_SYNC
#define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_GET_MESSAGE
#define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_DESTROY
#define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE
#define GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID
#define GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition scheduler.c:980
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition scheduler.c:1277
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:1207
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:1231
struct GNUNET_TIME_Relative GNUNET_TIME_relative_ntoh(struct GNUNET_TIME_RelativeNBO a)
Convert relative time from network byte order.
Definition time.c:626
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get_zero_(void)
Return absolute time of 0ms.
Definition time.c:142
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition time.c:111
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_AbsoluteNBO GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a)
Convert absolute time to network byte order.
Definition time.c:636
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
static void callback_leave_message_sent(void *cls)
static void keep_subscription_alive(void *cls)
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.
static enum GNUNET_GenericReturnValue iterate_send_key_to_room(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
static void dequeue_message_from_room(void *cls)
static void handle_recv_message(void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg)
static void callback_reconnect(void *cls)
static void handle_room_close(void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
static void send_message_to_room_with_key(struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_BlindablePublicKey *public_key, const struct GNUNET_CRYPTO_HpkePublicKey *encryption_key)
static enum GNUNET_GenericReturnValue iterate_close_room(void *cls, const struct GNUNET_HashCode *key, void *value)
static enum GNUNET_GenericReturnValue iterate_find_room(void *cls, const struct GNUNET_HashCode *key, void *value)
static void dequeue_messages_from_room(struct GNUNET_MESSENGER_Room *room)
static enum GNUNET_GenericReturnValue check_recv_message(void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg)
static void handle_room_open(void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
static void send_sync_room(struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room)
static void handle_room_entry(void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
static const struct GNUNET_CRYPTO_BlindablePublicKey * get_non_anonymous_key(const struct GNUNET_CRYPTO_BlindablePublicKey *public_key)
static void send_enter_room(struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_PeerIdentity *door)
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.
static void handle_room_sync(void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
static const struct GNUNET_CRYPTO_HpkePublicKey * get_valid_encryption_key_for_room(struct GNUNET_MESSENGER_Room *room)
static void send_close_room(struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room)
static void callback_mq_error(void *cls, enum GNUNET_MQ_Error error)
static void handle_discourse_subscription(struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Message *message)
static enum GNUNET_GenericReturnValue iterate_send_name_to_room(void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
static void handle_member_id(void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg)
static enum GNUNET_GenericReturnValue iterate_reset_room(void *cls, const struct GNUNET_HashCode *key, void *value)
static void send_message_to_room(struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_BlindablePrivateKey *key, const struct GNUNET_HashCode *epoch, struct GNUNET_HashCode *hash)
static void send_open_room(struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room)
static void handle_miss_message(void *cls, const struct GNUNET_MESSENGER_GetMessage *msg)
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.
const struct GNUNET_CRYPTO_BlindablePublicKey * get_contact_key(const struct GNUNET_MESSENGER_Contact *contact)
Returns the blindable public key of a given contact.
size_t get_contact_id(const struct GNUNET_MESSENGER_Contact *contact)
Returns the locally unique identifier of a given contact.
const char * get_contact_name(const struct GNUNET_MESSENGER_Contact *contact)
Returns the current name of a given contact or NULL if no valid name was assigned yet.
const struct GNUNET_CRYPTO_HpkePublicKey * get_contact_encryption_key(const struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_HashCode *key)
Returns the HPKE public key of a given contact for a specific room that is identified via its own roo...
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.
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 entry_handle_room_at(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key)
Adds a tunnel for a room known to a handle identified by a given key to a list of opened connections.
void open_handle_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Marks a room known to a handle identified by a given key as open.
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.
void destroy_handle(struct GNUNET_MESSENGER_Handle *handle)
Destroys a handle and frees its memory fully from the client API.
struct GNUNET_MESSENGER_Handle * create_handle(const struct GNUNET_CONFIGURATION_Handle *config, const struct GNUNET_HashCode *secret, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
Creates and allocates a new handle using a given configuration, a secret and a custom message callbac...
void close_handle_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Destroys and so implicitly closes a room known to a handle identified by a given key.
void set_handle_name(struct GNUNET_MESSENGER_Handle *handle, const char *name)
Sets the name of a handle to a specific name.
const struct GNUNET_CRYPTO_BlindablePrivateKey * get_handle_key(const struct GNUNET_MESSENGER_Handle *handle)
Returns the private key of a given handle.
void set_handle_key(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_CRYPTO_BlindablePrivateKey *key)
Sets the keypair of a given handle to the keypair of a specific private key.
struct GNUNET_MESSENGER_Room * get_handle_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key, enum GNUNET_GenericReturnValue init)
Returns the room known to a handle identified by a given key.
void clear_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels)
Clears the list of tunnels peer identities.
enum GNUNET_GenericReturnValue encrypt_message(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_HpkePublicKey *hpke_key)
Encrypts a message using a given public key and replaces its body and kind with the now private encry...
void encode_message(const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, enum GNUNET_GenericReturnValue include_header)
Encodes a given message into a buffer of a maximal length in bytes.
enum GNUNET_GenericReturnValue is_service_message(const struct GNUNET_MESSENGER_Message *message)
Returns whether a specific kind of message contains service critical information.
struct GNUNET_MESSENGER_Message * copy_message(const struct GNUNET_MESSENGER_Message *message)
Creates and allocates a copy of a given message.
enum GNUNET_GenericReturnValue filter_message_sending(const struct GNUNET_MESSENGER_Message *message)
Returns whether a specific kind of message should be sent by a client.
void sign_message(struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_BlindablePrivateKey *key)
Signs the hash of a message with a given private key and writes the signature into the buffer as well...
const struct GNUNET_ShortHashCode * get_message_discourse(const struct GNUNET_MESSENGER_Message *message)
Returns the discourse hash of a message depending on its kind.
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...
void hash_message(const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, struct GNUNET_HashCode *hash)
Calculates a hash of a given buffer with a length in bytes from a message.
void destroy_message(struct GNUNET_MESSENGER_Message *message)
Destroys a message and frees its memory fully.
uint16_t get_message_kind_size(enum GNUNET_MESSENGER_MessageKind kind, enum GNUNET_GenericReturnValue include_header)
Returns the minimal size in bytes to encode a message of a specific kind.
enum GNUNET_GenericReturnValue is_message_session_bound(const struct GNUNET_MESSENGER_Message *message)
Returns if the message should be bound to a member session.
uint16_t get_message_size(const struct GNUNET_MESSENGER_Message *message, enum GNUNET_GenericReturnValue include_header)
Returns the exact size in bytes to encode a given message.
enum GNUNET_GenericReturnValue decode_message(struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, enum GNUNET_GenericReturnValue include_header, uint16_t *padding)
Decodes a message from a given buffer of a maximal length in bytes.
struct GNUNET_MESSENGER_Message * transcribe_message(const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_BlindablePublicKey *key)
Transcribes a message as a new transcript message using a given public key from the recipient of the ...
enum GNUNET_GenericReturnValue encrypt_secret_message(struct GNUNET_MESSENGER_Message *message, const union GNUNET_MESSENGER_EpochIdentifier *identifier, const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
Encrypts a message using a given shared key from an announcement of an epoch and replaces its body an...
void cleanup_message(struct GNUNET_MESSENGER_Message *message)
Frees the messages body memory.
void process_message_control(struct GNUNET_MESSENGER_MessageControl *control, const struct GNUNET_HashCode *sender, const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *hash, const struct GNUNET_HashCode *epoch, const struct GNUNET_MESSENGER_Message *message, enum GNUNET_MESSENGER_MessageFlags flags)
Processes a new message with its hash and regarding information about sender, context and message fla...
struct GNUNET_MESSENGER_Message * create_message_name(const char *name)
Creates and allocates a new name message containing the name to change to.
struct GNUNET_MESSENGER_Message * create_message_subscription(const struct GNUNET_ShortHashCode *discourse, const struct GNUNET_TIME_Relative time, uint32_t flags)
Creates and allocates a new subscribe message for a subscription of a given discourse with a specific...
struct GNUNET_MESSENGER_Message * create_message_leave(void)
Creates and allocates a new leave message.
struct GNUNET_MESSENGER_Message * create_message_join(const struct GNUNET_CRYPTO_BlindablePrivateKey *key, const struct GNUNET_CRYPTO_HpkePublicKey *hpke_key)
Creates and allocates a new join message containing the clients public key.
struct GNUNET_MESSENGER_Message * create_message_request(const struct GNUNET_HashCode *hash)
Creates and allocates a new request message containing the hash of a missing message.
struct GNUNET_MESSENGER_Message * create_message_id(const struct GNUNET_ShortHashCode *unique_id)
Creates and allocates a new id message containing the unique member id to change to.
struct GNUNET_MESSENGER_Message * create_message_key(const struct GNUNET_CRYPTO_BlindablePrivateKey *key, const struct GNUNET_CRYPTO_HpkePublicKey *hpke_key)
Creates and allocates a new key message containing the public key to change to derived from its priva...
void enqueue_to_messages(struct GNUNET_MESSENGER_QueueMessages *messages, const struct GNUNET_CRYPTO_BlindablePrivateKey *sender, const struct GNUNET_CRYPTO_HpkePublicKey *transcript_key, const struct GNUNET_HashCode *epoch, struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_Message *transcript)
Adds a specific message to the end or the beginning of the queue.
struct GNUNET_MESSENGER_Message * dequeue_from_messages(struct GNUNET_MESSENGER_QueueMessages *messages, struct GNUNET_CRYPTO_BlindablePrivateKey *sender, struct GNUNET_CRYPTO_HpkePublicKey *transcript_key, struct GNUNET_HashCode *epoch, struct GNUNET_MESSENGER_Message **transcript)
Remove the message from the front of the queue and returns it.
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...
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...
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.
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.
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.
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 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 ...
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...
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...
enum GNUNET_GenericReturnValue is_room_available(const struct GNUNET_MESSENGER_Room *room)
Checks whether a room is available to send messages.
const struct GNUNET_HashCode * get_room_key(const struct GNUNET_MESSENGER_Room *room)
Return a the hash representation of a given room.
const struct GNUNET_ShortHashCode * get_room_sender_id(const struct GNUNET_MESSENGER_Room *room)
Returns the member id of the room's sender.
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...
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...
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.
const struct GNUNET_CRYPTO_BlindablePublicKey * get_anonymous_public_key(void)
Returns the public identity key of GNUNET_IDENTITY_ego_get_anonymous() without recalculating it every...
#define SIZE_MAX
Definition platform.h:209
static void reconnect(void)
Adjust exponential back-off and reconnect to the service.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
A public key used for encryption.
A 512-bit hashcode.
Message to create a handle for a client.
Message to destroy the handle for a client.
Message to request something from a room.
struct GNUNET_MQ_Handle * mq
GNUNET_MESSENGER_MessageCallback msg_callback
struct GNUNET_HashCode secret
struct GNUNET_MESSENGER_ListTunnel * next
struct GNUNET_MESSENGER_ListTunnel * head
Message to receive the current member id of a handle in room.
struct GNUNET_MESSENGER_MessageName name
struct GNUNET_MESSENGER_MessageLeave leave
struct GNUNET_MESSENGER_MessageTranscript transcript
struct GNUNET_MESSENGER_MessageSubscribtion subscription
struct GNUNET_MESSENGER_MessageJoin join
struct GNUNET_HashCode previous
The hash of the previous message from the senders perspective.
struct GNUNET_CRYPTO_BlindableKeySignature signature
The signature of the senders private key.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.
struct GNUNET_TIME_AbsoluteNBO timestamp
The timestamp of the message.
struct GNUNET_ShortHashCode sender_id
The senders id inside of the room the message was sent in.
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
char * name
The new name which replaces the current senders name.
uint32_t flags
The flags about the subscription to a discourse.
struct GNUNET_TIME_RelativeNBO time
The time window of the subscription.
struct GNUNET_ShortHashCode discourse
The hash of the discourse to subscription.
struct GNUNET_HashCode hash
The hash of the original message.
struct GNUNET_MESSENGER_MessageHeader header
Header.
struct GNUNET_MESSENGER_MessageBody body
Body.
struct GNUNET_MESSENGER_QueueMessage * head
Message to receive something from a room.
GNUNET_MESSENGER_MemberCallback callback
const struct GNUNET_MESSENGER_Contact * contact
General message to confirm interaction with a room.
struct GNUNET_SCHEDULER_Task * task
struct GNUNET_MESSENGER_Message * message
struct GNUNET_MESSENGER_Room * room
struct GNUNET_CONTAINER_MultiShortmap * subscriptions
struct GNUNET_MESSENGER_Handle * handle
enum GNUNET_GenericReturnValue opened
enum GNUNET_GenericReturnValue wait_for_sync
struct GNUNET_MESSENGER_MessageControl * control
struct GNUNET_SCHEDULER_Task * queue_task
struct GNUNET_HashCode last_epoch
enum GNUNET_GenericReturnValue use_handle_name
struct GNUNET_MESSENGER_QueueMessages queue
enum GNUNET_GenericReturnValue joined
struct GNUNET_MESSENGER_ListTunnels entries
Message to send something into a room.
Message handler for a specific message type.
The identity of the host (wraps the signing key of the peer).
A 256-bit hashcode.
Time for relative time used by GNUnet, in microseconds.
struct GNUNET_MQ_Handle * mq
Connection to VPN service.
Definition vpn_api.c:44
A room key unifies a room key code and its 512bit hash representation.