diff options
Diffstat (limited to 'src/gns/test_gns_pseu_shorten.c')
-rw-r--r-- | src/gns/test_gns_pseu_shorten.c | 56 |
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 | ||
76 | static struct GNUNET_DHT_Handle *dht_handle; | 70 | static struct GNUNET_DHT_Handle *dht_handle; |
77 | 71 | ||
78 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 72 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
79 | 73 | ||
80 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded alice_pkey; | 74 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded alice_pkey; |
81 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded bob_pkey; | 75 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded bob_pkey; |
82 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded our_pkey; | 76 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded our_pkey; |
83 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded priv_pkey; | 77 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded priv_pkey; |
84 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded short_pkey; | 78 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded short_pkey; |
85 | struct GNUNET_CRYPTO_RsaPrivateKey *alice_key; | 79 | static struct GNUNET_CRYPTO_RsaPrivateKey *alice_key; |
86 | struct GNUNET_CRYPTO_RsaPrivateKey *bob_key; | 80 | static struct GNUNET_CRYPTO_RsaPrivateKey *bob_key; |
87 | struct GNUNET_CRYPTO_RsaPrivateKey *our_key; | 81 | static struct GNUNET_CRYPTO_RsaPrivateKey *our_key; |
88 | struct GNUNET_CRYPTO_RsaPrivateKey *priv_key; | 82 | static struct GNUNET_CRYPTO_RsaPrivateKey *priv_key; |
89 | struct GNUNET_CRYPTO_RsaPrivateKey *short_key; | 83 | static struct GNUNET_CRYPTO_RsaPrivateKey *short_key; |
90 | struct GNUNET_CRYPTO_ShortHashCode alice_hash; | 84 | static struct GNUNET_CRYPTO_ShortHashCode alice_hash; |
91 | struct GNUNET_CRYPTO_ShortHashCode bob_hash; | 85 | static struct GNUNET_CRYPTO_ShortHashCode bob_hash; |
92 | struct GNUNET_CRYPTO_ShortHashCode our_zone; | 86 | static struct GNUNET_CRYPTO_ShortHashCode our_zone; |
93 | struct GNUNET_CRYPTO_ShortHashCode priv_zone; | 87 | static struct GNUNET_CRYPTO_ShortHashCode priv_zone; |
94 | struct GNUNET_CRYPTO_ShortHashCode short_zone; | 88 | static 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 | |||
129 | static void | 124 | static void |
130 | end_badly_now () | 125 | end_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 | ||
136 | static void shutdown_task (void *cls, | 131 | |
137 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 132 | static void |
133 | shutdown_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 | |||
349 | static void | 347 | static void |
350 | put_www_dht(void *cls, int success) | 348 | put_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 | |||
517 | static void | 516 | static void |
518 | fin_init_zone (void *cls, int32_t success, const char *emsg) | 517 | fin_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 | |||
555 | static void | 555 | static void |
556 | do_check (void *cls, | 556 | do_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 | |||
649 | int | 650 | int |
650 | main (int argc, char *argv[]) | 651 | main (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; |