diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-29 20:32:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-29 20:32:23 +0000 |
commit | 0cd2efeadb67206c0b3e8f1ba743ff342b18926b (patch) | |
tree | ee5e46113366e26a25b9691ebdb3e49666dc8ddd /src/ats-tests/ats-testing.h | |
parent | 1e2d3aaecc2a4130e35d46a7c03b9d80d34d6673 (diff) | |
download | gnunet-0cd2efeadb67206c0b3e8f1ba743ff342b18926b.tar.gz gnunet-0cd2efeadb67206c0b3e8f1ba743ff342b18926b.zip |
-migrating ATS tests to new transport (and core) API; core tests disabled as new core API doesn't exist yet
Diffstat (limited to 'src/ats-tests/ats-testing.h')
-rw-r--r-- | src/ats-tests/ats-testing.h | 85 |
1 files changed, 51 insertions, 34 deletions
diff --git a/src/ats-tests/ats-testing.h b/src/ats-tests/ats-testing.h index c6e679b0b..de189953e 100644 --- a/src/ats-tests/ats-testing.h +++ b/src/ats-tests/ats-testing.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "gnunet_testbed_service.h" | 28 | #include "gnunet_testbed_service.h" |
29 | #include "gnunet_ats_service.h" | 29 | #include "gnunet_ats_service.h" |
30 | #include "gnunet_core_service.h" | 30 | #include "gnunet_core_service.h" |
31 | #include "gnunet_transport_core_service.h" | ||
31 | 32 | ||
32 | #define TEST_ATS_PREFERENCE_DEFAULT 1.0 | 33 | #define TEST_ATS_PREFERENCE_DEFAULT 1.0 |
33 | 34 | ||
@@ -46,6 +47,15 @@ | |||
46 | */ | 47 | */ |
47 | #define TEST_MESSAGE_SIZE 100 | 48 | #define TEST_MESSAGE_SIZE 100 |
48 | 49 | ||
50 | |||
51 | struct TestMessage | ||
52 | { | ||
53 | struct GNUNET_MessageHeader header; | ||
54 | |||
55 | uint8_t padding[TEST_MESSAGE_SIZE - sizeof (struct GNUNET_MessageHeader)]; | ||
56 | }; | ||
57 | |||
58 | |||
49 | struct BenchmarkPartner; | 59 | struct BenchmarkPartner; |
50 | 60 | ||
51 | struct BenchmarkPeer; | 61 | struct BenchmarkPeer; |
@@ -147,14 +157,14 @@ struct BenchmarkPeer | |||
147 | struct TestbedConnectOperation *core_connect_ops; | 157 | struct TestbedConnectOperation *core_connect_ops; |
148 | 158 | ||
149 | /** | 159 | /** |
150 | * Core handle | 160 | * Core handle |
151 | */ | 161 | */ |
152 | struct GNUNET_CORE_Handle *ch; | 162 | struct GNUNET_CORE_Handle *ch; |
153 | 163 | ||
154 | /** | 164 | /** |
155 | * Core handle | 165 | * Transport handle |
156 | */ | 166 | */ |
157 | struct GNUNET_TRANSPORT_Handle *th; | 167 | struct GNUNET_TRANSPORT_CoreHandle *th; |
158 | 168 | ||
159 | /** | 169 | /** |
160 | * Masters only: | 170 | * Masters only: |
@@ -280,10 +290,9 @@ struct BenchmarkPartner | |||
280 | struct GNUNET_CORE_TransmitHandle *cth; | 290 | struct GNUNET_CORE_TransmitHandle *cth; |
281 | 291 | ||
282 | /** | 292 | /** |
283 | * Transport transmit handles | 293 | * Message queue handle. |
284 | */ | 294 | */ |
285 | struct GNUNET_TRANSPORT_TransmitHandle *tth; | 295 | struct GNUNET_MQ_Handle *mq; |
286 | |||
287 | 296 | ||
288 | /** | 297 | /** |
289 | * Handle for traffic generator | 298 | * Handle for traffic generator |
@@ -325,24 +334,34 @@ struct BenchmarkPartner | |||
325 | */ | 334 | */ |
326 | unsigned int bytes_received; | 335 | unsigned int bytes_received; |
327 | 336 | ||
328 | /* Current ATS properties */ | 337 | /** |
338 | * Current ATS properties | ||
339 | */ | ||
329 | struct GNUNET_ATS_Properties props; | 340 | struct GNUNET_ATS_Properties props; |
330 | 341 | ||
331 | /* Bandwidth assigned inbound */ | 342 | /** |
343 | * Bandwidth assigned inbound | ||
344 | */ | ||
332 | uint32_t bandwidth_in; | 345 | uint32_t bandwidth_in; |
333 | 346 | ||
334 | /* Bandwidth assigned outbound */ | 347 | /** |
348 | * Bandwidth assigned outbound | ||
349 | */ | ||
335 | uint32_t bandwidth_out; | 350 | uint32_t bandwidth_out; |
336 | 351 | ||
337 | /* Current preference values for bandwidth */ | 352 | /** |
353 | * Current preference values for bandwidth | ||
354 | */ | ||
338 | double pref_bandwidth; | 355 | double pref_bandwidth; |
339 | 356 | ||
340 | /* Current preference values for delay */ | 357 | /** |
358 | * Current preference values for delay | ||
359 | */ | ||
341 | double pref_delay; | 360 | double pref_delay; |
342 | 361 | ||
343 | |||
344 | }; | 362 | }; |
345 | 363 | ||
364 | |||
346 | /** | 365 | /** |
347 | * Overall state of the performance benchmark | 366 | * Overall state of the performance benchmark |
348 | */ | 367 | */ |
@@ -387,7 +406,8 @@ struct GNUNET_ATS_TEST_Topology | |||
387 | */ | 406 | */ |
388 | int result; | 407 | int result; |
389 | 408 | ||
390 | /**Test core (GNUNET_YES) or transport (GNUNET_NO) | 409 | /** |
410 | * Test core (#GNUNET_YES) or transport (#GNUNET_NO) | ||
391 | */ | 411 | */ |
392 | int test_core; | 412 | int test_core; |
393 | 413 | ||
@@ -446,10 +466,10 @@ struct GNUNET_ATS_TEST_Topology | |||
446 | */ | 466 | */ |
447 | struct BenchmarkState state; | 467 | struct BenchmarkState state; |
448 | 468 | ||
449 | struct GNUNET_CORE_MessageHandler *handlers; | ||
450 | |||
451 | GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb; | 469 | GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb; |
470 | |||
452 | GNUNET_ATS_AddressInformationCallback ats_perf_cb; | 471 | GNUNET_ATS_AddressInformationCallback ats_perf_cb; |
472 | |||
453 | void *done_cb_cls; | 473 | void *done_cb_cls; |
454 | }; | 474 | }; |
455 | 475 | ||
@@ -465,11 +485,13 @@ struct Episode; | |||
465 | 485 | ||
466 | struct Experiment; | 486 | struct Experiment; |
467 | 487 | ||
468 | typedef void (*GNUNET_ATS_TESTING_EpisodeDoneCallback) ( | 488 | typedef void |
469 | struct Episode *e); | 489 | (*GNUNET_ATS_TESTING_EpisodeDoneCallback) (struct Episode *e); |
470 | 490 | ||
471 | typedef void (*GNUNET_ATS_TESTING_ExperimentDoneCallback) (struct Experiment *e, | 491 | typedef void |
472 | struct GNUNET_TIME_Relative duration,int success); | 492 | (*GNUNET_ATS_TESTING_ExperimentDoneCallback) (struct Experiment *e, |
493 | struct GNUNET_TIME_Relative duration, | ||
494 | int success); | ||
473 | 495 | ||
474 | /** | 496 | /** |
475 | * An operation in an experiment | 497 | * An operation in an experiment |
@@ -524,9 +546,7 @@ struct Experiment | |||
524 | GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb; | 546 | GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb; |
525 | }; | 547 | }; |
526 | 548 | ||
527 | /* | 549 | |
528 | * Experiment related functions | ||
529 | */ | ||
530 | extern struct GNUNET_CONFIGURATION_Handle *cfg; | 550 | extern struct GNUNET_CONFIGURATION_Handle *cfg; |
531 | 551 | ||
532 | /** | 552 | /** |
@@ -560,13 +580,11 @@ GNUNET_ATS_TEST_experimentation_load (const char *filename); | |||
560 | void | 580 | void |
561 | GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e); | 581 | GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e); |
562 | 582 | ||
563 | /* | ||
564 | * Traffic related functions | ||
565 | */ | ||
566 | 583 | ||
567 | void | 584 | void |
568 | GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p); | 585 | GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p); |
569 | 586 | ||
587 | |||
570 | void | 588 | void |
571 | GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p); | 589 | GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p); |
572 | 590 | ||
@@ -597,6 +615,7 @@ GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, | |||
597 | void | 615 | void |
598 | GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg); | 616 | GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg); |
599 | 617 | ||
618 | |||
600 | /** | 619 | /** |
601 | * Stop all traffic generators | 620 | * Stop all traffic generators |
602 | */ | 621 | */ |
@@ -628,6 +647,7 @@ GNUNET_ATS_TEST_generate_preferences_start (struct BenchmarkPeer *src, | |||
628 | struct GNUNET_TIME_Relative frequency, | 647 | struct GNUNET_TIME_Relative frequency, |
629 | enum GNUNET_ATS_PreferenceKind kind); | 648 | enum GNUNET_ATS_PreferenceKind kind); |
630 | 649 | ||
650 | |||
631 | void | 651 | void |
632 | GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg); | 652 | GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg); |
633 | 653 | ||
@@ -635,9 +655,6 @@ GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg); | |||
635 | void | 655 | void |
636 | GNUNET_ATS_TEST_generate_preferences_stop_all (void); | 656 | GNUNET_ATS_TEST_generate_preferences_stop_all (void); |
637 | 657 | ||
638 | /* | ||
639 | * Logging related functions | ||
640 | */ | ||
641 | 658 | ||
642 | /** | 659 | /** |
643 | * Start logging | 660 | * Start logging |
@@ -651,12 +668,12 @@ GNUNET_ATS_TEST_generate_preferences_stop_all (void); | |||
651 | * @return the logging handle or NULL on error | 668 | * @return the logging handle or NULL on error |
652 | */ | 669 | */ |
653 | struct LoggingHandle * | 670 | struct LoggingHandle * |
654 | GNUNET_ATS_TEST_logging_start(struct GNUNET_TIME_Relative log_frequency, | 671 | GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, |
655 | const char *testname, | 672 | const char *testname, |
656 | struct BenchmarkPeer *masters, | 673 | struct BenchmarkPeer *masters, |
657 | int num_masters, | 674 | int num_masters, |
658 | int num_slaves, | 675 | int num_slaves, |
659 | int verbose); | 676 | int verbose); |
660 | 677 | ||
661 | 678 | ||
662 | /** | 679 | /** |