diff options
Diffstat (limited to 'src/transport/transport-testing-cmds.h')
-rw-r--r-- | src/transport/transport-testing-cmds.h | 312 |
1 files changed, 0 insertions, 312 deletions
diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h deleted file mode 100644 index f9ebafade..000000000 --- a/src/transport/transport-testing-cmds.h +++ /dev/null | |||
@@ -1,312 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 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 | */ | ||
20 | |||
21 | /** | ||
22 | * @file transport-testing.h | ||
23 | * @brief testing lib for transport service | ||
24 | * @author Matthias Wachs | ||
25 | * @author Christian Grothoff | ||
26 | */ | ||
27 | #ifndef TRANSPORT_TESTING_CMDS_H | ||
28 | #define TRANSPORT_TESTING_CMDS_H | ||
29 | #include "gnunet_testing_lib.h" | ||
30 | |||
31 | |||
32 | struct StartPeerState_v2 | ||
33 | { | ||
34 | /** | ||
35 | * The ip of a node. | ||
36 | */ | ||
37 | char *node_ip; | ||
38 | |||
39 | /** | ||
40 | * Receive callback | ||
41 | */ | ||
42 | struct GNUNET_MQ_MessageHandler *handlers; | ||
43 | |||
44 | const char *cfgname; | ||
45 | |||
46 | /** | ||
47 | * Peer's configuration | ||
48 | */ | ||
49 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
50 | |||
51 | struct GNUNET_TESTING_Peer *peer; | ||
52 | |||
53 | /** | ||
54 | * Peer identity | ||
55 | */ | ||
56 | struct GNUNET_PeerIdentity id; | ||
57 | |||
58 | /** | ||
59 | * Peer's transport service handle | ||
60 | */ | ||
61 | struct GNUNET_TRANSPORT_CoreHandle *th; | ||
62 | |||
63 | /** | ||
64 | * Application handle | ||
65 | */ | ||
66 | struct GNUNET_TRANSPORT_ApplicationHandle *ah; | ||
67 | |||
68 | /** | ||
69 | * Peer's PEERSTORE Handle | ||
70 | */ | ||
71 | struct GNUNET_PEERSTORE_Handle *ph; | ||
72 | |||
73 | /** | ||
74 | * Hello get task | ||
75 | */ | ||
76 | struct GNUNET_SCHEDULER_Task *rh_task; | ||
77 | |||
78 | /** | ||
79 | * Peer's transport get hello handle to retrieve peer's HELLO message | ||
80 | */ | ||
81 | struct GNUNET_PEERSTORE_IterateContext *pic; | ||
82 | |||
83 | /** | ||
84 | * Hello | ||
85 | */ | ||
86 | char *hello; | ||
87 | |||
88 | /** | ||
89 | * Hello size | ||
90 | */ | ||
91 | size_t hello_size; | ||
92 | |||
93 | char *m; | ||
94 | |||
95 | char *n; | ||
96 | |||
97 | char *local_m; | ||
98 | |||
99 | unsigned int finished; | ||
100 | |||
101 | const char *system_label; | ||
102 | |||
103 | /** | ||
104 | * An unique number to identify the peer | ||
105 | */ | ||
106 | unsigned int no; | ||
107 | |||
108 | struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; | ||
109 | |||
110 | struct GNUNET_TESTING_System *tl_system; | ||
111 | |||
112 | }; | ||
113 | |||
114 | |||
115 | struct StartPeerState | ||
116 | { | ||
117 | /** | ||
118 | * The ip of a node. | ||
119 | */ | ||
120 | char *node_ip; | ||
121 | |||
122 | /** | ||
123 | * Receive callback | ||
124 | */ | ||
125 | struct GNUNET_MQ_MessageHandler *handlers; | ||
126 | |||
127 | const char *cfgname; | ||
128 | |||
129 | /** | ||
130 | * Peer's configuration | ||
131 | */ | ||
132 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
133 | |||
134 | struct GNUNET_TESTING_Peer *peer; | ||
135 | |||
136 | /** | ||
137 | * Peer identity | ||
138 | */ | ||
139 | struct GNUNET_PeerIdentity id; | ||
140 | |||
141 | /** | ||
142 | * Peer's transport service handle | ||
143 | */ | ||
144 | struct GNUNET_TRANSPORT_CoreHandle *th; | ||
145 | |||
146 | /** | ||
147 | * Application handle | ||
148 | */ | ||
149 | struct GNUNET_TRANSPORT_ApplicationHandle *ah; | ||
150 | |||
151 | /** | ||
152 | * Peer's PEERSTORE Handle | ||
153 | */ | ||
154 | struct GNUNET_PEERSTORE_Handle *ph; | ||
155 | |||
156 | /** | ||
157 | * Hello get task | ||
158 | */ | ||
159 | struct GNUNET_SCHEDULER_Task *rh_task; | ||
160 | |||
161 | /** | ||
162 | * Peer's transport get hello handle to retrieve peer's HELLO message | ||
163 | */ | ||
164 | struct GNUNET_PEERSTORE_IterateContext *pic; | ||
165 | |||
166 | /** | ||
167 | * Hello | ||
168 | */ | ||
169 | char *hello; | ||
170 | |||
171 | /** | ||
172 | * Hello size | ||
173 | */ | ||
174 | size_t hello_size; | ||
175 | |||
176 | char *m; | ||
177 | |||
178 | char *n; | ||
179 | |||
180 | char *local_m; | ||
181 | |||
182 | unsigned int finished; | ||
183 | |||
184 | const char *system_label; | ||
185 | |||
186 | /** | ||
187 | * An unique number to identify the peer | ||
188 | */ | ||
189 | unsigned int no; | ||
190 | |||
191 | struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; | ||
192 | |||
193 | struct GNUNET_TESTING_System *tl_system; | ||
194 | |||
195 | }; | ||
196 | |||
197 | |||
198 | int | ||
199 | GNUNET_TRANSPORT_get_trait_state (const struct | ||
200 | GNUNET_TESTING_Command | ||
201 | *cmd, | ||
202 | struct StartPeerState **sps); | ||
203 | |||
204 | |||
205 | struct GNUNET_TESTING_Command | ||
206 | GNUNET_TRANSPORT_cmd_start_peer_v2 (const char *label, | ||
207 | const char *system_label, | ||
208 | uint32_t no, | ||
209 | char *node_ip, | ||
210 | struct GNUNET_MQ_MessageHandler *handlers, | ||
211 | const char *cfgname); | ||
212 | |||
213 | struct GNUNET_TESTING_Command | ||
214 | GNUNET_TRANSPORT_cmd_start_peer (const char *label, | ||
215 | const char *system_label, | ||
216 | char *m, | ||
217 | char *n, | ||
218 | char *local_m, | ||
219 | char *node_ip, | ||
220 | struct GNUNET_MQ_MessageHandler *handlers, | ||
221 | const char *cfgname); | ||
222 | |||
223 | struct GNUNET_TESTING_Command | ||
224 | GNUNET_TRANSPORT_cmd_stop_peer (const char *label, | ||
225 | const char *start_label); | ||
226 | |||
227 | struct GNUNET_TESTING_Command | ||
228 | GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | ||
229 | const char *start_peer_label, | ||
230 | const char *create_label, | ||
231 | uint32_t num); | ||
232 | |||
233 | struct GNUNET_TESTING_Command | ||
234 | GNUNET_TRANSPORT_cmd_connect_peers_v2 (const char *label, | ||
235 | const char *start_peer_label, | ||
236 | const char *create_label, | ||
237 | uint32_t num); | ||
238 | |||
239 | struct GNUNET_TESTING_Command | ||
240 | GNUNET_TRANSPORT_cmd_send_simple (const char *label, | ||
241 | char *m, | ||
242 | char *n, | ||
243 | uint32_t num, | ||
244 | const char *start_peer_label); | ||
245 | |||
246 | /** | ||
247 | * Create command. | ||
248 | * | ||
249 | * @param label name for command. | ||
250 | * @param m The number of the local node of the actual network namespace. | ||
251 | * @param n The number of the actual namespace. | ||
252 | * @param num Number globally identifying the node. | ||
253 | * @param start_peer_label Label of the cmd to start a peer. | ||
254 | * @return command. | ||
255 | */ | ||
256 | struct GNUNET_TESTING_Command | ||
257 | GNUNET_TRANSPORT_cmd_send_simple_v2 (const char *label, | ||
258 | const char *start_peer_label, | ||
259 | uint32_t num); | ||
260 | |||
261 | int | ||
262 | GNUNET_TRANSPORT_get_trait_peer_id (const struct | ||
263 | GNUNET_TESTING_Command *cmd, | ||
264 | struct GNUNET_PeerIdentity **id); | ||
265 | |||
266 | int | ||
267 | GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct | ||
268 | GNUNET_TESTING_Command | ||
269 | *cmd, | ||
270 | struct | ||
271 | GNUNET_CONTAINER_MultiShortmap * | ||
272 | * | ||
273 | connected_peers_map); | ||
274 | |||
275 | int | ||
276 | GNUNET_TRANSPORT_get_trait_connected_peers_map_v2 (const struct | ||
277 | GNUNET_TESTING_Command | ||
278 | *cmd, | ||
279 | struct | ||
280 | GNUNET_CONTAINER_MultiShortmap | ||
281 | * | ||
282 | * | ||
283 | connected_peers_map); | ||
284 | int | ||
285 | GNUNET_TRANSPORT_get_trait_hello_size (const struct | ||
286 | GNUNET_TESTING_Command | ||
287 | *cmd, | ||
288 | size_t **hello_size); | ||
289 | |||
290 | int | ||
291 | GNUNET_TRANSPORT_get_trait_hello (const struct | ||
292 | GNUNET_TESTING_Command | ||
293 | *cmd, | ||
294 | char **hello); | ||
295 | |||
296 | |||
297 | int | ||
298 | GNUNET_TRANSPORT_get_trait_application_handle (const struct | ||
299 | GNUNET_TESTING_Command *cmd, | ||
300 | struct | ||
301 | GNUNET_TRANSPORT_ApplicationHandle | ||
302 | **ah); | ||
303 | |||
304 | int | ||
305 | GNUNET_TRANSPORT_get_trait_application_handle_v2 (const struct | ||
306 | GNUNET_TESTING_Command *cmd, | ||
307 | struct | ||
308 | GNUNET_TRANSPORT_ApplicationHandle | ||
309 | **ah); | ||
310 | |||
311 | #endif | ||
312 | /* end of transport_testing.h */ | ||