search for data in DHT More...
Go to the source code of this file.
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "dht-clients", __VA_ARGS__) |
Functions | |
static void | cleanup_task (void *cls) |
Task run to clean up on shutdown. More... | |
static void | timeout_task (void *cls) |
Task run on timeout. More... | |
static void | get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp, const struct GNUNET_HashCode *key, const struct GNUNET_PeerIdentity *trunc_peer, const struct GNUNET_DHT_PathElement *get_path, unsigned int get_path_length, const struct GNUNET_DHT_PathElement *put_path, unsigned int put_path_length, enum GNUNET_BLOCK_Type type, size_t size, const void *data) |
Iterator called on each result obtained for a DHT operation that expects a reply. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
Main function that will be run by the scheduler. More... | |
int | main (int argc, char *const *argv) |
Entry point for gnunet-dht-get. More... | |
Variables | |
static unsigned int | query_type |
The type of the query. More... | |
static unsigned int | replication = 5 |
Desired replication level. More... | |
static char * | query_key |
The key for the query. More... | |
static struct GNUNET_TIME_Relative | timeout_request = { 60000 } |
User supplied timeout value. More... | |
static unsigned int | verbose |
Be verbose. More... | |
static int | demultixplex_everywhere |
Use DHT demultixplex_everywhere. More... | |
static int | record_route |
Use GNUNET_DHT_RO_RECORD_ROUTE. More... | |
static struct GNUNET_DHT_Handle * | dht_handle |
Handle to the DHT. More... | |
static const struct GNUNET_CONFIGURATION_Handle * | cfg |
Global handle of the configuration. More... | |
static struct GNUNET_DHT_GetHandle * | get_handle |
Handle for the get request. More... | |
static unsigned int | result_count |
Count of results found. More... | |
static int | ret |
Global status value. More... | |
static struct GNUNET_SCHEDULER_Task * | tt |
Task scheduled to handle timeout. More... | |
search for data in DHT
Definition in file gnunet-dht-get.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "dht-clients", __VA_ARGS__) |
Definition at line 29 of file gnunet-dht-get.c.
|
static |
Task run to clean up on shutdown.
cls | unused |
Definition at line 102 of file gnunet-dht-get.c.
References dht_handle, get_handle, GNUNET_DHT_disconnect(), GNUNET_DHT_get_stop(), GNUNET_SCHEDULER_cancel(), and tt.
Referenced by run().
|
static |
Task run on timeout.
Triggers shutdown.
cls | unused |
Definition at line 128 of file gnunet-dht-get.c.
References GNUNET_SCHEDULER_shutdown(), and tt.
Referenced by run().
|
static |
Iterator called on each result obtained for a DHT operation that expects a reply.
cls | closure |
exp | when will this value expire |
key | key of the result |
trunc_peer | peer at which the path was truncated, or NULL if not |
get_path | peers on reply path (or NULL if not recorded) |
get_path_length | number of entries in get_path |
put_path | peers on the PUT path (or NULL if not recorded) |
put_path_length | number of entries in get_path |
type | type of the result |
size | number of bytes in data |
data | pointer to the result data |
Definition at line 152 of file gnunet-dht-get.c.
References _, cfg, data, GNUNET_BLOCK_TYPE_TEST, GNUNET_break, GNUNET_CRYPTO_get_peer_identity(), GNUNET_DHT_verify_path(), GNUNET_i2s(), GNUNET_OK, my_identity, record_route, result_count, size, type, and verbose.
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!) |
c | configuration |
Definition at line 225 of file gnunet-dht-get.c.
References _, cfg, cleanup_task(), demultixplex_everywhere, dht_handle, get_handle, get_result_iterator(), GNUNET_BLOCK_TYPE_ANY, GNUNET_BLOCK_TYPE_TEST, GNUNET_CRYPTO_hash(), GNUNET_DHT_connect(), GNUNET_DHT_get_start(), GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, GNUNET_DHT_RO_NONE, GNUNET_DHT_RO_RECORD_ROUTE, GNUNET_h2s_full(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), key, query_key, query_type, record_route, replication, ret, timeout_request, timeout_task(), tt, and verbose.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
Entry point for gnunet-dht-get.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 285 of file gnunet-dht-get.c.
References demultixplex_everywhere, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_relative_time(), GNUNET_GETOPT_option_string(), GNUNET_GETOPT_option_uint(), GNUNET_GETOPT_option_verbose(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), options, query_key, query_type, record_route, replication, ret, run(), timeout_request, and verbose.
|
static |
The type of the query.
Definition at line 33 of file gnunet-dht-get.c.
|
static |
Desired replication level.
Definition at line 38 of file gnunet-dht-get.c.
Referenced by execute_get(), get_cb(), GNUNET_DATASTORE_put(), GNUNET_FS_handle_on_demand_block(), handle_datastore_reply(), heap_plugin_put(), main(), postgres_plugin_put(), process_local_reply(), process_migration_content(), process_result(), repl_proc(), run(), sqlite_plugin_put(), and transmit_item().
|
static |
The key for the query.
Definition at line 43 of file gnunet-dht-get.c.
|
static |
User supplied timeout value.
Definition at line 48 of file gnunet-dht-get.c.
|
static |
Be verbose.
Definition at line 53 of file gnunet-dht-get.c.
Referenced by get_result_iterator(), main(), and run().
|
static |
Use DHT demultixplex_everywhere.
Definition at line 58 of file gnunet-dht-get.c.
|
static |
Use GNUNET_DHT_RO_RECORD_ROUTE.
Definition at line 63 of file gnunet-dht-get.c.
Referenced by get_result_iterator(), main(), and run().
|
static |
Handle to the DHT.
Definition at line 68 of file gnunet-dht-get.c.
Referenced by cleanup_task(), and run().
|
static |
Global handle of the configuration.
Definition at line 73 of file gnunet-dht-get.c.
Referenced by get_result_iterator(), and run().
|
static |
Handle for the get request.
Definition at line 78 of file gnunet-dht-get.c.
Referenced by cleanup_task(), get_result_iterator(), GNUNET_DHT_get_filter_known_results(), GNUNET_DHT_get_stop(), process_client_result(), and run().
|
static |
Count of results found.
Definition at line 83 of file gnunet-dht-get.c.
Referenced by get_result_iterator().
|
static |
Global status value.
Definition at line 88 of file gnunet-dht-get.c.
|
static |
Task scheduled to handle timeout.
Definition at line 93 of file gnunet-dht-get.c.
Referenced by cleanup_task(), GNUNET_STRINGS_absolute_time_to_string(), GNUNET_TIME_absolute2s(), GNUNET_TIME_timestamp2s(), run(), and timeout_task().