aboutsummaryrefslogtreecommitdiff
path: root/src/gns/test_gns_pseu_shorten.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/test_gns_pseu_shorten.c')
-rw-r--r--src/gns/test_gns_pseu_shorten.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/src/gns/test_gns_pseu_shorten.c b/src/gns/test_gns_pseu_shorten.c
index 8f279bb55..74f41398d 100644
--- a/src/gns/test_gns_pseu_shorten.c
+++ b/src/gns/test_gns_pseu_shorten.c
@@ -33,15 +33,9 @@
33#include "gnunet_dht_service.h" 33#include "gnunet_dht_service.h"
34#include "gnunet_gns_service.h" 34#include "gnunet_gns_service.h"
35 35
36/* DEFINES */
37#define VERBOSE GNUNET_YES
38
39/* Timeout for entire testcase */ 36/* Timeout for entire testcase */
40#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30) 37#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
41 38
42/* If number of peers not in config file, use this number */
43#define DEFAULT_NUM_PEERS 2
44
45/* test records to resolve */ 39/* test records to resolve */
46#define TEST_DOMAIN "www.alicewonderland.bobbuilder.gads" 40#define TEST_DOMAIN "www.alicewonderland.bobbuilder.gads"
47#define TEST_IP "127.0.0.1" 41#define TEST_IP "127.0.0.1"
@@ -75,23 +69,23 @@ static struct GNUNET_GNS_Handle *gns_handle;
75 69
76static struct GNUNET_DHT_Handle *dht_handle; 70static struct GNUNET_DHT_Handle *dht_handle;
77 71
78const struct GNUNET_CONFIGURATION_Handle *cfg; 72static const struct GNUNET_CONFIGURATION_Handle *cfg;
79 73
80struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded alice_pkey; 74static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded alice_pkey;
81struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded bob_pkey; 75static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded bob_pkey;
82struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded our_pkey; 76static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded our_pkey;
83struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded priv_pkey; 77static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded priv_pkey;
84struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded short_pkey; 78static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded short_pkey;
85struct GNUNET_CRYPTO_RsaPrivateKey *alice_key; 79static struct GNUNET_CRYPTO_RsaPrivateKey *alice_key;
86struct GNUNET_CRYPTO_RsaPrivateKey *bob_key; 80static struct GNUNET_CRYPTO_RsaPrivateKey *bob_key;
87struct GNUNET_CRYPTO_RsaPrivateKey *our_key; 81static struct GNUNET_CRYPTO_RsaPrivateKey *our_key;
88struct GNUNET_CRYPTO_RsaPrivateKey *priv_key; 82static struct GNUNET_CRYPTO_RsaPrivateKey *priv_key;
89struct GNUNET_CRYPTO_RsaPrivateKey *short_key; 83static struct GNUNET_CRYPTO_RsaPrivateKey *short_key;
90struct GNUNET_CRYPTO_ShortHashCode alice_hash; 84static struct GNUNET_CRYPTO_ShortHashCode alice_hash;
91struct GNUNET_CRYPTO_ShortHashCode bob_hash; 85static struct GNUNET_CRYPTO_ShortHashCode bob_hash;
92struct GNUNET_CRYPTO_ShortHashCode our_zone; 86static struct GNUNET_CRYPTO_ShortHashCode our_zone;
93struct GNUNET_CRYPTO_ShortHashCode priv_zone; 87static struct GNUNET_CRYPTO_ShortHashCode priv_zone;
94struct GNUNET_CRYPTO_ShortHashCode short_zone; 88static struct GNUNET_CRYPTO_ShortHashCode short_zone;
95 89
96 90
97/** 91/**
@@ -126,6 +120,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
126 ok = 1; 120 ok = 1;
127} 121}
128 122
123
129static void 124static void
130end_badly_now () 125end_badly_now ()
131{ 126{
@@ -133,8 +128,10 @@ end_badly_now ()
133 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); 128 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
134} 129}
135 130
136static void shutdown_task (void *cls, 131
137 const struct GNUNET_SCHEDULER_TaskContext *tc) 132static void
133shutdown_task (void *cls,
134 const struct GNUNET_SCHEDULER_TaskContext *tc)
138{ 135{
139 GNUNET_GNS_disconnect(gns_handle); 136 GNUNET_GNS_disconnect(gns_handle);
140 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer!\n"); 137 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer!\n");
@@ -346,6 +343,7 @@ put_pseu_dht (void *cls, int success)
346 GNUNET_free (nrb); 343 GNUNET_free (nrb);
347} 344}
348 345
346
349static void 347static void
350put_www_dht(void *cls, int success) 348put_www_dht(void *cls, int success)
351{ 349{
@@ -514,6 +512,7 @@ put_pkey_dht(void *cls, int32_t success, const char *emsg)
514 GNUNET_free (nrb); 512 GNUNET_free (nrb);
515} 513}
516 514
515
517static void 516static void
518fin_init_zone (void *cls, int32_t success, const char *emsg) 517fin_init_zone (void *cls, int32_t success, const char *emsg)
519{ 518{
@@ -552,6 +551,7 @@ cont_init_zone (void *cls, int32_t success, const char *emsg)
552 NULL); 551 NULL);
553} 552}
554 553
554
555static void 555static void
556do_check (void *cls, 556do_check (void *cls,
557 const struct GNUNET_CONFIGURATION_Handle *ccfg, 557 const struct GNUNET_CONFIGURATION_Handle *ccfg,
@@ -646,17 +646,13 @@ do_check (void *cls,
646 NULL); 646 NULL);
647} 647}
648 648
649
649int 650int
650main (int argc, char *argv[]) 651main (int argc, char *argv[])
651{ 652{
652 ok = 1; 653 ok = 1;
653
654 GNUNET_log_setup ("test-gns-pseu-shorten", 654 GNUNET_log_setup ("test-gns-pseu-shorten",
655#if VERBOSE
656 "DEBUG",
657#else
658 "WARNING", 655 "WARNING",
659#endif
660 NULL); 656 NULL);
661 GNUNET_TESTING_peer_run ("test-gns-pseu-shorten", "test_gns_simple_lookup.conf", &do_check, NULL); 657 GNUNET_TESTING_peer_run ("test-gns-pseu-shorten", "test_gns_simple_lookup.conf", &do_check, NULL);
662 return ok; 658 return ok;