GNUnet debian-0.24.3-24-gfea921bd2
messenger_api.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2025 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
26#include "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 "SUBSCRIBTION";
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
161 room = get_handle_room (handle, key);
162 if (! room)
163 return;
164
165 update_room_last_message (room, prev, epoch);
167}
168
169
170static void
172 const struct GNUNET_MESSENGER_RoomMessage *msg)
173{
175 const struct GNUNET_PeerIdentity *door;
176 const struct GNUNET_HashCode *key;
177 const struct GNUNET_HashCode *prev;
178 const struct GNUNET_HashCode *epoch;
179 struct GNUNET_MESSENGER_Room *room;
180
181 GNUNET_assert ((cls) && (msg));
182
183 handle = cls;
184
185 door = &(msg->door);
186 key = &(msg->key);
187 prev = &(msg->previous);
188 epoch = &(msg->epoch);
189
190 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Entered room: %s\n", GNUNET_h2s (key));
191
193
194 room = get_handle_room (handle, key);
195 if (! room)
196 return;
197
198 update_room_last_message (room, prev, epoch);
200}
201
202
203static void
205 const struct GNUNET_MESSENGER_RoomMessage *msg)
206{
208 const struct GNUNET_HashCode *key;
209 const struct GNUNET_HashCode *prev;
210 const struct GNUNET_HashCode *epoch;
211 struct GNUNET_MESSENGER_Room *room;
212
213 GNUNET_assert ((cls) && (msg));
214
215 handle = cls;
216
217 key = &(msg->key);
218 prev = &(msg->previous);
219 epoch = &(msg->epoch);
220
221 room = get_handle_room (handle, key);
222 if (room)
223 update_room_last_message (room, prev, epoch);
224
225 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Closed room: %s\n", GNUNET_h2s (key));
226
228}
229
230
231static void
233 const struct GNUNET_MESSENGER_RoomMessage *msg)
234{
236 const struct GNUNET_HashCode *key;
237 const struct GNUNET_HashCode *prev;
238 const struct GNUNET_HashCode *epoch;
239 struct GNUNET_MESSENGER_Room *room;
240
241 GNUNET_assert ((cls) && (msg));
242
243 handle = cls;
244
245 key = &(msg->key);
246 prev = &(msg->previous);
247 epoch = &(msg->epoch);
248
249 room = get_handle_room (handle, key);
250 if (! room)
251 return;
252
253 update_room_last_message (room, prev, epoch);
254
255 room->wait_for_sync = GNUNET_NO;
257}
258
259
260static void
263{
265 const struct GNUNET_HashCode *key;
266 const struct GNUNET_ShortHashCode *id;
267 struct GNUNET_MESSENGER_Room *room;
268 struct GNUNET_MESSENGER_Message *message;
269 uint32_t reset;
270
271 GNUNET_assert ((cls) && (msg));
272
273 handle = cls;
274
275 key = &(msg->key);
276 id = &(msg->id);
277 reset = msg->reset;
278
279 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Changed member id in room: %s\n",
280 GNUNET_h2s (key));
281
282 room = get_handle_room (handle, key);
283 if (! room)
284 {
285 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Room is unknown to handle: %s\n",
286 GNUNET_h2s (key));
287 return;
288 }
289
290 if ((! get_room_sender_id (room)) || (GNUNET_YES == reset))
291 {
292 set_room_sender_id (room, id);
294 }
295 else
296 message = create_message_id (id);
297
298 if (! message)
299 return;
300
301 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
302}
303
304
307 const struct GNUNET_MESSENGER_RecvMessage *msg)
308{
309 struct GNUNET_MESSENGER_Message message;
310 uint16_t full_length, length;
311 const char *buffer;
312
314
315 full_length = ntohs (msg->header.size);
316
317 if (full_length < sizeof(*msg))
318 {
320 "Receiving failed: Message invalid!\n");
321 return GNUNET_NO;
322 }
323
324 length = full_length - sizeof(*msg);
325 buffer = ((const char*) msg) + sizeof(*msg);
326
328 GNUNET_YES))
329 {
331 "Receiving failed: Message too short!\n");
332 return GNUNET_NO;
333 }
334
335 if (GNUNET_YES != decode_message (&message, length, buffer, GNUNET_YES, NULL))
336 {
338 "Receiving failed: Message decoding failed!\n");
339 return GNUNET_NO;
340 }
341
342 cleanup_message (&message);
343 return GNUNET_OK;
344}
345
346
347static void
349 const struct GNUNET_MESSENGER_RecvMessage *msg)
350{
352 const struct GNUNET_HashCode *key;
353 const struct GNUNET_HashCode *sender;
354 const struct GNUNET_HashCode *context;
355 const struct GNUNET_HashCode *hash;
356 const struct GNUNET_HashCode *epoch;
358 struct GNUNET_MESSENGER_Message message;
359 struct GNUNET_MESSENGER_Room *room;
360 uint16_t length;
361 const char *buffer;
362
363 GNUNET_assert ((cls) && (msg));
364
365 handle = cls;
366
367 key = &(msg->key);
368 sender = &(msg->sender);
369 context = &(msg->context);
370 hash = &(msg->hash);
371 epoch = &(msg->epoch);
372
373 flags = (enum GNUNET_MESSENGER_MessageFlags) (msg->flags);
374
375 length = ntohs (msg->header.size) - sizeof(*msg);
376 buffer = ((const char*) msg) + sizeof(*msg);
377
378 decode_message (&message, length, buffer, GNUNET_YES, NULL);
379
381 "Receiving message: %s during epoch '%s'\n",
383 GNUNET_h2s (epoch));
384
385 room = get_handle_room (handle, key);
386 if (! room)
387 {
388 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Unknown room for this client: %s\n",
389 GNUNET_h2s (key));
390
391 goto skip_message;
392 }
393
395 "Raw contact from sender and context: (%s : %s)\n",
397
399 sender,
400 context,
401 hash,
402 epoch,
403 &message,
404 flags);
405
406skip_message:
407 cleanup_message (&message);
408}
409
410
411static void
413 const struct GNUNET_MESSENGER_GetMessage *msg)
414{
416 const struct GNUNET_HashCode *key;
417 const struct GNUNET_HashCode *hash;
418 struct GNUNET_MESSENGER_Room *room;
419
420 GNUNET_assert ((cls) && (msg));
421
422 handle = cls;
423
424 key = &(msg->key);
425 hash = &(msg->hash);
426
427 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Missing message in room: %s\n",
428 GNUNET_h2s (hash));
429
430 room = get_handle_room (handle, key);
431 if (! room)
432 {
434 "Miss in unknown room for this client: %s\n", GNUNET_h2s (key));
435 return;
436 }
437
438 if (! get_room_sender_id (room))
439 return;
440
441 {
442 struct GNUNET_MESSENGER_Message *message;
443
444 message = create_message_request (hash);
445 if (! message)
446 return;
447
448 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
449 }
450}
451
452
453static void
455
456static void
458 struct GNUNET_MESSENGER_Room *room)
459{
460 const struct GNUNET_CRYPTO_PublicKey *key;
462 struct GNUNET_MQ_Envelope *env;
463 char *msg_buffer;
464 ssize_t len;
465
466 GNUNET_assert ((handle) && (handle->mq) && (room));
467
469
471 "Open room (%s) by member using key: %s\n",
472 GNUNET_h2s (get_room_key (room)),
474
476
477 env = GNUNET_MQ_msg_extra (msg, len > 0 ? len : 0,
479 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
480 copy_room_last_message (room, &(msg->previous));
481
482 msg_buffer = ((char*) msg) + sizeof(*msg);
483
484 if (len > 0)
486
488}
489
490
491static void
493 struct GNUNET_MESSENGER_Room *room,
494 const struct GNUNET_PeerIdentity *door)
495{
496 const struct GNUNET_CRYPTO_PublicKey *key;
498 struct GNUNET_MQ_Envelope *env;
499 char *msg_buffer;
500 ssize_t len;
501
502 GNUNET_assert ((handle) && (handle->mq) && (room) && (door));
503
505
506 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Enter room (%s) via door: %s (%s)\n",
507 GNUNET_h2s (get_room_key (room)),
508 GNUNET_i2s (door),
510
512
513 env = GNUNET_MQ_msg_extra (msg, len > 0 ? len : 0,
515 GNUNET_memcpy (&(msg->door), door, sizeof(*door));
516 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
517 copy_room_last_message (room, &(msg->previous));
518
519 msg_buffer = ((char*) msg) + sizeof(*msg);
520
521 if (len > 0)
523
525}
526
527
528static void
530 struct GNUNET_MESSENGER_Room *room)
531{
533 struct GNUNET_MQ_Envelope *env;
534
535 GNUNET_assert ((handle) && (handle->mq) && (room));
536
537 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Close room (%s)!\n",
538 GNUNET_h2s (get_room_key (room)));
539
541
542 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
543 copy_room_last_message (room, &(msg->previous));
544
546}
547
548
549static void
551 struct GNUNET_MESSENGER_Room *room)
552{
554 struct GNUNET_MQ_Envelope *env;
555
556 GNUNET_assert ((handle) && (handle->mq) && (room));
557
558 if (GNUNET_YES == room->wait_for_sync)
559 return;
560
562
563 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sync room (%s)!\n",
564 GNUNET_h2s (get_room_key (room)));
565
567
568 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
569 copy_room_last_message (room, &(msg->previous));
570
572}
573
574
577 const struct GNUNET_HashCode *key,
578 void *value)
579{
581 struct GNUNET_MESSENGER_Room *room;
582 struct GNUNET_MESSENGER_ListTunnel *entry;
583
584 GNUNET_assert ((cls) && (value));
585
586 handle = cls;
587 room = value;
588
589 if (GNUNET_YES == room->opened)
590 send_open_room (handle, room);
591
592 entry = room->entries.head;
593 while (entry)
594 {
595 struct GNUNET_PeerIdentity door;
596
597 GNUNET_PEER_resolve (entry->peer, &door);
598 send_enter_room (handle, room, &door);
599
600 entry = entry->next;
601 }
602
603 return GNUNET_YES;
604}
605
606
607static void
609{
611
612 GNUNET_assert (cls);
613
614 handle = cls;
615
616 handle->reconnect_task = NULL;
617 handle->reconnect_time = GNUNET_TIME_STD_BACKOFF (handle->reconnect_time);
618
619 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Reconnect messenger!\n");
620
622
624 handle);
625}
626
627
630 const struct GNUNET_HashCode *key,
631 void *value)
632{
634 struct GNUNET_MESSENGER_Room *room;
635
636 GNUNET_assert ((cls) && (value));
637
638 handle = cls;
639 room = value;
640
641 send_close_room (handle, room);
642
643 return GNUNET_YES;
644}
645
646
647static void
649 enum GNUNET_MQ_Error error)
650{
652
653 GNUNET_assert (cls);
654
655 handle = cls;
656
657 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MQ_Error: %u\n", error);
658
660 handle);
661
662 if (handle->mq)
663 {
665 handle->mq = NULL;
666 }
667
668 handle->reconnect_task = GNUNET_SCHEDULER_add_delayed (handle->reconnect_time,
670 handle);
671}
672
673
674static void
676{
678
679 {
680 const struct GNUNET_MQ_MessageHandler handlers[] = {
682 member_id,
685 ),
687 room_open,
690 ),
692 room_entry,
695 ),
697 room_close,
700 ),
705 ),
707 miss_message,
710 ),
712 room_sync,
715 ),
717 };
718
722 handle);
723 }
724}
725
726
729 const char *name,
730 const struct GNUNET_CRYPTO_PrivateKey *key,
732 void *msg_cls)
733{
735
737
739
741
742 if (handle->mq)
743 {
745 struct GNUNET_MQ_Envelope *env;
746
748
751
752 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connect handle!\n");
753
756 return handle;
757 }
758 else
759 {
761 return NULL;
762 }
763}
764
765
766void
768{
770 struct GNUNET_MQ_Envelope *env;
771
772 if (! handle)
773 return;
774
775 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect handle!\n");
776
779
781}
782
783
784static void
786{
787 struct GNUNET_MESSENGER_Room *room;
788
789 GNUNET_assert (cls);
790
791 room = cls;
792
793 room->opened = GNUNET_NO;
794 clear_list_tunnels (&(room->entries));
795
796 send_close_room (room->handle, room);
797}
798
799
800static void
802{
803 struct GNUNET_MESSENGER_RoomSubscription *subscription;
804 struct GNUNET_MESSENGER_Room *room;
805 struct GNUNET_MESSENGER_Message *message;
806 const struct GNUNET_ShortHashCode *discourse;
807
808 GNUNET_assert (cls);
809
810 subscription = cls;
811 subscription->task = NULL;
812
813 room = subscription->room;
814 message = subscription->message;
815
816 subscription->message = NULL;
817
818 discourse = &(message->body.subscribtion.discourse);
819
821 discourse,
822 subscription))
823 {
824 destroy_message (message);
825 return;
826 }
827
828 GNUNET_free (subscription);
829
830 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
831}
832
833
834static void
836 struct GNUNET_MESSENGER_Message *message)
837{
838 const struct GNUNET_ShortHashCode *discourse;
839 struct GNUNET_MESSENGER_RoomSubscription *subscription;
840 struct GNUNET_TIME_Relative time;
841 uint32_t flags;
842
843 GNUNET_assert ((room) && (message));
844
845 flags = message->body.subscribtion.flags;
846
847 discourse = &(message->body.subscribtion.discourse);
848
850 discourse);
851
853 goto active_subscription;
854
855 if (! subscription)
856 return;
857
858 if (subscription->task)
859 GNUNET_SCHEDULER_cancel (subscription->task);
860
861 if (subscription->message)
862 destroy_message (subscription->message);
863
865 discourse,
866 subscription))
867 {
868 subscription->task = NULL;
869 subscription->message = NULL;
870 return;
871 }
872
873 GNUNET_free (subscription);
874 return;
875
876active_subscription:
878 return;
879
881
882 if (! subscription)
883 {
884 subscription = GNUNET_new (struct GNUNET_MESSENGER_RoomSubscription);
885
887 room->subscriptions, discourse, subscription,
889 {
890 GNUNET_free (subscription);
891 return;
892 }
893
894 subscription->room = room;
895 }
896 else
897 {
898 if (subscription->task)
899 GNUNET_SCHEDULER_cancel (subscription->task);
900
901 if (subscription->message)
902 destroy_message (subscription->message);
903 }
904
905 subscription->message = create_message_subscribtion (discourse, time,
906 flags);
907
908 if (! subscription->message)
909 {
910 subscription->task = NULL;
911 return;
912 }
913
914 {
915 struct GNUNET_TIME_Relative delay;
916 delay = GNUNET_TIME_relative_multiply_double (time, 0.9);
917
920 keep_subscription_alive, subscription);
921 }
922}
923
924
925static void
927 struct GNUNET_MESSENGER_Message *message,
928 const struct GNUNET_CRYPTO_PrivateKey *key,
929 const struct GNUNET_HashCode *epoch,
930 struct GNUNET_HashCode *hash)
931{
932 const struct GNUNET_ShortHashCode *sender_id;
934 struct GNUNET_MQ_Envelope *env;
935 uint16_t msg_length;
936 char *msg_buffer;
937
938 GNUNET_assert ((room) && (message) && (key) && (hash));
939
940 sender_id = get_room_sender_id (room);
941
942 if (GNUNET_NO == is_service_message (message))
943 {
944 struct GNUNET_MESSENGER_Epoch *last_epoch;
945 struct GNUNET_MESSENGER_EpochAnnouncement *announcement;
946 const struct GNUNET_CRYPTO_SymmetricSessionKey *epoch_key;
947
948 last_epoch = get_room_epoch (room, epoch, GNUNET_YES);
949
950 if (! last_epoch)
951 goto send_message;
952
953 announcement = get_epoch_announcement (last_epoch, NULL, GNUNET_YES);
954
955 if ((! announcement) && (GNUNET_YES != is_room_public (room)))
956 generate_room_epoch_announcement (room, last_epoch, &announcement);
957
958 if (announcement)
959 epoch_key = get_epoch_announcement_key (announcement);
960 else
961 epoch_key = NULL;
962
963 if (! epoch_key)
964 goto send_message;
965
966 if (GNUNET_YES != encrypt_secret_message (message, &(announcement->
967 identifier), epoch_key)
968 )
969 {
970 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Encrypting message (%s) failed!\n",
971 GNUNET_h2s (hash));
972 return;
973 }
974 }
975
977 if (GNUNET_YES == is_epoch_message (message))
980 else
983
984 GNUNET_memcpy (&(message->header.sender_id), sender_id,
985 sizeof(message->header.sender_id));
986
987 if (0 == GNUNET_CRYPTO_hash_cmp (epoch, &(room->last_epoch)))
988 copy_room_last_message (room, &(message->header.previous));
989 else
990 GNUNET_memcpy (&(message->header.previous), epoch,
991 sizeof(message->header.previous));
992
993 switch (message->header.kind)
994 {
996 {
997 GNUNET_memcpy (&(message->body.join.epoch), epoch,
998 sizeof(message->body.join.epoch));
999 break;
1000 }
1002 {
1003 GNUNET_memcpy (&(message->body.leave.epoch), epoch,
1004 sizeof(message->body.leave.epoch));
1005 break;
1006 }
1007 default:
1008 break;
1009 }
1010
1011 message->header.signature.type = key->type;
1012
1013 msg_length = get_message_size (message, GNUNET_YES);
1014
1016 msg, msg_length,
1018
1019 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
1020
1021 msg_buffer = ((char*) msg) + sizeof(*msg);
1022 encode_message (message, msg_length, msg_buffer, GNUNET_YES);
1023
1024 hash_message (message, msg_length, msg_buffer, hash);
1025 sign_message (message, msg_length, msg_buffer, hash, key);
1026
1027 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send message (%s)!\n",
1028 GNUNET_h2s (hash));
1029
1030 if (! get_message_discourse (message))
1031 {
1032 const struct GNUNET_HashCode *epoch;
1033
1034 switch (message->header.kind)
1035 {
1038 epoch = hash;
1039 break;
1040 default:
1041 epoch = &(room->last_epoch);
1042 break;
1043 }
1044
1045 update_room_last_message (room, hash, epoch);
1046 }
1047
1048 switch (message->header.kind)
1049 {
1052 break;
1054 handle_discourse_subscription (room, message);
1055 break;
1056 default:
1057 break;
1058 }
1059
1060 GNUNET_MQ_send (room->handle->mq, env);
1061}
1062
1063
1064void
1066 const struct GNUNET_HashCode *epoch,
1067 struct GNUNET_MESSENGER_Message *message,
1068 struct GNUNET_MESSENGER_Message *transcript,
1069 enum GNUNET_GenericReturnValue sync)
1070{
1071 const struct GNUNET_CRYPTO_PrivateKey *key;
1072
1073 GNUNET_assert ((room) && (message));
1074
1075 key = get_handle_key (room->handle);
1076
1077 if (! epoch)
1078 epoch = &(room->last_epoch);
1079
1080 enqueue_to_messages (&(room->queue),
1081 key,
1082 epoch,
1083 message,
1084 transcript);
1085
1086 if (GNUNET_YES != is_room_available (room))
1087 return;
1088
1089 if ((GNUNET_YES == sync) ||
1090 (GNUNET_YES == is_message_session_bound (message)))
1091 send_sync_room (room->handle, room);
1092 else if (GNUNET_YES != room->wait_for_sync)
1094}
1095
1096
1097static void
1099{
1100 struct GNUNET_MESSENGER_Room *room;
1101 struct GNUNET_MESSENGER_Message *message;
1102 struct GNUNET_MESSENGER_Message *transcript;
1104 struct GNUNET_HashCode epoch;
1105 struct GNUNET_HashCode hash;
1107
1108 GNUNET_assert (cls);
1109
1110 room = cls;
1111
1112 GNUNET_assert (room->handle);
1113
1114 room->queue_task = NULL;
1115
1116 if ((GNUNET_YES != is_room_available (room)) || (! (room->handle->mq)))
1117 goto next_message;
1118
1119 message = NULL;
1120 transcript = NULL;
1121 memset (&key, 0, sizeof(key));
1122
1123 message = dequeue_from_messages (&(room->queue),
1124 &key,
1125 &epoch,
1126 &transcript);
1127
1128 if (! message)
1129 {
1130 if (transcript)
1131 destroy_message (transcript);
1132
1133 return;
1134 }
1135
1136 send_message_to_room (room, message, &key, &epoch, &hash);
1137 destroy_message (message);
1138
1139 if (! transcript)
1140 {
1142 goto next_message;
1143 }
1144
1145 GNUNET_memcpy (&(transcript->body.transcript.hash), &hash, sizeof(hash));
1146
1147 memset (&pubkey, 0, sizeof(pubkey));
1149
1150 if (GNUNET_YES == encrypt_message (transcript, &pubkey))
1151 {
1152 struct GNUNET_HashCode other;
1153 send_message_to_room (room, transcript, &key, &epoch, &other);
1154
1156
1157 link_room_message (room, &hash, &other);
1158 link_room_message (room, &other, &hash);
1159 }
1160 else
1161 {
1163
1165 "Sending transcript aborted: Encryption failed!\n");
1166 }
1167
1168 destroy_message (transcript);
1169
1171 if (! room->queue.head)
1172 return;
1173
1176}
1177
1178
1179static void
1181{
1182 if ((GNUNET_YES != is_room_available (room)) || (! (room->handle)))
1183 return;
1184
1185 if (room->handle->mq)
1187 else if (! (room->queue_task))
1190}
1191
1192
1193const char*
1195{
1196 if (! handle)
1197 return NULL;
1198
1199 return get_handle_name (handle);
1200}
1201
1202
1203static enum GNUNET_GenericReturnValue
1205 struct GNUNET_MESSENGER_Room *room,
1206 const struct GNUNET_MESSENGER_Contact *contact)
1207{
1208 const struct GNUNET_MESSENGER_Handle *handle;
1209 struct GNUNET_MESSENGER_Message *message;
1210 const char *name;
1211
1212 GNUNET_assert ((cls) && (room));
1213
1214 handle = cls;
1215
1216 if (GNUNET_YES != room->use_handle_name)
1217 return GNUNET_YES;
1218
1220 if (! name)
1221 return GNUNET_YES;
1222
1223 message = create_message_name (name);
1224 if (! message)
1225 return GNUNET_NO;
1226
1227 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
1228 return GNUNET_YES;
1229}
1230
1231
1234 const char *name)
1235{
1236 if (! handle)
1237 return GNUNET_SYSERR;
1238
1239 set_handle_name (handle, strlen (name) > 0 ? name : NULL);
1241 return GNUNET_YES;
1242}
1243
1244
1245static const struct GNUNET_CRYPTO_PublicKey*
1247{
1248 if (0 == GNUNET_memcmp (public_key, get_anonymous_public_key ()))
1249 return NULL;
1250
1251 return public_key;
1252}
1253
1254
1255const struct GNUNET_CRYPTO_PublicKey*
1257{
1258 if (! handle)
1259 return NULL;
1260
1262}
1263
1264
1265static enum GNUNET_GenericReturnValue
1267 struct GNUNET_MESSENGER_Room *room,
1268 const struct GNUNET_MESSENGER_Contact *contact)
1269{
1270 const struct GNUNET_CRYPTO_PrivateKey *key;
1271 struct GNUNET_MESSENGER_Message *message;
1272
1273 GNUNET_assert ((cls) && (room));
1274
1275 key = cls;
1276
1277 message = create_message_key (key);
1278 if (! message)
1279 return GNUNET_NO;
1280
1281 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_NO);
1282 return GNUNET_YES;
1283}
1284
1285
1288 const struct GNUNET_CRYPTO_PrivateKey *key)
1289{
1290 if (! handle)
1291 return GNUNET_SYSERR;
1292
1293 if (! key)
1294 {
1296 set_handle_key (handle, NULL);
1297 return GNUNET_YES;
1298 }
1299
1301 return GNUNET_SYSERR;
1302
1303 {
1304 struct GNUNET_CRYPTO_PrivateKey priv;
1305 GNUNET_memcpy (&priv, key, sizeof (priv));
1306
1309 }
1310
1312 return GNUNET_YES;
1313}
1314
1315
1318 const union GNUNET_MESSENGER_RoomKey *key)
1319{
1320 struct GNUNET_MESSENGER_Room *room;
1321
1322 if ((! handle) || (! key))
1323 return NULL;
1324
1325 if ((key->code.feed_bit) && (! key->code.group_bit))
1326 {
1328 "Personal rooms containing private feeds should not be opened!")
1329 ;
1330 return NULL;
1331 }
1332
1333 room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, &(key->hash));
1334 if (! room)
1335 {
1336 room = create_room (handle, key);
1337
1339 handle->rooms, &(key->hash), room,
1341 {
1342 destroy_room (room);
1343 return NULL;
1344 }
1345 }
1346
1347 send_open_room (handle, room);
1348 return room;
1349}
1350
1351
1354 const struct GNUNET_PeerIdentity *door,
1355 const union GNUNET_MESSENGER_RoomKey *key)
1356{
1357 struct GNUNET_MESSENGER_Room *room;
1358
1359 if ((! handle) || (! door) || (! key))
1360 return NULL;
1361
1362 room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, &(key->hash));
1363 if (! room)
1364 {
1365 room = create_room (handle, key);
1366
1368 handle->rooms, &(key->hash), room,
1370 {
1371 destroy_room (room);
1372 return NULL;
1373 }
1374 }
1375
1376 send_enter_room (handle, room, door);
1377 return room;
1378}
1379
1380
1381void
1383{
1384 struct GNUNET_MESSENGER_Message *message;
1385
1386 if (! room)
1387 return;
1388
1389 message = create_message_leave ();
1390
1391 if (! message)
1392 return;
1393
1394 enqueue_message_to_room (room, NULL, message, NULL, GNUNET_YES);
1395}
1396
1397
1399{
1402 size_t counter;
1403 void *cls;
1404};
1405
1406static enum GNUNET_GenericReturnValue
1408 const struct GNUNET_HashCode *key,
1409 void *value)
1410{
1411 struct GNUNET_MESSENGER_RoomFind *find;
1412 struct GNUNET_MESSENGER_Room *room;
1414
1415 GNUNET_assert ((cls) && (value));
1416
1417 find = cls;
1418 room = value;
1420
1421 if ((! find->contact) ||
1422 (GNUNET_YES == find_room_member (room, find->contact)))
1423 find->counter--;
1424
1425 if (find->callback)
1426 result = find->callback (find->cls, room, find->contact);
1427
1428 if (find->counter <= 0)
1429 result = GNUNET_NO;
1430
1431 return result;
1432}
1433
1434
1435int
1437 const struct GNUNET_MESSENGER_Contact *contact,
1439 void *cls)
1440{
1441 struct GNUNET_MESSENGER_RoomFind find;
1442
1443 if (! handle)
1444 return GNUNET_SYSERR;
1445
1446 find.contact = contact;
1447 find.callback = callback;
1448 find.counter = (contact? contact->rc : SIZE_MAX);
1449 find.cls = cls;
1450
1451 if (find.counter <= 0)
1452 return 0;
1453
1455 iterate_find_room, &find);
1456}
1457
1458
1459const struct GNUNET_HashCode*
1461{
1462 if (! room)
1463 return NULL;
1464
1465 return get_room_key (room);
1466}
1467
1468
1469const struct GNUNET_MESSENGER_Contact*
1471 const struct GNUNET_HashCode *hash)
1472{
1473 if ((! room) || (! hash))
1474 return NULL;
1475
1476 return get_room_sender (room, hash);
1477}
1478
1479
1480const struct GNUNET_MESSENGER_Contact*
1482 const struct GNUNET_HashCode *hash)
1483{
1484 if ((! room) || (! hash))
1485 return NULL;
1486
1487 return get_room_recipient (room, hash);
1488}
1489
1490
1491const char*
1493 GNUNET_MESSENGER_Contact *contact)
1494{
1495 if (! contact)
1496 return NULL;
1497
1498 return get_contact_name (contact);
1499}
1500
1501
1502const struct GNUNET_CRYPTO_PublicKey*
1504 GNUNET_MESSENGER_Contact *contact)
1505{
1506 if (! contact)
1507 return NULL;
1508
1509 return get_non_anonymous_key (get_contact_key (contact));
1510}
1511
1512
1513size_t
1515 GNUNET_MESSENGER_Contact *contact)
1516{
1517 if (! contact)
1518 return 0;
1519
1520 return get_contact_id (contact);
1521}
1522
1523
1524static void
1526 struct GNUNET_MESSENGER_Message *message,
1527 const struct GNUNET_CRYPTO_PublicKey *public_key)
1528{
1529 struct GNUNET_MESSENGER_Message *transcript;
1530 const struct GNUNET_CRYPTO_PublicKey *pubkey;
1531 const char *handle_name;
1532 char *original_name;
1533
1534 transcript = NULL;
1535
1536 if (GNUNET_MESSENGER_KIND_NAME != message->header.kind)
1537 goto skip_naming;
1538
1539 original_name = message->body.name.name;
1541 "Apply rule for using handle name in room: %s\n", GNUNET_h2s (
1542 get_room_key (room)));
1543
1544 handle_name = get_handle_name (room->handle);
1545
1546 if ((handle_name) && (GNUNET_YES == room->use_handle_name) &&
1547 ((! original_name) || (0 == strlen (original_name))))
1548 {
1549 if (original_name)
1550 GNUNET_free (original_name);
1551
1552 message->body.name.name = GNUNET_strdup (handle_name);
1553 }
1554
1555skip_naming:
1556 if (! public_key)
1557 goto skip_encryption;
1558
1560
1561 if (0 != GNUNET_memcmp (pubkey, public_key))
1562 transcript = transcribe_message (message, public_key);
1563
1564 if (GNUNET_YES != encrypt_message (message, public_key))
1565 {
1567 "Sending message aborted: Encryption failed!\n");
1568
1569 if (transcript)
1570 destroy_message (transcript);
1571
1572 destroy_message (message);
1573 return;
1574 }
1575
1576skip_encryption:
1577 enqueue_message_to_room (room, NULL, message, transcript, GNUNET_NO);
1578}
1579
1580
1581void
1583 const struct GNUNET_MESSENGER_Message *message,
1584 const struct GNUNET_MESSENGER_Contact *contact)
1585{
1586 const struct GNUNET_CRYPTO_PublicKey *public_key;
1587
1588 if ((! room) || (! message))
1589 return;
1590
1591 switch (filter_message_sending (message))
1592 {
1593 case GNUNET_SYSERR:
1595 "Sending message aborted: This kind of message is reserved for the service!\n");
1596 return;
1597 case GNUNET_NO:
1599 "Sending message aborted: This kind of message could cause issues!\n");
1600 return;
1601 default:
1602 break;
1603 }
1604
1605 if (contact)
1606 {
1607 public_key = get_non_anonymous_key (
1608 get_contact_key (contact));
1609
1610 if (! public_key)
1611 {
1613 "Sending message aborted: Invalid key!\n");
1614 return;
1615 }
1616 }
1617 else
1618 public_key = NULL;
1619
1620 send_message_to_room_with_key (room, copy_message (message), public_key);
1621}
1622
1623
1624void
1626 const struct GNUNET_HashCode *hash,
1627 const struct GNUNET_TIME_Relative delay)
1628{
1629 const struct GNUNET_MESSENGER_Message *message;
1630
1631 if ((! room) || (! hash))
1632 return;
1633
1634 message = get_room_message (room, hash);
1635
1636 if ((message) && (GNUNET_YES == is_epoch_message (message)))
1637 {
1639 "Deletion of message is not allowed!\n");
1640 return;
1641 }
1642
1643 delete_room_message (room, hash, delay);
1644}
1645
1646
1647void
1649 const struct GNUNET_HashCode *hash)
1650{
1652 struct GNUNET_MQ_Envelope *env;
1653
1654 GNUNET_assert ((room) && (hash));
1655
1656 if (GNUNET_is_zero (hash))
1657 return;
1658
1659 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request message (%s)!\n",
1660 GNUNET_h2s (hash));
1661
1663 GNUNET_memcpy (&(msg->key), get_room_key (room), sizeof(msg->key));
1664 GNUNET_memcpy (&(msg->hash), hash, sizeof(*hash));
1665 GNUNET_MQ_send (room->handle->mq, env);
1666}
1667
1668
1669const struct GNUNET_MESSENGER_Message*
1671 const struct GNUNET_HashCode *hash)
1672{
1673 const struct GNUNET_MESSENGER_Message *message;
1674
1675 if ((! room) || (! hash) || (GNUNET_is_zero (hash)))
1676 return NULL;
1677
1678 message = get_room_message (room, hash);
1679
1680 if (! message)
1681 {
1682 if ((GNUNET_YES == room->joined) && (get_room_sender_id (room)))
1683 request_message_from_room (room, hash);
1684 else
1685 require_message_from_room (room, hash);
1686 }
1687
1688 return message;
1689}
1690
1691
1692int
1695 void *cls)
1696{
1697 if (! room)
1698 return GNUNET_SYSERR;
1699
1700 return iterate_room_members (room, callback, cls);
1701}
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 char * name
Name (label) of the records to list.
static struct GNUNET_CRYPTO_PublicKey pubkey
Public key of the zone to look in.
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_PrivateKey *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.
Definition: crypto_hash.c:218
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multishortmap_put(struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
void * GNUNET_CONTAINER_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.
ssize_t GNUNET_CRYPTO_public_key_get_length(const struct GNUNET_CRYPTO_PublicKey *key)
Get the compacted length of a GNUNET_CRYPTO_PublicKey.
Definition: crypto_pkey.c:85
#define GNUNET_log(kind,...)
char * GNUNET_CRYPTO_public_key_to_string(const struct GNUNET_CRYPTO_PublicKey *key)
Creates a (Base32) string representation of the public key.
Definition: crypto_pkey.c:379
ssize_t GNUNET_CRYPTO_write_public_key_to_buffer(const struct GNUNET_CRYPTO_PublicKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PublicKey to a compact buffer.
Definition: crypto_pkey.c:128
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_key_get_public(const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: crypto_pkey.c:430
ssize_t GNUNET_CRYPTO_private_key_get_length(const struct GNUNET_CRYPTO_PrivateKey *key)
Get the compacted length of a GNUNET_CRYPTO_PrivateKey.
Definition: crypto_pkey.c:64
#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.
GNUNET_GenericReturnValue
Named constants for return values.
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.
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.
Definition: messenger_api.c:46
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.
struct GNUNET_MESSENGER_Handle * GNUNET_MESSENGER_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, const struct GNUNET_CRYPTO_PrivateKey *key, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
Set up a handle for the messenger related functions and connects to all necessary services.
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_CRYPTO_PublicKey * 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.
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.
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_key(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_CRYPTO_PrivateKey *key)
Set the private key used by the messenger or NULL if the anonymous key should be used instead.
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.
const struct GNUNET_CRYPTO_PublicKey * 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.
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 subscribtion 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.
Definition: gnunet_mq_lib.h:61
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:76
#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:630
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:640
#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 send_message_to_room(struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_PrivateKey *key, const struct GNUNET_HashCode *epoch, struct GNUNET_HashCode *hash)
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 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 send_message_to_room_with_key(struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_PublicKey *public_key)
static void handle_room_entry(void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
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_PublicKey * get_non_anonymous_key(const struct GNUNET_CRYPTO_PublicKey *public_key)
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 void reconnect(struct GNUNET_MESSENGER_Handle *handle)
static enum GNUNET_GenericReturnValue iterate_reset_room(void *cls, const struct GNUNET_HashCode *key, void *value)
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_PublicKey * get_contact_key(const struct GNUNET_MESSENGER_Contact *contact)
Returns the 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.
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.
struct GNUNET_MESSENGER_Handle * create_handle(const struct GNUNET_CONFIGURATION_Handle *config, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
Creates and allocates a new handle using a given configuration and a custom message callback with a g...
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 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_Room * get_handle_room(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Returns the room known to a handle identified by a given key.
void set_handle_key(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_CRYPTO_PrivateKey *key)
Sets the keypair of a given handle to the keypair of a specific private key.
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_PrivateKey * get_handle_key(const struct GNUNET_MESSENGER_Handle *handle)
Returns the private key of a given handle.
const struct GNUNET_CRYPTO_PublicKey * get_handle_pubkey(const struct GNUNET_MESSENGER_Handle *handle)
Returns the public key of a given handle.
void clear_list_tunnels(struct GNUNET_MESSENGER_ListTunnels *tunnels)
Clears the list of tunnels peer identities.
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.
void sign_message(struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_PrivateKey *key)
Signs the hash of a message with a given private key and writes the signature into the buffer as well...
enum GNUNET_GenericReturnValue is_service_message(const struct GNUNET_MESSENGER_Message *message)
Returns whether a specific kind of message contains service critical information.
enum GNUNET_GenericReturnValue encrypt_message(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_PublicKey *key)
Encrypts a message using a given public key and replaces its body and kind with the now private encry...
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.
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.
struct GNUNET_MESSENGER_Message * transcribe_message(const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_PublicKey *key)
Transcribes a message as a new transcript message using a given public key from the recipient of the ...
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.
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_leave(void)
Creates and allocates a new leave message.
struct GNUNET_MESSENGER_Message * create_message_subscribtion(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_join(const struct GNUNET_CRYPTO_PrivateKey *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_key(const struct GNUNET_CRYPTO_PrivateKey *key)
Creates and allocates a new key message containing the public key to change to derived from its priva...
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 * dequeue_from_messages(struct GNUNET_MESSENGER_QueueMessages *messages, struct GNUNET_CRYPTO_PrivateKey *sender, struct GNUNET_HashCode *epoch, struct GNUNET_MESSENGER_Message **transcript)
Remove the message from the front of the queue and returns it.
void enqueue_to_messages(struct GNUNET_MESSENGER_QueueMessages *messages, const struct GNUNET_CRYPTO_PrivateKey *sender, 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.
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...
struct GNUNET_MESSENGER_Room * create_room(struct GNUNET_MESSENGER_Handle *handle, const union GNUNET_MESSENGER_RoomKey *key)
Creates and allocates a new room for a handle with a given key for the client API.
void copy_room_last_message(const struct GNUNET_MESSENGER_Room *room, struct GNUNET_HashCode *hash)
Copies the last message hash of a room into a given hash variable.
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_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 ...
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...
void destroy_room(struct GNUNET_MESSENGER_Room *room)
Destroys a room and frees its memory fully from the client API.
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_PublicKey * 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
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
uint32_t type
Type of signature.
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_MESSENGER_ListTunnel * next
struct GNUNET_MESSENGER_ListTunnel * head
Message to receive the current member id of a handle in room.
struct GNUNET_MESSENGER_MessageSubscribtion subscribtion
struct GNUNET_MESSENGER_MessageName name
struct GNUNET_MESSENGER_MessageLeave leave
struct GNUNET_MESSENGER_MessageTranscript transcript
struct GNUNET_MESSENGER_MessageJoin join
struct GNUNET_HashCode previous
The hash of the previous message from the senders perspective.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.
struct GNUNET_CRYPTO_Signature signature
The signature of the senders private key.
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 subscribtion.
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.