GNUnet  0.19.2
gnunet-service-fs.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2009-2014, 2016 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 
26 #include "platform.h"
27 #include <float.h>
28 #include "gnunet_constants.h"
29 #include "gnunet_core_service.h"
30 #include "gnunet_dht_service.h"
32 #include "gnunet_load_lib.h"
33 #include "gnunet_protocols.h"
34 #include "gnunet_signatures.h"
37 #include "gnunet_util_lib.h"
38 #include "gnunet-service-fs_cp.h"
40 #include "gnunet-service-fs_pe.h"
41 #include "gnunet-service-fs_pr.h"
42 #include "gnunet-service-fs_push.h"
43 #include "gnunet-service-fs_put.h"
45 #include "fs.h"
46 #include "fs_api.h"
47 
53 #define FS_DHT_HT_SIZE 1024
54 
55 
61 #define COVER_AGE_FREQUENCY GNUNET_TIME_relative_multiply ( \
62  GNUNET_TIME_UNIT_SECONDS, 5)
63 
67 #define INSANE_STATISTICS GNUNET_NO
68 
69 
75 {
80 
85 
90 
95 
100 };
101 
102 
108 {
113 
118 
123 
127  size_t msize;
128 };
129 
130 
136 {
141 
146 
150  char *filename;
151 
156 
161 
165  struct GNUNET_HashCode file_id;
166 };
167 
168 
173 {
178 
183 
189 
195 
200 
205 
210 
215 };
216 
217 
218 /* ****************************** globals ****************************** */
219 
224 
229 
234 
239 
244 
249 struct GNUNET_TIME_Relative GSF_avg_latency = { 500 };
250 
255 
256 
268 
273 
279 
285 
290 
296 
301 
306 
307 /* ***************************** locals ******************************* */
308 
313 
317 static struct GNUNET_CRYPTO_EddsaPrivateKey pk;
318 
323 
328 
329 
338 static void *
339 client_connect_cb (void *cls,
340  struct GNUNET_SERVICE_Client *client,
341  struct GNUNET_MQ_Handle *mq)
342 {
343  struct GSF_LocalClient *pos;
344 
345  pos = GNUNET_new (struct GSF_LocalClient);
346  pos->client = client;
347  pos->mq = mq;
348  return pos;
349 }
350 
351 
357 static void
359 {
360  struct ClientRequest *cr = cls;
361  struct GSF_LocalClient *lc = cr->lc;
362 
363  cr->kill_task = NULL;
365  lc->cr_tail,
366  cr);
368  GNUNET_YES);
370  gettext_noop ("# client searches active"),
371  -1,
372  GNUNET_NO);
373  GNUNET_free (cr);
374 }
375 
376 
395 static void
398  struct GSF_PendingRequest *pr,
399  uint32_t reply_anonymity_level,
402  enum GNUNET_BLOCK_Type type,
403  const void *data,
404  size_t data_len)
405 {
406  struct ClientRequest *cr = cls;
407  struct GSF_LocalClient *lc;
408  struct GNUNET_MQ_Envelope *env;
409  struct ClientPutMessage *pm;
410  const struct GSF_PendingRequestData *prd;
411 
412  if (NULL == data)
413  {
414  /* local-only request, with no result, clean up. */
415  if (NULL == cr->kill_task)
417  cr);
418  return;
419  }
422  if ((prd->type != type) && (prd->type != GNUNET_BLOCK_TYPE_ANY))
423  {
424  GNUNET_break (0);
425  return;
426  }
429  ("# replies received for local clients"), 1,
430  GNUNET_NO);
431  GNUNET_assert (pr == cr->pr);
432  lc = cr->lc;
434  data_len,
436  pm->type = htonl (type);
437  pm->expiration = GNUNET_TIME_absolute_hton (expiration);
438  pm->last_transmission = GNUNET_TIME_absolute_hton (last_transmission);
439  pm->num_transmissions = htonl (prd->num_transmissions);
440  pm->respect_offered = htonl (prd->respect_offered);
441  GNUNET_memcpy (&pm[1],
442  data,
443  data_len);
444  GNUNET_MQ_send (lc->mq,
445  env);
447  "Queued reply to query `%s' for local client\n",
448  GNUNET_h2s (&prd->query));
449  if (GNUNET_BLOCK_REPLY_OK_LAST != eval)
450  {
452  "Evaluation %d - keeping query alive\n",
453  (int) eval);
454  return;
455  }
456  if (NULL == cr->kill_task)
458  cr);
459 }
460 
461 
470 static void
472  struct GNUNET_SERVICE_Client *client,
473  void *app_ctx)
474 {
475  struct GSF_LocalClient *lc = app_ctx;
476  struct IndexStartContext *isc;
477  struct ClientRequest *cr;
478  struct ClientResponse *res;
479 
480  while (NULL != (cr = lc->cr_head))
481  {
482  if (NULL != cr->kill_task)
485  }
486  while (NULL != (res = lc->res_head))
487  {
489  lc->res_tail,
490  res);
491  GNUNET_free (res);
492  }
493  while (NULL != (isc = lc->isc_head))
494  {
496  lc->isc_tail,
497  isc);
499  GNUNET_free (isc);
500  }
501  GNUNET_free (lc);
502 }
503 
504 
510 static void
512 {
518  NULL);
519 }
520 
521 
528 void
530 {
532 
535 }
536 
537 
548 int
549 GSF_test_get_load_too_high_ (uint32_t priority)
550 {
551  double ld;
552 
554  if (ld < 1)
555  return GNUNET_SYSERR;
556  if (ld <= priority)
557  return GNUNET_NO;
558  return GNUNET_YES;
559 }
560 
561 
573 static void
574 update_latencies (void *cls,
575  const struct GNUNET_HELLO_Address *address,
576  int active,
577  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
578  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
579  const struct GNUNET_ATS_Properties *prop)
580 {
581  if (NULL == address)
582  {
583  /* ATS service temporarily disconnected */
584  return;
585  }
586 
587  if (GNUNET_YES != active)
588  return;
590  prop->delay);
593  + GNUNET_MIN (5000, prop->delay.rel_value_us)) / 32;
595  gettext_noop ("# running average P2P latency (ms)"),
596  GSF_avg_latency.rel_value_us / 1000LL,
597  GNUNET_NO);
598 }
599 
600 
609 static int
610 check_p2p_put (void *cls,
611  const struct PutMessage *put)
612 {
613  enum GNUNET_BLOCK_Type type;
614 
615  type = ntohl (put->type);
617  {
618  GNUNET_break_op (0);
619  return GNUNET_SYSERR;
620  }
621  return GNUNET_OK;
622 }
623 
624 
634 static void
636  const struct GNUNET_PeerIdentity *peer,
637  struct GSF_ConnectedPeer *cp,
638  const struct GSF_PeerPerformanceData *ppd)
639 {
640  struct GSF_PendingRequest *pr = cls;
641 
642  if (GNUNET_YES !=
644  {
645 #if INSANE_STATISTICS
647  gettext_noop ("# Loopback routes suppressed"), 1,
648  GNUNET_NO);
649 #endif
650  return;
651  }
652  GSF_plan_add_ (cp,
653  pr);
654 }
655 
656 
667 void
669  struct GSF_PendingRequest *pr,
671 {
673  return; /* we're done... */
674  if (GNUNET_YES !=
676  return; /* request is not actually active, skip! */
678  pr);
679 }
680 
681 
690 static int
691 check_p2p_get (void *cls,
692  const struct GetMessage *gm)
693 {
694  size_t msize;
695  unsigned int bm;
696  unsigned int bits;
697  size_t bfsize;
698 
699  msize = ntohs (gm->header.size);
700  bm = ntohl (gm->hash_bitmap);
701  bits = 0;
702  while (bm > 0)
703  {
704  if (1 == (bm & 1))
705  bits++;
706  bm >>= 1;
707  }
708  if (msize < sizeof(struct GetMessage) + bits * sizeof(struct
710  {
711  GNUNET_break_op (0);
712  return GNUNET_SYSERR;
713  }
714  bfsize = msize - sizeof(struct GetMessage) - bits * sizeof(struct
716  /* bfsize must be power of 2, check! */
717  if (0 != ((bfsize - 1) & bfsize))
718  {
719  GNUNET_break_op (0);
720  return GNUNET_SYSERR;
721  }
722  return GNUNET_OK;
723 }
724 
725 
736 static void
738  struct GSF_PendingRequest *pr,
740 {
741  struct GSF_LocalClient *lc = cls;
742  struct GSF_PendingRequestData *prd;
743 
746  return; /* we're done, 'pr' was already destroyed... */
749  "Finished database lookup for local request `%s' with result %d\n",
750  GNUNET_h2s (&prd->query),
751  result);
752  if (0 == prd->anonymity_level)
753  {
754  switch (prd->type)
755  {
758  /* the above block types MAY be available via 'cadet' */
760  "Considering cadet-based download for block\n");
761  GSF_cadet_lookup_ (pr);
762  break;
763 
765  /* the above block types are in the DHT */
767  "Considering DHT-based search for block\n");
768  GSF_dht_lookup_ (pr);
769  break;
770 
771  default:
772  GNUNET_break (0);
773  break;
774  }
775  }
777  pr,
778  result);
779 }
780 
781 
790 static int
792  const struct SearchMessage *sm)
793 {
794  uint16_t msize;
795 
796  msize = ntohs (sm->header.size) - sizeof(struct SearchMessage);
797  if (0 != msize % sizeof(struct GNUNET_HashCode))
798  {
799  GNUNET_break (0);
800  return GNUNET_SYSERR;
801  }
802  return GNUNET_OK;
803 }
804 
805 
816 static void
818  const struct SearchMessage *sm)
819 {
820  static struct GNUNET_PeerIdentity all_zeros;
821  struct GSF_LocalClient *lc = cls;
822  struct ClientRequest *cr;
823  struct GSF_PendingRequestData *prd;
824  uint16_t msize;
825  unsigned int sc;
826  enum GNUNET_BLOCK_Type type;
828 
830  gettext_noop ("# client searches received"),
831  1,
832  GNUNET_NO);
833  msize = ntohs (sm->header.size) - sizeof(struct SearchMessage);
834  sc = msize / sizeof(struct GNUNET_HashCode);
835  type = ntohl (sm->type);
837  "Received request for `%s' of type %u from local client\n",
838  GNUNET_h2s (&sm->query),
839  (unsigned int) type);
840  cr = NULL;
841  /* detect duplicate UBLOCK requests */
844  {
845  cr = lc->cr_head;
846  while (NULL != cr)
847  {
848  prd = GSF_pending_request_get_data_ (cr->pr);
849  /* only unify with queries that hae not yet started local processing
850  (SEARCH_MESSAGE_OPTION_CONTINUED was always set) and that have a
851  matching query and type */
852  if ((GNUNET_YES != prd->has_started) &&
853  (0 != memcmp (&prd->query,
854  &sm->query,
855  sizeof(struct GNUNET_HashCode))) &&
856  (prd->type == type))
857  break;
858  cr = cr->next;
859  }
860  }
861  if (NULL != cr)
862  {
864  "Have existing request, merging content-seen lists.\n");
866  (const struct GNUNET_HashCode *) &sm[1],
867  sc);
869  gettext_noop (
870  "# client searches updated (merged content seen list)"),
871  1,
872  GNUNET_NO);
873  }
874  else
875  {
877  gettext_noop ("# client searches active"),
878  1,
879  GNUNET_NO);
880  cr = GNUNET_new (struct ClientRequest);
881  cr->lc = lc;
883  lc->cr_tail,
884  cr);
886  if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options)))
889  &sm->query,
890  (0 !=
891  memcmp (&sm->target,
892  &all_zeros,
893  sizeof(struct
895  ? &sm->target : NULL, NULL,
896  0 /* bf */,
897  ntohl (sm->anonymity_level),
898  0 /* priority */,
899  0 /* ttl */,
900  0 /* sender PID */,
901  0 /* origin PID */,
902  (const struct
903  GNUNET_HashCode *) &sm[1], sc,
905  cr);
906  }
907  if (0 != (SEARCH_MESSAGE_OPTION_CONTINUED & ntohl (sm->options)))
908  {
910  return;
911  }
913  GSF_local_lookup_ (cr->pr,
915  lc);
916 }
917 
918 
925 static void
927  const struct RequestLocSignatureMessage *msg)
928 {
929  struct GSF_LocalClient *lc = cls;
930  struct GNUNET_FS_Uri base;
931  struct GNUNET_FS_Uri *loc;
932  struct GNUNET_MQ_Envelope *env;
933  struct ResponseLocSignatureMessage *resp;
934 
936  ntohl (msg->purpose));
937  base.type = GNUNET_FS_URI_CHK;
938  base.data.chk.chk = msg->chk;
939  base.data.chk.file_length = GNUNET_ntohll (msg->file_length);
940  loc = GNUNET_FS_uri_loc_create (&base,
941  &pk,
943  msg->expiration_time));
944  env = GNUNET_MQ_msg (resp,
948  loc->data.loc.expirationTime);
949  resp->signature = loc->data.loc.contentSignature;
950  resp->peer = loc->data.loc.peer;
951  GNUNET_FS_uri_destroy (loc);
952  GNUNET_MQ_send (lc->mq,
953  env);
955 }
956 
957 
965 static int
967  const struct IndexStartMessage *ism)
968 {
969  char *fn;
970 
972  if (0 != ism->reserved)
973  {
974  GNUNET_break (0);
975  return GNUNET_SYSERR;
976  }
977  fn = GNUNET_STRINGS_filename_expand ((const char *) &ism[1]);
978  if (NULL == fn)
979  {
980  GNUNET_break (0);
981  return GNUNET_SYSERR;
982  }
983  GNUNET_free (fn);
984  return GNUNET_OK;
985 }
986 
987 
994 static void
996 {
997  struct GSF_LocalClient *lc = isc->lc;
998  struct GNUNET_MQ_Envelope *env;
999  struct GNUNET_MessageHeader *msg;
1000 
1002  &isc->file_id);
1003  env = GNUNET_MQ_msg (msg,
1005  GNUNET_MQ_send (lc->mq,
1006  env);
1007  GNUNET_free (isc->filename);
1008  GNUNET_free (isc);
1010 }
1011 
1012 
1020 static void
1022  const struct GNUNET_HashCode *res)
1023 {
1024  struct IndexStartContext *isc = cls;
1025  struct GSF_LocalClient *lc = isc->lc;
1026  struct GNUNET_MQ_Envelope *env;
1027  struct GNUNET_MessageHeader *msg;
1028 
1030  lc->isc_tail,
1031  isc);
1032  isc->fhc = NULL;
1033  if ((NULL == res) ||
1034  (0 != memcmp (res,
1035  &isc->file_id,
1036  sizeof(struct GNUNET_HashCode))))
1037  {
1039  _ (
1040  "Hash mismatch trying to index file `%s' which does not have hash `%s'\n"),
1041  isc->filename,
1042  GNUNET_h2s (&isc->file_id));
1043 
1044  const char *emsg = "hash mismatch";
1045  const size_t msize = strlen(emsg) + 1;
1046 
1048  msize,
1050  memcpy((char*) &msg[1], emsg, msize);
1051  GNUNET_MQ_send (lc->mq,
1052  env);
1054  GNUNET_free (isc);
1055  return;
1056  }
1057  signal_index_ok (isc);
1058 }
1059 
1060 
1067 static void
1069  const struct IndexStartMessage *ism)
1070 {
1071  struct GSF_LocalClient *lc = cls;
1072  struct IndexStartContext *isc;
1073  char *fn;
1074  uint64_t dev;
1075  uint64_t ino;
1076  uint64_t mydev;
1077  uint64_t myino;
1078 
1079  fn = GNUNET_STRINGS_filename_expand ((const char *) &ism[1]);
1080  GNUNET_assert (NULL != fn);
1081  dev = GNUNET_ntohll (ism->device);
1082  ino = GNUNET_ntohll (ism->inode);
1083  isc = GNUNET_new (struct IndexStartContext);
1084  isc->filename = fn;
1085  isc->file_id = ism->file_id;
1087  "Received START_INDEX message for file `%s'\n",
1088  isc->filename);
1089  isc->lc = lc;
1090  mydev = 0;
1091  myino = 0;
1092  if (((dev != 0) ||
1093  (ino != 0)) &&
1095  &mydev,
1096  &myino)) &&
1097  (dev == mydev) &&
1098  (ino == myino))
1099  {
1100  /* fast validation OK! */
1101  signal_index_ok (isc);
1102  return;
1103  }
1105  "Mismatch in file identifiers (%llu != %llu or %u != %u), need to hash.\n",
1106  (unsigned long long) ino,
1107  (unsigned long long) myino,
1108  (unsigned int) dev,
1109  (unsigned int) mydev);
1110  /* slow validation, need to hash full file (again) */
1112  lc->isc_tail,
1113  isc);
1115  isc->filename,
1118  isc);
1119  if (NULL == isc->fhc)
1120  hash_for_index_val (isc,
1121  NULL);
1122 }
1123 
1124 
1131 static void
1133  const struct GNUNET_MessageHeader *message)
1134 {
1135  struct GSF_LocalClient *lc = cls;
1136 
1139 }
1140 
1141 
1148 static void
1150  const struct UnindexMessage *um)
1151 {
1152  struct GSF_LocalClient *lc = cls;
1153  struct GNUNET_MQ_Envelope *env;
1154  struct GNUNET_MessageHeader *msg;
1155  int found;
1156 
1157  GNUNET_break (0 == um->reserved);
1158  found = GNUNET_FS_indexing_do_unindex (&um->file_id);
1160  "Client requested unindexing of file `%s': %s\n",
1161  GNUNET_h2s (&um->file_id),
1162  found ? "found" : "not found");
1163  env = GNUNET_MQ_msg (msg,
1165  GNUNET_MQ_send (lc->mq,
1166  env);
1168 }
1169 
1170 
1176 static void
1177 shutdown_task (void *cls)
1178 {
1180  if (NULL != GSF_core)
1181  {
1183  GSF_core = NULL;
1184  }
1185  if (NULL != GSF_ats)
1186  {
1188  GSF_ats = NULL;
1189  }
1190  GSF_put_done_ ();
1191  GSF_push_done_ ();
1193  GSF_plan_done ();
1196  GNUNET_NO);
1197  GSF_dsh = NULL;
1199  GSF_dht = NULL;
1201  GSF_block_ctx = NULL;
1203  block_cfg = NULL;
1205  GSF_stats = NULL;
1206  if (NULL != cover_age_task)
1207  {
1209  cover_age_task = NULL;
1210  }
1213  datastore_get_load = NULL;
1215  GSF_rt_entry_lifetime = NULL;
1216 }
1217 
1218 
1229 static void
1231  const struct GNUNET_PeerIdentity *my_identity)
1232 {
1233  if (0 != GNUNET_memcmp (&GSF_my_id,
1234  my_identity))
1235  {
1237  "Peer identity mismatch, refusing to start!\n");
1239  }
1240 }
1241 
1242 
1248 static int
1250 {
1251  struct GNUNET_MQ_MessageHandler no_p2p_handlers[] = {
1253  };
1254  struct GNUNET_MQ_MessageHandler p2p_handlers[] = {
1255  GNUNET_MQ_hd_var_size (p2p_get,
1257  struct GetMessage,
1258  NULL),
1259  GNUNET_MQ_hd_var_size (p2p_put,
1261  struct PutMessage,
1262  NULL),
1263  GNUNET_MQ_hd_fixed_size (p2p_migration_stop,
1265  struct MigrationStopMessage,
1266  NULL),
1268  };
1269  int anon_p2p_off;
1270  char *keyfile;
1271 
1272  /* this option is really only for testcases that need to disable
1273  _anonymous_ file-sharing for some reason */
1274  anon_p2p_off = (GNUNET_YES ==
1276  "fs",
1277  "DISABLE_ANON_TRANSFER"));
1278 
1279  if (GNUNET_OK !=
1281  "PEER",
1282  "PRIVATE_KEY",
1283  &keyfile))
1284  {
1286  _ (
1287  "FS service is lacking HOSTKEY configuration setting. Exiting.\n"));
1289  return GNUNET_SYSERR;
1290  }
1291  if (GNUNET_SYSERR ==
1293  GNUNET_YES,
1294  &pk))
1295  {
1297  "Failed to setup peer's private key\n");
1299  GNUNET_free (keyfile);
1300  return GNUNET_SYSERR;
1301  }
1302  GNUNET_free (keyfile);
1305 
1307  "I am peer %s\n",
1308  GNUNET_i2s (&GSF_my_id));
1309  GSF_core
1311  NULL,
1315  (GNUNET_YES == anon_p2p_off)
1316  ? no_p2p_handlers
1317  : p2p_handlers);
1318  if (NULL == GSF_core)
1319  {
1321  _ ("Failed to connect to `%s' service.\n"),
1322  "core");
1323  return GNUNET_SYSERR;
1324  }
1325  cover_age_task =
1328  NULL);
1332  NULL);
1333  return GNUNET_OK;
1334 }
1335 
1336 
1344 static void
1345 run (void *cls,
1346  const struct GNUNET_CONFIGURATION_Handle *cfg,
1348 {
1349  unsigned long long dqs;
1350 
1351  GSF_cfg = cfg;
1352  if (GNUNET_OK !=
1354  "fs",
1355  "DATASTORE_QUEUE_SIZE",
1356  &dqs))
1357  {
1359  "fs",
1360  "DATASTORE_QUEUE_SIZE");
1361  dqs = 32;
1362  }
1363  GSF_datastore_queue_size = (unsigned int) dqs;
1365  GNUNET_CONFIGURATION_get_value_yesno (cfg, "fs", "DELAY");
1367  if (NULL == GSF_dsh)
1368  {
1370  return;
1371  }
1376  GNUNET_assert (NULL != GSF_block_ctx);
1378  GSF_plan_init ();
1383  NULL);
1384  GSF_push_init_ ();
1385  GSF_put_init_ ();
1387  GSF_dsh)) ||
1388  (GNUNET_OK != main_init (cfg)))
1389  {
1391  shutdown_task (NULL);
1392  return;
1393  }
1394 }
1395 
1396 
1401  ("fs",
1403  &run,
1406  NULL,
1407  GNUNET_MQ_hd_var_size (client_index_start,
1409  struct IndexStartMessage,
1410  NULL),
1411  GNUNET_MQ_hd_fixed_size (client_index_list_get,
1413  struct GNUNET_MessageHeader,
1414  NULL),
1415  GNUNET_MQ_hd_fixed_size (client_unindex,
1417  struct UnindexMessage,
1418  NULL),
1419  GNUNET_MQ_hd_var_size (client_start_search,
1421  struct SearchMessage,
1422  NULL),
1423  GNUNET_MQ_hd_fixed_size (client_loc_sign,
1426  NULL),
1428 
1429 
1430 /* end of gnunet-service-fs.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
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
@ GNUNET_BLOCK_TYPE_FS_UBLOCK
Type of a block representing any type of search result (universal).
@ GNUNET_BLOCK_TYPE_FS_IBLOCK
Inner block in the CHK tree.
@ GNUNET_BLOCK_TYPE_ANY
Identifier for any block.
@ GNUNET_BLOCK_TYPE_FS_ONDEMAND
Type of a block representing a block to be encoded on demand from disk.
@ GNUNET_BLOCK_TYPE_FS_DBLOCK
Data block (leaf) in the CHK tree.
#define GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT
Signature by which a peer affirms that it is providing a certain bit of content for use in LOCation U...
definitions for the entire fs module
#define HASHING_BLOCKSIZE
Blocksize to use when hashing files for indexing (blocksize for IO, not for the DBlocks).
Definition: fs.h:48
#define SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY
Only search the local datastore (no network)
Definition: fs.h:254
#define SEARCH_MESSAGE_OPTION_CONTINUED
Request is too large to fit in 64k format.
Definition: fs.h:262
shared definitions for the FS library
@ GNUNET_FS_URI_CHK
Content-hash-key (simple file).
Definition: fs_api.h:144
#define gettext_noop(String)
Definition: gettext.h:70
static char * expiration
Credential TTL.
Definition: gnunet-abd.c:96
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
static int res
static char * address
GNS address for this phone.
uint32_t data
The data value.
static int result
Global testing status.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:87
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
static struct GNUNET_PeerIdentity my_identity
Identity of this peer.
GNUNET_SERVICE_MAIN("fs", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_var_size(client_index_start, GNUNET_MESSAGE_TYPE_FS_INDEX_START, struct IndexStartMessage, NULL), GNUNET_MQ_hd_fixed_size(client_index_list_get, GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_fixed_size(client_unindex, GNUNET_MESSAGE_TYPE_FS_UNINDEX, struct UnindexMessage, NULL), GNUNET_MQ_hd_var_size(client_start_search, GNUNET_MESSAGE_TYPE_FS_START_SEARCH, struct SearchMessage, NULL), GNUNET_MQ_hd_fixed_size(client_loc_sign, GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGN, struct RequestLocSignatureMessage, NULL), GNUNET_MQ_handler_end())
Define "main" method using service macro.
static struct GNUNET_SCHEDULER_Task * cover_age_task
ID of our task that we use to age the cover counters.
static void handle_client_loc_sign(void *cls, const struct RequestLocSignatureMessage *msg)
Handle request to sign a LOC URI (from client).
#define COVER_AGE_FREQUENCY
How quickly do we age cover traffic? At the given time interval, remaining cover traffic counters are...
int GSF_enable_randomized_delays
Are we introducing randomized delays for better anonymity?
static struct GNUNET_LOAD_Value * datastore_get_load
Datastore 'GET' load tracking.
static int check_p2p_get(void *cls, const struct GetMessage *gm)
Check P2P "GET" request.
void GSF_update_datastore_delay_(struct GNUNET_TIME_Absolute start)
We've just now completed a datastore request.
struct GNUNET_BLOCK_Context * GSF_block_ctx
Our block context.
static void hash_for_index_val(void *cls, const struct GNUNET_HashCode *res)
Function called once the hash computation over an indexed file has completed.
static void start_p2p_processing(void *cls, struct GSF_PendingRequest *pr, enum GNUNET_BLOCK_ReplyEvaluationResult result)
We're done with the local lookup, now consider P2P processing (depending on request options and resul...
static void handle_client_start_search(void *cls, const struct SearchMessage *sm)
Handle GNUNET_MESSAGE_TYPE_FS_START_SEARCH-message (search request from client).
static void handle_client_unindex(void *cls, const struct UnindexMessage *um)
Handle UNINDEX-message.
static void handle_client_index_start(void *cls, const struct IndexStartMessage *ism)
Handle INDEX_START-message.
static int check_client_index_start(void *cls, const struct IndexStartMessage *ism)
Check INDEX_START-message.
static void update_latencies(void *cls, const struct GNUNET_HELLO_Address *address, int active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop)
We've received peer performance information.
static void handle_client_index_list_get(void *cls, const struct GNUNET_MessageHeader *message)
Handle INDEX_LIST_GET-message.
struct GNUNET_DHT_Handle * GSF_dht
Handle for DHT operations.
static struct GNUNET_CRYPTO_EddsaPrivateKey pk
Private key of this peer.
static void consider_request_for_forwarding(void *cls, const struct GNUNET_PeerIdentity *peer, struct GSF_ConnectedPeer *cp, const struct GSF_PeerPerformanceData *ppd)
We have a new request, consider forwarding it to the given peer.
static void shutdown_task(void *cls)
Task run during shutdown.
int GSF_test_get_load_too_high_(uint32_t priority)
Test if the DATABASE (GET) load on this peer is too high to even consider processing the query at all...
struct GNUNET_STATISTICS_Handle * GSF_stats
Handle for reporting statistics.
static void signal_index_ok(struct IndexStartContext *isc)
We've validated the hash of the file we're about to index.
double GSF_current_priorities
Typical priorities we're seeing from other peers right now.
static void peer_init_handler(void *cls, const struct GNUNET_PeerIdentity *my_identity)
Function called after GNUNET_CORE_connect has succeeded (or failed for good).
unsigned int GSF_cover_query_count
How many query messages have we received 'recently' that have not yet been claimed as cover traffic?
const struct GNUNET_CONFIGURATION_Handle * GSF_cfg
Our configuration.
static int check_p2p_put(void *cls, const struct PutMessage *put)
Check P2P "PUT" message.
void GSF_consider_forwarding(void *cls, struct GSF_PendingRequest *pr, enum GNUNET_BLOCK_ReplyEvaluationResult result)
Function to be called after we're done processing replies from the local lookup.
static void age_cover_counters(void *cls)
Task that periodically ages our cover traffic statistics.
static void * client_connect_cb(void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
Creates a fresh local client handle.
struct GNUNET_PeerIdentity GSF_my_id
Identity of this peer.
struct GNUNET_ATS_PerformanceHandle * GSF_ats
Handle to ATS service.
struct GNUNET_CORE_Handle * GSF_core
Pointer to handle to the core service (points to NULL until we've connected to it).
unsigned int GSF_cover_content_count
How many content messages have we received 'recently' that have not yet been claimed as cover traffic...
static void client_response_handler(void *cls, enum GNUNET_BLOCK_ReplyEvaluationResult eval, struct GSF_PendingRequest *pr, uint32_t reply_anonymity_level, struct GNUNET_TIME_Absolute expiration, struct GNUNET_TIME_Absolute last_transmission, enum GNUNET_BLOCK_Type type, const void *data, size_t data_len)
Handle a reply to a pending request.
static void client_disconnect_cb(void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx)
A client disconnected from us.
struct GNUNET_TIME_Relative GSF_avg_latency
Running average of the observed latency to other peers (round trip).
static int main_init(const struct GNUNET_CONFIGURATION_Handle *c)
Process fs requests.
struct GNUNET_LOAD_Value * GSF_rt_entry_lifetime
How long do requests typically stay in the routing table?
struct GNUNET_DATASTORE_Handle * GSF_dsh
Our connection to the datastore.
#define FS_DHT_HT_SIZE
Size for the hash map for DHT requests from the FS service.
static void client_request_destroy(void *cls)
Free the given client request.
unsigned int GSF_datastore_queue_size
Size of the datastore queue we assume for common requests.
static int check_client_start_search(void *cls, const struct SearchMessage *sm)
Check GNUNET_MESSAGE_TYPE_FS_START_SEARCH-message (search request from client).
static void run(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service)
Process fs requests.
static struct GNUNET_CONFIGURATION_Handle * block_cfg
Configuration for block library.
#define DATASTORE_LOAD_AUTODECLINE
At what frequency should our datastore load decrease automatically (since if we don't use it,...
non-anonymous file-transfer
void GSF_cadet_stop_server(void)
Shutdown subsystem for non-anonymous file-sharing.
void GSF_cadet_start_server(void)
Initialize subsystem for non-anonymous file-sharing.
void GSF_connected_peer_done_()
Shutdown peer management subsystem.
void GSF_peer_disconnect_handler(void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls)
A peer disconnected from us.
void GSF_update_peer_latency_(const struct GNUNET_PeerIdentity *id, struct GNUNET_TIME_Relative latency)
Update the latency information kept for the given peer.
void GSF_iterate_connected_peers_(GSF_ConnectedPeerIterator it, void *it_cls)
Iterate over all connected peers.
void * GSF_peer_connect_handler(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
A peer connected to us.
void GSF_connected_peer_init_()
Initialize peer management subsystem.
API to handle 'connected peers'.
int GNUNET_FS_indexing_do_unindex(const struct GNUNET_HashCode *fid)
Remove a file from the index.
void GNUNET_FS_add_to_index(const char *filename, const struct GNUNET_HashCode *file_id)
Add the given file to the list of indexed files.
int GNUNET_FS_indexing_init(const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_DATASTORE_Handle *d)
Initialize the indexing submodule.
void GNUNET_FS_indexing_send_list(struct GNUNET_MQ_Handle *mq)
Transmit information about indexed files to mq.
void GNUNET_FS_indexing_done()
Shutdown the module.
indexing for the file-sharing service
void GSF_plan_init()
Initialize plan subsystem.
void GSF_plan_add_(struct GSF_ConnectedPeer *cp, struct GSF_PendingRequest *pr)
Create a new query plan entry.
void GSF_plan_done()
Shutdown plan subsystem.
API to manage query plan.
int GSF_pending_request_test_target_(struct GSF_PendingRequest *pr, const struct GNUNET_PeerIdentity *target)
Is the given target a legitimate peer for forwarding the given request?
void GSF_cadet_lookup_(struct GSF_PendingRequest *pr)
Consider downloading via cadet (if possible)
void GSF_dht_lookup_(struct GSF_PendingRequest *pr)
Consider looking up the data in the DHT (anonymity-level permitting).
void GSF_local_lookup_(struct GSF_PendingRequest *pr, GSF_LocalLookupContinuation cont, void *cont_cls)
Look up the request in the local datastore.
void GSF_pending_request_init_()
Setup the subsystem.
int GSF_pending_request_test_active_(struct GSF_PendingRequest *pr)
Check if the given request is still active.
void GSF_pending_request_done_()
Shutdown the subsystem.
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
struct GSF_PendingRequest * GSF_pending_request_create_(enum GSF_PendingRequestOptions options, enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode *query, const struct GNUNET_PeerIdentity *target, const char *bf_data, size_t bf_size, uint32_t anonymity_level, uint32_t priority, int32_t ttl, GNUNET_PEER_Id sender_pid, GNUNET_PEER_Id origin_pid, const struct GNUNET_HashCode *replies_seen, unsigned int replies_seen_count, GSF_PendingRequestReplyHandler rh, void *rh_cls)
Create a new pending request.
void GSF_pending_request_cancel_(struct GSF_PendingRequest *pr, int full_cleanup)
Explicitly cancel a pending request.
void GSF_pending_request_update_(struct GSF_PendingRequest *pr, const struct GNUNET_HashCode *replies_seen, unsigned int replies_seen_count)
Update a given pending request with additional replies that have been seen.
API to handle pending requests.
GSF_PendingRequestOptions
Options for pending requests (bits to be ORed).
@ GSF_PRO_LOCAL_REQUEST
Option mask for typical local requests.
@ GSF_PRO_LOCAL_ONLY
Request must only be processed locally.
void GSF_push_init_()
Setup the module.
void GSF_push_done_()
Shutdown the module.
support for pushing out content
void GSF_put_init_()
Setup the module.
void GSF_put_done_()
Shutdown the module.
support for putting content into the DHT
static struct GNUNET_PeerIdentity all_zeros
Peer identity that is all zeros, used as a way to indicate "all peers".
static struct GNUNET_TRANSPORT_PluginMonitor * pm
Handle if we are monitoring plugin session activity.
Core service; the main API for encrypted P2P communications.
API to the DHT service.
Functions related to load calculations.
Constants for network protocols.
API to create, modify and access statistics.
struct GNUNET_ATS_PerformanceHandle * GNUNET_ATS_performance_init(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_AddressInformationCallback addr_info_cb, void *addr_info_cb_cls)
Get handle to access performance API of the ATS subsystem.
void GNUNET_ATS_performance_done(struct GNUNET_ATS_PerformanceHandle *ph)
Client is done using the ATS performance subsystem, release resources.
GNUNET_BLOCK_ReplyEvaluationResult
Possible ways for how a block may relate to a query.
void GNUNET_BLOCK_context_destroy(struct GNUNET_BLOCK_Context *ctx)
Destroy the block context.
Definition: block.c:156
struct GNUNET_BLOCK_Context * GNUNET_BLOCK_context_create(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a block context.
Definition: block.c:140
@ GNUNET_BLOCK_REPLY_OK_LAST
Last possible valid result.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_size(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *size)
Get a configuration value that should be a size in bytes.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_yesno(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Get a configuration value that should be in a set of "YES" or "NO".
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)
Connect to the core service.
Definition: core_api.c:691
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
Definition: core_api.c:729
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_key_from_file(const char *filename, int do_create, struct GNUNET_CRYPTO_EddsaPrivateKey *pkey)
Create a new private key by reading it from a file.
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
struct GNUNET_DATASTORE_Handle * GNUNET_DATASTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the datastore service.
void GNUNET_DATASTORE_disconnect(struct GNUNET_DATASTORE_Handle *h, int drop)
Disconnect from the datastore service (and free associated resources).
struct GNUNET_DHT_Handle * GNUNET_DHT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int ht_len)
Initialize the connection with the DHT service.
Definition: dht_api.c:1039
void GNUNET_DHT_disconnect(struct GNUNET_DHT_Handle *handle)
Shutdown connection with the DHT service.
Definition: dht_api.c:1062
enum GNUNET_GenericReturnValue GNUNET_DISK_file_get_identifiers(const char *filename, uint64_t *dev, uint64_t *ino)
Obtain some unique identifiers for the given file that can be used to identify it in the local system...
Definition: disk.c:240
#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.
struct GNUNET_FS_Uri * GNUNET_FS_uri_loc_create(const struct GNUNET_FS_Uri *base_uri, const struct GNUNET_CRYPTO_EddsaPrivateKey *sign_key, struct GNUNET_TIME_Absolute expiration_time)
Construct a location URI (this peer will be used for the location).
Definition: fs_uri.c:869
void GNUNET_FS_uri_destroy(struct GNUNET_FS_Uri *uri)
Free URI.
Definition: fs_uri.c:677
struct GNUNET_CRYPTO_FileHashContext * GNUNET_CRYPTO_hash_file(enum GNUNET_SCHEDULER_Priority priority, const char *filename, size_t blocksize, GNUNET_CRYPTO_HashCompletedCallback callback, void *callback_cls)
Compute the hash of an entire file.
#define GNUNET_log(kind,...)
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:54
void * cls
Closure for mv and cb.
void GNUNET_CRYPTO_hash_file_cancel(struct GNUNET_CRYPTO_FileHashContext *fhc)
Cancel a file hashing operation.
#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.
#define GNUNET_MIN(a, b)
@ GNUNET_SCHEDULER_PRIORITY_IDLE
Run when otherwise idle.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
struct GNUNET_LOAD_Value * GNUNET_LOAD_value_init(struct GNUNET_TIME_Relative autodecline)
Create a new load value.
Definition: load.c:125
void GNUNET_LOAD_update(struct GNUNET_LOAD_Value *load, uint64_t data)
Update the current load.
Definition: load.c:237
double GNUNET_LOAD_get_load(struct GNUNET_LOAD_Value *load)
Get the current load.
Definition: load.c:201
#define GNUNET_LOAD_value_free(lv)
Free a load value.
#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_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ 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.
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:304
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_check_zero_termination(m)
Insert code for a "check_" function that verifies that a given variable-length message received over ...
#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:62
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:77
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET
Request from client for list of indexed files.
#define GNUNET_MESSAGE_TYPE_FS_UNINDEX_OK
Reply to client indicating unindex receipt.
#define GNUNET_MESSAGE_TYPE_FS_START_SEARCH
Client asks FS service to start a (keyword) search.
#define GNUNET_MESSAGE_TYPE_FS_INDEX_START
Message sent by fs client to start indexing.
#define GNUNET_MESSAGE_TYPE_FS_PUT
P2P response with content or active migration of content.
#define GNUNET_MESSAGE_TYPE_FS_GET
P2P request for content (one FS to another).
#define GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP
Peer asks us to stop migrating content towards it for a while.
#define GNUNET_MESSAGE_TYPE_FS_UNINDEX
Request from client to unindex a file.
#define GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED
Response to a request for start indexing that refuses.
#define GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGN
Message sent by fs client to request LOC signature.
#define GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGNATURE
Reply sent by fs service with LOC signature.
#define GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK
Affirmative response to a request for start indexing.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:534
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1268
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:1303
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:944
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:1241
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2249
@ 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_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.
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
char * GNUNET_STRINGS_filename_expand(const char *fil)
Complete filename (a la shell) from abbrevition.
Definition: strings.c:494
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
Definition: time.c:436
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
Definition: time.c:737
struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a)
Convert absolute time to network byte order.
Definition: time.c:638
#define _(String)
GNU gettext support macro.
Definition: platform.h:177
static GNUNET_CronTime last_transmission
Response from FS service with a result for a previous FS search.
Definition: fs.h:356
Doubly-linked list of requests we are performing on behalf of the same client.
struct ClientRequest * prev
This is a doubly-linked list.
struct GNUNET_SCHEDULER_Task * kill_task
Task scheduled to destroy the request.
struct ClientRequest * next
This is a doubly-linked list.
struct GSF_LocalClient * lc
Client list this request belongs to.
struct GSF_PendingRequest * pr
Request this entry represents.
Replies to be transmitted to the client.
size_t msize
Number of bytes in the response.
struct ClientResponse * prev
This is a doubly-linked list.
struct GSF_LocalClient * lc
Client list entry this response belongs to.
struct ClientResponse * next
This is a doubly-linked list.
struct ContentHashKey chk
Query and key of the top GNUNET_EC_IBlock.
Definition: fs_api.h:104
uint64_t file_length
Total size of the file in bytes.
Definition: fs_api.h:99
ATS Handle to obtain and/or modify performance information.
ATS performance characteristics for an address.
struct GNUNET_TIME_Relative delay
Delay.
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
Handle to an initialized block library.
Definition: block.c:55
Context for the core service connection.
Definition: core_api.c:78
Private ECC key encoded for transmission.
Context used when hashing a file.
Handle to the datastore service.
Connection to the DHT service.
Definition: dht_api.c:237
A Universal Resource Identifier (URI), opaque.
Definition: fs_api.h:167
union GNUNET_FS_Uri::@13 data
enum GNUNET_FS_UriType type
Type of the URI.
Definition: fs_api.h:171
struct Location loc
Information needed to retrieve a file including signed location (identity of a peer) of the content.
Definition: fs_api.h:218
struct FileIdentifier chk
Information needed to retrieve a file (content-hash-key plus file size).
Definition: fs_api.h:212
An address for communicating with a peer.
A 512-bit hashcode.
Values we track for load calculations.
Definition: load.c:37
Handle to a message queue.
Definition: mq.c:87
Message handler for a specific message type.
Header for all communications.
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
Entry in list of pending tasks.
Definition: scheduler.c:136
Handle to a client that is connected to a service.
Definition: service.c:252
Handle to a service.
Definition: service.c:118
Handle for the service.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
A connected peer.
A local client.
struct IndexStartContext * isc_head
This is a doubly linked list.
struct ClientRequest * cr_head
Head of list of requests performed on behalf of this client right now.
struct ClientResponse * res_tail
Tail of linked list of responses.
struct ClientRequest * cr_tail
Tail of list of requests performed on behalf of this client right now.
struct GNUNET_MQ_Handle * mq
Queue for sending replies.
struct IndexStartContext * isc_tail
This is a doubly linked list.
struct ClientResponse * res_head
Head of linked list of responses.
struct GNUNET_SERVICE_Client * client
ID of the client.
Performance data kept for a peer.
Public data (in the sense of not encapsulated within 'gnunet-service-fs_pr', not in the sense of netw...
int has_started
Has this request been started yet (local/p2p operations)? Or are we still constructing it?
uint32_t respect_offered
How much respect did we (in total) offer for this request so far (estimate, because we might have the...
enum GNUNET_BLOCK_Type type
Type of the requested block.
uint32_t num_transmissions
Counter for how often this request has been transmitted (estimate, because we might have the same req...
uint32_t anonymity_level
Desired anonymity level.
struct GNUNET_HashCode query
Primary query hash for this request.
An active request.
Message to the datastore service asking about specific content.
Definition: datastore.h:141
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET.
Definition: datastore.h:145
uint32_t hash_bitmap
Which of the optional hash codes are present at the end of the message? See GET_MESSAGE_BIT_xx consta...
Information we track while handling an index start request from a client.
struct GNUNET_CRYPTO_FileHashContext * fhc
Context for hashing of the file.
struct GNUNET_HashCode file_id
Hash of the contents of the file.
struct IndexStartContext * next
This is a doubly linked list.
struct IndexStartContext * prev
This is a doubly linked list.
struct GSF_LocalClient * lc
Context for transmitting confirmation to client.
char * filename
Name of the indexed file.
Message sent from a GNUnet (fs) publishing activity to the gnunet-fs-service to initiate indexing of ...
Definition: fs.h:153
uint64_t inode
Inode of the file on the given device, as seen by the client ("st_ino" field from "struct stat").
Definition: fs.h:179
struct GNUNET_HashCode file_id
Hash of the file that we would like to index.
Definition: fs.h:184
uint32_t reserved
For alignment.
Definition: fs.h:162
uint64_t device
ID of device containing the file, as seen by the client.
Definition: fs.h:171
struct GNUNET_TIME_Absolute expirationTime
Time when this location URI expires.
Definition: fs_api.h:127
struct GNUNET_CRYPTO_EddsaSignature contentSignature
Signature over the GNUNET_EC_FileIdentifier, peer identity and expiration time.
Definition: fs_api.h:133
struct GNUNET_PeerIdentity peer
Identity of the peer sharing the file.
Definition: fs_api.h:122
Message send by a peer that wants to be excluded from migration for a while.
Response from FS service with a result for a previous FS search.
Definition: fs.h:330
uint32_t type
Type of the block (in big endian).
Definition: fs.h:339
Message sent from a GNUnet (fs) publishing activity to sign a LOC URI.
Definition: fs.h:76
Message sent from the service with the signed LOC URI.
Definition: fs.h:109
struct GNUNET_CRYPTO_EddsaSignature signature
The requested signature.
Definition: fs.h:130
struct GNUNET_PeerIdentity peer
Identity of the peer sharing the file.
Definition: fs.h:135
uint32_t purpose
Purpose of the generated signature.
Definition: fs.h:120
struct GNUNET_TIME_AbsoluteNBO expiration_time
Expiration time that was actually used (rounded!).
Definition: fs.h:125
Message sent from a GNUnet (fs) search activity to the gnunet-service-fs to start a search.
Definition: fs.h:270
struct GNUNET_PeerIdentity target
If the request is for a DBLOCK or IBLOCK, this is the identity of the peer that is known to have a re...
Definition: fs.h:307
uint32_t type
Type of the content that we're looking for.
Definition: fs.h:290
struct GNUNET_HashCode query
Hash of the public key for UBLOCKs; Hash of the CHK-encoded block for DBLOCKS and IBLOCKS.
Definition: fs.h:313
uint32_t anonymity_level
Desired anonymity level, big-endian.
Definition: fs.h:295
struct GNUNET_MessageHeader header
Message type will be GNUNET_MESSAGE_TYPE_FS_START_SEARCH.
Definition: fs.h:274
uint32_t options
Bitmask with options.
Definition: fs.h:285
Message sent from a GNUnet (fs) unindexing activity to the gnunet-service-fs to indicate that a file ...
Definition: fs.h:228
struct GNUNET_HashCode file_id
Hash of the file that we will unindex.
Definition: fs.h:242
uint32_t reserved
Always zero.
Definition: fs.h:237
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.