aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_block_lib.h
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/include/gnunet_block_lib.h
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/include/gnunet_block_lib.h')
-rw-r--r--src/include/gnunet_block_lib.h46
1 files changed, 36 insertions, 10 deletions
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