GNUnet 0.21.0
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
38#include "gnunet_util_lib.h"
39#include "gnunet_dht_block_types.h"
40
41#ifdef __cplusplus
42extern "C"
43{
44#if 0 /* keep Emacsens' auto-indent happy */
45}
46#endif
47#endif
48
49
54{
55
60
65
70
75
80
81};
82
83
88
89
97void
99 uint32_t mingle_number,
100 struct GNUNET_HashCode *hc);
101
102
111
112
118void
120
121
127struct GNUNET_BLOCK_Group;
128
129
141struct GNUNET_BLOCK_Group *
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
169void
171
172
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
212 const struct GNUNET_HashCode *query,
213 const void *xquery,
214 size_t xquery_size);
215
216
230 const void *block,
231 size_t block_size);
232
233
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 struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:109
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_FS_Handle * ctx
static uint32_t type
Type string converted to DNS type value.
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:363
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:337
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:319
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
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_group_destroy(struct GNUNET_BLOCK_Group *bg)
Destroy resources used by a block group.
Definition: block.c:192
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
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
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.
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
Handle to an initialized block library.
Definition: block.c:55
Block group data.
A 512-bit hashcode.