fix only cache variable long/short
[oweals/gnunet.git] / src / gns / test_gns_proxy.c
index d07f197c3c0f2779746e1ef5625996b0e28e2227..eac9e44496e4c0d32c2658016f8a42bb580f0fbc 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -32,7 +32,7 @@
 #include "gnunet_os_lib.h"
 
 #define PORT 8080
-#define TEST_DOMAIN "www.gads"
+#define TEST_DOMAIN "www.gnu"
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300)
 
@@ -220,9 +220,9 @@ curl_main ()
     }
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n");
     do_shutdown ();
-    return;    
+    return;
   }
-  GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max)); 
+  GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max));
   if ( (CURLM_OK != curl_multi_timeout (multi, &timeout)) ||
        (-1 == timeout) )
     delay = GNUNET_TIME_UNIT_SECONDS;
@@ -239,13 +239,13 @@ curl_main ()
                                              &nrs,
                                              &nws,
                                              &curl_task,
-                                             NULL);  
+                                             NULL);
 }
 
 static void
 start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_asprintf (&url, 
+  GNUNET_asprintf (&url,
                   "http://%s:%d/hello_world",  
                   TEST_DOMAIN, PORT);
   curl = curl_easy_init ();
@@ -280,7 +280,7 @@ disco_ns (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  *                will match 'result_af' from the request
  * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
  *                that the VPN allocated for the redirection;
- *                traffic to this IP will now be redirected to the 
+ *                traffic to this IP will now be redirected to the
  *                specified target peer; NULL on error
  */
 static void
@@ -290,12 +290,12 @@ commence_testing (void *cls, int32_t success, const char *emsg)
 
   if ((emsg != NULL) && (GNUNET_YES != success))
   {
-    fprintf (stderr, 
+    fprintf (stderr,
             "NS failed to create record %s\n", emsg);
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
-  
+
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1), start_curl, NULL);
 
 }
@@ -306,7 +306,7 @@ commence_testing (void *cls, int32_t success, const char *emsg)
 /**
  * Function to keep the HTTP server running.
  */
-static void 
+static void
 mhd_main (void);
 
 
@@ -320,7 +320,7 @@ mhd_task (void *cls,
 }
 
 
-static void 
+static void
 mhd_main ()
 {
   struct GNUNET_NETWORK_FDSet nrs;
@@ -355,7 +355,7 @@ mhd_main ()
                                             &nrs,
                                             &nws,
                                             &mhd_task,
-                                            NULL);  
+                                            NULL);
 }
 
 static void
@@ -364,10 +364,10 @@ run (void *cls,
      struct GNUNET_TESTING_Peer *peer)
 {
   enum MHD_FLAG flags;
-  struct GNUNET_CRYPTO_EccPrivateKey *host_key;
-  struct GNUNET_NAMESTORE_RecordData rd;
+  struct GNUNET_CRYPTO_EcdsaPrivateKey *host_key;
+  struct GNUNET_GNSRECORD_Data rd;
   char *zone_keyfile;
-  
+
   namestore = GNUNET_NAMESTORE_connect (cfg);
   GNUNET_assert (NULL != namestore);
   flags = MHD_USE_DEBUG;
@@ -396,7 +396,7 @@ run (void *cls,
     do_shutdown ();
     return;
   }
-  
+
   proxy_proc = GNUNET_OS_start_process (GNUNET_NO,
                                         GNUNET_OS_INHERIT_STD_ALL,
                                         NULL,
@@ -412,7 +412,7 @@ run (void *cls,
     do_shutdown ();
     return;
   }
-  
+
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
                                                             "ZONEKEY",
                                                             &zone_keyfile))
@@ -421,13 +421,13 @@ run (void *cls,
     return;
   }
 
-  host_key = GNUNET_CRYPTO_ecc_key_create_from_file (zone_keyfile);
-  rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value;
-  GNUNET_assert (GNUNET_OK == GNUNET_NAMESTORE_string_to_value (GNUNET_GNS_RECORD_A,
+  host_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (zone_keyfile);
+  rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
+  GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_string_to_value (GNUNET_DNSPARSER_TYPE_A,
                                                                "127.0.0.1",
                                                                (void**)&rd.data,
                                                                &rd.data_size));
-  rd.record_type = GNUNET_GNS_RECORD_A;
+  rd.record_type = GNUNET_DNSPARSER_TYPE_A;
 
   GNUNET_NAMESTORE_record_create (namestore,
                                   host_key,
@@ -438,7 +438,7 @@ run (void *cls,
 
   GNUNET_free ((void**)rd.data);
   GNUNET_free (zone_keyfile);
-  GNUNET_CRYPTO_ecc_key_free (host_key);
+  GNUNET_free (host_key);
 }
 
 int
@@ -460,8 +460,6 @@ main (int argc, char *const *argv)
   }
     GNUNET_free (binary);
 
-  GNUNET_CRYPTO_ecc_setup_hostkey ("test_gns_proxy.conf");
-  
   if (0 != curl_global_init (CURL_GLOBAL_WIN32))
   {
     fprintf (stderr, "failed to initialize curl\n");