GNUnet  0.11.x
gnunet-service-cadet.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2001-2013, 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 
35 #include "platform.h"
36 #include "gnunet_util_lib.h"
37 #include "cadet.h"
39 #include "gnunet-service-cadet.h"
48 
49 #define LOG(level, ...) GNUNET_log (level, __VA_ARGS__)
50 
51 
56 {
60  struct CadetClient *next;
61 
65  struct CadetClient *prev;
66 
72 
77 
82 
88 
94 
98  unsigned int id;
99 };
100 
101 
102 /******************************************************************************/
103 /*********************** GLOBAL VARIABLES ****************************/
104 /******************************************************************************/
105 
106 /****************************** Global variables ******************************/
107 
112 
117 
122 
127 
132 
137 
141 static struct CadetClient *clients_head;
142 
146 static struct CadetClient *clients_tail;
147 
151 static unsigned int next_client_id;
152 
158 
165 
170 
176 
180 unsigned long long ratchet_messages;
181 
186 
191 
195 unsigned long long drop_percent;
196 
197 
204 void
206  struct GNUNET_MQ_Envelope *env)
207 {
208  GNUNET_MQ_send (c->mq,
209  env);
210 }
211 
212 
219 const char *
220 GSC_2s (struct CadetClient *c)
221 {
222  static char buf[32];
223 
225  sizeof(buf),
226  "Client(%u)",
227  c->id);
228  return buf;
229 }
230 
231 
239 static struct CadetChannel *
242 {
244  ntohl (ccn.channel_of_client));
245 }
246 
247 
256 {
257  struct GNUNET_CADET_ClientChannelNumber ccn = c->next_ccn;
258 
259  /* increment until we have a free one... */
260  while (NULL !=
261  lookup_channel (c,
262  ccn))
263  {
265  = htonl (1 + (ntohl (ccn.channel_of_client)));
266  if (ntohl (ccn.channel_of_client) >=
268  ccn.channel_of_client = htonl (0);
269  }
270  c->next_ccn.channel_of_client
271  = htonl (1 + (ntohl (ccn.channel_of_client)));
272  return ccn;
273 }
274 
275 
289 GSC_bind (struct CadetClient *c,
290  struct CadetChannel *ch,
291  struct CadetPeer *dest,
292  const struct GNUNET_HashCode *port,
293  uint32_t options)
294 {
295  struct GNUNET_MQ_Envelope *env;
298 
299  ccn = client_get_next_ccn (c);
302  ntohl (
303  ccn.channel_of_client),
304  ch,
307  "Accepting incoming %s from %s on open port %s (%u), assigning ccn %X\n",
308  GCCH_2s (ch),
309  GCP_2s (dest),
310  GNUNET_h2s (port),
311  (uint32_t) ntohl (options),
312  (uint32_t) ntohl (ccn.channel_of_client));
313  /* notify local client about incoming connection! */
314  env = GNUNET_MQ_msg (cm,
316  cm->ccn = ccn;
317  cm->port = *port;
318  cm->opt = htonl (options);
319  cm->peer = *GCP_get_id (dest);
321  env);
322  return ccn;
323 }
324 
325 
335 static int
337  const struct GNUNET_PeerIdentity *pid,
338  void *value)
339 {
340  struct CadetPeer *cp = value;
341  struct CadetTunnel *t = GCP_get_tunnel (cp,
342  GNUNET_NO);
343 
344  if (NULL != t)
346  return GNUNET_OK;
347 }
348 
349 
359 static int
360 destroy_paths_now (void *cls,
361  const struct GNUNET_PeerIdentity *pid,
362  void *value)
363 {
364  struct CadetPeer *cp = value;
365 
367  return GNUNET_OK;
368 }
369 
370 
374 static void
376 {
377  if (NULL != stats)
378  {
380  GNUNET_NO);
381  stats = NULL;
382  }
383  /* Destroy tunnels. Note that all channels must be destroyed first! */
385  NULL);
386  /* All tunnels, channels, connections and CORE must be down before this point. */
388  NULL);
389  /* All paths, tunnels, channels, connections and CORE must be down before this point. */
391  if (NULL != open_ports)
392  {
394  open_ports = NULL;
395  }
396  if (NULL != loose_channels)
397  {
399  loose_channels = NULL;
400  }
401  if (NULL != peers)
402  {
404  peers = NULL;
405  }
406  if (NULL != connections)
407  {
409  connections = NULL;
410  }
411  if (NULL != ats_ch)
412  {
414  ats_ch = NULL;
415  }
416  GCD_shutdown ();
417  GCH_shutdown ();
419  my_private_key = NULL;
420 }
421 
422 
428 static void
429 shutdown_task (void *cls)
430 {
432  "Shutting down\n");
434  GCO_shutdown ();
435  if (NULL == clients_head)
436  shutdown_rest ();
437 }
438 
439 
449 static int
451  const struct GNUNET_HashCode *port,
452  void *value)
453 {
454  struct OpenPort *op = cls;
455  struct CadetChannel *ch = value;
456 
457  GCCH_bind (ch,
458  op->c,
459  &op->port);
462  &op->h_port,
463  ch));
464  return GNUNET_YES;
465 }
466 
467 
477 static void
478 handle_port_open (void *cls,
479  const struct GNUNET_CADET_PortMessage *pmsg)
480 {
481  struct CadetClient *c = cls;
482  struct OpenPort *op;
483 
485  "Open port %s requested by %s\n",
486  GNUNET_h2s (&pmsg->port),
487  GSC_2s (c));
488  if (NULL == c->ports)
490  GNUNET_NO);
491  op = GNUNET_new (struct OpenPort);
492  op->c = c;
493  op->port = pmsg->port;
494  GCCH_hash_port (&op->h_port,
495  &pmsg->port,
496  &my_full_id);
497  if (GNUNET_OK !=
499  &op->port,
500  op,
502  {
503  GNUNET_break (0);
505  return;
506  }
508  &op->h_port,
509  op,
512  &op->h_port,
514  op);
516 }
517 
518 
528 static void
529 handle_port_close (void *cls,
530  const struct GNUNET_CADET_PortMessage *pmsg)
531 {
532  struct CadetClient *c = cls;
533  struct OpenPort *op;
534 
536  "Closing port %s as requested by %s\n",
537  GNUNET_h2s (&pmsg->port),
538  GSC_2s (c));
539  if (NULL == c->ports)
540  {
541  /* Client closed a port despite _never_ having opened one? */
542  GNUNET_break (0);
544  return;
545  }
547  &pmsg->port);
548  if (NULL == op)
549  {
550  GNUNET_break (0);
552  return;
553  }
556  &op->port,
557  op));
560  &op->h_port,
561  op));
562  GNUNET_free (op);
564 }
565 
566 
573 static void
575  const struct GNUNET_CADET_LocalChannelCreateMessage *tcm)
576 {
577  struct CadetClient *c = cls;
578  struct CadetChannel *ch;
579 
581  {
582  /* Channel ID not in allowed range. */
583  LOG (GNUNET_ERROR_TYPE_DEBUG,"Channel ID not in allowed range.");
584  GNUNET_break (0);
586  return;
587  }
588  ch = lookup_channel (c,
589  tcm->ccn);
590  if (NULL != ch)
591  {
592  /* Channel ID already in use. Not allowed. */
593  LOG (GNUNET_ERROR_TYPE_DEBUG,"Channel ID already in use. Not allowed.");
594  GNUNET_break (0);
596  return;
597  }
599  "New channel to %s at port %s requested by %s\n",
600  GNUNET_i2s (&tcm->peer),
601  GNUNET_h2s (&tcm->port),
602  GSC_2s (c));
603 
604  /* Create channel */
606  tcm->ccn,
607  GCP_get (&tcm->peer,
608  GNUNET_YES),
609  &tcm->port,
610  ntohl (tcm->opt));
611  if (NULL == ch)
612  {
613  GNUNET_break (0);
615  return;
616  }
619  ntohl (
620  tcm->ccn.
621  channel_of_client),
622  ch,
624 
626 }
627 
628 
635 static void
637  const struct
639 {
640  struct CadetClient *c = cls;
641  struct CadetChannel *ch;
642 
643  ch = lookup_channel (c,
644  msg->ccn);
645  if (NULL == ch)
646  {
647  /* Client attempted to destroy unknown channel.
648  Can happen if the other side went down at the same time.*/
650  "%s tried to destroy unknown channel %X\n",
651  GSC_2s (c),
652  (uint32_t) ntohl (msg->ccn.channel_of_client));
654  return;
655  }
657  "%s is destroying %s\n",
658  GSC_2s (c),
659  GCCH_2s (ch));
662  ntohl (
663  msg->ccn.
664  channel_of_client),
665  ch));
667  c,
668  msg->ccn);
670 }
671 
672 
680 static int
681 check_local_data (void *cls,
682  const struct GNUNET_CADET_LocalData *msg)
683 {
684  size_t payload_size;
685  size_t payload_claimed_size;
686  const char *buf;
687  struct GNUNET_MessageHeader pa;
688 
689  /* FIXME: what is the format we shall allow for @a msg?
690  ONE payload item or multiple? Seems current cadet_api
691  at least in theory allows more than one. Next-gen
692  cadet_api will likely no more, so we could then
693  simplify this mess again. *//* Sanity check for message size */payload_size = ntohs (msg->header.size) - sizeof(*msg);
694  buf = (const char *) &msg[1];
695  while (payload_size >= sizeof(struct GNUNET_MessageHeader))
696  {
697  /* need to memcpy() for alignment */
698  GNUNET_memcpy (&pa,
699  buf,
700  sizeof(pa));
701  payload_claimed_size = ntohs (pa.size);
702  if ((payload_size < payload_claimed_size) ||
703  (payload_claimed_size < sizeof(struct GNUNET_MessageHeader)) ||
704  (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE < payload_claimed_size))
705  {
706  GNUNET_break (0);
708  "Local data of %u total size had sub-message %u at %u with %u bytes\n",
709  ntohs (msg->header.size),
710  ntohs (pa.type),
711  (unsigned int) (buf - (const char *) &msg[1]),
712  (unsigned int) payload_claimed_size);
713  return GNUNET_SYSERR;
714  }
715  payload_size -= payload_claimed_size;
716  buf += payload_claimed_size;
717  }
718  if (0 != payload_size)
719  {
720  GNUNET_break_op (0);
721  return GNUNET_SYSERR;
722  }
723  return GNUNET_OK;
724 }
725 
726 
734 static void
735 handle_local_data (void *cls,
736  const struct GNUNET_CADET_LocalData *msg)
737 {
738  struct CadetClient *c = cls;
739  struct CadetChannel *ch;
740  size_t payload_size;
741  const char *buf;
742 
743  ch = lookup_channel (c,
744  msg->ccn);
745  if (NULL == ch)
746  {
747  /* Channel does not exist (anymore) */
749  "Dropping payload for channel %u from client (channel unknown, other endpoint may have disconnected)\n",
750  (unsigned int) ntohl (msg->ccn.channel_of_client));
752  return;
753  }
754  payload_size = ntohs (msg->header.size) - sizeof(*msg);
756  "# payload received from clients",
757  payload_size,
758  GNUNET_NO);
759  buf = (const char *) &msg[1];
761  "Received %u bytes payload from %s for %s\n",
762  (unsigned int) payload_size,
763  GSC_2s (c),
764  GCCH_2s (ch));
765  if (GNUNET_OK !=
767  msg->ccn,
768  buf,
769  payload_size))
770  {
771  GNUNET_break (0);
773  return;
774  }
776 }
777 
778 
785 static void
786 handle_local_ack (void *cls,
787  const struct GNUNET_CADET_LocalAck *msg)
788 {
789  struct CadetClient *c = cls;
790  struct CadetChannel *ch;
791 
792  ch = lookup_channel (c,
793  msg->ccn);
794  if (NULL == ch)
795  {
796  /* Channel does not exist (anymore) */
798  "Ignoring local ACK for channel %u from client (channel unknown, other endpoint may have disconnected)\n",
799  (unsigned int) ntohl (msg->ccn.channel_of_client));
801  return;
802  }
804  "Got a local ACK from %s for %s\n",
805  GSC_2s (c),
806  GCCH_2s (ch));
808  msg->ccn);
810 }
811 
812 
821 static int
823  const struct GNUNET_PeerIdentity *peer,
824  void *value)
825 {
826  struct CadetClient *c = cls;
827  struct CadetPeer *p = value;
828  struct GNUNET_MQ_Envelope *env;
830 
831  env = GNUNET_MQ_msg (msg,
833  msg->destination = *peer;
834  msg->paths = htons (GCP_count_paths (p));
835  msg->tunnel = htons (NULL != GCP_get_tunnel (p,
836  GNUNET_NO));
837  msg->best_path_length = htonl (0); // FIXME: get length of shortest known path!
838  GNUNET_MQ_send (c->mq,
839  env);
840  return GNUNET_YES;
841 }
842 
843 
850 static void
851 handle_get_peers (void *cls,
852  const struct GNUNET_MessageHeader *message)
853 {
854  struct CadetClient *c = cls;
855  struct GNUNET_MQ_Envelope *env;
856  struct GNUNET_MessageHeader *reply;
857 
859  c);
860  env = GNUNET_MQ_msg (reply,
862  GNUNET_MQ_send (c->mq,
863  env);
865 }
866 
867 
878 static int
880  struct CadetPeerPath *path,
881  unsigned int off)
882 {
883  struct GNUNET_MQ_Handle *mq = cls;
884  struct GNUNET_MQ_Envelope *env;
885  struct GNUNET_CADET_LocalInfoPath *resp;
886  struct GNUNET_PeerIdentity *id;
887  size_t path_size;
888  unsigned int path_length;
889 
890  path_length = GCPP_get_length (path);
891  path_size = sizeof(struct GNUNET_PeerIdentity) * path_length;
892  if (sizeof(*resp) + path_size > UINT16_MAX)
893  {
894  /* try just giving the relevant path */
895  path_length = GNUNET_MIN ((UINT16_MAX - sizeof(*resp)) / sizeof(struct
897  off);
898  path_size = sizeof(struct GNUNET_PeerIdentity) * path_length;
899  }
900  if (sizeof(*resp) + path_size > UINT16_MAX)
901  {
903  "Path of %u entries is too long for info message\n",
904  path_length);
905  return GNUNET_YES;
906  }
907  env = GNUNET_MQ_msg_extra (resp,
908  path_size,
910  id = (struct GNUNET_PeerIdentity *) &resp[1];
911 
912  /* Don't copy first peer. First peer is always the local one. Last
913  * peer is always the destination (leave as 0, EOL).
914  */
915  for (unsigned int i = 0; i < path_length; i++)
916  id[i] = *GCP_get_id (GCPP_get_peer_at_offset (path,
917  i));
918  resp->off = htonl (off);
920  env);
921  return GNUNET_YES;
922 }
923 
924 
931 static void
932 handle_show_path (void *cls,
934 {
935  struct CadetClient *c = cls;
936  struct CadetPeer *p;
937  struct GNUNET_MQ_Envelope *env;
938  struct GNUNET_MessageHeader *resp;
939 
940  p = GCP_get (&msg->peer,
941  GNUNET_NO);
942  if (NULL != p)
945  c->mq);
946  env = GNUNET_MQ_msg (resp,
948  GNUNET_MQ_send (c->mq,
949  env);
951 }
952 
953 
962 static int
964  const struct GNUNET_PeerIdentity *peer,
965  void *value)
966 {
967  struct CadetClient *c = cls;
968  struct CadetPeer *p = value;
969  struct GNUNET_MQ_Envelope *env;
971  struct CadetTunnel *t;
972 
973  t = GCP_get_tunnel (p,
974  GNUNET_NO);
975  if (NULL == t)
976  return GNUNET_YES;
977  env = GNUNET_MQ_msg (msg,
979  msg->destination = *peer;
980  msg->channels = htonl (GCT_count_channels (t));
981  msg->connections = htonl (GCT_count_any_connections (t));
982  msg->cstate = htons (0);
983  msg->estate = htons ((uint16_t) GCT_get_estate (t));
984  GNUNET_MQ_send (c->mq,
985  env);
986  return GNUNET_YES;
987 }
988 
989 
996 static void
998  const struct GNUNET_MessageHeader *message)
999 {
1000  struct CadetClient *c = cls;
1001  struct GNUNET_MQ_Envelope *env;
1002  struct GNUNET_MessageHeader *reply;
1003 
1005  c);
1006  env = GNUNET_MQ_msg (reply,
1008  GNUNET_MQ_send (c->mq,
1009  env);
1011 }
1012 
1013 
1020 static void
1022  const struct GNUNET_CADET_RequestDropCadetMessage *message)
1023 {
1024  struct CadetClient *c = cls;
1025  struct CadetChannel *ch;
1026 
1027  ch = lookup_channel (c,
1028  message->ccn);
1029 
1030  if (NULL != ch)
1031  GCCH_assign_type_to_drop (ch, message);
1032 
1034 }
1035 
1036 
1045 static void *
1047  struct GNUNET_SERVICE_Client *client,
1048  struct GNUNET_MQ_Handle *mq)
1049 {
1050  struct CadetClient *c;
1051 
1052  c = GNUNET_new (struct CadetClient);
1053  c->client = client;
1054  c->mq = mq;
1055  c->id = next_client_id++; /* overflow not important: just for debug */
1056  c->channels
1059  clients_tail,
1060  c);
1062  "# clients",
1063  +1,
1064  GNUNET_NO);
1066  "%s connected\n",
1067  GSC_2s (c));
1068  return c;
1069 }
1070 
1071 
1079 void
1082  struct CadetChannel *ch)
1083 {
1084  struct GNUNET_MQ_Envelope *env;
1086 
1087  env = GNUNET_MQ_msg (tdm,
1089  tdm->ccn = ccn;
1090  GSC_send_to_client (c,
1091  env);
1094  ntohl (
1096  ch));
1097 }
1098 
1099 
1107 void
1109  struct CadetChannel *ch)
1110 {
1113  h_port,
1114  ch));
1115 }
1116 
1117 
1126 static int
1128  uint32_t key,
1129  void *value)
1130 {
1131  struct CadetClient *c = cls;
1133  struct CadetChannel *ch = value;
1134 
1136  "Destroying %s, due to %s disconnecting.\n",
1137  GCCH_2s (ch),
1138  GSC_2s (c));
1139  ccn.channel_of_client = htonl (key);
1142  key,
1143  ch));
1145  c,
1146  ccn);
1147  return GNUNET_OK;
1148 }
1149 
1150 
1159 static int
1161  const struct GNUNET_HashCode *port,
1162  void *value)
1163 {
1164  struct CadetClient *c = cls;
1165  struct OpenPort *op = value;
1166 
1167  GNUNET_assert (c == op->c);
1169  "Closing port %s due to %s disconnect.\n",
1170  GNUNET_h2s (port),
1171  GSC_2s (c));
1174  &op->h_port,
1175  op));
1178  port,
1179  op));
1180  GNUNET_free (op);
1181  return GNUNET_OK;
1182 }
1183 
1184 
1192 static void
1194  struct GNUNET_SERVICE_Client *client,
1195  void *internal_cls)
1196 {
1197  struct CadetClient *c = internal_cls;
1198 
1199  GNUNET_assert (c->client == client);
1201  "%s is disconnecting.\n",
1202  GSC_2s (c));
1203  if (NULL != c->channels)
1204  {
1207  c);
1210  }
1211  if (NULL != c->ports)
1212  {
1215  c);
1217  }
1219  clients_tail,
1220  c);
1222  "# clients",
1223  -1,
1224  GNUNET_NO);
1225  GNUNET_free (c);
1226  if ((NULL == clients_head) &&
1228  shutdown_rest ();
1229 }
1230 
1231 
1239 static void
1240 run (void *cls,
1241  const struct GNUNET_CONFIGURATION_Handle *c,
1243 {
1244  cfg = c;
1245  if (GNUNET_OK !=
1247  "CADET",
1248  "RATCHET_MESSAGES",
1249  &ratchet_messages))
1250  {
1252  "CADET",
1253  "RATCHET_MESSAGES",
1254  "needs to be a number");
1255  ratchet_messages = 64;
1256  }
1257  if (GNUNET_OK !=
1259  "CADET",
1260  "RATCHET_TIME",
1261  &ratchet_time))
1262  {
1264  "CADET",
1265  "RATCHET_TIME",
1266  "need delay value");
1268  }
1269  if (GNUNET_OK !=
1271  "CADET",
1272  "REFRESH_CONNECTION_TIME",
1273  &keepalive_period))
1274  {
1276  "CADET",
1277  "REFRESH_CONNECTION_TIME",
1278  "need delay value");
1280  }
1281  if (GNUNET_OK !=
1283  "CADET",
1284  "DROP_PERCENT",
1285  &drop_percent))
1286  {
1287  drop_percent = 0;
1288  }
1289  else
1290  {
1291  LOG (GNUNET_ERROR_TYPE_WARNING, "**************************************\n");
1292  LOG (GNUNET_ERROR_TYPE_WARNING, "Cadet is running with DROP enabled.\n");
1293  LOG (GNUNET_ERROR_TYPE_WARNING, "This is NOT a good idea!\n");
1294  LOG (GNUNET_ERROR_TYPE_WARNING, "Remove DROP_PERCENT from config file.\n");
1295  LOG (GNUNET_ERROR_TYPE_WARNING, "**************************************\n");
1296  }
1298  if (NULL == my_private_key)
1299  {
1300  GNUNET_break (0);
1302  return;
1303  }
1306  stats = GNUNET_STATISTICS_create ("cadet",
1307  c);
1309  NULL);
1311  /* FIXME: optimize code to allow GNUNET_YES here! */
1313  GNUNET_NO);
1315  GNUNET_NO);
1317  GNUNET_YES);
1319  GNUNET_YES);
1320  GCH_init (c);
1321  GCD_init (c);
1322  GCO_init (c);
1324  "CADET started for peer %s\n",
1325  GNUNET_i2s (&my_full_id));
1326 }
1327 
1328 
1333  ("cadet",
1335  &run,
1338  NULL,
1339  GNUNET_MQ_hd_fixed_size (port_open,
1341  struct GNUNET_CADET_PortMessage,
1342  NULL),
1343  GNUNET_MQ_hd_fixed_size (port_close,
1345  struct GNUNET_CADET_PortMessage,
1346  NULL),
1347  GNUNET_MQ_hd_fixed_size (channel_create,
1350  NULL),
1354  NULL),
1355  GNUNET_MQ_hd_var_size (local_data,
1357  struct GNUNET_CADET_LocalData,
1358  NULL),
1359  GNUNET_MQ_hd_fixed_size (local_ack,
1361  struct GNUNET_CADET_LocalAck,
1362  NULL),
1365  struct GNUNET_MessageHeader,
1366  NULL),
1367  GNUNET_MQ_hd_fixed_size (show_path,
1370  NULL),
1371  GNUNET_MQ_hd_fixed_size (info_tunnels,
1373  struct GNUNET_MessageHeader,
1374  NULL),
1375  GNUNET_MQ_hd_fixed_size (drop_message,
1378  NULL),
1380 
1381 /* end of gnunet-service-cadet-new.c */
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI
Minimum value for channel IDs of local clients.
Definition: cadet.h:71
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static uint16_t port
Port number.
Definition: gnunet-bcd.c:83
static void get_peers(void *cls)
Call CADET's meta API, get all peers known to a peer.
Definition: gnunet-cadet.c:584
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
struct GNUNET_CONTAINER_MultiPeerMap * peers
Map from PIDs to struct CadetPeer entries.
struct GNUNET_CONTAINER_MultiShortmap * connections
Map from struct GNUNET_CADET_ConnectionTunnelIdentifier hash codes to struct CadetConnection objects.
static void handle_info_tunnels(void *cls, const struct GNUNET_MessageHeader *message)
Handler for client's GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS request.
static struct CadetClient * clients_tail
DLL with all the clients, tail.
static struct CadetChannel * lookup_channel(struct CadetClient *c, struct GNUNET_CADET_ClientChannelNumber ccn)
Lookup channel of client c by ccn.
struct GNUNET_PeerIdentity my_full_id
Local peer own ID.
void GSC_handle_remote_channel_destroy(struct CadetClient *c, struct GNUNET_CADET_ClientChannelNumber ccn, struct CadetChannel *ch)
A channel was destroyed by the other peer.
static void handle_channel_destroy(void *cls, const struct GNUNET_CADET_LocalChannelDestroyMessage *msg)
Handler for requests of destroying an existing channel.
static int channel_destroy_iterator(void *cls, uint32_t key, void *value)
Iterator for deleting each channel whose client endpoint disconnected.
static unsigned int next_client_id
Next ID to assign to a client.
unsigned long long drop_percent
Set to non-zero values to create random drops to test retransmissions.
static void handle_port_open(void *cls, const struct GNUNET_CADET_PortMessage *pmsg)
Handle port open request.
static void handle_channel_create(void *cls, const struct GNUNET_CADET_LocalChannelCreateMessage *tcm)
Handler for requests for us creating a new channel to another peer and port.
const char * GSC_2s(struct CadetClient *c)
Return identifier for a client as a string.
struct GNUNET_STATISTICS_Handle * stats
Handle to the statistics service.
struct GNUNET_ATS_ConnectivityHandle * ats_ch
Handle to communicate with ATS.
static void handle_show_path(void *cls, const struct GNUNET_CADET_RequestPathInfoMessage *msg)
Handler for client's GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH request.
const struct GNUNET_CONFIGURATION_Handle * cfg
Handle to our configuration.
struct GNUNET_TIME_Relative keepalive_period
How frequently do we send KEEPALIVE messages on idle connections?
static void handle_get_peers(void *cls, const struct GNUNET_MessageHeader *message)
Handler for client's INFO PEERS request.
static int get_all_tunnels_iterator(void *cls, const struct GNUNET_PeerIdentity *peer, void *value)
Iterator over all tunnels to send a monitoring client info about each tunnel.
static int bind_loose_channel(void *cls, const struct GNUNET_HashCode *port, void *value)
We had a remote connection value to port h_port before client cls opened port port.
void GSC_send_to_client(struct CadetClient *c, struct GNUNET_MQ_Envelope *env)
Send a message to a client.
static void shutdown_task(void *cls)
Task run during shutdown.
static int destroy_paths_now(void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
Callback invoked on all peers to destroy all tunnels that may still exist.
int shutting_down
Signal that shutdown is happening: prevent recovery measures.
unsigned long long ratchet_messages
How many messages are needed to trigger an AXOLOTL ratchet advance.
static void run(void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_SERVICE_Handle *service)
Setup CADET internals.
static int check_local_data(void *cls, const struct GNUNET_CADET_LocalData *msg)
Check for client traffic data message is well-formed.
static void handle_local_ack(void *cls, const struct GNUNET_CADET_LocalAck *msg)
Handler for client's ACKs for payload traffic.
static int client_release_ports(void *cls, const struct GNUNET_HashCode *port, void *value)
Remove client's ports from the global hashmap on disconnect.
static void handle_local_data(void *cls, const struct GNUNET_CADET_LocalData *msg)
Handler for client payload traffic to be send on a channel to another peer.
static void shutdown_rest()
Shutdown everything once the clients have disconnected.
static int path_info_iterator(void *cls, struct CadetPeerPath *path, unsigned int off)
Iterator over all paths of a peer to build an InfoPeer message.
static int get_all_peers_iterator(void *cls, const struct GNUNET_PeerIdentity *peer, void *value)
Iterator over all peers to send a monitoring client info about each peer.
#define LOG(level,...)
struct GNUNET_CONTAINER_MultiHashMap * open_ports
All ports clients of this peer have opened.
static struct CadetClient * clients_head
DLL with all the clients, head.
static void * client_connect_cb(void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
Callback called when a client connects to the service.
struct GNUNET_CADET_ClientChannelNumber GSC_bind(struct CadetClient *c, struct CadetChannel *ch, struct CadetPeer *dest, const struct GNUNET_HashCode *port, uint32_t options)
Bind incoming channel to this client, and notify client about incoming connection.
struct GNUNET_CONTAINER_MultiHashMap * loose_channels
Map from ports to channels where the ports were closed at the time we got the inbound connection.
struct GNUNET_CRYPTO_EddsaPrivateKey * my_private_key
Own private key.
static struct GNUNET_CADET_ClientChannelNumber client_get_next_ccn(struct CadetClient *c)
Obtain the next LID to use for incoming connections to the given client.
static void client_disconnect_cb(void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls)
Callback called when a client disconnected from the service.
struct GNUNET_TIME_Relative ratchet_time
How long until we trigger a ratched advance due to time.
static void handle_drop_message(void *cls, const struct GNUNET_CADET_RequestDropCadetMessage *message)
Handler for client's GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE request.
static int destroy_tunnels_now(void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
Callback invoked on all peers to destroy all tunnels that may still exist.
static void handle_port_close(void *cls, const struct GNUNET_CADET_PortMessage *pmsg)
Handler for port close requests.
GNUNET_SERVICE_MAIN("cadet", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_fixed_size(port_open, GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN, struct GNUNET_CADET_PortMessage, NULL), GNUNET_MQ_hd_fixed_size(port_close, GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE, struct GNUNET_CADET_PortMessage, NULL), GNUNET_MQ_hd_fixed_size(channel_create, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE, struct GNUNET_CADET_LocalChannelCreateMessage, NULL), GNUNET_MQ_hd_fixed_size(channel_destroy, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY, struct GNUNET_CADET_LocalChannelDestroyMessage, NULL), GNUNET_MQ_hd_var_size(local_data, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, struct GNUNET_CADET_LocalData, NULL), GNUNET_MQ_hd_fixed_size(local_ack, GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK, struct GNUNET_CADET_LocalAck, NULL), GNUNET_MQ_hd_fixed_size(get_peers, GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PEERS, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_fixed_size(show_path, GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH, struct GNUNET_CADET_RequestPathInfoMessage, NULL), GNUNET_MQ_hd_fixed_size(info_tunnels, GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_fixed_size(drop_message, GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE, struct GNUNET_CADET_RequestDropCadetMessage, NULL), GNUNET_MQ_handler_end())
Define "main" method using service macro.
void GSC_drop_loose_channel(const struct GNUNET_HashCode *h_port, struct CadetChannel *ch)
A client that created a loose channel that was not bound to a port disconnected, drop it from the loo...
Information we track per peer.
static void channel_destroy(struct CadetChannel *ch)
Destroy the given channel.
int GCCH_handle_local_data(struct CadetChannel *ch, struct GNUNET_CADET_ClientChannelNumber sender_ccn, const char *buf, size_t buf_len)
Handle data given by a client.
void GCCH_bind(struct CadetChannel *ch, struct CadetClient *c, const struct GNUNET_HashCode *port)
A client is bound to the port that we have a channel open to.
void GCCH_handle_local_ack(struct CadetChannel *ch, struct GNUNET_CADET_ClientChannelNumber client_ccn)
Handle ACK from client on local channel.
void GCCH_channel_local_destroy(struct CadetChannel *ch, struct CadetClient *c, struct GNUNET_CADET_ClientChannelNumber ccn)
Destroy locally created channel.
void GCCH_assign_type_to_drop(struct CadetChannel *ch, const struct GNUNET_CADET_RequestDropCadetMessage *message)
Assign type of message to drop.
const char * GCCH_2s(const struct CadetChannel *ch)
Get the static string for identification of the channel.
void GCCH_hash_port(struct GNUNET_HashCode *h_port, const struct GNUNET_HashCode *port, const struct GNUNET_PeerIdentity *listener)
Hash the port and initiator and listener to calculate the "challenge" h_port we send to the other pee...
struct CadetChannel * GCCH_channel_local_new(struct CadetClient *owner, struct GNUNET_CADET_ClientChannelNumber ccn, struct CadetPeer *destination, const struct GNUNET_HashCode *port, uint32_t options)
Create a new channel.
GNUnet CADET service with encryption.
A connection is a live end-to-end messaging mechanism where the peers are identified by a path and kn...
void GCO_shutdown()
Shut down the CORE subsystem.
void GCO_init(const struct GNUNET_CONFIGURATION_Handle *c)
Initialize the CORE subsystem.
cadet service; interaction with CORE service
void GCD_init(const struct GNUNET_CONFIGURATION_Handle *c)
Initialize the DHT subsystem.
void GCD_shutdown(void)
Shut down the DHT subsystem.
cadet service; dealing with DHT requests and results
void GCH_shutdown()
Shut down the hello subsystem.
void GCH_init(const struct GNUNET_CONFIGURATION_Handle *c)
Initialize the hello subsystem.
cadet service; dealing with hello messages
struct CadetPeer * GCPP_get_peer_at_offset(struct CadetPeerPath *path, unsigned int off)
Obtain the peer at offset off in path.
unsigned int GCPP_get_length(struct CadetPeerPath *path)
Return the length of the path.
unsigned int GCP_count_paths(const struct CadetPeer *cp)
Count the number of known paths toward the peer.
struct CadetTunnel * GCP_get_tunnel(struct CadetPeer *cp, int create)
Get the tunnel towards a peer.
const struct GNUNET_PeerIdentity * GCP_get_id(struct CadetPeer *cp)
Obtain the peer identity for a struct CadetPeer.
void GCP_drop_owned_paths(struct CadetPeer *cp)
Drop all paths owned by this peer, and do not allow new ones to be added: We are shutting down.
struct CadetPeer * GCP_get(const struct GNUNET_PeerIdentity *peer_id, int create)
Retrieve the CadetPeer structure associated with the peer.
unsigned int GCP_iterate_indirect_paths(struct CadetPeer *cp, GCP_PathIterator callback, void *callback_cls)
Iterate over the paths to a peer without direct link.
const char * GCP_2s(const struct CadetPeer *cp)
Get the static string for a peer ID.
void GCP_destroy_all_peers()
Clean up all entries about all peers.
void GCP_iterate_all(GNUNET_CONTAINER_PeerMapIterator iter, void *cls)
Iterate over all known peers.
Information we track per peer.
unsigned int GCT_count_any_connections(const struct CadetTunnel *t)
Count all created connections of a tunnel.
unsigned int GCT_count_channels(struct CadetTunnel *t)
Count channels of a tunnel.
enum CadetTunnelEState GCT_get_estate(struct CadetTunnel *t)
Get the encryption state of a tunnel.
void GCT_destroy_tunnel_now(struct CadetTunnel *t)
Destroys the tunnel t now, without delay.
Information we track per tunnel.
static char buf[2048]
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
static struct GNUNET_SCHEDULER_Task * t
Main task.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_OK
Definition: gnunet_common.h:95
@ GNUNET_YES
Definition: gnunet_common.h:97
@ GNUNET_NO
Definition: gnunet_common.h:94
@ GNUNET_SYSERR
Definition: gnunet_common.h:93
#define GNUNET_MIN(a, b)
struct GNUNET_ATS_ConnectivityHandle * GNUNET_ATS_connectivity_init(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the ATS connectivity suggestion client handle.
void GNUNET_ATS_connectivity_done(struct GNUNET_ATS_ConnectivityHandle *ch)
Client is done with ATS connectivity management, release resources.
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.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
#define GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE
Maximum message size that can be sent on CADET.
struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_CRYPTO_eddsa_key_create_from_configuration(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a new private key by reading our peer's key from the file specified in the configuration.
void GNUNET_CRYPTO_eddsa_key_get_public(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:197
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
int GNUNET_CONTAINER_multihashmap_get_multiple(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
int GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
int GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
int GNUNET_CONTAINER_multihashmap32_iterate(struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MulitHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
int GNUNET_CONTAINER_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.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
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_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *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).
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
void GNUNET_CONTAINER_multishortmap_destroy(struct GNUNET_CONTAINER_MultiShortmap *map)
Destroy a hash map.
void * GNUNET_CONTAINER_multihashmap32_get(const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
Given a key find a value in the map matching the key.
int GNUNET_CONTAINER_multihashmap32_remove(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value)
Remove the given key-value pair from the map.
void GNUNET_CONTAINER_multihashmap32_destroy(struct GNUNET_CONTAINER_MultiHashMap32 *map)
Destroy a 32-bit key hash 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.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
@ 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...
#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).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
void GNUNET_log_config_invalid(enum GNUNET_ErrorType kind, const char *section, const char *option, const char *required)
Log error message about invalid configuration option value.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_DEBUG
@ GNUNET_ERROR_TYPE_INFO
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
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:355
#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:52
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE
Ask the cadet service to create a new channel.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PEERS
Request local information about all peers known to the service.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS
Local information about all tunnels of service.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS_END
End of local information about all tunnels of service.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK
Local ACK for data.
#define GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE
Request to drop a message of type X to peer y.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH_END
End of local information of service about a specific path.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH
Request local information of service about paths to specific peer.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS
Local information about all peers known to the service.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS_END
End of local information about all peers known to the service.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE
Stop listening on a port.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN
Start listening on a port.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH
Local information of service about a specific path.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS
Request local information about all tunnels of service.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA
Payload client <-> service.
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY
Tell client that a channel was destroyed.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:531
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
Definition: scheduler.c:1331
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2325
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2244
@ GNUNET_SERVICE_OPTION_NONE
Use defaults.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
#define GNUNET_TIME_UNIT_HOURS
One hour.
#define GNUNET_TIME_UNIT_MINUTES
One minute.
Struct containing all information regarding a channel to a remote client.
Struct containing information about a client of the service.
struct GNUNET_MQ_Handle * mq
Handle to communicate with the client.
struct GNUNET_SERVICE_Client * client
Client handle.
struct CadetClient * prev
Linked list prev.
unsigned int id
ID of the client, mainly for debug messages.
struct GNUNET_CONTAINER_MultiHashMap * ports
Ports that this client has declared interest in.
struct GNUNET_CONTAINER_MultiHashMap32 * channels
Tunnels that belong to this client, indexed by local id, value is a struct CadetChannel.
struct GNUNET_CADET_ClientChannelNumber next_ccn
Channel ID to use for the next incoming channel for this client.
struct CadetClient * next
Linked list next.
Information regarding a possible path to reach a peer.
Peer description.
struct CadetPeer * dest
Destinaton to ping.
Struct containing all information regarding a tunnel to a peer.
Handle to the ATS subsystem for connectivity management.
Number uniquely identifying a channel of a client.
Definition: cadet.h:102
uint32_t channel_of_client
Values for channel numbering.
Definition: cadet.h:110
Message to allow the client send more data to the service (always service -> client).
Definition: cadet.h:281
Message for a client to create channels.
Definition: cadet.h:202
struct GNUNET_PeerIdentity peer
Channel's peer.
Definition: cadet.h:218
struct GNUNET_CADET_ClientChannelNumber ccn
ID of a channel controlled by this client.
Definition: cadet.h:213
struct GNUNET_HashCode port
Port of the channel.
Definition: cadet.h:223
Message for or to a client to destroy tunnel.
Definition: cadet.h:236
struct GNUNET_CADET_ClientChannelNumber ccn
ID of a channel controlled by this client.
Definition: cadet.h:245
Message for cadet data traffic.
Definition: cadet.h:253
Message to inform the client about one of the paths known to the service.
Definition: cadet.h:408
uint32_t off
Offset of the peer that was requested.
Definition: cadet.h:417
Message to inform the client about one of the peers in the service.
Definition: cadet.h:425
Message to inform the client about one of the tunnels in the service.
Definition: cadet.h:459
Message for a client to create and destroy channels.
Definition: cadet.h:182
struct GNUNET_HashCode port
Port to open/close.
Definition: cadet.h:194
Message to drop another message of specific type.
Definition: cadet.h:322
struct GNUNET_CADET_ClientChannelNumber ccn
ID of the channel we want to drop a message for.
Definition: cadet.h:337
Message to inform the client about channels in the service.
Definition: cadet.h:345
Internal representation of the hash map.
Internal representation of the hash map.
Internal representation of the hash map.
Internal representation of the hash map.
Private ECC key encoded for transmission.
A 512-bit hashcode.
Handle to a message queue.
Definition: mq.c:86
Header for all communications.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CRYPTO_EddsaPublicKey public_key
Handle to a client that is connected to a service.
Definition: service.c:251
Handle to a service.
Definition: service.c:117
Handle for the service.
Time for relative time used by GNUnet, in microseconds.
Port opened by a client.
struct CadetClient * c
Client that opened the port.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.