GNUnet  0.20.0
gnunet_namestore_plugin.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2012, 2013, 2018 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 
34 #ifndef GNUNET_NAMESTORE_PLUGIN_H
35 #define GNUNET_NAMESTORE_PLUGIN_H
36 
37 
38 #include "gnunet_util_lib.h"
40 
41 #ifdef __cplusplus
42 extern "C"
43 {
44 #if 0 /* keep Emacsens' auto-indent happy */
45 }
46 #endif
47 #endif
48 
49 
61 typedef void
63  uint64_t serial,
64  const struct
65  GNUNET_IDENTITY_PrivateKey *private_key,
66  const char *label,
67  unsigned int rd_count,
68  const struct GNUNET_GNSRECORD_Data *rd);
69 
70 
75 {
79  void *cls;
80 
93  (*store_records)(void *cls,
94  const struct GNUNET_IDENTITY_PrivateKey *zone,
95  const char *label,
96  unsigned int rd_count,
97  const struct GNUNET_GNSRECORD_Data *rd);
98 
110  (*lookup_records)(void *cls,
111  const struct GNUNET_IDENTITY_PrivateKey *zone,
112  const char *label,
114  void *iter_cls);
115 
116 
132  (*iterate_records)(void *cls,
133  const struct GNUNET_IDENTITY_PrivateKey *zone,
134  uint64_t serial,
135  uint64_t limit,
137  void *iter_cls);
138 
139 
152  (*zone_to_name)(void *cls,
153  const struct GNUNET_IDENTITY_PrivateKey *zone,
154  const struct GNUNET_IDENTITY_PublicKey *value_zone,
156  void *iter_cls);
157 
168  (*transaction_begin)(void *cls, char **emsg);
169 
178  (*transaction_rollback)(void *cls, char **emsg);
179 
188  (*transaction_commit)(void *cls, char **emsg);
189 
203  (*edit_records)(void *cls,
204  const struct GNUNET_IDENTITY_PrivateKey *zone,
205  const char *label,
207  void *iter_cls);
208 
216  (*create_tables)(void *cls);
217 
218 
227  (*drop_tables)(void *cls);
228 };
229 
230 
231 #if 0 /* keep Emacsens' auto-indent happy */
232 {
233 #endif
234 #ifdef __cplusplus
235 }
236 #endif
237 
238 #endif
239  /* end of group */
241  /* end of group addition */
static char * zone
Name of the zone being managed.
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
API that can be used to store naming information on a GNUnet node;.
GNUNET_GenericReturnValue
Named constants for return values.
void(* GNUNET_NAMESTORE_RecordIterator)(void *cls, uint64_t serial, const struct GNUNET_IDENTITY_PrivateKey *private_key, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Function called for each matching record.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
struct returned by the initialization function of the plugin
enum GNUNET_GenericReturnValue(* create_tables)(void *cls)
Setup the database.
enum GNUNET_GenericReturnValue(* store_records)(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Store a record in the datastore for which we are the authority.
enum GNUNET_GenericReturnValue(* lookup_records)(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
Lookup records in the datastore for which we are the authority.
enum GNUNET_GenericReturnValue(* transaction_begin)(void *cls, char **emsg)
Transaction-based API draft.
enum GNUNET_GenericReturnValue(* iterate_records)(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, uint64_t serial, uint64_t limit, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
Iterate over the results for a particular zone in the datastore.
enum GNUNET_GenericReturnValue(* zone_to_name)(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const struct GNUNET_IDENTITY_PublicKey *value_zone, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
Look for an existing PKEY delegation record for a given public key.
enum GNUNET_GenericReturnValue(* drop_tables)(void *cls)
Drop existing tables.
enum GNUNET_GenericReturnValue(* transaction_commit)(void *cls, char **emsg)
Commit a transaction in the database.
void * cls
Closure to pass to all plugin functions.
enum GNUNET_GenericReturnValue(* transaction_rollback)(void *cls, char **emsg)
Abort and roll back a transaction in the database.
enum GNUNET_GenericReturnValue(* edit_records)(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
Edit records in the datastore for which we are the authority.