summaryrefslogtreecommitdiff
path: root/src/include/gnunet_block_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_block_lib.h')
-rw-r--r--src/include/gnunet_block_lib.h79
1 files changed, 41 insertions, 38 deletions
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index 29b64759c..18ca6f63f 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -44,7 +44,8 @@ extern "C"
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 */ 46 */
47enum GNUNET_BLOCK_Type { 47enum GNUNET_BLOCK_Type
48{
48 /** 49 /**
49 * Any type of block, used as a wildcard when searching. Should 50 * Any type of block, used as a wildcard when searching. Should
50 * never be attached to a specific block. 51 * never be attached to a specific block.
@@ -142,7 +143,8 @@ enum GNUNET_BLOCK_Type {
142/** 143/**
143 * Flags that can be set to control the evaluation. 144 * Flags that can be set to control the evaluation.
144 */ 145 */
145enum GNUNET_BLOCK_EvaluationOptions { 146enum GNUNET_BLOCK_EvaluationOptions
147{
146 /** 148 /**
147 * Default behavior. 149 * Default behavior.
148 */ 150 */
@@ -159,7 +161,8 @@ enum GNUNET_BLOCK_EvaluationOptions {
159/** 161/**
160 * Possible ways for how a block may relate to a query. 162 * Possible ways for how a block may relate to a query.
161 */ 163 */
162enum GNUNET_BLOCK_EvaluationResult { 164enum GNUNET_BLOCK_EvaluationResult
165{
163 /** 166 /**
164 * Valid result, and there may be more. 167 * Valid result, and there may be more.
165 */ 168 */
@@ -218,9 +221,9 @@ struct GNUNET_BLOCK_Context;
218 * @param hc where to store the result. 221 * @param hc where to store the result.
219 */ 222 */
220void 223void
221GNUNET_BLOCK_mingle_hash(const struct GNUNET_HashCode *in, 224GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in,
222 uint32_t mingle_number, 225 uint32_t mingle_number,
223 struct GNUNET_HashCode *hc); 226 struct GNUNET_HashCode *hc);
224 227
225 228
226/** 229/**
@@ -230,7 +233,7 @@ GNUNET_BLOCK_mingle_hash(const struct GNUNET_HashCode *in,
230 * @return NULL on error 233 * @return NULL on error
231 */ 234 */
232struct GNUNET_BLOCK_Context * 235struct GNUNET_BLOCK_Context *
233GNUNET_BLOCK_context_create(const struct GNUNET_CONFIGURATION_Handle *cfg); 236GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg);
234 237
235 238
236/** 239/**
@@ -239,7 +242,7 @@ GNUNET_BLOCK_context_create(const struct GNUNET_CONFIGURATION_Handle *cfg);
239 * @param ctx context to destroy 242 * @param ctx context to destroy
240 */ 243 */
241void 244void
242GNUNET_BLOCK_context_destroy(struct GNUNET_BLOCK_Context *ctx); 245GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx);
243 246
244 247
245/** 248/**
@@ -263,12 +266,12 @@ struct GNUNET_BLOCK_Group;
263 * by this @a type of block (this is not an error) 266 * by this @a type of block (this is not an error)
264 */ 267 */
265struct GNUNET_BLOCK_Group * 268struct GNUNET_BLOCK_Group *
266GNUNET_BLOCK_group_create(struct GNUNET_BLOCK_Context *ctx, 269GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
267 enum GNUNET_BLOCK_Type type, 270 enum GNUNET_BLOCK_Type type,
268 uint32_t nonce, 271 uint32_t nonce,
269 const void *raw_data, 272 const void *raw_data,
270 size_t raw_data_size, 273 size_t raw_data_size,
271 ...); 274 ...);
272 275
273 276
274/** 277/**
@@ -282,10 +285,10 @@ GNUNET_BLOCK_group_create(struct GNUNET_BLOCK_Context *ctx,
282 * supported, #GNUNET_SYSERR on error 285 * supported, #GNUNET_SYSERR on error
283 */ 286 */
284int 287int
285GNUNET_BLOCK_group_serialize(struct GNUNET_BLOCK_Group *bg, 288GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg,
286 uint32_t *nonce, 289 uint32_t *nonce,
287 void **raw_data, 290 void **raw_data,
288 size_t *raw_data_size); 291 size_t *raw_data_size);
289 292
290 293
291/** 294/**
@@ -294,7 +297,7 @@ GNUNET_BLOCK_group_serialize(struct GNUNET_BLOCK_Group *bg,
294 * @param bg group to destroy, NULL is allowed 297 * @param bg group to destroy, NULL is allowed
295 */ 298 */
296void 299void
297GNUNET_BLOCK_group_destroy(struct GNUNET_BLOCK_Group *bg); 300GNUNET_BLOCK_group_destroy (struct GNUNET_BLOCK_Group *bg);
298 301
299 302
300/** 303/**
@@ -316,15 +319,15 @@ GNUNET_BLOCK_group_destroy(struct GNUNET_BLOCK_Group *bg);
316 * @return characterization of result 319 * @return characterization of result
317 */ 320 */
318enum GNUNET_BLOCK_EvaluationResult 321enum GNUNET_BLOCK_EvaluationResult
319GNUNET_BLOCK_evaluate(struct GNUNET_BLOCK_Context *ctx, 322GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
320 enum GNUNET_BLOCK_Type type, 323 enum GNUNET_BLOCK_Type type,
321 struct GNUNET_BLOCK_Group *group, 324 struct GNUNET_BLOCK_Group *group,
322 enum GNUNET_BLOCK_EvaluationOptions eo, 325 enum GNUNET_BLOCK_EvaluationOptions eo,
323 const struct GNUNET_HashCode *query, 326 const struct GNUNET_HashCode *query,
324 const void *xquery, 327 const void *xquery,
325 size_t xquery_size, 328 size_t xquery_size,
326 const void *reply_block, 329 const void *reply_block,
327 size_t reply_block_size); 330 size_t reply_block_size);
328 331
329 332
330/** 333/**
@@ -341,11 +344,11 @@ GNUNET_BLOCK_evaluate(struct GNUNET_BLOCK_Context *ctx,
341 * (or if extracting a key from a block of this type does not work) 344 * (or if extracting a key from a block of this type does not work)
342 */ 345 */
343int 346int
344GNUNET_BLOCK_get_key(struct GNUNET_BLOCK_Context *ctx, 347GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
345 enum GNUNET_BLOCK_Type type, 348 enum GNUNET_BLOCK_Type type,
346 const void *block, 349 const void *block,
347 size_t block_size, 350 size_t block_size,
348 struct GNUNET_HashCode *key); 351 struct GNUNET_HashCode *key);
349 352
350 353
351/** 354/**
@@ -360,9 +363,9 @@ GNUNET_BLOCK_get_key(struct GNUNET_BLOCK_Context *ctx,
360 * @return #GNUNET_SYSERR if not supported, #GNUNET_OK on success 363 * @return #GNUNET_SYSERR if not supported, #GNUNET_OK on success
361 */ 364 */
362int 365int
363GNUNET_BLOCK_group_set_seen(struct GNUNET_BLOCK_Group *bg, 366GNUNET_BLOCK_group_set_seen (struct GNUNET_BLOCK_Group *bg,
364 const struct GNUNET_HashCode *seen_results, 367 const struct GNUNET_HashCode *seen_results,
365 unsigned int seen_results_count); 368 unsigned int seen_results_count);
366 369
367 370
368/** 371/**
@@ -378,8 +381,8 @@ GNUNET_BLOCK_group_set_seen(struct GNUNET_BLOCK_Group *bg,
378 * #GNUNET_SYSERR if merging is not supported 381 * #GNUNET_SYSERR if merging is not supported
379 */ 382 */
380int 383int
381GNUNET_BLOCK_group_merge(struct GNUNET_BLOCK_Group *bg1, 384GNUNET_BLOCK_group_merge (struct GNUNET_BLOCK_Group *bg1,
382 struct GNUNET_BLOCK_Group *bg2); 385 struct GNUNET_BLOCK_Group *bg2);
383 386
384 387
385#if 0 /* keep Emacsens' auto-indent happy */ 388#if 0 /* keep Emacsens' auto-indent happy */