GNUnet  0.20.0
cadet_test_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2012,2017 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  SPDX-License-Identifier: AGPL3.0-or-later
19  */
25 #ifndef CADET_TEST_LIB_H
26 #define CADET_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_cadet_service.h"
38 
43 
44 
54 typedef void (*GNUNET_CADET_TEST_AppMain) (void *cls,
56  unsigned int num_peers,
57  struct GNUNET_TESTBED_Peer **peers,
58  struct GNUNET_CADET_Handle **cadets);
59 
60 
76 void
77 GNUNET_CADET_TEST_ruN (const char *testname,
78  const char *cfgfile,
79  unsigned int num_peers,
81  void *tmain_cls,
86  const struct GNUNET_HashCode **ports);
87 
93 void
95 
96 
97 #if 0 /* keep Emacsens' auto-indent happy */
98 {
99 #endif
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 
105 /* ifndef CADET_TEST_LIB_H */
106 #endif
void * connects(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Definition: 010.c:2
void disconnects(void *cls, const struct GNUNET_PeerIdentity *peer)
Definition: 011.c:2
void GNUNET_CADET_TEST_ruN(const char *testname, const char *cfgfile, unsigned int num_peers, GNUNET_CADET_TEST_AppMain tmain, void *tmain_cls, GNUNET_CADET_ConnectEventHandler connects, GNUNET_CADET_WindowSizeEventHandler window_changes, GNUNET_CADET_DisconnectEventHandler disconnects, struct GNUNET_MQ_MessageHandler *handlers, const struct GNUNET_HashCode **ports)
Run a test using the given name, configuration file and number of peers.
void(* GNUNET_CADET_TEST_AppMain)(void *cls, struct GNUNET_CADET_TEST_Context *ctx, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, struct GNUNET_CADET_Handle **cadets)
Main function of a CADET test.
void GNUNET_CADET_TEST_cleanup(struct GNUNET_CADET_TEST_Context *ctx)
Clean up the testbed.
static void tmain(void *cls, struct GNUNET_CADET_TEST_Context *ctx, unsigned int num_peers, struct GNUNET_TESTBED_Peer **testbed_peers, struct GNUNET_CADET_Handle **cadetes)
test main: start test when all peers are connected
static struct CadetPeer * peers
Operation to get peer ids.
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static unsigned int num_peers
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
CADET service; establish channels to distant peers.
API for writing tests and creating large-scale emulation testbeds for GNUnet.
void(* GNUNET_CADET_DisconnectEventHandler)(void *cls, const struct GNUNET_CADET_Channel *channel)
Function called whenever an MQ-channel is destroyed, unless the destruction was requested by GNUNET_C...
void(* GNUNET_CADET_WindowSizeEventHandler)(void *cls, const struct GNUNET_CADET_Channel *channel, int window_size)
Function called whenever an MQ-channel's transmission window size changes.
void *(* GNUNET_CADET_ConnectEventHandler)(void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *source)
Method called whenever a peer connects to a port in MQ-based CADET.
Opaque handle to the service.
Definition: cadet_api.c:39
struct GNUNET_CONTAINER_MultiHashMap * ports
Ports open.
Definition: cadet_api.c:48
Test context for a CADET Test.
A 512-bit hashcode.
Message handler for a specific message type.
A peer controlled by the testing framework.