GNUnet 0.22.2
gnunet_block_plugin.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2010, 2013, 2017, 2021, 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
38#ifndef PLUGIN_BLOCK_H
39#define PLUGIN_BLOCK_H
40
41
42#include "gnunet_util_lib.h"
43#include "gnunet_block_lib.h"
44
45
54typedef void
56 struct GNUNET_BLOCK_Group *bg,
57 const struct GNUNET_HashCode *seen_results,
58 unsigned int seen_results_count);
59
60
72 const struct GNUNET_BLOCK_Group *bg2);
73
74
86 void **raw_data,
87 size_t *raw_data_size);
88
89
95typedef void
97
98
104{
108 struct GNUENT_BLOCK_Context *ctx;
109
114
120
126
132
138
143};
144
145
158typedef struct GNUNET_BLOCK_Group *
159(*GNUNET_BLOCK_GroupCreateFunction)(void *cls,
161 const void *raw_data,
162 size_t raw_data_size,
163 va_list va);
164
165
176typedef enum GNUNET_GenericReturnValue
179 const struct GNUNET_HashCode *query,
180 const void *xquery,
181 size_t xquery_size);
182
183
193typedef enum GNUNET_GenericReturnValue
196 const void *block,
197 size_t block_size);
198
199
219 struct GNUNET_BLOCK_Group *group,
220 const struct GNUNET_HashCode *query,
221 const void *xquery,
222 size_t xquery_size,
223 const void *reply_block,
224 size_t reply_block_size);
225
226
241typedef enum GNUNET_GenericReturnValue
242(*GNUNET_BLOCK_GetKeyFunction)(void *cls,
244 const void *block,
245 size_t block_size,
246 struct GNUNET_HashCode *key);
247
248
254{
258 void *cls;
259
264
269
275
280
285
290
291};
292
293#endif
294 /* end of group */
296 /* end of group addition */
struct GNUNET_HashCode key
The key used in the DHT.
static uint32_t type
Type string converted to DNS type value.
Library for data block manipulation.
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
enum GNUNET_BLOCK_ReplyEvaluationResult(* GNUNET_BLOCK_ReplyEvaluationFunction)(void *cls, 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 a reply to a request.
enum GNUNET_GenericReturnValue(* GNUNET_BLOCK_QueryEvaluationFunction)(void *cls, enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode *query, const void *xquery, size_t xquery_size)
Function called to validate a query.
enum GNUNET_GenericReturnValue(* GNUNET_BLOCK_BlockEvaluationFunction)(void *cls, enum GNUNET_BLOCK_Type type, const void *block, size_t block_size)
Function called to validate a block for storage.
struct GNUNET_BLOCK_Group *(* GNUNET_BLOCK_GroupCreateFunction)(void *cls, enum GNUNET_BLOCK_Type type, const void *raw_data, size_t raw_data_size, va_list va)
Create a new block group.
void(* GNUNET_BLOCK_GroupMarkSeenFunction)(struct GNUNET_BLOCK_Group *bg, const struct GNUNET_HashCode *seen_results, unsigned int seen_results_count)
Mark elements as "seen" using a hash of the element.
enum GNUNET_GenericReturnValue(* GNUNET_BLOCK_GroupSerializeFunction)(struct GNUNET_BLOCK_Group *bg, void **raw_data, size_t *raw_data_size)
Serialize state of a block group.
enum GNUNET_GenericReturnValue(* GNUNET_BLOCK_GetKeyFunction)(void *cls, 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.
void(* GNUNET_BLOCK_GroupDestroyFunction)(struct GNUNET_BLOCK_Group *bg)
Destroy resources used by a block group.
enum GNUNET_GenericReturnValue(* GNUNET_BLOCK_GroupMergeFunction)(struct GNUNET_BLOCK_Group *bg1, const struct GNUNET_BLOCK_Group *bg2)
Merge two groups, if possible.
GNUNET_BLOCK_ReplyEvaluationResult
Possible ways for how a block may relate to a query.
GNUNET_GenericReturnValue
Named constants for return values.
Block group data.
GNUNET_BLOCK_GroupMergeFunction merge_cb
Function to call to merge two groups.
GNUNET_BLOCK_GroupDestroyFunction destroy_cb
Function to call to destroy the block group.
GNUNET_BLOCK_GroupMarkSeenFunction mark_seen_cb
Function to call to mark elements as seen in the group.
struct GNUENT_BLOCK_Context * ctx
Context owning the block group.
void * internal_cls
Internal data structure of the plugin.
GNUNET_BLOCK_GroupSerializeFunction serialize_cb
Serialize the block group data, can be NULL if not supported.
enum GNUNET_BLOCK_Type type
Type for the block group.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
enum GNUNET_BLOCK_Type * types
0-terminated array of block types supported by this plugin.
GNUNET_BLOCK_QueryEvaluationFunction check_query
Check that a query is well-formed.
GNUNET_BLOCK_BlockEvaluationFunction check_block
Check that a block is well-formed.
GNUNET_BLOCK_GetKeyFunction get_key
Obtain the key for a given block (if possible).
GNUNET_BLOCK_ReplyEvaluationFunction check_reply
Check that a reply block matches a query.
GNUNET_BLOCK_GroupCreateFunction create_group
Create a block group to process a bunch of blocks in a shared context (i.e.
void * cls
Closure for all of the callbacks.
A 512-bit hashcode.