GNUnet  0.10.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 };
141 
142 
147 {
148 
153 
159 };
160 
161 
166 {
171 
176 
181 
186 
191 
196 
203 
208 };
209 
210 
214 struct GNUNET_BLOCK_Context;
215 
216 
224 void
225 GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in,
226  uint32_t mingle_number,
227  struct GNUNET_HashCode *hc);
228 
229 
236 struct GNUNET_BLOCK_Context *
238 
239 
245 void
247 
248 
254 struct GNUNET_BLOCK_Group;
255 
256 
269 struct GNUNET_BLOCK_Group *
271  enum GNUNET_BLOCK_Type type,
272  uint32_t nonce,
273  const void *raw_data,
274  size_t raw_data_size,
275  ...);
276 
277 
288 int
290  uint32_t *nonce,
291  void **raw_data,
292  size_t *raw_data_size);
293 
294 
300 void
302 
303 
324  enum GNUNET_BLOCK_Type type,
325  struct GNUNET_BLOCK_Group *group,
327  const struct GNUNET_HashCode *query,
328  const void *xquery,
329  size_t xquery_size,
330  const void *reply_block,
331  size_t reply_block_size);
332 
333 
347 int
349  enum GNUNET_BLOCK_Type type,
350  const void *block,
351  size_t block_size,
352  struct GNUNET_HashCode *key);
353 
354 
366 int
368  const struct GNUNET_HashCode *seen_results,
369  unsigned int seen_results_count);
370 
371 
384 int
386  struct GNUNET_BLOCK_Group *bg2);
387 
388 
389 #if 0 /* keep Emacsens' auto-indent happy */
390 {
391 #endif
392 #ifdef __cplusplus
393 }
394 #endif
395 
396 /* ifndef GNUNET_BLOCK_LIB_H */
397 #endif
398  /* end of group */
400 
401 /* 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:132
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
Any type of block, used as a wildcard when searching.
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)
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.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
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
Definition: configuration.c:85
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