GNUnet  0.19.2
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 
41 #ifndef GNUNET_NAMESTORE_SERVICE_H
42 #define GNUNET_NAMESTORE_SERVICE_H
43 
44 
45 #include "gnunet_error_codes.h"
46 #include "gnunet_util_lib.h"
47 #include "gnunet_block_lib.h"
48 #include "gnunet_gnsrecord_lib.h"
50 
51 #ifdef __cplusplus
52 extern "C"
53 {
54 #if 0 /* keep Emacsens' auto-indent happy */
55 }
56 #endif
57 #endif
58 
59 
64 
69 
74 
80 {
84 };
85 
91 {
92  const char *a_label;
93  unsigned int a_rd_count;
95 };
96 
97 
106 
107 
115 void
117 
118 
129 typedef void
131  enum GNUNET_ErrorCode ec);
132 
133 
156  const struct GNUNET_IDENTITY_PrivateKey *pkey,
157  const char *label,
158  unsigned int rd_count,
159  const struct GNUNET_GNSRECORD_Data *rd,
161  void *cont_cls);
162 
189  struct GNUNET_NAMESTORE_Handle *h,
190  const struct GNUNET_IDENTITY_PrivateKey *pkey,
191  unsigned int rd_set_count,
192  const struct GNUNET_NAMESTORE_RecordInfo *record_info,
193  unsigned int *rds_sent,
195  void *cont_cls);
196 
220  const struct GNUNET_IDENTITY_PrivateKey *pkey,
221  const char *label,
222  unsigned int rd_count,
223  const struct GNUNET_GNSRECORD_Data *rd,
224  int is_zonemaster,
226  void *cont_cls);
227 
228 
229 
230 
240 typedef void
241 (*GNUNET_NAMESTORE_RecordMonitor) (void *cls,
242  const struct
244  const char *label,
245  unsigned int rd_count,
246  const struct GNUNET_GNSRECORD_Data *rd);
247 
260 typedef void
262  const struct
264  const char *label,
265  unsigned int rd_count,
266  const struct GNUNET_GNSRECORD_Data *rd,
267  struct GNUNET_TIME_Absolute expiry);
268 
269 
286  const struct
288  const char *label,
290  void *error_cb_cls,
292  void *rm_cls);
293 
311  const struct
313  const char *label,
315  void *error_cb_cls,
317  void *rm_cls,
319 
320 
321 
341  const struct GNUNET_IDENTITY_PrivateKey *zone,
342  const struct
343  GNUNET_IDENTITY_PublicKey *value_zone,
345  void *error_cb_cls,
347  void *proc_cls);
348 
349 
358 void
360 
361 
392  const struct
395  void *error_cb_cls,
397  void *proc_cls,
399  void *finish_cb_cls);
400 
429  const struct
432  void *error_cb_cls,
434  void *proc_cls,
436  void *finish_cb_cls,
438 
439 
440 
449 void
451  uint64_t limit);
452 
453 
461 void
463 
464 
469 
470 
503  const struct GNUNET_CONFIGURATION_Handle *cfg,
504  const struct GNUNET_IDENTITY_PrivateKey *zone,
505  int iterate_first,
507  void *error_cb_cls,
509  void *monitor_cls,
511  void *sync_cb_cls);
512 
543  const struct GNUNET_CONFIGURATION_Handle *cfg,
544  const struct GNUNET_IDENTITY_PrivateKey *zone,
545  int iterate_first,
547  void *error_cb_cls,
549  void *monitor_cls,
551  void *sync_cb_cls,
553 
554 
576 void
578  uint64_t limit);
579 
580 
586 void
588 
589 
605  cont,
606  void *cont_cls);
607 
620  cont,
621  void *cont_cls);
634  cont,
635  void *cont_cls);
636 
639  struct GNUNET_NAMESTORE_Handle *h,
640  const struct GNUNET_IDENTITY_PrivateKey *pkey,
641  const char *label,
643  void *error_cb_cls,
645  void *rm_cls);
646 
647 #if 0 /* keep Emacsens' auto-indent happy */
648 {
649 #endif
650 #ifdef __cplusplus
651 }
652 #endif
653 
654 #endif
655  /* end of group */
657  /* end of group addition */
GNUNET_ErrorCode
Taler error codes.
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 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.
static void sync_cb(void *cls)
Function called once we are in sync in monitor mode.
static struct GNUNET_NAMESTORE_ZoneMonitor * zm
Monitor handle.
static struct GNUNET_CONTAINER_BloomFilter * filter
Bloomfilter to quickly tell if we don't have the content.
Library for data block manipulation.
API that can be used to manipulate GNS record data.
Identity service; implements identity management for GNUnet.
GNUNET_GNSRECORD_Filter
Filter for GNUNET_GNSRECORD_normalize_record_set().
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup2(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, enum GNUNET_GNSRECORD_Filter filter)
Lookup an item in the namestore with GNSRECORD filter.
void(* GNUNET_NAMESTORE_ContinuationWithStatus)(void *cls, enum GNUNET_ErrorCode ec)
Continuation called to notify client about result of the operation.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_transaction_rollback(struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Begin rollback all actions in a transaction.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store2(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, unsigned int rd_set_count, const struct GNUNET_NAMESTORE_RecordInfo *record_info, unsigned int *rds_sent, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store one or more record sets 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)
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.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_transaction_begin(struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
New API draft.
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_RecordSetMonitor)(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute expiry)
Process a record set that was stored in the namestore.
void GNUNET_NAMESTORE_zone_monitor_stop(struct GNUNET_NAMESTORE_ZoneMonitor *zm)
Stop monitoring a zone for changes.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start2(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordSetMonitor proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls, enum GNUNET_GNSRECORD_Filter filter)
Starts a new zone iteration (used to periodically PUT all of our records into our DHT).
GNUNET_NAMESTORE_TxControl
Transaction control types.
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.
struct GNUNET_NAMESTORE_ZoneMonitor * GNUNET_NAMESTORE_zone_monitor_start2(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_RecordSetMonitor monitor, void *monitor_cls, GNUNET_SCHEDULER_TaskCallback sync_cb, void *sync_cb_cls, enum GNUNET_GNSRECORD_Filter filter)
Begin monitoring a zone for changes.
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)
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_commit(struct GNUNET_NAMESTORE_Handle *h, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_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, 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.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_edit(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)
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
@ GNUNET_NAMESTORE_TX_COMMIT
@ GNUNET_NAMESTORE_TX_ROLLBACK
@ GNUNET_NAMESTORE_TX_BEGIN
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:53
void * error_cb_cls
Closure for error_cb.
GNUNET_NAMESTORE_RecordMonitor proc
Function to call with the records we get back; or NULL.
Definition: namestore_api.c:82
GNUNET_NAMESTORE_ContinuationWithStatus cont
Continuation to call.
Definition: namestore_api.c:72
void * cont_cls
Closure for cont.
Definition: namestore_api.c:77
void * proc_cls
Closure for proc.
Definition: namestore_api.c:92
A struct for record bulk import.
struct GNUNET_GNSRECORD_Data * a_rd
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?
Time for absolute times used by GNUnet, in microseconds.