29 #elif HAVE_IDN2_IDN2_H
30 #include <idn2/idn2.h>
170 const char *
name = cls;
171 const char *
typename;
184 printf (
"No results.\n");
186 printf (
"%s:\n",
name);
188 for (uint32_t i = 0; i <
rd_count; i++)
196 if (NULL == string_val)
199 "Record %u of type %d malformed, skipping\n",
201 (
int)
rd[i].record_type);
205 printf (
"%s\n", string_val);
207 printf (
"Got `%s' record: %s%s\n",
211 " (supplemental)" :
"");
256 _ (
"`%s' is not a valid DNS domain name\n"),
263 IDNA_ALLOW_UNASSIGNED)))
266 _ (
"Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"),
280 _ (
"Cannot resolve using GNS: GNUnet peer not running\n"));
291 _ (
"Failed to connect to GNS\n"));
301 if (UINT32_MAX ==
rtype)
304 _ (
"Invalid typename specified, assuming `ANY'\n"));
330 main (
int argc,
char *
const *argv)
339 "Lookup a record for the given name"),
345 "Specify the type of the record to lookup"),
351 "Specify a timeout for the lookup"),
360 "DNS Compatibility: Name is passed in IDNA instead of UTF-8"),
374 _ (
"GNUnet GNS resolver tool"),
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
#define gettext_noop(String)
static int ret
Return value of the commandline.
static size_t data_size
Number of bytes in data.
static struct GNUNET_GNS_Handle * gns
Handle to GNS service.
static void do_timeout(void *cls)
Task to run on timeout.
static char * lookup_name
GNS name to lookup.
static int global_ret
Global return value.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static void do_shutdown(void *cls)
Task run on shutdown.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Main function that will be run.
static int dns_compat
DNS compatibility (name is given as DNS name, possible IDNA).
static struct GNUNET_TIME_Relative timeout
Timeout for lookup.
static struct GNUNET_SCHEDULER_Task * to_task
Timeout task.
char * idna_name
DNS IDNA name to lookup.
int main(int argc, char *const *argv)
The main function for gnunet-gns.
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.
static char * lookup_type
record type to look up (-t option)
static struct GNUNET_GNS_LookupWithTldRequest * lr
Handle to lookup request.
static uint32_t rtype
Desired record type.
uint32_t data
The data value.
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
API that can be used to manipulate GNS record data.
API that can be used to store naming information on a GNUnet node;.
int GNUNET_CLIENT_test(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name)
Test if the port or UNIXPATH of the given service_name is in use and thus (most likely) the respectiv...
#define GNUNET_DNSPARSER_TYPE_A
int GNUNET_DNSPARSER_check_name(const char *name)
Check if a hostname in UTF-8 format can be coded into valid IDNA.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_mandatory(struct GNUNET_GETOPT_CommandLineOption opt)
Make the given option mandatory.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Relative *val)
Allow user to specify a struct GNUNET_TIME_Relative (using human-readable "fancy" time).
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
void * GNUNET_GNS_lookup_with_tld_cancel(struct GNUNET_GNS_LookupWithTldRequest *ltr)
Cancel pending lookup request.
struct GNUNET_GNS_LookupWithTldRequest * GNUNET_GNS_lookup_with_tld(struct GNUNET_GNS_Handle *handle, const char *name, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor2 proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS, determining the zone using the TLD of the given ...
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
@ GNUNET_GNS_LO_DEFAULT
Defaults, look in cache, then in DHT.
const char * GNUNET_GNSRECORD_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string (e.g.
@ GNUNET_GNSRECORD_RF_SUPPLEMENTAL
This is a supplemental record.
char * GNUNET_GNSRECORD_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the 'value' of a record to a string.
uint32_t GNUNET_GNSRECORD_typename_to_number(const char *dns_typename)
Convert a type name (e.g.
#define GNUNET_GNSRECORD_TYPE_ANY
Record type indicating any record/'*'.
#define GNUNET_log(kind,...)
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
@ GNUNET_ERROR_TYPE_WARNING
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_free_nz(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
Definition of a command line option.
Connection to the GNS service.
Handle to a lookup request.
Entry in list of pending tasks.
Time for relative time used by GNUnet, in microseconds.