diff options
Diffstat (limited to 'src/testing/testing_api_loop.c')
-rw-r--r-- | src/testing/testing_api_loop.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c index d7456b91f..7d76979dc 100644 --- a/src/testing/testing_api_loop.c +++ b/src/testing/testing_api_loop.c | |||
@@ -665,6 +665,27 @@ GNUNET_TESTING_send_message_to_netjail (struct GNUNET_TESTING_Interpreter *is, | |||
665 | is); | 665 | is); |
666 | } | 666 | } |
667 | 667 | ||
668 | void | ||
669 | TST_interpreter_send_barrier_advance (struct GNUNET_TESTING_Interpreter *is, | ||
670 | const char *barrier_name, | ||
671 | unsigned int global_node_number) | ||
672 | { | ||
673 | struct CommandBarrierAdvanced *adm = GNUNET_new (struct | ||
674 | CommandBarrierAdvanced); | ||
675 | size_t msg_length = sizeof(struct CommandBarrierAdvanced); | ||
676 | size_t name_len; | ||
677 | |||
678 | name_len = strlen (barrier_name) + 1; | ||
679 | adm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ADVANCED); | ||
680 | adm->header.size = htons ((uint16_t) msg_length); | ||
681 | memcpy (&adm[1], barrier_name, name_len); | ||
682 | GNUNET_TESTING_send_message_to_netjail (is, | ||
683 | global_node_number, | ||
684 | &adm->header); | ||
685 | GNUNET_free (adm); | ||
686 | } | ||
687 | |||
688 | |||
668 | 689 | ||
669 | int | 690 | int |
670 | free_barrier_node_cb (void *cls, | 691 | free_barrier_node_cb (void *cls, |
@@ -678,9 +699,9 @@ free_barrier_node_cb (void *cls, | |||
678 | 699 | ||
679 | if (GNUNET_NO == is->finishing) | 700 | if (GNUNET_NO == is->finishing) |
680 | { | 701 | { |
681 | GNUNET_TESTING_send_barrier_advance (is, | 702 | TST_interpreter_send_barrier_advance (is, |
682 | barrier->name, | 703 | barrier->name, |
683 | node->node_number); | 704 | node->node_number); |
684 | } | 705 | } |
685 | GNUNET_CONTAINER_multishortmap_remove (barrier->nodes, key, node); | 706 | GNUNET_CONTAINER_multishortmap_remove (barrier->nodes, key, node); |
686 | return GNUNET_YES; | 707 | return GNUNET_YES; |
@@ -695,7 +716,7 @@ free_barrier_node_cb (void *cls, | |||
695 | * @return The barrier. | 716 | * @return The barrier. |
696 | */ | 717 | */ |
697 | struct GNUNET_TESTING_Barrier * | 718 | struct GNUNET_TESTING_Barrier * |
698 | GNUNET_TESTING_get_barrier (struct GNUNET_TESTING_Interpreter *is, | 719 | TST_interpreter_get_barrier (struct GNUNET_TESTING_Interpreter *is, |
699 | const char *barrier_name) | 720 | const char *barrier_name) |
700 | { | 721 | { |
701 | struct GNUNET_HashCode hc; | 722 | struct GNUNET_HashCode hc; |
@@ -718,12 +739,12 @@ GNUNET_TESTING_get_barrier (struct GNUNET_TESTING_Interpreter *is, | |||
718 | * @param barrier The barrier in question. | 739 | * @param barrier The barrier in question. |
719 | */ | 740 | */ |
720 | void | 741 | void |
721 | GNUNET_TESTING_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is, | 742 | TST_interpreter_finish_attached_cmds (struct GNUNET_TESTING_Interpreter *is, |
722 | const char *barrier_name) | 743 | const char *barrier_name) |
723 | { | 744 | { |
724 | struct CommandListEntry *pos; | 745 | struct CommandListEntry *pos; |
725 | struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls; | 746 | struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls; |
726 | struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is, | 747 | struct GNUNET_TESTING_Barrier *barrier = TST_interpreter_get_barrier (is, |
727 | barrier_name); | 748 | barrier_name); |
728 | 749 | ||
729 | while (NULL != (pos = barrier->cmds_head)) | 750 | while (NULL != (pos = barrier->cmds_head)) |
@@ -783,14 +804,13 @@ free_barriers_cb (void *cls, | |||
783 | return GNUNET_YES; | 804 | return GNUNET_YES; |
784 | } | 805 | } |
785 | 806 | ||
786 | |||
787 | /** | 807 | /** |
788 | * Deleting all barriers create in the context of this interpreter. | 808 | * Deleting all barriers create in the context of this interpreter. |
789 | * | 809 | * |
790 | * @param is The interpreter. | 810 | * @param is The interpreter. |
791 | */ | 811 | */ |
792 | void | 812 | void |
793 | GNUNET_TESTING_delete_barriers (struct GNUNET_TESTING_Interpreter *is) | 813 | TST_interpreter_delete_barriers (struct GNUNET_TESTING_Interpreter *is) |
794 | { | 814 | { |
795 | GNUNET_CONTAINER_multishortmap_iterate (is->barriers, | 815 | GNUNET_CONTAINER_multishortmap_iterate (is->barriers, |
796 | free_barriers_cb, | 816 | free_barriers_cb, |
@@ -806,7 +826,7 @@ GNUNET_TESTING_delete_barriers (struct GNUNET_TESTING_Interpreter *is) | |||
806 | * @param barrier The barrier to add. | 826 | * @param barrier The barrier to add. |
807 | */ | 827 | */ |
808 | void | 828 | void |
809 | GNUNET_TESTING_interpreter_add_barrier (struct GNUNET_TESTING_Interpreter *is, | 829 | TST_interpreter_add_barrier (struct GNUNET_TESTING_Interpreter *is, |
810 | struct GNUNET_TESTING_Barrier *barrier) | 830 | struct GNUNET_TESTING_Barrier *barrier) |
811 | { | 831 | { |
812 | struct GNUNET_HashCode hc; | 832 | struct GNUNET_HashCode hc; |