GNUnet  0.17.6
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 #include "gnunet_util_lib.h"
42 #include "gnunet_block_lib.h"
43 
44 
53 typedef void
55  struct GNUNET_BLOCK_Group *bg,
56  const struct GNUNET_HashCode *seen_results,
57  unsigned int seen_results_count);
58 
59 
69 typedef enum GNUNET_GenericReturnValue
71  const struct GNUNET_BLOCK_Group *bg2);
72 
73 
83 typedef enum GNUNET_GenericReturnValue
85  void **raw_data,
86  size_t *raw_data_size);
87 
88 
94 typedef void
96 
97 
103 {
107  struct GNUENT_BLOCK_Context *ctx;
108 
112  enum GNUNET_BLOCK_Type type;
113 
119 
125 
131 
137 
142 };
143 
144 
157 typedef struct GNUNET_BLOCK_Group *
158 (*GNUNET_BLOCK_GroupCreateFunction)(void *cls,
159  enum GNUNET_BLOCK_Type type,
160  const void *raw_data,
161  size_t raw_data_size,
162  va_list va);
163 
164 
175 typedef enum GNUNET_GenericReturnValue
177  enum GNUNET_BLOCK_Type type,
178  const struct GNUNET_HashCode *query,
179  const void *xquery,
180  size_t xquery_size);
181 
182 
192 typedef enum GNUNET_GenericReturnValue
194  enum GNUNET_BLOCK_Type type,
195  const void *block,
196  size_t block_size);
197 
198 
217  enum GNUNET_BLOCK_Type type,
218  struct GNUNET_BLOCK_Group *group,
219  const struct GNUNET_HashCode *query,
220  const void *xquery,
221  size_t xquery_size,
222  const void *reply_block,
223  size_t reply_block_size);
224 
225 
240 typedef enum GNUNET_GenericReturnValue
241 (*GNUNET_BLOCK_GetKeyFunction)(void *cls,
242  enum GNUNET_BLOCK_Type type,
243  const void *block,
244  size_t block_size,
245  struct GNUNET_HashCode *key);
246 
247 
253 {
257  void *cls;
258 
263 
268 
274 
279 
284 
289 
290 };
291 
292 #endif
293  /* end of group */
295  /* end of group addition */
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
struct GNUNET_HashCode key
The key used in the DHT.
Library for data block manipulation.
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.
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.
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.
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.
Definition: gnunet_common.h:96
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.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model