GNUnet  0.16.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 
160  const struct GNUNET_IDENTITY_PrivateKey *pkey,
161  const char *label,
162  unsigned int rd_count,
163  const struct GNUNET_GNSRECORD_Data *rd,
164  int is_zonemaster,
166  void *cont_cls);
167 
168 
169 
170 
180 typedef void
181 (*GNUNET_NAMESTORE_RecordMonitor) (void *cls,
182  const struct
184  const char *label,
185  unsigned int rd_count,
186  const struct GNUNET_GNSRECORD_Data *rd);
187 
188 
205  const struct
207  const char *label,
209  void *error_cb_cls,
211  void *rm_cls);
212 
213 
233  const struct GNUNET_IDENTITY_PrivateKey *zone,
234  const struct
235  GNUNET_IDENTITY_PublicKey *value_zone,
237  void *error_cb_cls,
239  void *proc_cls);
240 
241 
250 void
252 
253 
281  const struct
284  void *error_cb_cls,
286  void *proc_cls,
288  void *finish_cb_cls);
289 
290 
299 void
301  uint64_t limit);
302 
303 
311 void
313 
314 
319 
320 
350  const struct GNUNET_CONFIGURATION_Handle *cfg,
351  const struct GNUNET_IDENTITY_PrivateKey *zone,
352  int iterate_first,
354  void *error_cb_cls,
356  void *monitor_cls,
358  void *sync_cb_cls);
359 
360 
382 void
384  uint64_t limit);
385 
386 
392 void
394 
395 
412  void *error_cb_cls);
413 
427  void *error_cb_cls);
441  void *error_cb_cls);
442 
459  const struct
461  const char *label,
463  void *error_cb_cls,
465  void *rm_cls);
466 
467 
490  const struct GNUNET_IDENTITY_PrivateKey *pkey,
491  const char *label,
492  unsigned int rd_count,
493  const struct GNUNET_GNSRECORD_Data *rd,
495  void *cont_cls);
496 
497 #if 0 /* keep Emacsens' auto-indent happy */
498 {
499 #endif
500 #ifdef __cplusplus
501 }
502 #endif
503 
504 #endif
505  /* end of group */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static void error_cb(void *cls)
Function called if lookup fails.
Definition: gnunet-abd.c:479
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static int monitor
Monitor ARM activity.
Definition: gnunet-arm.c:64
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
static char * pkey
Public key of the zone to look in, in ASCII.
static char * zone
Name of the zone being managed.
static void sync_cb(void *cls)
Function called once we are in sync in monitor mode.
static struct GNUNET_NAMESTORE_ZoneMonitor * zm
Monitor handle.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_replace(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)
Creates, deletes or updates an item in the namestore.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_select(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 GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
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).
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 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 GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
void GNUNET_NAMESTORE_zone_monitor_stop(struct GNUNET_NAMESTORE_ZoneMonitor *zm)
Stop monitoring a zone for changes.
void(* GNUNET_NAMESTORE_ContinuationWithStatus)(void *cls, int32_t success, const char *emsg)
Continuation called to notify client about result of the operation.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_transaction_commit(struct GNUNET_NAMESTORE_Handle *h, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls)
Commit a namestore transaction.
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_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.
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
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 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).
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_transaction_begin(struct GNUNET_NAMESTORE_Handle *h, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls)
New API draft.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_transaction_abort(struct GNUNET_NAMESTORE_Handle *h, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls)
Begin rollback all actions in a transaction.
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, int is_zonemaster, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the namestore.
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.
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Connection to the NAMESTORE service.
An QueueEntry used to store information for a pending NAMESTORE record operation.
Definition: namestore_api.c:54
void * error_cb_cls
Closure for error_cb.
Definition: namestore_api.c:98
GNUNET_NAMESTORE_RecordMonitor proc
Function to call with the records we get back; or NULL.
Definition: namestore_api.c:83
GNUNET_NAMESTORE_ContinuationWithStatus cont
Continuation to call.
Definition: namestore_api.c:73
void * cont_cls
Closure for cont.
Definition: namestore_api.c:78
void * proc_cls
Closure for proc.
Definition: namestore_api.c:88
Handle for a zone iterator operation.
void * finish_cb_cls
Closure for error_cb.
void * error_cb_cls
Closure for error_cb.
void * proc_cls
Closure for proc.
GNUNET_NAMESTORE_RecordMonitor proc
The continuation to call with the results.
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Handle for a monitoring activity.
void * monitor_cls
Closure for monitor.
void * sync_cb_cls
Closure for sync_cb.
void * error_cb_cls
Closure for error_cb.
int iterate_first
Do we first iterate over all existing records?