diff options
Diffstat (limited to 'src/ats-tests/ats-testing.h')
-rw-r--r-- | src/ats-tests/ats-testing.h | 128 |
1 files changed, 58 insertions, 70 deletions
diff --git a/src/ats-tests/ats-testing.h b/src/ats-tests/ats-testing.h index f6df5a9bd..ff3a40837 100644 --- a/src/ats-tests/ats-testing.h +++ b/src/ats-tests/ats-testing.h | |||
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2013 GNUnet e.V. | 3 | Copyright (C) 2010-2013 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 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 | 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, | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | or (at your option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
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 | */ |
@@ -48,11 +48,10 @@ | |||
48 | #define TEST_MESSAGE_SIZE 100 | 48 | #define TEST_MESSAGE_SIZE 100 |
49 | 49 | ||
50 | 50 | ||
51 | struct TestMessage | 51 | struct TestMessage { |
52 | { | ||
53 | struct GNUNET_MessageHeader header; | 52 | struct GNUNET_MessageHeader header; |
54 | 53 | ||
55 | uint8_t padding[TEST_MESSAGE_SIZE - sizeof (struct GNUNET_MessageHeader)]; | 54 | uint8_t padding[TEST_MESSAGE_SIZE - sizeof(struct GNUNET_MessageHeader)]; |
56 | }; | 55 | }; |
57 | 56 | ||
58 | 57 | ||
@@ -66,8 +65,7 @@ struct TrafficGenerator; | |||
66 | 65 | ||
67 | struct LoggingHandle; | 66 | struct LoggingHandle; |
68 | 67 | ||
69 | enum GeneratorType | 68 | enum GeneratorType { |
70 | { | ||
71 | GNUNET_ATS_TEST_TG_LINEAR, | 69 | GNUNET_ATS_TEST_TG_LINEAR, |
72 | GNUNET_ATS_TEST_TG_CONSTANT, | 70 | GNUNET_ATS_TEST_TG_CONSTANT, |
73 | GNUNET_ATS_TEST_TG_RANDOM, | 71 | GNUNET_ATS_TEST_TG_RANDOM, |
@@ -108,8 +106,7 @@ typedef void (*GNUNET_ATS_TEST_LogRequest) ( | |||
108 | /** | 106 | /** |
109 | * Information we track for a peer in the testbed. | 107 | * Information we track for a peer in the testbed. |
110 | */ | 108 | */ |
111 | struct BenchmarkPeer | 109 | struct BenchmarkPeer { |
112 | { | ||
113 | /** | 110 | /** |
114 | * Handle with testbed. | 111 | * Handle with testbed. |
115 | */ | 112 | */ |
@@ -227,8 +224,7 @@ struct BenchmarkPeer | |||
227 | unsigned int total_bytes_received; | 224 | unsigned int total_bytes_received; |
228 | }; | 225 | }; |
229 | 226 | ||
230 | struct TrafficGenerator | 227 | struct TrafficGenerator { |
231 | { | ||
232 | struct TrafficGenerator *prev; | 228 | struct TrafficGenerator *prev; |
233 | struct TrafficGenerator *next; | 229 | struct TrafficGenerator *next; |
234 | 230 | ||
@@ -247,8 +243,7 @@ struct TrafficGenerator | |||
247 | }; | 243 | }; |
248 | 244 | ||
249 | 245 | ||
250 | struct PreferenceGenerator | 246 | struct PreferenceGenerator { |
251 | { | ||
252 | struct PreferenceGenerator *prev; | 247 | struct PreferenceGenerator *prev; |
253 | struct PreferenceGenerator *next; | 248 | struct PreferenceGenerator *next; |
254 | 249 | ||
@@ -272,8 +267,7 @@ struct PreferenceGenerator | |||
272 | /** | 267 | /** |
273 | * Information about a benchmarking partner | 268 | * Information about a benchmarking partner |
274 | */ | 269 | */ |
275 | struct BenchmarkPartner | 270 | struct BenchmarkPartner { |
276 | { | ||
277 | /** | 271 | /** |
278 | * The peer itself this partner belongs to | 272 | * The peer itself this partner belongs to |
279 | */ | 273 | */ |
@@ -359,8 +353,7 @@ struct BenchmarkPartner | |||
359 | /** | 353 | /** |
360 | * Overall state of the performance benchmark | 354 | * Overall state of the performance benchmark |
361 | */ | 355 | */ |
362 | struct BenchmarkState | 356 | struct BenchmarkState { |
363 | { | ||
364 | /** | 357 | /** |
365 | * Are we connected to ATS service of all peers: GNUNET_YES/NO | 358 | * Are we connected to ATS service of all peers: GNUNET_YES/NO |
366 | */ | 359 | */ |
@@ -388,8 +381,7 @@ struct BenchmarkState | |||
388 | }; | 381 | }; |
389 | 382 | ||
390 | 383 | ||
391 | struct GNUNET_ATS_TEST_Topology | 384 | struct GNUNET_ATS_TEST_Topology { |
392 | { | ||
393 | /** | 385 | /** |
394 | * Progress task | 386 | * Progress task |
395 | */ | 387 | */ |
@@ -467,8 +459,7 @@ struct GNUNET_ATS_TEST_Topology | |||
467 | void *done_cb_cls; | 459 | void *done_cb_cls; |
468 | }; | 460 | }; |
469 | 461 | ||
470 | enum OperationType | 462 | enum OperationType { |
471 | { | ||
472 | START_SEND, | 463 | START_SEND, |
473 | STOP_SEND, | 464 | STOP_SEND, |
474 | START_PREFERENCE, | 465 | START_PREFERENCE, |
@@ -489,8 +480,7 @@ typedef void (*GNUNET_ATS_TESTING_ExperimentDoneCallback) ( | |||
489 | /** | 480 | /** |
490 | * An operation in an experiment | 481 | * An operation in an experiment |
491 | */ | 482 | */ |
492 | struct GNUNET_ATS_TEST_Operation | 483 | struct GNUNET_ATS_TEST_Operation { |
493 | { | ||
494 | struct GNUNET_ATS_TEST_Operation *next; | 484 | struct GNUNET_ATS_TEST_Operation *next; |
495 | struct GNUNET_ATS_TEST_Operation *prev; | 485 | struct GNUNET_ATS_TEST_Operation *prev; |
496 | 486 | ||
@@ -507,8 +497,7 @@ struct GNUNET_ATS_TEST_Operation | |||
507 | enum GNUNET_ATS_PreferenceKind pref_type; | 497 | enum GNUNET_ATS_PreferenceKind pref_type; |
508 | }; | 498 | }; |
509 | 499 | ||
510 | struct Episode | 500 | struct Episode { |
511 | { | ||
512 | int id; | 501 | int id; |
513 | struct Episode *next; | 502 | struct Episode *next; |
514 | struct GNUNET_TIME_Relative duration; | 503 | struct GNUNET_TIME_Relative duration; |
@@ -518,8 +507,7 @@ struct Episode | |||
518 | }; | 507 | }; |
519 | 508 | ||
520 | 509 | ||
521 | struct Experiment | 510 | struct Experiment { |
522 | { | ||
523 | char *name; | 511 | char *name; |
524 | char *cfg_file; | 512 | char *cfg_file; |
525 | unsigned long long int num_masters; | 513 | unsigned long long int num_masters; |
@@ -550,7 +538,7 @@ extern struct GNUNET_CONFIGURATION_Handle *cfg; | |||
550 | * @param e_done_cb the experiment is completed | 538 | * @param e_done_cb the experiment is completed |
551 | */ | 539 | */ |
552 | void | 540 | void |
553 | GNUNET_ATS_TEST_experimentation_run ( | 541 | GNUNET_ATS_TEST_experimentation_run( |
554 | struct Experiment *e, | 542 | struct Experiment *e, |
555 | GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb, | 543 | GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb, |
556 | GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb); | 544 | GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb); |
@@ -563,7 +551,7 @@ GNUNET_ATS_TEST_experimentation_run ( | |||
563 | * @return the Experiment or NULL on failure | 551 | * @return the Experiment or NULL on failure |
564 | */ | 552 | */ |
565 | struct Experiment * | 553 | struct Experiment * |
566 | GNUNET_ATS_TEST_experimentation_load (const char *filename); | 554 | GNUNET_ATS_TEST_experimentation_load(const char *filename); |
567 | 555 | ||
568 | 556 | ||
569 | /** | 557 | /** |
@@ -572,15 +560,15 @@ GNUNET_ATS_TEST_experimentation_load (const char *filename); | |||
572 | * @param e the experiment | 560 | * @param e the experiment |
573 | */ | 561 | */ |
574 | void | 562 | void |
575 | GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e); | 563 | GNUNET_ATS_TEST_experimentation_stop(struct Experiment *e); |
576 | 564 | ||
577 | 565 | ||
578 | void | 566 | void |
579 | GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p); | 567 | GNUNET_ATS_TEST_traffic_handle_ping(struct BenchmarkPartner *p); |
580 | 568 | ||
581 | 569 | ||
582 | void | 570 | void |
583 | GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p); | 571 | GNUNET_ATS_TEST_traffic_handle_pong(struct BenchmarkPartner *p); |
584 | 572 | ||
585 | 573 | ||
586 | /** | 574 | /** |
@@ -597,24 +585,24 @@ GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p); | |||
597 | * @return the traffic generator | 585 | * @return the traffic generator |
598 | */ | 586 | */ |
599 | struct TrafficGenerator * | 587 | struct TrafficGenerator * |
600 | GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, | 588 | GNUNET_ATS_TEST_generate_traffic_start(struct BenchmarkPeer *src, |
601 | struct BenchmarkPartner *dest, | 589 | struct BenchmarkPartner *dest, |
602 | enum GeneratorType type, | 590 | enum GeneratorType type, |
603 | unsigned int base_rate, | 591 | unsigned int base_rate, |
604 | unsigned int max_rate, | 592 | unsigned int max_rate, |
605 | struct GNUNET_TIME_Relative period, | 593 | struct GNUNET_TIME_Relative period, |
606 | struct GNUNET_TIME_Relative duration); | 594 | struct GNUNET_TIME_Relative duration); |
607 | 595 | ||
608 | 596 | ||
609 | void | 597 | void |
610 | GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg); | 598 | GNUNET_ATS_TEST_generate_traffic_stop(struct TrafficGenerator *tg); |
611 | 599 | ||
612 | 600 | ||
613 | /** | 601 | /** |
614 | * Stop all traffic generators | 602 | * Stop all traffic generators |
615 | */ | 603 | */ |
616 | void | 604 | void |
617 | GNUNET_ATS_TEST_generate_traffic_stop_all (void); | 605 | GNUNET_ATS_TEST_generate_traffic_stop_all(void); |
618 | 606 | ||
619 | 607 | ||
620 | /** | 608 | /** |
@@ -632,7 +620,7 @@ GNUNET_ATS_TEST_generate_traffic_stop_all (void); | |||
632 | * @return the traffic generator | 620 | * @return the traffic generator |
633 | */ | 621 | */ |
634 | struct PreferenceGenerator * | 622 | struct PreferenceGenerator * |
635 | GNUNET_ATS_TEST_generate_preferences_start ( | 623 | GNUNET_ATS_TEST_generate_preferences_start( |
636 | struct BenchmarkPeer *src, | 624 | struct BenchmarkPeer *src, |
637 | struct BenchmarkPartner *dest, | 625 | struct BenchmarkPartner *dest, |
638 | enum GeneratorType type, | 626 | enum GeneratorType type, |
@@ -644,11 +632,11 @@ GNUNET_ATS_TEST_generate_preferences_start ( | |||
644 | 632 | ||
645 | 633 | ||
646 | void | 634 | void |
647 | GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg); | 635 | GNUNET_ATS_TEST_generate_preferences_stop(struct PreferenceGenerator *pg); |
648 | 636 | ||
649 | 637 | ||
650 | void | 638 | void |
651 | GNUNET_ATS_TEST_generate_preferences_stop_all (void); | 639 | GNUNET_ATS_TEST_generate_preferences_stop_all(void); |
652 | 640 | ||
653 | 641 | ||
654 | /** | 642 | /** |
@@ -663,12 +651,12 @@ GNUNET_ATS_TEST_generate_preferences_stop_all (void); | |||
663 | * @return the logging handle or NULL on error | 651 | * @return the logging handle or NULL on error |
664 | */ | 652 | */ |
665 | struct LoggingHandle * | 653 | struct LoggingHandle * |
666 | GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, | 654 | GNUNET_ATS_TEST_logging_start(struct GNUNET_TIME_Relative log_frequency, |
667 | const char *testname, | 655 | const char *testname, |
668 | struct BenchmarkPeer *masters, | 656 | struct BenchmarkPeer *masters, |
669 | int num_masters, | 657 | int num_masters, |
670 | int num_slaves, | 658 | int num_slaves, |
671 | int verbose); | 659 | int verbose); |
672 | 660 | ||
673 | 661 | ||
674 | /** | 662 | /** |
@@ -677,7 +665,7 @@ GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, | |||
677 | * @param l the logging handle | 665 | * @param l the logging handle |
678 | */ | 666 | */ |
679 | void | 667 | void |
680 | GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l); | 668 | GNUNET_ATS_TEST_logging_clean_up(struct LoggingHandle *l); |
681 | 669 | ||
682 | 670 | ||
683 | /** | 671 | /** |
@@ -686,7 +674,7 @@ GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l); | |||
686 | * @param l the logging handle | 674 | * @param l the logging handle |
687 | */ | 675 | */ |
688 | void | 676 | void |
689 | GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l); | 677 | GNUNET_ATS_TEST_logging_stop(struct LoggingHandle *l); |
690 | 678 | ||
691 | 679 | ||
692 | /** | 680 | /** |
@@ -695,7 +683,7 @@ GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l); | |||
695 | * @param l logging handle to use | 683 | * @param l logging handle to use |
696 | */ | 684 | */ |
697 | void | 685 | void |
698 | GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l); | 686 | GNUNET_ATS_TEST_logging_now(struct LoggingHandle *l); |
699 | 687 | ||
700 | 688 | ||
701 | /** | 689 | /** |
@@ -706,20 +694,20 @@ GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l); | |||
706 | * @param plots create gnuplots: #GNUNET_YES or #GNUNET_NO | 694 | * @param plots create gnuplots: #GNUNET_YES or #GNUNET_NO |
707 | */ | 695 | */ |
708 | void | 696 | void |
709 | GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, | 697 | GNUNET_ATS_TEST_logging_write_to_file(struct LoggingHandle *l, |
710 | const char *test_name, | 698 | const char *test_name, |
711 | int plots); | 699 | int plots); |
712 | 700 | ||
713 | 701 | ||
714 | /** | 702 | /** |
715 | * Topology related functions | 703 | * Topology related functions |
716 | */ | 704 | */ |
717 | struct BenchmarkPeer * | 705 | struct BenchmarkPeer * |
718 | GNUNET_ATS_TEST_get_peer (int src); | 706 | GNUNET_ATS_TEST_get_peer(int src); |
719 | 707 | ||
720 | 708 | ||
721 | struct BenchmarkPartner * | 709 | struct BenchmarkPartner * |
722 | GNUNET_ATS_TEST_get_partner (int src, int dest); | 710 | GNUNET_ATS_TEST_get_partner(int src, int dest); |
723 | 711 | ||
724 | 712 | ||
725 | /** | 713 | /** |
@@ -736,7 +724,7 @@ GNUNET_ATS_TEST_get_partner (int src, int dest); | |||
736 | * @param log_request_cb callback to call when logging is required | 724 | * @param log_request_cb callback to call when logging is required |
737 | */ | 725 | */ |
738 | void | 726 | void |
739 | GNUNET_ATS_TEST_create_topology ( | 727 | GNUNET_ATS_TEST_create_topology( |
740 | char *name, | 728 | char *name, |
741 | char *cfg_file, | 729 | char *cfg_file, |
742 | unsigned int num_slaves, | 730 | unsigned int num_slaves, |
@@ -751,7 +739,7 @@ GNUNET_ATS_TEST_create_topology ( | |||
751 | * Shutdown topology | 739 | * Shutdown topology |
752 | */ | 740 | */ |
753 | void | 741 | void |
754 | GNUNET_ATS_TEST_shutdown_topology (void); | 742 | GNUNET_ATS_TEST_shutdown_topology(void); |
755 | 743 | ||
756 | 744 | ||
757 | /* end of file ats-testing.h */ | 745 | /* end of file ats-testing.h */ |