aboutsummaryrefslogtreecommitdiff
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.h84
1 files changed, 40 insertions, 44 deletions
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index c85d3702b..29b64759c 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20 20
21/** 21/**
22 * @author Christian Grothoff 22 * @author Christian Grothoff
@@ -44,8 +44,7 @@ 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{
49 /** 48 /**
50 * Any type of block, used as a wildcard when searching. Should 49 * Any type of block, used as a wildcard when searching. Should
51 * never be attached to a specific block. 50 * never be attached to a specific block.
@@ -143,9 +142,7 @@ enum GNUNET_BLOCK_Type
143/** 142/**
144 * Flags that can be set to control the evaluation. 143 * Flags that can be set to control the evaluation.
145 */ 144 */
146enum GNUNET_BLOCK_EvaluationOptions 145enum GNUNET_BLOCK_EvaluationOptions {
147{
148
149 /** 146 /**
150 * Default behavior. 147 * Default behavior.
151 */ 148 */
@@ -162,8 +159,7 @@ enum GNUNET_BLOCK_EvaluationOptions
162/** 159/**
163 * Possible ways for how a block may relate to a query. 160 * Possible ways for how a block may relate to a query.
164 */ 161 */
165enum GNUNET_BLOCK_EvaluationResult 162enum GNUNET_BLOCK_EvaluationResult {
166{
167 /** 163 /**
168 * Valid result, and there may be more. 164 * Valid result, and there may be more.
169 */ 165 */
@@ -222,9 +218,9 @@ struct GNUNET_BLOCK_Context;
222 * @param hc where to store the result. 218 * @param hc where to store the result.
223 */ 219 */
224void 220void
225GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in, 221GNUNET_BLOCK_mingle_hash(const struct GNUNET_HashCode *in,
226 uint32_t mingle_number, 222 uint32_t mingle_number,
227 struct GNUNET_HashCode *hc); 223 struct GNUNET_HashCode *hc);
228 224
229 225
230/** 226/**
@@ -234,7 +230,7 @@ GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in,
234 * @return NULL on error 230 * @return NULL on error
235 */ 231 */
236struct GNUNET_BLOCK_Context * 232struct GNUNET_BLOCK_Context *
237GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg); 233GNUNET_BLOCK_context_create(const struct GNUNET_CONFIGURATION_Handle *cfg);
238 234
239 235
240/** 236/**
@@ -243,7 +239,7 @@ GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg);
243 * @param ctx context to destroy 239 * @param ctx context to destroy
244 */ 240 */
245void 241void
246GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx); 242GNUNET_BLOCK_context_destroy(struct GNUNET_BLOCK_Context *ctx);
247 243
248 244
249/** 245/**
@@ -267,12 +263,12 @@ struct GNUNET_BLOCK_Group;
267 * by this @a type of block (this is not an error) 263 * by this @a type of block (this is not an error)
268 */ 264 */
269struct GNUNET_BLOCK_Group * 265struct GNUNET_BLOCK_Group *
270GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx, 266GNUNET_BLOCK_group_create(struct GNUNET_BLOCK_Context *ctx,
271 enum GNUNET_BLOCK_Type type, 267 enum GNUNET_BLOCK_Type type,
272 uint32_t nonce, 268 uint32_t nonce,
273 const void *raw_data, 269 const void *raw_data,
274 size_t raw_data_size, 270 size_t raw_data_size,
275 ...); 271 ...);
276 272
277 273
278/** 274/**
@@ -286,10 +282,10 @@ GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
286 * supported, #GNUNET_SYSERR on error 282 * supported, #GNUNET_SYSERR on error
287 */ 283 */
288int 284int
289GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg, 285GNUNET_BLOCK_group_serialize(struct GNUNET_BLOCK_Group *bg,
290 uint32_t *nonce, 286 uint32_t *nonce,
291 void **raw_data, 287 void **raw_data,
292 size_t *raw_data_size); 288 size_t *raw_data_size);
293 289
294 290
295/** 291/**
@@ -298,7 +294,7 @@ GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg,
298 * @param bg group to destroy, NULL is allowed 294 * @param bg group to destroy, NULL is allowed
299 */ 295 */
300void 296void
301GNUNET_BLOCK_group_destroy (struct GNUNET_BLOCK_Group *bg); 297GNUNET_BLOCK_group_destroy(struct GNUNET_BLOCK_Group *bg);
302 298
303 299
304/** 300/**
@@ -320,15 +316,15 @@ GNUNET_BLOCK_group_destroy (struct GNUNET_BLOCK_Group *bg);
320 * @return characterization of result 316 * @return characterization of result
321 */ 317 */
322enum GNUNET_BLOCK_EvaluationResult 318enum GNUNET_BLOCK_EvaluationResult
323GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, 319GNUNET_BLOCK_evaluate(struct GNUNET_BLOCK_Context *ctx,
324 enum GNUNET_BLOCK_Type type, 320 enum GNUNET_BLOCK_Type type,
325 struct GNUNET_BLOCK_Group *group, 321 struct GNUNET_BLOCK_Group *group,
326 enum GNUNET_BLOCK_EvaluationOptions eo, 322 enum GNUNET_BLOCK_EvaluationOptions eo,
327 const struct GNUNET_HashCode *query, 323 const struct GNUNET_HashCode *query,
328 const void *xquery, 324 const void *xquery,
329 size_t xquery_size, 325 size_t xquery_size,
330 const void *reply_block, 326 const void *reply_block,
331 size_t reply_block_size); 327 size_t reply_block_size);
332 328
333 329
334/** 330/**
@@ -345,11 +341,11 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
345 * (or if extracting a key from a block of this type does not work) 341 * (or if extracting a key from a block of this type does not work)
346 */ 342 */
347int 343int
348GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, 344GNUNET_BLOCK_get_key(struct GNUNET_BLOCK_Context *ctx,
349 enum GNUNET_BLOCK_Type type, 345 enum GNUNET_BLOCK_Type type,
350 const void *block, 346 const void *block,
351 size_t block_size, 347 size_t block_size,
352 struct GNUNET_HashCode *key); 348 struct GNUNET_HashCode *key);
353 349
354 350
355/** 351/**
@@ -364,9 +360,9 @@ GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
364 * @return #GNUNET_SYSERR if not supported, #GNUNET_OK on success 360 * @return #GNUNET_SYSERR if not supported, #GNUNET_OK on success
365 */ 361 */
366int 362int
367GNUNET_BLOCK_group_set_seen (struct GNUNET_BLOCK_Group *bg, 363GNUNET_BLOCK_group_set_seen(struct GNUNET_BLOCK_Group *bg,
368 const struct GNUNET_HashCode *seen_results, 364 const struct GNUNET_HashCode *seen_results,
369 unsigned int seen_results_count); 365 unsigned int seen_results_count);
370 366
371 367
372/** 368/**
@@ -382,8 +378,8 @@ GNUNET_BLOCK_group_set_seen (struct GNUNET_BLOCK_Group *bg,
382 * #GNUNET_SYSERR if merging is not supported 378 * #GNUNET_SYSERR if merging is not supported
383 */ 379 */
384int 380int
385GNUNET_BLOCK_group_merge (struct GNUNET_BLOCK_Group *bg1, 381GNUNET_BLOCK_group_merge(struct GNUNET_BLOCK_Group *bg1,
386 struct GNUNET_BLOCK_Group *bg2); 382 struct GNUNET_BLOCK_Group *bg2);
387 383
388 384
389#if 0 /* keep Emacsens' auto-indent happy */ 385#if 0 /* keep Emacsens' auto-indent happy */