2 This file is part of GNUnet.
3 (C) 2012 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 dht/dht_test_lib.h
22 * @author Christian Grothoff
23 * @brief library for writing DHT tests
25 #ifndef DHT_TEST_LIB_H
26 #define DHT_TEST_LIB_H
28 #include "gnunet_testbed_service.h"
29 #include "gnunet_dht_service.h"
32 * Test context for a DHT Test.
34 struct GNUNET_DHT_TEST_Context;
38 * Main function of a DHT test.
41 * @param ctx argument to give to GNUNET_DHT_TEST_cleanup on test end
42 * @param num_peers number of peers that are running
43 * @param peers array of peers
44 * @param dhts handle to each of the DHTs of the peers
46 typedef void (*GNUNET_DHT_TEST_AppMain) (void *cls,
47 struct GNUNET_DHT_TEST_Context *ctx,
48 unsigned int num_peers,
49 struct GNUNET_TESTBED_Peer **peers,
50 struct GNUNET_DHT_Handle **dhts);
54 * Run a test using the given name, configuration file and number of
57 * @param testname name of the test (for logging)
58 * @param cfgname name of the configuration file
59 * @param num_peers number of peers to start
60 * @param tmain main function to run once the testbed is ready
61 * @param tmain_cls closure for 'tmain'
64 GNUNET_DHT_TEST_run (const char *testname,
66 unsigned int num_peers,
67 GNUNET_DHT_TEST_AppMain tmain,
72 * Clean up the testbed.
74 * @param ctx handle for the testbed
77 GNUNET_DHT_TEST_cleanup (struct GNUNET_DHT_TEST_Context *ctx);