GNUnet  0.11.x
gnunet_namestore_service.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 
38 #ifndef GNUNET_NAMESTORE_SERVICE_H
39 #define GNUNET_NAMESTORE_SERVICE_H
40 
41 #include "gnunet_util_lib.h"
42 #include "gnunet_block_lib.h"
43 #include "gnunet_gnsrecord_lib.h"
44 
45 #ifdef __cplusplus
46 extern "C"
47 {
48 #if 0 /* keep Emacsens' auto-indent happy */
49 }
50 #endif
51 #endif
52 
53 
58 
63 
68 
69 
78 
79 
87 void
89 
90 
101 typedef void
103  int32_t success,
104  const char *emsg);
105 
106 
129  const struct
131  const char *label,
132  unsigned int rd_count,
133  const struct GNUNET_GNSRECORD_Data *rd,
135  void *cont_cls);
136 
137 
147 typedef void
149  const struct
151  const char *label,
152  unsigned int rd_count,
153  const struct GNUNET_GNSRECORD_Data *rd);
154 
155 
168  const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
169  const char *nick,
171  void *cont_cls);
172 
173 
190  const struct
192  const char *label,
194  void *error_cb_cls,
196  void *rm_cls);
197 
198 
218  const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
219  const struct
220  GNUNET_CRYPTO_EcdsaPublicKey *value_zone,
222  void *error_cb_cls,
224  void *proc_cls);
225 
226 
235 void
237 
238 
266  const struct
269  void *error_cb_cls,
271  void *proc_cls,
273  void *finish_cb_cls);
274 
275 
284 void
286  uint64_t limit);
287 
288 
296 void
298 
299 
304 
305 
336  const struct
338  int iterate_first,
340  void *error_cb_cls,
342  void *monitor_cls,
344  void *sync_cb_cls);
345 
346 
368 void
370  uint64_t limit);
371 
372 
378 void
380 
381 
382 #if 0 /* keep Emacsens' auto-indent happy */
383 {
384 #endif
385 #ifdef __cplusplus
386 }
387 #endif
388 
389 #endif
390  /* end of group */
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
void(* GNUNET_NAMESTORE_ContinuationWithStatus)(void *cls, int32_t success, const char *emsg)
Continuation called to notify client about result of the operation.
static char * pkey
Public key of the zone to look in, in ASCII.
void * error_cb_cls
Closure for error_cb.
struct GNUNET_NAMESTORE_ZoneMonitor * GNUNET_NAMESTORE_zone_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, int iterate_first, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor monitor, void *monitor_cls, GNUNET_SCHEDULER_TaskCallback sync_cb, void *sync_cb_cls)
Begin monitoring a zone for changes.
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
GNUNET_NAMESTORE_RecordMonitor proc
Function to call with the records we get back; or NULL.
Definition: namestore_api.c:83
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls)
Lookup an item in the namestore.
static void sync_cb(void *cls)
Function called once we are in sync in monitor mode.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
Starts a new zone iteration (used to periodically PUT all of our records into our DHT)...
static void error_cb(void *cls)
Function called if lookup fails.
Definition: gnunet-abd.c:485
GNUNET_NAMESTORE_RecordMonitor proc
The continuation to call with the results.
void * proc_cls
Closure for proc.
void(* GNUNET_NAMESTORE_RecordMonitor)(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Process a record that was stored in the namestore.
void GNUNET_NAMESTORE_zone_monitor_stop(struct GNUNET_NAMESTORE_ZoneMonitor *zm)
Stop monitoring a zone for changes.
static struct GNUNET_NAMESTORE_ZoneMonitor * zm
Monitor handle.
void GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it, uint64_t limit)
Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_start for the next record...
Private ECC key encoded for transmission.
void * error_cb_cls
Closure for error_cb.
void * proc_cls
Closure for proc.
Definition: namestore_api.c:88
void * error_cb_cls
Closure for error_cb.
Definition: namestore_api.c:98
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the namestore.
static char * zone
Name of the zone we manage.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
Handle for a monitoring activity.
Handle for a zone iterator operation.
Connection to the NAMESTORE service.
int iterate_first
Do we first iterate over all existing records?
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
void * sync_cb_cls
Closure for sync_cb.
An QueueEntry used to store information for a pending NAMESTORE record operation. ...
Definition: namestore_api.c:53
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
GNUNET_NAMESTORE_ContinuationWithStatus cont
Continuation to call.
Definition: namestore_api.c:73
void * finish_cb_cls
Closure for error_cb.
void * cont_cls
Closure for cont.
Definition: namestore_api.c:78
static int monitor
Monitor ARM activity.
Definition: gnunet-arm.c:64
configuration data
Definition: configuration.c:85
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_zone_to_name(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls)
Look for an existing PKEY delegation record for a given public key.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_set_nick(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *nick, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Set the desired nick name for a zone.
void GNUNET_NAMESTORE_zone_monitor_next(struct GNUNET_NAMESTORE_ZoneMonitor *zm, uint64_t limit)
Calls the monitor processor specified in GNUNET_NAMESTORE_zone_monitor_start for the next record(s)...
void * monitor_cls
Closure for monitor.