GNUnet 0.27.0
 
Loading...
Searching...
No Matches
gnunet-service-cadet_core.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2017 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 */
20
33#include "gnunet_common.h"
34#include "gnunet_pils_service.h"
35#include "platform.h"
41#include "gnunet_core_service.h"
43#include "cadet_protocol.h"
44
45#define LOG(level, ...) GNUNET_log_from (level, "cadet-cor", __VA_ARGS__)
46
50struct RouteDirection;
51
58struct Rung
59{
63 struct Rung *next;
64
68 struct Rung *prev;
69
74
79
83 unsigned int num_routes;
84
89 unsigned int rung_off;
90};
91
92
97{
102
107
111 struct Rung *rung;
112
117
122
126 struct CadetPeer *hop;
127
132
137
142};
143
144
172
173
178
183
188
192static struct Rung rung_zero;
193
198static struct Rung *rung_head = &rung_zero;
199
203static struct Rung *rung_tail = &rung_zero;
204
208static unsigned long long max_routes;
209
213static unsigned long long max_buffers;
214
218static unsigned long long cur_buffers;
219
224
230static struct CadetRoute *
236
237
243static void
245{
246 struct Rung *rung = dir->rung;
247 struct Rung *prev;
248
250 prev = rung->prev;
251 GNUNET_assert (NULL != prev);
252 if (prev->rung_off != rung->rung_off - 1)
253 {
254 prev = GNUNET_new (struct Rung);
255 prev->rung_off = rung->rung_off - 1;
257 }
258 GNUNET_assert (NULL != prev);
260 dir->rung = prev;
261}
262
263
271static void
273{
274 GNUNET_MQ_dll_remove (&dir->env_head, &dir->env_tail, env);
275 cur_buffers--;
277 lower_rung (dir);
279}
280
281
285static void
287{
288 struct Rung *tail = rung_tail;
289 struct RouteDirection *dir;
290
291 while (NULL != (dir = tail->rd_head))
292 {
294 "Queue full due new message on connection %s, dropping old message\n",
295 GNUNET_sh2s (&dir->my_route->cid.connection_of_tunnel));
297 "# messages dropped due to full buffer",
298 1,
299 GNUNET_NO);
300 discard_buffer (dir, dir->env_head);
301 }
303 GNUNET_free (tail);
304}
305
306
316static void
319 const struct GNUNET_MessageHeader *msg,
320 const enum GNUNET_MQ_PriorityPreferences priority)
321{
322 const struct GNUNET_PeerIdentity *my_identity;
323 struct CadetRoute *route;
324 struct RouteDirection *dir;
325 struct Rung *rung;
326 struct Rung *nxt;
327 struct GNUNET_MQ_Envelope *env;
328
330 if (! my_identity)
331 return;
332
333 route = get_route (cid);
334 if (NULL == route)
335 {
337
339 "Failed to route message of type %u from %s on connection %s: no route\n",
340 ntohs (msg->type),
341 GCP_2s (prev),
343 switch (ntohs (msg->type))
344 {
347 /* No need to respond to these! */
348 return;
349 }
351 bm->cid = *cid;
352 bm->peer1 = *my_identity;
353 GCP_send_ooo (prev, env);
354 return;
355 }
358 dir = (prev == route->prev.hop) ? &route->next : &route->prev;
359 if (GNUNET_YES == dir->is_ready)
360 {
362 "Routing message of type %u from %s to %s on connection %s\n",
363 ntohs (msg->type),
364 GCP_2s (prev),
365 GNUNET_i2s (GCP_get_id (dir->hop)),
367 dir->is_ready = GNUNET_NO;
369 return;
370 }
371 /* Check if low latency is required and if the previous message was
372 unreliable; if so, make sure we only queue one message per
373 direction (no buffering). */
374 if ((0 != (priority & GNUNET_MQ_PREF_LOW_LATENCY)) &&
375 (NULL != dir->env_head) &&
376 (0 ==
378 discard_buffer (dir, dir->env_head);
379 /* Check for duplicates */
380 for (const struct GNUNET_MQ_Envelope *env_tmp = dir->env_head;
381 NULL != env_tmp;
382 env_tmp = GNUNET_MQ_env_next (env_tmp))
383 {
384 const struct GNUNET_MessageHeader *hdr = GNUNET_MQ_env_get_msg (env_tmp);
385
386 if ((hdr->size == msg->size) && (0 == memcmp (hdr, msg, ntohs (msg->size))))
387 {
389 "Received duplicate of message already in buffer, dropping\n");
391 "# messages dropped due to duplicate in buffer",
392 1,
393 GNUNET_NO);
394 return;
395 }
396 }
397
398 rung = dir->rung;
400 {
401 /* Need to make room. */
402 if (NULL != rung->next)
403 {
404 /* Easy case, drop messages from route directions in highest rung */
406 }
407 else
408 {
409 /* We are in the highest rung, drop our own! */
411 "Queue full due new message on connection %s, dropping old message\n",
412 GNUNET_sh2s (&dir->my_route->cid.connection_of_tunnel));
414 "# messages dropped due to full buffer",
415 1,
416 GNUNET_NO);
417 discard_buffer (dir, dir->env_head);
418 rung = dir->rung;
419 }
420 }
421 /* remove 'dir' from current rung */
423 /* make 'nxt' point to the next higher rung, create if necessary */
424 nxt = rung->next;
425 if ((NULL == nxt) || (rung->rung_off + 1 != nxt->rung_off))
426 {
427 nxt = GNUNET_new (struct Rung);
428 nxt->rung_off = rung->rung_off + 1;
430 }
431 /* insert 'dir' into next higher rung */
433 dir->rung = nxt;
434
435 /* add message into 'dir' buffer */
437 "Queueing new message of type %u from %s to %s on connection %s\n",
438 ntohs (msg->type),
439 GCP_2s (prev),
440 GNUNET_i2s (GCP_get_id (dir->hop)),
443 GNUNET_MQ_env_set_options (env, priority);
444 if ((0 != (priority & GNUNET_MQ_PREF_LOW_LATENCY)) &&
445 (0 != (priority & GNUNET_MQ_PREF_OUT_OF_ORDER)) &&
446 (NULL != dir->env_head) &&
447 (0 == (GNUNET_MQ_env_get_options (dir->env_head)
449 GNUNET_MQ_dll_insert_head (&dir->env_head, &dir->env_tail, env);
450 else
451 GNUNET_MQ_dll_insert_tail (&dir->env_head, &dir->env_tail, env);
452 cur_buffers++;
454 /* Clean up 'rung' if now empty (and not head) */
455 if ((NULL == rung->rd_head) && (rung != rung_head))
456 {
458 GNUNET_free (rung);
459 }
460}
461
462
471static int
474{
475 uint16_t size = ntohs (msg->header.size) - sizeof(*msg);
476
477 if (0 != (size % sizeof(struct GNUNET_PeerIdentity)))
478 {
479 GNUNET_break_op (0);
480 return GNUNET_NO;
481 }
482 return GNUNET_YES;
483}
484
485
491static void
493{
494 struct GNUNET_MQ_Envelope *env;
495
496 while (NULL != (env = dir->env_head))
497 {
499 "# messages dropped due to route destruction",
500 1,
501 GNUNET_NO);
503 }
504 if (NULL != dir->mqm)
505 {
506 GCP_request_mq_cancel (dir->mqm, NULL);
507 dir->mqm = NULL;
508 }
510}
511
512
518static void
520{
522 "Destroying route from %s to %s of connection %s\n",
523 GNUNET_i2s (GCP_get_id (route->prev.hop)),
524 GNUNET_i2s2 (GCP_get_id (route->next.hop)),
528 GNUNET_YES ==
531 route));
533 "# routes",
535 GNUNET_NO);
536 destroy_direction (&route->prev);
537 destroy_direction (&route->next);
538 GNUNET_free (route);
539}
540
541
550static void
553 const struct GNUNET_PeerIdentity *peer1,
554 const struct GNUNET_PeerIdentity *peer2)
555{
556 struct GNUNET_MQ_Envelope *env;
558
559 if (NULL == target->mqm)
560 return; /* Can't send notification, connection is down! */
562 "Notifying %s about BROKEN route at %s-%s of connection %s\n",
563 GCP_2s (target->hop),
567
569 bm->cid = *cid;
570 if (NULL != peer1)
571 bm->peer1 = *peer1;
572 if (NULL != peer2)
573 bm->peer2 = *peer2;
574 GCP_request_mq_cancel (target->mqm, env);
575 target->mqm = NULL;
576}
577
578
586static void
587timeout_cb (void *cls)
588{
589 struct CadetRoute *r;
590 struct GNUNET_TIME_Relative linger;
591 struct GNUNET_TIME_Absolute exp;
592
593 timeout_task = NULL;
595 while (NULL != (r = GNUNET_CONTAINER_heap_peek (route_heap)))
596 {
597 exp = GNUNET_TIME_absolute_add (r->last_use, linger);
598 if (0 != GNUNET_TIME_absolute_get_remaining (exp).rel_value_us)
599 {
600 /* Route not yet timed out, wait until it does. */
602 return;
603 }
605 "Sending BROKEN due to timeout (%s was last use, %s linger)\n",
608 send_broken (&r->prev, &r->cid, NULL, NULL);
609 send_broken (&r->next, &r->cid, NULL, NULL);
610 destroy_route (r);
611 }
612 /* No more routes left, so no need for a #timeout_task */
613}
614
615
628static void
629dir_ready_cb (void *cls, int ready)
630{
631 const struct GNUNET_PeerIdentity *my_identity;
632 struct RouteDirection *dir = cls;
633 struct CadetRoute *route = dir->my_route;
634 struct RouteDirection *odir;
635
637 if (! my_identity)
638 return;
639
640 if (GNUNET_YES == ready)
641 {
642 struct GNUNET_MQ_Envelope *env;
643
644 dir->is_ready = GNUNET_YES;
645 if (NULL != (env = dir->env_head))
646 {
647 GNUNET_MQ_dll_remove (&dir->env_head, &dir->env_tail, env);
648 cur_buffers--;
650 lower_rung (dir);
651 dir->is_ready = GNUNET_NO;
652 GCP_send (dir->mqm, env);
653 }
654 return;
655 }
656 odir = (dir == &route->next) ? &route->prev : &route->next;
657 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending BROKEN due to MQ going down\n");
658 send_broken (&route->next, &route->cid, GCP_get_id (odir->hop), my_identity);
659 destroy_route (route);
660}
661
662
670static void
672 struct CadetRoute *route,
673 struct CadetPeer *hop)
674{
675 dir->hop = hop;
676 dir->my_route = route;
677 dir->mqm = GCP_request_mq (hop, &dir_ready_cb, dir);
679 dir->rung = rung_head;
680 GNUNET_assert (GNUNET_YES == dir->is_ready);
681}
682
683
694static void
696 struct CadetPeer *target,
698 const struct GNUNET_PeerIdentity *failure_at)
699{
700 const struct GNUNET_PeerIdentity *my_identity;
701 struct GNUNET_MQ_Envelope *env;
703
706
708 bm->cid = *cid;
709 bm->peer1 = *my_identity;
710 if (NULL != failure_at)
711 bm->peer2 = *failure_at;
712 GCP_send_ooo (target, env);
713}
714
715
722static void
724 void *cls,
726{
727 const struct GNUNET_PeerIdentity *my_identity;
728 struct CadetPeer *sender = cls;
729 struct CadetPeer *next;
730 const struct GNUNET_PeerIdentity *pids =
731 (const struct GNUNET_PeerIdentity *) &msg[1];
732 struct CadetRoute *route;
733 uint16_t size = ntohs (msg->header.size) - sizeof(*msg);
734 unsigned int path_length;
735 unsigned int off;
736 struct CadetTunnel *t;
737
739 if (! my_identity)
740 return;
741
742 path_length = size / sizeof(struct GNUNET_PeerIdentity);
743 if (0 == path_length)
744 {
746 "Dropping CADET_CONNECTION_CREATE with empty path\n");
747 GNUNET_break_op (0);
748 return;
749 }
751 "Handling CADET_CONNECTION_CREATE from %s for CID %s with %u hops\n",
752 GCP_2s (sender),
753 GNUNET_sh2s (&msg->cid.connection_of_tunnel),
754 path_length);
755 /* Check for loops */
756 {
758
760 GNUNET_assert (NULL != map);
761 for (unsigned int i = 0; i < path_length; i++)
762 {
764 "CADET_CONNECTION_CREATE has peer %s at offset %u\n",
765 GNUNET_i2s (&pids[i]),
766 i);
768 map,
769 &pids[i],
770 NULL,
772 {
773 /* bogus request */
776 "Dropping CADET_CONNECTION_CREATE with cyclic path\n");
777 GNUNET_break_op (0);
778 return;
779 }
780 }
782 }
783 /* Initiator is at offset 0, find us */
784 for (off = 1; off < path_length; off++)
785 if (0 == GNUNET_memcmp (my_identity, &pids[off]))
786 break;
787 if (off == path_length)
788 {
790 "Dropping CADET_CONNECTION_CREATE without us in the path\n");
791 GNUNET_break_op (0);
792 return;
793 }
794 /* Check previous hop */
795 if (sender != GCP_get (&pids[off - 1], GNUNET_NO))
796 {
798 "Dropping CADET_CONNECTION_CREATE without sender at previous hop in the path\n");
799 GNUNET_break_op (0);
800 return;
801 }
802 if (NULL != (route = get_route (&msg->cid)))
803 {
804 /* Duplicate CREATE, pass it on, previous one might have been lost! */
805
807 "Passing on duplicate CADET_CONNECTION_CREATE message on connection %s\n",
808 GNUNET_sh2s (&msg->cid.connection_of_tunnel));
809 route_message (sender,
810 &msg->cid,
811 &msg->header,
814 return;
815 }
816 if (off == path_length - 1)
817 {
818 /* We are the destination, create connection */
819 struct CadetConnection *cc;
820 struct CadetPeerPath *path;
821 struct CadetPeer *origin;
822
823 cc = GCC_lookup (&msg->cid);
824 if (NULL != cc)
825 {
827 "Received duplicate CADET_CONNECTION_CREATE message on connection %s\n",
828 GNUNET_sh2s (&msg->cid.connection_of_tunnel));
830 return;
831 }
832
833 origin = GCP_get (&pids[0], GNUNET_YES);
835 "I am destination for CADET_CONNECTION_CREATE message from %s for connection %s, building inverse path\n",
836 GCP_2s (origin),
837 GNUNET_sh2s (&msg->cid.connection_of_tunnel));
838 path = GCPP_get_path_from_route (path_length - 1, pids);
840
841 // Check for CADET state in case the other side has lost the tunnel (xrs,t3ss)
842 if ((GNUNET_YES == msg->has_monotime) &&
846 {
848 }
849
850 if (GNUNET_OK !=
852 &msg->cid,
853 path))
854 {
855 /* Send back BROKEN: duplicate connection on the same path,
856 we will use the other one. */
858 "Received CADET_CONNECTION_CREATE from %s for %s, but %s already has a connection. Sending BROKEN\n",
859 GCP_2s (sender),
860 GNUNET_sh2s (&msg->cid.connection_of_tunnel),
861 GCPP_2s (path));
862 send_broken_without_mqm (sender, &msg->cid, NULL);
863 return;
864 }
865 return;
866 }
867 /* We are merely a hop on the way, check if we can support the route */
868 next = GCP_get (&pids[off + 1], GNUNET_NO);
869 if ((NULL == next) || (GNUNET_NO == GCP_has_core_connection (next)))
870 {
871 /* unworkable, send back BROKEN notification */
873 "Received CADET_CONNECTION_CREATE from %s for %s. Next hop %s:%u is down. Sending BROKEN\n",
874 GCP_2s (sender),
875 GNUNET_sh2s (&msg->cid.connection_of_tunnel),
876 GNUNET_i2s (&pids[off + 1]),
877 off + 1);
878 send_broken_without_mqm (sender, &msg->cid, &pids[off + 1]);
879 return;
880 }
882 {
884 "Received CADET_CONNECTION_CREATE from %s for %s. We have reached our route limit. Sending BROKEN\n",
885 GCP_2s (sender),
886 GNUNET_sh2s (&msg->cid.connection_of_tunnel));
887 send_broken_without_mqm (sender, &msg->cid, &pids[off - 1]);
888 return;
889 }
890
891 /* Workable route, create routing entry */
893 "Received CADET_CONNECTION_CREATE from %s for %s. Next hop %s:%u is up. Creating route\n",
894 GCP_2s (sender),
895 GNUNET_sh2s (&msg->cid.connection_of_tunnel),
896 GNUNET_i2s (&pids[off + 1]),
897 off + 1);
898 route = GNUNET_new (struct CadetRoute);
899 route->cid = msg->cid;
901 dir_init (&route->prev, route, sender);
902 dir_init (&route->next, route, next);
905 routes,
907 route,
910 "# routes",
912 GNUNET_NO);
914 route,
915 route->last_use.abs_value_us);
916 if (NULL == timeout_task)
920 3),
921 &timeout_cb,
922 NULL);
923 /* also pass CREATE message along to next hop */
924 route_message (sender,
925 &msg->cid,
926 &msg->header,
928}
929
930
937static void
939 void *cls,
941{
942 struct CadetPeer *peer = cls;
943 struct CadetConnection *cc;
944
945 /* First, check if ACK belongs to a connection that ends here. */
946 cc = GCC_lookup (&msg->cid);
947 if (NULL != cc)
948 {
949 /* verify ACK came from the right direction */
950 unsigned int len;
951 struct CadetPeerPath *path = GCC_get_path (cc, &len);
952
953 if (peer != GCPP_get_peer_at_offset (path, 0))
954 {
955 /* received ACK from unexpected direction, ignore! */
956 GNUNET_break_op (0);
957 return;
958 }
960 "Received CONNECTION_CREATE_ACK for connection %s.\n",
961 GNUNET_sh2s (&msg->cid.connection_of_tunnel));
963 return;
964 }
965
966 /* We're just an intermediary peer, route the message along its path */
967 route_message (peer,
968 &msg->cid,
969 &msg->header,
971}
972
973
981static void
983 void *cls,
985{
986 struct CadetPeer *peer = cls;
987 struct CadetConnection *cc;
988 struct CadetRoute *route;
989
990 /* First, check if message belongs to a connection that ends here. */
991 cc = GCC_lookup (&msg->cid);
992 if (NULL != cc)
993 {
994 /* verify message came from the right direction */
995 unsigned int len;
996 struct CadetPeerPath *path = GCC_get_path (cc, &len);
997
998 if (peer != GCPP_get_peer_at_offset (path, 0))
999 {
1000 /* received message from unexpected direction, ignore! */
1001 GNUNET_break_op (0);
1002 return;
1003 }
1005 "Received CONNECTION_BROKEN for connection %s. Destroying it.\n",
1006 GNUNET_sh2s (&msg->cid.connection_of_tunnel));
1008
1009 /* FIXME: also destroy the path up to the specified link! */
1010 return;
1011 }
1012
1013 /* We're just an intermediary peer, route the message along its path */
1014 route_message (peer,
1015 &msg->cid,
1016 &msg->header,
1018 route = get_route (&msg->cid);
1019 if (NULL != route)
1020 destroy_route (route);
1021 /* FIXME: also destroy paths we MAY have up to the specified link! */
1022}
1023
1024
1031static void
1033 void *cls,
1035{
1036 struct CadetPeer *peer = cls;
1037 struct CadetConnection *cc;
1038 struct CadetRoute *route;
1039
1040 /* First, check if message belongs to a connection that ends here. */
1041 cc = GCC_lookup (&msg->cid);
1042 if (NULL != cc)
1043 {
1044 /* verify message came from the right direction */
1045 unsigned int len;
1046 struct CadetPeerPath *path = GCC_get_path (cc, &len);
1047
1048 if (peer != GCPP_get_peer_at_offset (path, 0))
1049 {
1050 /* received message from unexpected direction, ignore! */
1051 GNUNET_break_op (0);
1052 return;
1053 }
1055 "Received CONNECTION_DESTROY for connection %s. Destroying connection.\n",
1056 GNUNET_sh2s (&msg->cid.connection_of_tunnel));
1057
1059 return;
1060 }
1061
1062 /* We're just an intermediary peer, route the message along its path */
1064 "Received CONNECTION_DESTROY for connection %s. Destroying route.\n",
1065 GNUNET_sh2s (&msg->cid.connection_of_tunnel));
1066 route_message (peer,
1067 &msg->cid,
1068 &msg->header,
1070 route = get_route (&msg->cid);
1071 if (NULL != route)
1072 destroy_route (route);
1073}
1074
1075
1082static void
1085{
1086 struct CadetPeer *peer = cls;
1087 struct CadetConnection *cc;
1088
1089 /* First, check if message belongs to a connection that ends here. */
1091 "Routing KX with ephemeral %s on CID %s\n",
1092 GNUNET_e2s (&msg->ephemeral_key),
1093 GNUNET_sh2s (&msg->cid.connection_of_tunnel));
1094
1095
1096 cc = GCC_lookup (&msg->cid);
1097 if (NULL != cc)
1098 {
1099 /* verify message came from the right direction */
1100 unsigned int len;
1101 struct CadetPeerPath *path = GCC_get_path (cc, &len);
1102
1103 if (peer != GCPP_get_peer_at_offset (path, 0))
1104 {
1105 /* received message from unexpected direction, ignore! */
1106 GNUNET_break_op (0);
1107 return;
1108 }
1109 GCC_handle_kx (cc, msg);
1110 return;
1111 }
1112
1113 /* We're just an intermediary peer, route the message along its path */
1114 route_message (peer,
1115 &msg->cid,
1116 &msg->header,
1118}
1119
1120
1127static void
1129 void *cls,
1131{
1132 struct CadetPeer *peer = cls;
1133 struct CadetConnection *cc;
1134
1135 /* First, check if message belongs to a connection that ends here. */
1136 cc = GCC_lookup (&msg->kx.cid);
1137 if (NULL != cc)
1138 {
1139 /* verify message came from the right direction */
1140 unsigned int len;
1141 struct CadetPeerPath *path = GCC_get_path (cc, &len);
1142
1143 if (peer != GCPP_get_peer_at_offset (path, 0))
1144 {
1145 /* received message from unexpected direction, ignore! */
1146 GNUNET_break_op (0);
1147 return;
1148 }
1149 GCC_handle_kx_auth (cc, msg);
1150 return;
1151 }
1152
1153 /* We're just an intermediary peer, route the message along its path */
1154 route_message (peer,
1155 &msg->kx.cid,
1156 &msg->kx.header,
1158}
1159
1160
1169static int
1172{
1173 return GNUNET_YES;
1174}
1175
1176
1183static void
1186{
1187 struct CadetPeer *peer = cls;
1188 struct CadetConnection *cc;
1189
1190 /* First, check if message belongs to a connection that ends here. */
1191 cc = GCC_lookup (&msg->cid);
1192 if (NULL != cc)
1193 {
1194 /* verify message came from the right direction */
1195 unsigned int len;
1196 struct CadetPeerPath *path = GCC_get_path (cc, &len);
1197
1198 if (peer != GCPP_get_peer_at_offset (path, 0))
1199 {
1200 /* received message from unexpected direction, ignore! */
1201 GNUNET_break_op (0);
1202 return;
1203 }
1205 return;
1206 }
1207 /* We're just an intermediary peer, route the message along its path */
1208 route_message (peer, &msg->cid, &msg->header, GNUNET_MQ_PRIO_BEST_EFFORT);
1209}
1210
1211
1219static void *
1221 const struct GNUNET_PeerIdentity *peer,
1222 struct GNUNET_MQ_Handle *mq,
1223 enum GNUNET_CORE_PeerClass class)
1224{
1225 struct CadetPeer *cp;
1226
1228 "CORE connection to peer %s was established.\n",
1229 GNUNET_i2s (peer));
1230 cp = GCP_get (peer, GNUNET_YES);
1231 GCP_set_mq (cp, mq);
1232 return cp;
1233}
1234
1235
1242static void
1244 const struct GNUNET_PeerIdentity *peer,
1245 void *peer_cls)
1246{
1247 struct CadetPeer *cp = peer_cls;
1248
1250 "CORE connection to peer %s went down.\n",
1251 GNUNET_i2s (peer));
1252 GCP_set_mq (cp, NULL);
1253}
1254
1255
1261void
1263{
1268 NULL),
1269 GNUNET_MQ_hd_fixed_size (connection_create_ack,
1272 NULL),
1273 GNUNET_MQ_hd_fixed_size (connection_broken,
1276 NULL),
1280 NULL),
1281 GNUNET_MQ_hd_fixed_size (tunnel_kx,
1284 NULL),
1285 GNUNET_MQ_hd_fixed_size (tunnel_kx_auth,
1288 NULL),
1289 GNUNET_MQ_hd_var_size (tunnel_encrypted,
1292 NULL),
1294 const struct GNUNET_CORE_ServiceInfo service_info = {
1296 .version = { 1, 0 },
1297 .version_max = { 1, 0 },
1298 .version_min = { 1, 0 },
1299 };
1300
1302 "CADET",
1303 "MAX_ROUTES",
1304 &max_routes))
1305 max_routes = 5000;
1307 "CADET",
1308 "MAX_MSGS_QUEUE",
1309 &max_buffers))
1310 max_buffers = 10000;
1314 NULL,
1315 NULL,
1318 handlers,
1319 &service_info);
1320}
1321
1322
1323void
1325{
1326 if (NULL != core)
1327 {
1329 core = NULL;
1330 }
1333 routes = NULL;
1335 route_heap = NULL;
1336 if (NULL != timeout_task)
1337 {
1339 timeout_task = NULL;
1340 }
1341}
1342
1343
1344/* end of gnunet-cadet-service_core.c */
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
P2P messages used by CADET.
static char * dir
Set to the directory where runtime files are stored.
Definition gnunet-arm.c:88
static struct GNUNET_SCHEDULER_Task * t
Main task.
static char origin[GNUNET_DNSPARSER_MAX_NAME_LENGTH]
Current origin.
static struct GNUNET_PILS_Handle * pils
Handle to PILS.
Definition gnunet-pils.c:44
struct GNUNET_TIME_Relative keepalive_period
How frequently do we send KEEPALIVE messages on idle connections?
Information we track per peer.
static struct CadetConnection * connection_create(struct CadetPeer *destination, struct CadetPeerPath *path, unsigned int off, struct CadetTConnection *ct, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, enum CadetConnectionState init_state, GCC_ReadyCallback ready_cb, void *ready_cb_cls)
Create a connection to destination via path and notify cb whenever we are ready for more data.
void GCC_handle_encrypted(struct CadetConnection *cc, const struct GNUNET_CADET_TunnelEncryptedMessage *msg)
Handle encrypted message.
struct CadetPeerPath * GCC_get_path(struct CadetConnection *cc, unsigned int *off)
Obtain the path used by this connection.
void GCC_handle_connection_create_ack(struct CadetConnection *cc)
A GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK was received for this connection,...
void GCC_handle_kx(struct CadetConnection *cc, const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg)
Handle KX message.
void GCC_destroy_without_core(struct CadetConnection *cc)
Destroy a connection, called when the CORE layer is already done (i.e.
void GCC_handle_kx_auth(struct CadetConnection *cc, const struct GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg)
Handle KX_AUTH message.
void GCC_handle_duplicate_create(struct CadetConnection *cc)
We got a GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE for a connection that we already have.
struct CadetConnection * GCC_lookup(const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid)
Lookup a connection by its identifier.
A connection is a live end-to-end messaging mechanism where the peers are identified by a path and kn...
static void * core_connect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq, enum GNUNET_CORE_PeerClass class)
Method called whenever a given peer connects.
static void dir_ready_cb(void *cls, int ready)
Function called when the message queue to the previous hop becomes available/unavailable.
void GCO_shutdown()
Shut down the CORE subsystem.
static struct GNUNET_CORE_Handle * core
Handle to the CORE service.
static unsigned long long cur_buffers
Current number of envelopes we have buffered at this peer.
static void destroy_direction(struct RouteDirection *dir)
Free internal data of a route direction.
static struct Rung * rung_tail
Tail of the rung_head DLL.
static int check_connection_create(void *cls, const struct GNUNET_CADET_ConnectionCreateMessage *msg)
Check if the create_connection message has the appropriate size.
static void dir_init(struct RouteDirection *dir, struct CadetRoute *route, struct CadetPeer *hop)
Initialize one of the directions of a route.
static void handle_tunnel_kx(void *cls, const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg)
Handle for GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX.
static struct Rung rung_zero
Rung zero (always pointed to by rung_head).
static void handle_tunnel_encrypted(void *cls, const struct GNUNET_CADET_TunnelEncryptedMessage *msg)
Handle for GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED.
static void discard_buffer(struct RouteDirection *dir, struct GNUNET_MQ_Envelope *env)
Discard the buffer env from the route direction dir and move dir down a rung.
static void discard_all_from_rung_tail()
Discard all messages from the highest rung, to make space.
static struct Rung * rung_head
DLL of rungs, with the head always point to a rung of route directions with no messages in the queue.
static void route_message(struct CadetPeer *prev, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, const struct GNUNET_MessageHeader *msg, const enum GNUNET_MQ_PriorityPreferences priority)
We message msg from prev.
void GCO_init(const struct GNUNET_CONFIGURATION_Handle *c)
Initialize the CORE subsystem.
static int check_tunnel_encrypted(void *cls, const struct GNUNET_CADET_TunnelEncryptedMessage *msg)
Check if the encrypted message has the appropriate size.
static void send_broken_without_mqm(struct CadetPeer *target, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, const struct GNUNET_PeerIdentity *failure_at)
We could not create the desired route.
static void handle_connection_create(void *cls, const struct GNUNET_CADET_ConnectionCreateMessage *msg)
Handle for GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE.
static void timeout_cb(void *cls)
Function called to check if any routes have timed out, and if so, to clean them up.
static void destroy_route(struct CadetRoute *route)
Destroy our state for route.
static struct CadetRoute * get_route(const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid)
Get the route corresponding to a hash.
static struct GNUNET_CONTAINER_Heap * route_heap
Heap of routes, MIN-sorted by last activity.
static unsigned long long max_routes
Maximum number of concurrent routes this peer will support.
static void core_disconnect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, void *peer_cls)
Method called whenever a peer disconnects.
static void handle_tunnel_kx_auth(void *cls, const struct GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg)
Handle for GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX_AUTH.
static struct GNUNET_CONTAINER_MultiShortmap * routes
Routes on which this peer is an intermediate.
static void send_broken(struct RouteDirection *target, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, const struct GNUNET_PeerIdentity *peer1, const struct GNUNET_PeerIdentity *peer2)
Send message that a route is broken between peer1 and peer2.
static void lower_rung(struct RouteDirection *dir)
Lower the rung in which dir is by 1.
static void handle_connection_broken(void *cls, const struct GNUNET_CADET_ConnectionBrokenMessage *msg)
Handle for GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN.
static void handle_connection_destroy(void *cls, const struct GNUNET_CADET_ConnectionDestroyMessage *msg)
Handle for GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY.
static struct GNUNET_SCHEDULER_Task * timeout_task
Task to timeout routes.
#define LOG(level,...)
static void handle_connection_create_ack(void *cls, const struct GNUNET_CADET_ConnectionCreateAckMessage *msg)
Handle for GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK.
static unsigned long long max_buffers
Maximum number of envelopes we will buffer at this peer.
cadet service; interaction with CORE service
const char * GCPP_2s(struct CadetPeerPath *path)
Convert a path to a human-readable string.
struct CadetPeer * GCPP_get_peer_at_offset(struct CadetPeerPath *path, unsigned int off)
Obtain the peer at offset off in path.
struct CadetPeerPath * GCPP_get_path_from_route(unsigned int path_length, const struct GNUNET_PeerIdentity *pids)
We got an incoming connection, obtain the corresponding path.
int GCP_check_monotime_sig(struct CadetPeer *peer, const struct GNUNET_CADET_ConnectionCreateMessage *msg)
Checking the signature for a monotime of a GNUNET_CADET_ConnectionCreateMessage.
const struct GNUNET_PeerIdentity * GCP_get_id(struct CadetPeer *cp)
Obtain the peer identity for a struct CadetPeer.
struct CadetPeer * GCP_get(const struct GNUNET_PeerIdentity *peer_id, int create)
Retrieve the CadetPeer structure associated with the peer.
int GCP_has_core_connection(struct CadetPeer *cp)
Test if cp has a core-level connection.
struct CadetTunnel * GCP_get_tunnel(struct CadetPeer *cp, int create)
Get the tunnel towards a peer.
void GCP_send_ooo(struct CadetPeer *cp, struct GNUNET_MQ_Envelope *env)
Send the message in env to cp, overriding queueing logic.
int GCP_check_and_update_monotime(struct CadetPeer *peer, struct GNUNET_TIME_AbsoluteNBO monotime)
Checking if a monotime value is newer than the last monotime value received from a peer.
void GCP_request_mq_cancel(struct GCP_MessageQueueManager *mqm, struct GNUNET_MQ_Envelope *last_env)
Stops message queue change notifications.
void GCP_set_mq(struct CadetPeer *cp, struct GNUNET_MQ_Handle *mq)
Set the message queue to mq for peer cp and notify watchers.
void GCP_send(struct GCP_MessageQueueManager *mqm, struct GNUNET_MQ_Envelope *env)
Send the message in env to cp.
const char * GCP_2s(const struct CadetPeer *cp)
Get the static string for a peer ID.
struct GCP_MessageQueueManager * GCP_request_mq(struct CadetPeer *cp, GCP_MessageQueueNotificationCallback cb, void *cb_cls)
Start message queue change notifications.
Information we track per peer.
void GCT_change_estate(struct CadetTunnel *t, enum CadetTunnelEState state)
Change the tunnel encryption state.
int GCT_add_inbound_connection(struct CadetTunnel *t, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, struct CadetPeerPath *path)
Add a connection to the tunnel.
enum CadetTunnelEState GCT_get_estate(struct CadetTunnel *t)
Get the encryption state of a tunnel.
Information we track per tunnel.
@ CADET_TUNNEL_KEY_UNINITIALIZED
Uninitialized status, we need to send KX.
@ CADET_TUNNEL_KEY_OK
Handshake completed: session key available.
static struct GNUNET_PeerIdentity my_identity
Identity of this peer.
static struct GNUNET_STATISTICS_Handle * stats
Handle to the statistics service.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
Core service; the main API for encrypted P2P communications.
const struct GNUNET_PeerIdentity * GNUNET_PILS_get_identity(const struct GNUNET_PILS_Handle *handle)
Return the current peer identity of a given handle.
Definition pils_api.c:727
API to create, modify and access statistics.
static void connection_destroy(struct Connection *connection)
Destroy a connection.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
struct GNUNET_CORE_Handle * GNUNET_CORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, GNUNET_CORE_StartupCallback init, GNUNET_CORE_ConnectEventHandler connects, GNUNET_CORE_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers, const struct GNUNET_CORE_ServiceInfo *service_info)
Connect to the core service.
Definition core_api.c:698
GNUNET_CORE_PeerClass
The peer class gives a hint about the capabilities of a peer.
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
Definition core_api.c:744
@ GNUNET_CORE_SERVICE_CADET
Identifier for cadet service.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_after(head, tail, other, element)
Insert an element into a DLL after the given other element.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
struct GNUNET_CONTAINER_MultiShortmap * GNUNET_CONTAINER_multishortmap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multishortmap_put(struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
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.
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
void GNUNET_CONTAINER_multishortmap_destroy(struct GNUNET_CONTAINER_MultiShortmap *map)
Destroy a hash map.
unsigned int GNUNET_CONTAINER_multishortmap_size(const struct GNUNET_CONTAINER_MultiShortmap *map)
Get the number of key-value pairs in the map.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
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_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
void * GNUNET_CONTAINER_heap_remove_node(struct GNUNET_CONTAINER_HeapNode *node)
Removes a node from the heap.
void * GNUNET_CONTAINER_heap_peek(const struct GNUNET_CONTAINER_Heap *heap)
Get element stored at the root of heap.
void GNUNET_CONTAINER_heap_update_cost(struct GNUNET_CONTAINER_HeapNode *node, GNUNET_CONTAINER_HeapCostType new_cost)
Updates the cost of any node in the tree.
struct GNUNET_CONTAINER_HeapNode * GNUNET_CONTAINER_heap_insert(struct GNUNET_CONTAINER_Heap *heap, void *element, GNUNET_CONTAINER_HeapCostType cost)
Inserts a new element into the heap.
struct GNUNET_CONTAINER_Heap * GNUNET_CONTAINER_heap_create(enum GNUNET_CONTAINER_HeapOrder order)
Create a new heap.
void GNUNET_CONTAINER_heap_destroy(struct GNUNET_CONTAINER_Heap *heap)
Destroys the heap.
@ GNUNET_CONTAINER_HEAP_ORDER_MIN
Heap with the minimum cost at the root.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
#define GNUNET_log(kind,...)
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
const char * GNUNET_e2s(const struct GNUNET_CRYPTO_EcdhePublicKey *p)
Convert a public key value to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
const char * GNUNET_sh2s(const struct GNUNET_ShortHashCode *shc)
Convert a short hash value to a string (for printing debug messages).
const char * GNUNET_i2s2(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_DEBUG
@ GNUNET_ERROR_TYPE_INFO
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_MQ_Envelope * GNUNET_MQ_msg_copy(const struct GNUNET_MessageHeader *hdr)
Create a new envelope by copying an existing message.
Definition mq.c:550
void GNUNET_MQ_dll_remove(struct GNUNET_MQ_Envelope **env_head, struct GNUNET_MQ_Envelope **env_tail, struct GNUNET_MQ_Envelope *env)
Remove env from the envelope DLL starting at env_head.
Definition mq.c:963
void GNUNET_MQ_env_set_options(struct GNUNET_MQ_Envelope *env, enum GNUNET_MQ_PriorityPreferences pp)
Set application-specific options for this envelope.
Definition mq.c:847
void GNUNET_MQ_dll_insert_head(struct GNUNET_MQ_Envelope **env_head, struct GNUNET_MQ_Envelope **env_tail, struct GNUNET_MQ_Envelope *env)
Insert env into the envelope DLL starting at env_head Note that env must not be in any MQ while this ...
Definition mq.c:941
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
void GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm)
Discard the message queue message, free all allocated resources.
Definition mq.c:285
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
const struct GNUNET_MQ_Envelope * GNUNET_MQ_env_next(const struct GNUNET_MQ_Envelope *env)
Return next envelope in queue.
Definition mq.c:903
GNUNET_MQ_PriorityPreferences
Per envelope preferences and priorities.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
const struct GNUNET_MessageHeader * GNUNET_MQ_env_get_msg(const struct GNUNET_MQ_Envelope *env)
Obtain message contained in envelope.
Definition mq.c:896
enum GNUNET_MQ_PriorityPreferences GNUNET_MQ_env_get_options(struct GNUNET_MQ_Envelope *env)
Get performance preferences set for this envelope.
Definition mq.c:856
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_dll_insert_tail(struct GNUNET_MQ_Envelope **env_head, struct GNUNET_MQ_Envelope **env_tail, struct GNUNET_MQ_Envelope *env)
Insert env into the envelope DLL starting at env_head Note that env must not be in any MQ while this ...
Definition mq.c:952
@ GNUNET_MQ_PREF_OUT_OF_ORDER
Flag to indicate that out-of-order delivery is OK.
@ GNUNET_MQ_PRIO_CRITICAL_CONTROL
Highest priority, control traffic (e.g.
@ GNUNET_MQ_PREF_UNRELIABLE
Flag to indicate that unreliable delivery is acceptable.
@ GNUNET_MQ_PREF_LOW_LATENCY
Flag to indicate that low latency is important.
@ GNUNET_MQ_PRIO_BEST_EFFORT
Best-effort traffic (e.g.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK
Send origin an ACK that the connection is complete.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
Notify that a connection is no longer valid.
#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX
Axolotl key exchange.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
Request the destruction of a connection.
#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX_AUTH
Axolotl key exchange response with authentication.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
Request the creation of a connection.
#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED
Axolotl encrypted data.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_at(struct GNUNET_TIME_Absolute at, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run at the specified time.
Definition scheduler.c:1260
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
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition time.c:406
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition strings.c:604
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(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition time.c:486
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration)
Add a given relative duration to the given start time.
Definition time.c:452
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
Definition strings.c:665
static struct GNUNET_CONTAINER_MultiPeerMap * map
Peermap of PeerIdentities to "struct PeerEntry" (for fast lookup).
Definition peer.c:63
static unsigned int size
Size of the "table".
Definition peer.c:68
static struct GNUNET_MQ_Handle * mq
Our connection to the resolver service, created on-demand, but then persists until error or shutdown.
Low-level connection to a destination.
unsigned int off
Offset of our destination in path.
Information regarding a possible path to reach a peer.
Struct containing all information regarding a given peer.
struct RouteDirection prev
Information about the previous hop on this route.
struct GNUNET_CADET_ConnectionTunnelIdentifier cid
Unique identifier for the connection that uses this route.
struct GNUNET_CONTAINER_HeapNode * hn
Position of this route in the route_heap.
struct RouteDirection next
Information about the next hop on this route.
struct GNUNET_TIME_Absolute last_use
When was this route last in use?
Struct containing all information regarding a tunnel to a peer.
Data structure used to track whom we have to notify about changes to our message queue.
Message for notifying a disconnection in a path.
struct GNUNET_PeerIdentity peer1
ID of the endpoint.
struct GNUNET_CADET_ConnectionTunnelIdentifier cid
ID of the connection.
struct GNUNET_PeerIdentity peer2
ID of the endpoint.
Message for ack'ing a connection.
Message for cadet connection creation.
Message to destroy a connection.
Hash uniquely identifying a connection below a tunnel.
struct GNUNET_ShortHashCode connection_of_tunnel
Axolotl-encrypted tunnel message with application payload.
Message for a Key eXchange for a tunnel, with authentication.
Message for a Key eXchange for a tunnel.
Handle to a node in a heap.
Internal representation of the hash map.
Internal representation of the hash map.
Context for the core service connection.
Definition core_api.c:78
Gnunet service info - identifying compatibility with a range of version of a service communicating ov...
enum GNUNET_CORE_Service service
Identifier of the service on top of CORE.
Handle to a message queue.
Definition mq.c:87
Message handler for a specific message type.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Definition scheduler.c:141
Time for absolute times used by GNUnet, in microseconds.
uint64_t abs_value_us
The actual value.
Time for relative time used by GNUnet, in microseconds.
Information we keep per direction for a route.
struct Rung * rung
Rung of this route direction (matches length of the buffer DLL).
int is_ready
Is mqm currently ready for transmission?
struct RouteDirection * next
DLL of other route directions within the same struct Rung.
struct GNUNET_MQ_Envelope * env_tail
Tail of DLL of envelopes we have in the buffer for this direction.
struct GCP_MessageQueueManager * mqm
Message queue manager for hop.
struct GNUNET_MQ_Envelope * env_head
Head of DLL of envelopes we have in the buffer for this direction.
struct CadetRoute * my_route
Route this direction is part of.
struct CadetPeer * hop
Target peer.
struct RouteDirection * prev
DLL of other route directions within the same struct Rung.
Set of CadetRoutes that have exactly the same number of messages in their buffer.
struct RouteDirection * rd_head
DLL of route directions with a number of buffer entries matching this rung.
unsigned int num_routes
Total number of route directions in this rung.
struct RouteDirection * rd_tail
DLL of route directions with a number of buffer entries matching this rung.
struct Rung * prev
Rung of RouteDirections with one less buffer entry each.
struct Rung * next
Rung of RouteDirections with one more buffer entry each.
unsigned int rung_off
Number of messages route directions at this rung have in their buffer.