aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2021-12-28 22:39:30 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2021-12-28 22:39:30 +0100
commit7205436569d1b1e0f10485dbdec087f19de865f8 (patch)
tree30fb962a463d55d3636040fdcb779075a76e50bf /src/include
parent88d8a6cec7c63e52cf042db9f384309ccece15b6 (diff)
downloadgnunet-7205436569d1b1e0f10485dbdec087f19de865f8.tar.gz
gnunet-7205436569d1b1e0f10485dbdec087f19de865f8.zip
-lsd0004 draft block API
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_block_lib.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index 73b51252e..341c7bb5c 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -342,6 +342,93 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
342 const void *reply_block, 342 const void *reply_block,
343 size_t reply_block_size); 343 size_t reply_block_size);
344 344
345/**
346 * WORK IN PROGRESS LSD0004
347 */
348
349/**
350 * Function called to validate a reply.
351 * Also checks the query key against the block contents
352 * as it would be done with the #GNUNET_BLOCK_get_key() function.
353 *
354 * @param ctx block contxt
355 * @param type block type
356 * @param group block group to use for evaluation
357 * @param query original query (hash)
358 * @param reply_block response to validate
359 * @param reply_block_size number of bytes in @a reply_block
360 * @return characterization of result
361 */
362enum GNUNET_BLOCK_ReplyEvaluationResult
363GNUNET_BLOCK_evaluate_reply (struct GNUNET_BLOCK_Context *ctx,
364 enum GNUNET_BLOCK_Type type,
365 struct GNUNET_BLOCK_Group *group,
366 const struct GNUNET_HashCode *query,
367 const void *reply_block,
368 size_t reply_block_size);
369
370
371
372/**
373 * Function called to validate a request.
374 *
375 * @param ctx block contxt
376 * @param type block type
377 * @param eo evaluation options to control evaluation
378 * @param query original query (hash)
379 * @param xquery extrended query data (can be NULL, depending on type)
380 * @param xquery_size number of bytes in @a xquery
381 * @return characterization of result
382 */
383enum GNUNET_BLOCK_RequestEvaluationResult
384GNUNET_BLOCK_evaluate_get_request (struct GNUNET_BLOCK_Context *ctx,
385 enum GNUNET_BLOCK_Type type,
386 const struct GNUNET_HashCode *query,
387 const void *xquery,
388 size_t xquery_size);
389
390/**
391 * Function called to validate a request.
392 *
393 * @param ctx block contxt
394 * @param type block type
395 * @param query query key (hash)
396 * @param block payload to put
397 * @param block_size number of bytes in @a block
398 * @return characterization of result
399 */
400enum GNUNET_BLOCK_RequestEvaluationResult
401GNUNET_BLOCK_evaluate_put_request (struct GNUNET_BLOCK_Context *ctx,
402 enum GNUNET_BLOCK_Type type,
403 const struct GNUNET_HashCode *query,
404 const void *block,
405 size_t block_size);
406
407/**
408 * Function called to obtain the key for a block.
409 *
410 * @param ctx block context
411 * @param type block type
412 * @param key the key to validate @a block against.
413 * @param block block to validate @a key against.
414 * @param block_size number of bytes in @a block
415 * @return #GNUNET_YES if key is valid,
416 * #GNUNET_NO if the key is invalid for this block,
417 * #GNUNET_SYSERR if type not supported
418 * (or if extracting a key from a block of this type does not work)
419 */
420enum GNUNET_GenericReturnValue
421GNUNET_BLOCK_validate_key (struct GNUNET_BLOCK_Context *ctx,
422 enum GNUNET_BLOCK_Type type,
423 const struct GNUNET_HashCode *key,
424 const void *block,
425 size_t block_size);
426
427
428
429/**
430 * END LSD0004
431 */
345 432
346/** 433/**
347 * Function called to obtain the key for a block. 434 * Function called to obtain the key for a block.