-use GPLv3+ consistently
[oweals/gnunet.git] / src / gns / test_gns_pseu_shorten.c
index 28f92f8b596174963e1f40112e45a9aedf72d095..d51d2ea55660b30290b0bdcfd7af3a2ddd678cc8 100644 (file)
@@ -37,7 +37,7 @@
 #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
 
 /* test records to resolve */
-#define TEST_DOMAIN "www.alicewonderland.bobbuilder.gads"
+#define TEST_DOMAIN "www.alicewonderland.bobbuilder.gnu"
 #define TEST_IP "127.0.0.1"
 #define TEST_RECORD_NAME "www"
 
@@ -46,7 +46,7 @@
 #define TEST_AUTHORITY_BOB "bobbuilder"
 #define TEST_AUTHORITY_ALICE "alicewonderland"
 #define TEST_PSEU_ALICE "carol"
-#define TEST_EXPECTED_RESULT "www.carol.short.private.gads"
+#define TEST_EXPECTED_RESULT "www.carol.short.private.gnu"
 
 #define DHT_OPERATION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
 
@@ -69,11 +69,11 @@ static struct GNUNET_DHT_Handle *dht_handle;
 
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
-static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded alice_pkey;
-static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded bob_pkey;
-static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded our_pkey;
-static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded priv_pkey;
-static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded short_pkey;
+static struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
+static struct GNUNET_CRYPTO_EccPublicKey bob_pkey;
+static struct GNUNET_CRYPTO_EccPublicKey our_pkey;
+static struct GNUNET_CRYPTO_EccPublicKey priv_pkey;
+static struct GNUNET_CRYPTO_EccPublicKey short_pkey;
 static struct GNUNET_CRYPTO_EccPrivateKey *alice_key;
 static struct GNUNET_CRYPTO_EccPrivateKey *bob_key;
 static struct GNUNET_CRYPTO_EccPrivateKey *our_key;
@@ -200,7 +200,7 @@ on_lookup_result (void *cls, uint32_t rd_count,
     for (i=0; i<rd_count; i++)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
-      if (rd[i].record_type == GNUNET_GNS_RECORD_A)
+      if (rd[i].record_type == GNUNET_DNSPARSER_TYPE_A)
       {
         memcpy(&a, rd[i].data, sizeof(a));
         addr = inet_ntoa(a);
@@ -234,9 +234,9 @@ on_lookup_result (void *cls, uint32_t rd_count,
 static void
 commence_testing (void *cls, int success)
 {
-  GNUNET_CRYPTO_ecc_key_free(our_key);
-  GNUNET_CRYPTO_ecc_key_free(bob_key);
-  GNUNET_CRYPTO_ecc_key_free(alice_key);
+  GNUNET_free(our_key);
+  GNUNET_free(bob_key);
+  GNUNET_free(alice_key);
   GNUNET_NAMESTORE_disconnect (namestore_handle);
   namestore_handle = NULL;
   gns_handle = GNUNET_GNS_connect(cfg);
@@ -247,7 +247,7 @@ commence_testing (void *cls, int success)
   }
   GNUNET_GNS_lookup_zone (gns_handle, TEST_DOMAIN,
                           &our_zone,
-                          GNUNET_GNS_RECORD_A,
+                          GNUNET_DNSPARSER_TYPE_A,
                           GNUNET_NO,
                           short_key,
                           &on_lookup_result, TEST_DOMAIN);
@@ -269,10 +269,10 @@ put_pseu_dht (void *cls, int success)
   struct GNUNET_NAMESTORE_RecordData rd;
   
   memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData));
-  rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value;
+  rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
   rd.data_size = strlen(TEST_PSEU_ALICE)+1;
   rd.data = TEST_PSEU_ALICE;
-  rd.record_type = GNUNET_GNS_RECORD_PSEU;
+  rd.record_type = GNUNET_NAMESTORE_TYPE_PSEU;
   rd.flags = 0;
 
   sig = GNUNET_NAMESTORE_create_signature(alice_key,
@@ -306,9 +306,9 @@ put_pseu_dht (void *cls, int success)
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n");
     ok = 3;
-    GNUNET_CRYPTO_ecc_key_free(our_key);
-    GNUNET_CRYPTO_ecc_key_free(bob_key);
-    GNUNET_CRYPTO_ecc_key_free(alice_key);
+    GNUNET_free(our_key);
+    GNUNET_free(bob_key);
+    GNUNET_free(alice_key);
     GNUNET_free(sig);
     GNUNET_free (nrb);
     end_badly_now ();
@@ -316,7 +316,7 @@ put_pseu_dht (void *cls, int success)
   }
   GNUNET_CRYPTO_short_hash(GNUNET_GNS_MASTERZONE_STR, strlen(GNUNET_GNS_MASTERZONE_STR), &name_hash);
   GNUNET_CRYPTO_short_hash(&alice_pkey,
-                     sizeof(struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
+                     sizeof(struct GNUNET_CRYPTO_EccPublicKey),
                      &zone_hash);
 
   GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
@@ -394,9 +394,9 @@ put_www_dht (void *cls, int success)
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n");
     ok = 3;
-    GNUNET_CRYPTO_ecc_key_free(our_key);
-    GNUNET_CRYPTO_ecc_key_free(bob_key);
-    GNUNET_CRYPTO_ecc_key_free(alice_key);
+    GNUNET_free(our_key);
+    GNUNET_free(bob_key);
+    GNUNET_free(alice_key);
     GNUNET_free (sig);
     GNUNET_free(web);
     GNUNET_free (nrb);
@@ -405,7 +405,7 @@ put_www_dht (void *cls, int success)
   }
   GNUNET_CRYPTO_short_hash(TEST_RECORD_NAME, strlen(TEST_RECORD_NAME), &name_hash);
   GNUNET_CRYPTO_short_hash(&alice_pkey,
-                     sizeof(struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
+                     sizeof(struct GNUNET_CRYPTO_EccPublicKey),
                      &zone_hash);
   GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double);
   GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
@@ -447,7 +447,7 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg)
   rd.expiration_time = UINT64_MAX;
   rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
   rd.data = &alice_hash;
-  rd.record_type = GNUNET_GNS_RECORD_PKEY;
+  rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
   rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
   
   sig = GNUNET_NAMESTORE_create_signature (bob_key,
@@ -475,9 +475,9 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg)
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n");
     ok = 3;
     
-    GNUNET_CRYPTO_ecc_key_free (our_key);
-    GNUNET_CRYPTO_ecc_key_free (bob_key);
-    GNUNET_CRYPTO_ecc_key_free (alice_key);
+    GNUNET_free (our_key);
+    GNUNET_free (bob_key);
+    GNUNET_free (alice_key);
     GNUNET_free (sig);
     GNUNET_free (nrb);
     end_badly_now ();
@@ -488,7 +488,7 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg)
   GNUNET_CRYPTO_short_hash (TEST_AUTHORITY_ALICE,
                            strlen (TEST_AUTHORITY_ALICE), &name_hash);
   GNUNET_CRYPTO_short_hash (&bob_pkey,
-                           sizeof(struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
+                           sizeof(struct GNUNET_CRYPTO_EccPublicKey),
                            &zone_hash);
   GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double);
   GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
@@ -518,7 +518,7 @@ fin_init_zone (void *cls, int32_t success, const char *emsg)
   rd.expiration_time = UINT64_MAX;
   rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
   rd.data = &bob_hash;
-  rd.record_type = GNUNET_GNS_RECORD_PKEY;
+  rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
   rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
   
   GNUNET_NAMESTORE_record_put_by_authority (namestore_handle,
@@ -539,7 +539,7 @@ cont_init_zone (void *cls, int32_t success, const char *emsg)
   rd.expiration_time = UINT64_MAX;
   rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
   rd.data = &short_zone;
-  rd.record_type = GNUNET_GNS_RECORD_PKEY;
+  rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
   rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
 
   GNUNET_NAMESTORE_record_put_by_authority (namestore_handle,
@@ -640,7 +640,7 @@ do_check (void *cls,
   rd.expiration_time = UINT64_MAX;
   rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
   rd.data = &priv_zone;
-  rd.record_type = GNUNET_GNS_RECORD_PKEY;
+  rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
   rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
 
   GNUNET_NAMESTORE_record_put_by_authority (namestore_handle,