2 This file is part of GNUnet.
3 (C) 2009 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file gns/test_gns_pseu_shorten.c
22 * @brief base testcase for testing on the fly pseu import and shorten
26 #include "gnunet_testing_lib.h"
27 #include "gnunet_core_service.h"
28 #include "block_gns.h"
29 #include "gnunet_signatures.h"
30 #include "gnunet_namestore_service.h"
31 #include "../namestore/namestore.h"
32 #include "gnunet_dnsparser_lib.h"
33 #include "gnunet_dht_service.h"
34 #include "gnunet_gns_service.h"
37 #define VERBOSE GNUNET_YES
39 /* Timeout for entire testcase */
40 #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
42 /* If number of peers not in config file, use this number */
43 #define DEFAULT_NUM_PEERS 2
45 /* test records to resolve */
46 #define TEST_DOMAIN "www.alicewonderland.bobbuilder.gnunet"
47 #define TEST_IP "127.0.0.1"
48 #define TEST_RECORD_NAME "www"
50 #define TEST_PRIVATE_ZONE "private"
51 #define TEST_SHORTEN_ZONE "short"
52 #define TEST_AUTHORITY_BOB "bobbuilder"
53 #define TEST_AUTHORITY_ALICE "alicewonderland"
54 #define TEST_PSEU_ALICE "carol"
55 #define TEST_EXPECTED_RESULT "www.carol.short.private.gnunet"
57 #define DHT_OPERATION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
59 #define KEYFILE_SHORTEN = "zonefiles/188JSUMKEF25GVU8TTV0PBNNN8JVCPUEDFV1UHJJU884JD25V0T0.zkey"
60 #define KEYFILE_PRIVATE = "zonefiles/OEFL7A4VEF1B40QLEMTG5D8G1CN6EN16QUSG5R2DT71GRJN34LSG.zkey"
61 #define KEYFILE_BOB "../namestore/zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"
62 #define KEYFILE_ALICE "../namestore/zonefiles/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"
67 * Directory to store temp data in, defined in config file
69 static char *test_directory;
71 static struct GNUNET_TESTING_PeerGroup *pg;
73 /* Task handle to use to schedule test failure */
74 static GNUNET_SCHEDULER_TaskIdentifier die_task;
76 static GNUNET_SCHEDULER_TaskIdentifier disco_task;
78 /* Global return value (0 for success, anything else for failure) */
81 static struct GNUNET_NAMESTORE_Handle *namestore_handle;
83 static struct GNUNET_GNS_Handle *gns_handle;
85 static struct GNUNET_DHT_Handle *dht_handle;
87 const struct GNUNET_CONFIGURATION_Handle *cfg;
89 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded alice_pkey;
90 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded bob_pkey;
91 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded our_pkey;
92 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded priv_pkey;
93 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded short_pkey;
94 struct GNUNET_CRYPTO_RsaPrivateKey *alice_key;
95 struct GNUNET_CRYPTO_RsaPrivateKey *bob_key;
96 struct GNUNET_CRYPTO_RsaPrivateKey *our_key;
97 struct GNUNET_CRYPTO_RsaPrivateKey *priv_key;
98 struct GNUNET_CRYPTO_RsaPrivateKey *short_key;
99 struct GNUNET_CRYPTO_ShortHashCode alice_hash;
100 struct GNUNET_CRYPTO_ShortHashCode bob_hash;
101 struct GNUNET_CRYPTO_ShortHashCode our_zone;
102 struct GNUNET_CRYPTO_ShortHashCode priv_zone;
103 struct GNUNET_CRYPTO_ShortHashCode short_zone;
106 * Check whether peers successfully shut down.
109 shutdown_callback (void *cls, const char *emsg)
111 if (disco_task != GNUNET_SCHEDULER_NO_TASK)
113 disco_task = GNUNET_SCHEDULER_NO_TASK;
114 GNUNET_SCHEDULER_cancel(disco_task);
115 GNUNET_DHT_disconnect(dht_handle);
121 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error on shutdown! ret=%d\n", ok);
126 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "done(ret=%d)!\n", ok);
130 disco_dht(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
132 disco_task = GNUNET_SCHEDULER_NO_TASK;
133 GNUNET_DHT_disconnect(dht_handle);
138 * Called when gns shorten finishes
141 process_shorten_result(void* cls, const char* sname)
143 GNUNET_GNS_disconnect(gns_handle);
144 //GNUNET_SCHEDULER_add_now(disco_dht, NULL);
149 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
150 "shorten test failed!\n");
155 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
156 "%s shortened to %s\n", (char*)cls, sname);
157 if (0 != strcmp(sname, TEST_EXPECTED_RESULT))
159 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
160 "shorten test failed! (wanted: %s got: %s\n",
161 TEST_EXPECTED_RESULT, sname);
165 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shorten test succeeded!\n");
168 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer1!\n");
169 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
173 do_shorten(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
175 GNUNET_GNS_shorten_zone (gns_handle, TEST_DOMAIN,
179 &process_shorten_result,
184 on_lookup_result(void *cls, uint32_t rd_count,
185 const struct GNUNET_NAMESTORE_RecordData *rd)
193 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
194 "Lookup failed, rp_filtering?\n");
200 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "name: %s\n", (char*)cls);
201 for (i=0; i<rd_count; i++)
203 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
204 if (rd[i].record_type == GNUNET_GNS_RECORD_A)
206 memcpy(&a, rd[i].data, sizeof(a));
208 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "address: %s\n", addr);
209 if (0 == strcmp(addr, TEST_IP))
211 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
212 "%s correctly resolved to %s!\n", TEST_DOMAIN, addr);
218 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No resolution!\n");
223 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &do_shorten, NULL);
228 * Function scheduled to be run on the successful start of services
229 * tries to look up the dns record for TEST_DOMAIN
232 commence_testing (void *cls, int success)
234 GNUNET_SCHEDULER_add_now(disco_dht, NULL);
235 //GNUNET_DHT_disconnect(dht_handle);
237 GNUNET_CRYPTO_rsa_key_free(our_key);
238 GNUNET_CRYPTO_rsa_key_free(bob_key);
239 GNUNET_CRYPTO_rsa_key_free(alice_key);
241 GNUNET_NAMESTORE_disconnect (namestore_handle);
242 gns_handle = GNUNET_GNS_connect(cfg);
244 if (NULL == gns_handle)
246 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
247 "Failed to connect to GNS!\n");
250 GNUNET_GNS_lookup_zone (gns_handle, TEST_DOMAIN,
255 &on_lookup_result, TEST_DOMAIN);
259 * Continuation for the GNUNET_DHT_get_stop call, so that we don't shut
260 * down the peers without freeing memory associated with GET request.
263 end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
265 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failing test with error: `%s'!\n",
269 if (disco_task != GNUNET_SCHEDULER_NO_TASK)
271 disco_task = GNUNET_SCHEDULER_NO_TASK;
272 GNUNET_SCHEDULER_cancel(disco_task);
273 GNUNET_DHT_disconnect(dht_handle);
277 GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
278 GNUNET_SCHEDULER_cancel (die_task);
282 put_pseu_dht(void *cls, int success)
284 struct GNSNameRecordBlock *nrb;
285 struct GNUNET_CRYPTO_ShortHashCode name_hash;
286 struct GNUNET_CRYPTO_ShortHashCode zone_hash;
287 struct GNUNET_HashCode xor_hash;
288 struct GNUNET_HashCode name_hash_double;
289 struct GNUNET_HashCode zone_hash_double;
290 uint32_t rd_payload_length;
291 char* nrb_data = NULL;
292 struct GNUNET_CRYPTO_RsaSignature *sig;
293 struct GNUNET_NAMESTORE_RecordData rd;
295 memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData));
296 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value;
297 rd.data_size = strlen(TEST_PSEU_ALICE)+1;
298 rd.data = TEST_PSEU_ALICE;
299 rd.record_type = GNUNET_GNS_RECORD_PSEU;
302 sig = GNUNET_NAMESTORE_create_signature(alice_key,
303 GNUNET_TIME_UNIT_FOREVER_ABS,
307 GNUNET_assert (NULL != sig);
309 GNUNET_break (GNUNET_OK == GNUNET_NAMESTORE_verify_signature (&alice_pkey,
310 GNUNET_TIME_UNIT_FOREVER_ABS,
315 rd_payload_length = GNUNET_NAMESTORE_records_get_size (1, &rd);
316 nrb = GNUNET_malloc(rd_payload_length + strlen("+") + 1
317 + sizeof(struct GNSNameRecordBlock));
318 nrb->signature = *sig;
319 nrb->public_key = alice_pkey;
320 nrb->rd_count = htonl(1);
321 memset(&nrb[1], 0, strlen("+") + 1);
322 strcpy((char*)&nrb[1], "+");
323 nrb_data = (char*)&nrb[1];
324 nrb_data += strlen("+") + 1;
326 if (-1 == GNUNET_NAMESTORE_records_serialize (1,
331 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n");
333 GNUNET_DHT_disconnect(dht_handle);
336 GNUNET_CRYPTO_rsa_key_free(our_key);
337 GNUNET_CRYPTO_rsa_key_free(bob_key);
338 GNUNET_CRYPTO_rsa_key_free(alice_key);
343 GNUNET_CRYPTO_short_hash("+", strlen("+"), &name_hash);
344 GNUNET_CRYPTO_short_hash(&alice_pkey,
345 sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
348 GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
349 GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double);
350 GNUNET_CRYPTO_hash_xor(&zone_hash_double, &name_hash_double, &xor_hash);
352 rd_payload_length += sizeof(struct GNSNameRecordBlock) +
355 GNUNET_DHT_put (dht_handle, &xor_hash,
358 GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
361 GNUNET_TIME_UNIT_FOREVER_ABS,
362 DHT_OPERATION_TIMEOUT,
371 put_www_dht(void *cls, int success)
373 struct GNSNameRecordBlock *nrb;
374 struct GNUNET_CRYPTO_ShortHashCode name_hash;
375 struct GNUNET_CRYPTO_ShortHashCode zone_hash;
376 struct GNUNET_HashCode xor_hash;
377 struct GNUNET_HashCode name_hash_double;
378 struct GNUNET_HashCode zone_hash_double;
379 uint32_t rd_payload_length;
380 char* nrb_data = NULL;
381 struct GNUNET_CRYPTO_RsaSignature *sig;
382 struct GNUNET_NAMESTORE_RecordData rd;
384 struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
386 rd.expiration_time = UINT64_MAX;
387 GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
388 rd.data_size = sizeof(struct in_addr);
390 rd.record_type = GNUNET_DNSPARSER_TYPE_A;
391 rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
393 sig = GNUNET_NAMESTORE_create_signature(alice_key,
394 GNUNET_TIME_UNIT_FOREVER_ABS,
398 GNUNET_break (GNUNET_OK == GNUNET_NAMESTORE_verify_signature (&alice_pkey,
399 GNUNET_TIME_UNIT_FOREVER_ABS,
404 rd_payload_length = GNUNET_NAMESTORE_records_get_size (1, &rd);
405 nrb = GNUNET_malloc(rd_payload_length + strlen(TEST_RECORD_NAME) + 1
406 + sizeof(struct GNSNameRecordBlock));
407 nrb->signature = *sig;
408 nrb->public_key = alice_pkey;
409 nrb->rd_count = htonl(1);
410 memset(&nrb[1], 0, strlen(TEST_RECORD_NAME) + 1);
411 strcpy((char*)&nrb[1], TEST_RECORD_NAME);
412 nrb_data = (char*)&nrb[1];
413 nrb_data += strlen(TEST_RECORD_NAME) + 1;
415 if (-1 == GNUNET_NAMESTORE_records_serialize (1,
420 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n");
422 GNUNET_DHT_disconnect(dht_handle);
424 GNUNET_CRYPTO_rsa_key_free(our_key);
425 GNUNET_CRYPTO_rsa_key_free(bob_key);
426 GNUNET_CRYPTO_rsa_key_free(alice_key);
431 GNUNET_CRYPTO_short_hash(TEST_RECORD_NAME, strlen(TEST_RECORD_NAME), &name_hash);
432 GNUNET_CRYPTO_short_hash(&alice_pkey,
433 sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
435 GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double);
436 GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
437 GNUNET_CRYPTO_hash_xor(&zone_hash_double, &name_hash_double, &xor_hash);
439 rd_payload_length += sizeof(struct GNSNameRecordBlock) +
440 strlen(TEST_RECORD_NAME) + 1;
442 GNUNET_DHT_put (dht_handle, &xor_hash,
445 GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
448 GNUNET_TIME_UNIT_FOREVER_ABS,
449 DHT_OPERATION_TIMEOUT,
459 put_pkey_dht(void *cls, int32_t success, const char *emsg)
461 struct GNSNameRecordBlock *nrb;
462 struct GNUNET_CRYPTO_ShortHashCode name_hash;
463 struct GNUNET_CRYPTO_ShortHashCode zone_hash;
464 struct GNUNET_HashCode xor_hash;
465 struct GNUNET_HashCode name_hash_double;
466 struct GNUNET_HashCode zone_hash_double;
467 uint32_t rd_payload_length;
468 char* nrb_data = NULL;
469 struct GNUNET_CRYPTO_RsaSignature *sig;
470 struct GNUNET_NAMESTORE_RecordData rd;
472 rd.expiration_time = UINT64_MAX;
473 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
474 rd.data = &alice_hash;
475 rd.record_type = GNUNET_GNS_RECORD_PKEY;
476 rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
478 sig = GNUNET_NAMESTORE_create_signature(bob_key,
479 GNUNET_TIME_UNIT_FOREVER_ABS,
480 TEST_AUTHORITY_ALICE,
484 rd_payload_length = GNUNET_NAMESTORE_records_get_size (1, &rd);
485 nrb = GNUNET_malloc(rd_payload_length + strlen(TEST_AUTHORITY_ALICE) + 1
486 + sizeof(struct GNSNameRecordBlock));
487 nrb->signature = *sig;
488 nrb->public_key = bob_pkey;
489 nrb->rd_count = htonl(1);
490 memset(&nrb[1], 0, strlen(TEST_AUTHORITY_ALICE) + 1);
491 strcpy((char*)&nrb[1], TEST_AUTHORITY_ALICE);
492 nrb_data = (char*)&nrb[1];
493 nrb_data += strlen(TEST_AUTHORITY_ALICE) + 1;
495 if (-1 == GNUNET_NAMESTORE_records_serialize (1,
500 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n");
503 GNUNET_CRYPTO_rsa_key_free(our_key);
504 GNUNET_CRYPTO_rsa_key_free(bob_key);
505 GNUNET_CRYPTO_rsa_key_free(alice_key);
512 GNUNET_CRYPTO_short_hash(TEST_AUTHORITY_ALICE,
513 strlen(TEST_AUTHORITY_ALICE), &name_hash);
514 GNUNET_CRYPTO_short_hash(&bob_pkey,
515 sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
517 GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double);
518 GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
519 GNUNET_CRYPTO_hash_xor(&zone_hash_double, &name_hash_double, &xor_hash);
521 rd_payload_length += sizeof(struct GNSNameRecordBlock) +
522 strlen(TEST_AUTHORITY_ALICE) + 1;
523 GNUNET_DHT_put (dht_handle, &xor_hash,
526 GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
529 GNUNET_TIME_UNIT_FOREVER_ABS,
530 DHT_OPERATION_TIMEOUT,
537 fin_init_zone (void *cls, int32_t success, const char *emsg)
539 struct GNUNET_NAMESTORE_RecordData rd;
540 rd.expiration_time = UINT64_MAX;
541 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
543 rd.record_type = GNUNET_GNS_RECORD_PKEY;
544 rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
546 GNUNET_NAMESTORE_record_create (namestore_handle,
556 cont_init_zone (void *cls, int32_t success, const char *emsg)
559 struct GNUNET_NAMESTORE_RecordData rd;
560 rd.expiration_time = UINT64_MAX;
561 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
562 rd.data = &short_zone;
563 rd.record_type = GNUNET_GNS_RECORD_PKEY;
564 rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
566 GNUNET_NAMESTORE_record_create (namestore_handle,
575 do_lookup (void *cls, const struct GNUNET_PeerIdentity *id,
576 const struct GNUNET_CONFIGURATION_Handle *_cfg,
577 struct GNUNET_TESTING_Daemon *d, const char *emsg)
580 char* private_keyfile;
581 char* shorten_keyfile;
586 GNUNET_SCHEDULER_cancel (die_task);
588 /* put records into namestore */
589 namestore_handle = GNUNET_NAMESTORE_connect(cfg);
590 if (NULL == namestore_handle)
592 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to connect to namestore\n");
598 dht_handle = GNUNET_DHT_connect(cfg, 1);
599 if (NULL == dht_handle)
601 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to connect to dht\n");
606 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
610 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to get key from cfg\n");
615 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
619 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
620 "Failed to get shorten zone key from cfg\n");
625 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
629 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
630 "Failed to get private zone key from cfg\n");
634 our_key = GNUNET_CRYPTO_rsa_key_create_from_file (our_keyfile);
635 priv_key = GNUNET_CRYPTO_rsa_key_create_from_file (private_keyfile);
636 short_key = GNUNET_CRYPTO_rsa_key_create_from_file (shorten_keyfile);
637 bob_key = GNUNET_CRYPTO_rsa_key_create_from_file (KEYFILE_BOB);
638 alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (KEYFILE_ALICE);
640 GNUNET_free(our_keyfile);
641 GNUNET_free(shorten_keyfile);
642 GNUNET_free(private_keyfile);
644 GNUNET_CRYPTO_rsa_key_get_public (our_key, &our_pkey);
645 GNUNET_CRYPTO_rsa_key_get_public (priv_key, &priv_pkey);
646 GNUNET_CRYPTO_rsa_key_get_public (short_key, &short_pkey);
647 GNUNET_CRYPTO_rsa_key_get_public (bob_key, &bob_pkey);
648 GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey);
649 GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
650 GNUNET_CRYPTO_short_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash);
651 GNUNET_CRYPTO_short_hash(&our_pkey, sizeof(our_pkey), &our_zone);
652 GNUNET_CRYPTO_short_hash(&priv_pkey, sizeof(priv_pkey), &priv_zone);
653 GNUNET_CRYPTO_short_hash(&short_pkey, sizeof(short_pkey), &short_zone);
655 struct GNUNET_NAMESTORE_RecordData rd;
656 rd.expiration_time = UINT64_MAX;
657 rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
658 rd.data = &priv_zone;
659 rd.record_type = GNUNET_GNS_RECORD_PKEY;
660 rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
662 GNUNET_NAMESTORE_record_create (namestore_handle,
675 run (void *cls, char *const *args, const char *cfgfile,
676 const struct GNUNET_CONFIGURATION_Handle *c)
679 /* Get path from configuration file */
681 GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
689 /* Set up a task to end testing if peer start fails */
691 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
692 "didn't start all daemons in reasonable amount of time!!!");
695 //d1 = GNUNET_TESTING_daemon_start(cfg, TIMEOUT, GNUNET_NO, NULL, NULL, 0,
696 // NULL, NULL, NULL, &do_lookup, NULL);
697 pg = GNUNET_TESTING_daemons_start(cfg, 1, 1, 1, TIMEOUT,
698 NULL, NULL, &do_lookup, NULL,
707 /* Arguments for GNUNET_PROGRAM_run */
708 char *const argv[] = { "test-gns-pseu-shorten", /* Name to give running binary */
710 "test_gns_simple_lookup.conf", /* Config file to use */
716 struct GNUNET_GETOPT_CommandLineOption options[] = {
717 GNUNET_GETOPT_OPTION_END
719 /* Run the run function as a new program */
721 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
722 "test-gns-pseu-shorten", "nohelp", options, &run,
724 if (ret != GNUNET_OK)
726 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
727 "`test-gns-pseu-shorten': Failed with error code %d\n", ret);
733 main (int argc, char *argv[])
737 GNUNET_log_setup ("test-gns-pseu-shorten",
746 * Need to remove base directory, subdirectories taken care
747 * of by the testing framework.
752 /* end of test_gns_twopeer.c */