aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-29 19:12:28 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-29 19:12:28 +0100
commitdaa9284567865177279a692eb722e257ed06923e (patch)
tree1954840c92a91027d2caee63668f9c7b2b79f04e /src/include
parent2536cd090b7e467e604cf5cfe5d1d93b32431876 (diff)
downloadgnunet-daa9284567865177279a692eb722e257ed06923e.tar.gz
gnunet-daa9284567865177279a692eb722e257ed06923e.zip
implement revised block API
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_block_lib.h73
1 files changed, 24 insertions, 49 deletions
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index 6f82381ac..25569c59e 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -43,6 +43,8 @@ extern "C"
43 43
44/** 44/**
45 * Blocks in the datastore and the datacache must have a unique type. 45 * Blocks in the datastore and the datacache must have a unique type.
46 *
47 * TODO: move to GANA!
46 */ 48 */
47enum GNUNET_BLOCK_Type 49enum GNUNET_BLOCK_Type
48{ 50{
@@ -155,6 +157,7 @@ enum GNUNET_BLOCK_Type
155 157
156/** 158/**
157 * Flags that can be set to control the evaluation. 159 * Flags that can be set to control the evaluation.
160 * @deprecated
158 */ 161 */
159enum GNUNET_BLOCK_EvaluationOptions 162enum GNUNET_BLOCK_EvaluationOptions
160{ 163{
@@ -173,6 +176,7 @@ enum GNUNET_BLOCK_EvaluationOptions
173 176
174/** 177/**
175 * Possible ways for how a block may relate to a query. 178 * Possible ways for how a block may relate to a query.
179 * @deprecated
176 */ 180 */
177enum GNUNET_BLOCK_EvaluationResult 181enum GNUNET_BLOCK_EvaluationResult
178{ 182{
@@ -244,7 +248,7 @@ enum GNUNET_BLOCK_ReplyEvaluationResult
244 * Specified block type not supported by any plugin. 248 * Specified block type not supported by any plugin.
245 */ 249 */
246 GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED = -1, 250 GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED = -1,
247 251
248 /** 252 /**
249 * Block does not match query (invalid result) 253 * Block does not match query (invalid result)
250 */ 254 */
@@ -368,6 +372,7 @@ GNUNET_BLOCK_group_destroy (struct GNUNET_BLOCK_Group *bg);
368 * @param reply_block response to validate 372 * @param reply_block response to validate
369 * @param reply_block_size number of bytes in @a reply_block 373 * @param reply_block_size number of bytes in @a reply_block
370 * @return characterization of result 374 * @return characterization of result
375 * @deprecated
371 */ 376 */
372enum GNUNET_BLOCK_EvaluationResult 377enum GNUNET_BLOCK_EvaluationResult
373GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, 378GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
@@ -380,9 +385,6 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
380 const void *reply_block, 385 const void *reply_block,
381 size_t reply_block_size); 386 size_t reply_block_size);
382 387
383/**
384 * WORK IN PROGRESS LSD0004
385 */
386 388
387/** 389/**
388 * Function called to validate a reply. 390 * Function called to validate a reply.
@@ -400,15 +402,14 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
400 * @return characterization of result 402 * @return characterization of result
401 */ 403 */
402enum GNUNET_BLOCK_ReplyEvaluationResult 404enum GNUNET_BLOCK_ReplyEvaluationResult
403GNUNET_BLOCK_evaluate_reply (struct GNUNET_BLOCK_Context *ctx, 405GNUNET_BLOCK_check_reply (struct GNUNET_BLOCK_Context *ctx,
404 enum GNUNET_BLOCK_Type type, 406 enum GNUNET_BLOCK_Type type,
405 struct GNUNET_BLOCK_Group *group, 407 struct GNUNET_BLOCK_Group *group,
406 const struct GNUNET_HashCode *query, 408 const struct GNUNET_HashCode *query,
407 const void *xquery, 409 const void *xquery,
408 size_t xquery_size, 410 size_t xquery_size,
409 const void *reply_block, 411 const void *reply_block,
410 size_t reply_block_size); 412 size_t reply_block_size);
411
412 413
413 414
414/** 415/**
@@ -423,11 +424,11 @@ GNUNET_BLOCK_evaluate_reply (struct GNUNET_BLOCK_Context *ctx,
423 * #GNUNET_SYSERR if @a type is not supported 424 * #GNUNET_SYSERR if @a type is not supported
424 */ 425 */
425enum GNUNET_GenericReturnValue 426enum GNUNET_GenericReturnValue
426GNUNET_BLOCK_evaluate_request (struct GNUNET_BLOCK_Context *ctx, 427GNUNET_BLOCK_check_request (struct GNUNET_BLOCK_Context *ctx,
427 enum GNUNET_BLOCK_Type type, 428 enum GNUNET_BLOCK_Type type,
428 const struct GNUNET_HashCode *query, 429 const struct GNUNET_HashCode *query,
429 const void *xquery, 430 const void *xquery,
430 size_t xquery_size); 431 size_t xquery_size);
431 432
432 433
433/** 434/**
@@ -441,39 +442,13 @@ GNUNET_BLOCK_evaluate_request (struct GNUNET_BLOCK_Context *ctx,
441 * @return #GNUNET_OK if the block is fine, #GNUNET_NO if not, 442 * @return #GNUNET_OK if the block is fine, #GNUNET_NO if not,
442 * #GNUNET_SYSERR if @a type is not supported 443 * #GNUNET_SYSERR if @a type is not supported
443 */ 444 */
444enum GNUNET_BLOCK_RequestEvaluationResult
445GNUNET_BLOCK_evaluate_block (struct GNUNET_BLOCK_Context *ctx,
446 enum GNUNET_BLOCK_Type type,
447 const struct GNUNET_HashCode *query,
448 const void *block,
449 size_t block_size);
450
451
452/**
453 * Function called to obtain the key for a block.
454 *
455 * @param ctx block context
456 * @param type block type
457 * @param key the key to validate @a block against.
458 * @param block block to validate @a key against.
459 * @param block_size number of bytes in @a block
460 * @return #GNUNET_YES if key is valid,
461 * #GNUNET_NO if the key is invalid for this block,
462 * #GNUNET_SYSERR if type not supported
463 * (or if extracting a key from a block of this type does not work)
464 */
465enum GNUNET_GenericReturnValue 445enum GNUNET_GenericReturnValue
466GNUNET_BLOCK_validate_key (struct GNUNET_BLOCK_Context *ctx, 446GNUNET_BLOCK_check_block (struct GNUNET_BLOCK_Context *ctx,
467 enum GNUNET_BLOCK_Type type, 447 enum GNUNET_BLOCK_Type type,
468 const struct GNUNET_HashCode *key, 448 const struct GNUNET_HashCode *query,
469 const void *block, 449 const void *block,
470 size_t block_size); 450 size_t block_size);
471
472
473 451
474/**
475 * END LSD0004
476 */
477 452
478/** 453/**
479 * Function called to obtain the key for a block. 454 * Function called to obtain the key for a block.