command line tool to access distributed GNS More...
#include "platform.h"
#include <gnunet_util_lib.h>
#include <gnunet_gnsrecord_lib.h>
#include <gnunet_namestore_service.h>
#include <gnunet_gns_service.h>
Go to the source code of this file.
Functions | |
static void | do_shutdown (void *cls) |
Task run on shutdown. More... | |
static void | do_timeout (void *cls) |
Task to run on timeout. More... | |
static void | process_lookup_result (void *cls, int was_gns, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Function called with the result of a GNS lookup. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
Main function that will be run. More... | |
int | main (int argc, char *const *argv) |
The main function for gnunet-gns. More... | |
Variables | |
static const struct GNUNET_CONFIGURATION_Handle * | cfg |
Configuration we are using. More... | |
static struct GNUNET_GNS_Handle * | gns |
Handle to GNS service. More... | |
static char * | lookup_name |
GNS name to lookup. More... | |
char * | idna_name |
DNS IDNA name to lookup. More... | |
static int | dns_compat |
DNS compatibility (name is given as DNS name, possible IDNA). More... | |
static char * | lookup_type |
record type to look up (-t option) More... | |
static int | raw |
raw output More... | |
static uint32_t | rtype |
Desired record type. More... | |
static struct GNUNET_TIME_Relative | timeout |
Timeout for lookup. More... | |
static struct GNUNET_SCHEDULER_Task * | to_task |
Timeout task. More... | |
static struct GNUNET_GNS_LookupWithTldRequest * | lr |
Handle to lookup request. More... | |
static int | global_ret |
Global return value. More... | |
command line tool to access distributed GNS
binary version of gnunet-gns-import.sh (for OSes that have no POSIX shell).
Definition in file gnunet-gns.c.
|
static |
Task run on shutdown.
Cleans up everything.
cls | unused |
Definition at line 116 of file gnunet-gns.c.
References gns, GNUNET_free, GNUNET_GNS_disconnect(), GNUNET_GNS_lookup_with_tld_cancel(), GNUNET_SCHEDULER_cancel(), idna_name, lr, and to_task.
Referenced by run().
|
static |
Task to run on timeout.
cls | unused |
Definition at line 148 of file gnunet-gns.c.
References global_ret, GNUNET_SCHEDULER_shutdown(), and to_task.
Referenced by run().
|
static |
Function called with the result of a GNS lookup.
cls | the 'const char *' name that was resolved |
was_gns | GNUNET_NO if TLD did not indicate use of GNS |
rd_count | number of records returned |
rd | array of rd_count records with the results |
Definition at line 165 of file gnunet-gns.c.
References data, data_size, global_ret, GNUNET_free, GNUNET_GNSRECORD_number_to_typename(), GNUNET_GNSRECORD_record_get_expiration_time(), GNUNET_GNSRECORD_RF_SUPPLEMENTAL, GNUNET_GNSRECORD_value_to_string(), GNUNET_NO, GNUNET_SCHEDULER_shutdown(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_UNIT_ZERO_ABS, GNUNET_YES, lr, raw, rd, and rd_count.
Referenced by run().
|
static |
Main function that will be run.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
c | configuration |
If DNS compatibility is requested, we first verify that the lookup_name is in a DNS format. If yes, we convert it to UTF-8.
Definition at line 239 of file gnunet-gns.c.
References _, consensus-simulation::args, cfg, dns_compat, do_shutdown(), do_timeout(), global_ret, gns, GNUNET_CLIENT_test(), GNUNET_DNSPARSER_check_name(), GNUNET_DNSPARSER_TYPE_A, GNUNET_ERROR_TYPE_WARNING, GNUNET_GNS_connect(), GNUNET_GNS_LO_DEFAULT, GNUNET_GNS_lookup_with_tld(), GNUNET_GNSRECORD_TYPE_ANY, GNUNET_GNSRECORD_typename_to_number(), GNUNET_log, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_YES, idna_name, lookup_name, lookup_type, lr, process_lookup_result(), raw, rtype, timeout, and to_task.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function for gnunet-gns.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 356 of file gnunet-gns.c.
References _, dns_compat, gettext_noop, global_ret, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_mandatory(), GNUNET_GETOPT_option_relative_time(), GNUNET_GETOPT_option_string(), GNUNET_log_setup(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), GNUNET_TIME_UNIT_FOREVER_REL, lookup_name, lookup_type, options, raw, ret, run(), and timeout.
|
static |
|
static |
Handle to GNS service.
Definition at line 53 of file gnunet-gns.c.
Referenced by do_shutdown(), and run().
|
static |
char* idna_name |
DNS IDNA name to lookup.
(set if -d option is set)
Definition at line 63 of file gnunet-gns.c.
Referenced by do_shutdown(), GNUNET_DNSPARSER_builder_add_name(), and run().
|
static |
DNS compatibility (name is given as DNS name, possible IDNA).
Definition at line 68 of file gnunet-gns.c.
|
static |
record type to look up (-t option)
Definition at line 73 of file gnunet-gns.c.
|
static |
raw output
Definition at line 78 of file gnunet-gns.c.
Referenced by bf_group_serialize_cb(), build_dns_query(), GNUNET_HELLO_extract_address(), main(), process_lookup_result(), process_queue(), queue(), and run().
|
static |
|
static |
|
static |
Timeout task.
Definition at line 93 of file gnunet-gns.c.
Referenced by do_shutdown(), do_timeout(), and run().
|
static |
Handle to lookup request.
Definition at line 98 of file gnunet-gns.c.
Referenced by do_shutdown(), GNUNET_ABD_request_cancel(), GNUNET_GNS_lookup_cancel(), GNUNET_GNS_lookup_limited(), handle_result(), process_lookup_result(), and run().
|
static |
Global return value.
0 on success (default), 1 on internal failures 2 on launch failure, 4 if the name is not a GNS-supported TLD,
Definition at line 107 of file gnunet-gns.c.
Referenced by do_timeout(), main(), process_lookup_result(), and run().