diff options
-rw-r--r-- | src/block/block.c | 36 | ||||
-rw-r--r-- | src/block/plugin_block_template.c | 13 | ||||
-rw-r--r-- | src/block/plugin_block_test.c | 13 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_clients.c | 14 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_datacache.c | 16 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 13 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_routing.c | 13 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_clients.c | 31 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_datacache.c | 49 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.c | 1 | ||||
-rw-r--r-- | src/dht/plugin_block_dht.c | 20 | ||||
-rw-r--r-- | src/dns/plugin_block_dns.c | 11 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 89 | ||||
-rw-r--r-- | src/fs/plugin_block_fs.c | 51 | ||||
-rw-r--r-- | src/fs/test_plugin_block_fs.c | 27 | ||||
-rw-r--r-- | src/gns/plugin_block_gns.c | 17 | ||||
-rw-r--r-- | src/include/gnunet_block_lib.h | 46 | ||||
-rw-r--r-- | src/include/gnunet_block_plugin.h | 13 | ||||
-rw-r--r-- | src/regex/plugin_block_regex.c | 67 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 4 |
20 files changed, 374 insertions, 170 deletions
diff --git a/src/block/block.c b/src/block/block.c index e4ce585e72..0e7b4a6ba3 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -197,6 +197,7 @@ find_plugin (struct GNUNET_BLOCK_Context *ctx, * * @param ctx block contxt * @param type block type + * @param eo control flags * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) * @param bf_mutator mutation value for @a bf @@ -209,18 +210,29 @@ find_plugin (struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_EvaluationResult GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, - const struct GNUNET_HashCode * query, + enum GNUNET_BLOCK_EvaluationOptions eo, + const struct GNUNET_HashCode *query, struct GNUNET_CONTAINER_BloomFilter **bf, - int32_t bf_mutator, const void *xquery, - size_t xquery_size, const void *reply_block, + int32_t bf_mutator, + const void *xquery, + size_t xquery_size, + const void *reply_block, size_t reply_block_size) { struct GNUNET_BLOCK_PluginFunctions *plugin = find_plugin (ctx, type); if (plugin == NULL) return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; - return plugin->evaluate (plugin->cls, type, query, bf, bf_mutator, xquery, - xquery_size, reply_block, reply_block_size); + return plugin->evaluate (plugin->cls, + type, + eo, + query, + bf, + bf_mutator, + xquery, + xquery_size, + reply_block, + reply_block_size); } @@ -237,8 +249,10 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, */ int GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, - enum GNUNET_BLOCK_Type type, const void *block, - size_t block_size, struct GNUNET_HashCode * key) + enum GNUNET_BLOCK_Type type, + const void *block, + size_t block_size, + struct GNUNET_HashCode *key) { struct GNUNET_BLOCK_PluginFunctions *plugin = find_plugin (ctx, type); @@ -250,9 +264,9 @@ GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, /** * How many bytes should a bloomfilter be if we have already seen - * entry_count responses? Note that GNUNET_CONSTANTS_BLOOMFILTER_K gives us the number - * of bits set per entry. Furthermore, we should not re-size the - * filter too often (to keep it cheap). + * entry_count responses? Note that #GNUNET_CONSTANTS_BLOOMFILTER_K + * gives us the number of bits set per entry. Furthermore, we should + * not re-size the filter too often (to keep it cheap). * * Since other peers will also add entries but not resize the filter, * we should generally pick a slightly larger size than what the @@ -291,7 +305,7 @@ compute_bloomfilter_size (unsigned int entry_count) */ struct GNUNET_CONTAINER_BloomFilter * GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator, - const struct GNUNET_HashCode * seen_results, + const struct GNUNET_HashCode *seen_results, unsigned int seen_results_count) { struct GNUNET_CONTAINER_BloomFilter *bf; diff --git a/src/block/plugin_block_template.c b/src/block/plugin_block_template.c index 9132d7557f..3cb648db7a 100644 --- a/src/block/plugin_block_template.c +++ b/src/block/plugin_block_template.c @@ -36,6 +36,7 @@ * * @param cls closure * @param type block type + * @param eo control flags * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) * @param bf_mutator mutation value for bf @@ -46,11 +47,15 @@ * @return characterization of result */ static enum GNUNET_BLOCK_EvaluationResult -block_plugin_template_evaluate (void *cls, enum GNUNET_BLOCK_Type type, - const struct GNUNET_HashCode * query, +block_plugin_template_evaluate (void *cls, + enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_EvaluationOptions eo, + const struct GNUNET_HashCode *query, struct GNUNET_CONTAINER_BloomFilter **bf, - int32_t bf_mutator, const void *xquery, - size_t xquery_size, const void *reply_block, + int32_t bf_mutator, + const void *xquery, + size_t xquery_size, + const void *reply_block, size_t reply_block_size) { struct GNUNET_HashCode chash; diff --git a/src/block/plugin_block_test.c b/src/block/plugin_block_test.c index 8c476aaa3e..6859f4f675 100644 --- a/src/block/plugin_block_test.c +++ b/src/block/plugin_block_test.c @@ -41,6 +41,7 @@ * * @param cls closure * @param type block type + * @param eo control flags * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) * @param bf_mutator mutation value for @a bf @@ -51,11 +52,15 @@ * @return characterization of result */ static enum GNUNET_BLOCK_EvaluationResult -block_plugin_test_evaluate (void *cls, enum GNUNET_BLOCK_Type type, - const struct GNUNET_HashCode * query, +block_plugin_test_evaluate (void *cls, + enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_EvaluationOptions eo, + const struct GNUNET_HashCode *query, struct GNUNET_CONTAINER_BloomFilter **bf, - int32_t bf_mutator, const void *xquery, - size_t xquery_size, const void *reply_block, + int32_t bf_mutator, + const void *xquery, + size_t xquery_size, + const void *reply_block, size_t reply_block_size) { struct GNUNET_HashCode chash; diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c index ae9e3f25db..ec957737f9 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) return GNUNET_YES; /* duplicate */ } eval = - GNUNET_BLOCK_evaluate (GDS_block_context, record->type, key, NULL, 0, - record->xquery, record->xquery_size, frc->data, + GNUNET_BLOCK_evaluate (GDS_block_context, + record->type, + GNUNET_BLOCK_EO_NONE, + key, + NULL, + 0, + record->xquery, + record->xquery_size, + frc->data, frc->data_size); LOG (GNUNET_ERROR_TYPE_DEBUG, "Evaluation result is %d for key %s for local client's query\n", - (int) eval, GNUNET_h2s (key)); + (int) eval, + GNUNET_h2s (key)); switch (eval) { 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 78f863e011..48ce941c1d 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, enum GNUNET_BLOCK_EvaluationResult eval; eval = - GNUNET_BLOCK_evaluate (GDS_block_context, type, key, ctx->reply_bf, - ctx->reply_bf_mutator, ctx->xquery, - ctx->xquery_size, data, size); + GNUNET_BLOCK_evaluate (GDS_block_context, + type, + GNUNET_BLOCK_EO_NONE, + key, + ctx->reply_bf, + ctx->reply_bf_mutator, + ctx->xquery, + ctx->xquery_size, + data, + size); LOG (GNUNET_ERROR_TYPE_DEBUG, "Found reply for query %s in datacache, evaluation result is %d\n", - GNUNET_h2s (key), (int) eval); + GNUNET_h2s (key), + (int) eval); ctx->eval = eval; switch (eval) { diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 9e23be3bc2..caa226dad6 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, { switch (GNUNET_BLOCK_evaluate (GDS_block_context, ntohl (put->type), + GNUNET_BLOCK_EO_NONE, NULL, /* query */ NULL, 0, /* bloom filer */ NULL, 0, /* xquery */ @@ -1953,8 +1954,16 @@ handle_dht_p2p_get (void *cls, GNUNET_CONTAINER_bloomfilter_init (&xquery[xquery_size], reply_bf_size, GNUNET_CONSTANTS_BLOOMFILTER_K); eval = - GNUNET_BLOCK_evaluate (GDS_block_context, type, &get->key, &reply_bf, - get->bf_mutator, xquery, xquery_size, NULL, 0); + GNUNET_BLOCK_evaluate (GDS_block_context, + type, + GNUNET_BLOCK_EO_NONE, + &get->key, + &reply_bf, + get->bf_mutator, + xquery, + xquery_size, + NULL, + 0); if (eval != GNUNET_BLOCK_EVALUATION_REQUEST_VALID) { /* 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 e42db80738..318ebecb2c 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) eval_key = key; } eval = - GNUNET_BLOCK_evaluate (GDS_block_context, pc->type, eval_key, - &rr->reply_bf, rr->reply_bf_mutator, rr->xquery, - rr->xquery_size, pc->data, pc->data_size); + GNUNET_BLOCK_evaluate (GDS_block_context, + pc->type, + GNUNET_BLOCK_EO_NONE, + eval_key, + &rr->reply_bf, + rr->reply_bf_mutator, + rr->xquery, + rr->xquery_size, + pc->data, + pc->data_size); switch (eval) { 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 c9c9c7134f..a055a652ca 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) int do_free; struct GNUNET_HashCode ch; unsigned int i; - + LOG_TRAFFIC (GNUNET_ERROR_TYPE_DEBUG, "XVINE CLIENT-RESULT %s\n", GNUNET_h2s_full (key)); @@ -519,8 +519,13 @@ forward_reply (void *cls, const struct GNUNET_HashCode * key, void *value) return GNUNET_YES; /* duplicate */ } eval = - GNUNET_BLOCK_evaluate (GDS_block_context, record->type, key, NULL, 0, - record->xquery, record->xquery_size, frc->data, + GNUNET_BLOCK_evaluate (GDS_block_context, + record->type, + GNUNET_BLOCK_EO_NONE, + key, NULL, 0, + record->xquery, + record->xquery_size, + frc->data, frc->data_size); LOG (GNUNET_ERROR_TYPE_DEBUG, "Evaluation result is %d for key %s for local client's query\n", @@ -834,7 +839,7 @@ GDS_CLIENTS_process_put (uint32_t options, /** - * Route the given request via the DHT. + * Route the given request via the DHT. */ static void transmit_request (struct ClientQueryRecord *cqr) @@ -843,16 +848,16 @@ transmit_request (struct ClientQueryRecord *cqr) gettext_noop ("# GET requests from clients injected"), 1, GNUNET_NO); - + LOG (GNUNET_ERROR_TYPE_DEBUG, "Initiating GET for %s, replication %u, already have %u replies\n", GNUNET_h2s (&cqr->key), cqr->replication, cqr->seen_replies_count); - - GDS_NEIGHBOURS_handle_get (&cqr->key, cqr->type, cqr->msg_options, + + GDS_NEIGHBOURS_handle_get (&cqr->key, cqr->type, cqr->msg_options, cqr->replication); - + /* exponential back-off for retries. * max GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD (15 min) */ 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, ntohl (put_msg->type), size - sizeof (struct GNUNET_DHT_ClientPutMessage), &put_msg[1]); - - GDS_NEIGHBOURS_handle_put (&put_msg->key, + + GDS_NEIGHBOURS_handle_put (&put_msg->key, ntohl (put_msg->type), ntohl (put_msg->options), ntohl (put_msg->desired_replication_level), GNUNET_TIME_absolute_ntoh (put_msg->expiration), @@ -1013,11 +1018,11 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client, cqr->replication = ntohl (get->desired_replication_level); cqr->msg_options = ntohl (get->options); cqr->type = ntohl (get->type); - + // FIXME use cqr->key, set multihashmap create to GNUNET_YES GNUNET_CONTAINER_multihashmap_put (forward_map, &get->key, cqr, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); - + struct GNUNET_PeerIdentity my_identity; my_identity = GDS_NEIGHBOURS_get_my_id(); GDS_CLIENTS_process_get (ntohl (get->options), @@ -1309,7 +1314,7 @@ handle_dht_act_malicious (void *cls, struct GNUNET_SERVER_Client *client, msg = (const struct GNUNET_DHT_ActMaliciousMessage *)message; malicious_action = msg->action; - + if(GNUNET_OK == GDS_NEIGHBOURS_act_malicious (malicious_action)) { 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 558832e5bc..9fbff7dfb7 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, const void *data) { int r; - + if (NULL == datacache) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -76,12 +76,12 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, GNUNET_break (0); return; } - + /* Put size is actual data size plus struct overhead plus path length (if any) */ GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# ITEMS stored in datacache"), 1, GNUNET_NO); - + struct GNUNET_PeerIdentity peer = GDS_NEIGHBOURS_get_my_id(); DEBUG("DATACACHE_PUT KEY = %s, peer = %s\n",GNUNET_h2s(key),GNUNET_i2s(&peer)); r = GNUNET_DATACACHE_put (datacache, key, data_size, data, type, expiration, @@ -180,32 +180,41 @@ struct GetRequestContext /** * Iterator for local get request results, * - * @param cls closure for iterator, a DatacacheGetContext - * @param exp when does this value expire? + * @param cls closure for iterator, a `struct GetRequestContext` * @param key the key this data is stored under * @param size the size of the data identified by key * @param data the actual data * @param type the type of the data - * @param put_path_length number of peers in 'put_path' + * @param exp when does this value expire? + * @param put_path_length number of peers in @a put_path * @param put_path path the reply took on put - * @return GNUNET_OK to continue iteration, anything else + * @return #GNUNET_OK to continue iteration, anything else * to stop iteration. */ static int datacache_get_iterator (void *cls, - const struct GNUNET_HashCode * key, size_t size, - const char *data, enum GNUNET_BLOCK_Type type, - struct GNUNET_TIME_Absolute exp, - unsigned int put_path_length, - const struct GNUNET_PeerIdentity *put_path) + const struct GNUNET_HashCode *key, + size_t size, + const char *data, + enum GNUNET_BLOCK_Type type, + struct GNUNET_TIME_Absolute exp, + unsigned int put_path_length, + const struct GNUNET_PeerIdentity *put_path) { struct GetRequestContext *ctx = cls; enum GNUNET_BLOCK_EvaluationResult eval; eval = - GNUNET_BLOCK_evaluate (GDS_block_context, type, key, ctx->reply_bf, - ctx->reply_bf_mutator, ctx->xquery, - ctx->xquery_size, data, size); + GNUNET_BLOCK_evaluate (GDS_block_context, + type, + GNUNET_BLOCK_EO_NONE, + key, + ctx->reply_bf, + ctx->reply_bf_mutator, + ctx->xquery, + ctx->xquery_size, + data, + size); LOG (GNUNET_ERROR_TYPE_DEBUG, "Found reply for query %s in datacache, evaluation result is %d\n", GNUNET_h2s (key), (int) eval); @@ -221,7 +230,7 @@ datacache_get_iterator (void *cls, ("# Good RESULTS found in datacache"), 1, GNUNET_NO); struct GNUNET_PeerIdentity *get_path; - get_path = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity) * + get_path = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity) * ctx->get_path_length); struct GetPath *iterator; iterator = ctx->head; @@ -271,7 +280,7 @@ datacache_get_iterator (void *cls, _("Unsupported block type (%u) in local response!\n"), type); break; } - + return (eval == GNUNET_BLOCK_EVALUATION_OK_LAST) ? GNUNET_NO : GNUNET_OK; } @@ -315,13 +324,13 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key, ctx.reply_bf = reply_bf; ctx.reply_bf_mutator = reply_bf_mutator; ctx.get_path_length = get_path_length; - + if (next_hop != NULL) { memcpy (&(ctx.next_hop), next_hop, sizeof (struct GNUNET_PeerIdentity)); } unsigned int i = 0; - + ctx.head = NULL; ctx.tail = NULL; if (get_path != NULL) @@ -337,7 +346,7 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key, i++; } } - + r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator, &ctx); 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 3d14fbcd4a..8339f9ce14 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, { switch (GNUNET_BLOCK_evaluate (GDS_block_context, ntohl (put->block_type), + GNUNET_BLOCK_EO_NONE, NULL, /* query */ NULL, 0, /* bloom filer */ NULL, 0, /* xquery */ diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c index dc26e03512..c5d902fa9b 100644 --- a/src/dht/plugin_block_dht.c +++ b/src/dht/plugin_block_dht.c @@ -36,10 +36,11 @@ /** * Function called to validate a reply or a request. For - * request evaluation, simply pass "NULL" for the reply_block. + * request evaluation, simply pass "NULL" for the @a reply_block. * * @param cls closure * @param type block type + * @param eo control flags * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) * @param bf_mutator mutation value for @a bf @@ -50,11 +51,15 @@ * @return characterization of result */ static enum GNUNET_BLOCK_EvaluationResult -block_plugin_dht_evaluate (void *cls, enum GNUNET_BLOCK_Type type, - const struct GNUNET_HashCode * query, +block_plugin_dht_evaluate (void *cls, + enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_EvaluationOptions eo, + const struct GNUNET_HashCode *query, struct GNUNET_CONTAINER_BloomFilter **bf, - int32_t bf_mutator, const void *xquery, - size_t xquery_size, const void *reply_block, + int32_t bf_mutator, + const void *xquery, + size_t xquery_size, + const void *reply_block, size_t reply_block_size) { struct GNUNET_HashCode mhash; @@ -100,9 +105,8 @@ block_plugin_dht_evaluate (void *cls, enum GNUNET_BLOCK_Type type, } else { - *bf = - GNUNET_CONTAINER_bloomfilter_init (NULL, 8, - GNUNET_CONSTANTS_BLOOMFILTER_K); + *bf = GNUNET_CONTAINER_bloomfilter_init (NULL, 8, + GNUNET_CONSTANTS_BLOOMFILTER_K); } GNUNET_CONTAINER_bloomfilter_add (*bf, &mhash); } diff --git a/src/dns/plugin_block_dns.c b/src/dns/plugin_block_dns.c index a5ed8fea28..f24bfda80c 100644 --- a/src/dns/plugin_block_dns.c +++ b/src/dns/plugin_block_dns.c @@ -39,6 +39,7 @@ * * @param cls closure * @param type block type + * @param eo control flags * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) * @param bf_mutator mutation value for bf @@ -49,11 +50,15 @@ * @return characterization of result */ static enum GNUNET_BLOCK_EvaluationResult -block_plugin_dns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, +block_plugin_dns_evaluate (void *cls, + enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_EvaluationOptions eo, const struct GNUNET_HashCode * query, struct GNUNET_CONTAINER_BloomFilter **bf, - int32_t bf_mutator, const void *xquery, - size_t xquery_size, const void *reply_block, + int32_t bf_mutator, + const void *xquery, + size_t xquery_size, + const void *reply_block, size_t reply_block_size) { 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 545c7c6572..709874f75c 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -748,6 +748,11 @@ struct ProcessReplyClosure enum GNUNET_BLOCK_Type type; /** + * Control flags for evaluation. + */ + enum GNUNET_BLOCK_EvaluationOptions eo; + + /** * How much was this reply worth to us? */ uint32_t priority; @@ -790,7 +795,7 @@ update_request_performance_data (struct ProcessReplyClosure *prq, /** * We have received a reply; handle it! * - * @param cls response (struct ProcessReplyClosure) + * @param cls response (a `struct ProcessReplyClosure`) * @param key our query * @param value value in the hash map (info about the query) * @return #GNUNET_YES (we should continue to iterate) @@ -809,13 +814,21 @@ process_reply (void *cls, return GNUNET_YES; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Matched result (type %u) for query `%s' with pending request\n", - (unsigned int) prq->type, GNUNET_h2s (key)); + (unsigned int) prq->type, + GNUNET_h2s (key)); GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# replies received and matched"), 1, GNUNET_NO); prq->eval = - GNUNET_BLOCK_evaluate (GSF_block_ctx, prq->type, key, &pr->bf, pr->mingle, - NULL, 0, prq->data, + GNUNET_BLOCK_evaluate (GSF_block_ctx, + prq->type, + prq->eo, + key, + &pr->bf, + pr->mingle, + NULL, + 0, + prq->data, prq->size); switch (prq->eval) { @@ -864,20 +877,26 @@ process_reply (void *cls, GNUNET_break (0); return GNUNET_YES; case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED: - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Unsupported block type %u\n"), + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Unsupported block type %u\n"), prq->type); return GNUNET_NO; } /* update bloomfilter */ - GNUNET_CRYPTO_hash (prq->data, prq->size, &chash); - GSF_pending_request_update_ (pr, &chash, 1); + GNUNET_CRYPTO_hash (prq->data, + prq->size, + &chash); + GSF_pending_request_update_ (pr, + &chash, + 1); if (NULL == prq->sender) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found result for query `%s' in local datastore\n", GNUNET_h2s (key)); GNUNET_STATISTICS_update (GSF_stats, - gettext_noop ("# results found locally"), 1, + gettext_noop ("# results found locally"), + 1, GNUNET_NO); } else @@ -894,9 +913,15 @@ process_reply (void *cls, prq->sender, &last_transmission)) last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; - pr->rh (pr->rh_cls, prq->eval, pr, - prq->anonymity_level, prq->expiration, - last_transmission, prq->type, prq->data, prq->size); + pr->rh (pr->rh_cls, + prq->eval, + pr, + prq->anonymity_level, + prq->expiration, + last_transmission, + prq->type, + prq->data, + prq->size); return GNUNET_YES; } @@ -1076,6 +1101,7 @@ handle_dht_reply (void *cls, prq.expiration); prq.size = size; prq.type = type; + prq.eo = GNUNET_BLOCK_EO_NONE; process_reply (&prq, key, pr); if ((GNUNET_YES == active_to_migration) && (GNUNET_NO == test_put_load_too_high (prq.priority))) @@ -1207,6 +1233,7 @@ cadet_reply_proc (void *cls, prq.expiration); prq.size = data_size; prq.type = type; + prq.eo = GNUNET_BLOCK_EO_NONE; process_reply (&prq, &query, pr); } @@ -1283,9 +1310,9 @@ odc_warn_delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * peer and if we are done either clean up (operation * complete) or forward to other peers (more results possible). * - * @param cls our closure (struct PendingRequest) + * @param cls our closure (`struct GSF_PendingRequest *`) * @param key key for the content - * @param size number of bytes in data + * @param size number of bytes in @a data * @param data content stored * @param type type of the content * @param priority priority of the content @@ -1295,10 +1322,15 @@ odc_warn_delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * maybe 0 if no unique identifier is available */ static void -process_local_reply (void *cls, const struct GNUNET_HashCode * key, size_t size, - const void *data, enum GNUNET_BLOCK_Type type, - uint32_t priority, uint32_t anonymity, - struct GNUNET_TIME_Absolute expiration, uint64_t uid) +process_local_reply (void *cls, + const struct GNUNET_HashCode *key, + size_t size, + const void *data, + enum GNUNET_BLOCK_Type type, + uint32_t priority, + uint32_t anonymity, + struct GNUNET_TIME_Absolute expiration, + uint64_t uid) { struct GSF_PendingRequest *pr = cls; GSF_LocalLookupContinuation cont; @@ -1464,8 +1496,9 @@ process_local_reply (void *cls, const struct GNUNET_HashCode * key, size_t size, prq.priority = priority; prq.request_found = GNUNET_NO; prq.anonymity_level = anonymity; - if ((old_rf == 0) && (pr->public_data.results_found == 0)) + if ((0 == old_rf) && (0 == pr->public_data.results_found)) GSF_update_datastore_delay_ (pr->public_data.start_time); + prq.eo = GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO; process_reply (&prq, key, pr); pr->local_result = prq.eval; 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, GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# Datastore lookups concluded (found last result)"), - 1, GNUNET_NO); + 1, + GNUNET_NO); goto check_error_and_continue; } 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, GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# Datastore lookups concluded (load too high)"), - 1, GNUNET_NO); + 1, + GNUNET_NO); goto check_error_and_continue; } pr->qe_start = GNUNET_TIME_absolute_get (); pr->warn_task = - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &warn_delay_task, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, + &warn_delay_task, pr); pr->qe = GNUNET_DATASTORE_get_key (GSF_dsh, pr->local_result_offset++, @@ -1553,7 +1589,7 @@ check_error_and_continue: * * @param pr request * @param target - * @return GNUNET_YES if this request could be forwarded to the given peer + * @return #GNUNET_YES if this request could be forwarded to the given peer */ int GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr, @@ -1576,11 +1612,12 @@ GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr, * * @param pr the pending request to process * @param cont function to call at the end - * @param cont_cls closure for cont + * @param cont_cls closure for @a cont */ void GSF_local_lookup_ (struct GSF_PendingRequest *pr, - GSF_LocalLookupContinuation cont, void *cont_cls) + GSF_LocalLookupContinuation cont, + void *cont_cls) { GNUNET_assert (NULL == pr->gh); GNUNET_assert (NULL == pr->cadet_request); @@ -1682,7 +1719,8 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, return GNUNET_SYSERR; } GNUNET_STATISTICS_update (GSF_stats, - gettext_noop ("# GAP PUT messages received"), 1, + gettext_noop ("# GAP PUT messages received"), + 1, GNUNET_NO); /* now, lookup 'query' */ prq.data = (const void *) &put[1]; @@ -1693,6 +1731,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, prq.priority = 0; prq.anonymity_level = UINT32_MAX; prq.request_found = GNUNET_NO; + prq.eo = GNUNET_BLOCK_EO_NONE; GNUNET_CONTAINER_multihashmap_get_multiple (pr_map, &query, &process_reply, diff --git a/src/fs/plugin_block_fs.c b/src/fs/plugin_block_fs.c index bc2e2d507c..c032899c56 100644 --- a/src/fs/plugin_block_fs.c +++ b/src/fs/plugin_block_fs.c @@ -42,25 +42,30 @@ * request evaluation, simply pass "NULL" for the reply_block. * Note that it is assumed that the reply has already been * matched to the key (and signatures checked) as it would - * be done with the "get_key" function. + * be done with the #GNUNET_BLOCK_get_key() function. * * @param cls closure * @param type block type + * @param eo control flags * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) - * @param bf_mutator mutation value for bf + * @param bf_mutator mutation value for @a bf * @param xquery extrended query data (can be NULL, depending on type) - * @param xquery_size number of bytes in xquery + * @param xquery_size number of bytes in @a xquery * @param reply_block response to validate - * @param reply_block_size number of bytes in reply block + * @param reply_block_size number of bytes in @a reply_block * @return characterization of result */ static enum GNUNET_BLOCK_EvaluationResult -block_plugin_fs_evaluate (void *cls, enum GNUNET_BLOCK_Type type, +block_plugin_fs_evaluate (void *cls, + enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_EvaluationOptions eo, const struct GNUNET_HashCode *query, struct GNUNET_CONTAINER_BloomFilter **bf, - int32_t bf_mutator, const void *xquery, - size_t xquery_size, const void *reply_block, + int32_t bf_mutator, + const void *xquery, + size_t xquery_size, + const void *reply_block, size_t reply_block_size) { const struct UBlock *ub; @@ -110,22 +115,28 @@ block_plugin_fs_evaluate (void *cls, enum GNUNET_BLOCK_Type type, GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } - if (GNUNET_OK != - GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK, - &ub->purpose, - &ub->signature, - &ub->verification_key)) + if ( (0 == (eo & GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO)) && + (GNUNET_OK != + GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK, + &ub->purpose, + &ub->signature, + &ub->verification_key)) ) { GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } if (NULL != bf) { - GNUNET_CRYPTO_hash (reply_block, reply_block_size, &chash); - GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash); + GNUNET_CRYPTO_hash (reply_block, + reply_block_size, + &chash); + GNUNET_BLOCK_mingle_hash (&chash, + bf_mutator, + &mhash); if (NULL != *bf) { - if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash)) + if (GNUNET_YES == + GNUNET_CONTAINER_bloomfilter_test (*bf, &mhash)) return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; } else @@ -147,14 +158,16 @@ block_plugin_fs_evaluate (void *cls, enum GNUNET_BLOCK_Type type, * @param cls closure * @param type block type * @param block block to get the key for - * @param block_size number of bytes in block + * @param block_size number of bytes in @a block * @param key set to the key (query) for the given block - * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported + * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported * (or if extracting a key from a block of this type does not work) */ static int -block_plugin_fs_get_key (void *cls, enum GNUNET_BLOCK_Type type, - const void *block, size_t block_size, +block_plugin_fs_get_key (void *cls, + enum GNUNET_BLOCK_Type type, + const void *block, + size_t block_size, struct GNUNET_HashCode *key) { const struct UBlock *ub; diff --git a/src/fs/test_plugin_block_fs.c b/src/fs/test_plugin_block_fs.c index 208f4ce78d..9e1246f72d 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) sizeof (block), &key)) return 1; if (GNUNET_BLOCK_EVALUATION_OK_LAST != - GNUNET_BLOCK_evaluate (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, &key, NULL, 0, - NULL, 0, block, sizeof (block))) + GNUNET_BLOCK_evaluate (ctx, + GNUNET_BLOCK_TYPE_FS_DBLOCK, + GNUNET_BLOCK_EO_NONE, + &key, + NULL, 0, + NULL, 0, + block, sizeof (block))) return 2; if (GNUNET_BLOCK_EVALUATION_REQUEST_VALID != - GNUNET_BLOCK_evaluate (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, &key, NULL, 0, - NULL, 0, NULL, 0)) + GNUNET_BLOCK_evaluate (ctx, + GNUNET_BLOCK_TYPE_FS_DBLOCK, + GNUNET_BLOCK_EO_NONE, + &key, + NULL, 0, + NULL, 0, + NULL, 0)) return 4; GNUNET_log_skip (1, GNUNET_NO); if (GNUNET_BLOCK_EVALUATION_REQUEST_INVALID != - GNUNET_BLOCK_evaluate (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, &key, NULL, 0, - "bogus", 5, NULL, 0)) + GNUNET_BLOCK_evaluate (ctx, + GNUNET_BLOCK_TYPE_FS_DBLOCK, + GNUNET_BLOCK_EO_NONE, + &key, + NULL, 0, + "bogus", 5, + NULL, 0)) return 8; GNUNET_log_skip (0, GNUNET_YES); return 0; diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c index a677f7f62a..8c08c4fc2a 100644 --- a/src/gns/plugin_block_gns.c +++ b/src/gns/plugin_block_gns.c @@ -44,6 +44,7 @@ * * @param cls closure * @param type block type + * @param eo control flags * @param query original query (hash) * @param bf pointer to bloom filter associated with @a query; possibly updated (!) * @param bf_mutator mutation value for @a bf @@ -54,12 +55,16 @@ * @return characterization of result */ static enum GNUNET_BLOCK_EvaluationResult -block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, - const struct GNUNET_HashCode *query, - struct GNUNET_CONTAINER_BloomFilter **bf, - int32_t bf_mutator, const void *xquery, - size_t xquery_size, const void *reply_block, - size_t reply_block_size) +block_plugin_gns_evaluate (void *cls, + enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_EvaluationOptions eo, + const struct GNUNET_HashCode *query, + struct GNUNET_CONTAINER_BloomFilter **bf, + int32_t bf_mutator, + const void *xquery, + size_t xquery_size, + const void *reply_block, + size_t reply_block_size) { const struct GNUNET_GNSRECORD_Block *block; struct GNUNET_HashCode h; diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h index d47bb45792..bf934b5040 100644 --- a/src/include/gnunet_block_lib.h +++ b/src/include/gnunet_block_lib.h @@ -119,6 +119,25 @@ enum GNUNET_BLOCK_Type /** + * Flags that can be set to control the evaluation. + */ +enum GNUNET_BLOCK_EvaluationOptions +{ + + /** + * Default behavior. + */ + GNUNET_BLOCK_EO_NONE = 0, + + /** + * The block is obtained from the local database, skip cryptographic + * checks. + */ + GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO = 1 +}; + + +/** * Possible ways for how a block may relate to a query. */ enum GNUNET_BLOCK_EvaluationResult @@ -181,8 +200,9 @@ struct GNUNET_BLOCK_Context; * @param hc where to store the result. */ void -GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode * in, uint32_t mingle_number, - struct GNUNET_HashCode * hc); +GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in, + uint32_t mingle_number, + struct GNUNET_HashCode *hc); /** @@ -206,13 +226,14 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx); /** * Function called to validate a reply or a request. For - * request evaluation, simply pass "NULL" for the reply_block. + * request evaluation, simply pass "NULL" for the @a reply_block. * Note that it is assumed that the reply has already been * matched to the key (and signatures checked) as it would - * be done with the "get_key" function. + * be done with the #GNUNET_BLOCK_get_key() function. * * @param ctx block contxt * @param type block type + * @param eo evaluation options to control evaluation * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) * @param bf_mutator mutation value for @a bf @@ -225,10 +246,13 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx); enum GNUNET_BLOCK_EvaluationResult GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, - const struct GNUNET_HashCode * query, + enum GNUNET_BLOCK_EvaluationOptions eo, + const struct GNUNET_HashCode *query, struct GNUNET_CONTAINER_BloomFilter **bf, - int32_t bf_mutator, const void *xquery, - size_t xquery_size, const void *reply_block, + int32_t bf_mutator, + const void *xquery, + size_t xquery_size, + const void *reply_block, size_t reply_block_size); @@ -247,8 +271,10 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, */ int GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, - enum GNUNET_BLOCK_Type type, const void *block, - size_t block_size, struct GNUNET_HashCode * key); + enum GNUNET_BLOCK_Type type, + const void *block, + size_t block_size, + struct GNUNET_HashCode * key); @@ -264,7 +290,7 @@ GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, */ struct GNUNET_CONTAINER_BloomFilter * GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator, - const struct GNUNET_HashCode * seen_results, + const struct GNUNET_HashCode *seen_results, unsigned int seen_results_count); diff --git a/src/include/gnunet_block_plugin.h b/src/include/gnunet_block_plugin.h index b4a60b4631..a588dde698 100644 --- a/src/include/gnunet_block_plugin.h +++ b/src/include/gnunet_block_plugin.h @@ -42,6 +42,7 @@ * * @param cls closure * @param type block type + * @param eo evaluation options to control evaluation * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) * @param bf_mutator mutation value for @a bf @@ -54,6 +55,7 @@ typedef enum GNUNET_BLOCK_EvaluationResult (*GNUNET_BLOCK_EvaluationFunction) (void *cls, enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_EvaluationOptions eo, const struct GNUNET_HashCode *query, struct GNUNET_CONTAINER_BloomFilter **bf, int32_t bf_mutator, @@ -76,11 +78,12 @@ typedef enum GNUNET_BLOCK_EvaluationResult * #GNUNET_SYSERR if type not supported * (or if extracting a key from a block of this type does not work) */ -typedef int (*GNUNET_BLOCK_GetKeyFunction) (void *cls, - enum GNUNET_BLOCK_Type type, - const void *block, - size_t block_size, - struct GNUNET_HashCode * key); +typedef int +(*GNUNET_BLOCK_GetKeyFunction) (void *cls, + enum GNUNET_BLOCK_Type type, + const void *block, + size_t block_size, + struct GNUNET_HashCode *key); diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c index 874f6b4ccd..2d6a5b6930 100644 --- a/src/regex/plugin_block_regex.c +++ b/src/regex/plugin_block_regex.c @@ -34,29 +34,34 @@ /** * Function called to validate a reply or a request of type - * GNUNET_BLOCK_TYPE_REGEX. + * #GNUNET_BLOCK_TYPE_REGEX. * For request evaluation, pass "NULL" for the reply_block. * Note that it is assumed that the reply has already been * matched to the key (and signatures checked) as it would - * be done with the "get_key" function. + * be done with the #GNUNET_BLOCK_get_key() function. * * @param cls closure * @param type block type + * @param eo control flags * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) * @param bf_mutator mutation value for bf * @param xquery extrended query data (can be NULL, depending on type) - * @param xquery_size number of bytes in xquery + * @param xquery_size number of bytes in @a xquery * @param reply_block response to validate - * @param reply_block_size number of bytes in reply block + * @param reply_block_size number of bytes in @a reply_block * @return characterization of result */ static enum GNUNET_BLOCK_EvaluationResult -evaluate_block_regex (void *cls, enum GNUNET_BLOCK_Type type, +evaluate_block_regex (void *cls, + enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_EvaluationOptions eo, const struct GNUNET_HashCode *query, struct GNUNET_CONTAINER_BloomFilter **bf, - int32_t bf_mutator, const void *xquery, - size_t xquery_size, const void *reply_block, + int32_t bf_mutator, + const void *xquery, + size_t xquery_size, + const void *reply_block, size_t reply_block_size) { if (NULL == reply_block) @@ -131,25 +136,28 @@ evaluate_block_regex (void *cls, enum GNUNET_BLOCK_Type type, /** * Function called to validate a reply or a request of type - * GNUNET_BLOCK_TYPE_REGEX_ACCEPT. + * #GNUNET_BLOCK_TYPE_REGEX_ACCEPT. * For request evaluation, pass "NULL" for the reply_block. * Note that it is assumed that the reply has already been * matched to the key (and signatures checked) as it would - * be done with the "get_key" function. + * be done with the #GNUNET_BLOCK_get_key() function. * * @param cls closure * @param type block type + * @param eo control flags * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) * @param bf_mutator mutation value for bf * @param xquery extrended query data (can be NULL, depending on type) - * @param xquery_size number of bytes in xquery + * @param xquery_size number of bytes in @a xquery * @param reply_block response to validate - * @param reply_block_size number of bytes in reply block + * @param reply_block_size number of bytes in @a reply_block * @return characterization of result */ static enum GNUNET_BLOCK_EvaluationResult -evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type, +evaluate_block_regex_accept (void *cls, + enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_EvaluationOptions eo, const struct GNUNET_HashCode * query, struct GNUNET_CONTAINER_BloomFilter **bf, int32_t bf_mutator, const void *xquery, @@ -221,10 +229,11 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type, * request evaluation, simply pass "NULL" for the reply_block. * Note that it is assumed that the reply has already been * matched to the key (and signatures checked) as it would - * be done with the "get_key" function. + * be done with the #GNUNET_BLOCK_get_key() function. * * @param cls closure * @param type block type + * @param eo control flags * @param query original query (hash) * @param bf pointer to bloom filter associated with query; possibly updated (!) * @param bf_mutator mutation value for bf @@ -235,11 +244,15 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type, * @return characterization of result */ static enum GNUNET_BLOCK_EvaluationResult -block_plugin_regex_evaluate (void *cls, enum GNUNET_BLOCK_Type type, - const struct GNUNET_HashCode * query, +block_plugin_regex_evaluate (void *cls, + enum GNUNET_BLOCK_Type type, + enum GNUNET_BLOCK_EvaluationOptions eo, + const struct GNUNET_HashCode *query, struct GNUNET_CONTAINER_BloomFilter **bf, - int32_t bf_mutator, const void *xquery, - size_t xquery_size, const void *reply_block, + int32_t bf_mutator, + const void *xquery, + size_t xquery_size, + const void *reply_block, size_t reply_block_size) { enum GNUNET_BLOCK_EvaluationResult result; @@ -247,12 +260,20 @@ block_plugin_regex_evaluate (void *cls, enum GNUNET_BLOCK_Type type, switch (type) { case GNUNET_BLOCK_TYPE_REGEX: - result = evaluate_block_regex (cls, type, query, bf, bf_mutator, + result = evaluate_block_regex (cls, + type, + eo, + query, + bf, bf_mutator, xquery, xquery_size, reply_block, reply_block_size); break; case GNUNET_BLOCK_TYPE_REGEX_ACCEPT: - result = evaluate_block_regex_accept (cls, type, query, bf, bf_mutator, + result = evaluate_block_regex_accept (cls, + type, + eo, + query, + bf, bf_mutator, xquery, xquery_size, reply_block, reply_block_size); break; @@ -276,9 +297,11 @@ block_plugin_regex_evaluate (void *cls, enum GNUNET_BLOCK_Type type, * (or if extracting a key from a block of this type does not work) */ static int -block_plugin_regex_get_key (void *cls, enum GNUNET_BLOCK_Type type, - const void *block, size_t block_size, - struct GNUNET_HashCode * key) +block_plugin_regex_get_key (void *cls, + enum GNUNET_BLOCK_Type type, + const void *block, + size_t block_size, + struct GNUNET_HashCode *key) { switch (type) { diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index bc80dd1bf7..3a283e17b6 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) GNUNET_SERVICE_stop (plugin->service); else GNUNET_SERVER_destroy (plugin->server); - GNUNET_free(plugin->handlers); + GNUNET_free (plugin->handlers); if (NULL != plugin->nat) GNUNET_NAT_unregister (plugin->nat); while (NULL != (tcp_probe = plugin->probe_head)) @@ -3111,7 +3111,7 @@ libgnunet_plugin_transport_tcp_done (void *cls) plugin->probe_tail, tcp_probe); GNUNET_CONNECTION_destroy (tcp_probe->sock); - GNUNET_free(tcp_probe); + GNUNET_free (tcp_probe); } GNUNET_CONTAINER_multipeermap_destroy (plugin->nat_wait_conns); GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap); |