GNUnet 0.21.1
plugin_datacache_template.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2006, 2009, 2015, 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
26#include "platform.h"
27#include "gnunet_util_lib.h"
29
30
34struct Plugin
35{
40};
41
42
51static ssize_t
53 uint32_t xor_distance,
54 const struct GNUNET_DATACACHE_Block *block)
55{
56 GNUNET_break (0);
57 return -1;
58}
59
60
72static unsigned int
74 const struct GNUNET_HashCode *key,
77 void *iter_cls)
78{
79 GNUNET_break (0);
80 return 0;
81}
82
83
93{
94 GNUNET_break (0);
95 return GNUNET_SYSERR;
96}
97
98
113static unsigned int
115 const struct GNUNET_HashCode *key,
117 unsigned int num_results,
119 void *iter_cls)
120{
121 GNUNET_break (0);
122 return 0;
123}
124
125
132void *
134{
137 struct Plugin *plugin;
138
139 plugin = GNUNET_new (struct Plugin);
140 plugin->env = env;
142 api->cls = plugin;
143 api->get = &template_plugin_get;
144 api->put = &template_plugin_put;
145 api->del = &template_plugin_del;
146 api->get_closest = &template_plugin_get_closest;
148 "template",
149 "Template datacache running\n");
150 return api;
151}
152
153
160void *
162{
164 struct Plugin *plugin = api->cls;
165
168 return NULL;
169}
170
171
172/* end of plugin_datacache_template.c */
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct TestcasePlugin * plugin
The process handle to the testbed service.
struct GNUNET_HashCode key
The key used in the DHT.
static uint32_t type
Type string converted to DNS type value.
API for database backends for the datacache.
enum GNUNET_GenericReturnValue(* GNUNET_DATACACHE_Iterator)(void *cls, const struct GNUNET_DATACACHE_Block *block)
An iterator over a set of items stored in the datacache.
#define GNUNET_log_from(kind, comp,...)
GNUNET_GenericReturnValue
Named constants for return values.
@ GNUNET_SYSERR
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_INFO
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
static enum GNUNET_GenericReturnValue template_plugin_del(void *cls)
Delete the entry with the lowest expiration value from the datacache right now.
static unsigned int template_plugin_get(void *cls, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Iterate over the results for a particular key in the datastore.
void * libgnunet_plugin_datacache_template_done(void *cls)
Exit point from the plugin.
static unsigned int template_plugin_get_closest(void *cls, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, unsigned int num_results, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Iterate over the results that are "close" to a particular key in the datacache.
static ssize_t template_plugin_put(void *cls, uint32_t xor_distance, const struct GNUNET_DATACACHE_Block *block)
Store an item in the datastore.
void * libgnunet_plugin_datacache_template_init(void *cls)
Entry point for the plugin.
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
void * cls
Closure for all of the callbacks.
Information about a block stored in the datacache.
The datastore service will pass a pointer to a struct of this type as the first and only argument to ...
void * cls
Closure to use for callbacks.
struct returned by the initialization function of the plugin
void * cls
Closure to pass to all plugin functions.
A 512-bit hashcode.
Handle for a plugin.
Definition: block.c:38
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47
struct GNUNET_DATACACHE_PluginEnvironment * env
Our execution environment.