-modify timeout values further
[oweals/gnunet.git] / src / dht / gnunet-dht-get.c
index 0d291e5e76599ebb496449514bcde59efa0fb17c..959f0b847317a5a45ad13137c84c004bc83ba0b9 100644 (file)
@@ -24,7 +24,7 @@
  * @author Nathan Evans
  */
 #include "platform.h"
-#include "gnunet_dht_service_new.h"
+#include "gnunet_dht_service.h"
 
 /**
  * The type of the query
@@ -122,14 +122,14 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  */
 static void
 get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
-                     const GNUNET_HashCode * key,
+                     const struct GNUNET_HashCode * key,
                      const struct GNUNET_PeerIdentity *get_path,
-                    unsigned int get_path_length,
+                     unsigned int get_path_length,
                      const struct GNUNET_PeerIdentity *put_path,
-                    unsigned int put_path_length,
-                     enum GNUNET_BLOCK_Type type, size_t size, const void *data)
+                     unsigned int put_path_length, enum GNUNET_BLOCK_Type type,
+                     size_t size, const void *data)
 {
-  fprintf (stdout, "Result %d, type %d:\n%.*s\n", result_count, type,
+  FPRINTF (stdout, "Result %d, type %d:\n%.*s\n", result_count, type,
            (unsigned int) size, (char *) data);
   result_count++;
 }
@@ -148,14 +148,14 @@ run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   struct GNUNET_TIME_Relative timeout;
-  GNUNET_HashCode key;
+  struct GNUNET_HashCode key;
 
   cfg = c;
 
   if (query_key == NULL)
   {
     if (verbose)
-      fprintf (stderr, "Must provide key for DHT GET!\n");
+      FPRINTF (stderr, "%s",  "Must provide key for DHT GET!\n");
     ret = 1;
     return;
   }
@@ -165,12 +165,12 @@ run (void *cls, char *const *args, const char *cfgfile,
   if (dht_handle == NULL)
   {
     if (verbose)
-      fprintf (stderr, "Couldn't connect to DHT service!\n");
+      FPRINTF (stderr, "%s",  "Couldn't connect to DHT service!\n");
     ret = 1;
     return;
   }
   else if (verbose)
-    fprintf (stderr, "Connected to DHT service!\n");
+    FPRINTF (stderr, "%s",  "Connected to DHT service!\n");
 
   if (query_type == GNUNET_BLOCK_TYPE_ANY)      /* Type of data not set */
     query_type = GNUNET_BLOCK_TYPE_TEST;
@@ -182,13 +182,13 @@ run (void *cls, char *const *args, const char *cfgfile,
   absolute_timeout = GNUNET_TIME_relative_to_absolute (timeout);
 
   if (verbose)
-    fprintf (stderr, "Issuing GET request for %s!\n", query_key);
+    FPRINTF (stderr, "Issuing GET request for %s!\n", query_key);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
                                 (absolute_timeout), &cleanup_task, NULL);
   get_handle =
-      GNUNET_DHT_get_start (dht_handle, timeout, query_type, &key,
-                            replication, GNUNET_DHT_RO_NONE, NULL,
-                            0, &get_result_iterator, NULL);
+      GNUNET_DHT_get_start (dht_handle, query_type, &key, replication,
+                            GNUNET_DHT_RO_NONE, NULL, 0, &get_result_iterator,
+                            NULL);
 
 }
 
@@ -226,6 +226,10 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
 int
 main (int argc, char *const *argv)
 {
+
+  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+    return 2;
+
   return (GNUNET_OK ==
           GNUNET_PROGRAM_run (argc, argv, "gnunet-dht-get",
                               gettext_noop