diff options
Diffstat (limited to 'src/psyc/test_psyc.c')
-rw-r--r-- | src/psyc/test_psyc.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/psyc/test_psyc.c b/src/psyc/test_psyc.c index f167e2697..74e27a48f 100644 --- a/src/psyc/test_psyc.c +++ b/src/psyc/test_psyc.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include "gnunet_common.h" | 32 | #include "gnunet_common.h" |
33 | #include "gnunet_util_lib.h" | 33 | #include "gnunet_util_lib.h" |
34 | #include "gnunet_testing_lib.h" | 34 | #include "gnunet_testing_lib.h" |
35 | #include "gnunet_env_lib.h" | ||
36 | #include "gnunet_psyc_util_lib.h" | 35 | #include "gnunet_psyc_util_lib.h" |
37 | #include "gnunet_psyc_service.h" | 36 | #include "gnunet_psyc_service.h" |
38 | #include "gnunet_core_service.h" | 37 | #include "gnunet_core_service.h" |
@@ -69,8 +68,8 @@ struct TransmitClosure | |||
69 | { | 68 | { |
70 | struct GNUNET_PSYC_MasterTransmitHandle *mst_tmit; | 69 | struct GNUNET_PSYC_MasterTransmitHandle *mst_tmit; |
71 | struct GNUNET_PSYC_SlaveTransmitHandle *slv_tmit; | 70 | struct GNUNET_PSYC_SlaveTransmitHandle *slv_tmit; |
72 | struct GNUNET_ENV_Environment *env; | 71 | struct GNUNET_PSYC_Environment *env; |
73 | struct GNUNET_ENV_Modifier *mod; | 72 | struct GNUNET_PSYC_Modifier *mod; |
74 | char *data[16]; | 73 | char *data[16]; |
75 | const char *mod_value; | 74 | const char *mod_value; |
76 | size_t mod_value_size; | 75 | size_t mod_value_size; |
@@ -116,7 +115,7 @@ void master_stopped (void *cls) | |||
116 | { | 115 | { |
117 | if (NULL != tmit) | 116 | if (NULL != tmit) |
118 | { | 117 | { |
119 | GNUNET_ENV_environment_destroy (tmit->env); | 118 | GNUNET_PSYC_env_destroy (tmit->env); |
120 | GNUNET_free (tmit); | 119 | GNUNET_free (tmit); |
121 | tmit = NULL; | 120 | tmit = NULL; |
122 | } | 121 | } |
@@ -617,7 +616,7 @@ tmit_notify_mod (void *cls, uint16_t *data_size, void *data, uint8_t *oper, | |||
617 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 616 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
618 | "Test #%d: Transmit notify modifier: %lu bytes available, " | 617 | "Test #%d: Transmit notify modifier: %lu bytes available, " |
619 | "%u modifiers left to process.\n", | 618 | "%u modifiers left to process.\n", |
620 | test, *data_size, GNUNET_ENV_environment_get_count (tmit->env)); | 619 | test, *data_size, GNUNET_PSYC_env_get_count (tmit->env)); |
621 | 620 | ||
622 | uint16_t name_size = 0; | 621 | uint16_t name_size = 0; |
623 | size_t value_size = 0; | 622 | size_t value_size = 0; |
@@ -697,12 +696,12 @@ slave_transmit () | |||
697 | "Test #%d: Slave sending request to master.\n", test); | 696 | "Test #%d: Slave sending request to master.\n", test); |
698 | 697 | ||
699 | tmit = GNUNET_new (struct TransmitClosure); | 698 | tmit = GNUNET_new (struct TransmitClosure); |
700 | tmit->env = GNUNET_ENV_environment_create (); | 699 | tmit->env = GNUNET_PSYC_env_create (); |
701 | GNUNET_ENV_environment_add (tmit->env, GNUNET_ENV_OP_ASSIGN, | 700 | GNUNET_PSYC_env_add (tmit->env, GNUNET_PSYC_OP_ASSIGN, |
702 | "_abc", "abc def", 7); | 701 | "_abc", "abc def", 7); |
703 | GNUNET_ENV_environment_add (tmit->env, GNUNET_ENV_OP_ASSIGN, | 702 | GNUNET_PSYC_env_add (tmit->env, GNUNET_PSYC_OP_ASSIGN, |
704 | "_abc_def", "abc def ghi", 11); | 703 | "_abc_def", "abc def ghi", 11); |
705 | tmit->mod = GNUNET_ENV_environment_head (tmit->env); | 704 | tmit->mod = GNUNET_PSYC_env_head (tmit->env); |
706 | tmit->n = 0; | 705 | tmit->n = 0; |
707 | tmit->data[0] = "slave test"; | 706 | tmit->data[0] = "slave test"; |
708 | tmit->data_count = 1; | 707 | tmit->data_count = 1; |
@@ -835,10 +834,10 @@ slave_join (int t) | |||
835 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test #%d: Joining slave.\n"); | 834 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test #%d: Joining slave.\n"); |
836 | 835 | ||
837 | struct GNUNET_PeerIdentity origin = this_peer; | 836 | struct GNUNET_PeerIdentity origin = this_peer; |
838 | struct GNUNET_ENV_Environment *env = GNUNET_ENV_environment_create (); | 837 | struct GNUNET_PSYC_Environment *env = GNUNET_PSYC_env_create (); |
839 | GNUNET_ENV_environment_add (env, GNUNET_ENV_OP_ASSIGN, | 838 | GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_ASSIGN, |
840 | "_foo", "bar baz", 7); | 839 | "_foo", "bar baz", 7); |
841 | GNUNET_ENV_environment_add (env, GNUNET_ENV_OP_ASSIGN, | 840 | GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_ASSIGN, |
842 | "_foo_bar", "foo bar baz", 11); | 841 | "_foo_bar", "foo bar baz", 11); |
843 | struct GNUNET_PSYC_Message * | 842 | struct GNUNET_PSYC_Message * |
844 | join_msg = GNUNET_PSYC_message_create ("_request_join", env, "some data", 9); | 843 | join_msg = GNUNET_PSYC_message_create ("_request_join", env, "some data", 9); |
@@ -851,7 +850,7 @@ slave_join (int t) | |||
851 | join_msg); | 850 | join_msg); |
852 | GNUNET_free (join_msg); | 851 | GNUNET_free (join_msg); |
853 | slv_chn = GNUNET_PSYC_slave_get_channel (slv); | 852 | slv_chn = GNUNET_PSYC_slave_get_channel (slv); |
854 | GNUNET_ENV_environment_destroy (env); | 853 | GNUNET_PSYC_env_destroy (env); |
855 | } | 854 | } |
856 | 855 | ||
857 | 856 | ||
@@ -881,20 +880,20 @@ master_transmit () | |||
881 | val_cont[i] = (0 == j % 10000) ? '0' + j / 10000 : '!'; | 880 | val_cont[i] = (0 == j % 10000) ? '0' + j / 10000 : '!'; |
882 | 881 | ||
883 | tmit = GNUNET_new (struct TransmitClosure); | 882 | tmit = GNUNET_new (struct TransmitClosure); |
884 | tmit->env = GNUNET_ENV_environment_create (); | 883 | tmit->env = GNUNET_PSYC_env_create (); |
885 | GNUNET_ENV_environment_add (tmit->env, GNUNET_ENV_OP_ASSIGN, | 884 | GNUNET_PSYC_env_add (tmit->env, GNUNET_PSYC_OP_ASSIGN, |
886 | "_foo", "bar baz", 7); | 885 | "_foo", "bar baz", 7); |
887 | GNUNET_ENV_environment_add (tmit->env, GNUNET_ENV_OP_ASSIGN, | 886 | GNUNET_PSYC_env_add (tmit->env, GNUNET_PSYC_OP_ASSIGN, |
888 | name_max, val_max, | 887 | name_max, val_max, |
889 | GNUNET_PSYC_MODIFIER_MAX_PAYLOAD | 888 | GNUNET_PSYC_MODIFIER_MAX_PAYLOAD |
890 | - name_max_size); | 889 | - name_max_size); |
891 | GNUNET_ENV_environment_add (tmit->env, GNUNET_ENV_OP_ASSIGN, | 890 | GNUNET_PSYC_env_add (tmit->env, GNUNET_PSYC_OP_ASSIGN, |
892 | "_foo_bar", "foo bar baz", 11); | 891 | "_foo_bar", "foo bar baz", 11); |
893 | GNUNET_ENV_environment_add (tmit->env, GNUNET_ENV_OP_ASSIGN, | 892 | GNUNET_PSYC_env_add (tmit->env, GNUNET_PSYC_OP_ASSIGN, |
894 | name_cont, val_cont, | 893 | name_cont, val_cont, |
895 | GNUNET_PSYC_MODIFIER_MAX_PAYLOAD - name_cont_size | 894 | GNUNET_PSYC_MODIFIER_MAX_PAYLOAD - name_cont_size |
896 | + GNUNET_PSYC_MOD_CONT_MAX_PAYLOAD); | 895 | + GNUNET_PSYC_MOD_CONT_MAX_PAYLOAD); |
897 | tmit->mod = GNUNET_ENV_environment_head (tmit->env); | 896 | tmit->mod = GNUNET_PSYC_env_head (tmit->env); |
898 | tmit->data[0] = "foo"; | 897 | tmit->data[0] = "foo"; |
899 | tmit->data[1] = GNUNET_malloc (GNUNET_PSYC_DATA_MAX_PAYLOAD + 1); | 898 | tmit->data[1] = GNUNET_malloc (GNUNET_PSYC_DATA_MAX_PAYLOAD + 1); |
900 | for (i = 0; i < GNUNET_PSYC_DATA_MAX_PAYLOAD; i++) | 899 | for (i = 0; i < GNUNET_PSYC_DATA_MAX_PAYLOAD; i++) |