1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
/*
This file is part of GNUnet.
(C) 2013 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/**
* @file scalarproduct/scalarproduct_testing.h
* @brief VectorProduct testcase common declarations
* @author Gaurav Kukreja
* @author Christian Fuchs
*
* Created on June 29, 2013, 7:39 PM
*/
#ifndef SCALARPRODUCT_TESTING_H
#define SCALARPRODUCT_TESTING_H
#ifdef __cplusplus
extern "C" {
#endif
struct GNUNET_SCALARPRODUCT_TESTING_handle
{
/**
* Testing library system handle
*/
struct GNUNET_TESTING_System *tl_system;
/**
* head DLL of peers
*/
struct PeerContext *p_head;
/**
* tail DLL of peers
*/
struct PeerContext *p_tail;
};
struct PeerContext
{
/**
* Next element in the DLL
*/
struct PeerContext *next;
/**
* Previous element in the DLL
*/
struct PeerContext *prev;
/**
* Peer's testing handle
*/
struct GNUNET_TESTING_Peer *peer;
/**
* Peer identity
*/
struct GNUNET_PeerIdentity id;
/**
* Handle for the peer's ARM process
*/
struct GNUNET_OS_Process *arm_proc;
/**
* Pointer to Vector Product Handle
*/
struct GNUNET_SCALARPRODUCT_Handle *vh;
/**
* Closure for the callbacks
*/
void *cb_cls;
/**
* An unique number to identify the peer
*/
unsigned int no;
/**
* Peer's configuration
*/
struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Pointer to the master testing handle
*/
struct GNUNET_SCALARPRODUCT_TESTING_handle * vth;
/**
* Callback when two peers are connected and both have called the connect callback
* to notify clients about a new peer
*/
void (*start_cb) (struct PeerContext * p, void *cls);
// /**
// * Pointer to function where the test occurs
// */
// GNUNET_SCALARPRODUCT_TESTING_start_cb start_cb;
};
/**
* Callback when two peers are connected and both have called the connect callback
* to notify clients about a new peer
*/
typedef void (*GNUNET_SCALARPRODUCT_TESTING_start_cb) (struct PeerContext * p,
void *cls);
struct GNUNET_SCALARPRODUCT_TESTING_handle *
GNUNET_SCALARPRODUCT_TESTING_init();
static void
GNUNET_SCALARPRODUCT_TESTING_done(struct GNUNET_SCALARPRODUCT_TESTING_handle * vth);
struct PeerContext *
GNUNET_SCALARPRODUCT_TESTING_start_peer (struct GNUNET_SCALARPRODUCT_TESTING_handle * vth,
const char *cfgname, int peer_id,
GNUNET_SCALARPRODUCT_TESTING_start_cb start_cb,
void *cb_cls);
static void
GNUNET_SCALARPRODUCT_TESTING_stop_peer
(struct GNUNET_SCALARPRODUCT_TESTING_handle * vth,
struct PeerContext *p);
#ifdef __cplusplus
}
#endif
#endif /* SCALARPRODUCT_TESTING_H */
|