diff options
Diffstat (limited to 'src/include/gnunet_testing_loop_lib.h')
-rw-r--r-- | src/include/gnunet_testing_loop_lib.h | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/src/include/gnunet_testing_loop_lib.h b/src/include/gnunet_testing_loop_lib.h index e4a7653e8..7e13edfab 100644 --- a/src/include/gnunet_testing_loop_lib.h +++ b/src/include/gnunet_testing_loop_lib.h | |||
@@ -571,24 +571,32 @@ GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, | |||
571 | /** | 571 | /** |
572 | * Create headers for a trait with name @a name for | 572 | * Create headers for a trait with name @a name for |
573 | * statically allocated data of type @a type. | 573 | * statically allocated data of type @a type. |
574 | * | ||
575 | * @param prefix symbol prefix to use | ||
576 | * @param name name of the trait | ||
577 | * @param type data type for the trait | ||
574 | */ | 578 | */ |
575 | #define GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT(name,type) \ | 579 | #define GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT(prefix,name,type) \ |
576 | enum GNUNET_GenericReturnValue \ | 580 | enum GNUNET_GenericReturnValue \ |
577 | GNUNET_TESTING_get_trait_ ## name ( \ | 581 | prefix ## _get_trait_ ## name ( \ |
578 | const struct GNUNET_TESTING_Command *cmd, \ | 582 | const struct GNUNET_TESTING_Command *cmd, \ |
579 | type **ret); \ | 583 | type **ret); \ |
580 | struct GNUNET_TESTING_Trait \ | 584 | struct GNUNET_TESTING_Trait \ |
581 | GNUNET_TESTING_make_trait_ ## name ( \ | 585 | prefix ## _make_trait_ ## name ( \ |
582 | type * value); | 586 | type * value); |
583 | 587 | ||
584 | 588 | ||
585 | /** | 589 | /** |
586 | * Create C implementation for a trait with name @a name for statically | 590 | * Create C implementation for a trait with name @a name for statically |
587 | * allocated data of type @a type. | 591 | * allocated data of type @a type. |
592 | * | ||
593 | * @param prefix symbol prefix to use | ||
594 | * @param name name of the trait | ||
595 | * @param type data type for the trait | ||
588 | */ | 596 | */ |
589 | #define GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT(name,type) \ | 597 | #define GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT(prefix,name,type) \ |
590 | enum GNUNET_GenericReturnValue \ | 598 | enum GNUNET_GenericReturnValue \ |
591 | GNUNET_TESTING_get_trait_ ## name ( \ | 599 | prefix ## _get_trait_ ## name ( \ |
592 | const struct GNUNET_TESTING_Command *cmd, \ | 600 | const struct GNUNET_TESTING_Command *cmd, \ |
593 | type * *ret) \ | 601 | type * *ret) \ |
594 | { \ | 602 | { \ |
@@ -599,7 +607,7 @@ GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, | |||
599 | 0); \ | 607 | 0); \ |
600 | } \ | 608 | } \ |
601 | struct GNUNET_TESTING_Trait \ | 609 | struct GNUNET_TESTING_Trait \ |
602 | GNUNET_TESTING_make_trait_ ## name ( \ | 610 | prefix ## _make_trait_ ## name ( \ |
603 | type * value) \ | 611 | type * value) \ |
604 | { \ | 612 | { \ |
605 | struct GNUNET_TESTING_Trait ret = { \ | 613 | struct GNUNET_TESTING_Trait ret = { \ |
@@ -613,15 +621,19 @@ GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, | |||
613 | /** | 621 | /** |
614 | * Create headers for a trait with name @a name for | 622 | * Create headers for a trait with name @a name for |
615 | * statically allocated data of type @a type. | 623 | * statically allocated data of type @a type. |
624 | * | ||
625 | * @param prefix symbol prefix to use | ||
626 | * @param name name of the trait | ||
627 | * @param type data type for the trait | ||
616 | */ | 628 | */ |
617 | #define GNUNET_TESTING_MAKE_DECL_INDEXED_TRAIT(name,type) \ | 629 | #define GNUNET_TESTING_MAKE_DECL_INDEXED_TRAIT(prefix,name,type) \ |
618 | enum GNUNET_GenericReturnValue \ | 630 | enum GNUNET_GenericReturnValue \ |
619 | GNUNET_TESTING_get_trait_ ## name ( \ | 631 | prefix ## _get_trait_ ## name ( \ |
620 | const struct GNUNET_TESTING_Command *cmd, \ | 632 | const struct GNUNET_TESTING_Command *cmd, \ |
621 | unsigned int index, \ | 633 | unsigned int index, \ |
622 | type **ret); \ | 634 | type **ret); \ |
623 | struct GNUNET_TESTING_Trait \ | 635 | struct GNUNET_TESTING_Trait \ |
624 | GNUNET_TESTING_make_trait_ ## name ( \ | 636 | prefix ## _make_trait_ ## name ( \ |
625 | unsigned int index, \ | 637 | unsigned int index, \ |
626 | type *value); | 638 | type *value); |
627 | 639 | ||
@@ -630,9 +642,9 @@ GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, | |||
630 | * Create C implementation for a trait with name @a name for statically | 642 | * Create C implementation for a trait with name @a name for statically |
631 | * allocated data of type @a type. | 643 | * allocated data of type @a type. |
632 | */ | 644 | */ |
633 | #define GNUNET_TESTING_MAKE_IMPL_INDEXED_TRAIT(name,type) \ | 645 | #define GNUNET_TESTING_MAKE_IMPL_INDEXED_TRAIT(prefix,name,type) \ |
634 | enum GNUNET_GenericReturnValue \ | 646 | enum GNUNET_GenericReturnValue \ |
635 | GNUNET_TESTING_get_trait_ ## name ( \ | 647 | prefix ## _get_trait_ ## name ( \ |
636 | const struct GNUNET_TESTING_Command *cmd, \ | 648 | const struct GNUNET_TESTING_Command *cmd, \ |
637 | unsigned int index, \ | 649 | unsigned int index, \ |
638 | type * *ret) \ | 650 | type * *ret) \ |
@@ -644,7 +656,7 @@ GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, | |||
644 | index); \ | 656 | index); \ |
645 | } \ | 657 | } \ |
646 | struct GNUNET_TESTING_Trait \ | 658 | struct GNUNET_TESTING_Trait \ |
647 | GNUNET_TESTING_make_trait_ ## name ( \ | 659 | prefix ## _make_trait_ ## name ( \ |
648 | unsigned int index, \ | 660 | unsigned int index, \ |
649 | type * value) \ | 661 | type * value) \ |
650 | { \ | 662 | { \ |
@@ -659,21 +671,27 @@ GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, | |||
659 | 671 | ||
660 | /** | 672 | /** |
661 | * Call #op on all simple traits needed by loop logic. | 673 | * Call #op on all simple traits needed by loop logic. |
674 | * | ||
675 | * @param op operation to perform | ||
676 | * @param prefix prefix to pass to @e op | ||
662 | */ | 677 | */ |
663 | #define GNUNET_TESTING_LOOP_SIMPLE_TRAITS(op) \ | 678 | #define GNUNET_TESTING_LOOP_SIMPLE_TRAITS(op,prefix) \ |
664 | op (batch_cmds, struct GNUNET_TESTING_Command *) | 679 | op (prefix, batch_cmds, struct GNUNET_TESTING_Command *) |
665 | 680 | ||
666 | 681 | ||
667 | GNUNET_TESTING_LOOP_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT) | 682 | GNUNET_TESTING_LOOP_SIMPLE_TRAITS(GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_TESTING) |
668 | 683 | ||
669 | 684 | ||
670 | /** | 685 | /** |
671 | * Call #op on all indexed traits needed by loop logic. | 686 | * Call #op on all indexed traits needed by loop logic. |
687 | * | ||
688 | * @param op operation to perform | ||
689 | * @param prefix prefix to pass to @e op | ||
672 | */ | 690 | */ |
673 | #define GNUNET_TESTING_LOOP_INDEXED_TRAITS(op) \ | 691 | #define GNUNET_TESTING_LOOP_INDEXED_TRAITS(op,prefix) \ |
674 | op (cmd, const struct GNUNET_TESTING_Command) | 692 | op (prefix, cmd, const struct GNUNET_TESTING_Command) |
675 | 693 | ||
676 | GNUNET_TESTING_LOOP_INDEXED_TRAITS (GNUNET_TESTING_MAKE_DECL_INDEXED_TRAIT) | 694 | GNUNET_TESTING_LOOP_INDEXED_TRAITS (GNUNET_TESTING_MAKE_DECL_INDEXED_TRAIT, GNUNET_TESTING) |
677 | 695 | ||
678 | 696 | ||
679 | #endif | 697 | #endif |