diff options
Diffstat (limited to 'src/transport/transport-testing-cmds.h')
-rw-r--r-- | src/transport/transport-testing-cmds.h | 276 |
1 files changed, 0 insertions, 276 deletions
diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h deleted file mode 100644 index f6e34df62..000000000 --- a/src/transport/transport-testing-cmds.h +++ /dev/null | |||
@@ -1,276 +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 | /** | ||
33 | * Struct to store information needed in callbacks. | ||
34 | * | ||
35 | */ | ||
36 | struct ConnectPeersState | ||
37 | { | ||
38 | /** | ||
39 | * Context for our asynchronous completion. | ||
40 | */ | ||
41 | struct GNUNET_TESTING_AsyncContext ac; | ||
42 | |||
43 | GNUNET_TRANSPORT_NotifyConnect notify_connect; | ||
44 | |||
45 | /** | ||
46 | * The testing system of this node. | ||
47 | */ | ||
48 | struct GNUNET_TESTING_System *tl_system; | ||
49 | |||
50 | // Label of the cmd which started the test system. | ||
51 | const char *create_label; | ||
52 | |||
53 | /** | ||
54 | * Number globally identifying the node. | ||
55 | * | ||
56 | */ | ||
57 | uint32_t num; | ||
58 | |||
59 | /** | ||
60 | * Label of the cmd to start a peer. | ||
61 | * | ||
62 | */ | ||
63 | const char *start_peer_label; | ||
64 | |||
65 | /** | ||
66 | * The peer identity of this peer. | ||
67 | * | ||
68 | */ | ||
69 | struct GNUNET_PeerIdentity *id; | ||
70 | |||
71 | /** | ||
72 | * The topology of the test setup. | ||
73 | */ | ||
74 | struct GNUNET_TESTING_NetjailTopology *topology; | ||
75 | |||
76 | /** | ||
77 | * Connections to other peers. | ||
78 | */ | ||
79 | struct GNUNET_TESTING_NodeConnection *node_connections_head; | ||
80 | |||
81 | struct GNUNET_TESTING_Interpreter *is; | ||
82 | |||
83 | /** | ||
84 | * Number of connections. | ||
85 | */ | ||
86 | unsigned int con_num; | ||
87 | }; | ||
88 | |||
89 | struct StartPeerState | ||
90 | { | ||
91 | /** | ||
92 | * Context for our asynchronous completion. | ||
93 | */ | ||
94 | struct GNUNET_TESTING_AsyncContext ac; | ||
95 | |||
96 | /** | ||
97 | * The ip of a node. | ||
98 | */ | ||
99 | char *node_ip; | ||
100 | |||
101 | /** | ||
102 | * Receive callback | ||
103 | */ | ||
104 | struct GNUNET_MQ_MessageHandler *handlers; | ||
105 | |||
106 | const char *cfgname; | ||
107 | |||
108 | /** | ||
109 | * Peer's configuration | ||
110 | */ | ||
111 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
112 | |||
113 | struct GNUNET_TESTING_Peer *peer; | ||
114 | |||
115 | /** | ||
116 | * Peer identity | ||
117 | */ | ||
118 | struct GNUNET_PeerIdentity id; | ||
119 | |||
120 | /** | ||
121 | * Peer's transport service handle | ||
122 | */ | ||
123 | struct GNUNET_TRANSPORT_CoreHandle *th; | ||
124 | |||
125 | /** | ||
126 | * Application handle | ||
127 | */ | ||
128 | struct GNUNET_TRANSPORT_ApplicationHandle *ah; | ||
129 | |||
130 | /** | ||
131 | * Peer's PEERSTORE Handle | ||
132 | */ | ||
133 | struct GNUNET_PEERSTORE_Handle *ph; | ||
134 | |||
135 | /** | ||
136 | * Hello get task | ||
137 | */ | ||
138 | struct GNUNET_SCHEDULER_Task *rh_task; | ||
139 | |||
140 | /** | ||
141 | * Peer's transport get hello handle to retrieve peer's HELLO message | ||
142 | */ | ||
143 | struct GNUNET_PEERSTORE_IterateContext *pic; | ||
144 | |||
145 | /** | ||
146 | * Hello | ||
147 | */ | ||
148 | char *hello; | ||
149 | |||
150 | /** | ||
151 | * Hello size | ||
152 | */ | ||
153 | size_t hello_size; | ||
154 | |||
155 | char *m; | ||
156 | |||
157 | char *n; | ||
158 | |||
159 | char *local_m; | ||
160 | |||
161 | const char *system_label; | ||
162 | |||
163 | /** | ||
164 | * An unique number to identify the peer | ||
165 | */ | ||
166 | unsigned int no; | ||
167 | |||
168 | struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; | ||
169 | |||
170 | struct GNUNET_TESTING_System *tl_system; | ||
171 | |||
172 | GNUNET_TRANSPORT_NotifyConnect notify_connect; | ||
173 | |||
174 | }; | ||
175 | |||
176 | |||
177 | /** | ||
178 | * Function to get the trait with the struct ConnectPeersState. | ||
179 | * | ||
180 | * @param[out] sps struct ConnectPeersState. | ||
181 | * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. | ||
182 | * | ||
183 | */ | ||
184 | int | ||
185 | GNUNET_TESTING_get_trait_connect_peer_state ( | ||
186 | const struct GNUNET_TESTING_Command *cmd, | ||
187 | struct ConnectPeersState **cps); | ||
188 | |||
189 | |||
190 | int | ||
191 | GNUNET_TRANSPORT_get_trait_state (const struct | ||
192 | GNUNET_TESTING_Command | ||
193 | *cmd, | ||
194 | struct StartPeerState **sps); | ||
195 | |||
196 | |||
197 | struct GNUNET_TESTING_Command | ||
198 | GNUNET_TRANSPORT_cmd_start_peer (const char *label, | ||
199 | const char *system_label, | ||
200 | uint32_t no, | ||
201 | char *node_ip, | ||
202 | struct GNUNET_MQ_MessageHandler *handlers, | ||
203 | const char *cfgname, | ||
204 | GNUNET_TRANSPORT_NotifyConnect notify_connect); | ||
205 | |||
206 | |||
207 | struct GNUNET_TESTING_Command | ||
208 | GNUNET_TRANSPORT_cmd_stop_peer (const char *label, | ||
209 | const char *start_label); | ||
210 | |||
211 | |||
212 | struct GNUNET_TESTING_Command | ||
213 | GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | ||
214 | const char *start_peer_label, | ||
215 | const char *create_label, | ||
216 | uint32_t num, | ||
217 | struct GNUNET_TESTING_NetjailTopology * | ||
218 | topology); | ||
219 | |||
220 | |||
221 | /** | ||
222 | * Create command. | ||
223 | * | ||
224 | * @param label name for command. | ||
225 | * @param m The number of the local node of the actual network namespace. | ||
226 | * @param n The number of the actual namespace. | ||
227 | * @param num Number globally identifying the node. | ||
228 | * @param start_peer_label Label of the cmd to start a peer. | ||
229 | * @return command. | ||
230 | */ | ||
231 | struct GNUNET_TESTING_Command | ||
232 | GNUNET_TRANSPORT_cmd_send_simple (const char *label, | ||
233 | const char *start_peer_label, | ||
234 | uint32_t num); | ||
235 | |||
236 | |||
237 | |||
238 | |||
239 | |||
240 | int | ||
241 | GNUNET_TRANSPORT_get_trait_peer_id (const struct | ||
242 | GNUNET_TESTING_Command *cmd, | ||
243 | struct GNUNET_PeerIdentity **id); | ||
244 | |||
245 | |||
246 | int | ||
247 | GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct | ||
248 | GNUNET_TESTING_Command | ||
249 | *cmd, | ||
250 | struct | ||
251 | GNUNET_CONTAINER_MultiShortmap | ||
252 | * | ||
253 | * | ||
254 | connected_peers_map); | ||
255 | int | ||
256 | GNUNET_TRANSPORT_get_trait_hello_size (const struct | ||
257 | GNUNET_TESTING_Command | ||
258 | *cmd, | ||
259 | size_t **hello_size); | ||
260 | |||
261 | int | ||
262 | GNUNET_TRANSPORT_get_trait_hello (const struct | ||
263 | GNUNET_TESTING_Command | ||
264 | *cmd, | ||
265 | char **hello); | ||
266 | |||
267 | |||
268 | int | ||
269 | GNUNET_TRANSPORT_get_trait_application_handle (const struct | ||
270 | GNUNET_TESTING_Command *cmd, | ||
271 | struct | ||
272 | GNUNET_TRANSPORT_ApplicationHandle | ||
273 | **ah); | ||
274 | |||
275 | #endif | ||
276 | /* end of transport_testing.h */ | ||