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