summaryrefslogtreecommitdiff
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
parent88d8a6cec7c63e52cf042db9f384309ccece15b6 (diff)
-lsd0004 draft block API
-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,
const void *reply_block,
size_t reply_block_size);
+/**
+ * WORK IN PROGRESS LSD0004
+ */
+
+/**
+ * Function called to validate a reply.
+ * Also checks the query key against the block contents
+ * as it would be done with the #GNUNET_BLOCK_get_key() function.
+ *
+ * @param ctx block contxt
+ * @param type block type
+ * @param group block group to use for evaluation
+ * @param query original query (hash)
+ * @param reply_block response to validate
+ * @param reply_block_size number of bytes in @a reply_block
+ * @return characterization of result
+ */
+enum GNUNET_BLOCK_ReplyEvaluationResult
+GNUNET_BLOCK_evaluate_reply (struct GNUNET_BLOCK_Context *ctx,
+ enum GNUNET_BLOCK_Type type,
+ struct GNUNET_BLOCK_Group *group,
+ const struct GNUNET_HashCode *query,
+ const void *reply_block,
+ size_t reply_block_size);
+
+
+
+/**
+ * Function called to validate a request.
+ *
+ * @param ctx block contxt
+ * @param type block type
+ * @param eo evaluation options to control evaluation
+ * @param query original query (hash)
+ * @param xquery extrended query data (can be NULL, depending on type)
+ * @param xquery_size number of bytes in @a xquery
+ * @return characterization of result
+ */
+enum GNUNET_BLOCK_RequestEvaluationResult
+GNUNET_BLOCK_evaluate_get_request (struct GNUNET_BLOCK_Context *ctx,
+ enum GNUNET_BLOCK_Type type,
+ const struct GNUNET_HashCode *query,
+ const void *xquery,
+ size_t xquery_size);
+
+/**
+ * Function called to validate a request.
+ *
+ * @param ctx block contxt
+ * @param type block type
+ * @param query query key (hash)
+ * @param block payload to put
+ * @param block_size number of bytes in @a block
+ * @return characterization of result
+ */
+enum GNUNET_BLOCK_RequestEvaluationResult
+GNUNET_BLOCK_evaluate_put_request (struct GNUNET_BLOCK_Context *ctx,
+ enum GNUNET_BLOCK_Type type,
+ const struct GNUNET_HashCode *query,
+ const void *block,
+ size_t block_size);
+
+/**
+ * Function called to obtain the key for a block.
+ *
+ * @param ctx block context
+ * @param type block type
+ * @param key the key to validate @a block against.
+ * @param block block to validate @a key against.
+ * @param block_size number of bytes in @a block
+ * @return #GNUNET_YES if key is valid,
+ * #GNUNET_NO if the key is invalid for this block,
+ * #GNUNET_SYSERR if type not supported
+ * (or if extracting a key from a block of this type does not work)
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_BLOCK_validate_key (struct GNUNET_BLOCK_Context *ctx,
+ enum GNUNET_BLOCK_Type type,
+ const struct GNUNET_HashCode *key,
+ const void *block,
+ size_t block_size);
+
+
+
+/**
+ * END LSD0004
+ */
/**
* Function called to obtain the key for a block.