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"
45 
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #if 0 /* keep Emacsens' auto-indent happy */
50 }
51 #endif
52 #endif
53 
54 
59 
64 
69 
70 
79 
80 
88 void
90 
91 
102 typedef void
104  int32_t success,
105  const char *emsg);
106 
107 
130  const struct GNUNET_IDENTITY_PrivateKey *pkey,
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 
172  const struct
174  const char *label,
176  void *error_cb_cls,
178  void *rm_cls);
179 
180 
200  const struct GNUNET_IDENTITY_PrivateKey *zone,
201  const struct
202  GNUNET_IDENTITY_PublicKey *value_zone,
204  void *error_cb_cls,
206  void *proc_cls);
207 
208 
217 void
219 
220 
248  const struct
251  void *error_cb_cls,
253  void *proc_cls,
255  void *finish_cb_cls);
256 
257 
266 void
268  uint64_t limit);
269 
270 
278 void
280 
281 
286 
287 
317  const struct GNUNET_CONFIGURATION_Handle *cfg,
318  const struct GNUNET_IDENTITY_PrivateKey *zone,
319  int iterate_first,
321  void *error_cb_cls,
323  void *monitor_cls,
325  void *sync_cb_cls);
326 
327 
349 void
351  uint64_t limit);
352 
353 
359 void
361 
362 
363 #if 0 /* keep Emacsens' auto-indent happy */
364 {
365 #endif
366 #ifdef __cplusplus
367 }
368 #endif
369 
370 #endif
371  /* end of group */
void(* GNUNET_NAMESTORE_RecordMonitor)(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Process a record that was stored in the namestore.
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.
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
static void sync_cb(void *cls)
Function called once we are in sync in monitor mode.
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.
struct GNUNET_NAMESTORE_ZoneMonitor * GNUNET_NAMESTORE_zone_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_IDENTITY_PrivateKey *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.
void * proc_cls
Closure for proc.
A private key for an identity as per LSD0001.
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.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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.
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...
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.
static char * zone
Name of the zone being managed.
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?
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_zone_to_name(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *zone, const struct GNUNET_IDENTITY_PublicKey *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_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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)...
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
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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.
void * finish_cb_cls
Closure for error_cb.
void * cont_cls
Closure for cont.
Definition: namestore_api.c:78
An identity key as per LSD0001.
static int monitor
Monitor ARM activity.
Definition: gnunet-arm.c:64
configuration data
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.