aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/vectorproduct_testing.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/scalarproduct/vectorproduct_testing.h')
-rw-r--r--src/scalarproduct/vectorproduct_testing.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/src/scalarproduct/vectorproduct_testing.h b/src/scalarproduct/vectorproduct_testing.h
new file mode 100644
index 000000000..19e4f6163
--- /dev/null
+++ b/src/scalarproduct/vectorproduct_testing.h
@@ -0,0 +1,129 @@
1/*
2 * File: vectorproduct_testing.h
3 * Author: gnunet
4 *
5 * Created on June 29, 2013, 7:39 PM
6 */
7
8#ifndef VECTORPRODUCT_TESTING_H
9#define VECTORPRODUCT_TESTING_H
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15struct GNUNET_VECTORPRODUCT_TESTING_handle
16{
17 /**
18 * Testing library system handle
19 */
20 struct GNUNET_TESTING_System *tl_system;
21
22 /**
23 * head DLL of peers
24 */
25 struct PeerContext *p_head;
26
27 /**
28 * tail DLL of peers
29 */
30 struct PeerContext *p_tail;
31};
32
33struct PeerContext
34{
35 /**
36 * Next element in the DLL
37 */
38 struct PeerContext *next;
39
40 /**
41 * Previous element in the DLL
42 */
43 struct PeerContext *prev;
44
45 /**
46 * Peer's testing handle
47 */
48 struct GNUNET_TESTING_Peer *peer;
49
50 /**
51 * Peer identity
52 */
53 struct GNUNET_PeerIdentity id;
54
55 /**
56 * Handle for the peer's ARM process
57 */
58 struct GNUNET_OS_Process *arm_proc;
59
60 /**
61 * Pointer to Vector Product Handle
62 */
63 struct GNUNET_VECTORPRODUCT_Handle *vh;
64
65 /**
66 * Closure for the callbacks
67 */
68 void *cb_cls;
69
70 /**
71 * An unique number to identify the peer
72 */
73 unsigned int no;
74
75 /**
76 * Peer's configuration
77 */
78 struct GNUNET_CONFIGURATION_Handle *cfg;
79
80 /**
81 * Pointer to the master testing handle
82 */
83 struct GNUNET_VECTORPRODUCT_TESTING_handle * vth;
84
85 /**
86 * Callback when two peers are connected and both have called the connect callback
87 * to notify clients about a new peer
88 */
89 void (*start_cb) (struct PeerContext * p, void *cls);
90
91// /**
92// * Pointer to function where the test occurs
93// */
94// GNUNET_VECTORPRODUCT_TESTING_start_cb start_cb;
95};
96
97/**
98 * Callback when two peers are connected and both have called the connect callback
99 * to notify clients about a new peer
100 */
101typedef void (*GNUNET_VECTORPRODUCT_TESTING_start_cb) (struct PeerContext * p,
102 void *cls);
103
104struct GNUNET_VECTORPRODUCT_TESTING_handle *
105GNUNET_VECTORPRODUCT_TESTING_init();
106
107static void
108GNUNET_VECTORPRODUCT_TESTING_done(struct GNUNET_VECTORPRODUCT_TESTING_handle * vth);
109
110struct PeerContext *
111GNUNET_VECTORPRODUCT_TESTING_start_peer (struct GNUNET_VECTORPRODUCT_TESTING_handle * vth,
112 const char *cfgname, int peer_id,
113 GNUNET_VECTORPRODUCT_TESTING_start_cb start_cb,
114 void *cb_cls);
115
116static void
117GNUNET_VECTORPRODUCT_TESTING_stop_peer
118 (struct GNUNET_VECTORPRODUCT_TESTING_handle * vth,
119 struct PeerContext *p);
120
121
122
123
124#ifdef __cplusplus
125}
126#endif
127
128#endif /* VECTORPRODUCT_TESTING_H */
129