GNUnet 0.25.2-10-g5b94a194f
 
Loading...
Searching...
No Matches
plugin_namestore_flat.c
Go to the documentation of this file.
1/*
2 * This file is part of GNUnet
3 * Copyright (C) 2009-2015, 2018, 2019 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 */
27#include "platform.h"
30
34struct Plugin
35{
36 const struct GNUNET_CONFIGURATION_Handle *cfg;
37
41 char *fn;
42
47};
48
49
50struct FlatFileEntry
51{
56
60 uint32_t record_count;
61
65 uint64_t rvalue;
66
71
75 char *label;
76};
77
78
86static void
88 const char *label,
89 struct GNUNET_HashCode *h)
90{
91 char *key;
92 size_t label_len;
93 size_t key_len;
94
95 label_len = strlen (label);
96 key_len = label_len + sizeof(struct GNUNET_CRYPTO_BlindablePrivateKey);
97 key = GNUNET_malloc (key_len);
99 label,
100 label_len);
101 GNUNET_memcpy (key + label_len,
102 pkey,
103 sizeof(struct GNUNET_CRYPTO_BlindablePrivateKey));
105 key_len,
106 h);
108}
109
110
119static int
121{
122 char *flatdbfile;
123 char *record_data;
124 char *zone_private_key;
125 char *record_data_b64;
126 char *buffer;
127 char *line;
128 char *label;
129 char *rvalue;
130 char *record_count;
131 size_t record_data_size;
132 uint64_t size;
133 struct GNUNET_HashCode hkey;
134 struct GNUNET_DISK_FileHandle *fh;
135 struct FlatFileEntry *entry;
137
138 if (GNUNET_OK !=
140 "namestore-flat",
141 "FILENAME",
142 &flatdbfile))
143 {
145 "namestore-flat",
146 "FILENAME");
147 return GNUNET_SYSERR;
148 }
149 if (GNUNET_OK !=
150 GNUNET_DISK_file_test (flatdbfile))
151 {
152 if (GNUNET_OK !=
154 {
155 GNUNET_break (0);
156 GNUNET_free (flatdbfile);
157 return GNUNET_SYSERR;
158 }
159 }
160 /* flatdbfile should be UTF-8-encoded. If it isn't, it's a bug */
161 plugin->fn = flatdbfile;
162
163 /* Load data from file into hashmap */
165 GNUNET_NO);
166 fh = GNUNET_DISK_file_open (flatdbfile,
171 if (NULL == fh)
172 {
174 _ ("Unable to initialize file: %s.\n"),
175 flatdbfile);
176 return GNUNET_SYSERR;
177 }
178 if (GNUNET_SYSERR ==
179 GNUNET_DISK_file_size (flatdbfile,
180 &size,
182 GNUNET_YES))
183 {
185 _ ("Unable to get filesize: %s.\n"),
186 flatdbfile);
188 return GNUNET_SYSERR;
189 }
190 if (size > SIZE_MAX)
191 {
193 _ ("File too big to map: %llu bytes.\n"),
194 (unsigned long long) size);
196 return GNUNET_SYSERR;
197 }
198 if (0 == size)
199 {
201 return GNUNET_OK;
202 }
203 buffer = GNUNET_DISK_file_map (fh,
204 &mh,
206 size);
207 if (NULL == buffer)
208 {
210 "mmap");
212 return GNUNET_SYSERR;
213 }
214 if ('\0' != buffer[size - 1])
215 {
217 _ ("Namestore database file `%s' malformed\n"),
218 flatdbfile);
221 return GNUNET_SYSERR;
222 }
223
224 line = strtok (buffer, "\n");
225 while (NULL != line)
226 {
227 zone_private_key = strtok (line, ",");
228 if (NULL == zone_private_key)
229 break;
230 rvalue = strtok (NULL, ",");
231 if (NULL == rvalue)
232 break;
233 record_count = strtok (NULL, ",");
234 if (NULL == record_count)
235 break;
236 record_data_b64 = strtok (NULL, ",");
237 if (NULL == record_data_b64)
238 break;
239 label = strtok (NULL, ",");
240 if (NULL == label)
241 break;
242 line = strtok (NULL, "\n");
243 entry = GNUNET_new (struct FlatFileEntry);
244 {
245 unsigned long long ll;
246
247 if (1 != sscanf (rvalue,
248 "%llu",
249 &ll))
250 {
252 "Error parsing entry\n");
253 GNUNET_free (entry);
254 break;
255 }
256 entry->rvalue = (uint64_t) ll;
257 }
258 {
259 unsigned int ui;
260
261 if (1 != sscanf (record_count,
262 "%u",
263 &ui))
264 {
266 "Error parsing entry\n");
267 GNUNET_free (entry);
268 break;
269 }
270 entry->record_count = (uint32_t) ui;
271 }
272 entry->label = GNUNET_strdup (label);
273 record_data_size
274 = GNUNET_STRINGS_base64_decode (record_data_b64,
275 strlen (record_data_b64),
276 (void **) &record_data);
277 entry->record_data =
279 struct GNUNET_GNSRECORD_Data);
280 if (GNUNET_OK !=
281 GNUNET_GNSRECORD_records_deserialize (record_data_size,
282 record_data,
283 entry->record_count,
284 entry->record_data))
285 {
287 "Unable to deserialize record %s\n",
288 label);
289 GNUNET_free (entry->label);
290 GNUNET_free (entry);
291 GNUNET_free (record_data);
292 break;
293 }
294 GNUNET_free (record_data);
295
296 {
297 struct GNUNET_CRYPTO_BlindablePrivateKey *private_key;
298
299 GNUNET_STRINGS_base64_decode (zone_private_key,
300 strlen (zone_private_key),
301 (void **) &private_key);
302 entry->private_key = *private_key;
303 GNUNET_free (private_key);
304 }
305
307 label,
308 &hkey);
309 if (GNUNET_OK !=
311 &hkey,
312 entry,
314 {
315 GNUNET_free (entry);
316 GNUNET_break (0);
317 }
318 }
321 return GNUNET_OK;
322}
323
324
332static int
334 const struct GNUNET_HashCode *key,
335 void *value)
336{
337 struct GNUNET_DISK_FileHandle *fh = cls;
338 struct FlatFileEntry *entry = value;
339 char *line;
340 char *zone_private_key;
341 char *record_data_b64;
342 ssize_t data_size;
343
344 (void) key;
347 ,
348 &zone_private_key);
350 entry->record_data);
351 if (data_size < 0)
352 {
353 GNUNET_break (0);
354 GNUNET_free (zone_private_key);
355 return GNUNET_SYSERR;
356 }
357 if (data_size >= UINT16_MAX)
358 {
359 GNUNET_break (0);
360 GNUNET_free (zone_private_key);
361 return GNUNET_SYSERR;
362 }
363 {
364 char data[data_size];
365 ssize_t ret;
366
368 entry->record_data,
369 data_size,
370 data);
371 if ((ret < 0) ||
372 (data_size != ret))
373 {
374 GNUNET_break (0);
375 GNUNET_free (zone_private_key);
376 return GNUNET_SYSERR;
377 }
379 data_size,
380 &record_data_b64);
381 }
383 "%s,%llu,%u,%s,%s\n",
384 zone_private_key,
385 (unsigned long long) entry->rvalue,
386 (unsigned int) entry->record_count,
387 record_data_b64,
388 entry->label);
389 GNUNET_free (record_data_b64);
390 GNUNET_free (zone_private_key);
391
393 line,
394 strlen (line));
395
397 GNUNET_free (entry->label);
398 GNUNET_free (entry->record_data);
399 GNUNET_free (entry);
400 return GNUNET_YES;
401}
402
403
409static void
411{
412 struct GNUNET_DISK_FileHandle *fh;
413
420 if (NULL == fh)
421 {
423 _ ("Unable to initialize file: %s.\n"),
424 plugin->fn);
425 return;
426 }
427
430 fh);
432 /* append 0-terminator */
434 "",
435 1);
437}
438
439
451static int
453 const struct
455 const char *label,
456 unsigned int rd_count,
457 const struct GNUNET_GNSRECORD_Data *rd)
458{
459 struct Plugin *plugin = cls;
460 uint64_t rvalue;
461 struct GNUNET_HashCode hkey;
462 struct FlatFileEntry *entry;
463
465 UINT64_MAX);
466 hash_pkey_and_label (zone_key,
467 label,
468 &hkey);
470 &hkey);
471 if (0 == rd_count)
472 {
474 "sqlite",
475 "Record deleted\n");
476 return GNUNET_OK;
477 }
478 entry = GNUNET_new (struct FlatFileEntry);
479 GNUNET_asprintf (&entry->label,
480 label,
481 strlen (label));
482 GNUNET_memcpy (&entry->private_key,
483 zone_key,
484 sizeof(struct GNUNET_CRYPTO_BlindablePrivateKey));
485 entry->rvalue = rvalue;
486 entry->record_count = rd_count;
488 struct GNUNET_GNSRECORD_Data);
489 for (unsigned int i = 0; i < rd_count; i++)
490 {
492 entry->record_data[i].record_type = rd[i].record_type;
493 entry->record_data[i].flags = rd[i].flags;
494 entry->record_data[i].data_size = rd[i].data_size;
495 entry->record_data[i].data = GNUNET_malloc (rd[i].data_size);
496 GNUNET_memcpy ((char *) entry->record_data[i].data,
497 rd[i].data,
498 rd[i].data_size);
499 }
501 &hkey,
502 entry,
504}
505
506
517static int
520 zone,
521 const char *label,
523 void *iter_cls)
524{
525 struct Plugin *plugin = cls;
526 struct FlatFileEntry *entry;
527 struct GNUNET_HashCode hkey;
528
529 if (NULL == zone)
530 {
531 GNUNET_break (0);
532 return GNUNET_SYSERR;
533 }
535 label,
536 &hkey);
538 &hkey);
539
540 if (NULL == entry)
541 return GNUNET_NO;
542 if (NULL != iter)
543 iter (iter_cls,
544 1, /* zero is illegal */
545 &entry->private_key,
546 entry->label,
547 entry->record_count,
548 entry->record_data);
549 return GNUNET_YES;
550}
551
552
557{
561 uint64_t offset;
562
566 uint64_t limit;
567
572 uint64_t pos;
573
578
583
587 void *iter_cls;
588};
589
590
599static int
600iterate_zones (void *cls,
601 const struct GNUNET_HashCode *key,
602 void *value)
603{
604 struct IterateContext *ic = cls;
605 struct FlatFileEntry *entry = value;
606
607 (void) key;
608 if (0 == ic->limit)
609 return GNUNET_NO;
610 if ((NULL != ic->zone) &&
611 (0 != GNUNET_memcmp (&entry->private_key,
612 ic->zone)))
613 return GNUNET_YES;
614 ic->pos++;
615 if (ic->offset > 0)
616 {
617 ic->offset--;
618 return GNUNET_YES;
619 }
620 ic->iter (ic->iter_cls,
621 ic->pos,
622 (NULL == ic->zone)
623 ? &entry->private_key
624 : ic->zone,
625 entry->label,
626 entry->record_count,
627 entry->record_data);
628 ic->limit--;
629 if (0 == ic->limit)
630 return GNUNET_NO;
631 return GNUNET_YES;
632}
633
634
647static int
649 const struct
651 uint64_t serial,
652 uint64_t limit,
654 void *iter_cls)
655{
656 struct Plugin *plugin = cls;
657 struct IterateContext ic;
658
659 ic.offset = serial;
660 ic.pos = 0;
661 ic.limit = limit;
662 ic.iter = iter;
663 ic.iter_cls = iter_cls;
664 ic.zone = zone;
667 &ic);
668 return (0 == ic.limit) ? GNUNET_OK : GNUNET_NO;
669}
670
671
684
685
686static int
687zone_to_name (void *cls,
688 const struct GNUNET_HashCode *key,
689 void *value)
690{
691 struct ZoneToNameContext *ztn = cls;
692 struct FlatFileEntry *entry = value;
693
694 (void) key;
695 if (0 != GNUNET_memcmp (&entry->private_key,
696 ztn->zone))
697 return GNUNET_YES;
698
699 for (unsigned int i = 0; i < entry->record_count; i++)
700 {
701 if (GNUNET_NO ==
703 continue;
704 if (ztn->value_zone->type != entry->record_data[i].record_type)
705 continue;
706 if (0 == memcmp (ztn->value_zone,
707 entry->record_data[i].data,
708 entry->record_data[i].data_size))
709 {
710 ztn->iter (ztn->iter_cls,
711 i + 1, /* zero is illegal! */
712 &entry->private_key,
713 entry->label,
714 entry->record_count,
715 entry->record_data);
717 }
718 }
719 return GNUNET_YES;
720}
721
722
734static int
737 zone,
738 const struct
741 void *iter_cls)
742{
743 struct Plugin *plugin = cls;
744 struct ZoneToNameContext ztn = {
745 .iter = iter,
746 .iter_cls = iter_cls,
747 .zone = zone,
748 .value_zone = value_zone,
749 .result_found = GNUNET_NO
750 };
751
753 "Performing reverse lookup for `%s'\n",
757 &ztn);
758 return ztn.result_found;
759}
760
761
768void *
770{
771 static struct Plugin plugin;
772 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
774
775 if (NULL != plugin.cfg)
776 return NULL; /* can only initialize once! */
777 memset (&plugin,
778 0,
779 sizeof(struct Plugin));
780 plugin.cfg = cfg;
782 {
784 return NULL;
785 }
787 api->cls = &plugin;
793 _ ("Flat file database running\n"));
794 return api;
795}
796
797
804void *
806{
808 struct Plugin *plugin = api->cls;
809
811 plugin->cfg = NULL;
814 "Flat file plugin is finished\n");
815 return NULL;
816}
817
818
819/* end of plugin_namestore_flat.c */
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition gnunet-arm.c:98
static int ret
Final status code.
Definition gnunet-arm.c:93
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition gnunet-arm.c:108
static struct GNUNET_CADET_Handle * mh
Cadet handle.
static struct GNUNET_TESTING_PluginFunctions * plugin
Plugin to dynamically load a test case.
static char * line
Desired phone line (string to be converted to a hash).
static uint64_t record_count
Record count.
static char * data
The data to insert into the dht.
struct GNUNET_HashCode key
The key used in the DHT.
static char * pkey
Public key of the zone to look in, in ASCII.
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 char * value
Value of the record to add/remove.
static size_t data_size
Number of bytes in data.
API that can be used to manipulate GNS record data.
Plugin API for the namestore database backend.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Generate a random unsigned 64-bit value.
@ GNUNET_CRYPTO_QUALITY_WEAK
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
Definition disk.c:1258
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory).
Definition disk.c:533
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition disk.c:710
enum GNUNET_GenericReturnValue GNUNET_DISK_file_size(const char *filename, uint64_t *size, int include_symbolic_links, int single_file_mode)
Get the size of the file (or directory) of the given file (in bytes).
Definition disk.c:235
enum GNUNET_GenericReturnValue GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
Definition disk.c:1332
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create_for_file(const char *filename)
Create the directory structure for storing a file.
Definition disk.c:633
void * GNUNET_DISK_file_map(const struct GNUNET_DISK_FileHandle *h, struct GNUNET_DISK_MapHandle **m, enum GNUNET_DISK_MapType access, size_t len)
Map a file into memory.
Definition disk.c:1404
enum GNUNET_GenericReturnValue GNUNET_DISK_file_unmap(struct GNUNET_DISK_MapHandle *h)
Unmap a file.
Definition disk.c:1435
@ GNUNET_DISK_OPEN_TRUNCATE
Truncate file if it exists.
@ GNUNET_DISK_OPEN_CREATE
Create file if it doesn't exist.
@ GNUNET_DISK_OPEN_READWRITE
Open the file for both reading and writing.
@ GNUNET_DISK_PERM_USER_READ
Owner can read.
@ GNUNET_DISK_PERM_USER_WRITE
Owner can write.
@ GNUNET_DISK_MAP_TYPE_READ
Read-only memory map.
int GNUNET_GNSRECORD_records_deserialize(size_t len, const char *src, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *dest)
Deserialize the given records to the given destination.
ssize_t GNUNET_GNSRECORD_records_serialize(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, size_t dest_size, char *dest)
Serialize the given records to the given destination buffer.
const char * GNUNET_GNSRECORD_z2s(const struct GNUNET_CRYPTO_BlindablePublicKey *z)
Convert a zone to a string (for printing debug messages).
ssize_t GNUNET_GNSRECORD_records_get_size(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Calculate how many bytes we will need to serialize the given records.
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_is_zonekey_type(uint32_t type)
Check if this type is one of the supported GNS zone types.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition crypto_hash.c:41
int GNUNET_CONTAINER_multihashmap_remove_all(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Remove all entries for the given key from the map.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
#define GNUNET_log(kind,...)
#define GNUNET_log_from(kind, comp,...)
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
@ GNUNET_ERROR_TYPE_INFO
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
void(* GNUNET_NAMESTORE_RecordIterator)(void *cls, uint64_t serial, const char *editor_hint, const struct GNUNET_CRYPTO_BlindablePrivateKey *private_key, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Function called for each matching record.
size_t GNUNET_STRINGS_base64_decode(const char *data, size_t len, void **output)
Decode from Base64.
Definition strings.c:1720
size_t GNUNET_STRINGS_base64_encode(const void *in, size_t len, char **output)
Encode into Base64.
Definition strings.c:1618
static unsigned int size
Size of the "table".
Definition peer.c:68
#define _(String)
GNU gettext support macro.
Definition platform.h:179
#define SIZE_MAX
Definition platform.h:209
static int namestore_flat_zone_to_name(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const struct GNUNET_CRYPTO_BlindablePublicKey *value_zone, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
Look for an existing PKEY delegation record for a given public key.
static int store_and_free_entries(void *cls, const struct GNUNET_HashCode *key, void *value)
Store values in hashmap in file and free data.
void * libgnunet_plugin_namestore_flat_init(void *cls)
Entry point for the plugin.
static int namestore_flat_store_records(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone_key, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Store a record in the datastore.
static void database_shutdown(struct Plugin *plugin)
Shutdown database connection and associate data structures.
static int zone_to_name(void *cls, const struct GNUNET_HashCode *key, void *value)
static int namestore_flat_lookup_records(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
Lookup records in the datastore for which we are the authority.
static int iterate_zones(void *cls, const struct GNUNET_HashCode *key, void *value)
Helper function for namestore_flat_iterate_records().
static int database_setup(struct Plugin *plugin)
Initialize the database connections and associated data structures (create tables and indices as need...
static int namestore_flat_iterate_records(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, uint64_t serial, uint64_t limit, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
Iterate over the results for a particular key and zone in the datastore.
static void hash_pkey_and_label(const struct GNUNET_CRYPTO_BlindablePrivateKey *pkey, const char *label, struct GNUNET_HashCode *h)
Hash contactenation of pkey and label into h.
void * libgnunet_plugin_namestore_flat_done(void *cls)
Exit point from the plugin.
struct GNUNET_CRYPTO_BlindablePrivateKey private_key
Entry zone.
uint64_t rvalue
Rvalue.
uint32_t record_count
Record count.
struct GNUNET_GNSRECORD_Data * record_data
Record data.
void * cls
Closure for all of the callbacks.
Internal representation of the hash map.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
uint32_t type
Type of public key.
Handle used to access files (and pipes).
Handle for a memory-mapping operation.
Definition disk.c:1385
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.
size_t data_size
Number of bytes in data.
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
uint64_t expiration_time
Expiration time for the DNS record.
A 512-bit hashcode.
struct returned by the initialization function of the plugin
enum GNUNET_GenericReturnValue(* lookup_records)(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
Lookup records in the datastore for which we are the authority.
enum GNUNET_GenericReturnValue(* zone_to_name)(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const struct GNUNET_CRYPTO_BlindablePublicKey *value_zone, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
Look for an existing PKEY delegation record for a given public key.
enum GNUNET_GenericReturnValue(* store_records)(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Store a record in the datastore for which we are the authority.
void * cls
Closure to pass to all plugin functions.
enum GNUNET_GenericReturnValue(* iterate_records)(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, uint64_t serial, uint64_t limit, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
Iterate over the results for a particular zone in the datastore.
Closure for iterate_zones.
void * iter_cls
Closure for iter.
uint64_t pos
What is the position of the current entry, counting starts from 1.
const struct GNUNET_CRYPTO_BlindablePrivateKey * zone
Target zone.
uint64_t offset
How many more records should we skip before returning results?
GNUNET_NAMESTORE_RecordIterator iter
Function to call on each record.
uint64_t limit
How many more records should we return?
Handle for a plugin.
Definition block.c:38
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition block.c:47
struct GNUNET_CONTAINER_MultiHashMap * hm
HashMap.
char * fn
Filename used for the DB.
const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Closure for zone_to_name.
GNUNET_NAMESTORE_RecordIterator iter
const struct GNUNET_CRYPTO_BlindablePublicKey * value_zone
const struct GNUNET_CRYPTO_BlindablePrivateKey * zone