daemon that uses cadet to announce a regular expression. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "regex_internal_lib.h"
#include "regex_test_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_statistics_service.h"
Go to the source code of this file.
Functions | |
static void | shutdown_task (void *cls) |
Task run during shutdown. More... | |
static void | reannounce_regex (void *cls) |
Announce a previously announced regex re-using cached data. More... | |
static void | announce_regex (const char *regex) |
Announce the given regular expression using regex and the path compression length read from config. More... | |
static int | scan (void *cls, const char *filename) |
Scan through the policy_dir looking for the n-th filename. 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) |
The main function of the regexprofiler service. 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_DHT_Handle * | dht_handle |
Peer's dht handle. More... | |
static struct REGEX_INTERNAL_Announcement * | announce_handle |
Peer's regex announce handle. More... | |
static struct GNUNET_SCHEDULER_Task * | reannounce_task |
Periodically reannounce regex. More... | |
static struct GNUNET_TIME_Relative | reannounce_period_max |
What's the maximum reannounce period. More... | |
static unsigned long long | max_path_compression |
Maximal path compression length for regex announcing. More... | |
static char * | policy_filename |
Name of the file containing policies that this peer should announce. More... | |
static char * | regex_prefix |
Prefix to add before every regex we're announcing. More... | |
static char * | rx_with_pfx |
Regex with prefix. More... | |
static unsigned int | rounds = 3 |
How many put rounds should we do. More... | |
static struct GNUNET_CRYPTO_EddsaPrivateKey * | my_private_key |
Private key for this peer. More... | |
daemon that uses cadet to announce a regular expression.
Used in conjunction with gnunet-regex-profiler to announce regexes on several peers without the need to explicitly connect to the cadet service running on the peer from within the profiler.
Definition in file gnunet-daemon-regexprofiler.c.
|
static |
Task run during shutdown.
cls | unused |
Definition at line 110 of file gnunet-daemon-regexprofiler.c.
References announce_handle, dht_handle, GNUNET_DHT_disconnect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_free_nz, GNUNET_log, GNUNET_SCHEDULER_cancel(), my_private_key, policy_filename, reannounce_task, and REGEX_INTERNAL_announce_cancel().
Referenced by run().
|
static |
Announce a previously announced regex re-using cached data.
cls | Closure (regex to announce if needed). |
Definition at line 144 of file gnunet-daemon-regexprofiler.c.
References announce_handle, dht_handle, global_ret, GNUNET_assert, GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_update(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_MICROSECONDS, max_path_compression, my_private_key, reannounce_period_max, reannounce_regex(), reannounce_task, REGEX_INTERNAL_announce(), REGEX_INTERNAL_reannounce(), GNUNET_TIME_Relative::rel_value_us, rounds, and stats_handle.
Referenced by announce_regex(), and reannounce_regex().
|
static |
Announce the given regular expression using regex and the path compression length read from config.
regex | regular expression to announce on this peer's cadet. |
Definition at line 194 of file gnunet-daemon-regexprofiler.c.
References GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_strdup, policy_filename, reannounce_regex(), and reannounce_task.
Referenced by run().
|
static |
Scan through the policy_dir looking for the n-th filename.
cls | Closure (target number n). |
filename | complete filename (absolute path). |
Definition at line 223 of file gnunet-daemon-regexprofiler.c.
References filename, GNUNET_NO, GNUNET_OK, GNUNET_strdup, and policy_filename.
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 247 of file gnunet-daemon-regexprofiler.c.
References _, announce_regex(), cfg, dht_handle, global_ret, GNUNET_asprintf(), GNUNET_assert, GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_CRYPTO_eddsa_key_create_from_configuration(), GNUNET_DHT_connect(), GNUNET_DISK_directory_scan(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_log_config_missing(), GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_create(), GNUNET_SYSERR, GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_MINUTES, max_path_compression, my_private_key, peer_id, policy_dir, policy_filename, reannounce_period_max, regex_prefix, REGEX_TEST_combine(), REGEX_TEST_free_from_file(), REGEX_TEST_read_from_file(), rx_with_pfx, scan(), shutdown_task(), and stats_handle.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function of the regexprofiler service.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 372 of file gnunet-daemon-regexprofiler.c.
References gettext_noop, global_ret, GNUNET_GETOPT_OPTION_END, GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), options, and run().
|
static |
Return value from 'main'.
Definition at line 40 of file gnunet-daemon-regexprofiler.c.
Referenced by main(), reannounce_regex(), and run().
|
static |
Configuration we use.
Definition at line 45 of file gnunet-daemon-regexprofiler.c.
Referenced by run().
|
static |
Handle to the statistics service.
Definition at line 50 of file gnunet-daemon-regexprofiler.c.
Referenced by reannounce_regex(), and run().
|
static |
Peer's dht handle.
Definition at line 55 of file gnunet-daemon-regexprofiler.c.
Referenced by reannounce_regex(), run(), and shutdown_task().
|
static |
Peer's regex announce handle.
Definition at line 60 of file gnunet-daemon-regexprofiler.c.
Referenced by reannounce_regex(), and shutdown_task().
|
static |
Periodically reannounce regex.
Definition at line 65 of file gnunet-daemon-regexprofiler.c.
Referenced by announce_regex(), reannounce_regex(), and shutdown_task().
|
static |
What's the maximum reannounce period.
Definition at line 70 of file gnunet-daemon-regexprofiler.c.
Referenced by reannounce_regex(), and run().
|
static |
Maximal path compression length for regex announcing.
Definition at line 75 of file gnunet-daemon-regexprofiler.c.
Referenced by reannounce_regex(), and run().
|
static |
Name of the file containing policies that this peer should announce.
One policy per line.
Definition at line 81 of file gnunet-daemon-regexprofiler.c.
Referenced by announce_regex(), run(), scan(), and shutdown_task().
|
static |
Prefix to add before every regex we're announcing.
Definition at line 86 of file gnunet-daemon-regexprofiler.c.
Referenced by run().
|
static |
Regex with prefix.
Definition at line 91 of file gnunet-daemon-regexprofiler.c.
Referenced by run().
|
static |
How many put rounds should we do.
Definition at line 96 of file gnunet-daemon-regexprofiler.c.
Referenced by reannounce_regex().
|
static |
Private key for this peer.
Definition at line 101 of file gnunet-daemon-regexprofiler.c.
Referenced by reannounce_regex(), run(), and shutdown_task().