GNUnet  0.19.4
gnunet-daemon-fsprofiler.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2012 Christian Grothoff
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 
29 #include "platform.h"
30 
31 #include "gnunet_fs_service.h"
33 
38 struct Pattern
39 {
43  struct Pattern *next;
44 
48  struct Pattern *prev;
49 
53  void *ctx;
54 
58  void *sctx;
59 
64 
69 
74 
79 
83  unsigned long long x;
84 
88  unsigned long long y;
89 };
90 
91 
95 static int global_ret;
96 
100 static const struct GNUNET_CONFIGURATION_Handle *cfg;
101 
106 
111 
115 static unsigned long long my_peerid;
116 
120 static unsigned long long anonymity_level;
121 
125 static unsigned long long replication_level;
126 
134 static char *publish_pattern;
135 
139 static struct Pattern *publish_head;
140 
144 static struct Pattern *publish_tail;
145 
154 static char *download_pattern;
155 
159 static struct Pattern *download_head;
160 
164 static struct Pattern *download_tail;
165 
166 
176 static int
178  struct Pattern **tail,
179  const char *pattern)
180 {
181  struct Pattern *p;
182  unsigned long long x;
183  unsigned long long y;
184  unsigned long long t;
185 
186  while (3 == sscanf (pattern,
187  "(%llu,%llu,%llu)",
188  &x, &y, &t))
189  {
190  p = GNUNET_new (struct Pattern);
191  p->x = x;
192  p->y = y;
193  p->delay.rel_value_us = (uint64_t) t;
195  pattern = strstr (pattern, ")");
196  GNUNET_assert (NULL != pattern);
197  pattern++;
198  }
199  return (0 == strlen (pattern)) ? GNUNET_OK : GNUNET_SYSERR;
200 }
201 
202 
209 static struct GNUNET_FS_Uri *
210 make_keywords (uint64_t kval)
211 {
212  char kw[128];
213 
214  GNUNET_snprintf (kw, sizeof(kw),
215  "%llu", (unsigned long long) kval);
216  return GNUNET_FS_uri_ksk_create (kw, NULL);
217 }
218 
219 
229 static struct GNUNET_FS_FileInformation *
230 make_file (uint64_t length,
231  uint64_t kval,
232  void *ctx)
233 {
234  struct GNUNET_FS_FileInformation *fi;
235  struct GNUNET_FS_BlockOptions bo;
236  char *data;
237  struct GNUNET_FS_Uri *keywords;
238  unsigned long long i;
239  uint64_t xor;
240 
241  data = NULL; /* to make compilers happy */
242  if ((0 != length) &&
243  (NULL == (data = GNUNET_malloc_large ((size_t) length))))
244  return NULL;
245  /* initialize data with 'unique' data only depending on 'kval' and 'size',
246  making sure that blocks do not repeat */
247  for (i = 0; i < length; i += 8)
248  {
249  xor = length ^ kval ^ (uint64_t) (i / 32 / 1024);
250  GNUNET_memcpy (&data[i], &xor, GNUNET_MIN (length - i, sizeof(uint64_t)));
251  }
253  bo.anonymity_level = (uint32_t) anonymity_level;
254  bo.content_priority = 128;
256  keywords = make_keywords (kval);
258  ctx,
259  length,
260  data, keywords,
261  NULL, GNUNET_NO, &bo);
263  return fi;
264 }
265 
266 
272 static void
273 shutdown_task (void *cls)
274 {
275  struct Pattern *p;
276 
277  while (NULL != (p = publish_head))
278  {
279  if (NULL != p->task)
280  GNUNET_SCHEDULER_cancel (p->task);
281  if (NULL != p->ctx)
282  GNUNET_FS_publish_stop (p->ctx);
284  GNUNET_free (p);
285  }
286  while (NULL != (p = download_head))
287  {
288  if (NULL != p->task)
289  GNUNET_SCHEDULER_cancel (p->task);
290  if (NULL != p->stask)
291  GNUNET_SCHEDULER_cancel (p->stask);
292  if (NULL != p->ctx)
294  if (NULL != p->sctx)
295  GNUNET_FS_search_stop (p->sctx);
297  GNUNET_free (p);
298  }
299  if (NULL != fs_handle)
300  {
302  fs_handle = NULL;
303  }
304  if (NULL != stats_handle)
305  {
307  stats_handle = NULL;
308  }
309 }
310 
311 
317 static void
318 publish_stop_task (void *cls)
319 {
320  struct Pattern *p = cls;
321 
322  p->task = NULL;
323  GNUNET_FS_publish_stop (p->ctx);
324 }
325 
326 
332 static void
334 {
335  struct Pattern *p = cls;
336 
337  p->task = NULL;
339 }
340 
341 
347 static void
348 search_stop_task (void *cls)
349 {
350  struct Pattern *p = cls;
351 
352  p->stask = NULL;
353  GNUNET_FS_search_stop (p->sctx);
354 }
355 
356 
372 static void *
373 progress_cb (void *cls,
374  const struct GNUNET_FS_ProgressInfo *info)
375 {
376  struct Pattern *p;
377  const struct GNUNET_FS_Uri *uri;
378 
379  switch (info->status)
380  {
383  p = info->value.publish.cctx;
384  return p;
385 
387  p = info->value.publish.cctx;
388  return p;
389 
392  "Publishing failed\n");
394  "# failed publish operations", 1, GNUNET_NO);
395  p = info->value.publish.cctx;
397  return p;
398 
400  p = info->value.publish.cctx;
402  "# publishing time (ms)",
404  p->start_time).rel_value_us / 1000LL,
405  GNUNET_NO);
407  return p;
408 
410  p = info->value.publish.cctx;
411  p->ctx = NULL;
413  GNUNET_free (p);
414  return NULL;
415 
420  p = info->value.download.cctx;
421  return p;
422 
425  "Download failed\n");
427  "# failed downloads", 1, GNUNET_NO);
428  p = info->value.download.cctx;
430  return p;
431 
433  p = info->value.download.cctx;
435  "# download time (ms)",
437  p->start_time).rel_value_us / 1000LL,
438  GNUNET_NO);
440  return p;
441 
443  p = info->value.download.cctx;
444  p->ctx = NULL;
445  if (NULL == p->sctx)
446  {
448  GNUNET_free (p);
449  }
450  return NULL;
451 
454  p = info->value.search.cctx;
455  return p;
456 
458  p = info->value.search.cctx;
459  uri = info->value.search.specifics.result.uri;
461  return NULL; /* not what we want */
463  return NULL; /* not what we want */
465  "# search time (ms)",
467  p->start_time).rel_value_us / 1000LL,
468  GNUNET_NO);
469  p->start_time = GNUNET_TIME_absolute_get ();
471  NULL, NULL, NULL,
475  p,
476  NULL);
478  return NULL;
479 
482  return NULL; /* don't care */
483 
486  "Search failed\n");
488  "# failed searches", 1, GNUNET_NO);
489  p = info->value.search.cctx;
491  return p;
492 
494  p = info->value.search.cctx;
495  p->sctx = NULL;
496  if (NULL == p->ctx)
497  {
499  GNUNET_free (p);
500  }
501  return NULL;
502 
503  default:
504  /* unexpected event during profiling */
505  GNUNET_break (0);
506  return NULL;
507  }
508 }
509 
510 
516 static void
517 start_publish (void *cls)
518 {
519  struct Pattern *p = cls;
520  struct GNUNET_FS_FileInformation *fi;
521 
522  p->task = NULL;
523  fi = make_file (p->x, p->y, p);
524  p->start_time = GNUNET_TIME_absolute_get ();
526  fi,
527  NULL, NULL, NULL,
529 }
530 
531 
537 static void
538 start_download (void *cls)
539 {
540  struct Pattern *p = cls;
541  struct GNUNET_FS_Uri *keywords;
542 
543  p->task = NULL;
544  keywords = make_keywords (p->x);
545  p->start_time = GNUNET_TIME_absolute_get ();
549  p);
550 }
551 
552 
561 static void
562 run (void *cls, char *const *args GNUNET_UNUSED,
563  const char *cfgfile GNUNET_UNUSED,
564  const struct GNUNET_CONFIGURATION_Handle *cfg_)
565 {
566  char myoptname[128];
567  struct Pattern *p;
568 
569  cfg = cfg_;
570  /* Scheduled the task to clean up when shutdown is called */
572  NULL);
573 
574  if (GNUNET_OK !=
576  "TESTBED", "PEERID",
577  &my_peerid))
578  {
580  "TESTBED", "PEERID");
583  return;
584  }
585  if (GNUNET_OK !=
587  "FSPROFILER", "ANONYMITY_LEVEL",
588  &anonymity_level))
589  anonymity_level = 1;
590  if (GNUNET_OK !=
592  "FSPROFILER", "REPLICATION_LEVEL",
594  replication_level = 1;
595  GNUNET_snprintf (myoptname, sizeof(myoptname),
596  "DOWNLOAD-PATTERN-%llu", my_peerid);
597  if (GNUNET_OK !=
599  "FSPROFILER", myoptname,
602  GNUNET_snprintf (myoptname, sizeof(myoptname),
603  "PUBLISH-PATTERN-%llu", my_peerid);
604  if (GNUNET_OK !=
606  "FSPROFILER", myoptname,
607  &publish_pattern))
609  if ((GNUNET_OK !=
611  &download_tail,
612  download_pattern)) ||
613  (GNUNET_OK !=
615  &publish_tail,
616  publish_pattern)))
617  {
619  return;
620  }
621 
622  stats_handle = GNUNET_STATISTICS_create ("fsprofiler", cfg);
623  fs_handle =
625  "fsprofiler",
626  &progress_cb, NULL,
631  if (NULL == fs_handle)
632  {
634  "Could not acquire FS handle. Exiting.\n");
637  return;
638  }
639  for (p = publish_head; NULL != p; p = p->next)
640  p->task = GNUNET_SCHEDULER_add_delayed (p->delay,
641  &start_publish, p);
642  for (p = download_head; NULL != p; p = p->next)
643  p->task = GNUNET_SCHEDULER_add_delayed (p->delay,
644  &start_download, p);
645 }
646 
647 
655 int
656 main (int argc, char *const *argv)
657 {
658  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
660  };
661 
662  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
663  return 2;
664  return (GNUNET_OK ==
665  GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-fsprofiler",
667  (
668  "Daemon to use file-sharing to measure its performance."),
669  options, &run, NULL)) ? global_ret : 1;
670 }
671 
672 
673 /* end of gnunet-daemon-fsprofiler.c */
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define gettext_noop(String)
Definition: gettext.h:70
static struct PendingResolutions * tail
Tail of list of pending resolution requests.
Definition: gnunet-ats.c:235
static struct PendingResolutions * head
Head of list of pending resolution requests.
Definition: gnunet-ats.c:230
static void publish_stop_task(void *cls)
Task run when a publish operation should be stopped.
static struct Pattern * download_tail
Tail of the DLL of publish patterns.
static struct GNUNET_FS_FileInformation * make_file(uint64_t length, uint64_t kval, void *ctx)
Create a file of the given length with a deterministic amount of data to be published under keyword '...
static char * publish_pattern
String describing which publishing operations this peer should perform.
static struct GNUNET_FS_Uri * make_keywords(uint64_t kval)
Create a KSK URI from a number.
static int global_ret
Return value from 'main'.
static char * download_pattern
String describing which download operations this peer should perform.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg_)
Main function that will be run by the scheduler.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.
static void shutdown_task(void *cls)
Task run during shutdown.
static struct Pattern * publish_head
Head of the DLL of publish patterns.
static struct GNUNET_STATISTICS_Handle * stats_handle
Handle to the statistics service.
static void start_download(void *cls)
Start download operation.
static unsigned long long my_peerid
Unique number for this peer in the testbed.
static unsigned long long replication_level
Desired replication level.
static void * progress_cb(void *cls, const struct GNUNET_FS_ProgressInfo *info)
Notification of FS to a client about the progress of an operation.
static unsigned long long anonymity_level
Desired anonymity level.
static int parse_pattern(struct Pattern **head, struct Pattern **tail, const char *pattern)
Parse a pattern string and store the corresponding 'struct Pattern' in the given head/tail.
static struct Pattern * publish_tail
Tail of the DLL of publish patterns.
static void search_stop_task(void *cls)
Task run when a download operation should be stopped.
static struct Pattern * download_head
Head of the DLL of publish patterns.
static struct GNUNET_FS_Handle * fs_handle
Peer's FS handle.
int main(int argc, char *const *argv)
Program that performs various "random" FS activities.
static void start_publish(void *cls)
Start publish operation.
static void download_stop_task(void *cls)
Task run when a download operation should be stopped.
uint32_t data
The data value.
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
static struct GNUNET_FS_BlockOptions bo
Options we set for published blocks.
#define info
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-uri.c:38
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
static struct GNUNET_SCHEDULER_Task * t
Main task.
API for file sharing via GNUnet.
API to create, modify and access statistics.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
#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.
uint64_t GNUNET_FS_uri_chk_get_file_size(const struct GNUNET_FS_Uri *uri)
What is the size of the file that this URI refers to?
Definition: fs_uri.c:1360
struct GNUNET_FS_Uri * GNUNET_FS_uri_ksk_create(const char *keywords, char **emsg)
Create an FS URI from a single user-supplied string of keywords.
Definition: fs_uri.c:1049
void GNUNET_FS_search_stop(struct GNUNET_FS_SearchContext *sc)
Stop search for content.
Definition: fs_search.c:1766
struct GNUNET_FS_PublishContext * GNUNET_FS_publish_start(struct GNUNET_FS_Handle *h, struct GNUNET_FS_FileInformation *fi, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *nid, const char *nuid, enum GNUNET_FS_PublishOptions options)
Publish a file or directory.
Definition: fs_publish.c:1443
void GNUNET_FS_uri_destroy(struct GNUNET_FS_Uri *uri)
Free URI.
Definition: fs_uri.c:677
struct GNUNET_FS_DownloadContext * GNUNET_FS_download_start(struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *meta, const char *filename, const char *tempname, uint64_t offset, uint64_t length, uint32_t anonymity, enum GNUNET_FS_DownloadOptions options, void *cctx, struct GNUNET_FS_DownloadContext *parent)
Download parts of a file.
Definition: fs_download.c:2100
void GNUNET_FS_download_stop(struct GNUNET_FS_DownloadContext *dc, int do_delete)
Stop a download (aborts if download is incomplete).
Definition: fs_download.c:2254
struct GNUNET_FS_Handle * GNUNET_FS_start(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *client_name, GNUNET_FS_ProgressCallback upcb, void *upcb_cls, enum GNUNET_FS_Flags flags,...)
Setup a connection to the file-sharing service.
Definition: fs_api.c:3244
int GNUNET_FS_uri_test_chk(const struct GNUNET_FS_Uri *uri)
Is this a file (or directory) URI?
Definition: fs_uri.c:1346
void GNUNET_FS_stop(struct GNUNET_FS_Handle *h)
Close our connection with the file-sharing service.
Definition: fs_api.c:3310
void GNUNET_FS_publish_stop(struct GNUNET_FS_PublishContext *pc)
Stop an upload.
Definition: fs_publish.c:1571
struct GNUNET_FS_SearchContext * GNUNET_FS_search_start(struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, uint32_t anonymity, enum GNUNET_FS_SearchOptions options, void *cctx)
Start search for content.
Definition: fs_search.c:1607
struct GNUNET_FS_FileInformation * GNUNET_FS_file_information_create_from_data(struct GNUNET_FS_Handle *h, void *client_info, uint64_t length, void *data, const struct GNUNET_FS_Uri *keywords, const struct GNUNET_FS_MetaData *meta, int do_index, const struct GNUNET_FS_BlockOptions *bo)
Create an entry for a file in a publish-structure.
@ GNUNET_FS_FLAGS_NONE
No special flags set.
@ GNUNET_FS_SEARCH_OPTION_NONE
No options (use defaults for everything).
@ GNUNET_FS_DOWNLOAD_NO_TEMPORARIES
Do not append temporary data to the target file (for the IBlocks).
@ GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM
Select the desired amount of parallelism (this option should be followed by an "unsigned int" giving ...
@ GNUNET_FS_OPTIONS_END
Last option in the VARARG list.
@ GNUNET_FS_OPTIONS_REQUEST_PARALLELISM
Maximum number of requests that should be pending at a given point in time (invidivual downloads may ...
@ GNUNET_FS_STATUS_SEARCH_UPDATE
We have additional data about the quality or availability of a search result.
@ GNUNET_FS_STATUS_DOWNLOAD_INACTIVE
Notification that this download is no longer actively being pursued (back in the queue).
@ GNUNET_FS_STATUS_SEARCH_RESULT_NAMESPACE
We have discovered a new namespace.
@ GNUNET_FS_STATUS_DOWNLOAD_ERROR
Notification that this download encountered an error.
@ GNUNET_FS_STATUS_SEARCH_ERROR
Signals a problem with this search.
@ GNUNET_FS_STATUS_DOWNLOAD_COMPLETED
Notification that this download completed.
@ GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED
Event generated for each search result when the respective search is stopped.
@ GNUNET_FS_STATUS_PUBLISH_STOPPED
Notification that we have stopped the process of uploading a file structure; no further events will b...
@ GNUNET_FS_STATUS_PUBLISH_ERROR
Notification that an error was encountered sharing a file structure.
@ GNUNET_FS_STATUS_SEARCH_RESULT
This search has yielded a result.
@ GNUNET_FS_STATUS_PUBLISH_PROGRESS
Notification that we are making progress sharing a file structure.
@ GNUNET_FS_STATUS_DOWNLOAD_START
Notification that we have started this download.
@ GNUNET_FS_STATUS_DOWNLOAD_PROGRESS
Notification about progress with this download.
@ GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY
Notification that we are making progress sharing a directory.
@ GNUNET_FS_STATUS_PUBLISH_START
Notification that we have started to publish a file structure.
@ GNUNET_FS_STATUS_PUBLISH_COMPLETED
Notification that we completed sharing a file structure.
@ GNUNET_FS_STATUS_SEARCH_START
First event generated when a client requests a search to begin or when a namespace result automatical...
@ GNUNET_FS_STATUS_DOWNLOAD_ACTIVE
Notification that this download is now actively being pursued (as opposed to waiting in the queue).
@ GNUNET_FS_STATUS_DOWNLOAD_STOPPED
Notification that this download was stopped (final event with respect to this action).
@ GNUNET_FS_STATUS_SEARCH_STOPPED
Last message from a search; this signals that there will be no further events associated with this se...
@ GNUNET_FS_PUBLISH_OPTION_NONE
No options (use defaults for everything).
#define GNUNET_log(kind,...)
#define GNUNET_UNUSED
gcc-ism to document unused arguments
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MIN(a, b)
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#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.
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_ERROR
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_malloc_large(size)
Wrapper around malloc.
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
Definition: program.c:400
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:562
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:1299
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:1334
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975
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:1272
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).
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1222
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
#define GNUNET_TIME_UNIT_DAYS
One day.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:111
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
Definition: time.c:316
Settings for publishing a block (which may of course also apply to an entire directory or file).
uint32_t anonymity_level
At which anonymity level should the block be shared? (0: no anonymity, 1: normal GAP,...
uint32_t content_priority
How important is it for us to store the block? If we run out of space, the highest-priority,...
uint32_t replication_level
How often should we try to migrate the block to other peers? Only used if "CONTENT_PUSHING" is set to...
struct GNUNET_TIME_Absolute expiration_time
At what time should the block expire? Data blocks (DBLOCKS and IBLOCKS) may still be used even if the...
Information for a file or directory that is about to be published.
Definition: fs_api.h:228
Master context for most FS operations.
Definition: fs_api.h:1070
Argument given to the progress callback with information about what is going on.
A Universal Resource Identifier (URI), opaque.
Definition: fs_api.h:167
char ** keywords
Keywords start with a '+' if they are mandatory (in which case the '+' is NOT part of the keyword) an...
Definition: fs_api.h:186
Definition of a command line option.
Entry in list of pending tasks.
Definition: scheduler.c:136
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.
We use 'patterns' of the form (x,y,t) to specify desired download/publish activities of a peer.
void * ctx
Execution context for the pattern (FS-handle to the operation).
void * sctx
Secondary execution context for the pattern (FS-handle to the operation).
struct GNUNET_TIME_Relative delay
With how much delay should this operation be started?
unsigned long long y
Y-value.
struct GNUNET_SCHEDULER_Task * stask
Secondary task to run the operation.
struct GNUNET_TIME_Absolute start_time
When did the operation start?
unsigned long long x
X-value.
struct Pattern * prev
Kept in a DLL.
struct GNUNET_SCHEDULER_Task * task
Task to run the operation.
struct Pattern * next
Kept in a DLL.