GNUnet  0.11.x
gnunet_block_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2010 GNUnet e.V.
4 
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
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
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/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
31 #ifndef GNUNET_BLOCK_LIB_H
32 #define GNUNET_BLOCK_LIB_H
33 
34 #include "gnunet_util_lib.h"
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #if 0 /* keep Emacsens' auto-indent happy */
39 }
40 #endif
41 #endif
42 
43 
48 {
54 
59 
64 
69 
74 
79 
85 
91 
96 
103 
108 
113 
118 
123 
128 
134 
140 
146 
152 
153 };
154 
155 
160 {
165 
171 };
172 
173 
178 {
183 
188 
193 
198 
203 
208 
215 
220 };
221 
222 
226 struct GNUNET_BLOCK_Context;
227 
228 
236 void
237 GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in,
238  uint32_t mingle_number,
239  struct GNUNET_HashCode *hc);
240 
241 
248 struct GNUNET_BLOCK_Context *
250 
251 
257 void
259 
260 
266 struct GNUNET_BLOCK_Group;
267 
268 
281 struct GNUNET_BLOCK_Group *
283  enum GNUNET_BLOCK_Type type,
284  uint32_t nonce,
285  const void *raw_data,
286  size_t raw_data_size,
287  ...);
288 
289 
300 int
302  uint32_t *nonce,
303  void **raw_data,
304  size_t *raw_data_size);
305 
306 
312 void
314 
315 
336  enum GNUNET_BLOCK_Type type,
337  struct GNUNET_BLOCK_Group *group,
339  const struct GNUNET_HashCode *query,
340  const void *xquery,
341  size_t xquery_size,
342  const void *reply_block,
343  size_t reply_block_size);
344 
345 
359 int
361  enum GNUNET_BLOCK_Type type,
362  const void *block,
363  size_t block_size,
364  struct GNUNET_HashCode *key);
365 
366 
378 int
380  const struct GNUNET_HashCode *seen_results,
381  unsigned int seen_results_count);
382 
383 
396 int
398  struct GNUNET_BLOCK_Group *bg2);
399 
400 
401 #if 0 /* keep Emacsens' auto-indent happy */
402 {
403 #endif
404 #ifdef __cplusplus
405 }
406 #endif
407 
408 /* ifndef GNUNET_BLOCK_LIB_H */
409 #endif
410  /* end of group */
412 
413 /* end of gnunet_block_lib.h */
struct GNUNET_BLOCK_Context * GNUNET_BLOCK_context_create(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a block context.
Definition: block.c:131
Block does not match query (invalid result)
Block to store a cadet regex accepting state.
Legacy type, no longer in use.
Handle to an initialized block library.
Definition: block.c:54
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
Any type of block, used as a wildcard when searching.
Block for testing set union.
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
Block type for a revocation message by which a key is revoked.
Block does not match xquery (valid result, not relevant for the request)
Block for testing set intersection.
Default behavior.
Type of a block representing a block to be encoded on demand from disk.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
int GNUNET_BLOCK_get_key(struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, const void *block, size_t block_size, struct GNUNET_HashCode *key)
Function called to obtain the key for a block.
Definition: block.c:379
int GNUNET_BLOCK_group_merge(struct GNUNET_BLOCK_Group *bg1, struct GNUNET_BLOCK_Group *bg2)
Try merging two block groups.
Definition: block.c:227
Legacy type, no longer in use.
Block for storing DNS exit service advertisements.
Valid result, but suppressed because it is a duplicate.
enum GNUNET_BLOCK_EvaluationResult GNUNET_BLOCK_evaluate(struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, struct GNUNET_BLOCK_Group *group, enum GNUNET_BLOCK_EvaluationOptions eo, const struct GNUNET_HashCode *query, const void *xquery, size_t xquery_size, const void *reply_block, size_t reply_block_size)
Function called to validate a reply or a request.
Definition: block.c:339
Inner block in the CHK tree.
Last possible valid result.
int GNUNET_BLOCK_group_serialize(struct GNUNET_BLOCK_Group *bg, uint32_t *nonce, void **raw_data, size_t *raw_data_size)
Serialize state of a block group.
Definition: block.c:181
Block for storing record data.
Type of a block that contains a HELLO for a peer (for DHT and CADET find-peer operations).
Type of a block representing any type of search result (universal).
A 512-bit hashcode.
void GNUNET_BLOCK_context_destroy(struct GNUNET_BLOCK_Context *ctx)
Destroy the block context.
Definition: block.c:152
The block is obtained from the local database, skip cryptographic checks.
Valid result, and there may be more.
struct GNUNET_HashCode key
The key used in the DHT.
GNUNET_BLOCK_EvaluationResult
Possible ways for how a block may relate to a query.
struct GNUNET_BLOCK_Group * GNUNET_BLOCK_group_create(struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, uint32_t nonce, const void *raw_data, size_t raw_data_size,...)
Create a new block group.
Definition: block.c:290
Specified block type not supported by this plugin.
Legacy type, no longer in use.
configuration data
Block for testing.
Block type for consensus elements.
Query format does not match block type (invalid query).
Block group data.
Data block (leaf) in the CHK tree.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Block for testing set/consensus.
Block to store a cadet regex state.
GNUNET_BLOCK_EvaluationOptions
Flags that can be set to control the evaluation.
Query is valid, no reply given.
void GNUNET_BLOCK_mingle_hash(const struct GNUNET_HashCode *in, uint32_t mingle_number, struct GNUNET_HashCode *hc)
Mingle hash with the mingle_number to produce different bits.
Definition: block.c:81
void GNUNET_BLOCK_group_destroy(struct GNUNET_BLOCK_Group *bg)
Destroy resources used by a block group.
Definition: block.c:206
int GNUNET_BLOCK_group_set_seen(struct GNUNET_BLOCK_Group *bg, const struct GNUNET_HashCode *seen_results, unsigned int seen_results_count)
Update block group to filter out the given results.
Definition: block.c:410