aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-28 21:12:03 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-28 21:12:03 +0000
commit3a2737d76679c68331fad0be0b89d8efdcde5079 (patch)
tree5bd4ef163438954cdcb75558e6368a297629b56d /src
parent9c46ed792caae948fd99cca44deaf5a265af7614 (diff)
downloadgnunet-3a2737d76679c68331fad0be0b89d8efdcde5079.tar.gz
gnunet-3a2737d76679c68331fad0be0b89d8efdcde5079.zip
-extend block API to allow specifying flags, use this to allow reducing checks for replies from local DB
Diffstat (limited to 'src')
-rw-r--r--src/block/block.c36
-rw-r--r--src/block/plugin_block_template.c13
-rw-r--r--src/block/plugin_block_test.c13
-rw-r--r--src/dht/gnunet-service-dht_clients.c14
-rw-r--r--src/dht/gnunet-service-dht_datacache.c16
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c13
-rw-r--r--src/dht/gnunet-service-dht_routing.c13
-rw-r--r--src/dht/gnunet-service-xdht_clients.c31
-rw-r--r--src/dht/gnunet-service-xdht_datacache.c49
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.c1
-rw-r--r--src/dht/plugin_block_dht.c20
-rw-r--r--src/dns/plugin_block_dns.c11
-rw-r--r--src/fs/gnunet-service-fs_pr.c89
-rw-r--r--src/fs/plugin_block_fs.c51
-rw-r--r--src/fs/test_plugin_block_fs.c27
-rw-r--r--src/gns/plugin_block_gns.c17
-rw-r--r--src/include/gnunet_block_lib.h46
-rw-r--r--src/include/gnunet_block_plugin.h13
-rw-r--r--src/regex/plugin_block_regex.c67
-rw-r--r--src/transport/plugin_transport_tcp.c4
20 files changed, 374 insertions, 170 deletions
diff --git a/src/block/block.c b/src/block/block.c
index e4ce585e7..0e7b4a6ba 100644
--- a/src/block/block.c
+++ b/src/block/block.c
@@ -197,6 +197,7 @@ find_plugin (struct GNUNET_BLOCK_Context *ctx,
197 * 197 *
198 * @param ctx block contxt 198 * @param ctx block contxt
199 * @param type block type 199 * @param type block type
200 * @param eo control flags
200 * @param query original query (hash) 201 * @param query original query (hash)
201 * @param bf pointer to bloom filter associated with query; possibly updated (!) 202 * @param bf pointer to bloom filter associated with query; possibly updated (!)
202 * @param bf_mutator mutation value for @a bf 203 * @param bf_mutator mutation value for @a bf
@@ -209,18 +210,29 @@ find_plugin (struct GNUNET_BLOCK_Context *ctx,
209enum GNUNET_BLOCK_EvaluationResult 210enum GNUNET_BLOCK_EvaluationResult
210GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, 211GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
211 enum GNUNET_BLOCK_Type type, 212 enum GNUNET_BLOCK_Type type,
212 const struct GNUNET_HashCode * query, 213 enum GNUNET_BLOCK_EvaluationOptions eo,
214 const struct GNUNET_HashCode *query,
213 struct GNUNET_CONTAINER_BloomFilter **bf, 215 struct GNUNET_CONTAINER_BloomFilter **bf,
214 int32_t bf_mutator, const void *xquery, 216 int32_t bf_mutator,
215 size_t xquery_size, const void *reply_block, 217 const void *xquery,
218 size_t xquery_size,
219 const void *reply_block,
216 size_t reply_block_size) 220 size_t reply_block_size)
217{ 221{
218 struct GNUNET_BLOCK_PluginFunctions *plugin = find_plugin (ctx, type); 222 struct GNUNET_BLOCK_PluginFunctions *plugin = find_plugin (ctx, type);
219 223
220 if (plugin == NULL) 224 if (plugin == NULL)
221 return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; 225 return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED;
222 return plugin->evaluate (plugin->cls, type, query, bf, bf_mutator, xquery, 226 return plugin->evaluate (plugin->cls,
223 xquery_size, reply_block, reply_block_size); 227 type,
228 eo,
229 query,
230 bf,
231 bf_mutator,
232 xquery,
233 xquery_size,
234 reply_block,
235 reply_block_size);
224} 236}
225 237
226 238
@@ -237,8 +249,10 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
237 */ 249 */
238int 250int
239GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, 251GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
240 enum GNUNET_BLOCK_Type type, const void *block, 252 enum GNUNET_BLOCK_Type type,
241 size_t block_size, struct GNUNET_HashCode * key) 253 const void *block,
254 size_t block_size,
255 struct GNUNET_HashCode *key)
242{ 256{
243 struct GNUNET_BLOCK_PluginFunctions *plugin = find_plugin (ctx, type); 257 struct GNUNET_BLOCK_PluginFunctions *plugin = find_plugin (ctx, type);
244 258
@@ -250,9 +264,9 @@ GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
250 264
251/** 265/**
252 * How many bytes should a bloomfilter be if we have already seen 266 * How many bytes should a bloomfilter be if we have already seen
253 * entry_count responses? Note that GNUNET_CONSTANTS_BLOOMFILTER_K gives us the number 267 * entry_count responses? Note that #GNUNET_CONSTANTS_BLOOMFILTER_K
254 * of bits set per entry. Furthermore, we should not re-size the 268 * gives us the number of bits set per entry. Furthermore, we should
255 * filter too often (to keep it cheap). 269 * not re-size the filter too often (to keep it cheap).
256 * 270 *
257 * Since other peers will also add entries but not resize the filter, 271 * Since other peers will also add entries but not resize the filter,
258 * we should generally pick a slightly larger size than what the 272 * we should generally pick a slightly larger size than what the
@@ -291,7 +305,7 @@ compute_bloomfilter_size (unsigned int entry_count)
291 */ 305 */
292struct GNUNET_CONTAINER_BloomFilter * 306struct GNUNET_CONTAINER_BloomFilter *
293GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator, 307GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator,
294 const struct GNUNET_HashCode * seen_results, 308 const struct GNUNET_HashCode *seen_results,
295 unsigned int seen_results_count) 309 unsigned int seen_results_count)
296{ 310{
297 struct GNUNET_CONTAINER_BloomFilter *bf; 311 struct GNUNET_CONTAINER_BloomFilter *bf;
diff --git a/src/block/plugin_block_template.c b/src/block/plugin_block_template.c
index 9132d7557..3cb648db7 100644
--- a/src/block/plugin_block_template.c
+++ b/src/block/plugin_block_template.c
@@ -36,6 +36,7 @@
36 * 36 *
37 * @param cls closure 37 * @param cls closure
38 * @param type block type 38 * @param type block type
39 * @param eo control flags
39 * @param query original query (hash) 40 * @param query original query (hash)
40 * @param bf pointer to bloom filter associated with query; possibly updated (!) 41 * @param bf pointer to bloom filter associated with query; possibly updated (!)
41 * @param bf_mutator mutation value for bf 42 * @param bf_mutator mutation value for bf
@@ -46,11 +47,15 @@
46 * @return characterization of result 47 * @return characterization of result
47 */ 48 */
48static enum GNUNET_BLOCK_EvaluationResult 49static enum GNUNET_BLOCK_EvaluationResult
49block_plugin_template_evaluate (void *cls, enum GNUNET_BLOCK_Type type, 50block_plugin_template_evaluate (void *cls,
50 const struct GNUNET_HashCode * query, 51 enum GNUNET_BLOCK_Type type,
52 enum GNUNET_BLOCK_EvaluationOptions eo,
53 const struct GNUNET_HashCode *query,
51 struct GNUNET_CONTAINER_BloomFilter **bf, 54 struct GNUNET_CONTAINER_BloomFilter **bf,
52 int32_t bf_mutator, const void *xquery, 55 int32_t bf_mutator,
53 size_t xquery_size, const void *reply_block, 56 const void *xquery,
57 size_t xquery_size,
58 const void *reply_block,
54 size_t reply_block_size) 59 size_t reply_block_size)
55{ 60{
56 struct GNUNET_HashCode chash; 61 struct GNUNET_HashCode chash;
diff --git a/src/block/plugin_block_test.c b/src/block/plugin_block_test.c
index 8c476aaa3..6859f4f67 100644
--- a/src/block/plugin_block_test.c
+++ b/src/block/plugin_block_test.c
@@ -41,6 +41,7 @@
41 * 41 *
42 * @param cls closure 42 * @param cls closure
43 * @param type block type 43 * @param type block type
44 * @param eo control flags
44 * @param query original query (hash) 45 * @param query original query (hash)
45 * @param bf pointer to bloom filter associated with query; possibly updated (!) 46 * @param bf pointer to bloom filter associated with query; possibly updated (!)
46 * @param bf_mutator mutation value for @a bf 47 * @param bf_mutator mutation value for @a bf
@@ -51,11 +52,15 @@
51 * @return characterization of result 52 * @return characterization of result
52 */ 53 */
53static enum GNUNET_BLOCK_EvaluationResult 54static enum GNUNET_BLOCK_EvaluationResult
54block_plugin_test_evaluate (void *cls, enum GNUNET_BLOCK_Type type, 55block_plugin_test_evaluate (void *cls,
55 const struct GNUNET_HashCode * query, 56 enum GNUNET_BLOCK_Type type,
57 enum GNUNET_BLOCK_EvaluationOptions eo,
58 const struct GNUNET_HashCode *query,
56 struct GNUNET_CONTAINER_BloomFilter **bf, 59 struct GNUNET_CONTAINER_BloomFilter **bf,
57 int32_t bf_mutator, const void *xquery, 60 int32_t bf_mutator,
58 size_t xquery_size, const void *reply_block, 61 const void *xquery,
62 size_t xquery_size,
63 const void *reply_block,
59 size_t reply_block_size) 64 size_t reply_block_size)
60{ 65{
61 struct GNUNET_HashCode chash; 66 struct GNUNET_HashCode chash;
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index ae9e3f25d..ec957737f 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -1055,12 +1055,20 @@ forward_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
1055 return GNUNET_YES; /* duplicate */ 1055 return GNUNET_YES; /* duplicate */
1056 } 1056 }
1057 eval = 1057 eval =
1058 GNUNET_BLOCK_evaluate (GDS_block_context, record->type, key, NULL, 0, 1058 GNUNET_BLOCK_evaluate (GDS_block_context,
1059 record->xquery, record->xquery_size, frc->data, 1059 record->type,
1060 GNUNET_BLOCK_EO_NONE,
1061 key,
1062 NULL,
1063 0,
1064 record->xquery,
1065 record->xquery_size,
1066 frc->data,
1060 frc->data_size); 1067 frc->data_size);
1061 LOG (GNUNET_ERROR_TYPE_DEBUG, 1068 LOG (GNUNET_ERROR_TYPE_DEBUG,
1062 "Evaluation result is %d for key %s for local client's query\n", 1069 "Evaluation result is %d for key %s for local client's query\n",
1063 (int) eval, GNUNET_h2s (key)); 1070 (int) eval,
1071 GNUNET_h2s (key));
1064 switch (eval) 1072 switch (eval)
1065 { 1073 {
1066 case GNUNET_BLOCK_EVALUATION_OK_LAST: 1074 case GNUNET_BLOCK_EVALUATION_OK_LAST:
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c
index 78f863e01..48ce941c1 100644
--- a/src/dht/gnunet-service-dht_datacache.c
+++ b/src/dht/gnunet-service-dht_datacache.c
@@ -148,12 +148,20 @@ datacache_get_iterator (void *cls,
148 enum GNUNET_BLOCK_EvaluationResult eval; 148 enum GNUNET_BLOCK_EvaluationResult eval;
149 149
150 eval = 150 eval =
151 GNUNET_BLOCK_evaluate (GDS_block_context, type, key, ctx->reply_bf, 151 GNUNET_BLOCK_evaluate (GDS_block_context,
152 ctx->reply_bf_mutator, ctx->xquery, 152 type,
153 ctx->xquery_size, data, size); 153 GNUNET_BLOCK_EO_NONE,
154 key,
155 ctx->reply_bf,
156 ctx->reply_bf_mutator,
157 ctx->xquery,
158 ctx->xquery_size,
159 data,
160 size);
154 LOG (GNUNET_ERROR_TYPE_DEBUG, 161 LOG (GNUNET_ERROR_TYPE_DEBUG,
155 "Found reply for query %s in datacache, evaluation result is %d\n", 162 "Found reply for query %s in datacache, evaluation result is %d\n",
156 GNUNET_h2s (key), (int) eval); 163 GNUNET_h2s (key),
164 (int) eval);
157 ctx->eval = eval; 165 ctx->eval = eval;
158 switch (eval) 166 switch (eval)
159 { 167 {
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 9e23be3bc..caa226dad 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -1708,6 +1708,7 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer,
1708 { 1708 {
1709 switch (GNUNET_BLOCK_evaluate (GDS_block_context, 1709 switch (GNUNET_BLOCK_evaluate (GDS_block_context,
1710 ntohl (put->type), 1710 ntohl (put->type),
1711 GNUNET_BLOCK_EO_NONE,
1711 NULL, /* query */ 1712 NULL, /* query */
1712 NULL, 0, /* bloom filer */ 1713 NULL, 0, /* bloom filer */
1713 NULL, 0, /* xquery */ 1714 NULL, 0, /* xquery */
@@ -1953,8 +1954,16 @@ handle_dht_p2p_get (void *cls,
1953 GNUNET_CONTAINER_bloomfilter_init (&xquery[xquery_size], reply_bf_size, 1954 GNUNET_CONTAINER_bloomfilter_init (&xquery[xquery_size], reply_bf_size,
1954 GNUNET_CONSTANTS_BLOOMFILTER_K); 1955 GNUNET_CONSTANTS_BLOOMFILTER_K);
1955 eval = 1956 eval =
1956 GNUNET_BLOCK_evaluate (GDS_block_context, type, &get->key, &reply_bf, 1957 GNUNET_BLOCK_evaluate (GDS_block_context,
1957 get->bf_mutator, xquery, xquery_size, NULL, 0); 1958 type,
1959 GNUNET_BLOCK_EO_NONE,
1960 &get->key,
1961 &reply_bf,
1962 get->bf_mutator,
1963 xquery,
1964 xquery_size,
1965 NULL,
1966 0);
1958 if (eval != GNUNET_BLOCK_EVALUATION_REQUEST_VALID) 1967 if (eval != GNUNET_BLOCK_EVALUATION_REQUEST_VALID)
1959 { 1968 {
1960 /* request invalid or block type not supported */ 1969 /* request invalid or block type not supported */
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c
index e42db8073..318ebecb2 100644
--- a/src/dht/gnunet-service-dht_routing.c
+++ b/src/dht/gnunet-service-dht_routing.c
@@ -199,9 +199,16 @@ process (void *cls, const struct GNUNET_HashCode * key, void *value)
199 eval_key = key; 199 eval_key = key;
200 } 200 }
201 eval = 201 eval =
202 GNUNET_BLOCK_evaluate (GDS_block_context, pc->type, eval_key, 202 GNUNET_BLOCK_evaluate (GDS_block_context,
203 &rr->reply_bf, rr->reply_bf_mutator, rr->xquery, 203 pc->type,
204 rr->xquery_size, pc->data, pc->data_size); 204 GNUNET_BLOCK_EO_NONE,
205 eval_key,
206 &rr->reply_bf,
207 rr->reply_bf_mutator,
208 rr->xquery,
209 rr->xquery_size,
210 pc->data,
211 pc->data_size);
205 switch (eval) 212 switch (eval)
206 { 213 {
207 case GNUNET_BLOCK_EVALUATION_OK_MORE: 214 case GNUNET_BLOCK_EVALUATION_OK_MORE:
diff --git a/src/dht/gnunet-service-xdht_clients.c b/src/dht/gnunet-service-xdht_clients.c
index c9c9c7134..a055a652c 100644
--- a/src/dht/gnunet-service-xdht_clients.c
+++ b/src/dht/gnunet-service-xdht_clients.c
@@ -487,7 +487,7 @@ forward_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
487 int do_free; 487 int do_free;
488 struct GNUNET_HashCode ch; 488 struct GNUNET_HashCode ch;
489 unsigned int i; 489 unsigned int i;
490 490
491 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, 491 LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG,
492 "XVINE CLIENT-RESULT %s\n", 492 "XVINE CLIENT-RESULT %s\n",
493 GNUNET_h2s_full (key)); 493 GNUNET_h2s_full (key));
@@ -519,8 +519,13 @@ forward_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
519 return GNUNET_YES; /* duplicate */ 519 return GNUNET_YES; /* duplicate */
520 } 520 }
521 eval = 521 eval =
522 GNUNET_BLOCK_evaluate (GDS_block_context, record->type, key, NULL, 0, 522 GNUNET_BLOCK_evaluate (GDS_block_context,
523 record->xquery, record->xquery_size, frc->data, 523 record->type,
524 GNUNET_BLOCK_EO_NONE,
525 key, NULL, 0,
526 record->xquery,
527 record->xquery_size,
528 frc->data,
524 frc->data_size); 529 frc->data_size);
525 LOG (GNUNET_ERROR_TYPE_DEBUG, 530 LOG (GNUNET_ERROR_TYPE_DEBUG,
526 "Evaluation result is %d for key %s for local client's query\n", 531 "Evaluation result is %d for key %s for local client's query\n",
@@ -834,7 +839,7 @@ GDS_CLIENTS_process_put (uint32_t options,
834 839
835 840
836/** 841/**
837 * Route the given request via the DHT. 842 * Route the given request via the DHT.
838 */ 843 */
839static void 844static void
840transmit_request (struct ClientQueryRecord *cqr) 845transmit_request (struct ClientQueryRecord *cqr)
@@ -843,16 +848,16 @@ transmit_request (struct ClientQueryRecord *cqr)
843 gettext_noop 848 gettext_noop
844 ("# GET requests from clients injected"), 1, 849 ("# GET requests from clients injected"), 1,
845 GNUNET_NO); 850 GNUNET_NO);
846 851
847 LOG (GNUNET_ERROR_TYPE_DEBUG, 852 LOG (GNUNET_ERROR_TYPE_DEBUG,
848 "Initiating GET for %s, replication %u, already have %u replies\n", 853 "Initiating GET for %s, replication %u, already have %u replies\n",
849 GNUNET_h2s (&cqr->key), 854 GNUNET_h2s (&cqr->key),
850 cqr->replication, 855 cqr->replication,
851 cqr->seen_replies_count); 856 cqr->seen_replies_count);
852 857
853 GDS_NEIGHBOURS_handle_get (&cqr->key, cqr->type, cqr->msg_options, 858 GDS_NEIGHBOURS_handle_get (&cqr->key, cqr->type, cqr->msg_options,
854 cqr->replication); 859 cqr->replication);
855 860
856 /* exponential back-off for retries. 861 /* exponential back-off for retries.
857 * max GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD (15 min) */ 862 * max GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD (15 min) */
858 cqr->retry_frequency = GNUNET_TIME_STD_BACKOFF (cqr->retry_frequency); 863 cqr->retry_frequency = GNUNET_TIME_STD_BACKOFF (cqr->retry_frequency);
@@ -941,8 +946,8 @@ handle_dht_local_put (void *cls, struct GNUNET_SERVER_Client *client,
941 ntohl (put_msg->type), 946 ntohl (put_msg->type),
942 size - sizeof (struct GNUNET_DHT_ClientPutMessage), 947 size - sizeof (struct GNUNET_DHT_ClientPutMessage),
943 &put_msg[1]); 948 &put_msg[1]);
944 949
945 GDS_NEIGHBOURS_handle_put (&put_msg->key, 950 GDS_NEIGHBOURS_handle_put (&put_msg->key,
946 ntohl (put_msg->type), ntohl (put_msg->options), 951 ntohl (put_msg->type), ntohl (put_msg->options),
947 ntohl (put_msg->desired_replication_level), 952 ntohl (put_msg->desired_replication_level),
948 GNUNET_TIME_absolute_ntoh (put_msg->expiration), 953 GNUNET_TIME_absolute_ntoh (put_msg->expiration),
@@ -1013,11 +1018,11 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client,
1013 cqr->replication = ntohl (get->desired_replication_level); 1018 cqr->replication = ntohl (get->desired_replication_level);
1014 cqr->msg_options = ntohl (get->options); 1019 cqr->msg_options = ntohl (get->options);
1015 cqr->type = ntohl (get->type); 1020 cqr->type = ntohl (get->type);
1016 1021
1017 // FIXME use cqr->key, set multihashmap create to GNUNET_YES 1022 // FIXME use cqr->key, set multihashmap create to GNUNET_YES
1018 GNUNET_CONTAINER_multihashmap_put (forward_map, &get->key, cqr, 1023 GNUNET_CONTAINER_multihashmap_put (forward_map, &get->key, cqr,
1019 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1024 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1020 1025
1021 struct GNUNET_PeerIdentity my_identity; 1026 struct GNUNET_PeerIdentity my_identity;
1022 my_identity = GDS_NEIGHBOURS_get_my_id(); 1027 my_identity = GDS_NEIGHBOURS_get_my_id();
1023 GDS_CLIENTS_process_get (ntohl (get->options), 1028 GDS_CLIENTS_process_get (ntohl (get->options),
@@ -1309,7 +1314,7 @@ handle_dht_act_malicious (void *cls, struct GNUNET_SERVER_Client *client,
1309 1314
1310 msg = (const struct GNUNET_DHT_ActMaliciousMessage *)message; 1315 msg = (const struct GNUNET_DHT_ActMaliciousMessage *)message;
1311 malicious_action = msg->action; 1316 malicious_action = msg->action;
1312 1317
1313 if(GNUNET_OK == GDS_NEIGHBOURS_act_malicious (malicious_action)) 1318 if(GNUNET_OK == GDS_NEIGHBOURS_act_malicious (malicious_action))
1314 { 1319 {
1315 pm = GNUNET_malloc (sizeof (struct PendingMessage) + 1320 pm = GNUNET_malloc (sizeof (struct PendingMessage) +
diff --git a/src/dht/gnunet-service-xdht_datacache.c b/src/dht/gnunet-service-xdht_datacache.c
index 558832e5b..9fbff7dfb 100644
--- a/src/dht/gnunet-service-xdht_datacache.c
+++ b/src/dht/gnunet-service-xdht_datacache.c
@@ -64,7 +64,7 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
64 const void *data) 64 const void *data)
65{ 65{
66 int r; 66 int r;
67 67
68 if (NULL == datacache) 68 if (NULL == datacache)
69 { 69 {
70 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 70 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -76,12 +76,12 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
76 GNUNET_break (0); 76 GNUNET_break (0);
77 return; 77 return;
78 } 78 }
79 79
80 /* Put size is actual data size plus struct overhead plus path length (if any) */ 80 /* Put size is actual data size plus struct overhead plus path length (if any) */
81 GNUNET_STATISTICS_update (GDS_stats, 81 GNUNET_STATISTICS_update (GDS_stats,
82 gettext_noop ("# ITEMS stored in datacache"), 1, 82 gettext_noop ("# ITEMS stored in datacache"), 1,
83 GNUNET_NO); 83 GNUNET_NO);
84 84
85 struct GNUNET_PeerIdentity peer = GDS_NEIGHBOURS_get_my_id(); 85 struct GNUNET_PeerIdentity peer = GDS_NEIGHBOURS_get_my_id();
86 DEBUG("DATACACHE_PUT KEY = %s, peer = %s\n",GNUNET_h2s(key),GNUNET_i2s(&peer)); 86 DEBUG("DATACACHE_PUT KEY = %s, peer = %s\n",GNUNET_h2s(key),GNUNET_i2s(&peer));
87 r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration, 87 r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration,
@@ -180,32 +180,41 @@ struct GetRequestContext
180/** 180/**
181 * Iterator for local get request results, 181 * Iterator for local get request results,
182 * 182 *
183 * @param cls closure for iterator, a DatacacheGetContext 183 * @param cls closure for iterator, a `struct GetRequestContext`
184 * @param exp when does this value expire?
185 * @param key the key this data is stored under 184 * @param key the key this data is stored under
186 * @param size the size of the data identified by key 185 * @param size the size of the data identified by key
187 * @param data the actual data 186 * @param data the actual data
188 * @param type the type of the data 187 * @param type the type of the data
189 * @param put_path_length number of peers in 'put_path' 188 * @param exp when does this value expire?
189 * @param put_path_length number of peers in @a put_path
190 * @param put_path path the reply took on put 190 * @param put_path path the reply took on put
191 * @return GNUNET_OK to continue iteration, anything else 191 * @return #GNUNET_OK to continue iteration, anything else
192 * to stop iteration. 192 * to stop iteration.
193 */ 193 */
194static int 194static int
195datacache_get_iterator (void *cls, 195datacache_get_iterator (void *cls,
196 const struct GNUNET_HashCode * key, size_t size, 196 const struct GNUNET_HashCode *key,
197 const char *data, enum GNUNET_BLOCK_Type type, 197 size_t size,
198 struct GNUNET_TIME_Absolute exp, 198 const char *data,
199 unsigned int put_path_length, 199 enum GNUNET_BLOCK_Type type,
200 const struct GNUNET_PeerIdentity *put_path) 200 struct GNUNET_TIME_Absolute exp,
201 unsigned int put_path_length,
202 const struct GNUNET_PeerIdentity *put_path)
201{ 203{
202 struct GetRequestContext *ctx = cls; 204 struct GetRequestContext *ctx = cls;
203 enum GNUNET_BLOCK_EvaluationResult eval; 205 enum GNUNET_BLOCK_EvaluationResult eval;
204 206
205 eval = 207 eval =
206 GNUNET_BLOCK_evaluate (GDS_block_context, type, key, ctx->reply_bf, 208 GNUNET_BLOCK_evaluate (GDS_block_context,
207 ctx->reply_bf_mutator, ctx->xquery, 209 type,
208 ctx->xquery_size, data, size); 210 GNUNET_BLOCK_EO_NONE,
211 key,
212 ctx->reply_bf,
213 ctx->reply_bf_mutator,
214 ctx->xquery,
215 ctx->xquery_size,
216 data,
217 size);
209 LOG (GNUNET_ERROR_TYPE_DEBUG, 218 LOG (GNUNET_ERROR_TYPE_DEBUG,
210 "Found reply for query %s in datacache, evaluation result is %d\n", 219 "Found reply for query %s in datacache, evaluation result is %d\n",
211 GNUNET_h2s (key), (int) eval); 220 GNUNET_h2s (key), (int) eval);
@@ -221,7 +230,7 @@ datacache_get_iterator (void *cls,
221 ("# Good RESULTS found in datacache"), 1, 230 ("# Good RESULTS found in datacache"), 1,
222 GNUNET_NO); 231 GNUNET_NO);
223 struct GNUNET_PeerIdentity *get_path; 232 struct GNUNET_PeerIdentity *get_path;
224 get_path = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity) * 233 get_path = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity) *
225 ctx->get_path_length); 234 ctx->get_path_length);
226 struct GetPath *iterator; 235 struct GetPath *iterator;
227 iterator = ctx->head; 236 iterator = ctx->head;
@@ -271,7 +280,7 @@ datacache_get_iterator (void *cls,
271 _("Unsupported block type (%u) in local response!\n"), type); 280 _("Unsupported block type (%u) in local response!\n"), type);
272 break; 281 break;
273 } 282 }
274 283
275 return (eval == GNUNET_BLOCK_EVALUATION_OK_LAST) ? GNUNET_NO : GNUNET_OK; 284 return (eval == GNUNET_BLOCK_EVALUATION_OK_LAST) ? GNUNET_NO : GNUNET_OK;
276} 285}
277 286
@@ -315,13 +324,13 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key,
315 ctx.reply_bf = reply_bf; 324 ctx.reply_bf = reply_bf;
316 ctx.reply_bf_mutator = reply_bf_mutator; 325 ctx.reply_bf_mutator = reply_bf_mutator;
317 ctx.get_path_length = get_path_length; 326 ctx.get_path_length = get_path_length;
318 327
319 if (next_hop != NULL) 328 if (next_hop != NULL)
320 { 329 {
321 memcpy (&(ctx.next_hop), next_hop, sizeof (struct GNUNET_PeerIdentity)); 330 memcpy (&(ctx.next_hop), next_hop, sizeof (struct GNUNET_PeerIdentity));
322 } 331 }
323 unsigned int i = 0; 332 unsigned int i = 0;
324 333
325 ctx.head = NULL; 334 ctx.head = NULL;
326 ctx.tail = NULL; 335 ctx.tail = NULL;
327 if (get_path != NULL) 336 if (get_path != NULL)
@@ -337,7 +346,7 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key,
337 i++; 346 i++;
338 } 347 }
339 } 348 }
340 349
341 r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator, 350 r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator,
342 &ctx); 351 &ctx);
343 DEBUG ("DATACACHE_GET for key %s completed (%d). %u results found.\n",GNUNET_h2s (key), ctx.eval, r); 352 DEBUG ("DATACACHE_GET for key %s completed (%d). %u results found.\n",GNUNET_h2s (key), ctx.eval, r);
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c
index 3d14fbcd4..8339f9ce1 100644
--- a/src/dht/gnunet-service-xdht_neighbours.c
+++ b/src/dht/gnunet-service-xdht_neighbours.c
@@ -3736,6 +3736,7 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer,
3736 { 3736 {
3737 switch (GNUNET_BLOCK_evaluate (GDS_block_context, 3737 switch (GNUNET_BLOCK_evaluate (GDS_block_context,
3738 ntohl (put->block_type), 3738 ntohl (put->block_type),
3739 GNUNET_BLOCK_EO_NONE,
3739 NULL, /* query */ 3740 NULL, /* query */
3740 NULL, 0, /* bloom filer */ 3741 NULL, 0, /* bloom filer */
3741 NULL, 0, /* xquery */ 3742 NULL, 0, /* xquery */
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c
index dc26e0351..c5d902fa9 100644
--- a/src/dht/plugin_block_dht.c
+++ b/src/dht/plugin_block_dht.c
@@ -36,10 +36,11 @@
36 36
37/** 37/**
38 * Function called to validate a reply or a request. For 38 * Function called to validate a reply or a request. For
39 * request evaluation, simply pass "NULL" for the reply_block. 39 * request evaluation, simply pass "NULL" for the @a reply_block.
40 * 40 *
41 * @param cls closure 41 * @param cls closure
42 * @param type block type 42 * @param type block type
43 * @param eo control flags
43 * @param query original query (hash) 44 * @param query original query (hash)
44 * @param bf pointer to bloom filter associated with query; possibly updated (!) 45 * @param bf pointer to bloom filter associated with query; possibly updated (!)
45 * @param bf_mutator mutation value for @a bf 46 * @param bf_mutator mutation value for @a bf
@@ -50,11 +51,15 @@
50 * @return characterization of result 51 * @return characterization of result
51 */ 52 */
52static enum GNUNET_BLOCK_EvaluationResult 53static enum GNUNET_BLOCK_EvaluationResult
53block_plugin_dht_evaluate (void *cls, enum GNUNET_BLOCK_Type type, 54block_plugin_dht_evaluate (void *cls,
54 const struct GNUNET_HashCode * query, 55 enum GNUNET_BLOCK_Type type,
56 enum GNUNET_BLOCK_EvaluationOptions eo,
57 const struct GNUNET_HashCode *query,
55 struct GNUNET_CONTAINER_BloomFilter **bf, 58 struct GNUNET_CONTAINER_BloomFilter **bf,
56 int32_t bf_mutator, const void *xquery, 59 int32_t bf_mutator,
57 size_t xquery_size, const void *reply_block, 60 const void *xquery,
61 size_t xquery_size,
62 const void *reply_block,
58 size_t reply_block_size) 63 size_t reply_block_size)
59{ 64{
60 struct GNUNET_HashCode mhash; 65 struct GNUNET_HashCode mhash;
@@ -100,9 +105,8 @@ block_plugin_dht_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
100 } 105 }
101 else 106 else
102 { 107 {
103 *bf = 108 *bf = GNUNET_CONTAINER_bloomfilter_init (NULL, 8,
104 GNUNET_CONTAINER_bloomfilter_init (NULL, 8, 109 GNUNET_CONSTANTS_BLOOMFILTER_K);
105 GNUNET_CONSTANTS_BLOOMFILTER_K);
106 } 110 }
107 GNUNET_CONTAINER_bloomfilter_add (*bf, &mhash); 111 GNUNET_CONTAINER_bloomfilter_add (*bf, &mhash);
108 } 112 }
diff --git a/src/dns/plugin_block_dns.c b/src/dns/plugin_block_dns.c
index a5ed8fea2..f24bfda80 100644
--- a/src/dns/plugin_block_dns.c
+++ b/src/dns/plugin_block_dns.c
@@ -39,6 +39,7 @@
39 * 39 *
40 * @param cls closure 40 * @param cls closure
41 * @param type block type 41 * @param type block type
42 * @param eo control flags
42 * @param query original query (hash) 43 * @param query original query (hash)
43 * @param bf pointer to bloom filter associated with query; possibly updated (!) 44 * @param bf pointer to bloom filter associated with query; possibly updated (!)
44 * @param bf_mutator mutation value for bf 45 * @param bf_mutator mutation value for bf
@@ -49,11 +50,15 @@
49 * @return characterization of result 50 * @return characterization of result
50 */ 51 */
51static enum GNUNET_BLOCK_EvaluationResult 52static enum GNUNET_BLOCK_EvaluationResult
52block_plugin_dns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, 53block_plugin_dns_evaluate (void *cls,
54 enum GNUNET_BLOCK_Type type,
55 enum GNUNET_BLOCK_EvaluationOptions eo,
53 const struct GNUNET_HashCode * query, 56 const struct GNUNET_HashCode * query,
54 struct GNUNET_CONTAINER_BloomFilter **bf, 57 struct GNUNET_CONTAINER_BloomFilter **bf,
55 int32_t bf_mutator, const void *xquery, 58 int32_t bf_mutator,
56 size_t xquery_size, const void *reply_block, 59 const void *xquery,
60 size_t xquery_size,
61 const void *reply_block,
57 size_t reply_block_size) 62 size_t reply_block_size)
58{ 63{
59 const struct GNUNET_DNS_Advertisement *ad; 64 const struct GNUNET_DNS_Advertisement *ad;
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index 545c7c657..709874f75 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -748,6 +748,11 @@ struct ProcessReplyClosure
748 enum GNUNET_BLOCK_Type type; 748 enum GNUNET_BLOCK_Type type;
749 749
750 /** 750 /**
751 * Control flags for evaluation.
752 */
753 enum GNUNET_BLOCK_EvaluationOptions eo;
754
755 /**
751 * How much was this reply worth to us? 756 * How much was this reply worth to us?
752 */ 757 */
753 uint32_t priority; 758 uint32_t priority;
@@ -790,7 +795,7 @@ update_request_performance_data (struct ProcessReplyClosure *prq,
790/** 795/**
791 * We have received a reply; handle it! 796 * We have received a reply; handle it!
792 * 797 *
793 * @param cls response (struct ProcessReplyClosure) 798 * @param cls response (a `struct ProcessReplyClosure`)
794 * @param key our query 799 * @param key our query
795 * @param value value in the hash map (info about the query) 800 * @param value value in the hash map (info about the query)
796 * @return #GNUNET_YES (we should continue to iterate) 801 * @return #GNUNET_YES (we should continue to iterate)
@@ -809,13 +814,21 @@ process_reply (void *cls,
809 return GNUNET_YES; 814 return GNUNET_YES;
810 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 815 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
811 "Matched result (type %u) for query `%s' with pending request\n", 816 "Matched result (type %u) for query `%s' with pending request\n",
812 (unsigned int) prq->type, GNUNET_h2s (key)); 817 (unsigned int) prq->type,
818 GNUNET_h2s (key));
813 GNUNET_STATISTICS_update (GSF_stats, 819 GNUNET_STATISTICS_update (GSF_stats,
814 gettext_noop ("# replies received and matched"), 1, 820 gettext_noop ("# replies received and matched"), 1,
815 GNUNET_NO); 821 GNUNET_NO);
816 prq->eval = 822 prq->eval =
817 GNUNET_BLOCK_evaluate (GSF_block_ctx, prq->type, key, &pr->bf, pr->mingle, 823 GNUNET_BLOCK_evaluate (GSF_block_ctx,
818 NULL, 0, prq->data, 824 prq->type,
825 prq->eo,
826 key,
827 &pr->bf,
828 pr->mingle,
829 NULL,
830 0,
831 prq->data,
819 prq->size); 832 prq->size);
820 switch (prq->eval) 833 switch (prq->eval)
821 { 834 {
@@ -864,20 +877,26 @@ process_reply (void *cls,
864 GNUNET_break (0); 877 GNUNET_break (0);
865 return GNUNET_YES; 878 return GNUNET_YES;
866 case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED: 879 case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED:
867 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Unsupported block type %u\n"), 880 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
881 _("Unsupported block type %u\n"),
868 prq->type); 882 prq->type);
869 return GNUNET_NO; 883 return GNUNET_NO;
870 } 884 }
871 /* update bloomfilter */ 885 /* update bloomfilter */
872 GNUNET_CRYPTO_hash (prq->data, prq->size, &chash); 886 GNUNET_CRYPTO_hash (prq->data,
873 GSF_pending_request_update_ (pr, &chash, 1); 887 prq->size,
888 &chash);
889 GSF_pending_request_update_ (pr,
890 &chash,
891 1);
874 if (NULL == prq->sender) 892 if (NULL == prq->sender)
875 { 893 {
876 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 894 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
877 "Found result for query `%s' in local datastore\n", 895 "Found result for query `%s' in local datastore\n",
878 GNUNET_h2s (key)); 896 GNUNET_h2s (key));
879 GNUNET_STATISTICS_update (GSF_stats, 897 GNUNET_STATISTICS_update (GSF_stats,
880 gettext_noop ("# results found locally"), 1, 898 gettext_noop ("# results found locally"),
899 1,
881 GNUNET_NO); 900 GNUNET_NO);
882 } 901 }
883 else 902 else
@@ -894,9 +913,15 @@ process_reply (void *cls,
894 prq->sender, 913 prq->sender,
895 &last_transmission)) 914 &last_transmission))
896 last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 915 last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
897 pr->rh (pr->rh_cls, prq->eval, pr, 916 pr->rh (pr->rh_cls,
898 prq->anonymity_level, prq->expiration, 917 prq->eval,
899 last_transmission, prq->type, prq->data, prq->size); 918 pr,
919 prq->anonymity_level,
920 prq->expiration,
921 last_transmission,
922 prq->type,
923 prq->data,
924 prq->size);
900 return GNUNET_YES; 925 return GNUNET_YES;
901} 926}
902 927
@@ -1076,6 +1101,7 @@ handle_dht_reply (void *cls,
1076 prq.expiration); 1101 prq.expiration);
1077 prq.size = size; 1102 prq.size = size;
1078 prq.type = type; 1103 prq.type = type;
1104 prq.eo = GNUNET_BLOCK_EO_NONE;
1079 process_reply (&prq, key, pr); 1105 process_reply (&prq, key, pr);
1080 if ((GNUNET_YES == active_to_migration) && 1106 if ((GNUNET_YES == active_to_migration) &&
1081 (GNUNET_NO == test_put_load_too_high (prq.priority))) 1107 (GNUNET_NO == test_put_load_too_high (prq.priority)))
@@ -1207,6 +1233,7 @@ cadet_reply_proc (void *cls,
1207 prq.expiration); 1233 prq.expiration);
1208 prq.size = data_size; 1234 prq.size = data_size;
1209 prq.type = type; 1235 prq.type = type;
1236 prq.eo = GNUNET_BLOCK_EO_NONE;
1210 process_reply (&prq, &query, pr); 1237 process_reply (&prq, &query, pr);
1211} 1238}
1212 1239
@@ -1283,9 +1310,9 @@ odc_warn_delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1283 * peer and if we are done either clean up (operation 1310 * peer and if we are done either clean up (operation
1284 * complete) or forward to other peers (more results possible). 1311 * complete) or forward to other peers (more results possible).
1285 * 1312 *
1286 * @param cls our closure (struct PendingRequest) 1313 * @param cls our closure (`struct GSF_PendingRequest *`)
1287 * @param key key for the content 1314 * @param key key for the content
1288 * @param size number of bytes in data 1315 * @param size number of bytes in @a data
1289 * @param data content stored 1316 * @param data content stored
1290 * @param type type of the content 1317 * @param type type of the content
1291 * @param priority priority of the content 1318 * @param priority priority of the content
@@ -1295,10 +1322,15 @@ odc_warn_delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1295 * maybe 0 if no unique identifier is available 1322 * maybe 0 if no unique identifier is available
1296 */ 1323 */
1297static void 1324static void
1298process_local_reply (void *cls, const struct GNUNET_HashCode * key, size_t size, 1325process_local_reply (void *cls,
1299 const void *data, enum GNUNET_BLOCK_Type type, 1326 const struct GNUNET_HashCode *key,
1300 uint32_t priority, uint32_t anonymity, 1327 size_t size,
1301 struct GNUNET_TIME_Absolute expiration, uint64_t uid) 1328 const void *data,
1329 enum GNUNET_BLOCK_Type type,
1330 uint32_t priority,
1331 uint32_t anonymity,
1332 struct GNUNET_TIME_Absolute expiration,
1333 uint64_t uid)
1302{ 1334{
1303 struct GSF_PendingRequest *pr = cls; 1335 struct GSF_PendingRequest *pr = cls;
1304 GSF_LocalLookupContinuation cont; 1336 GSF_LocalLookupContinuation cont;
@@ -1464,8 +1496,9 @@ process_local_reply (void *cls, const struct GNUNET_HashCode * key, size_t size,
1464 prq.priority = priority; 1496 prq.priority = priority;
1465 prq.request_found = GNUNET_NO; 1497 prq.request_found = GNUNET_NO;
1466 prq.anonymity_level = anonymity; 1498 prq.anonymity_level = anonymity;
1467 if ((old_rf == 0) && (pr->public_data.results_found == 0)) 1499 if ((0 == old_rf) && (0 == pr->public_data.results_found))
1468 GSF_update_datastore_delay_ (pr->public_data.start_time); 1500 GSF_update_datastore_delay_ (pr->public_data.start_time);
1501 prq.eo = GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO;
1469 process_reply (&prq, key, pr); 1502 process_reply (&prq, key, pr);
1470 pr->local_result = prq.eval; 1503 pr->local_result = prq.eval;
1471 if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST) 1504 if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST)
@@ -1473,7 +1506,8 @@ process_local_reply (void *cls, const struct GNUNET_HashCode * key, size_t size,
1473 GNUNET_STATISTICS_update (GSF_stats, 1506 GNUNET_STATISTICS_update (GSF_stats,
1474 gettext_noop 1507 gettext_noop
1475 ("# Datastore lookups concluded (found last result)"), 1508 ("# Datastore lookups concluded (found last result)"),
1476 1, GNUNET_NO); 1509 1,
1510 GNUNET_NO);
1477 goto check_error_and_continue; 1511 goto check_error_and_continue;
1478 } 1512 }
1479 if ((0 == (GSF_PRO_PRIORITY_UNLIMITED & pr->public_data.options)) && 1513 if ((0 == (GSF_PRO_PRIORITY_UNLIMITED & pr->public_data.options)) &&
@@ -1484,12 +1518,14 @@ process_local_reply (void *cls, const struct GNUNET_HashCode * key, size_t size,
1484 GNUNET_STATISTICS_update (GSF_stats, 1518 GNUNET_STATISTICS_update (GSF_stats,
1485 gettext_noop 1519 gettext_noop
1486 ("# Datastore lookups concluded (load too high)"), 1520 ("# Datastore lookups concluded (load too high)"),
1487 1, GNUNET_NO); 1521 1,
1522 GNUNET_NO);
1488 goto check_error_and_continue; 1523 goto check_error_and_continue;
1489 } 1524 }
1490 pr->qe_start = GNUNET_TIME_absolute_get (); 1525 pr->qe_start = GNUNET_TIME_absolute_get ();
1491 pr->warn_task = 1526 pr->warn_task =
1492 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &warn_delay_task, 1527 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
1528 &warn_delay_task,
1493 pr); 1529 pr);
1494 pr->qe = 1530 pr->qe =
1495 GNUNET_DATASTORE_get_key (GSF_dsh, pr->local_result_offset++, 1531 GNUNET_DATASTORE_get_key (GSF_dsh, pr->local_result_offset++,
@@ -1553,7 +1589,7 @@ check_error_and_continue:
1553 * 1589 *
1554 * @param pr request 1590 * @param pr request
1555 * @param target 1591 * @param target
1556 * @return GNUNET_YES if this request could be forwarded to the given peer 1592 * @return #GNUNET_YES if this request could be forwarded to the given peer
1557 */ 1593 */
1558int 1594int
1559GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr, 1595GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr,
@@ -1576,11 +1612,12 @@ GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr,
1576 * 1612 *
1577 * @param pr the pending request to process 1613 * @param pr the pending request to process
1578 * @param cont function to call at the end 1614 * @param cont function to call at the end
1579 * @param cont_cls closure for cont 1615 * @param cont_cls closure for @a cont
1580 */ 1616 */
1581void 1617void
1582GSF_local_lookup_ (struct GSF_PendingRequest *pr, 1618GSF_local_lookup_ (struct GSF_PendingRequest *pr,
1583 GSF_LocalLookupContinuation cont, void *cont_cls) 1619 GSF_LocalLookupContinuation cont,
1620 void *cont_cls)
1584{ 1621{
1585 GNUNET_assert (NULL == pr->gh); 1622 GNUNET_assert (NULL == pr->gh);
1586 GNUNET_assert (NULL == pr->cadet_request); 1623 GNUNET_assert (NULL == pr->cadet_request);
@@ -1682,7 +1719,8 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1682 return GNUNET_SYSERR; 1719 return GNUNET_SYSERR;
1683 } 1720 }
1684 GNUNET_STATISTICS_update (GSF_stats, 1721 GNUNET_STATISTICS_update (GSF_stats,
1685 gettext_noop ("# GAP PUT messages received"), 1, 1722 gettext_noop ("# GAP PUT messages received"),
1723 1,
1686 GNUNET_NO); 1724 GNUNET_NO);
1687 /* now, lookup 'query' */ 1725 /* now, lookup 'query' */
1688 prq.data = (const void *) &put[1]; 1726 prq.data = (const void *) &put[1];
@@ -1693,6 +1731,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1693 prq.priority = 0; 1731 prq.priority = 0;
1694 prq.anonymity_level = UINT32_MAX; 1732 prq.anonymity_level = UINT32_MAX;
1695 prq.request_found = GNUNET_NO; 1733 prq.request_found = GNUNET_NO;
1734 prq.eo = GNUNET_BLOCK_EO_NONE;
1696 GNUNET_CONTAINER_multihashmap_get_multiple (pr_map, 1735 GNUNET_CONTAINER_multihashmap_get_multiple (pr_map,
1697 &query, 1736 &query,
1698 &process_reply, 1737 &process_reply,
diff --git a/src/fs/plugin_block_fs.c b/src/fs/plugin_block_fs.c
index bc2e2d507..c032899c5 100644
--- a/src/fs/plugin_block_fs.c
+++ b/src/fs/plugin_block_fs.c
@@ -42,25 +42,30 @@
42 * request evaluation, simply pass "NULL" for the reply_block. 42 * request evaluation, simply pass "NULL" for the reply_block.
43 * Note that it is assumed that the reply has already been 43 * Note that it is assumed that the reply has already been
44 * matched to the key (and signatures checked) as it would 44 * matched to the key (and signatures checked) as it would
45 * be done with the "get_key" function. 45 * be done with the #GNUNET_BLOCK_get_key() function.
46 * 46 *
47 * @param cls closure 47 * @param cls closure
48 * @param type block type 48 * @param type block type
49 * @param eo control flags
49 * @param query original query (hash) 50 * @param query original query (hash)
50 * @param bf pointer to bloom filter associated with query; possibly updated (!) 51 * @param bf pointer to bloom filter associated with query; possibly updated (!)
51 * @param bf_mutator mutation value for bf 52 * @param bf_mutator mutation value for @a bf
52 * @param xquery extrended query data (can be NULL, depending on type) 53 * @param xquery extrended query data (can be NULL, depending on type)
53 * @param xquery_size number of bytes in xquery 54 * @param xquery_size number of bytes in @a xquery
54 * @param reply_block response to validate 55 * @param reply_block response to validate
55 * @param reply_block_size number of bytes in reply block 56 * @param reply_block_size number of bytes in @a reply_block
56 * @return characterization of result 57 * @return characterization of result
57 */ 58 */
58static enum GNUNET_BLOCK_EvaluationResult 59static enum GNUNET_BLOCK_EvaluationResult
59block_plugin_fs_evaluate (void *cls, enum GNUNET_BLOCK_Type type, 60block_plugin_fs_evaluate (void *cls,
61 enum GNUNET_BLOCK_Type type,
62 enum GNUNET_BLOCK_EvaluationOptions eo,
60 const struct GNUNET_HashCode *query, 63 const struct GNUNET_HashCode *query,
61 struct GNUNET_CONTAINER_BloomFilter **bf, 64 struct GNUNET_CONTAINER_BloomFilter **bf,
62 int32_t bf_mutator, const void *xquery, 65 int32_t bf_mutator,
63 size_t xquery_size, const void *reply_block, 66 const void *xquery,
67 size_t xquery_size,
68 const void *reply_block,
64 size_t reply_block_size) 69 size_t reply_block_size)
65{ 70{
66 const struct UBlock *ub; 71 const struct UBlock *ub;
@@ -110,22 +115,28 @@ block_plugin_fs_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
110 GNUNET_break_op (0); 115 GNUNET_break_op (0);
111 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 116 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
112 } 117 }
113 if (GNUNET_OK != 118 if ( (0 == (eo & GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO)) &&
114 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK, 119 (GNUNET_OK !=
115 &ub->purpose, 120 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK,
116 &ub->signature, 121 &ub->purpose,
117 &ub->verification_key)) 122 &ub->signature,
123 &ub->verification_key)) )
118 { 124 {
119 GNUNET_break_op (0); 125 GNUNET_break_op (0);
120 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 126 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
121 } 127 }
122 if (NULL != bf) 128 if (NULL != bf)
123 { 129 {
124 GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash); 130 GNUNET_CRYPTO_hash (reply_block,
125 GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash); 131 reply_block_size,
132 &chash);
133 GNUNET_BLOCK_mingle_hash (&chash,
134 bf_mutator,
135 &mhash);
126 if (NULL != *bf) 136 if (NULL != *bf)
127 { 137 {
128 if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash)) 138 if (GNUNET_YES ==
139 GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash))
129 return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; 140 return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE;
130 } 141 }
131 else 142 else
@@ -147,14 +158,16 @@ block_plugin_fs_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
147 * @param cls closure 158 * @param cls closure
148 * @param type block type 159 * @param type block type
149 * @param block block to get the key for 160 * @param block block to get the key for
150 * @param block_size number of bytes in block 161 * @param block_size number of bytes in @a block
151 * @param key set to the key (query) for the given block 162 * @param key set to the key (query) for the given block
152 * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported 163 * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported
153 * (or if extracting a key from a block of this type does not work) 164 * (or if extracting a key from a block of this type does not work)
154 */ 165 */
155static int 166static int
156block_plugin_fs_get_key (void *cls, enum GNUNET_BLOCK_Type type, 167block_plugin_fs_get_key (void *cls,
157 const void *block, size_t block_size, 168 enum GNUNET_BLOCK_Type type,
169 const void *block,
170 size_t block_size,
158 struct GNUNET_HashCode *key) 171 struct GNUNET_HashCode *key)
159{ 172{
160 const struct UBlock *ub; 173 const struct UBlock *ub;
diff --git a/src/fs/test_plugin_block_fs.c b/src/fs/test_plugin_block_fs.c
index 208f4ce78..9e1246f72 100644
--- a/src/fs/test_plugin_block_fs.c
+++ b/src/fs/test_plugin_block_fs.c
@@ -38,17 +38,32 @@ test_fs (struct GNUNET_BLOCK_Context *ctx)
38 sizeof (block), &key)) 38 sizeof (block), &key))
39 return 1; 39 return 1;
40 if (GNUNET_BLOCK_EVALUATION_OK_LAST != 40 if (GNUNET_BLOCK_EVALUATION_OK_LAST !=
41 GNUNET_BLOCK_evaluate (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, &key, NULL, 0, 41 GNUNET_BLOCK_evaluate (ctx,
42 NULL, 0, block, sizeof (block))) 42 GNUNET_BLOCK_TYPE_FS_DBLOCK,
43 GNUNET_BLOCK_EO_NONE,
44 &key,
45 NULL, 0,
46 NULL, 0,
47 block, sizeof (block)))
43 return 2; 48 return 2;
44 if (GNUNET_BLOCK_EVALUATION_REQUEST_VALID != 49 if (GNUNET_BLOCK_EVALUATION_REQUEST_VALID !=
45 GNUNET_BLOCK_evaluate (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, &key, NULL, 0, 50 GNUNET_BLOCK_evaluate (ctx,
46 NULL, 0, NULL, 0)) 51 GNUNET_BLOCK_TYPE_FS_DBLOCK,
52 GNUNET_BLOCK_EO_NONE,
53 &key,
54 NULL, 0,
55 NULL, 0,
56 NULL, 0))
47 return 4; 57 return 4;
48 GNUNET_log_skip (1, GNUNET_NO); 58 GNUNET_log_skip (1, GNUNET_NO);
49 if (GNUNET_BLOCK_EVALUATION_REQUEST_INVALID != 59 if (GNUNET_BLOCK_EVALUATION_REQUEST_INVALID !=
50 GNUNET_BLOCK_evaluate (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, &key, NULL, 0, 60 GNUNET_BLOCK_evaluate (ctx,
51 "bogus", 5, NULL, 0)) 61 GNUNET_BLOCK_TYPE_FS_DBLOCK,
62 GNUNET_BLOCK_EO_NONE,
63 &key,
64 NULL, 0,
65 "bogus", 5,
66 NULL, 0))
52 return 8; 67 return 8;
53 GNUNET_log_skip (0, GNUNET_YES); 68 GNUNET_log_skip (0, GNUNET_YES);
54 return 0; 69 return 0;
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c
index a677f7f62..8c08c4fc2 100644
--- a/src/gns/plugin_block_gns.c
+++ b/src/gns/plugin_block_gns.c
@@ -44,6 +44,7 @@
44 * 44 *
45 * @param cls closure 45 * @param cls closure
46 * @param type block type 46 * @param type block type
47 * @param eo control flags
47 * @param query original query (hash) 48 * @param query original query (hash)
48 * @param bf pointer to bloom filter associated with @a query; possibly updated (!) 49 * @param bf pointer to bloom filter associated with @a query; possibly updated (!)
49 * @param bf_mutator mutation value for @a bf 50 * @param bf_mutator mutation value for @a bf
@@ -54,12 +55,16 @@
54 * @return characterization of result 55 * @return characterization of result
55 */ 56 */
56static enum GNUNET_BLOCK_EvaluationResult 57static enum GNUNET_BLOCK_EvaluationResult
57block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, 58block_plugin_gns_evaluate (void *cls,
58 const struct GNUNET_HashCode *query, 59 enum GNUNET_BLOCK_Type type,
59 struct GNUNET_CONTAINER_BloomFilter **bf, 60 enum GNUNET_BLOCK_EvaluationOptions eo,
60 int32_t bf_mutator, const void *xquery, 61 const struct GNUNET_HashCode *query,
61 size_t xquery_size, const void *reply_block, 62 struct GNUNET_CONTAINER_BloomFilter **bf,
62 size_t reply_block_size) 63 int32_t bf_mutator,
64 const void *xquery,
65 size_t xquery_size,
66 const void *reply_block,
67 size_t reply_block_size)
63{ 68{
64 const struct GNUNET_GNSRECORD_Block *block; 69 const struct GNUNET_GNSRECORD_Block *block;
65 struct GNUNET_HashCode h; 70 struct GNUNET_HashCode h;
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index d47bb4579..bf934b504 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -119,6 +119,25 @@ enum GNUNET_BLOCK_Type
119 119
120 120
121/** 121/**
122 * Flags that can be set to control the evaluation.
123 */
124enum GNUNET_BLOCK_EvaluationOptions
125{
126
127 /**
128 * Default behavior.
129 */
130 GNUNET_BLOCK_EO_NONE = 0,
131
132 /**
133 * The block is obtained from the local database, skip cryptographic
134 * checks.
135 */
136 GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO = 1
137};
138
139
140/**
122 * Possible ways for how a block may relate to a query. 141 * Possible ways for how a block may relate to a query.
123 */ 142 */
124enum GNUNET_BLOCK_EvaluationResult 143enum GNUNET_BLOCK_EvaluationResult
@@ -181,8 +200,9 @@ struct GNUNET_BLOCK_Context;
181 * @param hc where to store the result. 200 * @param hc where to store the result.
182 */ 201 */
183void 202void
184GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode * in, uint32_t mingle_number, 203GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in,
185 struct GNUNET_HashCode * hc); 204 uint32_t mingle_number,
205 struct GNUNET_HashCode *hc);
186 206
187 207
188/** 208/**
@@ -206,13 +226,14 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx);
206 226
207/** 227/**
208 * Function called to validate a reply or a request. For 228 * Function called to validate a reply or a request. For
209 * request evaluation, simply pass "NULL" for the reply_block. 229 * request evaluation, simply pass "NULL" for the @a reply_block.
210 * Note that it is assumed that the reply has already been 230 * Note that it is assumed that the reply has already been
211 * matched to the key (and signatures checked) as it would 231 * matched to the key (and signatures checked) as it would
212 * be done with the "get_key" function. 232 * be done with the #GNUNET_BLOCK_get_key() function.
213 * 233 *
214 * @param ctx block contxt 234 * @param ctx block contxt
215 * @param type block type 235 * @param type block type
236 * @param eo evaluation options to control evaluation
216 * @param query original query (hash) 237 * @param query original query (hash)
217 * @param bf pointer to bloom filter associated with query; possibly updated (!) 238 * @param bf pointer to bloom filter associated with query; possibly updated (!)
218 * @param bf_mutator mutation value for @a bf 239 * @param bf_mutator mutation value for @a bf
@@ -225,10 +246,13 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx);
225enum GNUNET_BLOCK_EvaluationResult 246enum GNUNET_BLOCK_EvaluationResult
226GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, 247GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
227 enum GNUNET_BLOCK_Type type, 248 enum GNUNET_BLOCK_Type type,
228 const struct GNUNET_HashCode * query, 249 enum GNUNET_BLOCK_EvaluationOptions eo,
250 const struct GNUNET_HashCode *query,
229 struct GNUNET_CONTAINER_BloomFilter **bf, 251 struct GNUNET_CONTAINER_BloomFilter **bf,
230 int32_t bf_mutator, const void *xquery, 252 int32_t bf_mutator,
231 size_t xquery_size, const void *reply_block, 253 const void *xquery,
254 size_t xquery_size,
255 const void *reply_block,
232 size_t reply_block_size); 256 size_t reply_block_size);
233 257
234 258
@@ -247,8 +271,10 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
247 */ 271 */
248int 272int
249GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, 273GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
250 enum GNUNET_BLOCK_Type type, const void *block, 274 enum GNUNET_BLOCK_Type type,
251 size_t block_size, struct GNUNET_HashCode * key); 275 const void *block,
276 size_t block_size,
277 struct GNUNET_HashCode * key);
252 278
253 279
254 280
@@ -264,7 +290,7 @@ GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
264 */ 290 */
265struct GNUNET_CONTAINER_BloomFilter * 291struct GNUNET_CONTAINER_BloomFilter *
266GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator, 292GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator,
267 const struct GNUNET_HashCode * seen_results, 293 const struct GNUNET_HashCode *seen_results,
268 unsigned int seen_results_count); 294 unsigned int seen_results_count);
269 295
270 296
diff --git a/src/include/gnunet_block_plugin.h b/src/include/gnunet_block_plugin.h
index b4a60b463..a588dde69 100644
--- a/src/include/gnunet_block_plugin.h
+++ b/src/include/gnunet_block_plugin.h
@@ -42,6 +42,7 @@
42 * 42 *
43 * @param cls closure 43 * @param cls closure
44 * @param type block type 44 * @param type block type
45 * @param eo evaluation options to control evaluation
45 * @param query original query (hash) 46 * @param query original query (hash)
46 * @param bf pointer to bloom filter associated with query; possibly updated (!) 47 * @param bf pointer to bloom filter associated with query; possibly updated (!)
47 * @param bf_mutator mutation value for @a bf 48 * @param bf_mutator mutation value for @a bf
@@ -54,6 +55,7 @@
54typedef enum GNUNET_BLOCK_EvaluationResult 55typedef enum GNUNET_BLOCK_EvaluationResult
55(*GNUNET_BLOCK_EvaluationFunction) (void *cls, 56(*GNUNET_BLOCK_EvaluationFunction) (void *cls,
56 enum GNUNET_BLOCK_Type type, 57 enum GNUNET_BLOCK_Type type,
58 enum GNUNET_BLOCK_EvaluationOptions eo,
57 const struct GNUNET_HashCode *query, 59 const struct GNUNET_HashCode *query,
58 struct GNUNET_CONTAINER_BloomFilter **bf, 60 struct GNUNET_CONTAINER_BloomFilter **bf,
59 int32_t bf_mutator, 61 int32_t bf_mutator,
@@ -76,11 +78,12 @@ typedef enum GNUNET_BLOCK_EvaluationResult
76 * #GNUNET_SYSERR if type not supported 78 * #GNUNET_SYSERR if type not supported
77 * (or if extracting a key from a block of this type does not work) 79 * (or if extracting a key from a block of this type does not work)
78 */ 80 */
79typedef int (*GNUNET_BLOCK_GetKeyFunction) (void *cls, 81typedef int
80 enum GNUNET_BLOCK_Type type, 82(*GNUNET_BLOCK_GetKeyFunction) (void *cls,
81 const void *block, 83 enum GNUNET_BLOCK_Type type,
82 size_t block_size, 84 const void *block,
83 struct GNUNET_HashCode * key); 85 size_t block_size,
86 struct GNUNET_HashCode *key);
84 87
85 88
86 89
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index 874f6b4cc..2d6a5b693 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -34,29 +34,34 @@
34 34
35/** 35/**
36 * Function called to validate a reply or a request of type 36 * Function called to validate a reply or a request of type
37 * GNUNET_BLOCK_TYPE_REGEX. 37 * #GNUNET_BLOCK_TYPE_REGEX.
38 * For request evaluation, pass "NULL" for the reply_block. 38 * For request evaluation, pass "NULL" for the reply_block.
39 * Note that it is assumed that the reply has already been 39 * Note that it is assumed that the reply has already been
40 * matched to the key (and signatures checked) as it would 40 * matched to the key (and signatures checked) as it would
41 * be done with the "get_key" function. 41 * be done with the #GNUNET_BLOCK_get_key() function.
42 * 42 *
43 * @param cls closure 43 * @param cls closure
44 * @param type block type 44 * @param type block type
45 * @param eo control flags
45 * @param query original query (hash) 46 * @param query original query (hash)
46 * @param bf pointer to bloom filter associated with query; possibly updated (!) 47 * @param bf pointer to bloom filter associated with query; possibly updated (!)
47 * @param bf_mutator mutation value for bf 48 * @param bf_mutator mutation value for bf
48 * @param xquery extrended query data (can be NULL, depending on type) 49 * @param xquery extrended query data (can be NULL, depending on type)
49 * @param xquery_size number of bytes in xquery 50 * @param xquery_size number of bytes in @a xquery
50 * @param reply_block response to validate 51 * @param reply_block response to validate
51 * @param reply_block_size number of bytes in reply block 52 * @param reply_block_size number of bytes in @a reply_block
52 * @return characterization of result 53 * @return characterization of result
53 */ 54 */
54static enum GNUNET_BLOCK_EvaluationResult 55static enum GNUNET_BLOCK_EvaluationResult
55evaluate_block_regex (void *cls, enum GNUNET_BLOCK_Type type, 56evaluate_block_regex (void *cls,
57 enum GNUNET_BLOCK_Type type,
58 enum GNUNET_BLOCK_EvaluationOptions eo,
56 const struct GNUNET_HashCode *query, 59 const struct GNUNET_HashCode *query,
57 struct GNUNET_CONTAINER_BloomFilter **bf, 60 struct GNUNET_CONTAINER_BloomFilter **bf,
58 int32_t bf_mutator, const void *xquery, 61 int32_t bf_mutator,
59 size_t xquery_size, const void *reply_block, 62 const void *xquery,
63 size_t xquery_size,
64 const void *reply_block,
60 size_t reply_block_size) 65 size_t reply_block_size)
61{ 66{
62 if (NULL == reply_block) 67 if (NULL == reply_block)
@@ -131,25 +136,28 @@ evaluate_block_regex (void *cls, enum GNUNET_BLOCK_Type type,
131 136
132/** 137/**
133 * Function called to validate a reply or a request of type 138 * Function called to validate a reply or a request of type
134 * GNUNET_BLOCK_TYPE_REGEX_ACCEPT. 139 * #GNUNET_BLOCK_TYPE_REGEX_ACCEPT.
135 * For request evaluation, pass "NULL" for the reply_block. 140 * For request evaluation, pass "NULL" for the reply_block.
136 * Note that it is assumed that the reply has already been 141 * Note that it is assumed that the reply has already been
137 * matched to the key (and signatures checked) as it would 142 * matched to the key (and signatures checked) as it would
138 * be done with the "get_key" function. 143 * be done with the #GNUNET_BLOCK_get_key() function.
139 * 144 *
140 * @param cls closure 145 * @param cls closure
141 * @param type block type 146 * @param type block type
147 * @param eo control flags
142 * @param query original query (hash) 148 * @param query original query (hash)
143 * @param bf pointer to bloom filter associated with query; possibly updated (!) 149 * @param bf pointer to bloom filter associated with query; possibly updated (!)
144 * @param bf_mutator mutation value for bf 150 * @param bf_mutator mutation value for bf
145 * @param xquery extrended query data (can be NULL, depending on type) 151 * @param xquery extrended query data (can be NULL, depending on type)
146 * @param xquery_size number of bytes in xquery 152 * @param xquery_size number of bytes in @a xquery
147 * @param reply_block response to validate 153 * @param reply_block response to validate
148 * @param reply_block_size number of bytes in reply block 154 * @param reply_block_size number of bytes in @a reply_block
149 * @return characterization of result 155 * @return characterization of result
150 */ 156 */
151static enum GNUNET_BLOCK_EvaluationResult 157static enum GNUNET_BLOCK_EvaluationResult
152evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type, 158evaluate_block_regex_accept (void *cls,
159 enum GNUNET_BLOCK_Type type,
160 enum GNUNET_BLOCK_EvaluationOptions eo,
153 const struct GNUNET_HashCode * query, 161 const struct GNUNET_HashCode * query,
154 struct GNUNET_CONTAINER_BloomFilter **bf, 162 struct GNUNET_CONTAINER_BloomFilter **bf,
155 int32_t bf_mutator, const void *xquery, 163 int32_t bf_mutator, const void *xquery,
@@ -221,10 +229,11 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type,
221 * request evaluation, simply pass "NULL" for the reply_block. 229 * request evaluation, simply pass "NULL" for the reply_block.
222 * Note that it is assumed that the reply has already been 230 * Note that it is assumed that the reply has already been
223 * matched to the key (and signatures checked) as it would 231 * matched to the key (and signatures checked) as it would
224 * be done with the "get_key" function. 232 * be done with the #GNUNET_BLOCK_get_key() function.
225 * 233 *
226 * @param cls closure 234 * @param cls closure
227 * @param type block type 235 * @param type block type
236 * @param eo control flags
228 * @param query original query (hash) 237 * @param query original query (hash)
229 * @param bf pointer to bloom filter associated with query; possibly updated (!) 238 * @param bf pointer to bloom filter associated with query; possibly updated (!)
230 * @param bf_mutator mutation value for bf 239 * @param bf_mutator mutation value for bf
@@ -235,11 +244,15 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type,
235 * @return characterization of result 244 * @return characterization of result
236 */ 245 */
237static enum GNUNET_BLOCK_EvaluationResult 246static enum GNUNET_BLOCK_EvaluationResult
238block_plugin_regex_evaluate (void *cls, enum GNUNET_BLOCK_Type type, 247block_plugin_regex_evaluate (void *cls,
239 const struct GNUNET_HashCode * query, 248 enum GNUNET_BLOCK_Type type,
249 enum GNUNET_BLOCK_EvaluationOptions eo,
250 const struct GNUNET_HashCode *query,
240 struct GNUNET_CONTAINER_BloomFilter **bf, 251 struct GNUNET_CONTAINER_BloomFilter **bf,
241 int32_t bf_mutator, const void *xquery, 252 int32_t bf_mutator,
242 size_t xquery_size, const void *reply_block, 253 const void *xquery,
254 size_t xquery_size,
255 const void *reply_block,
243 size_t reply_block_size) 256 size_t reply_block_size)
244{ 257{
245 enum GNUNET_BLOCK_EvaluationResult result; 258 enum GNUNET_BLOCK_EvaluationResult result;
@@ -247,12 +260,20 @@ block_plugin_regex_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
247 switch (type) 260 switch (type)
248 { 261 {
249 case GNUNET_BLOCK_TYPE_REGEX: 262 case GNUNET_BLOCK_TYPE_REGEX:
250 result = evaluate_block_regex (cls, type, query, bf, bf_mutator, 263 result = evaluate_block_regex (cls,
264 type,
265 eo,
266 query,
267 bf, bf_mutator,
251 xquery, xquery_size, 268 xquery, xquery_size,
252 reply_block, reply_block_size); 269 reply_block, reply_block_size);
253 break; 270 break;
254 case GNUNET_BLOCK_TYPE_REGEX_ACCEPT: 271 case GNUNET_BLOCK_TYPE_REGEX_ACCEPT:
255 result = evaluate_block_regex_accept (cls, type, query, bf, bf_mutator, 272 result = evaluate_block_regex_accept (cls,
273 type,
274 eo,
275 query,
276 bf, bf_mutator,
256 xquery, xquery_size, 277 xquery, xquery_size,
257 reply_block, reply_block_size); 278 reply_block, reply_block_size);
258 break; 279 break;
@@ -276,9 +297,11 @@ block_plugin_regex_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
276 * (or if extracting a key from a block of this type does not work) 297 * (or if extracting a key from a block of this type does not work)
277 */ 298 */
278static int 299static int
279block_plugin_regex_get_key (void *cls, enum GNUNET_BLOCK_Type type, 300block_plugin_regex_get_key (void *cls,
280 const void *block, size_t block_size, 301 enum GNUNET_BLOCK_Type type,
281 struct GNUNET_HashCode * key) 302 const void *block,
303 size_t block_size,
304 struct GNUNET_HashCode *key)
282{ 305{
283 switch (type) 306 switch (type)
284 { 307 {
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index bc80dd1bf..3a283e17b 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -3102,7 +3102,7 @@ libgnunet_plugin_transport_tcp_done (void *cls)
3102 GNUNET_SERVICE_stop (plugin->service); 3102 GNUNET_SERVICE_stop (plugin->service);
3103 else 3103 else
3104 GNUNET_SERVER_destroy (plugin->server); 3104 GNUNET_SERVER_destroy (plugin->server);
3105 GNUNET_free(plugin->handlers); 3105 GNUNET_free (plugin->handlers);
3106 if (NULL != plugin->nat) 3106 if (NULL != plugin->nat)
3107 GNUNET_NAT_unregister (plugin->nat); 3107 GNUNET_NAT_unregister (plugin->nat);
3108 while (NULL != (tcp_probe = plugin->probe_head)) 3108 while (NULL != (tcp_probe = plugin->probe_head))
@@ -3111,7 +3111,7 @@ libgnunet_plugin_transport_tcp_done (void *cls)
3111 plugin->probe_tail, 3111 plugin->probe_tail,
3112 tcp_probe); 3112 tcp_probe);
3113 GNUNET_CONNECTION_destroy (tcp_probe->sock); 3113 GNUNET_CONNECTION_destroy (tcp_probe->sock);
3114 GNUNET_free(tcp_probe); 3114 GNUNET_free (tcp_probe);
3115 } 3115 }
3116 GNUNET_CONTAINER_multipeermap_destroy (plugin->nat_wait_conns); 3116 GNUNET_CONTAINER_multipeermap_destroy (plugin->nat_wait_conns);
3117 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap); 3117 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap);