2 This file is part of GNUnet
3 Copyright (C) 2012, 2013 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @author Christian Grothoff
25 * Plugin API for the namestore database backend
27 * @defgroup namestore-plugin Name Store service plugin API
28 * Plugin API for the namestore database backend
31 #ifndef GNUNET_NAMESTORE_PLUGIN_H
32 #define GNUNET_NAMESTORE_PLUGIN_H
34 #include "gnunet_util_lib.h"
35 #include "gnunet_namestore_service.h"
40 #if 0 /* keep Emacsens' auto-indent happy */
47 * Function called by for each matching record.
50 * @param zone_key private key of the zone
51 * @param label name that is being mapped (at most 255 characters long)
52 * @param rd_count number of entries in @a rd array
53 * @param rd array of records with data to store
56 (*GNUNET_NAMESTORE_RecordIterator) (void *cls,
57 const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key,
59 unsigned int rd_count,
60 const struct GNUNET_GNSRECORD_Data *rd);
64 * @brief struct returned by the initialization function of the plugin
66 struct GNUNET_NAMESTORE_PluginFunctions
70 * Closure to pass to all plugin functions.
75 * Store a record in the datastore for which we are the authority.
76 * Removes any existing record in the same zone with the same name.
78 * @param cls closure (internal context for the plugin)
79 * @param zone private key of the zone
80 * @param label name of the record in the zone
81 * @param rd_count number of entries in @a rd array, 0 to delete all records
82 * @param rd array of records with data to store
83 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
86 (*store_records) (void *cls,
87 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
89 unsigned int rd_count,
90 const struct GNUNET_GNSRECORD_Data *rd);
93 * Lookup records in the datastore for which we are the authority.
95 * @param cls closure (internal context for the plugin)
96 * @param zone private key of the zone
97 * @param label name of the record in the zone
98 * @param iter function to call with the result
99 * @param iter_cls closure for @a iter
100 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
103 (*lookup_records) (void *cls,
104 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
106 GNUNET_NAMESTORE_RecordIterator iter,
111 * Iterate over the results for a particular zone in the
112 * datastore. Will return at most one result to the iterator.
114 * @param cls closure (internal context for the plugin)
115 * @param zone private key of the zone, NULL for all zones
116 * @param offset offset in the list of all matching records
117 * @param iter function to call with the result
118 * @param iter_cls closure for @a iter
119 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
122 (*iterate_records) (void *cls,
123 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
125 GNUNET_NAMESTORE_RecordIterator iter,
130 * Look for an existing PKEY delegation record for a given public key.
131 * Returns at most one result to the iterator.
133 * @param cls closure (internal context for the plugin)
134 * @param zone private key of the zone to look up in, never NULL
135 * @param value_zone public key of the target zone (value), never NULL
136 * @param iter function to call with the result
137 * @param iter_cls closure for @a iter
138 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
141 (*zone_to_name) (void *cls,
142 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
143 const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone,
144 GNUNET_NAMESTORE_RecordIterator iter,
151 #if 0 /* keep Emacsens' auto-indent happy */
160 /** @} */ /* end of group */