aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_block_plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_block_plugin.h')
-rw-r--r--src/include/gnunet_block_plugin.h61
1 files changed, 9 insertions, 52 deletions
diff --git a/src/include/gnunet_block_plugin.h b/src/include/gnunet_block_plugin.h
index 2c9a3839d..1fa7ccf8b 100644
--- a/src/include/gnunet_block_plugin.h
+++ b/src/include/gnunet_block_plugin.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2010,2013,2017 GNUnet e.V. 3 Copyright (C) 2010, 2013, 2017, 2021, 2022 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -163,43 +163,9 @@ typedef struct GNUNET_BLOCK_Group *
163 163
164 164
165/** 165/**
166 * Function called to validate a reply or a request. For
167 * request evaluation, simply pass "NULL" for the @a reply_block.
168 * Note that it is assumed that the reply has already been
169 * matched to the key (and signatures checked) as it would
170 * be done with the "get_key" function.
171 *
172 * @param cls closure
173 * @param ctx block context
174 * @param type block type
175 * @param group which block group to use for evaluation
176 * @param eo evaluation options to control evaluation
177 * @param query original query (hash)
178 * @param xquery extrended query data (can be NULL, depending on type)
179 * @param xquery_size number of bytes in @a xquery
180 * @param reply_block response to validate
181 * @param reply_block_size number of bytes in @a reply_block
182 * @return characterization of result
183 * @deprecated
184 */
185typedef enum GNUNET_BLOCK_EvaluationResult
186(*GNUNET_BLOCK_EvaluationFunction)(void *cls,
187 struct GNUNET_BLOCK_Context *ctx,
188 enum GNUNET_BLOCK_Type type,
189 struct GNUNET_BLOCK_Group *group,
190 enum GNUNET_BLOCK_EvaluationOptions eo,
191 const struct GNUNET_HashCode *query,
192 const void *xquery,
193 size_t xquery_size,
194 const void *reply_block,
195 size_t reply_block_size);
196
197
198/**
199 * Function called to validate a query. 166 * Function called to validate a query.
200 * 167 *
201 * @param cls closure 168 * @param cls closure
202 * @param ctx block context
203 * @param type block type 169 * @param type block type
204 * @param query original query (hash) 170 * @param query original query (hash)
205 * @param xquery extrended query data (can be NULL, depending on type) 171 * @param xquery extrended query data (can be NULL, depending on type)
@@ -215,19 +181,17 @@ typedef enum GNUNET_GenericReturnValue
215 181
216 182
217/** 183/**
218 * Function called to validate a block for storage. 184 * Function called to validate a @a block for storage.
219 * 185 *
220 * @param cls closure 186 * @param cls closure
221 * @param type block type 187 * @param type block type
222 * @param query key for the block (hash), must match exactly
223 * @param block block data to validate 188 * @param block block data to validate
224 * @param block_size number of bytes in @a block 189 * @param block_size number of bytes in @a block
225 * @return #GNUNET_OK if the block is fine, #GNUNET_NO if not 190 * @return #GNUNET_OK if the @a block is fine, #GNUNET_NO if not, #GNUNET_SYSERR if the @a type is not supported
226 */ 191 */
227typedef enum GNUNET_GenericReturnValue 192typedef enum GNUNET_GenericReturnValue
228(*GNUNET_BLOCK_BlockEvaluationFunction)(void *cls, 193(*GNUNET_BLOCK_BlockEvaluationFunction)(void *cls,
229 enum GNUNET_BLOCK_Type type, 194 enum GNUNET_BLOCK_Type type,
230 const struct GNUNET_HashCode *query,
231 const void *block, 195 const void *block,
232 size_t block_size); 196 size_t block_size);
233 197
@@ -260,17 +224,18 @@ typedef enum GNUNET_BLOCK_ReplyEvaluationResult
260 224
261 225
262/** 226/**
263 * Function called to obtain the key for a block. 227 * Function called to obtain the @a key for a block.
228 * If the @a block is malformed, the function should
229 * zero-out @a key and return #GNUNET_OK.
264 * 230 *
265 * @param cls closure 231 * @param cls closure
266 * @param type block type 232 * @param type block type
267 * @param block block to get the key for 233 * @param block block to get the @a key for
268 * @param block_size number of bytes in @a block 234 * @param block_size number of bytes in @a block
269 * @param[out] key set to the key (query) for the given block 235 * @param[out] key set to the key (query) for the given block
270 * @return #GNUNET_YES on success, 236 * @return #GNUNET_YES on success,
271 * #GNUNET_NO if the block is malformed 237 * #GNUNET_NO if extracting a key for this @a type does not work
272 * #GNUNET_SYSERR if type not supported 238 * #GNUNET_SYSERR if @a type not supported
273 * (or if extracting a key from a block of this type does not work)
274 */ 239 */
275typedef enum GNUNET_GenericReturnValue 240typedef enum GNUNET_GenericReturnValue
276(*GNUNET_BLOCK_GetKeyFunction) (void *cls, 241(*GNUNET_BLOCK_GetKeyFunction) (void *cls,
@@ -297,14 +262,6 @@ struct GNUNET_BLOCK_PluginFunctions
297 const enum GNUNET_BLOCK_Type *types; 262 const enum GNUNET_BLOCK_Type *types;
298 263
299 /** 264 /**
300 * Main function of a block plugin. Allows us to check if a
301 * block matches a query.
302 *
303 * @param deprecated
304 */
305 GNUNET_BLOCK_EvaluationFunction evaluate;
306
307 /**
308 * Obtain the key for a given block (if possible). 265 * Obtain the key for a given block (if possible).
309 */ 266 */
310 GNUNET_BLOCK_GetKeyFunction get_key; 267 GNUNET_BLOCK_GetKeyFunction get_key;