search for data in DHT More...
Go to the source code of this file.
Functions | |
static void | cleanup_task (void *cls) |
Stop monitoring request and start shutdown. More... | |
static void | timeout_task (void *cls) |
We hit a timeout. More... | |
static void | get_callback (void *cls, enum GNUNET_DHT_RouteOption options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, uint32_t desired_replication_level, const struct GNUNET_HashCode *key) |
Callback called on each GET request going through the DHT. More... | |
static void | get_resp_callback (void *cls, enum GNUNET_BLOCK_Type type, 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, struct GNUNET_TIME_Absolute exp, const struct GNUNET_HashCode *key, const void *data, size_t size) |
Callback called on each GET reply going through the DHT. More... | |
static void | put_callback (void *cls, enum GNUNET_DHT_RouteOption options, enum GNUNET_BLOCK_Type type, uint32_t hop_count, uint32_t desired_replication_level, const struct GNUNET_PeerIdentity *trunc_peer, unsigned int path_length, const struct GNUNET_DHT_PathElement *path, struct GNUNET_TIME_Absolute exp, const struct GNUNET_HashCode *key, const void *data, size_t size) |
Callback called on each PUT request going through the DHT. 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-monitor. More... | |
Variables | |
static unsigned int | block_type |
The type of the query. More... | |
static char * | query_key |
The key to be monitored. More... | |
static struct GNUNET_TIME_Relative | timeout_request = { 60000 } |
User supplied timeout value (in seconds) More... | |
static int | verbose |
Be verbose. 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_MonitorHandle * | monitor_handle |
Handle for the get request. More... | |
static unsigned int | result_count |
Count of messages received. 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-monitor.c.
|
static |
Stop monitoring request and start shutdown.
cls | closure (unused) |
Definition at line 86 of file gnunet-dht-monitor.c.
References dht_handle, GNUNET_DHT_disconnect(), GNUNET_DHT_monitor_stop(), GNUNET_SCHEDULER_cancel(), monitor_handle, tt, and verbose.
Referenced by run().
|
static |
We hit a timeout.
Stop monitoring request and start shutdown
cls | closure (unused) |
Definition at line 114 of file gnunet-dht-monitor.c.
References GNUNET_SCHEDULER_shutdown(), and tt.
Referenced by run().
|
static |
Callback called on each GET request going through the DHT.
cls | Closure. |
options | Options, for instance RecordRoute, DemultiplexEverywhere. |
type | The type of data in the request. |
hop_count | Hop count so far. |
desired_replication_level | Desired replication level. |
key | Key of the requested data. |
Definition at line 132 of file gnunet-dht-monitor.c.
References GNUNET_h2s_full(), key, result_count, and type.
Referenced by run().
|
static |
Callback called on each GET reply going through the DHT.
cls | Closure. |
type | The type of data in the result. |
trunc_peer | peer where the path was truncated, or NULL if the path is complete |
get_path | Peers on GET 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. |
exp | Expiration time of the data. |
key | Key of the data. |
data | Pointer to the result data. |
size | Number of bytes in data. |
Definition at line 164 of file gnunet-dht-monitor.c.
References data, GNUNET_BLOCK_TYPE_TEST, GNUNET_h2s_full(), GNUNET_STRINGS_absolute_time_to_string(), key, result_count, size, and type.
Referenced by run().
|
static |
Callback called on each PUT request going through the DHT.
cls | Closure. |
options | Options, for instance RecordRoute, DemultiplexEverywhere. |
type | The type of data in the request. |
hop_count | Hop count so far. |
trunc_peer | peer where the path was truncated, or NULL if the path is complete |
path_length | number of entries in path (or 0 if not recorded). |
path | peers on the PUT path (or NULL if not recorded). |
desired_replication_level | Desired replication level. |
exp | Expiration time of the data. |
key | Key under which data is to be stored. |
data | Pointer to the data carried. |
size | Number of bytes in data. |
Definition at line 207 of file gnunet-dht-monitor.c.
References data, GNUNET_BLOCK_TYPE_TEST, GNUNET_h2s_full(), GNUNET_STRINGS_absolute_time_to_string(), key, result_count, size, and type.
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 243 of file gnunet-dht-monitor.c.
References _, block_type, cfg, cleanup_task(), dht_handle, get_callback(), get_resp_callback(), GNUNET_BLOCK_TYPE_ANY, GNUNET_BLOCK_TYPE_TEST, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_hash_from_string, GNUNET_DHT_connect(), GNUNET_DHT_monitor_start(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_STRINGS_relative_time_to_string(), key, monitor_handle, put_callback(), query_key, ret, timeout_request, timeout_task(), tt, and verbose.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
Entry point for gnunet-dht-monitor.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 296 of file gnunet-dht-monitor.c.
References block_type, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_relative_time(), GNUNET_GETOPT_option_string(), GNUNET_GETOPT_option_uint(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), options, query_key, ret, run(), timeout_request, and verbose.
|
static |
The type of the query.
Definition at line 32 of file gnunet-dht-monitor.c.
Referenced by GDS_helper_make_put_message(), main(), and run().
|
static |
The key to be monitored.
Definition at line 37 of file gnunet-dht-monitor.c.
|
static |
User supplied timeout value (in seconds)
Definition at line 42 of file gnunet-dht-monitor.c.
|
static |
Be verbose.
Definition at line 47 of file gnunet-dht-monitor.c.
Referenced by cleanup_task(), main(), and run().
|
static |
Handle to the DHT.
Definition at line 52 of file gnunet-dht-monitor.c.
Referenced by cleanup_task(), and run().
|
static |
Global handle of the configuration.
Definition at line 57 of file gnunet-dht-monitor.c.
Referenced by run().
|
static |
Handle for the get request.
Definition at line 62 of file gnunet-dht-monitor.c.
Referenced by cleanup_task(), and run().
|
static |
Count of messages received.
Definition at line 67 of file gnunet-dht-monitor.c.
Referenced by get_callback(), get_resp_callback(), and put_callback().
|
static |
Global status value.
Definition at line 72 of file gnunet-dht-monitor.c.
|
static |
Task scheduled to handle timeout.
Definition at line 77 of file gnunet-dht-monitor.c.
Referenced by cleanup_task(), run(), and timeout_task().