From bc7d219460d5ef0511164eb90039710940d905dd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 13 Aug 2013 17:48:54 +0000 Subject: -more work on simplified GNS API implementation --- src/gns/gnunet-gns.c | 225 ++++++++++----------------------------------------- 1 file changed, 43 insertions(+), 182 deletions(-) (limited to 'src/gns/gnunet-gns.c') diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index d3b61d510..d58018d20 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2012 Christian Grothoff (and other contributing authors) + (C) 2012-2013 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -34,11 +34,6 @@ */ static struct GNUNET_GNS_Handle *gns; -/** - * GNS name to shorten. (-s option) - */ -static char *shorten_name; - /** * GNS name to lookup. (-u option) */ @@ -49,11 +44,6 @@ static char *lookup_name; */ static char *lookup_type; -/** - * name to look up authority for (-a option) - */ -static char *auth_name; - /** * raw output */ @@ -69,16 +59,6 @@ static int rtype; */ static struct GNUNET_GNS_LookupRequest *lookup_request; -/** - * Handle to shorten request - */ -static struct GNUNET_GNS_ShortenRequest *shorten_request; - -/** - * Handle to get authority request - */ -static struct GNUNET_GNS_GetAuthRequest *getauth_request; - /** * Task run on shutdown. Cleans up everything. @@ -92,19 +72,9 @@ do_shutdown (void *cls, { if (NULL != lookup_request) { - GNUNET_GNS_cancel_lookup_request (lookup_request); + GNUNET_GNS_lookup_cancel (lookup_request); lookup_request = NULL; } - if (NULL != shorten_request) - { - GNUNET_GNS_cancel_shorten_request (shorten_request); - shorten_request = NULL; - } - if (NULL != getauth_request) - { - GNUNET_GNS_cancel_get_auth_request (getauth_request); - getauth_request = NULL; - } if (NULL != gns) { GNUNET_GNS_disconnect (gns); @@ -113,27 +83,6 @@ do_shutdown (void *cls, } -/** - * Function called with the result of a shorten operation. - * Prints the result. - * - * @param cls a 'const char *' with the original (long) name - * @param nshort the shortened name - */ -static void -process_shorten_result (void* cls, const char *nshort) -{ - const char *original_name = cls; - - shorten_request = NULL; - if (raw) - printf("%s", nshort); - else - printf("%s shortened to %s\n", original_name, nshort); - GNUNET_SCHEDULER_shutdown (); -} - - /** * Function called with the result of a GADS lookup. * @@ -142,21 +91,22 @@ process_shorten_result (void* cls, const char *nshort) * @param rd array of 'rd_count' records with the results */ static void -process_lookup_result (void* cls, uint32_t rd_count, +process_lookup_result (void *cls, uint32_t rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) { - const char* name = cls; + const char *name = cls; uint32_t i; - const char* typename; + const char *typename; char* string_val; lookup_request = NULL; if (!raw) { if (0 == rd_count) - printf("No results.\n"); + printf ("No results.\n"); else - printf("%s:\n", name); + printf ("%s:\n", + name); } for (i=0; i