-remove trailing whitespace
[oweals/gnunet.git] / src / dht / dht_test_lib.h
1 /*
2      This file is part of GNUnet.
3      (C) 2012 Christian Grothoff (and other contributing authors)
4
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.
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      General Public License for more details.
14
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.
19 */
20 /**
21  * @file dht/dht_test_lib.h
22  * @author Christian Grothoff
23  * @brief library for writing DHT tests
24  */
25 #ifndef DHT_TEST_LIB_H
26 #define DHT_TEST_LIB_H
27
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #if 0                           /* keep Emacsens' auto-indent happy */
32 }
33 #endif
34 #endif
35
36 #include "gnunet_testbed_service.h"
37 #include "gnunet_dht_service.h"
38
39 /**
40  * Test context for a DHT Test.
41  */
42 struct GNUNET_DHT_TEST_Context;
43
44
45 /**
46  * Main function of a DHT test.
47  *
48  * @param cls closure
49  * @param ctx argument to give to GNUNET_DHT_TEST_cleanup on test end
50  * @param num_peers number of peers that are running
51  * @param peers array of peers
52  * @param dhts handle to each of the DHTs of the peers
53  */
54 typedef void (*GNUNET_DHT_TEST_AppMain) (void *cls,
55                                          struct GNUNET_DHT_TEST_Context *ctx,
56                                          unsigned int num_peers,
57                                          struct GNUNET_TESTBED_Peer **peers,
58                                          struct GNUNET_DHT_Handle **dhts);
59
60
61 /**
62  * Run a test using the given name, configuration file and number of
63  * peers.
64  *
65  * @param testname name of the test (for logging)
66  * @param cfgname name of the configuration file
67  * @param num_peers number of peers to start
68  * @param tmain main function to run once the testbed is ready
69  * @param tmain_cls closure for 'tmain'
70  */
71 void
72 GNUNET_DHT_TEST_run (const char *testname,
73                      const char *cfgname,
74                      unsigned int num_peers,
75                      GNUNET_DHT_TEST_AppMain tmain,
76                      void *tmain_cls);
77
78
79 /**
80  * Clean up the testbed.
81  *
82  * @param ctx handle for the testbed
83  */
84 void
85 GNUNET_DHT_TEST_cleanup (struct GNUNET_DHT_TEST_Context *ctx);
86
87 #if 0                           /* keep Emacsens' auto-indent happy */
88 {
89 #endif
90 #ifdef __cplusplus
91 }
92 #endif
93
94 /* ifndef DHT_TEST_LIB_H */
95 #endif