daemon that publishes and downloads (random) files More...
Go to the source code of this file.
Data Structures | |
struct | Pattern |
We use 'patterns' of the form (x,y,t) to specify desired download/publish activities of a peer. More... | |
Functions | |
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. More... | |
static struct GNUNET_FS_Uri * | make_keywords (uint64_t kval) |
Create a KSK URI from a number. More... | |
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 'kval'. More... | |
static void | shutdown_task (void *cls) |
Task run during shutdown. More... | |
static void | publish_stop_task (void *cls) |
Task run when a publish operation should be stopped. More... | |
static void | download_stop_task (void *cls) |
Task run when a download operation should be stopped. More... | |
static void | search_stop_task (void *cls) |
Task run when a download operation should be stopped. More... | |
static void * | progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) |
Notification of FS to a client about the progress of an operation. More... | |
static void | start_publish (void *cls) |
Start publish operation. More... | |
static void | start_download (void *cls) |
Start download operation. More... | |
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. More... | |
int | main (int argc, char *const *argv) |
Program that performs various "random" FS activities. More... | |
Variables | |
static int | global_ret |
Return value from 'main'. More... | |
static const struct GNUNET_CONFIGURATION_Handle * | cfg |
Configuration we use. More... | |
static struct GNUNET_STATISTICS_Handle * | stats_handle |
Handle to the statistics service. More... | |
static struct GNUNET_FS_Handle * | fs_handle |
Peer's FS handle. More... | |
static unsigned long long | my_peerid |
Unique number for this peer in the testbed. More... | |
static unsigned long long | anonymity_level |
Desired anonymity level. More... | |
static unsigned long long | replication_level |
Desired replication level. More... | |
static char * | publish_pattern |
String describing which publishing operations this peer should perform. More... | |
static struct Pattern * | publish_head |
Head of the DLL of publish patterns. More... | |
static struct Pattern * | publish_tail |
Tail of the DLL of publish patterns. More... | |
static char * | download_pattern |
String describing which download operations this peer should perform. More... | |
static struct Pattern * | download_head |
Head of the DLL of publish patterns. More... | |
static struct Pattern * | download_tail |
Tail of the DLL of publish patterns. More... | |
daemon that publishes and downloads (random) files
TODO:
Definition in file gnunet-daemon-fsprofiler.c.
|
static |
Parse a pattern string and store the corresponding 'struct Pattern' in the given head/tail.
head | where to store the head |
tail | where to store the tail |
pattern | pattern to parse |
Definition at line 177 of file gnunet-daemon-fsprofiler.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_OK, GNUNET_SYSERR, p, t, Pattern::x, and Pattern::y.
Referenced by run().
|
static |
Create a KSK URI from a number.
kval | the number |
Definition at line 210 of file gnunet-daemon-fsprofiler.c.
References GNUNET_FS_uri_ksk_create(), and GNUNET_snprintf().
Referenced by make_file(), and start_download().
|
static |
Create a file of the given length with a deterministic amount of data to be published under keyword 'kval'.
length | number of bytes in the file |
kval | keyword value and seed for the data of the file |
ctx | context to pass to 'fi' |
Definition at line 230 of file gnunet-daemon-fsprofiler.c.
References GNUNET_FS_BlockOptions::anonymity_level, anonymity_level, bo, GNUNET_FS_BlockOptions::content_priority, ctx, data, GNUNET_FS_BlockOptions::expiration_time, fs_handle, GNUNET_FS_file_information_create_from_data(), GNUNET_FS_uri_destroy(), GNUNET_malloc_large, GNUNET_memcpy, GNUNET_MIN, GNUNET_NO, GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_UNIT_DAYS, GNUNET_FS_Uri::keywords, make_keywords(), GNUNET_FS_BlockOptions::replication_level, and replication_level.
Referenced by start_publish().
|
static |
Task run during shutdown.
cls | unused |
Definition at line 273 of file gnunet-daemon-fsprofiler.c.
References download_head, download_tail, fs_handle, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_FS_download_stop(), GNUNET_FS_publish_stop(), GNUNET_FS_search_stop(), GNUNET_FS_stop(), GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_destroy(), GNUNET_YES, p, publish_head, publish_tail, and stats_handle.
Referenced by run().
|
static |
Task run when a publish operation should be stopped.
cls | the 'struct Pattern' of the publish operation to stop |
Definition at line 318 of file gnunet-daemon-fsprofiler.c.
References GNUNET_FS_publish_stop(), and p.
Referenced by progress_cb().
|
static |
Task run when a download operation should be stopped.
cls | the 'struct Pattern' of the download operation to stop |
Definition at line 333 of file gnunet-daemon-fsprofiler.c.
References GNUNET_FS_download_stop(), GNUNET_YES, and p.
Referenced by progress_cb().
|
static |
Task run when a download operation should be stopped.
cls | the 'struct Pattern' of the download operation to stop |
Definition at line 348 of file gnunet-daemon-fsprofiler.c.
References GNUNET_FS_search_stop(), and p.
Referenced by progress_cb().
|
static |
Notification of FS to a client about the progress of an operation.
Callbacks of this type will be used for uploads, downloads and searches. Some of the arguments depend a bit in their meaning on the context in which the callback is used.
cls | closure |
info | details about the event, specifying the event type and various bits about the event |
Definition at line 373 of file gnunet-daemon-fsprofiler.c.
References anonymity_level, download_head, download_stop_task(), download_tail, fs_handle, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_FS_DOWNLOAD_NO_TEMPORARIES, GNUNET_FS_download_start(), GNUNET_FS_STATUS_DOWNLOAD_ACTIVE, GNUNET_FS_STATUS_DOWNLOAD_COMPLETED, GNUNET_FS_STATUS_DOWNLOAD_ERROR, GNUNET_FS_STATUS_DOWNLOAD_INACTIVE, GNUNET_FS_STATUS_DOWNLOAD_PROGRESS, GNUNET_FS_STATUS_DOWNLOAD_START, GNUNET_FS_STATUS_DOWNLOAD_STOPPED, GNUNET_FS_STATUS_PUBLISH_COMPLETED, GNUNET_FS_STATUS_PUBLISH_ERROR, GNUNET_FS_STATUS_PUBLISH_PROGRESS, GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY, GNUNET_FS_STATUS_PUBLISH_START, GNUNET_FS_STATUS_PUBLISH_STOPPED, GNUNET_FS_STATUS_SEARCH_ERROR, GNUNET_FS_STATUS_SEARCH_RESULT, GNUNET_FS_STATUS_SEARCH_RESULT_NAMESPACE, GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED, GNUNET_FS_STATUS_SEARCH_START, GNUNET_FS_STATUS_SEARCH_STOPPED, GNUNET_FS_STATUS_SEARCH_UPDATE, GNUNET_FS_uri_chk_get_file_size(), GNUNET_FS_uri_test_chk(), GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), GNUNET_YES, info, p, publish_head, publish_stop_task(), publish_tail, GNUNET_TIME_Relative::rel_value_us, search_stop_task(), stats_handle, and uri.
Referenced by run().
|
static |
Start publish operation.
cls | the 'struct Pattern' specifying the operation to perform |
Definition at line 517 of file gnunet-daemon-fsprofiler.c.
References fs_handle, GNUNET_FS_PUBLISH_OPTION_NONE, GNUNET_FS_publish_start(), GNUNET_TIME_absolute_get(), make_file(), and p.
Referenced by run().
|
static |
Start download operation.
cls | the 'struct Pattern' specifying the operation to perform |
Definition at line 538 of file gnunet-daemon-fsprofiler.c.
References anonymity_level, fs_handle, GNUNET_FS_SEARCH_OPTION_NONE, GNUNET_FS_search_start(), GNUNET_TIME_absolute_get(), GNUNET_FS_Uri::keywords, make_keywords(), and p.
Referenced by run().
|
static |
Main function that will be run by the scheduler.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg_ | configuration |
Definition at line 562 of file gnunet-daemon-fsprofiler.c.
References anonymity_level, cfg, download_head, download_pattern, download_tail, fs_handle, global_ret, GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_ERROR_TYPE_ERROR, GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM, GNUNET_FS_OPTIONS_END, GNUNET_FS_OPTIONS_REQUEST_PARALLELISM, GNUNET_FS_start(), GNUNET_log, GNUNET_log_config_missing(), GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_snprintf(), GNUNET_STATISTICS_create(), GNUNET_strdup, GNUNET_SYSERR, my_peerid, p, parse_pattern(), progress_cb(), publish_head, publish_pattern, publish_tail, replication_level, shutdown_task(), start_download(), start_publish(), and stats_handle.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
Program that performs various "random" FS activities.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 656 of file gnunet-daemon-fsprofiler.c.
References gettext_noop, global_ret, GNUNET_GETOPT_OPTION_END, GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), options, and run().
|
static |
Return value from 'main'.
Definition at line 95 of file gnunet-daemon-fsprofiler.c.
|
static |
Configuration we use.
Definition at line 100 of file gnunet-daemon-fsprofiler.c.
Referenced by run().
|
static |
Handle to the statistics service.
Definition at line 105 of file gnunet-daemon-fsprofiler.c.
Referenced by progress_cb(), run(), and shutdown_task().
|
static |
Peer's FS handle.
Definition at line 110 of file gnunet-daemon-fsprofiler.c.
Referenced by make_file(), progress_cb(), run(), shutdown_task(), start_download(), and start_publish().
|
static |
Unique number for this peer in the testbed.
Definition at line 115 of file gnunet-daemon-fsprofiler.c.
Referenced by run().
|
static |
Desired anonymity level.
Definition at line 120 of file gnunet-daemon-fsprofiler.c.
Referenced by make_file(), progress_cb(), run(), and start_download().
|
static |
Desired replication level.
Definition at line 125 of file gnunet-daemon-fsprofiler.c.
Referenced by make_file(), and run().
|
static |
String describing which publishing operations this peer should perform.
The format is "(SIZE,SEED,TIME)*", for example: "(1,5,0)(7,3,13)" means to publish a file with 1 byte and seed/keyword 5 immediately and another file with 7 bytes and seed/keyword 3 after 13 ms.
Definition at line 134 of file gnunet-daemon-fsprofiler.c.
Referenced by run().
|
static |
Head of the DLL of publish patterns.
Definition at line 139 of file gnunet-daemon-fsprofiler.c.
Referenced by progress_cb(), run(), and shutdown_task().
|
static |
Tail of the DLL of publish patterns.
Definition at line 144 of file gnunet-daemon-fsprofiler.c.
Referenced by progress_cb(), run(), and shutdown_task().
|
static |
String describing which download operations this peer should perform.
The format is "(KEYWORD,SIZE,DELAY)*"; for example, "(1,7,3)(3,8,8)" means to download one file of 7 bytes under keyword "1" starting the search after 3 ms; and another one of 8 bytes under keyword '3' starting after 8 ms. The file size is used to determine which search result(s) should be used or ignored.
Definition at line 154 of file gnunet-daemon-fsprofiler.c.
Referenced by run().
|
static |
Head of the DLL of publish patterns.
Definition at line 159 of file gnunet-daemon-fsprofiler.c.
Referenced by progress_cb(), run(), and shutdown_task().
|
static |
Tail of the DLL of publish patterns.
Definition at line 164 of file gnunet-daemon-fsprofiler.c.
Referenced by progress_cb(), run(), and shutdown_task().