diff options
author | Gabor X Toth <*@tg-x.net> | 2016-01-12 23:26:47 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2016-01-12 23:26:47 +0000 |
commit | 50eaf8d7de763d25b7dae7ffdee8d7c6b5fe71ea (patch) | |
tree | a8023bdb9c9446a45792d7100303265c78713a50 /src/psyc | |
parent | 3cbdbe18dbd56def00c0014381ff90b4ee664904 (diff) | |
download | gnunet-50eaf8d7de763d25b7dae7ffdee8d7c6b5fe71ea.tar.gz gnunet-50eaf8d7de763d25b7dae7ffdee8d7c6b5fe71ea.zip |
psycutil reorg: message, env, slicer
Diffstat (limited to 'src/psyc')
-rw-r--r-- | src/psyc/Makefile.am | 8 | ||||
-rw-r--r-- | src/psyc/gnunet-service-psyc.c | 2 | ||||
-rw-r--r-- | src/psyc/psyc_api.c | 1 | ||||
-rw-r--r-- | src/psyc/test_psyc.c | 37 |
4 files changed, 22 insertions, 26 deletions
diff --git a/src/psyc/Makefile.am b/src/psyc/Makefile.am index 4bb28ce0a..e00537e73 100644 --- a/src/psyc/Makefile.am +++ b/src/psyc/Makefile.am | |||
@@ -24,8 +24,7 @@ libgnunetpsyc_la_SOURCES = \ | |||
24 | psyc_api.c psyc.h | 24 | psyc_api.c psyc.h |
25 | libgnunetpsyc_la_LIBADD = \ | 25 | libgnunetpsyc_la_LIBADD = \ |
26 | $(top_builddir)/src/util/libgnunetutil.la \ | 26 | $(top_builddir)/src/util/libgnunetutil.la \ |
27 | $(top_builddir)/src/env/libgnunetenv.la \ | 27 | $(top_builddir)/src/psycutil/libgnunetpsycutil.la \ |
28 | $(top_builddir)/src/psycstore/libgnunetpsycutil.la \ | ||
29 | $(GN_LIBINTL) $(XLIB) | 28 | $(GN_LIBINTL) $(XLIB) |
30 | libgnunetpsyc_la_LDFLAGS = \ | 29 | libgnunetpsyc_la_LDFLAGS = \ |
31 | $(GN_LIB_LDFLAGS) $(WINFLAGS) \ | 30 | $(GN_LIB_LDFLAGS) $(WINFLAGS) \ |
@@ -43,7 +42,7 @@ gnunet_service_psyc_LDADD = \ | |||
43 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 42 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
44 | $(top_builddir)/src/multicast/libgnunetmulticast.la \ | 43 | $(top_builddir)/src/multicast/libgnunetmulticast.la \ |
45 | $(top_builddir)/src/psycstore/libgnunetpsycstore.la \ | 44 | $(top_builddir)/src/psycstore/libgnunetpsycstore.la \ |
46 | $(top_builddir)/src/psycstore/libgnunetpsycutil.la \ | 45 | $(top_builddir)/src/psycutil/libgnunetpsycutil.la \ |
47 | $(GN_LIBINTL) | 46 | $(GN_LIBINTL) |
48 | gnunet_service_psyc_CFLAGS = $(AM_CFLAGS) | 47 | gnunet_service_psyc_CFLAGS = $(AM_CFLAGS) |
49 | 48 | ||
@@ -62,10 +61,9 @@ test_psyc_SOURCES = \ | |||
62 | test_psyc.c | 61 | test_psyc.c |
63 | test_psyc_LDADD = \ | 62 | test_psyc_LDADD = \ |
64 | libgnunetpsyc.la \ | 63 | libgnunetpsyc.la \ |
65 | $(top_builddir)/src/psycstore/libgnunetpsycutil.la \ | 64 | $(top_builddir)/src/psycutil/libgnunetpsycutil.la \ |
66 | $(top_builddir)/src/testing/libgnunettesting.la \ | 65 | $(top_builddir)/src/testing/libgnunettesting.la \ |
67 | $(top_builddir)/src/core/libgnunetcore.la \ | 66 | $(top_builddir)/src/core/libgnunetcore.la \ |
68 | $(top_builddir)/src/env/libgnunetenv.la \ | ||
69 | $(top_builddir)/src/util/libgnunetutil.la | 67 | $(top_builddir)/src/util/libgnunetutil.la |
70 | 68 | ||
71 | EXTRA_DIST = \ | 69 | EXTRA_DIST = \ |
diff --git a/src/psyc/gnunet-service-psyc.c b/src/psyc/gnunet-service-psyc.c index e9727c485..827f3d79b 100644 --- a/src/psyc/gnunet-service-psyc.c +++ b/src/psyc/gnunet-service-psyc.c | |||
@@ -2477,7 +2477,7 @@ store_recv_state_var (void *cls, const char *name, | |||
2477 | mod->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER); | 2477 | mod->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER); |
2478 | mod->name_size = htons (name_size); | 2478 | mod->name_size = htons (name_size); |
2479 | mod->value_size = htonl (value_size); | 2479 | mod->value_size = htonl (value_size); |
2480 | mod->oper = htons (GNUNET_ENV_OP_ASSIGN); | 2480 | mod->oper = htons (GNUNET_PSYC_OP_ASSIGN); |
2481 | memcpy (&mod[1], name, name_size); | 2481 | memcpy (&mod[1], name, name_size); |
2482 | memcpy (((char *) &mod[1]) + name_size, value, value_size); | 2482 | memcpy (((char *) &mod[1]) + name_size, value, value_size); |
2483 | } | 2483 | } |
diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c index 8152fc47f..c9d74f3c8 100644 --- a/src/psyc/psyc_api.c +++ b/src/psyc/psyc_api.c | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | #include "platform.h" | 35 | #include "platform.h" |
36 | #include "gnunet_util_lib.h" | 36 | #include "gnunet_util_lib.h" |
37 | #include "gnunet_env_lib.h" | ||
38 | #include "gnunet_multicast_service.h" | 37 | #include "gnunet_multicast_service.h" |
39 | #include "gnunet_psyc_service.h" | 38 | #include "gnunet_psyc_service.h" |
40 | #include "gnunet_psyc_util_lib.h" | 39 | #include "gnunet_psyc_util_lib.h" |
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++) |