aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing.h
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-08-12 04:28:53 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-08-12 04:28:53 +0000
commit5434646c91cc203f4113018503b06ada292060d4 (patch)
tree172e672d2040ebf16c05d772a8655c169acc8389 /src/transport/transport-testing.h
parent202d53014183b98b27cdc88fef11b5f9f6b97f00 (diff)
downloadgnunet-5434646c91cc203f4113018503b06ada292060d4.tar.gz
gnunet-5434646c91cc203f4113018503b06ada292060d4.zip
documentation
Diffstat (limited to 'src/transport/transport-testing.h')
-rw-r--r--src/transport/transport-testing.h40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/transport/transport-testing.h b/src/transport/transport-testing.h
index cfcffaff6..25a772001 100644
--- a/src/transport/transport-testing.h
+++ b/src/transport/transport-testing.h
@@ -27,31 +27,51 @@
27 27
28#include "platform.h" 28#include "platform.h"
29#include "gnunet_common.h" 29#include "gnunet_common.h"
30#include "gnunet_hello_lib.h"
31#include "gnunet_getopt_lib.h" 30#include "gnunet_getopt_lib.h"
32#include "gnunet_os_lib.h" 31#include "gnunet_os_lib.h"
33#include "gnunet_program_lib.h" 32#include "gnunet_program_lib.h"
34#include "gnunet_transport_service.h" 33#include "gnunet_transport_service.h"
35#include "transport.h"
36 34
37 35
36/**
37 * Context for a single peer
38 */
38struct PeerContext 39struct PeerContext
39{ 40{
40 struct GNUNET_CONFIGURATION_Handle *cfg; 41 struct GNUNET_CONFIGURATION_Handle *cfg;
42
41 struct GNUNET_TRANSPORT_Handle *th; 43 struct GNUNET_TRANSPORT_Handle *th;
44
42 struct GNUNET_PeerIdentity id; 45 struct GNUNET_PeerIdentity id;
46
43 struct GNUNET_OS_Process *arm_proc; 47 struct GNUNET_OS_Process *arm_proc;
44 48
45 GNUNET_TRANSPORT_ReceiveCallback rec; 49 GNUNET_TRANSPORT_ReceiveCallback rec;
50
46 GNUNET_TRANSPORT_NotifyConnect nc; 51 GNUNET_TRANSPORT_NotifyConnect nc;
52
47 GNUNET_TRANSPORT_NotifyDisconnect nd; 53 GNUNET_TRANSPORT_NotifyDisconnect nd;
54
48 void * cb_cls; 55 void * cb_cls;
49 56
50 char * servicehome; 57 char * servicehome;
51}; 58};
52 59
60/**
61 * Callback when two peers are connected and both have called the connect callback
62 * to notify clients about a new peer
63 */
53typedef void (*GNUNET_TRANSPORT_TESTING_connect_cb) (struct PeerContext * p1, struct PeerContext * p2, void *cls); 64typedef void (*GNUNET_TRANSPORT_TESTING_connect_cb) (struct PeerContext * p1, struct PeerContext * p2, void *cls);
54 65
66
67/**
68 * Start a peer with the given configuration
69 * @param rec receive callback
70 * @param nc connect callback
71 * @param nd disconnect callback
72 * @param cb_cls closure for callback
73 * @return the peer context
74 */
55struct PeerContext * 75struct PeerContext *
56GNUNET_TRANSPORT_TESTING_start_peer (const char * cfgname, 76GNUNET_TRANSPORT_TESTING_start_peer (const char * cfgname,
57 GNUNET_TRANSPORT_ReceiveCallback rec, 77 GNUNET_TRANSPORT_ReceiveCallback rec,
@@ -59,9 +79,25 @@ GNUNET_TRANSPORT_TESTING_start_peer (const char * cfgname,
59 GNUNET_TRANSPORT_NotifyDisconnect nd, 79 GNUNET_TRANSPORT_NotifyDisconnect nd,
60 void * cb_cls); 80 void * cb_cls);
61 81
82
83/**
84 * shutdown the given peer
85 * @param p the peer
86 */
87
62void 88void
63GNUNET_TRANSPORT_TESTING_stop_peer (struct PeerContext * pc); 89GNUNET_TRANSPORT_TESTING_stop_peer (struct PeerContext * pc);
64 90
91
92/**
93 * Connect the given peers and call the callback when both peers report the
94 * inbound connection. Remarks: start_peer's notify_connect callback can be called
95 * before.
96 * @param p1 peer 1
97 * @param p2 peer 2
98 * @param cb the callback to call
99 * @param cb_cls callback cls
100 */
65void 101void
66GNUNET_TRANSPORT_TESTING_connect_peers (struct PeerContext * p1, 102GNUNET_TRANSPORT_TESTING_connect_peers (struct PeerContext * p1,
67 struct PeerContext * p2, 103 struct PeerContext * p2,