[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35326 - in gnunet/src: block dht dns fs gns include regex
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35326 - in gnunet/src: block dht dns fs gns include regex transport |
Date: |
Sat, 28 Feb 2015 22:12:04 +0100 |
Author: grothoff
Date: 2015-02-28 22:12:03 +0100 (Sat, 28 Feb 2015)
New Revision: 35326
Modified:
gnunet/src/block/block.c
gnunet/src/block/plugin_block_template.c
gnunet/src/block/plugin_block_test.c
gnunet/src/dht/gnunet-service-dht_clients.c
gnunet/src/dht/gnunet-service-dht_datacache.c
gnunet/src/dht/gnunet-service-dht_neighbours.c
gnunet/src/dht/gnunet-service-dht_routing.c
gnunet/src/dht/gnunet-service-xdht_clients.c
gnunet/src/dht/gnunet-service-xdht_datacache.c
gnunet/src/dht/gnunet-service-xdht_neighbours.c
gnunet/src/dht/plugin_block_dht.c
gnunet/src/dns/plugin_block_dns.c
gnunet/src/fs/gnunet-service-fs_pr.c
gnunet/src/fs/plugin_block_fs.c
gnunet/src/fs/test_plugin_block_fs.c
gnunet/src/gns/plugin_block_gns.c
gnunet/src/include/gnunet_block_lib.h
gnunet/src/include/gnunet_block_plugin.h
gnunet/src/regex/plugin_block_regex.c
gnunet/src/transport/plugin_transport_tcp.c
Log:
-extend block API to allow specifying flags, use this to allow reducing checks
for replies from local DB
Modified: gnunet/src/block/block.c
===================================================================
--- gnunet/src/block/block.c 2015-02-28 19:52:54 UTC (rev 35325)
+++ gnunet/src/block/block.c 2015-02-28 21:12:03 UTC (rev 35326)
@@ -197,6 +197,7 @@
*
* @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 @@
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 @@
*/
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 @@
/**
* 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 @@
*/
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;
Modified: gnunet/src/block/plugin_block_template.c
===================================================================
--- gnunet/src/block/plugin_block_template.c 2015-02-28 19:52:54 UTC (rev
35325)
+++ gnunet/src/block/plugin_block_template.c 2015-02-28 21:12:03 UTC (rev
35326)
@@ -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;
Modified: gnunet/src/block/plugin_block_test.c
===================================================================
--- gnunet/src/block/plugin_block_test.c 2015-02-28 19:52:54 UTC (rev
35325)
+++ gnunet/src/block/plugin_block_test.c 2015-02-28 21:12:03 UTC (rev
35326)
@@ -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;
Modified: gnunet/src/dht/gnunet-service-dht_clients.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_clients.c 2015-02-28 19:52:54 UTC (rev
35325)
+++ gnunet/src/dht/gnunet-service-dht_clients.c 2015-02-28 21:12:03 UTC (rev
35326)
@@ -1055,12 +1055,20 @@
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:
Modified: gnunet/src/dht/gnunet-service-dht_datacache.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_datacache.c 2015-02-28 19:52:54 UTC
(rev 35325)
+++ gnunet/src/dht/gnunet-service-dht_datacache.c 2015-02-28 21:12:03 UTC
(rev 35326)
@@ -148,12 +148,20 @@
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)
{
Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c 2015-02-28 19:52:54 UTC
(rev 35325)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c 2015-02-28 21:12:03 UTC
(rev 35326)
@@ -1708,6 +1708,7 @@
{
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 @@
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 */
Modified: gnunet/src/dht/gnunet-service-dht_routing.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_routing.c 2015-02-28 19:52:54 UTC (rev
35325)
+++ gnunet/src/dht/gnunet-service-dht_routing.c 2015-02-28 21:12:03 UTC (rev
35326)
@@ -199,9 +199,16 @@
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:
Modified: gnunet/src/dht/gnunet-service-xdht_clients.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_clients.c 2015-02-28 19:52:54 UTC
(rev 35325)
+++ gnunet/src/dht/gnunet-service-xdht_clients.c 2015-02-28 21:12:03 UTC
(rev 35326)
@@ -487,7 +487,7 @@
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 @@
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 @@
/**
- * 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 @@
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 @@
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 @@
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 @@
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) +
Modified: gnunet/src/dht/gnunet-service-xdht_datacache.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_datacache.c 2015-02-28 19:52:54 UTC
(rev 35325)
+++ gnunet/src/dht/gnunet-service-xdht_datacache.c 2015-02-28 21:12:03 UTC
(rev 35326)
@@ -64,7 +64,7 @@
const void *data)
{
int r;
-
+
if (NULL == datacache)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -76,12 +76,12 @@
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 @@
/**
* 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 @@
("# 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 @@
_("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 @@
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 @@
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);
Modified: gnunet/src/dht/gnunet-service-xdht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_neighbours.c 2015-02-28 19:52:54 UTC
(rev 35325)
+++ gnunet/src/dht/gnunet-service-xdht_neighbours.c 2015-02-28 21:12:03 UTC
(rev 35326)
@@ -3736,6 +3736,7 @@
{
switch (GNUNET_BLOCK_evaluate (GDS_block_context,
ntohl (put->block_type),
+ GNUNET_BLOCK_EO_NONE,
NULL, /* query */
NULL, 0, /* bloom filer */
NULL, 0, /* xquery */
Modified: gnunet/src/dht/plugin_block_dht.c
===================================================================
--- gnunet/src/dht/plugin_block_dht.c 2015-02-28 19:52:54 UTC (rev 35325)
+++ gnunet/src/dht/plugin_block_dht.c 2015-02-28 21:12:03 UTC (rev 35326)
@@ -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 @@
}
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);
}
Modified: gnunet/src/dns/plugin_block_dns.c
===================================================================
--- gnunet/src/dns/plugin_block_dns.c 2015-02-28 19:52:54 UTC (rev 35325)
+++ gnunet/src/dns/plugin_block_dns.c 2015-02-28 21:12:03 UTC (rev 35326)
@@ -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;
Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c 2015-02-28 19:52:54 UTC (rev
35325)
+++ gnunet/src/fs/gnunet-service-fs_pr.c 2015-02-28 21:12:03 UTC (rev
35326)
@@ -748,6 +748,11 @@
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 @@
/**
* 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 @@
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 @@
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 @@
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 @@
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 @@
prq.expiration);
prq.size = data_size;
prq.type = type;
+ prq.eo = GNUNET_BLOCK_EO_NONE;
process_reply (&prq, &query, pr);
}
@@ -1283,9 +1310,9 @@
* 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 @@
* 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 @@
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 @@
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 @@
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 @@
*
* @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 @@
*
* @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 @@
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 @@
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,
Modified: gnunet/src/fs/plugin_block_fs.c
===================================================================
--- gnunet/src/fs/plugin_block_fs.c 2015-02-28 19:52:54 UTC (rev 35325)
+++ gnunet/src/fs/plugin_block_fs.c 2015-02-28 21:12:03 UTC (rev 35326)
@@ -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 @@
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 @@
* @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;
Modified: gnunet/src/fs/test_plugin_block_fs.c
===================================================================
--- gnunet/src/fs/test_plugin_block_fs.c 2015-02-28 19:52:54 UTC (rev
35325)
+++ gnunet/src/fs/test_plugin_block_fs.c 2015-02-28 21:12:03 UTC (rev
35326)
@@ -38,17 +38,32 @@
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;
Modified: gnunet/src/gns/plugin_block_gns.c
===================================================================
--- gnunet/src/gns/plugin_block_gns.c 2015-02-28 19:52:54 UTC (rev 35325)
+++ gnunet/src/gns/plugin_block_gns.c 2015-02-28 21:12:03 UTC (rev 35326)
@@ -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;
Modified: gnunet/src/include/gnunet_block_lib.h
===================================================================
--- gnunet/src/include/gnunet_block_lib.h 2015-02-28 19:52:54 UTC (rev
35325)
+++ gnunet/src/include/gnunet_block_lib.h 2015-02-28 21:12:03 UTC (rev
35326)
@@ -119,6 +119,25 @@
/**
+ * 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 @@
* @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 @@
/**
* 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 @@
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 @@
*/
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 @@
*/
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);
Modified: gnunet/src/include/gnunet_block_plugin.h
===================================================================
--- gnunet/src/include/gnunet_block_plugin.h 2015-02-28 19:52:54 UTC (rev
35325)
+++ gnunet/src/include/gnunet_block_plugin.h 2015-02-28 21:12:03 UTC (rev
35326)
@@ -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 @@
* #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);
Modified: gnunet/src/regex/plugin_block_regex.c
===================================================================
--- gnunet/src/regex/plugin_block_regex.c 2015-02-28 19:52:54 UTC (rev
35325)
+++ gnunet/src/regex/plugin_block_regex.c 2015-02-28 21:12:03 UTC (rev
35326)
@@ -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 @@
/**
* 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 @@
* 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 @@
* @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 @@
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 @@
* (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)
{
Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2015-02-28 19:52:54 UTC (rev
35325)
+++ gnunet/src/transport/plugin_transport_tcp.c 2015-02-28 21:12:03 UTC (rev
35326)
@@ -3102,7 +3102,7 @@
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 @@
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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35326 - in gnunet/src: block dht dns fs gns include regex transport,
gnunet <=