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 cadet/cadet_test_lib.h
22 * @author Bartlomiej Polot
23 * @brief library for writing CADET tests
25 #ifndef CADET_TEST_LIB_H
26 #define CADET_TEST_LIB_H
31 #if 0 /* keep Emacsens' auto-indent happy */
36 #include "gnunet_testbed_service.h"
37 #include "gnunet_cadet_service.h"
40 * Test context for a CADET Test.
42 struct GNUNET_CADET_TEST_Context;
46 * Main function of a CADET test.
49 * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
50 * @param num_peers Number of peers that are running.
51 * @param peers Array of peers.
52 * @param cadetes Handle to each of the CADETs of the peers.
54 typedef void (*GNUNET_CADET_TEST_AppMain) (void *cls,
55 struct GNUNET_CADET_TEST_Context *ctx,
56 unsigned int num_peers,
57 struct GNUNET_TESTBED_Peer **peers,
58 struct GNUNET_CADET_Handle **cadetes);
62 * Run a test using the given name, configuration file and number of
64 * All cadet callbacks will receive the peer number as the closure.
66 * @param testname Name of the test (for logging).
67 * @param cfgname Name of the configuration file.
68 * @param num_peers Number of peers to start.
69 * @param tmain Main function to run once the testbed is ready.
70 * @param tmain_cls Closure for 'tmain'.
71 * @param new_channel Handler for incoming tunnels.
72 * @param cleaner Cleaner for destroyed incoming tunnels.
73 * @param handlers Message handlers.
74 * @param ports Ports the peers offer.
77 GNUNET_CADET_TEST_run (const char *testname,
79 unsigned int num_peers,
80 GNUNET_CADET_TEST_AppMain tmain,
82 GNUNET_CADET_InboundChannelNotificationHandler new_channel,
83 GNUNET_CADET_ChannelEndHandler cleaner,
84 struct GNUNET_CADET_MessageHandler* handlers,
85 const uint32_t* ports);
89 * Clean up the testbed.
91 * @param ctx handle for the testbed
94 GNUNET_CADET_TEST_cleanup (struct GNUNET_CADET_TEST_Context *ctx);
97 #if 0 /* keep Emacsens' auto-indent happy */
105 /* ifndef CADET_TEST_LIB_H */