GNUnet  0.10.x
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 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 
35 #ifndef PLUGIN_BLOCK_H
36 #define PLUGIN_BLOCK_H
37 
38 #include "gnunet_util_lib.h"
39 #include "gnunet_block_lib.h"
40 
41 
50 typedef void
52  const struct GNUNET_HashCode *seen_results,
53  unsigned int seen_results_count);
54 
55 
65 typedef int
67  const struct GNUNET_BLOCK_Group *bg2);
68 
69 
80 typedef int
82  uint32_t *nonce,
83  void **raw_data,
84  size_t *raw_data_size);
85 
86 
92 typedef void
94 
95 
104  struct GNUENT_BLOCK_Context *ctx;
105 
110 
116 
122 
128 
134 
139 };
140 
141 
154 typedef struct GNUNET_BLOCK_Group *
155 (*GNUNET_BLOCK_GroupCreateFunction)(void *cls,
156  enum GNUNET_BLOCK_Type type,
157  uint32_t nonce,
158  const void *raw_data,
159  size_t raw_data_size,
160  va_list va);
161 
162 
184  struct GNUNET_BLOCK_Context *ctx,
185  enum GNUNET_BLOCK_Type type,
186  struct GNUNET_BLOCK_Group *group,
188  const struct GNUNET_HashCode *query,
189  const void *xquery,
190  size_t xquery_size,
191  const void *reply_block,
192  size_t reply_block_size);
193 
194 
208 typedef int
210  enum GNUNET_BLOCK_Type type,
211  const void *block,
212  size_t block_size,
213  struct GNUNET_HashCode *key);
214 
215 
216 
225  void *cls;
226 
231 
237 
242 
248 };
249 
250 #endif
251  /* end of group */
enum GNUNET_BLOCK_EvaluationResult(* GNUNET_BLOCK_EvaluationFunction)(void *cls, 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.
Handle to an initialized block library.
Definition: block.c:53
void * internal_cls
Internal data structure of the plugin.
void(* GNUNET_BLOCK_GroupDestroyFunction)(struct GNUNET_BLOCK_Group *bg)
Destroy resources used by a block group.
enum GNUNET_BLOCK_Type * types
0-terminated array of block types supported by this plugin.
GNUNET_BLOCK_GroupSerializeFunction serialize_cb
Serialize the block group data, can be NULL if not supported.
GNUNET_BLOCK_EvaluationFunction evaluate
Main function of a block plugin.
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
struct GNUNET_BLOCK_Group *(* GNUNET_BLOCK_GroupCreateFunction)(void *cls, enum GNUNET_BLOCK_Type type, uint32_t nonce, const void *raw_data, size_t raw_data_size, va_list va)
Create a new block group.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
GNUNET_BLOCK_GroupDestroyFunction destroy_cb
Function to call to destroy the block group.
struct GNUENT_BLOCK_Context * ctx
Context owning the block group.
enum GNUNET_BLOCK_Type type
Type for the 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.
int(* GNUNET_BLOCK_GroupSerializeFunction)(struct GNUNET_BLOCK_Group *bg, uint32_t *nonce, void **raw_data, size_t *raw_data_size)
Serialize state of a block group.
A 512-bit hashcode.
int(* GNUNET_BLOCK_GroupMergeFunction)(struct GNUNET_BLOCK_Group *bg1, const struct GNUNET_BLOCK_Group *bg2)
Merge two groups, if possible.
struct GNUNET_HashCode key
The key used in the DHT.
GNUNET_BLOCK_GroupCreateFunction create_group
Create a block group to process a bunch of blocks in a shared context (i.e.
GNUNET_BLOCK_EvaluationResult
Possible ways for how a block may relate to a query.
GNUNET_BLOCK_GetKeyFunction get_key
Obtain the key for a given block (if possible).
GNUNET_BLOCK_GroupMergeFunction merge_cb
Function to call to merge two groups.
Block group data.
void * cls
Closure for all of the callbacks.
GNUNET_BLOCK_EvaluationOptions
Flags that can be set to control the evaluation.
int(* 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.
GNUNET_BLOCK_GroupMarkSeenFunction mark_seen_cb
Function to call to mark elements as seen in the group.