paragraph for gnunet devs that don't know how to use the web
[oweals/gnunet.git] / src / dht / dht_test_lib.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2012 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your option) any later version.
9
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      Affero General Public License for more details.
14     
15      You should have received a copy of the GNU Affero General Public License
16      along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 /**
19  * @file dht/dht_test_lib.h
20  * @author Christian Grothoff
21  * @brief library for writing DHT tests
22  */
23 #ifndef DHT_TEST_LIB_H
24 #define DHT_TEST_LIB_H
25
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #if 0                           /* keep Emacsens' auto-indent happy */
30 }
31 #endif
32 #endif
33
34 #include "gnunet_testbed_service.h"
35 #include "gnunet_dht_service.h"
36
37 /**
38  * Test context for a DHT Test.
39  */
40 struct GNUNET_DHT_TEST_Context;
41
42
43 /**
44  * Main function of a DHT test.
45  *
46  * @param cls closure
47  * @param ctx argument to give to GNUNET_DHT_TEST_cleanup on test end
48  * @param num_peers number of peers that are running
49  * @param peers array of peers
50  * @param dhts handle to each of the DHTs of the peers
51  */
52 typedef void (*GNUNET_DHT_TEST_AppMain) (void *cls,
53                                          struct GNUNET_DHT_TEST_Context *ctx,
54                                          unsigned int num_peers,
55                                          struct GNUNET_TESTBED_Peer **peers,
56                                          struct GNUNET_DHT_Handle **dhts);
57
58
59 /**
60  * Run a test using the given name, configuration file and number of
61  * peers.
62  *
63  * @param testname name of the test (for logging)
64  * @param cfgname name of the configuration file
65  * @param num_peers number of peers to start
66  * @param tmain main function to run once the testbed is ready
67  * @param tmain_cls closure for 'tmain'
68  */
69 void
70 GNUNET_DHT_TEST_run (const char *testname,
71                      const char *cfgname,
72                      unsigned int num_peers,
73                      GNUNET_DHT_TEST_AppMain tmain,
74                      void *tmain_cls);
75
76
77 /**
78  * Clean up the testbed.
79  *
80  * @param ctx handle for the testbed
81  */
82 void
83 GNUNET_DHT_TEST_cleanup (struct GNUNET_DHT_TEST_Context *ctx);
84
85 #if 0                           /* keep Emacsens' auto-indent happy */
86 {
87 #endif
88 #ifdef __cplusplus
89 }
90 #endif
91
92 /* ifndef DHT_TEST_LIB_H */
93 #endif