diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-20 15:09:00 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-20 15:09:19 +0100 |
commit | a3882b58f1c5976677aa65b0af8a48e8e946b06e (patch) | |
tree | bd841d8e78052a05821e194d002ca843693fb2c9 /src/include/gnunet_block_lib.h | |
parent | f0149c5430f42a8bad422e9c51754af59c7bfa2f (diff) | |
download | gnunet-a3882b58f1c5976677aa65b0af8a48e8e946b06e.tar.gz gnunet-a3882b58f1c5976677aa65b0af8a48e8e946b06e.zip |
first half of new BLOCK API to generalize duplicate detection beyond BFs
Diffstat (limited to 'src/include/gnunet_block_lib.h')
-rw-r--r-- | src/include/gnunet_block_lib.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h index b21b3496b..0f0fee499 100644 --- a/src/include/gnunet_block_lib.h +++ b/src/include/gnunet_block_lib.h | |||
@@ -230,6 +230,57 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx); | |||
230 | 230 | ||
231 | 231 | ||
232 | /** | 232 | /** |
233 | * Handle for a group of elements that will be evaluated together. | ||
234 | * They must all be of the same type. A block group allows the | ||
235 | * plugin to keep some state across individual evaluations. | ||
236 | */ | ||
237 | struct GNUNET_BLOCK_Group; | ||
238 | |||
239 | |||
240 | /** | ||
241 | * Create a new block group. | ||
242 | * | ||
243 | * @param ctx block context in which the block group is created | ||
244 | * @param type type of the block for which we are creating the group | ||
245 | * @param nonce random value used to seed the group creation | ||
246 | * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh | ||
247 | * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh | ||
248 | * @return block group handle, NULL if block groups are not supported | ||
249 | * by this @a type of block (this is not an error) | ||
250 | */ | ||
251 | struct GNUNET_BLOCK_Group * | ||
252 | GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx, | ||
253 | enum GNUNET_BLOCK_Type type, | ||
254 | uint32_t nonce, | ||
255 | const void *raw_data, | ||
256 | size_t raw_data_size); | ||
257 | |||
258 | |||
259 | /** | ||
260 | * Serialize state of a block group. | ||
261 | * | ||
262 | * @param bg group to serialize | ||
263 | * @param[out] raw_data set to the serialized state | ||
264 | * @param[out] raw_data_size set to the number of bytes in @a raw_data | ||
265 | * @return #GNUNET_OK on success, #GNUNET_NO if serialization is not | ||
266 | * supported, #GNUNET_SYSERR on error | ||
267 | */ | ||
268 | int | ||
269 | GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg, | ||
270 | void **raw_data, | ||
271 | size_t *raw_data_size); | ||
272 | |||
273 | |||
274 | /** | ||
275 | * Destroy resources used by a block group. | ||
276 | * | ||
277 | * @param bg group to destroy, NULL is allowed | ||
278 | */ | ||
279 | void | ||
280 | GNUNET_BLOCK_group_destroy (struct GNUNET_BLOCK_Group *bg); | ||
281 | |||
282 | |||
283 | /** | ||
233 | * Function called to validate a reply or a request. For | 284 | * Function called to validate a reply or a request. For |
234 | * request evaluation, simply pass "NULL" for the @a reply_block. | 285 | * request evaluation, simply pass "NULL" for the @a reply_block. |
235 | * Note that it is assumed that the reply has already been | 286 | * Note that it is assumed that the reply has already been |