diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_block_lib.h | 13 | ||||
-rw-r--r-- | src/seti/gnunet-service-seti.c | 20 | ||||
-rw-r--r-- | src/seti/plugin_block_seti_test.c | 44 | ||||
-rw-r--r-- | src/seti/seti_api.c | 8 | ||||
-rw-r--r-- | src/seti/test_seti.conf | 3 | ||||
-rw-r--r-- | src/setu/plugin_block_setu_test.c | 44 |
6 files changed, 79 insertions, 53 deletions
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h index 18ca6f63f..73b51252e 100644 --- a/src/include/gnunet_block_lib.h +++ b/src/include/gnunet_block_lib.h | |||
@@ -137,6 +137,19 @@ enum GNUNET_BLOCK_Type | |||
137 | * Contains either special marker elements or a nested block. | 137 | * Contains either special marker elements or a nested block. |
138 | */ | 138 | */ |
139 | GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT = 25, | 139 | GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT = 25, |
140 | |||
141 | /** | ||
142 | * Block for testing set intersection. If first byte of the block | ||
143 | * is non-zero, the block is considered invalid. | ||
144 | */ | ||
145 | GNUNET_BLOCK_TYPE_SETI_TEST = 24, | ||
146 | |||
147 | /** | ||
148 | * Block for testing set union. If first byte of the block | ||
149 | * is non-zero, the block is considered invalid. | ||
150 | */ | ||
151 | GNUNET_BLOCK_TYPE_SETU_TEST = 24, | ||
152 | |||
140 | }; | 153 | }; |
141 | 154 | ||
142 | 155 | ||
diff --git a/src/seti/gnunet-service-seti.c b/src/seti/gnunet-service-seti.c index 7159a7ba2..618d53128 100644 --- a/src/seti/gnunet-service-seti.c +++ b/src/seti/gnunet-service-seti.c | |||
@@ -519,8 +519,11 @@ send_client_removed_element (struct Operation *op, | |||
519 | struct GNUNET_MQ_Envelope *ev; | 519 | struct GNUNET_MQ_Envelope *ev; |
520 | struct GNUNET_SETI_ResultMessage *rm; | 520 | struct GNUNET_SETI_ResultMessage *rm; |
521 | 521 | ||
522 | if (GNUNET_NO != op->return_intersection) | 522 | if (GNUNET_YES == op->return_intersection) |
523 | { | ||
524 | GNUNET_break (0); | ||
523 | return; /* Wrong mode for transmitting removed elements */ | 525 | return; /* Wrong mode for transmitting removed elements */ |
526 | } | ||
524 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 527 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
525 | "Sending removed element (size %u) to client\n", | 528 | "Sending removed element (size %u) to client\n", |
526 | element->size); | 529 | element->size); |
@@ -1096,6 +1099,11 @@ send_remaining_elements (void *cls) | |||
1096 | const struct GNUNET_SETI_Element *element; | 1099 | const struct GNUNET_SETI_Element *element; |
1097 | int res; | 1100 | int res; |
1098 | 1101 | ||
1102 | if (GNUNET_NO == op->return_intersection) | ||
1103 | { | ||
1104 | GNUNET_break (0); | ||
1105 | return; /* Wrong mode for transmitting removed elements */ | ||
1106 | } | ||
1099 | res = GNUNET_CONTAINER_multihashmap_iterator_next ( | 1107 | res = GNUNET_CONTAINER_multihashmap_iterator_next ( |
1100 | op->full_result_iter, | 1108 | op->full_result_iter, |
1101 | NULL, | 1109 | NULL, |
@@ -2191,6 +2199,7 @@ handle_client_evaluate (void *cls, | |||
2191 | op->salt = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, | 2199 | op->salt = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, |
2192 | UINT32_MAX); | 2200 | UINT32_MAX); |
2193 | op->peer = msg->target_peer; | 2201 | op->peer = msg->target_peer; |
2202 | op->return_intersection = htonl (msg->return_intersection); | ||
2194 | op->client_request_id = ntohl (msg->request_id); | 2203 | op->client_request_id = ntohl (msg->request_id); |
2195 | context = GNUNET_MQ_extract_nested_mh (msg); | 2204 | context = GNUNET_MQ_extract_nested_mh (msg); |
2196 | 2205 | ||
@@ -2354,9 +2363,14 @@ handle_client_accept (void *cls, | |||
2354 | (uint32_t) ntohl (msg->accept_reject_id)); | 2363 | (uint32_t) ntohl (msg->accept_reject_id)); |
2355 | listener = op->listener; | 2364 | listener = op->listener; |
2356 | op->listener = NULL; | 2365 | op->listener = NULL; |
2357 | GNUNET_CONTAINER_DLL_remove (listener->op_head, listener->op_tail, op); | 2366 | op->return_intersection = htonl (msg->return_intersection); |
2367 | GNUNET_CONTAINER_DLL_remove (listener->op_head, | ||
2368 | listener->op_tail, | ||
2369 | op); | ||
2358 | op->set = set; | 2370 | op->set = set; |
2359 | GNUNET_CONTAINER_DLL_insert (set->ops_head, set->ops_tail, op); | 2371 | GNUNET_CONTAINER_DLL_insert (set->ops_head, |
2372 | set->ops_tail, | ||
2373 | op); | ||
2360 | op->client_request_id = ntohl (msg->request_id); | 2374 | op->client_request_id = ntohl (msg->request_id); |
2361 | 2375 | ||
2362 | /* Advance generation values, so that future mutations do not | 2376 | /* Advance generation values, so that future mutations do not |
diff --git a/src/seti/plugin_block_seti_test.c b/src/seti/plugin_block_seti_test.c index 1de086092..55cf31bea 100644 --- a/src/seti/plugin_block_seti_test.c +++ b/src/seti/plugin_block_seti_test.c | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file set/plugin_block_set_test.c | 22 | * @file seti/plugin_block_seti_test.c |
23 | * @brief set test block, recognizes elements with non-zero first byte as invalid | 23 | * @brief set test block, recognizes elements with non-zero first byte as invalid |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
@@ -46,16 +46,16 @@ | |||
46 | * @return characterization of result | 46 | * @return characterization of result |
47 | */ | 47 | */ |
48 | static enum GNUNET_BLOCK_EvaluationResult | 48 | static enum GNUNET_BLOCK_EvaluationResult |
49 | block_plugin_set_test_evaluate (void *cls, | 49 | block_plugin_seti_test_evaluate (void *cls, |
50 | struct GNUNET_BLOCK_Context *ctx, | 50 | struct GNUNET_BLOCK_Context *ctx, |
51 | enum GNUNET_BLOCK_Type type, | 51 | enum GNUNET_BLOCK_Type type, |
52 | struct GNUNET_BLOCK_Group *group, | 52 | struct GNUNET_BLOCK_Group *group, |
53 | enum GNUNET_BLOCK_EvaluationOptions eo, | 53 | enum GNUNET_BLOCK_EvaluationOptions eo, |
54 | const struct GNUNET_HashCode *query, | 54 | const struct GNUNET_HashCode *query, |
55 | const void *xquery, | 55 | const void *xquery, |
56 | size_t xquery_size, | 56 | size_t xquery_size, |
57 | const void *reply_block, | 57 | const void *reply_block, |
58 | size_t reply_block_size) | 58 | size_t reply_block_size) |
59 | { | 59 | { |
60 | if ((NULL == reply_block) || | 60 | if ((NULL == reply_block) || |
61 | (reply_block_size == 0) || | 61 | (reply_block_size == 0) || |
@@ -77,11 +77,11 @@ block_plugin_set_test_evaluate (void *cls, | |||
77 | * (or if extracting a key from a block of this type does not work) | 77 | * (or if extracting a key from a block of this type does not work) |
78 | */ | 78 | */ |
79 | static int | 79 | static int |
80 | block_plugin_set_test_get_key (void *cls, | 80 | block_plugin_seti_test_get_key (void *cls, |
81 | enum GNUNET_BLOCK_Type type, | 81 | enum GNUNET_BLOCK_Type type, |
82 | const void *block, | 82 | const void *block, |
83 | size_t block_size, | 83 | size_t block_size, |
84 | struct GNUNET_HashCode *key) | 84 | struct GNUNET_HashCode *key) |
85 | { | 85 | { |
86 | return GNUNET_SYSERR; | 86 | return GNUNET_SYSERR; |
87 | } | 87 | } |
@@ -91,17 +91,17 @@ block_plugin_set_test_get_key (void *cls, | |||
91 | * Entry point for the plugin. | 91 | * Entry point for the plugin. |
92 | */ | 92 | */ |
93 | void * | 93 | void * |
94 | libgnunet_plugin_block_set_test_init (void *cls) | 94 | libgnunet_plugin_block_seti_test_init (void *cls) |
95 | { | 95 | { |
96 | static enum GNUNET_BLOCK_Type types[] = { | 96 | static enum GNUNET_BLOCK_Type types[] = { |
97 | GNUNET_BLOCK_TYPE_SET_TEST, | 97 | GNUNET_BLOCK_TYPE_SETI_TEST, |
98 | GNUNET_BLOCK_TYPE_ANY /* end of list */ | 98 | GNUNET_BLOCK_TYPE_ANY /* end of list */ |
99 | }; | 99 | }; |
100 | struct GNUNET_BLOCK_PluginFunctions *api; | 100 | struct GNUNET_BLOCK_PluginFunctions *api; |
101 | 101 | ||
102 | api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions); | 102 | api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions); |
103 | api->evaluate = &block_plugin_set_test_evaluate; | 103 | api->evaluate = &block_plugin_seti_test_evaluate; |
104 | api->get_key = &block_plugin_set_test_get_key; | 104 | api->get_key = &block_plugin_seti_test_get_key; |
105 | api->types = types; | 105 | api->types = types; |
106 | return api; | 106 | return api; |
107 | } | 107 | } |
@@ -111,7 +111,7 @@ libgnunet_plugin_block_set_test_init (void *cls) | |||
111 | * Exit point from the plugin. | 111 | * Exit point from the plugin. |
112 | */ | 112 | */ |
113 | void * | 113 | void * |
114 | libgnunet_plugin_block_set_test_done (void *cls) | 114 | libgnunet_plugin_block_seti_test_done (void *cls) |
115 | { | 115 | { |
116 | struct GNUNET_BLOCK_PluginFunctions *api = cls; | 116 | struct GNUNET_BLOCK_PluginFunctions *api = cls; |
117 | 117 | ||
@@ -120,4 +120,4 @@ libgnunet_plugin_block_set_test_done (void *cls) | |||
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | /* end of plugin_block_set_test.c */ | 123 | /* end of plugin_block_seti_test.c */ |
diff --git a/src/seti/seti_api.c b/src/seti/seti_api.c index d80a60684..337b7b219 100644 --- a/src/seti/seti_api.c +++ b/src/seti/seti_api.c | |||
@@ -411,7 +411,7 @@ GNUNET_SETI_create (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
411 | 411 | ||
412 | set->cfg = cfg; | 412 | set->cfg = cfg; |
413 | set->mq = GNUNET_CLIENT_connect (cfg, | 413 | set->mq = GNUNET_CLIENT_connect (cfg, |
414 | "set", | 414 | "seti", |
415 | mq_handlers, | 415 | mq_handlers, |
416 | &handle_client_set_error, | 416 | &handle_client_set_error, |
417 | set); | 417 | set); |
@@ -549,7 +549,7 @@ GNUNET_SETI_prepare (const struct GNUNET_PeerIdentity *other_peer, | |||
549 | switch (opt->type) | 549 | switch (opt->type) |
550 | { | 550 | { |
551 | case GNUNET_SETI_OPTION_RETURN_INTERSECTION: | 551 | case GNUNET_SETI_OPTION_RETURN_INTERSECTION: |
552 | msg->return_intersection = GNUNET_YES; | 552 | msg->return_intersection = htonl (GNUNET_YES); |
553 | break; | 553 | break; |
554 | default: | 554 | default: |
555 | LOG (GNUNET_ERROR_TYPE_ERROR, | 555 | LOG (GNUNET_ERROR_TYPE_ERROR, |
@@ -687,7 +687,7 @@ listen_connect (void *cls) | |||
687 | lh->reconnect_task = NULL; | 687 | lh->reconnect_task = NULL; |
688 | GNUNET_assert (NULL == lh->mq); | 688 | GNUNET_assert (NULL == lh->mq); |
689 | lh->mq = GNUNET_CLIENT_connect (lh->cfg, | 689 | lh->mq = GNUNET_CLIENT_connect (lh->cfg, |
690 | "set", | 690 | "seti", |
691 | mq_handlers, | 691 | mq_handlers, |
692 | &handle_client_listener_error, | 692 | &handle_client_listener_error, |
693 | lh); | 693 | lh); |
@@ -806,7 +806,7 @@ GNUNET_SETI_accept (struct GNUNET_SETI_Request *request, | |||
806 | switch (opt->type) | 806 | switch (opt->type) |
807 | { | 807 | { |
808 | case GNUNET_SETI_OPTION_RETURN_INTERSECTION: | 808 | case GNUNET_SETI_OPTION_RETURN_INTERSECTION: |
809 | oh->return_intersection = GNUNET_YES; | 809 | oh->return_intersection = htonl (GNUNET_YES); |
810 | break; | 810 | break; |
811 | default: | 811 | default: |
812 | LOG (GNUNET_ERROR_TYPE_ERROR, | 812 | LOG (GNUNET_ERROR_TYPE_ERROR, |
diff --git a/src/seti/test_seti.conf b/src/seti/test_seti.conf index 21fe984f8..c87433419 100644 --- a/src/seti/test_seti.conf +++ b/src/seti/test_seti.conf | |||
@@ -3,7 +3,7 @@ | |||
3 | [PATHS] | 3 | [PATHS] |
4 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-set/ | 4 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-set/ |
5 | 5 | ||
6 | [set] | 6 | [seti] |
7 | START_ON_DEMAND = YES | 7 | START_ON_DEMAND = YES |
8 | #PREFIX = valgrind --leak-check=full | 8 | #PREFIX = valgrind --leak-check=full |
9 | #PREFIX = gdbserver :1234 | 9 | #PREFIX = gdbserver :1234 |
@@ -30,4 +30,3 @@ DISABLEV6 = NO | |||
30 | 30 | ||
31 | # Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8) | 31 | # Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8) |
32 | RETURN_LOCAL_ADDRESSES = YES | 32 | RETURN_LOCAL_ADDRESSES = YES |
33 | |||
diff --git a/src/setu/plugin_block_setu_test.c b/src/setu/plugin_block_setu_test.c index 1de086092..fd0c8a680 100644 --- a/src/setu/plugin_block_setu_test.c +++ b/src/setu/plugin_block_setu_test.c | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file set/plugin_block_set_test.c | 22 | * @file setu/plugin_block_setu_test.c |
23 | * @brief set test block, recognizes elements with non-zero first byte as invalid | 23 | * @brief set test block, recognizes elements with non-zero first byte as invalid |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
@@ -46,16 +46,16 @@ | |||
46 | * @return characterization of result | 46 | * @return characterization of result |
47 | */ | 47 | */ |
48 | static enum GNUNET_BLOCK_EvaluationResult | 48 | static enum GNUNET_BLOCK_EvaluationResult |
49 | block_plugin_set_test_evaluate (void *cls, | 49 | block_plugin_setu_test_evaluate (void *cls, |
50 | struct GNUNET_BLOCK_Context *ctx, | 50 | struct GNUNET_BLOCK_Context *ctx, |
51 | enum GNUNET_BLOCK_Type type, | 51 | enum GNUNET_BLOCK_Type type, |
52 | struct GNUNET_BLOCK_Group *group, | 52 | struct GNUNET_BLOCK_Group *group, |
53 | enum GNUNET_BLOCK_EvaluationOptions eo, | 53 | enum GNUNET_BLOCK_EvaluationOptions eo, |
54 | const struct GNUNET_HashCode *query, | 54 | const struct GNUNET_HashCode *query, |
55 | const void *xquery, | 55 | const void *xquery, |
56 | size_t xquery_size, | 56 | size_t xquery_size, |
57 | const void *reply_block, | 57 | const void *reply_block, |
58 | size_t reply_block_size) | 58 | size_t reply_block_size) |
59 | { | 59 | { |
60 | if ((NULL == reply_block) || | 60 | if ((NULL == reply_block) || |
61 | (reply_block_size == 0) || | 61 | (reply_block_size == 0) || |
@@ -77,11 +77,11 @@ block_plugin_set_test_evaluate (void *cls, | |||
77 | * (or if extracting a key from a block of this type does not work) | 77 | * (or if extracting a key from a block of this type does not work) |
78 | */ | 78 | */ |
79 | static int | 79 | static int |
80 | block_plugin_set_test_get_key (void *cls, | 80 | block_plugin_setu_test_get_key (void *cls, |
81 | enum GNUNET_BLOCK_Type type, | 81 | enum GNUNET_BLOCK_Type type, |
82 | const void *block, | 82 | const void *block, |
83 | size_t block_size, | 83 | size_t block_size, |
84 | struct GNUNET_HashCode *key) | 84 | struct GNUNET_HashCode *key) |
85 | { | 85 | { |
86 | return GNUNET_SYSERR; | 86 | return GNUNET_SYSERR; |
87 | } | 87 | } |
@@ -91,17 +91,17 @@ block_plugin_set_test_get_key (void *cls, | |||
91 | * Entry point for the plugin. | 91 | * Entry point for the plugin. |
92 | */ | 92 | */ |
93 | void * | 93 | void * |
94 | libgnunet_plugin_block_set_test_init (void *cls) | 94 | libgnunet_plugin_block_setu_test_init (void *cls) |
95 | { | 95 | { |
96 | static enum GNUNET_BLOCK_Type types[] = { | 96 | static enum GNUNET_BLOCK_Type types[] = { |
97 | GNUNET_BLOCK_TYPE_SET_TEST, | 97 | GNUNET_BLOCK_TYPE_SETU_TEST, |
98 | GNUNET_BLOCK_TYPE_ANY /* end of list */ | 98 | GNUNET_BLOCK_TYPE_ANY /* end of list */ |
99 | }; | 99 | }; |
100 | struct GNUNET_BLOCK_PluginFunctions *api; | 100 | struct GNUNET_BLOCK_PluginFunctions *api; |
101 | 101 | ||
102 | api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions); | 102 | api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions); |
103 | api->evaluate = &block_plugin_set_test_evaluate; | 103 | api->evaluate = &block_plugin_setu_test_evaluate; |
104 | api->get_key = &block_plugin_set_test_get_key; | 104 | api->get_key = &block_plugin_setu_test_get_key; |
105 | api->types = types; | 105 | api->types = types; |
106 | return api; | 106 | return api; |
107 | } | 107 | } |
@@ -111,7 +111,7 @@ libgnunet_plugin_block_set_test_init (void *cls) | |||
111 | * Exit point from the plugin. | 111 | * Exit point from the plugin. |
112 | */ | 112 | */ |
113 | void * | 113 | void * |
114 | libgnunet_plugin_block_set_test_done (void *cls) | 114 | libgnunet_plugin_block_setu_test_done (void *cls) |
115 | { | 115 | { |
116 | struct GNUNET_BLOCK_PluginFunctions *api = cls; | 116 | struct GNUNET_BLOCK_PluginFunctions *api = cls; |
117 | 117 | ||
@@ -120,4 +120,4 @@ libgnunet_plugin_block_set_test_done (void *cls) | |||
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | /* end of plugin_block_set_test.c */ | 123 | /* end of plugin_block_setu_test.c */ |