aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tests/ats-testing.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ats-tests/ats-testing.h')
-rw-r--r--src/ats-tests/ats-testing.h128
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
51struct TestMessage 51struct 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
67struct LoggingHandle; 66struct LoggingHandle;
68 67
69enum GeneratorType 68enum 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 */
111struct BenchmarkPeer 109struct 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
230struct TrafficGenerator 227struct 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
250struct PreferenceGenerator 246struct 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 */
275struct BenchmarkPartner 270struct 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 */
362struct BenchmarkState 356struct 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
391struct GNUNET_ATS_TEST_Topology 384struct 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
470enum OperationType 462enum 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 */
492struct GNUNET_ATS_TEST_Operation 483struct 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
510struct Episode 500struct 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
521struct Experiment 510struct 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 */
552void 540void
553GNUNET_ATS_TEST_experimentation_run ( 541GNUNET_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 */
565struct Experiment * 553struct Experiment *
566GNUNET_ATS_TEST_experimentation_load (const char *filename); 554GNUNET_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 */
574void 562void
575GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e); 563GNUNET_ATS_TEST_experimentation_stop(struct Experiment *e);
576 564
577 565
578void 566void
579GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p); 567GNUNET_ATS_TEST_traffic_handle_ping(struct BenchmarkPartner *p);
580 568
581 569
582void 570void
583GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p); 571GNUNET_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 */
599struct TrafficGenerator * 587struct TrafficGenerator *
600GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, 588GNUNET_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
609void 597void
610GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg); 598GNUNET_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 */
616void 604void
617GNUNET_ATS_TEST_generate_traffic_stop_all (void); 605GNUNET_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 */
634struct PreferenceGenerator * 622struct PreferenceGenerator *
635GNUNET_ATS_TEST_generate_preferences_start ( 623GNUNET_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
646void 634void
647GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg); 635GNUNET_ATS_TEST_generate_preferences_stop(struct PreferenceGenerator *pg);
648 636
649 637
650void 638void
651GNUNET_ATS_TEST_generate_preferences_stop_all (void); 639GNUNET_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 */
665struct LoggingHandle * 653struct LoggingHandle *
666GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, 654GNUNET_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 */
679void 667void
680GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l); 668GNUNET_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 */
688void 676void
689GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l); 677GNUNET_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 */
697void 685void
698GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l); 686GNUNET_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 */
708void 696void
709GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, 697GNUNET_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 */
717struct BenchmarkPeer * 705struct BenchmarkPeer *
718GNUNET_ATS_TEST_get_peer (int src); 706GNUNET_ATS_TEST_get_peer(int src);
719 707
720 708
721struct BenchmarkPartner * 709struct BenchmarkPartner *
722GNUNET_ATS_TEST_get_partner (int src, int dest); 710GNUNET_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 */
738void 726void
739GNUNET_ATS_TEST_create_topology ( 727GNUNET_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 */
753void 741void
754GNUNET_ATS_TEST_shutdown_topology (void); 742GNUNET_ATS_TEST_shutdown_topology(void);
755 743
756 744
757/* end of file ats-testing.h */ 745/* end of file ats-testing.h */