GNUnet 0.27.0
 
Loading...
Searching...
No Matches
gnunet-service-fs.c File Reference

gnunet anonymity protocol implementation More...

Include dependency graph for gnunet-service-fs.c:

Go to the source code of this file.

Data Structures

struct  ClientRequest
 Doubly-linked list of requests we are performing on behalf of the same client. More...
 
struct  ClientResponse
 Replies to be transmitted to the client. More...
 
struct  IndexStartContext
 Information we track while handling an index start request from a client. More...
 
struct  GSF_LocalClient
 A local client. More...
 

Macros

#define FS_DHT_HT_SIZE   1024
 Size for the hash map for DHT requests from the FS service.
 
#define COVER_AGE_FREQUENCY
 How quickly do we age cover traffic? At the given time interval, remaining cover traffic counters are decremented by 1/16th.
 
#define INSANE_STATISTICS   GNUNET_NO
 Collect an instance number of statistics? May cause excessive IPC.
 

Functions

static void * client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
 Creates a fresh local client handle.
 
static void client_request_destroy (void *cls)
 Free the given client request.
 
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.
 
static void age_cover_counters (void *cls)
 Task that periodically ages our cover traffic statistics.
 
void GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start)
 We've just now completed a datastore request.
 
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.
 
static int check_p2p_put (void *cls, const struct PutMessage *put)
 Check P2P "PUT" message.
 
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.
 
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 int check_p2p_get (void *cls, const struct GetMessage *gm)
 Check P2P "GET" request.
 
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 result status).
 
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 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_loc_sign (void *cls, const struct RequestLocSignatureMessage *msg)
 Handle request to sign a LOC URI (from client).
 
static int check_client_index_start (void *cls, const struct IndexStartMessage *ism)
 Check INDEX_START-message.
 
static void signal_index_ok (struct IndexStartContext *isc)
 We've validated the hash of the file we're about to index.
 
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 handle_client_index_start (void *cls, const struct IndexStartMessage *ism)
 Handle INDEX_START-message.
 
static void handle_client_index_list_get (void *cls, const struct GNUNET_MessageHeader *message)
 Handle INDEX_LIST_GET-message.
 
static void handle_client_unindex (void *cls, const struct UnindexMessage *um)
 Handle UNINDEX-message.
 
static void shutdown_task (void *cls)
 Task run during shutdown.
 
static int main_init (const struct GNUNET_CONFIGURATION_Handle *c)
 Process fs requests.
 
static void run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service)
 Process fs requests.
 
 GNUNET_SERVICE_MAIN (GNUNET_OS_project_data_gnunet(), "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.
 

Variables

struct GNUNET_DATASTORE_HandleGSF_dsh
 Our connection to the datastore.
 
const struct GNUNET_CONFIGURATION_HandleGSF_cfg
 Our configuration.
 
struct GNUNET_STATISTICS_HandleGSF_stats
 Handle for reporting statistics.
 
struct GNUNET_DHT_HandleGSF_dht
 Handle for DHT operations.
 
struct GNUNET_LOAD_ValueGSF_rt_entry_lifetime
 How long do requests typically stay in the routing table?
 
struct GNUNET_TIME_Relative GSF_avg_latency = { 500 }
 Running average of the observed latency to other peers (round trip).
 
double GSF_current_priorities
 Typical priorities we're seeing from other peers right now.
 
unsigned int GSF_datastore_queue_size
 Size of the datastore queue we assume for common requests.
 
unsigned int GSF_cover_query_count
 How many query messages have we received 'recently' that have not yet been claimed as cover traffic?
 
unsigned int GSF_cover_content_count
 How many content messages have we received 'recently' that have not yet been claimed as cover traffic?
 
struct GNUNET_BLOCK_ContextGSF_block_ctx
 Our block context.
 
struct GNUNET_CORE_HandleGSF_core
 Pointer to handle to the core service (points to NULL until we've connected to it).
 
struct GNUNET_PILS_HandleGSF_pils
 Pointer to handle of the pils service (points to NULL until we've connected to it).
 
int GSF_enable_randomized_delays
 Are we introducing randomized delays for better anonymity?
 
static struct GNUNET_CONFIGURATION_Handleblock_cfg
 Configuration for block library.
 
static struct GNUNET_CRYPTO_EddsaPrivateKey pk
 Private key of this peer.
 
static struct GNUNET_SCHEDULER_Taskcover_age_task
 ID of our task that we use to age the cover counters.
 
static struct GNUNET_LOAD_Valuedatastore_get_load
 Datastore 'GET' load tracking.
 

Detailed Description

gnunet anonymity protocol implementation

Author
Christian Grothoff

Definition in file gnunet-service-fs.c.

Macro Definition Documentation

◆ FS_DHT_HT_SIZE

#define FS_DHT_HT_SIZE   1024

Size for the hash map for DHT requests from the FS service.

Should be about the number of concurrent DHT requests we plan to make.

Definition at line 52 of file gnunet-service-fs.c.

◆ COVER_AGE_FREQUENCY

#define COVER_AGE_FREQUENCY
Value:
#define GNUNET_TIME_UNIT_SECONDS
One second.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition time.c:486

How quickly do we age cover traffic? At the given time interval, remaining cover traffic counters are decremented by 1/16th.

Definition at line 60 of file gnunet-service-fs.c.

73{
77 struct ClientRequest *next;
78
82 struct ClientRequest *prev;
83
87 struct GSF_PendingRequest *pr;
88
92 struct GSF_LocalClient *lc;
93
97 struct GNUNET_SCHEDULER_Task *kill_task;
98};
99
100
105struct ClientResponse
106{
110 struct ClientResponse *next;
111
115 struct ClientResponse *prev;
116
120 struct GSF_LocalClient *lc;
121
125 size_t msize;
126};
127
128
134{
138 struct IndexStartContext *next;
139
143 struct IndexStartContext *prev;
144
148 char *filename;
149
153 struct GSF_LocalClient *lc;
154
159
164};
165
166
170struct GSF_LocalClient
171{
176
180 struct GNUNET_MQ_Handle *mq;
181
186 struct ClientRequest *cr_head;
187
192 struct ClientRequest *cr_tail;
193
198
203
207 struct ClientResponse *res_head;
208
212 struct ClientResponse *res_tail;
213};
214
215
216/* ****************************** globals ****************************** */
217
222
227
232
237
242
248
249
261
265unsigned int GSF_datastore_queue_size;
266
271unsigned int GSF_cover_query_count;
272
277unsigned int GSF_cover_content_count;
278
283
289
295
300
301/* ***************************** locals ******************************* */
302
307
312
317
322
323
332static void *
333client_connect_cb (void *cls,
334 struct GNUNET_SERVICE_Client *client,
335 struct GNUNET_MQ_Handle *mq)
336{
337 struct GSF_LocalClient *pos;
338
339 pos = GNUNET_new (struct GSF_LocalClient);
340 pos->client = client;
341 pos->mq = mq;
342 return pos;
343}
344
345
351static void
352client_request_destroy (void *cls)
353{
354 struct ClientRequest *cr = cls;
355 struct GSF_LocalClient *lc = cr->lc;
356
357 cr->kill_task = NULL;
359 lc->cr_tail,
360 cr);
362 GNUNET_YES);
364 gettext_noop ("# client searches active"),
365 -1,
366 GNUNET_NO);
367 GNUNET_free (cr);
368}
369
370
389static void
390client_response_handler (void *cls,
392 struct GSF_PendingRequest *pr,
393 uint32_t reply_anonymity_level,
395 struct GNUNET_TIME_Absolute last_transmission,
397 const void *data,
398 size_t data_len)
399{
400 struct ClientRequest *cr = cls;
401 struct GSF_LocalClient *lc;
402 struct GNUNET_MQ_Envelope *env;
403 struct ClientPutMessage *pm;
404 const struct GSF_PendingRequestData *prd;
405
406 if (NULL == data)
407 {
408 /* local-only request, with no result, clean up. */
409 if (NULL == cr->kill_task)
411 cr);
412 return;
413 }
416 if ((prd->type != type) && (prd->type != GNUNET_BLOCK_TYPE_ANY))
417 {
418 GNUNET_break (0);
419 return;
420 }
423 ("# replies received for local clients"), 1,
424 GNUNET_NO);
425 GNUNET_assert (pr == cr->pr);
426 lc = cr->lc;
428 data_len,
430 pm->type = htonl (type);
432 pm->last_transmission = GNUNET_TIME_absolute_hton (last_transmission);
433 pm->num_transmissions = htonl (prd->num_transmissions);
434 pm->respect_offered = htonl (prd->respect_offered);
435 GNUNET_memcpy (&pm[1],
436 data,
437 data_len);
438 GNUNET_MQ_send (lc->mq,
439 env);
441 "Queued reply to query `%s' for local client\n",
442 GNUNET_h2s (&prd->query));
443 if (GNUNET_BLOCK_REPLY_OK_LAST != eval)
444 {
446 "Evaluation %d - keeping query alive\n",
447 (int) eval);
448 return;
449 }
450 if (NULL == cr->kill_task)
452 cr);
453}
454
455
464static void
465client_disconnect_cb (void *cls,
466 struct GNUNET_SERVICE_Client *client,
467 void *app_ctx)
468{
469 struct GSF_LocalClient *lc = app_ctx;
470 struct IndexStartContext *isc;
471 struct ClientRequest *cr;
472 struct ClientResponse *res;
473
474 while (NULL != (cr = lc->cr_head))
475 {
476 if (NULL != cr->kill_task)
479 }
480 while (NULL != (res = lc->res_head))
481 {
483 lc->res_tail,
484 res);
486 }
487 while (NULL != (isc = lc->isc_head))
488 {
490 lc->isc_tail,
491 isc);
493 GNUNET_free (isc);
494 }
495 GNUNET_free (lc);
496}
497
498
504static void
505age_cover_counters (void *cls)
506{
512 NULL);
513}
514
515
522void
524{
525 struct GNUNET_TIME_Relative delay;
526
528 GNUNET_LOAD_update (datastore_get_load, delay.rel_value_us);
529}
530
531
542int
543GSF_test_get_load_too_high_ (uint32_t priority)
544{
545 double ld;
546
548 if (ld < 1)
549 return GNUNET_SYSERR;
550 if (ld <= priority)
551 return GNUNET_NO;
552 return GNUNET_YES;
553}
554
555
564static int
565check_p2p_put (void *cls,
566 const struct PutMessage *put)
567{
569
570 type = ntohl (put->type);
572 {
573 GNUNET_break_op (0);
574 return GNUNET_SYSERR;
575 }
576 return GNUNET_OK;
577}
578
579
589static void
591 const struct GNUNET_PeerIdentity *peer,
592 struct GSF_ConnectedPeer *cp,
593 const struct GSF_PeerPerformanceData *ppd)
594{
595 struct GSF_PendingRequest *pr = cls;
596
597 if (GNUNET_YES !=
599 {
600#if INSANE_STATISTICS
602 gettext_noop ("# Loopback routes suppressed"), 1,
603 GNUNET_NO);
604#endif
605 return;
606 }
607 GSF_plan_add_ (cp,
608 pr);
609}
610
611
622void
623GSF_consider_forwarding (void *cls,
624 struct GSF_PendingRequest *pr,
626{
628 return; /* we're done... */
629 if (GNUNET_YES !=
631 return; /* request is not actually active, skip! */
633 pr);
634}
635
636
645static int
646check_p2p_get (void *cls,
647 const struct GetMessage *gm)
648{
649 size_t msize;
650 unsigned int bm;
651 unsigned int bits;
652 size_t bfsize;
653
654 msize = ntohs (gm->header.size);
655 bm = ntohl (gm->hash_bitmap);
656 bits = 0;
657 while (bm > 0)
658 {
659 if (1 == (bm & 1))
660 bits++;
661 bm >>= 1;
662 }
663 if (msize < sizeof(struct GetMessage) + bits * sizeof(struct
665 {
666 GNUNET_break_op (0);
667 return GNUNET_SYSERR;
668 }
669 bfsize = msize - sizeof(struct GetMessage) - bits * sizeof(struct
671 /* bfsize must be power of 2, check! */
672 if (0 != ((bfsize - 1) & bfsize))
673 {
674 GNUNET_break_op (0);
675 return GNUNET_SYSERR;
676 }
677 return GNUNET_OK;
678}
679
680
691static void
692start_p2p_processing (void *cls,
693 struct GSF_PendingRequest *pr,
695{
696 struct GSF_LocalClient *lc = cls;
697 struct GSF_PendingRequestData *prd;
698
701 return; /* we're done, 'pr' was already destroyed... */
704 "Finished database lookup for local request `%s' with result %d\n",
705 GNUNET_h2s (&prd->query),
706 result);
707 if (0 == prd->anonymity_level)
708 {
709 switch (prd->type)
710 {
713 /* the above block types MAY be available via 'cadet' */
715 "Considering cadet-based download for block\n");
717 break;
718
720 /* the above block types are in the DHT */
722 "Considering DHT-based search for block\n");
723 GSF_dht_lookup_ (pr);
724 break;
725
726 default:
727 GNUNET_break (0);
728 break;
729 }
730 }
732 pr,
733 result);
734}
735
736
745static int
747 const struct SearchMessage *sm)
748{
749 uint16_t msize;
750
751 msize = ntohs (sm->header.size) - sizeof(struct SearchMessage);
752 if (0 != msize % sizeof(struct GNUNET_HashCode))
753 {
754 GNUNET_break (0);
755 return GNUNET_SYSERR;
756 }
757 return GNUNET_OK;
758}
759
760
771static void
773 const struct SearchMessage *sm)
774{
775 static struct GNUNET_PeerIdentity all_zeros;
776 struct GSF_LocalClient *lc = cls;
777 struct ClientRequest *cr;
778 struct GSF_PendingRequestData *prd;
779 uint16_t msize;
780 unsigned int sc;
783
785 gettext_noop ("# client searches received"),
786 1,
787 GNUNET_NO);
788 msize = ntohs (sm->header.size) - sizeof(struct SearchMessage);
789 sc = msize / sizeof(struct GNUNET_HashCode);
790 type = ntohl (sm->type);
792 "Received request for `%s' of type %u from local client\n",
793 GNUNET_h2s (&sm->query),
794 (unsigned int) type);
795 cr = NULL;
796 /* detect duplicate UBLOCK requests */
799 {
800 cr = lc->cr_head;
801 while (NULL != cr)
802 {
804 /* only unify with queries that hae not yet started local processing
805 (SEARCH_MESSAGE_OPTION_CONTINUED was always set) and that have a
806 matching query and type */
807 if ((GNUNET_YES != prd->has_started) &&
808 (0 != memcmp (&prd->query,
809 &sm->query,
810 sizeof(struct GNUNET_HashCode))) &&
811 (prd->type == type))
812 break;
813 cr = cr->next;
814 }
815 }
816 if (NULL != cr)
817 {
819 "Have existing request, merging content-seen lists.\n");
821 (const struct GNUNET_HashCode *) &sm[1],
822 sc);
825 "# client searches updated (merged content seen list)"),
826 1,
827 GNUNET_NO);
828 }
829 else
830 {
832 gettext_noop ("# client searches active"),
833 1,
834 GNUNET_NO);
835 cr = GNUNET_new (struct ClientRequest);
836 cr->lc = lc;
838 lc->cr_tail,
839 cr);
841 if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options)))
844 &sm->query,
845 (0 !=
846 memcmp (&sm->target,
847 &all_zeros,
848 sizeof(struct
850 ? &sm->target : NULL, NULL,
851 0 /* bf */,
852 ntohl (sm->anonymity_level),
853 0 /* priority */,
854 0 /* ttl */,
855 0 /* sender PID */,
856 0 /* origin PID */,
857 (const struct
858 GNUNET_HashCode *) &sm[1], sc,
860 cr);
861 }
862 if (0 != (SEARCH_MESSAGE_OPTION_CONTINUED & ntohl (sm->options)))
863 {
865 return;
866 }
870 lc);
871}
872
873
880static void
881handle_client_loc_sign (void *cls,
882 const struct RequestLocSignatureMessage *msg)
883{
884 struct GSF_LocalClient *lc = cls;
885 struct GNUNET_FS_Uri base;
886 struct GNUNET_FS_Uri *loc;
887 struct GNUNET_MQ_Envelope *env;
888 struct ResponseLocSignatureMessage *resp;
889
891 ntohl (msg->purpose));
892 base.type = GNUNET_FS_URI_CHK;
893 base.data.chk.chk = msg->chk;
894 base.data.chk.file_length = GNUNET_ntohll (msg->file_length);
895 loc = GNUNET_FS_uri_loc_create (&base,
896 &pk,
898 msg->expiration_time));
899 env = GNUNET_MQ_msg (resp,
903 loc->data.loc.expirationTime);
904 resp->signature = loc->data.loc.contentSignature;
905 resp->peer = loc->data.loc.peer;
907 GNUNET_MQ_send (lc->mq,
908 env);
910}
911
912
920static int
921check_client_index_start (void *cls,
922 const struct IndexStartMessage *ism)
923{
924 char *fn;
925
927 if (0 != ism->reserved)
928 {
929 GNUNET_break (0);
930 return GNUNET_SYSERR;
931 }
932 fn = GNUNET_STRINGS_filename_expand ((const char *) &ism[1]);
933 if (NULL == fn)
934 {
935 GNUNET_break (0);
936 return GNUNET_SYSERR;
937 }
938 GNUNET_free (fn);
939 return GNUNET_OK;
940}
941
942
949static void
951{
952 struct GSF_LocalClient *lc = isc->lc;
953 struct GNUNET_MQ_Envelope *env;
955
957 &isc->file_id);
960 GNUNET_MQ_send (lc->mq,
961 env);
962 GNUNET_free (isc->filename);
963 GNUNET_free (isc);
965}
966
967
975static void
976hash_for_index_val (void *cls,
977 const struct GNUNET_HashCode *res)
978{
979 struct IndexStartContext *isc = cls;
980 struct GSF_LocalClient *lc = isc->lc;
981 struct GNUNET_MQ_Envelope *env;
983
985 lc->isc_tail,
986 isc);
987 isc->fhc = NULL;
988 if ((NULL == res) ||
989 (0 != memcmp (res,
990 &isc->file_id,
991 sizeof(struct GNUNET_HashCode))))
992 {
994 _ (
995 "Hash mismatch trying to index file `%s' which does not have hash `%s'\n"),
996 isc->filename,
997 GNUNET_h2s (&isc->file_id));
998
999 const char *emsg = "hash mismatch";
1000 const size_t msize = strlen (emsg) + 1;
1001
1003 msize,
1005 memcpy ((char*) &msg[1], emsg, msize);
1006 GNUNET_MQ_send (lc->mq,
1007 env);
1009 GNUNET_free (isc);
1010 return;
1011 }
1012 signal_index_ok (isc);
1013}
1014
1015
1022static void
1023handle_client_index_start (void *cls,
1024 const struct IndexStartMessage *ism)
1025{
1026 struct GSF_LocalClient *lc = cls;
1027 struct IndexStartContext *isc;
1028 char *fn;
1029 uint64_t dev;
1030 uint64_t ino;
1031 uint64_t mydev;
1032 uint64_t myino;
1033
1034 fn = GNUNET_STRINGS_filename_expand ((const char *) &ism[1]);
1035 GNUNET_assert (NULL != fn);
1036 dev = GNUNET_ntohll (ism->device);
1037 ino = GNUNET_ntohll (ism->inode);
1038 isc = GNUNET_new (struct IndexStartContext);
1039 isc->filename = fn;
1040 isc->file_id = ism->file_id;
1042 "Received START_INDEX message for file `%s'\n",
1043 isc->filename);
1044 isc->lc = lc;
1045 mydev = 0;
1046 myino = 0;
1047 if (((dev != 0) ||
1048 (ino != 0)) &&
1050 &mydev,
1051 &myino)) &&
1052 (dev == mydev) &&
1053 (ino == myino))
1054 {
1055 /* fast validation OK! */
1056 signal_index_ok (isc);
1057 return;
1058 }
1060 "Mismatch in file identifiers (%llu != %llu or %u != %u), need to hash.\n",
1061 (unsigned long long) ino,
1062 (unsigned long long) myino,
1063 (unsigned int) dev,
1064 (unsigned int) mydev);
1065 /* slow validation, need to hash full file (again) */
1067 lc->isc_tail,
1068 isc);
1070 isc->filename,
1073 isc);
1074 if (NULL == isc->fhc)
1075 hash_for_index_val (isc,
1076 NULL);
1077}
1078
1079
1086static void
1088 const struct GNUNET_MessageHeader *message)
1089{
1090 struct GSF_LocalClient *lc = cls;
1091
1094}
1095
1096
1103static void
1104handle_client_unindex (void *cls,
1105 const struct UnindexMessage *um)
1106{
1107 struct GSF_LocalClient *lc = cls;
1108 struct GNUNET_MQ_Envelope *env;
1109 struct GNUNET_MessageHeader *msg;
1110 int found;
1111
1112 GNUNET_break (0 == um->reserved);
1115 "Client requested unindexing of file `%s': %s\n",
1116 GNUNET_h2s (&um->file_id),
1117 found ? "found" : "not found");
1120 GNUNET_MQ_send (lc->mq,
1121 env);
1123}
1124
1125
1131static void
1132shutdown_task (void *cls)
1133{
1135 if (NULL != GSF_core)
1136 {
1138 GSF_core = NULL;
1139 }
1140 if (NULL != GSF_pils)
1141 {
1143 GSF_pils = NULL;
1144 }
1145 GSF_put_done_ ();
1146 GSF_push_done_ ();
1148 GSF_plan_done ();
1151 GNUNET_NO);
1152 GSF_dsh = NULL;
1154 GSF_dht = NULL;
1156 GSF_block_ctx = NULL;
1158 block_cfg = NULL;
1160 GSF_stats = NULL;
1161 if (NULL != cover_age_task)
1162 {
1164 cover_age_task = NULL;
1165 }
1168 datastore_get_load = NULL;
1170 GSF_rt_entry_lifetime = NULL;
1171}
1172
1173
1179static int
1180main_init (const struct GNUNET_CONFIGURATION_Handle *c)
1181{
1182 struct GNUNET_MQ_MessageHandler no_p2p_handlers[] = {
1184 };
1185 struct GNUNET_MQ_MessageHandler p2p_handlers[] = {
1186 GNUNET_MQ_hd_var_size (p2p_get,
1188 struct GetMessage,
1189 NULL),
1190 GNUNET_MQ_hd_var_size (p2p_put,
1192 struct PutMessage,
1193 NULL),
1194 GNUNET_MQ_hd_fixed_size (p2p_migration_stop,
1196 struct MigrationStopMessage,
1197 NULL),
1199 };
1200 int anon_p2p_off;
1201 struct GNUNET_CORE_ServiceInfo service_info = {
1203 .version = { 1, 0 },
1204 .version_max = { 1, 0 },
1205 .version_min = { 1, 0 },
1206 };
1207
1208 /* this option is really only for testcases that need to disable
1209 _anonymous_ file-sharing for some reason */
1210 anon_p2p_off = (GNUNET_YES ==
1212 "fs",
1213 "DISABLE_ANON_TRANSFER")
1214 );
1215 GSF_pils = GNUNET_PILS_connect (GSF_cfg, NULL, NULL);
1216 if (NULL == GSF_pils)
1217 {
1219 _ ("Failed to connect to `%s' service.\n"),
1220 "pils");
1221 return GNUNET_SYSERR;
1222 }
1223 GSF_core
1225 NULL,
1226 NULL,
1229 (GNUNET_YES == anon_p2p_off)
1230 ? no_p2p_handlers
1231 : p2p_handlers,
1232 &service_info);
1233 if (NULL == GSF_core)
1234 {
1236 _ ("Failed to connect to `%s' service.\n"),
1237 "core");
1238 return GNUNET_SYSERR;
1239 }
1243 NULL);
1247 NULL);
1248 return GNUNET_OK;
1249}
1250
1251
1259static void
1260run (void *cls,
1261 const struct GNUNET_CONFIGURATION_Handle *cfg,
1263{
1264 unsigned long long dqs;
1265
1266 GSF_cfg = cfg;
1267 if (GNUNET_OK !=
1269 "fs",
1270 "DATASTORE_QUEUE_SIZE",
1271 &dqs))
1272 {
1274 "fs",
1275 "DATASTORE_QUEUE_SIZE");
1276 dqs = 32;
1277 }
1278 GSF_datastore_queue_size = (unsigned int) dqs;
1282 if (NULL == GSF_dsh)
1283 {
1285 return;
1286 }
1291 GNUNET_assert (NULL != GSF_block_ctx);
1293 GSF_plan_init ();
1296
1297 GSF_push_init_ ();
1298 GSF_put_init_ ();
1300 GSF_dsh)) ||
1301 (GNUNET_OK != main_init (cfg)))
1302 {
1304 shutdown_task (NULL);
1305 return;
1306 }
1307}
1308
1309
1315 "fs",
1317 &run,
1320 NULL,
1321 GNUNET_MQ_hd_var_size (client_index_start,
1323 struct IndexStartMessage,
1324 NULL),
1325 GNUNET_MQ_hd_fixed_size (client_index_list_get,
1327 struct GNUNET_MessageHeader,
1328 NULL),
1329 GNUNET_MQ_hd_fixed_size (client_unindex,
1331 struct UnindexMessage,
1332 NULL),
1333 GNUNET_MQ_hd_var_size (client_start_search,
1335 struct SearchMessage,
1336 NULL),
1337 GNUNET_MQ_hd_fixed_size (client_loc_sign,
1340 NULL),
1342
1343
1344/* end of gnunet-service-fs.c */
struct GNUNET_GETOPT_CommandLineOption options[]
Definition 002.c:5
struct GNUNET_MessageHeader * msg
Definition 005.c:2
struct GNUNET_MQ_Envelope * env
Definition 005.c:1
#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
@ GNUNET_FS_URI_CHK
Content-hash-key (simple file).
Definition fs_api.h:144
#define gettext_noop(String)
Definition gettext.h:74
static int start
Set if we are to start default services (including ARM).
Definition gnunet-arm.c:38
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition gnunet-arm.c:108
static unsigned int anonymity_level
Anonymity level option to use for publishing.
static char * data
The data to insert into the dht.
static struct GNUNET_TIME_Relative expiration
User supplied expiration value.
struct GNUNET_SCHEDULER_Task * shutdown_task
static char * res
Currently read line or NULL on EOF.
static uint32_t type
Type string converted to DNS type value.
static int result
Global testing status.
static struct GNUNET_FS_SearchContext * sc
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
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.
struct GNUNET_PILS_Handle * GSF_pils
Pointer to handle of the pils service (points to NULL until we've connected to it).
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 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.
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...
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_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.
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.
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,...
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_iterate_connected_peers_(GSF_ConnectedPeerIterator it, void *it_cls)
Iterate over all connected peers.
void GSF_connected_peer_init_()
Initialize peer management subsystem.
void * GSF_peer_connect_handler(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq, enum GNUNET_CORE_PeerClass class)
A peer connected to us.
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.
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.
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?
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_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.
struct GSF_PendingRequestData * GSF_pending_request_get_data_(struct GSF_PendingRequest *pr)
Obtain the public data associated with a pending request.
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.
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.
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.
void GSF_put_init_()
Setup the module.
void GSF_put_done_()
Shutdown the module.
static struct GNUNET_TRANSPORT_PluginMonitor * pm
Handle if we are monitoring plugin session activity.
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_DBLOCK
Data block (leaf) in the CHK tree.
@ GNUNET_BLOCK_TYPE_FS_ONDEMAND
Type of a block representing a block to be encoded on demand from disk.
@ GNUNET_BLOCK_TYPE_FS_IBLOCK
Inner block in the CHK tree.
@ GNUNET_BLOCK_TYPE_ANY
Identifier for any block.
@ GNUNET_BLOCK_TYPE_FS_UBLOCK
Type of a block representing any type of search result (universal).
struct GNUNET_PILS_Handle * GNUNET_PILS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_PILS_PidChangeCallback pid_change_cb, void *cls)
Connect to the PILS service.
Definition pils_api.c:465
void GNUNET_PILS_disconnect(struct GNUNET_PILS_Handle *handle)
Disconnect from the PILS service.
Definition pils_api.c:488
#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...
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:158
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.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(const struct GNUNET_OS_ProjectData *pd)
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, const struct GNUNET_CORE_ServiceInfo *service_info)
Connect to the core service.
Definition core_api.c:698
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
Definition core_api.c:744
@ GNUNET_CORE_SERVICE_FS
Identifier for fs (file sharing) service.
void GNUNET_DATASTORE_disconnect(struct GNUNET_DATASTORE_Handle *h, int drop)
Disconnect from the datastore service (and free associated resources).
struct GNUNET_DATASTORE_Handle * GNUNET_DATASTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the datastore service.
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:1036
void GNUNET_DHT_disconnect(struct GNUNET_DHT_Handle *handle)
Shutdown connection with the DHT service.
Definition dht_api.c:1059
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:254
#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.
void GNUNET_CRYPTO_hash_file_cancel(struct GNUNET_CRYPTO_FileHashContext *fhc)
Cancel a file hashing operation.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
@ 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:124
void GNUNET_LOAD_update(struct GNUNET_LOAD_Value *load, uint64_t data)
Update the current load.
Definition load.c:236
double GNUNET_LOAD_get_load(struct GNUNET_LOAD_Value *load)
Get the current load.
Definition load.c:200
#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.
#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:305
#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.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
#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:572
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:1345
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition scheduler.c:986
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition scheduler.c:1310
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition scheduler.c:1283
#define GNUNET_SERVICE_MAIN(pd, service_name, service_options, init_cb, connect_cb, disconnect_cb, cls,...)
Creates the "main" function for a GNUnet service.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition service.c:2434
@ 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).
char * GNUNET_STRINGS_filename_expand(const char *fil)
Complete filename (a la shell) from abbrevition.
Definition strings.c:525
#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:438
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:636
#define _(String)
GNU gettext support macro.
Definition platform.h:179
static struct GNUNET_MQ_Handle * mq
Our connection to the resolver service, created on-demand, but then persists until error or shutdown.
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.
Handle to an initialized block library.
Definition block.c:55
Context for the core service connection.
Definition core_api.c:78
Gnunet service info - identifying compatibility with a range of version of a service communicating ov...
enum GNUNET_CORE_Service service
Identifier of the service on top of CORE.
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:235
A Universal Resource Identifier (URI), opaque.
Definition fs_api.h:167
struct Location loc
Information needed to retrieve a file including signed location (identity of a peer) of the content.
Definition fs_api.h:218
union GNUNET_FS_Uri::@57 data
A 512-bit hashcode.
Values we track for load calculations.
Definition load.c:36
Handle to a message queue.
Definition mq.c:87
Message handler for a specific message type.
Header for all communications.
A handle for the PILS service.
Definition pils_api.c:82
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Definition scheduler.c:141
Handle to a client that is connected to a service.
Definition service.c:249
Handle to a service.
Definition service.c:116
Handle for the service.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
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
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

◆ INSANE_STATISTICS

#define INSANE_STATISTICS   GNUNET_NO

Collect an instance number of statistics? May cause excessive IPC.

Definition at line 66 of file gnunet-service-fs.c.

Function Documentation

◆ client_connect_cb()

static void * client_connect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
struct GNUNET_MQ_Handle mq 
)
static

Creates a fresh local client handle.

Parameters
clsNULL
clienthandle of the client
mqmessage queue for client
Returns
handle to local client entry

Definition at line 334 of file gnunet-service-fs.c.

337{
338 struct GSF_LocalClient *pos;
339
340 pos = GNUNET_new (struct GSF_LocalClient);
341 pos->client = client;
342 pos->mq = mq;
343 return pos;
344}

References GSF_LocalClient::client, GNUNET_new, mq, and GSF_LocalClient::mq.

◆ client_request_destroy()

static void client_request_destroy ( void *  cls)
static

Free the given client request.

Parameters
clsthe client request to free

Definition at line 353 of file gnunet-service-fs.c.

354{
355 struct ClientRequest *cr = cls;
356 struct GSF_LocalClient *lc = cr->lc;
357
358 cr->kill_task = NULL;
360 lc->cr_tail,
361 cr);
363 GNUNET_YES);
365 gettext_noop ("# client searches active"),
366 -1,
367 GNUNET_NO);
368 GNUNET_free (cr);
369}

References GSF_LocalClient::cr_head, GSF_LocalClient::cr_tail, gettext_noop, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, GSF_pending_request_cancel_(), GSF_stats, ClientRequest::kill_task, ClientRequest::lc, and ClientRequest::pr.

Referenced by client_disconnect_cb(), and client_response_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ client_response_handler()

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 
)
static

Handle a reply to a pending request.

Also called if a request expires (then with data == NULL). The handler may be called many times (depending on the request type), but will not be called during or after a call to #GSF_pending_request_cancel() and will also not be called anymore after a call signalling expiration.

Parameters
clsuser-specified closure
evalevaluation of the result
prhandle to the original pending request
reply_anonymity_levelanonymity level for the reply, UINT32_MAX for "unknown"
expirationwhen does data expire?
last_transmissionwhen was the last time we've tried to download this block? (FOREVER if unknown)
typetype of the block
dataresponse data, NULL on request expiration
data_lennumber of bytes in data

Definition at line 391 of file gnunet-service-fs.c.

400{
401 struct ClientRequest *cr = cls;
402 struct GSF_LocalClient *lc;
403 struct GNUNET_MQ_Envelope *env;
404 struct ClientPutMessage *pm;
405 const struct GSF_PendingRequestData *prd;
406
407 if (NULL == data)
408 {
409 /* local-only request, with no result, clean up. */
410 if (NULL == cr->kill_task)
412 cr);
413 return;
414 }
417 if ((prd->type != type) && (prd->type != GNUNET_BLOCK_TYPE_ANY))
418 {
419 GNUNET_break (0);
420 return;
421 }
424 ("# replies received for local clients"), 1,
425 GNUNET_NO);
426 GNUNET_assert (pr == cr->pr);
427 lc = cr->lc;
429 data_len,
431 pm->type = htonl (type);
433 pm->last_transmission = GNUNET_TIME_absolute_hton (last_transmission);
434 pm->num_transmissions = htonl (prd->num_transmissions);
435 pm->respect_offered = htonl (prd->respect_offered);
436 GNUNET_memcpy (&pm[1],
437 data,
438 data_len);
439 GNUNET_MQ_send (lc->mq,
440 env);
442 "Queued reply to query `%s' for local client\n",
443 GNUNET_h2s (&prd->query));
444 if (GNUNET_BLOCK_REPLY_OK_LAST != eval)
445 {
447 "Evaluation %d - keeping query alive\n",
448 (int) eval);
449 return;
450 }
451 if (NULL == cr->kill_task)
453 cr);
454}

References client_request_destroy(), data, env, expiration, gettext_noop, GNUNET_assert, GNUNET_BLOCK_REPLY_OK_LAST, GNUNET_BLOCK_TYPE_ANY, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_FS_PUT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_hton(), GSF_pending_request_get_data_(), GSF_stats, ClientRequest::kill_task, ClientRequest::lc, GSF_LocalClient::mq, GSF_PendingRequestData::num_transmissions, pm, ClientRequest::pr, GSF_PendingRequestData::query, GSF_PendingRequestData::respect_offered, type, and GSF_PendingRequestData::type.

Referenced by handle_client_start_search().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ client_disconnect_cb()

static void client_disconnect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
void *  app_ctx 
)
static

A client disconnected from us.

Tear down the local client record.

Parameters
clsunused
clienthandle of the client
app_ctxthe struct GSF_LocalClient

Definition at line 466 of file gnunet-service-fs.c.

469{
470 struct GSF_LocalClient *lc = app_ctx;
471 struct IndexStartContext *isc;
472 struct ClientRequest *cr;
473 struct ClientResponse *res;
474
475 while (NULL != (cr = lc->cr_head))
476 {
477 if (NULL != cr->kill_task)
480 }
481 while (NULL != (res = lc->res_head))
482 {
484 lc->res_tail,
485 res);
487 }
488 while (NULL != (isc = lc->isc_head))
489 {
491 lc->isc_tail,
492 isc);
494 GNUNET_free (isc);
495 }
496 GNUNET_free (lc);
497}

References client_request_destroy(), GSF_LocalClient::cr_head, IndexStartContext::fhc, GNUNET_CONTAINER_DLL_remove, GNUNET_CRYPTO_hash_file_cancel(), GNUNET_free, GNUNET_SCHEDULER_cancel(), GSF_LocalClient::isc_head, GSF_LocalClient::isc_tail, ClientRequest::kill_task, ClientResponse::lc, res, GSF_LocalClient::res_head, and GSF_LocalClient::res_tail.

Here is the call graph for this function:

◆ age_cover_counters()

static void age_cover_counters ( void *  cls)
static

Task that periodically ages our cover traffic statistics.

Parameters
clsunused closure

Definition at line 506 of file gnunet-service-fs.c.

References age_cover_counters(), COVER_AGE_FREQUENCY, cover_age_task, GNUNET_SCHEDULER_add_delayed(), GSF_cover_content_count, and GSF_cover_query_count.

Referenced by age_cover_counters(), and main_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_update_datastore_delay_()

void GSF_update_datastore_delay_ ( struct GNUNET_TIME_Absolute  start)

We've just now completed a datastore request.

Update our datastore load calculations.

Parameters
starttime when the datastore request was issued

Definition at line 524 of file gnunet-service-fs.c.

525{
526 struct GNUNET_TIME_Relative delay;
527
529 GNUNET_LOAD_update (datastore_get_load, delay.rel_value_us);
530}

References datastore_get_load, GNUNET_LOAD_update(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_Relative::rel_value_us, and start.

Referenced by process_local_reply().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_test_get_load_too_high_()

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.

Parameters
prioritypriority of the request (used as a reference point to compare with the load)
Returns
GNUNET_YES if the load is too high to do anything (load high) GNUNET_NO to process normally (load normal) GNUNET_SYSERR to process for free (load low)

Definition at line 544 of file gnunet-service-fs.c.

545{
546 double ld;
547
549 if (ld < 1)
550 return GNUNET_SYSERR;
551 if (ld <= priority)
552 return GNUNET_NO;
553 return GNUNET_YES;
554}

References datastore_get_load, GNUNET_LOAD_get_load(), GNUNET_NO, GNUNET_SYSERR, and GNUNET_YES.

Referenced by bound_priority(), and process_local_reply().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_p2p_put()

static int check_p2p_put ( void *  cls,
const struct PutMessage put 
)
static

Check P2P "PUT" message.

Parameters
clsclosure with the struct GSF_ConnectedPeer
putthe actual message
Returns
GNUNET_OK to keep the connection open, GNUNET_SYSERR to close it (signal serious error)

Definition at line 566 of file gnunet-service-fs.c.

568{
570
571 type = ntohl (put->type);
573 {
574 GNUNET_break_op (0);
575 return GNUNET_SYSERR;
576 }
577 return GNUNET_OK;
578}

References GNUNET_BLOCK_TYPE_FS_ONDEMAND, GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, type, and PutMessage::type.

◆ consider_request_for_forwarding()

static void consider_request_for_forwarding ( void *  cls,
const struct GNUNET_PeerIdentity peer,
struct GSF_ConnectedPeer cp,
const struct GSF_PeerPerformanceData ppd 
)
static

We have a new request, consider forwarding it to the given peer.

Parameters
clsthe struct GSF_PendingRequest
peeridentity of the peer
cphandle to the connected peer record
ppdpeer performance data

Definition at line 591 of file gnunet-service-fs.c.

595{
596 struct GSF_PendingRequest *pr = cls;
597
598 if (GNUNET_YES !=
600 {
601#if INSANE_STATISTICS
603 gettext_noop ("# Loopback routes suppressed"), 1,
604 GNUNET_NO);
605#endif
606 return;
607 }
608 GSF_plan_add_ (cp,
609 pr);
610}

References gettext_noop, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, GSF_pending_request_test_target_(), GSF_plan_add_(), and GSF_stats.

Referenced by GSF_consider_forwarding().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GSF_consider_forwarding()

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.

If the result status code indicates that there may be more replies, plan forwarding the request.

Parameters
clsclosure (NULL)
prthe pending request we were processing
resultfinal datastore lookup result

Definition at line 624 of file gnunet-service-fs.c.

627{
629 return; /* we're done... */
630 if (GNUNET_YES !=
632 return; /* request is not actually active, skip! */
634 pr);
635}

References consider_request_for_forwarding(), GNUNET_BLOCK_REPLY_OK_LAST, GNUNET_YES, GSF_iterate_connected_peers_(), GSF_pending_request_test_active_(), and result.

Referenced by handle_p2p_get(), and start_p2p_processing().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_p2p_get()

static int check_p2p_get ( void *  cls,
const struct GetMessage gm 
)
static

Check P2P "GET" request.

Parameters
clsclosure
gmthe actual message
Returns
GNUNET_OK to keep the connection open, GNUNET_SYSERR to close it (signal serious error)

Definition at line 647 of file gnunet-service-fs.c.

649{
650 size_t msize;
651 unsigned int bm;
652 unsigned int bits;
653 size_t bfsize;
654
655 msize = ntohs (gm->header.size);
656 bm = ntohl (gm->hash_bitmap);
657 bits = 0;
658 while (bm > 0)
659 {
660 if (1 == (bm & 1))
661 bits++;
662 bm >>= 1;
663 }
664 if (msize < sizeof(struct GetMessage) + bits * sizeof(struct
666 {
667 GNUNET_break_op (0);
668 return GNUNET_SYSERR;
669 }
670 bfsize = msize - sizeof(struct GetMessage) - bits * sizeof(struct
672 /* bfsize must be power of 2, check! */
673 if (0 != ((bfsize - 1) & bfsize))
674 {
675 GNUNET_break_op (0);
676 return GNUNET_SYSERR;
677 }
678 return GNUNET_OK;
679}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GetMessage::hash_bitmap, GetMessage::header, and GNUNET_MessageHeader::size.

◆ start_p2p_processing()

static void start_p2p_processing ( void *  cls,
struct GSF_PendingRequest pr,
enum GNUNET_BLOCK_ReplyEvaluationResult  result 
)
static

We're done with the local lookup, now consider P2P processing (depending on request options and result status).

Also signal that we can now receive more request information from the client.

Parameters
clsthe client doing the request (struct GSF_LocalClient)
prthe pending request we were processing
resultfinal datastore lookup result

Definition at line 693 of file gnunet-service-fs.c.

696{
697 struct GSF_LocalClient *lc = cls;
698 struct GSF_PendingRequestData *prd;
699
702 return; /* we're done, 'pr' was already destroyed... */
705 "Finished database lookup for local request `%s' with result %d\n",
706 GNUNET_h2s (&prd->query),
707 result);
708 if (0 == prd->anonymity_level)
709 {
710 switch (prd->type)
711 {
714 /* the above block types MAY be available via 'cadet' */
716 "Considering cadet-based download for block\n");
718 break;
719
721 /* the above block types are in the DHT */
723 "Considering DHT-based search for block\n");
724 GSF_dht_lookup_ (pr);
725 break;
726
727 default:
728 GNUNET_break (0);
729 break;
730 }
731 }
733 pr,
734 result);
735}

References GSF_PendingRequestData::anonymity_level, GSF_LocalClient::client, GNUNET_BLOCK_REPLY_OK_LAST, GNUNET_BLOCK_TYPE_FS_DBLOCK, GNUNET_BLOCK_TYPE_FS_IBLOCK, GNUNET_BLOCK_TYPE_FS_UBLOCK, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_SERVICE_client_continue(), GSF_cadet_lookup_(), GSF_consider_forwarding(), GSF_dht_lookup_(), GSF_pending_request_get_data_(), GSF_PendingRequestData::query, result, and GSF_PendingRequestData::type.

Referenced by handle_client_start_search().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_client_start_search()

static int check_client_start_search ( void *  cls,
const struct SearchMessage sm 
)
static

Check GNUNET_MESSAGE_TYPE_FS_START_SEARCH-message (search request from client).

Parameters
clsidentification of the client
smthe actual message
Returns
GNUNET_OK if sm is well-formed

Definition at line 747 of file gnunet-service-fs.c.

749{
750 uint16_t msize;
751
752 msize = ntohs (sm->header.size) - sizeof(struct SearchMessage);
753 if (0 != msize % sizeof(struct GNUNET_HashCode))
754 {
755 GNUNET_break (0);
756 return GNUNET_SYSERR;
757 }
758 return GNUNET_OK;
759}

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, SearchMessage::header, and GNUNET_MessageHeader::size.

◆ handle_client_start_search()

static void handle_client_start_search ( void *  cls,
const struct SearchMessage sm 
)
static

Handle GNUNET_MESSAGE_TYPE_FS_START_SEARCH-message (search request from client).

Responsible for creating the request entry itself and setting up reply callback and cancellation on client disconnect.

Parameters
clsidentification of the client
smthe actual message

Definition at line 773 of file gnunet-service-fs.c.

775{
776 static struct GNUNET_PeerIdentity all_zeros;
777 struct GSF_LocalClient *lc = cls;
778 struct ClientRequest *cr;
779 struct GSF_PendingRequestData *prd;
780 uint16_t msize;
781 unsigned int sc;
784
786 gettext_noop ("# client searches received"),
787 1,
788 GNUNET_NO);
789 msize = ntohs (sm->header.size) - sizeof(struct SearchMessage);
790 sc = msize / sizeof(struct GNUNET_HashCode);
791 type = ntohl (sm->type);
793 "Received request for `%s' of type %u from local client\n",
794 GNUNET_h2s (&sm->query),
795 (unsigned int) type);
796 cr = NULL;
797 /* detect duplicate UBLOCK requests */
800 {
801 cr = lc->cr_head;
802 while (NULL != cr)
803 {
805 /* only unify with queries that hae not yet started local processing
806 (SEARCH_MESSAGE_OPTION_CONTINUED was always set) and that have a
807 matching query and type */
808 if ((GNUNET_YES != prd->has_started) &&
809 (0 != memcmp (&prd->query,
810 &sm->query,
811 sizeof(struct GNUNET_HashCode))) &&
812 (prd->type == type))
813 break;
814 cr = cr->next;
815 }
816 }
817 if (NULL != cr)
818 {
820 "Have existing request, merging content-seen lists.\n");
822 (const struct GNUNET_HashCode *) &sm[1],
823 sc);
826 "# client searches updated (merged content seen list)"),
827 1,
828 GNUNET_NO);
829 }
830 else
831 {
833 gettext_noop ("# client searches active"),
834 1,
835 GNUNET_NO);
836 cr = GNUNET_new (struct ClientRequest);
837 cr->lc = lc;
839 lc->cr_tail,
840 cr);
842 if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options)))
845 &sm->query,
846 (0 !=
847 memcmp (&sm->target,
848 &all_zeros,
849 sizeof(struct
851 ? &sm->target : NULL, NULL,
852 0 /* bf */,
853 ntohl (sm->anonymity_level),
854 0 /* priority */,
855 0 /* ttl */,
856 0 /* sender PID */,
857 0 /* origin PID */,
858 (const struct
859 GNUNET_HashCode *) &sm[1], sc,
861 cr);
862 }
863 if (0 != (SEARCH_MESSAGE_OPTION_CONTINUED & ntohl (sm->options)))
864 {
866 return;
867 }
871 lc);
872}

References SearchMessage::anonymity_level, GSF_LocalClient::client, client_response_handler(), GSF_LocalClient::cr_head, GSF_LocalClient::cr_tail, gettext_noop, GNUNET_BLOCK_TYPE_ANY, GNUNET_BLOCK_TYPE_FS_UBLOCK, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_STATISTICS_update(), GNUNET_YES, GSF_local_lookup_(), GSF_pending_request_create_(), GSF_pending_request_get_data_(), GSF_pending_request_update_(), GSF_PRO_LOCAL_ONLY, GSF_PRO_LOCAL_REQUEST, GSF_stats, GSF_PendingRequestData::has_started, SearchMessage::header, ClientRequest::lc, ClientRequest::next, options, SearchMessage::options, ClientRequest::pr, SearchMessage::query, GSF_PendingRequestData::query, sc, SEARCH_MESSAGE_OPTION_CONTINUED, SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY, GNUNET_MessageHeader::size, start_p2p_processing(), SearchMessage::target, type, SearchMessage::type, and GSF_PendingRequestData::type.

Here is the call graph for this function:

◆ handle_client_loc_sign()

static void handle_client_loc_sign ( void *  cls,
const struct RequestLocSignatureMessage msg 
)
static

Handle request to sign a LOC URI (from client).

Parameters
clsidentification of the client
msgthe actual message

Definition at line 882 of file gnunet-service-fs.c.

884{
885 struct GSF_LocalClient *lc = cls;
886 struct GNUNET_FS_Uri base;
887 struct GNUNET_FS_Uri *loc;
888 struct GNUNET_MQ_Envelope *env;
889 struct ResponseLocSignatureMessage *resp;
890
892 ntohl (msg->purpose));
893 base.type = GNUNET_FS_URI_CHK;
894 base.data.chk.chk = msg->chk;
895 base.data.chk.file_length = GNUNET_ntohll (msg->file_length);
896 loc = GNUNET_FS_uri_loc_create (&base,
897 &pk,
899 msg->expiration_time));
900 env = GNUNET_MQ_msg (resp,
904 loc->data.loc.expirationTime);
905 resp->signature = loc->data.loc.contentSignature;
906 resp->peer = loc->data.loc.peer;
908 GNUNET_MQ_send (lc->mq,
909 env);
911}

References FileIdentifier::chk, GNUNET_FS_Uri::chk, GSF_LocalClient::client, Location::contentSignature, GNUNET_FS_Uri::data, env, ResponseLocSignatureMessage::expiration_time, Location::expirationTime, FileIdentifier::file_length, GNUNET_break, GNUNET_FS_URI_CHK, GNUNET_FS_uri_destroy(), GNUNET_FS_uri_loc_create(), GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGNATURE, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_ntohll(), GNUNET_SERVICE_client_continue(), GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT, GNUNET_TIME_absolute_hton(), GNUNET_TIME_absolute_ntoh(), GNUNET_FS_Uri::loc, GSF_LocalClient::mq, msg, ResponseLocSignatureMessage::peer, Location::peer, pk, ResponseLocSignatureMessage::purpose, ResponseLocSignatureMessage::signature, and GNUNET_FS_Uri::type.

Here is the call graph for this function:

◆ check_client_index_start()

static int check_client_index_start ( void *  cls,
const struct IndexStartMessage ism 
)
static

Check INDEX_START-message.

Parameters
clsidentification of the client
ismthe actual message
Returns
GNUNET_OK if ism is well-formed

Definition at line 922 of file gnunet-service-fs.c.

924{
925 char *fn;
926
928 if (0 != ism->reserved)
929 {
930 GNUNET_break (0);
931 return GNUNET_SYSERR;
932 }
933 fn = GNUNET_STRINGS_filename_expand ((const char *) &ism[1]);
934 if (NULL == fn)
935 {
936 GNUNET_break (0);
937 return GNUNET_SYSERR;
938 }
939 GNUNET_free (fn);
940 return GNUNET_OK;
941}

References GNUNET_break, GNUNET_free, GNUNET_MQ_check_zero_termination, GNUNET_OK, GNUNET_STRINGS_filename_expand(), GNUNET_SYSERR, and IndexStartMessage::reserved.

Here is the call graph for this function:

◆ signal_index_ok()

static void signal_index_ok ( struct IndexStartContext isc)
static

We've validated the hash of the file we're about to index.

Signal success to the client and update our internal data structures.

Parameters
iscthe data about the index info entry for the request

Definition at line 951 of file gnunet-service-fs.c.

952{
953 struct GSF_LocalClient *lc = isc->lc;
954 struct GNUNET_MQ_Envelope *env;
956
958 &isc->file_id);
961 GNUNET_MQ_send (lc->mq,
962 env);
963 GNUNET_free (isc->filename);
964 GNUNET_free (isc);
966}

References GSF_LocalClient::client, env, IndexStartContext::file_id, IndexStartContext::filename, GNUNET_free, GNUNET_FS_add_to_index(), GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), IndexStartContext::lc, GSF_LocalClient::mq, and msg.

Referenced by handle_client_index_start(), and hash_for_index_val().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash_for_index_val()

static void hash_for_index_val ( void *  cls,
const struct GNUNET_HashCode res 
)
static

Function called once the hash computation over an indexed file has completed.

Parameters
clsclosure, our publishing context
resresulting hash, NULL on error

Definition at line 977 of file gnunet-service-fs.c.

979{
980 struct IndexStartContext *isc = cls;
981 struct GSF_LocalClient *lc = isc->lc;
982 struct GNUNET_MQ_Envelope *env;
984
986 lc->isc_tail,
987 isc);
988 isc->fhc = NULL;
989 if ((NULL == res) ||
990 (0 != memcmp (res,
991 &isc->file_id,
992 sizeof(struct GNUNET_HashCode))))
993 {
995 _ (
996 "Hash mismatch trying to index file `%s' which does not have hash `%s'\n"),
997 isc->filename,
998 GNUNET_h2s (&isc->file_id));
999
1000 const char *emsg = "hash mismatch";
1001 const size_t msize = strlen (emsg) + 1;
1002
1004 msize,
1006 memcpy ((char*) &msg[1], emsg, msize);
1007 GNUNET_MQ_send (lc->mq,
1008 env);
1010 GNUNET_free (isc);
1011 return;
1012 }
1013 signal_index_ok (isc);
1014}

References _, GSF_LocalClient::client, env, IndexStartContext::fhc, IndexStartContext::file_id, IndexStartContext::filename, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), GSF_LocalClient::isc_head, GSF_LocalClient::isc_tail, IndexStartContext::lc, GSF_LocalClient::mq, msg, res, and signal_index_ok().

Referenced by handle_client_index_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_client_index_start()

static void handle_client_index_start ( void *  cls,
const struct IndexStartMessage ism 
)
static

Handle INDEX_START-message.

Parameters
clsidentification of the client
ismthe actual message

Definition at line 1024 of file gnunet-service-fs.c.

1026{
1027 struct GSF_LocalClient *lc = cls;
1028 struct IndexStartContext *isc;
1029 char *fn;
1030 uint64_t dev;
1031 uint64_t ino;
1032 uint64_t mydev;
1033 uint64_t myino;
1034
1035 fn = GNUNET_STRINGS_filename_expand ((const char *) &ism[1]);
1036 GNUNET_assert (NULL != fn);
1037 dev = GNUNET_ntohll (ism->device);
1038 ino = GNUNET_ntohll (ism->inode);
1039 isc = GNUNET_new (struct IndexStartContext);
1040 isc->filename = fn;
1041 isc->file_id = ism->file_id;
1043 "Received START_INDEX message for file `%s'\n",
1044 isc->filename);
1045 isc->lc = lc;
1046 mydev = 0;
1047 myino = 0;
1048 if (((dev != 0) ||
1049 (ino != 0)) &&
1051 &mydev,
1052 &myino)) &&
1053 (dev == mydev) &&
1054 (ino == myino))
1055 {
1056 /* fast validation OK! */
1057 signal_index_ok (isc);
1058 return;
1059 }
1061 "Mismatch in file identifiers (%llu != %llu or %u != %u), need to hash.\n",
1062 (unsigned long long) ino,
1063 (unsigned long long) myino,
1064 (unsigned int) dev,
1065 (unsigned int) mydev);
1066 /* slow validation, need to hash full file (again) */
1068 lc->isc_tail,
1069 isc);
1071 isc->filename,
1074 isc);
1075 if (NULL == isc->fhc)
1076 hash_for_index_val (isc,
1077 NULL);
1078}

References IndexStartMessage::device, IndexStartContext::fhc, IndexStartMessage::file_id, IndexStartContext::file_id, IndexStartContext::filename, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_CRYPTO_hash_file(), GNUNET_DISK_file_get_identifiers(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_ntohll(), GNUNET_OK, GNUNET_SCHEDULER_PRIORITY_IDLE, GNUNET_STRINGS_filename_expand(), hash_for_index_val(), HASHING_BLOCKSIZE, IndexStartMessage::inode, GSF_LocalClient::isc_head, GSF_LocalClient::isc_tail, IndexStartContext::lc, and signal_index_ok().

Here is the call graph for this function:

◆ handle_client_index_list_get()

static void handle_client_index_list_get ( void *  cls,
const struct GNUNET_MessageHeader message 
)
static

Handle INDEX_LIST_GET-message.

Parameters
clsclosure
messagethe actual message

Definition at line 1088 of file gnunet-service-fs.c.

1090{
1091 struct GSF_LocalClient *lc = cls;
1092
1095}

References GSF_LocalClient::client, GNUNET_FS_indexing_send_list(), GNUNET_SERVICE_client_continue(), and GSF_LocalClient::mq.

Here is the call graph for this function:

◆ handle_client_unindex()

static void handle_client_unindex ( void *  cls,
const struct UnindexMessage um 
)
static

Handle UNINDEX-message.

Parameters
clsidentification of the client
umthe actual message

Definition at line 1105 of file gnunet-service-fs.c.

1107{
1108 struct GSF_LocalClient *lc = cls;
1109 struct GNUNET_MQ_Envelope *env;
1110 struct GNUNET_MessageHeader *msg;
1111 int found;
1112
1113 GNUNET_break (0 == um->reserved);
1116 "Client requested unindexing of file `%s': %s\n",
1117 GNUNET_h2s (&um->file_id),
1118 found ? "found" : "not found");
1121 GNUNET_MQ_send (lc->mq,
1122 env);
1124}

References GSF_LocalClient::client, env, UnindexMessage::file_id, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_FS_indexing_do_unindex(), GNUNET_h2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_FS_UNINDEX_OK, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), GSF_LocalClient::mq, msg, and UnindexMessage::reserved.

Here is the call graph for this function:

◆ shutdown_task()

static void shutdown_task ( void *  cls)
static

Task run during shutdown.

Parameters
clsunused

Definition at line 1133 of file gnunet-service-fs.c.

References block_cfg, cover_age_task, datastore_get_load, GNUNET_BLOCK_context_destroy(), GNUNET_CONFIGURATION_destroy(), GNUNET_CORE_disconnect(), GNUNET_DATASTORE_disconnect(), GNUNET_DHT_disconnect(), GNUNET_FS_indexing_done(), GNUNET_LOAD_value_free, GNUNET_NO, GNUNET_PILS_disconnect(), GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_destroy(), GSF_block_ctx, GSF_cadet_stop_server(), GSF_connected_peer_done_(), GSF_core, GSF_dht, GSF_dsh, GSF_pending_request_done_(), GSF_pils, GSF_plan_done(), GSF_push_done_(), GSF_put_done_(), GSF_rt_entry_lifetime, and GSF_stats.

Here is the call graph for this function:

◆ main_init()

static int main_init ( const struct GNUNET_CONFIGURATION_Handle c)
static

Process fs requests.

Parameters
cconfiguration to use

Definition at line 1181 of file gnunet-service-fs.c.

1182{
1183 struct GNUNET_MQ_MessageHandler no_p2p_handlers[] = {
1185 };
1186 struct GNUNET_MQ_MessageHandler p2p_handlers[] = {
1187 GNUNET_MQ_hd_var_size (p2p_get,
1189 struct GetMessage,
1190 NULL),
1191 GNUNET_MQ_hd_var_size (p2p_put,
1193 struct PutMessage,
1194 NULL),
1195 GNUNET_MQ_hd_fixed_size (p2p_migration_stop,
1197 struct MigrationStopMessage,
1198 NULL),
1200 };
1201 int anon_p2p_off;
1202 struct GNUNET_CORE_ServiceInfo service_info = {
1204 .version = { 1, 0 },
1205 .version_max = { 1, 0 },
1206 .version_min = { 1, 0 },
1207 };
1208
1209 /* this option is really only for testcases that need to disable
1210 _anonymous_ file-sharing for some reason */
1211 anon_p2p_off = (GNUNET_YES ==
1213 "fs",
1214 "DISABLE_ANON_TRANSFER")
1215 );
1216 GSF_pils = GNUNET_PILS_connect (GSF_cfg, NULL, NULL);
1217 if (NULL == GSF_pils)
1218 {
1220 _ ("Failed to connect to `%s' service.\n"),
1221 "pils");
1222 return GNUNET_SYSERR;
1223 }
1224 GSF_core
1226 NULL,
1227 NULL,
1230 (GNUNET_YES == anon_p2p_off)
1231 ? no_p2p_handlers
1232 : p2p_handlers,
1233 &service_info);
1234 if (NULL == GSF_core)
1235 {
1237 _ ("Failed to connect to `%s' service.\n"),
1238 "core");
1239 return GNUNET_SYSERR;
1240 }
1244 NULL);
1248 NULL);
1249 return GNUNET_OK;
1250}

References _, age_cover_counters(), COVER_AGE_FREQUENCY, cover_age_task, datastore_get_load, DATASTORE_LOAD_AUTODECLINE, GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_CORE_connect(), GNUNET_CORE_SERVICE_FS, GNUNET_ERROR_TYPE_ERROR, GNUNET_LOAD_value_init(), GNUNET_log, GNUNET_MESSAGE_TYPE_FS_GET, GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP, GNUNET_MESSAGE_TYPE_FS_PUT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_OK, GNUNET_PILS_connect(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SYSERR, GNUNET_YES, GSF_cadet_start_server(), GSF_cfg, GSF_core, GSF_peer_connect_handler(), GSF_peer_disconnect_handler(), GSF_pils, GNUNET_CORE_ServiceInfo::service, and shutdown_task.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg,
struct GNUNET_SERVICE_Handle service 
)
static

Process fs requests.

Parameters
clsclosure
cfgconfiguration to use
servicethe initialized service

Definition at line 1261 of file gnunet-service-fs.c.

1264{
1265 unsigned long long dqs;
1266
1267 GSF_cfg = cfg;
1268 if (GNUNET_OK !=
1270 "fs",
1271 "DATASTORE_QUEUE_SIZE",
1272 &dqs))
1273 {
1275 "fs",
1276 "DATASTORE_QUEUE_SIZE");
1277 dqs = 32;
1278 }
1279 GSF_datastore_queue_size = (unsigned int) dqs;
1283 if (NULL == GSF_dsh)
1284 {
1286 return;
1287 }
1292 GNUNET_assert (NULL != GSF_block_ctx);
1294 GSF_plan_init ();
1297
1298 GSF_push_init_ ();
1299 GSF_put_init_ ();
1301 GSF_dsh)) ||
1302 (GNUNET_OK != main_init (cfg)))
1303 {
1305 shutdown_task (NULL);
1306 return;
1307 }
1308}

References block_cfg, cfg, FS_DHT_HT_SIZE, GNUNET_assert, GNUNET_BLOCK_context_create(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_get_value_size(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_DATASTORE_connect(), GNUNET_DHT_connect(), GNUNET_ERROR_TYPE_INFO, GNUNET_FS_indexing_init(), GNUNET_LOAD_value_init(), GNUNET_log_config_missing(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_create(), GNUNET_TIME_UNIT_FOREVER_REL, GSF_block_ctx, GSF_cfg, GSF_connected_peer_init_(), GSF_datastore_queue_size, GSF_dht, GSF_dsh, GSF_enable_randomized_delays, GSF_pending_request_init_(), GSF_plan_init(), GSF_push_init_(), GSF_put_init_(), GSF_rt_entry_lifetime, GSF_stats, main_init(), and shutdown_task.

Here is the call graph for this function:

◆ GNUNET_SERVICE_MAIN()

GNUNET_SERVICE_MAIN ( GNUNET_OS_project_data_gnunet()  ,
"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.

Variable Documentation

◆ GSF_dsh

◆ GSF_cfg

◆ GSF_stats

◆ GSF_dht

struct GNUNET_DHT_Handle* GSF_dht

Handle for DHT operations.

Definition at line 237 of file gnunet-service-fs.c.

Referenced by GSF_dht_lookup_(), process_dht_put_content(), run(), and shutdown_task().

◆ GSF_rt_entry_lifetime

struct GNUNET_LOAD_Value* GSF_rt_entry_lifetime

How long do requests typically stay in the routing table?

Definition at line 242 of file gnunet-service-fs.c.

Referenced by handle_p2p_get(), process_reply(), run(), and shutdown_task().

◆ GSF_avg_latency

struct GNUNET_TIME_Relative GSF_avg_latency = { 500 }

Running average of the observed latency to other peers (round trip).

Initialized to 5s as the initial default.

Definition at line 248 of file gnunet-service-fs.c.

248{ 500 };

Referenced by get_randomized_delay().

◆ GSF_current_priorities

double GSF_current_priorities

Typical priorities we're seeing from other peers right now.

Since most priorities will be zero, this value is the weighted average of non-zero priorities seen "recently". In order to ensure that new values do not dramatically change the ratio, values are first "capped" to a reasonable range (+N of the current value) and then averaged into the existing value by a ratio of 1:N. Hence receiving the largest possible priority can still only raise our "current_priorities" by at most 1.

Definition at line 261 of file gnunet-service-fs.c.

Referenced by bound_priority(), and plan().

◆ GSF_datastore_queue_size

unsigned int GSF_datastore_queue_size

Size of the datastore queue we assume for common requests.

Definition at line 266 of file gnunet-service-fs.c.

Referenced by handle_request(), run(), and start_local_query().

◆ GSF_cover_query_count

unsigned int GSF_cover_query_count

How many query messages have we received 'recently' that have not yet been claimed as cover traffic?

Definition at line 272 of file gnunet-service-fs.c.

Referenced by age_cover_counters(), and handle_p2p_get().

◆ GSF_cover_content_count

unsigned int GSF_cover_content_count

How many content messages have we received 'recently' that have not yet been claimed as cover traffic?

Definition at line 278 of file gnunet-service-fs.c.

Referenced by age_cover_counters(), handle_p2p_put(), and handle_p2p_reply().

◆ GSF_block_ctx

◆ GSF_core

struct GNUNET_CORE_Handle* GSF_core

Pointer to handle to the core service (points to NULL until we've connected to it).

Definition at line 289 of file gnunet-service-fs.c.

Referenced by main_init(), and shutdown_task().

◆ GSF_pils

struct GNUNET_PILS_Handle* GSF_pils

Pointer to handle of the pils service (points to NULL until we've connected to it).

Handle to PILS service.

Definition at line 295 of file gnunet-service-fs.c.

Referenced by GSF_peer_connect_handler(), main_init(), and shutdown_task().

◆ GSF_enable_randomized_delays

int GSF_enable_randomized_delays

Are we introducing randomized delays for better anonymity?

Definition at line 300 of file gnunet-service-fs.c.

Referenced by handle_p2p_reply(), and run().

◆ block_cfg

struct GNUNET_CONFIGURATION_Handle* block_cfg
static

Configuration for block library.

Definition at line 307 of file gnunet-service-fs.c.

Referenced by run(), and shutdown_task().

◆ pk

Private key of this peer.

Used to sign LOC URI requests.

Definition at line 312 of file gnunet-service-fs.c.

Referenced by handle_client_loc_sign().

◆ cover_age_task

struct GNUNET_SCHEDULER_Task* cover_age_task
static

ID of our task that we use to age the cover counters.

Definition at line 317 of file gnunet-service-fs.c.

Referenced by age_cover_counters(), main_init(), and shutdown_task().

◆ datastore_get_load

struct GNUNET_LOAD_Value* datastore_get_load
static

Datastore 'GET' load tracking.

Definition at line 322 of file gnunet-service-fs.c.

Referenced by GSF_test_get_load_too_high_(), GSF_update_datastore_delay_(), main_init(), and shutdown_task().