GNUnet  0.17.6
gnunet_block_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2010, 2022 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 
34 #ifndef GNUNET_BLOCK_LIB_H
35 #define GNUNET_BLOCK_LIB_H
36 
37 #include "gnunet_util_lib.h"
38 #include "gnunet_dht_block_types.h"
39 
40 #ifdef __cplusplus
41 extern "C"
42 {
43 #if 0 /* keep Emacsens' auto-indent happy */
44 }
45 #endif
46 #endif
47 
48 
53 {
54 
59 
64 
69 
74 
79 
80 };
81 
82 
87 
88 
96 void
98  uint32_t mingle_number,
99  struct GNUNET_HashCode *hc);
100 
101 
108 struct GNUNET_BLOCK_Context *
110 
111 
117 void
119 
120 
126 struct GNUNET_BLOCK_Group;
127 
128 
141 struct GNUNET_BLOCK_Group *
143  enum GNUNET_BLOCK_Type type,
144  const void *raw_data,
145  size_t raw_data_size,
146  ...);
147 
148 
160  void **raw_data,
161  size_t *raw_data_size);
162 
163 
169 void
171 
172 
189  enum GNUNET_BLOCK_Type type,
190  struct GNUNET_BLOCK_Group *group,
191  const struct GNUNET_HashCode *query,
192  const void *xquery,
193  size_t xquery_size,
194  const void *reply_block,
195  size_t reply_block_size);
196 
197 
211  enum GNUNET_BLOCK_Type type,
212  const struct GNUNET_HashCode *query,
213  const void *xquery,
214  size_t xquery_size);
215 
216 
229  enum GNUNET_BLOCK_Type type,
230  const void *block,
231  size_t block_size);
232 
233 
250  enum GNUNET_BLOCK_Type type,
251  const void *block,
252  size_t block_size,
253  struct GNUNET_HashCode *key);
254 
255 
269  const struct GNUNET_HashCode *seen_results,
270  unsigned int seen_results_count);
271 
272 
287  struct GNUNET_BLOCK_Group *bg2);
288 
289 
290 #if 0 /* keep Emacsens' auto-indent happy */
291 {
292 #endif
293 #ifdef __cplusplus
294 }
295 #endif
296 
297 /* ifndef GNUNET_BLOCK_LIB_H */
298 #endif
299  /* end of group */
301  /* end of group addition */
303 
304 /* end of gnunet_block_lib.h */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
enum GNUNET_GenericReturnValue 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:360
enum GNUNET_BLOCK_ReplyEvaluationResult GNUNET_BLOCK_check_reply(struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, struct GNUNET_BLOCK_Group *group, 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 if a reply is good for a particular query.
Definition: block.c:334
enum GNUNET_GenericReturnValue GNUNET_BLOCK_check_block(struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, const void *block, size_t block_size)
Function called to validate a block.
Definition: block.c:316
enum GNUNET_GenericReturnValue GNUNET_BLOCK_check_query(struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode *query, const void *xquery, size_t xquery_size)
Function called to validate a request.
Definition: block.c:296
GNUNET_BLOCK_ReplyEvaluationResult
Possible ways for how a block may relate to a query.
void GNUNET_BLOCK_context_destroy(struct GNUNET_BLOCK_Context *ctx)
Destroy the block context.
Definition: block.c:156
enum GNUNET_GenericReturnValue GNUNET_BLOCK_group_merge(struct GNUNET_BLOCK_Group *bg1, struct GNUNET_BLOCK_Group *bg2)
Try merging two block groups.
Definition: block.c:201
void GNUNET_BLOCK_group_destroy(struct GNUNET_BLOCK_Group *bg)
Destroy resources used by a block group.
Definition: block.c:192
struct GNUNET_BLOCK_Group * GNUNET_BLOCK_group_create(struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, const void *raw_data, size_t raw_data_size,...)
Create a new block group.
Definition: block.c:247
struct GNUNET_BLOCK_Context * GNUNET_BLOCK_context_create(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a block context.
Definition: block.c:140
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:96
enum GNUNET_GenericReturnValue GNUNET_BLOCK_group_serialize(struct GNUNET_BLOCK_Group *bg, void **raw_data, size_t *raw_data_size)
Serialize state of a block group.
Definition: block.c:175
enum GNUNET_GenericReturnValue 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:276
@ GNUNET_BLOCK_REPLY_OK_MORE
Valid result, and there may be more.
@ GNUNET_BLOCK_REPLY_OK_DUPLICATE
Valid result, but suppressed because it is a duplicate.
@ GNUNET_BLOCK_REPLY_OK_LAST
Last possible valid result.
@ GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED
Specified block type not supported by any plugin.
@ GNUNET_BLOCK_REPLY_IRRELEVANT
Block does not match xquery (valid result, not relevant for the request)
GNUNET_GenericReturnValue
Named constants for return values.
Definition: gnunet_common.h:96
Handle to an initialized block library.
Definition: block.c:55
Block group data.
A 512-bit hashcode.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model