aboutsummaryrefslogtreecommitdiff
path: root/src/ats/test_ats_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ats/test_ats_lib.h')
-rw-r--r--src/ats/test_ats_lib.h80
1 files changed, 25 insertions, 55 deletions
diff --git a/src/ats/test_ats_lib.h b/src/ats/test_ats_lib.h
index cc9f8ec73..db083d2d7 100644
--- a/src/ats/test_ats_lib.h
+++ b/src/ats/test_ats_lib.h
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20/** 20/**
21 * @file ats/test_ats_lib.h 21 * @file ats/test_ats_lib.h
22 * @brief test ATS library with a generic interpreter for running ATS tests 22 * @brief test ATS library with a generic interpreter for running ATS tests
@@ -33,8 +33,7 @@
33/** 33/**
34 * Commands for the interpreter. 34 * Commands for the interpreter.
35 */ 35 */
36enum CommandCode 36enum CommandCode {
37{
38 /** 37 /**
39 * End the test (passing). 38 * End the test (passing).
40 */ 39 */
@@ -123,15 +122,13 @@ enum CommandCode
123 * Wait for a bit. 122 * Wait for a bit.
124 */ 123 */
125 CMD_SLEEP 124 CMD_SLEEP
126
127}; 125};
128 126
129 127
130/** 128/**
131 * Details for the #CMD_ADD_ADDRESS command. 129 * Details for the #CMD_ADD_ADDRESS command.
132 */ 130 */
133struct CommandAddAddress 131struct CommandAddAddress {
134{
135 /** 132 /**
136 * Number of the peer (used to generate PID). 133 * Number of the peer (used to generate PID).
137 */ 134 */
@@ -172,8 +169,7 @@ struct CommandAddAddress
172/** 169/**
173 * Details for the #CMD_DEL_ADDRESS command. 170 * Details for the #CMD_DEL_ADDRESS command.
174 */ 171 */
175struct CommandDelAddress 172struct CommandDelAddress {
176{
177 /** 173 /**
178 * Label of the corresponding #CMD_ADD_ADDRESS that 174 * Label of the corresponding #CMD_ADD_ADDRESS that
179 * we are now to remove. 175 * we are now to remove.
@@ -185,8 +181,7 @@ struct CommandDelAddress
185/** 181/**
186 * Details for the #CMD_AWAIT_ADDRESS_SUGGESTION command. 182 * Details for the #CMD_AWAIT_ADDRESS_SUGGESTION command.
187 */ 183 */
188struct CommandAwaitAddressSuggestion 184struct CommandAwaitAddressSuggestion {
189{
190 /** 185 /**
191 * For which peer do we expect a suggestion? 186 * For which peer do we expect a suggestion?
192 */ 187 */
@@ -198,28 +193,24 @@ struct CommandAwaitAddressSuggestion
198 * use NULL for "any" available address. 193 * use NULL for "any" available address.
199 */ 194 */
200 const char *add_label; 195 const char *add_label;
201
202}; 196};
203 197
204 198
205/** 199/**
206 * Details for the #CMD_AWAIT_DISCONNECT_SUGGESTION command. 200 * Details for the #CMD_AWAIT_DISCONNECT_SUGGESTION command.
207 */ 201 */
208struct CommandAwaitDisconnectSuggestion 202struct CommandAwaitDisconnectSuggestion {
209{
210 /** 203 /**
211 * For which peer do we expect the disconnect? 204 * For which peer do we expect the disconnect?
212 */ 205 */
213 unsigned int pid; 206 unsigned int pid;
214
215}; 207};
216 208
217 209
218/** 210/**
219 * Details for the #CMD_REQUEST_CONNECTION_START command. 211 * Details for the #CMD_REQUEST_CONNECTION_START command.
220 */ 212 */
221struct CommandRequestConnectionStart 213struct CommandRequestConnectionStart {
222{
223 /** 214 /**
224 * Identity of the peer we would like to connect to. 215 * Identity of the peer we would like to connect to.
225 */ 216 */
@@ -236,8 +227,7 @@ struct CommandRequestConnectionStart
236/** 227/**
237 * Details for the #CMD_REQUEST_CONNECTION_STOP command. 228 * Details for the #CMD_REQUEST_CONNECTION_STOP command.
238 */ 229 */
239struct CommandRequestConnectionStop 230struct CommandRequestConnectionStop {
240{
241 /** 231 /**
242 * Label of the corresponding #CMD_REQUEST_CONNECTION_START that 232 * Label of the corresponding #CMD_REQUEST_CONNECTION_START that
243 * we are now stopping. 233 * we are now stopping.
@@ -249,8 +239,7 @@ struct CommandRequestConnectionStop
249/** 239/**
250 * Details for the #CMD_AWAIT_ADDRESS_INFORMATION command. 240 * Details for the #CMD_AWAIT_ADDRESS_INFORMATION command.
251 */ 241 */
252struct CommandAwaitAddressInformation 242struct CommandAwaitAddressInformation {
253{
254 /** 243 /**
255 * For which address do we expect information? 244 * For which address do we expect information?
256 * The address is identified by the respective 245 * The address is identified by the respective
@@ -264,15 +253,13 @@ struct CommandAwaitAddressInformation
264 * the properties from the @e add_label. 253 * the properties from the @e add_label.
265 */ 254 */
266 const char *update_label; 255 const char *update_label;
267
268}; 256};
269 257
270 258
271/** 259/**
272 * Details for the #CMD_UPDATE_ADDRESS command. 260 * Details for the #CMD_UPDATE_ADDRESS command.
273 */ 261 */
274struct CommandUpdateAddress 262struct CommandUpdateAddress {
275{
276 /** 263 /**
277 * Label of the addresses's add operation. 264 * Label of the addresses's add operation.
278 */ 265 */
@@ -282,16 +269,14 @@ struct CommandUpdateAddress
282 * Performance properties to supply. 269 * Performance properties to supply.
283 */ 270 */
284 struct GNUNET_ATS_Properties properties; 271 struct GNUNET_ATS_Properties properties;
285
286}; 272};
287 273
288 274
289/** 275/**
290 * Details for the #CMD_ADD_SESSION command. 276 * Details for the #CMD_ADD_SESSION command.
291 */ 277 */
292struct CommandAddSession 278struct CommandAddSession {
293{ 279 /**
294 /**
295 * Label of the addresses's add operation. 280 * Label of the addresses's add operation.
296 */ 281 */
297 const char *add_label; 282 const char *add_label;
@@ -300,43 +285,37 @@ struct CommandAddSession
300 * Session to supply. 285 * Session to supply.
301 */ 286 */
302 unsigned int session; 287 unsigned int session;
303
304}; 288};
305 289
306 290
307/** 291/**
308 * Details for the #CMD_DEL_SESSION command. 292 * Details for the #CMD_DEL_SESSION command.
309 */ 293 */
310struct CommandDelSession 294struct CommandDelSession {
311{ 295 /**
312 /**
313 * Label of the addresses's add operation. 296 * Label of the addresses's add operation.
314 */ 297 */
315 const char *add_session_label; 298 const char *add_session_label;
316
317}; 299};
318 300
319 301
320/** 302/**
321 * Details for the #CMD_CHANGE_PREFERENCE command. 303 * Details for the #CMD_CHANGE_PREFERENCE command.
322 */ 304 */
323struct CommandChangePreference 305struct CommandChangePreference {
324{
325 /** 306 /**
326 * Identity of the peer we have a preference change towards. 307 * Identity of the peer we have a preference change towards.
327 */ 308 */
328 unsigned int pid; 309 unsigned int pid;
329 310
330 /* FIXME: preference details! */ 311 /* FIXME: preference details! */
331
332}; 312};
333 313
334 314
335/** 315/**
336 * Details for the #CMD_PROVIDE_FEEDBACK command. 316 * Details for the #CMD_PROVIDE_FEEDBACK command.
337 */ 317 */
338struct CommandProvideFeedback 318struct CommandProvideFeedback {
339{
340 /** 319 /**
341 * Identity of the peer we have a feedback for. 320 * Identity of the peer we have a feedback for.
342 */ 321 */
@@ -354,8 +333,7 @@ struct CommandProvideFeedback
354/** 333/**
355 * Details for the #CMD_LIST_ADDRESSES command. 334 * Details for the #CMD_LIST_ADDRESSES command.
356 */ 335 */
357struct CommandListAddresses 336struct CommandListAddresses {
358{
359 /** 337 /**
360 * Identity of the peer we want a list for. 338 * Identity of the peer we want a list for.
361 */ 339 */
@@ -403,15 +381,13 @@ struct CommandListAddresses
403 * #GNUNET_ATS_performance_list_addresses(). 381 * #GNUNET_ATS_performance_list_addresses().
404 */ 382 */
405 struct GNUNET_ATS_AddressListHandle *alh; 383 struct GNUNET_ATS_AddressListHandle *alh;
406
407}; 384};
408 385
409 386
410/** 387/**
411 * Details for the #CMD_RESERVE_BANDWIDTH command. 388 * Details for the #CMD_RESERVE_BANDWIDTH command.
412 */ 389 */
413struct CommandReserveBandwidth 390struct CommandReserveBandwidth {
414{
415 /** 391 /**
416 * For which peer do we reserve bandwidth? 392 * For which peer do we reserve bandwidth?
417 */ 393 */
@@ -435,15 +411,13 @@ struct CommandReserveBandwidth
435 * #GNUNET_ATS_reserve_bandwidth(). 411 * #GNUNET_ATS_reserve_bandwidth().
436 */ 412 */
437 struct GNUNET_ATS_ReservationContext *rc; 413 struct GNUNET_ATS_ReservationContext *rc;
438
439}; 414};
440 415
441 416
442/** 417/**
443 * Details for the #CMD_SLEEP command. 418 * Details for the #CMD_SLEEP command.
444 */ 419 */
445struct CommandSleep 420struct CommandSleep {
446{
447 /** 421 /**
448 * How long should we wait before running the next command? 422 * How long should we wait before running the next command?
449 */ 423 */
@@ -454,8 +428,7 @@ struct CommandSleep
454/** 428/**
455 * A command for the test case interpreter. 429 * A command for the test case interpreter.
456 */ 430 */
457struct Command 431struct Command {
458{
459 /** 432 /**
460 * Command code to run. 433 * Command code to run.
461 */ 434 */
@@ -470,7 +443,6 @@ struct Command
470 * Additional arguments to commands, if any. 443 * Additional arguments to commands, if any.
471 */ 444 */
472 union { 445 union {
473
474 struct CommandAddAddress add_address; 446 struct CommandAddAddress add_address;
475 447
476 struct CommandDelAddress del_address; 448 struct CommandDelAddress del_address;
@@ -500,9 +472,7 @@ struct Command
500 struct CommandReserveBandwidth reserve_bandwidth; 472 struct CommandReserveBandwidth reserve_bandwidth;
501 473
502 struct CommandSleep sleep; 474 struct CommandSleep sleep;
503
504 } details; 475 } details;
505
506}; 476};
507 477
508 478
@@ -516,9 +486,9 @@ struct Command
516 * @return 0 on success 486 * @return 0 on success
517 */ 487 */
518int 488int
519TEST_ATS_run (int argc, 489TEST_ATS_run(int argc,
520 char *argv[], 490 char *argv[],
521 struct Command *cmds, 491 struct Command *cmds,
522 struct GNUNET_TIME_Relative timeout); 492 struct GNUNET_TIME_Relative timeout);
523 493
524#endif 494#endif