GNUnet 0.22.2
plugin_block_seti_test.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 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
27#include "platform.h"
28#include "gnunet_block_plugin.h"
30
31
46 const struct GNUNET_HashCode *query,
47 const void *xquery,
48 size_t xquery_size)
49{
51 {
52 GNUNET_break (0);
53 return GNUNET_SYSERR;
54 }
55 if (0 != xquery_size)
56 {
58 return GNUNET_NO;
59 }
60 return GNUNET_OK;
61}
62
63
76 const void *block,
77 size_t block_size)
78{
79 (void) cls;
81 {
82 GNUNET_break (0);
83 return GNUNET_SYSERR;
84 }
85 if ((NULL == block) ||
86 (0 == block_size) ||
87 (0 != ((char *) block)[0]))
88 return GNUNET_SYSERR;
89 return GNUNET_OK;
90}
91
92
112 struct GNUNET_BLOCK_Group *group,
113 const struct GNUNET_HashCode *query,
114 const void *xquery,
115 size_t xquery_size,
116 const void *reply_block,
117 size_t reply_block_size)
118{
119 (void) cls;
120 (void) xquery;
121 (void) xquery_size;
123 {
124 GNUNET_break (0);
126 }
127 if ( (NULL == reply_block) ||
128 (0 == reply_block_size) ||
129 (0 != ((char *) reply_block)[0]) )
130 GNUNET_assert (0);
132}
133
134
149 const void *block,
150 size_t block_size,
151 struct GNUNET_HashCode *key)
152{
154 {
155 GNUNET_break (0);
156 return GNUNET_SYSERR;
157 }
158 return GNUNET_NO;
159}
160
161void *
163
167void *
169{
170 static enum GNUNET_BLOCK_Type types[] = {
172 GNUNET_BLOCK_TYPE_ANY /* end of list */
173 };
175
181 api->types = types;
182 return api;
183}
184
185void *
187
191void *
193{
194 struct GNUNET_BLOCK_PluginFunctions *api = cls;
195
196 GNUNET_free (api);
197 return NULL;
198}
199
200
201/* end of plugin_block_seti_test.c */
struct GNUNET_HashCode key
The key used in the DHT.
static uint32_t type
Type string converted to DNS type value.
API for block plugins.
GNUNET_BLOCK_ReplyEvaluationResult
Possible ways for how a block may relate to a query.
@ GNUNET_BLOCK_REPLY_OK_MORE
Valid result, and there may be more.
@ GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED
Specified block type not supported by any plugin.
GNUNET_GenericReturnValue
Named constants for return values.
@ GNUNET_OK
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
static enum GNUNET_GenericReturnValue block_plugin_seti_test_check_block(void *cls, enum GNUNET_BLOCK_Type type, const void *block, size_t block_size)
Function called to validate a block for storage.
static enum GNUNET_GenericReturnValue block_plugin_seti_test_check_query(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.
void * libgnunet_plugin_block_seti_test_done(void *cls)
Exit point from the plugin.
static enum GNUNET_GenericReturnValue block_plugin_seti_test_get_key(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 * libgnunet_plugin_block_seti_test_init(void *cls)
Entry point for the plugin.
static enum GNUNET_BLOCK_ReplyEvaluationResult block_plugin_seti_test_check_reply(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.
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
@ GNUNET_BLOCK_TYPE_ANY
Identifier for any block.
@ GNUNET_BLOCK_TYPE_SETI_TEST
Block for testing set intersection.
Block group data.
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.
void * cls
Closure for all of the callbacks.
A 512-bit hashcode.