GNUnet 0.26.2-113-ged4734898
 
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;
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)))
993
994 if (announcement)
996 else
997 epoch_key = NULL;
998
999 if (! epoch_key)
1000 goto send_message;
1001
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, hash, key);
1062
1063 encode_message_signature (message, msg_length, msg_buffer);
1064
1065 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send message (%s)!\n",
1066 GNUNET_h2s (hash));
1067
1068 if (! get_message_discourse (message))
1069 {
1070 const struct GNUNET_HashCode *epoch;
1071
1072 switch (message->header.kind)
1073 {
1076 epoch = hash;
1077 break;
1078 default:
1079 epoch = &(room->last_epoch);
1080 break;
1081 }
1082
1083 update_room_last_message (room, hash, epoch);
1084 }
1085
1086 switch (message->header.kind)
1087 {
1090 break;
1092 handle_discourse_subscription (room, message);
1093 break;
1094 default:
1095 break;
1096 }
1097
1098 GNUNET_MQ_send (room->handle->mq, env);
1099}
1100
1101
1102void
1104 const struct GNUNET_HashCode *epoch,
1105 struct GNUNET_MESSENGER_Message *message,
1106 struct GNUNET_MESSENGER_Message *transcript,
1107 enum GNUNET_GenericReturnValue sync)
1108{
1110 const struct GNUNET_CRYPTO_HpkePublicKey *transcript_key;
1111
1112 GNUNET_assert ((room) && (message));
1113
1114 key = get_handle_key (room->handle);
1115
1116 if (! epoch)
1117 epoch = &(room->last_epoch);
1118
1119 transcript_key = get_valid_encryption_key_for_room (room);
1120
1121 enqueue_to_messages (&(room->queue),
1122 key,
1123 transcript_key,
1124 epoch,
1125 message,
1126 transcript);
1127
1128 if (GNUNET_YES != is_room_available (room))
1129 return;
1130
1131 if ((GNUNET_YES == sync) ||
1132 (GNUNET_YES == is_message_session_bound (message)))
1133 send_sync_room (room->handle, room);
1134 else if (GNUNET_YES != room->wait_for_sync)
1136}
1137
1138
1139static void
1141{
1142 struct GNUNET_MESSENGER_Room *room;
1143 struct GNUNET_MESSENGER_Message *message;
1144 struct GNUNET_MESSENGER_Message *transcript;
1146 struct GNUNET_CRYPTO_HpkePublicKey transcript_key;
1147 struct GNUNET_HashCode epoch;
1148 struct GNUNET_HashCode hash;
1149
1150 GNUNET_assert (cls);
1151
1152 room = cls;
1153
1154 GNUNET_assert (room->handle);
1155
1156 room->queue_task = NULL;
1157
1158 if ((GNUNET_YES != is_room_available (room)) || (! (room->handle->mq)))
1159 goto next_message;
1160
1161 message = NULL;
1162 transcript = NULL;
1163 memset (&key, 0, sizeof(key));
1164 memset (&transcript_key, 0, sizeof(transcript_key));
1165
1166 message = dequeue_from_messages (&(room->queue),
1167 &key,
1168 &transcript_key,
1169 &epoch,
1170 &transcript);
1171
1172 if (! message)
1173 {
1174 if (transcript)
1175 destroy_message (transcript);
1176
1177 return;
1178 }
1179
1180 send_message_to_room (room, message, &key, &epoch, &hash);
1181 destroy_message (message);
1182
1183 if (! transcript)
1184 {
1186 goto next_message;
1187 }
1188
1189 GNUNET_memcpy (&(transcript->body.transcript.hash), &hash, sizeof(hash));
1190
1191 if (GNUNET_YES == encrypt_message (transcript, &transcript_key))
1192 {
1193 struct GNUNET_HashCode other;
1194 send_message_to_room (room, transcript, &key, &epoch, &other);
1195
1197
1198 link_room_message (room, &hash, &other);
1199 link_room_message (room, &other, &hash);
1200 }
1201 else
1202 {
1204
1206 "Sending transcript aborted: Encryption failed!\n");
1207 }
1208
1209 destroy_message (transcript);
1210
1212 if (! room->queue.head)
1213 return;
1214
1217}
1218
1219
1220static void
1222{
1223 if ((GNUNET_YES != is_room_available (room)) || (! (room->handle)))
1224 return;
1225
1226 if (room->handle->mq)
1228 else if (! (room->queue_task))
1231}
1232
1233
1234const char*
1236{
1237 if (! handle)
1238 return NULL;
1239
1240 return get_handle_name (handle);
1241}
1242
1243
1244static enum GNUNET_GenericReturnValue
1246 struct GNUNET_MESSENGER_Room *room,
1247 const struct GNUNET_MESSENGER_Contact *contact)
1248{
1249 const struct GNUNET_MESSENGER_Handle *handle;
1250 struct GNUNET_MESSENGER_Message *message;
1251 const char *name;
1252
1253 GNUNET_assert ((cls) && (room));
1254
1255 handle = cls;
1256
1257 if (GNUNET_YES != room->use_handle_name)
1258 return GNUNET_YES;
1259
1261 if (! name)
1262 return GNUNET_YES;
1263
1264 message = create_message_name (name);
1265 if (! message)
1266 return GNUNET_NO;
1267
1268 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
1269 return GNUNET_YES;
1270}
1271
1272
1275 const char *name)
1276{
1277 if (! handle)
1278 return GNUNET_SYSERR;
1279
1280 set_handle_name (handle, strlen (name) > 0 ? name : NULL);
1282 return GNUNET_YES;
1283}
1284
1285
1286static const struct GNUNET_CRYPTO_BlindablePublicKey*
1288 )
1289{
1290 if (0 == GNUNET_memcmp (public_key, get_anonymous_public_key ()))
1291 return NULL;
1292
1293 return public_key;
1294}
1295
1296
1299{
1300 if (! handle)
1301 return NULL;
1302
1304}
1305
1306
1307static enum GNUNET_GenericReturnValue
1309 struct GNUNET_MESSENGER_Room *room,
1310 const struct GNUNET_MESSENGER_Contact *contact)
1311{
1313 struct GNUNET_MESSENGER_Message *message;
1314
1315 GNUNET_assert ((cls) && (room));
1316
1317 key = cls;
1318
1319 add_room_encryption_key (room, NULL);
1320
1322 if (! message)
1323 return GNUNET_NO;
1324
1325 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
1326 return GNUNET_YES;
1327}
1328
1329
1333{
1334 if (! handle)
1335 return GNUNET_SYSERR;
1336
1337 if (! key)
1338 {
1340 set_handle_key (handle, NULL);
1341 return GNUNET_YES;
1342 }
1343
1345 return GNUNET_SYSERR;
1346
1347 {
1349 GNUNET_memcpy (&priv, key, sizeof (priv));
1350
1353 }
1354
1356 return GNUNET_YES;
1357}
1358
1359
1362 const union GNUNET_MESSENGER_RoomKey *key)
1363{
1364 struct GNUNET_MESSENGER_Room *room;
1365
1366 if ((! handle) || (! key))
1367 return NULL;
1368
1369 if ((key->code.feed_bit) && (! key->code.group_bit))
1370 {
1372 "Personal rooms containing private feeds should not be opened!")
1373 ;
1374 return NULL;
1375 }
1376
1377 room = get_handle_room (handle, &(key->hash), GNUNET_YES);
1378
1379 if (! room)
1380 return NULL;
1381
1382 send_open_room (handle, room);
1383 return room;
1384}
1385
1386
1389 const struct GNUNET_PeerIdentity *door,
1390 const union GNUNET_MESSENGER_RoomKey *key)
1391{
1392 struct GNUNET_MESSENGER_Room *room;
1393
1394 if ((! handle) || (! door) || (! key))
1395 return NULL;
1396
1397 room = get_handle_room (handle, &(key->hash), GNUNET_YES);
1398
1399 if (! room)
1400 return NULL;
1401
1402 send_enter_room (handle, room, door);
1403 return room;
1404}
1405
1406
1407void
1409{
1410 struct GNUNET_MESSENGER_Message *message;
1411
1412 if (! room)
1413 return;
1414
1415 message = create_message_leave ();
1416
1417 if (! message)
1418 return;
1419
1420 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_YES);
1421}
1422
1423
1431
1432static enum GNUNET_GenericReturnValue
1434 const struct GNUNET_HashCode *key,
1435 void *value)
1436{
1437 struct GNUNET_MESSENGER_RoomFind *find;
1438 struct GNUNET_MESSENGER_Room *room;
1440
1441 GNUNET_assert ((cls) && (value));
1442
1443 find = cls;
1444 room = value;
1446
1447 if ((! find->contact) ||
1448 (GNUNET_YES == find_room_member (room, find->contact)))
1449 find->counter--;
1450
1451 if (find->callback)
1452 result = find->callback (find->cls, room, find->contact);
1453
1454 if (find->counter <= 0)
1455 result = GNUNET_NO;
1456
1457 return result;
1458}
1459
1460
1461int
1463 const struct GNUNET_MESSENGER_Contact *contact,
1465 void *cls)
1466{
1467 struct GNUNET_MESSENGER_RoomFind find;
1468
1469 if (! handle)
1470 return GNUNET_SYSERR;
1471
1472 find.contact = contact;
1473 find.callback = callback;
1474 find.counter = (contact? contact->rc : SIZE_MAX);
1475 find.cls = cls;
1476
1477 if (find.counter <= 0)
1478 return 0;
1479
1481 iterate_find_room, &find);
1482}
1483
1484
1485const struct GNUNET_HashCode*
1487{
1488 if (! room)
1489 return NULL;
1490
1491 return get_room_key (room);
1492}
1493
1494
1495const struct GNUNET_MESSENGER_Contact*
1497 const struct GNUNET_HashCode *hash)
1498{
1499 if ((! room) || (! hash))
1500 return NULL;
1501
1502 return get_room_sender (room, hash);
1503}
1504
1505
1506const struct GNUNET_MESSENGER_Contact*
1508 const struct GNUNET_HashCode *hash)
1509{
1510 if ((! room) || (! hash))
1511 return NULL;
1512
1513 return get_room_recipient (room, hash);
1514}
1515
1516
1517const char*
1519 GNUNET_MESSENGER_Contact *contact)
1520{
1521 if (! contact)
1522 return NULL;
1523
1524 return get_contact_name (contact);
1525}
1526
1527
1530 GNUNET_MESSENGER_Contact *contact)
1531{
1532 if (! contact)
1533 return NULL;
1534
1535 return get_non_anonymous_key (get_contact_key (contact));
1536}
1537
1538
1539size_t
1541 GNUNET_MESSENGER_Contact *contact)
1542{
1543 if (! contact)
1544 return 0;
1545
1546 return get_contact_id (contact);
1547}
1548
1549
1550static void
1552 struct GNUNET_MESSENGER_Message *message,
1554 public_key,
1555 const struct GNUNET_CRYPTO_HpkePublicKey *
1556 encryption_key)
1557{
1558 struct GNUNET_MESSENGER_Message *transcript;
1560 const char *handle_name;
1561 char *original_name;
1562
1563 GNUNET_assert ((room) && (message));
1564 GNUNET_assert ((! public_key) == (! encryption_key));
1565
1566 transcript = NULL;
1567
1568 if (GNUNET_MESSENGER_KIND_NAME != message->header.kind)
1569 goto skip_naming;
1570
1571 original_name = message->body.name.name;
1573 "Apply rule for using handle name in room: %s\n", GNUNET_h2s (
1574 get_room_key (room)));
1575
1576 handle_name = get_handle_name (room->handle);
1577
1578 if ((handle_name) && (GNUNET_YES == room->use_handle_name) &&
1579 ((! original_name) || (0 == strlen (original_name))))
1580 {
1581 if (original_name)
1582 GNUNET_free (original_name);
1583
1584 message->body.name.name = GNUNET_strdup (handle_name);
1585 }
1586
1587skip_naming:
1588 if ((! public_key) || (! encryption_key))
1589 goto skip_encryption;
1590
1592
1593 if (0 != GNUNET_memcmp (pubkey, public_key))
1594 transcript = transcribe_message (message, public_key);
1595
1596 if (GNUNET_YES != encrypt_message (message, encryption_key))
1597 {
1599 "Sending message aborted: Encryption failed!\n");
1600
1601 if (transcript)
1602 destroy_message (transcript);
1603
1604 destroy_message (message);
1605 return;
1606 }
1607
1608skip_encryption:
1609 enqueue_message_to_room (room, NULL, message, transcript, GNUNET_NO);
1610}
1611
1612
1613void
1615 const struct GNUNET_MESSENGER_Message *message,
1616 const struct GNUNET_MESSENGER_Contact *contact)
1617{
1618 const struct GNUNET_CRYPTO_BlindablePublicKey *public_key;
1619 const struct GNUNET_CRYPTO_HpkePublicKey *encryption_key;
1620
1621 if ((! room) || (! message))
1622 return;
1623
1624 switch (filter_message_sending (message))
1625 {
1626 case GNUNET_SYSERR:
1628 "Sending message aborted: This kind of message is reserved for the service!\n");
1629 return;
1630 case GNUNET_NO:
1632 "Sending message aborted: This kind of message could cause issues!\n");
1633 return;
1634 default:
1635 break;
1636 }
1637
1638 if (contact)
1639 {
1640 public_key = get_non_anonymous_key (
1641 get_contact_key (contact));
1642
1643 if (! public_key)
1644 {
1646 "Sending message aborted: Invalid key!\n");
1647 return;
1648 }
1649
1650 encryption_key = get_contact_encryption_key (
1651 contact, get_room_key (room));
1652
1653 if (! encryption_key)
1654 {
1656 "Sending message aborted: Missing encryption key!\n");
1657 return;
1658 }
1659 }
1660 else
1661 {
1662 public_key = NULL;
1663 encryption_key = NULL;
1664 }
1665
1667 room, copy_message (message), public_key, encryption_key);
1668}
1669
1670
1671void
1673 const struct GNUNET_HashCode *hash,
1674 const struct GNUNET_TIME_Relative delay)
1675{
1676 const struct GNUNET_MESSENGER_Message *message;
1677
1678 if ((! room) || (! hash))
1679 return;
1680
1681 message = get_room_message (room, hash);
1682
1683 if ((message) && (GNUNET_YES == is_epoch_message (message)))
1684 {
1686 "Deletion of message is not allowed!\n");
1687 return;
1688 }
1689
1690 delete_room_message (room, hash, delay);
1691}
1692
1693
1694void
1696 const struct GNUNET_HashCode *hash)
1697{
1699 struct GNUNET_MQ_Envelope *env;
1700
1701 GNUNET_assert ((room) && (hash));
1702
1703 if (GNUNET_is_zero (hash))
1704 return;
1705
1706 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request message (%s)!\n",
1707 GNUNET_h2s (hash));
1708
1710 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
1711 GNUNET_memcpy (&(msg->hash), hash, sizeof(*hash));
1712 GNUNET_MQ_send (room->handle->mq, env);
1713}
1714
1715
1716const struct GNUNET_MESSENGER_Message*
1718 const struct GNUNET_HashCode *hash)
1719{
1720 const struct GNUNET_MESSENGER_Message *message;
1721
1722 if ((! room) || (! hash) || (GNUNET_is_zero (hash)))
1723 return NULL;
1724
1725 message = get_room_message (room, hash);
1726
1727 if (! message)
1728 {
1729 if ((GNUNET_YES == room->joined) && (get_room_sender_id (room)))
1730 request_message_from_room (room, hash);
1731 else
1732 require_message_from_room (room, hash);
1733 }
1734
1735 return message;
1736}
1737
1738
1739int
1742 void *cls)
1743{
1744 if (! room)
1745 return GNUNET_SYSERR;
1746
1747 return iterate_room_members (room, callback, cls);
1748}
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.
struct GNUNET_REGEX_Announcement * announcement
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:986
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:1283
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_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_signature(const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer)
Encodes the signature of a given message into a buffer of a maximum length in bytes.
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 maximum 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, const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_BlindablePrivateKey *key)
Signs the hash of a message with a given private key.
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 maximum 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.