GNUnet 0.25.0
 
Loading...
Searching...
No Matches
gnunet-namestore-zonefile.c File Reference
#include "platform.h"
#include <gnunet_util_lib.h>
#include <gnunet_namestore_plugin.h>
Include dependency graph for gnunet-namestore-zonefile.c:

Go to the source code of this file.

Data Structures

struct  Zone
 Egos / Zones. More...
 
struct  MissingZoneCreationCtx
 Missing identity creation context. More...
 
struct  Job
 Request we should make. More...
 

Macros

#define MAX_RECORDS_PER_NAME   50
 
#define MAX_ZONEFILE_LINE_LEN   4096
 Maximum length of a zonefile line.
 
#define MAX_ZONEFILE_RECORD_DATA_LEN   2048
 FIXME: Soft limit this?
 
#define THRESH   100
 Maximum number of queries pending at the same time.
 
#define TIME_THRESH   10
 TIME_THRESH is in usecs.
 
#define SERIES_DELAY    GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, 10)
 How long do we wait at least between series of requests?
 

Enumerations

enum  ZonefileImportState { ZS_READY , ZS_ORIGIN_SET , ZS_ORIGIN_CHANGED , ZS_NAME_CHANGED }
 

Functions

static void do_shutdown (void *cls)
 Task run on shutdown.
 
static void parse (void *cls)
 Main function that will be run.
 
static char * trim (char *line)
 
static char * next_token (char *token)
 
static int parse_ttl (char *token, struct GNUNET_TIME_Relative *pttl)
 
static int parse_origin (char *token, char *porigin)
 
static void origin_create_cb (void *cls, const struct GNUNET_CRYPTO_PrivateKey *pk, enum GNUNET_ErrorCode ec)
 
static void ensure_ego_and_continue (const char *ego_name)
 
static void add_continuation (void *cls, enum GNUNET_ErrorCode ec)
 
static void process_queue (void *cls)
 Process as many requests as possible from the queue.
 
static void insert_sorted (struct Job *job)
 Insert req into DLL sorted by next fetch time.
 
static void queue (const char *label, uint32_t rd_count, struct GNUNET_GNSRECORD_Data *rd, const struct Zone *zone)
 Add hostname to the list of requests to be made.
 
static void identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *_cfg)
 
int main (int argc, char *const *argv)
 The main function for gnunet-namestore-dbtool.
 

Variables

static struct GNUNET_CONTAINER_Heapreq_heap
 Heap of all requests to perform, sorted by the time we should next do the request (i.e.
 
static struct Jobreq_head
 Active requests are kept in a DLL.
 
static struct Jobreq_tail
 Active requests are kept in a DLL.
 
static struct Zonezone_head
 Head of list of zones we are managing.
 
static struct Zonezone_tail
 Tail of list of zones we are managing.
 
static struct GNUNET_GNSRECORD_Data rd [50]
 The record data under a single label.
 
static struct GNUNET_TIME_Relative ttl
 Current record $TTL to use.
 
static char origin [GNUNET_DNSPARSER_MAX_NAME_LENGTH]
 Current origin.
 
static unsigned int rd_count = 0
 Number of records for currently parsed set.
 
static int ret = 0
 Return code.
 
static char * ego_name = NULL
 Name of the ego.
 
static char * res
 Currently read line or NULL on EOF.
 
static unsigned int published_sets = 0
 Statistics, how many published record sets.
 
static unsigned int published_records = 0
 Statistics, how many records published in aggregate.
 
static struct Zonecurrent_zone
 Private key for the our zone.
 
static struct GNUNET_NAMESTORE_QueueEntryns_qe
 Queue entry for the 'add' operation.
 
static struct GNUNET_NAMESTORE_Handlens
 Handle to the namestore.
 
static struct GNUNET_IDENTITY_Operationid_op
 Origin create operations.
 
static struct GNUNET_IDENTITY_Handleid
 Handle to IDENTITY.
 
static const struct GNUNET_CONFIGURATION_Handlecfg
 Current configurataion.
 
static struct GNUNET_SCHEDULER_Taskt
 Main task.
 
static unsigned int pending
 The number of DNS queries that are outstanding.
 
static unsigned int pending_rs
 The number of NAMESTORE record store operations that are outstanding.
 
static int state
 The current state of the parser.
 
static struct GNUNET_TIME_Absolute sleep_time_reg_proc
 Last time we worked before going idle.
 

Macro Definition Documentation

◆ MAX_RECORDS_PER_NAME

#define MAX_RECORDS_PER_NAME   50

Definition at line 44 of file gnunet-namestore-zonefile.c.

◆ MAX_ZONEFILE_LINE_LEN

#define MAX_ZONEFILE_LINE_LEN   4096

Maximum length of a zonefile line.

Definition at line 49 of file gnunet-namestore-zonefile.c.

◆ MAX_ZONEFILE_RECORD_DATA_LEN

#define MAX_ZONEFILE_RECORD_DATA_LEN   2048

FIXME: Soft limit this?

Definition at line 54 of file gnunet-namestore-zonefile.c.

◆ THRESH

#define THRESH   100

Maximum number of queries pending at the same time.

Definition at line 59 of file gnunet-namestore-zonefile.c.

◆ TIME_THRESH

#define TIME_THRESH   10

TIME_THRESH is in usecs.

How quickly do we submit fresh queries. Used as an additional throttle.

Definition at line 65 of file gnunet-namestore-zonefile.c.

◆ SERIES_DELAY

How long do we wait at least between series of requests?

Definition at line 70 of file gnunet-namestore-zonefile.c.

76{
80 struct Zone *next;
81
85 struct Zone *prev;
86
90 char *domain;
91
96};
97
102{
103 // DLL
105
106 // DLL
108
109 // Operation
111
112 // NS Operation
114
115 // Request
116 struct Job *job;
117
118 // Name
119 char *name;
120};
121
127struct Job
128{
133
137 struct Job *next;
138
142 struct Job *prev;
143
148 struct Record *rec_head;
149
154 struct Record *rec_tail;
155
160
165
169 const struct Zone *zone;
170
177
185
186 // Records to store in job
188
189 // Number of records to store in job
190 uint32_t rd_count;
191};
192
197static struct GNUNET_CONTAINER_Heap *req_heap;
198
202static struct Job *req_head;
203
207static struct Job *req_tail;
208
209
213static struct Zone *zone_head;
214
218static struct Zone *zone_tail;
219
220
226
230static struct GNUNET_TIME_Relative ttl;
231
236
240static unsigned int rd_count = 0;
241
245static int ret = 0;
246
250static char *ego_name = NULL;
251
255static char *res;
256
260static unsigned int published_sets = 0;
261
265static unsigned int published_records = 0;
266
267
271static struct Zone *current_zone;
272
277
281static struct GNUNET_NAMESTORE_Handle *ns;
282
286static struct GNUNET_IDENTITY_Operation *id_op;
287
291static struct GNUNET_IDENTITY_Handle *id;
292
296static const struct GNUNET_CONFIGURATION_Handle *cfg;
297
301static struct GNUNET_SCHEDULER_Task *t;
302
306static unsigned int pending;
307
311static unsigned int pending_rs;
312
313
317static int state;
318
323
325{
326
327 /* Uninitialized */
328 ZS_READY,
329
330 /* The initial state */
332
333 /* The $ORIGIN has changed */
335
336 /* The record name/label has changed */
338
339};
340
341
347static void
348do_shutdown (void *cls)
349{
350 (void) cls;
351 if (NULL != ego_name)
353 if (NULL != ns_qe)
355 if (NULL != id_op)
357 if (NULL != ns)
359 if (NULL != id)
361 for (int i = 0; i < rd_count; i++)
362 {
363 void *rd_ptr = (void*) rd[i].data;
364 GNUNET_free (rd_ptr);
365 }
366 if (NULL != t)
368}
369
370
371static void
372parse (void *cls);
373
374static char*
375trim (char *line)
376{
377 char *ltrimmed = line;
378 int ltrimmed_len;
379 int quoted = 0;
380
381 // Trim all whitespace to the left
382 while (*ltrimmed == ' ')
383 ltrimmed++;
384 ltrimmed_len = strlen (ltrimmed);
385 // Find the first occurrence of an unqoted ';', which is our comment
386 for (int i = 0; i < ltrimmed_len; i++)
387 {
388 if (ltrimmed[i] == '"')
389 quoted = ! quoted;
390 if ((ltrimmed[i] != ';') || quoted)
391 continue;
392 ltrimmed[i] = '\0';
393 }
394 ltrimmed_len = strlen (ltrimmed);
395 // Remove trailing whitespace
396 for (int i = ltrimmed_len; i > 0; i--)
397 {
398 if (ltrimmed[i - 1] != ' ')
399 break;
400 ltrimmed[i - 1] = '\0';
401 }
402 ltrimmed_len = strlen (ltrimmed);
403 if (ltrimmed[ltrimmed_len - 1] == '\n')
404 ltrimmed[ltrimmed_len - 1] = ' ';
405 return ltrimmed;
406}
407
408
409static char*
410next_token (char *token)
411{
412 char *next = token;
413 while (*next == ' ')
414 next++;
415 return next;
416}
417
418
419static int
420parse_ttl (char *token, struct GNUNET_TIME_Relative *pttl)
421{
422 char *next;
423 unsigned int ttl_tmp;
424
425 next = strchr (token, ';');
426 if (NULL != next)
427 next[0] = '\0';
428 next = strchr (token, ' ');
429 if (NULL != next)
430 next[0] = '\0';
431 if (1 != sscanf (token, "%u", &ttl_tmp))
432 {
433 fprintf (stderr, "Unable to parse TTL `%s'\n", token);
434 return GNUNET_SYSERR;
435 }
436 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TTL is: %u\n", ttl_tmp);
437 pttl->rel_value_us = ttl_tmp * 1000 * 1000;
438 return GNUNET_OK;
439}
440
441
442static int
443parse_origin (char *token, char *porigin)
444{
445 char *next;
446 next = strchr (token, ';');
447 if (NULL != next)
448 next[0] = '\0';
449 next = strchr (token, ' ');
450 if (NULL != next)
451 next[0] = '\0';
452 strcpy (porigin, token);
453 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Origin is: %s\n", porigin);
454 return GNUNET_OK;
455}
456
457
458static void
459origin_create_cb (void *cls,
460 const struct GNUNET_CRYPTO_PrivateKey *pk,
461 enum GNUNET_ErrorCode ec)
462{
463 struct Zone *zone;
464 id_op = NULL;
465 if (GNUNET_EC_NONE != ec)
466 {
467 fprintf (stderr, "Error: %s\n", GNUNET_ErrorCode_get_hint (ec));
468 ret = 1;
470 return;
471 }
473 "Created missing ego `%s'\n",
474 ego_name);
475 zone = GNUNET_new (struct Zone);
476 zone->key = *pk;
477 zone->domain = GNUNET_strdup (ego_name);
479 // FIXME add delegation to parent zone
481 current_zone = zone;
483}
484
485
486static void
488{
489 struct Zone *zone;
490 for (zone = zone_head; NULL != zone; zone = zone->next)
491 if (0 == strcmp (zone->domain, ego_name))
492 break;
493 if (NULL == zone)
494 {
496 "$ORIGIN %s does not exist, creating...\n", ego_name);
498 GNUNET_PUBLIC_KEY_TYPE_EDDSA, // FIXME make configurable
500 NULL);
501 return;
502 }
504 current_zone = zone;
506}
507
508
509static void
510add_continuation (void *cls, enum GNUNET_ErrorCode ec)
511{
512 ns_qe = NULL;
513 if (GNUNET_EC_NONE != ec)
514 {
515 fprintf (stderr,
516 _ ("Failed to store records...\n"));
518 ret = -1;
519 }
521 {
522 if (NULL != ego_name)
525 if (ego_name[strlen (ego_name) - 1] == '.')
526 ego_name[strlen (ego_name) - 1] = '\0';
528 "Changing origin to %s\n", ego_name);
530 return;
531 }
533}
534
535
541static void
542process_queue (void *cls)
543{
544 struct Job *job;
545
546 (void) cls;
547 t = NULL;
548 while (pending + pending_rs < THRESH)
549 {
551 if (NULL == job)
552 break;
553 if (NULL != job->qe)
554 return; /* namestore op still pending */
556 break;
558 job->hn = NULL;
561 "Requesting store for `%s'\n",
562 job->label);
563 job->op_start_time = GNUNET_TIME_absolute_get ();
565 &job->zone->key,
566 job->label,
567 job->rd_count,
568 job->rd,
570 job);
571 GNUNET_assert (NULL != job->qe);
572 pending++;
573 }
574 if (pending + pending_rs >= THRESH)
575 {
577 "Stopped processing queue (%u+%u/%u)]\n",
578 pending,
580 THRESH);
581 return; /* wait for replies */
582 }
584 if (NULL == job)
585 {
587 "Stopped processing queue: empty queue\n");
588 return;
589 }
590 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Throttling\n");
591 if (NULL != t)
595}
596
597
603static void
604insert_sorted (struct Job *job)
605{
606 job->hn =
607 GNUNET_CONTAINER_heap_insert (req_heap, job, job->expires.abs_value_us);
608}
609
610
616static void
617queue (const char *label,
618 uint32_t rd_count,
620 const struct Zone *zone)
621{
622 struct Job *job;
623 struct GNUNET_HashContext *hctx;
624 struct GNUNET_HashCode hc;
625 size_t hlen;
626
627 hlen = strlen (label) + 1;
628 job = GNUNET_new (struct Job);
629 job->rd = rd;
630 job->rd_count = rd_count;
631 GNUNET_assert (NULL != zone);
632 job->zone = zone;
633 GNUNET_memcpy (job->label, label, hlen);
635 GNUNET_CRYPTO_hash_context_read (hctx, job->label, hlen);
636 GNUNET_CRYPTO_hash_context_read (hctx, job->zone, sizeof *zone);
639}
640
641
658static void
659parse (void *cls)
660{
661 char buf[MAX_ZONEFILE_LINE_LEN];
663 char *next;
664 char *token;
665 char *payload_pos;
666 static char lastname[GNUNET_DNSPARSER_MAX_LABEL_LENGTH];
668 void *data;
669 size_t data_size;
670 int ttl_line = 0;
671 int type;
672 int bracket_unclosed = 0;
673 int quoted = 0;
674 int ln = 0;
675
676 t = NULL;
677 /* use filename provided as 1st argument (stdin by default) */
678 while ((res = fgets (buf, sizeof(buf), stdin))) /* read each line of input */
679 {
680 ln++;
681 ttl_line = 0;
682 token = trim (buf);
684 "Trimmed line (bracket %s): `%s'\n",
685 (bracket_unclosed > 0) ? "unclosed" : "closed",
686 token);
687 if ((0 == strlen (token)) ||
688 ((1 == strlen (token)) && (' ' == *token)))
689 continue; // I guess we can safely ignore blank lines
690 if (bracket_unclosed == 0)
691 {
692 /* Payload is already parsed */
693 payload_pos = payload;
694 /* Find space */
695 next = strchr (token, ' ');
696 if (NULL == next)
697 {
698 fprintf (stderr, "Error at line %u: %s\n", ln, token);
699 ret = 1;
701 return;
702 }
703 next[0] = '\0';
704 next++;
705 if (0 == (strcmp (token, "$ORIGIN")))
706 {
708 token = next_token (next);
709 }
710 else if (0 == (strcmp (token, "$TTL")))
711 {
712 ttl_line = 1;
713 token = next_token (next);
714 }
715 else
716 {
717 if (0 == strcmp (token, "IN")) // Inherit name from before
718 {
720 "Old name: %s\n", lastname);
721 strcpy (newname, lastname);
722 token[strlen (token)] = ' ';
723 }
724 else if (token[strlen (token) - 1] != '.') // no fqdn
725 {
726 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New name: %s\n", token);
727 if (GNUNET_DNSPARSER_MAX_LABEL_LENGTH < strlen (token))
728 {
729 fprintf (stderr,
730 _ ("Name `%s' is too long\n"),
731 token);
732 ret = 1;
734 return;
735 }
736 strcpy (newname, token);
737 token = next_token (next);
738 }
739 else if (0 == strcmp (token, origin))
740 {
741 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New name: @\n");
742 strcpy (newname, "@");
743 token = next_token (next);
744 }
745 else
746 {
747 if (strlen (token) < strlen (origin))
748 {
749 fprintf (stderr, "Wrong origin: %s (expected %s)\n", token, origin);
750 break; // FIXME error?
751 }
752 if (0 != strcmp (token + (strlen (token) - strlen (origin)), origin))
753 {
754 fprintf (stderr, "Wrong origin: %s (expected %s)\n", token, origin);
755 break;
756 }
757 token[strlen (token) - strlen (origin) - 1] = '\0';
758 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New name: %s\n", token);
759 if (GNUNET_DNSPARSER_MAX_LABEL_LENGTH < strlen (token))
760 {
761 fprintf (stderr,
762 _ ("Name `%s' is too long\n"),
763 token);
764 ret = 1;
766 return;
767 }
768 strcpy (newname, token);
769 token = next_token (next);
770 }
771 if (0 != strcmp (newname, lastname) &&
772 (0 < rd_count))
773 {
775 "Name changed %s->%s, storing record set of %u elements\n",
776 lastname, newname,
777 rd_count);
779 }
780 else
781 {
782 strcpy (lastname, newname);
783 }
784 }
785
786 if (ttl_line)
787 {
788 if (GNUNET_SYSERR == parse_ttl (token, &ttl))
789 {
790 fprintf (stderr, _ ("Failed to parse $TTL\n"));
791 ret = 1;
793 return;
794 }
795 continue;
796 }
798 {
799 if (GNUNET_SYSERR == parse_origin (token, origin))
800 {
801 fprintf (stderr, _ ("Failed to parse $ORIGIN from %s\n"), token);
802 ret = 1;
804 return;
805 }
806 break;
807 }
808 if (ZS_READY == state)
809 {
810 fprintf (stderr,
811 _ (
812 "You must provide $ORIGIN in your zonefile or via arguments (--zone)!\n"));
813 ret = 1;
815 return;
816 }
817 // This is a record, let's go
819 {
820 fprintf (stderr,
821 _ ("Only %u records per unique name supported.\n"),
823 ret = 1;
825 return;
826 }
829 next = strchr (token, ' ');
830 if (NULL == next)
831 {
832 fprintf (stderr, "Error, last token: %s\n", token);
833 ret = 1;
835 break;
836 }
837 next[0] = '\0';
838 next++;
839 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "class is: %s\n", token);
840 while (*next == ' ')
841 next++;
842 token = next;
843 next = strchr (token, ' ');
844 if (NULL == next)
845 {
846 fprintf (stderr, "Error\n");
847 break;
848 }
849 next[0] = '\0';
850 next++;
851 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "type is: %s\n", token);
854 while (*next == ' ')
855 next++;
856 token = next;
857 }
858 for (int i = 0; i < strlen (token); i++)
859 {
860 if (token[i] == '"')
861 quoted = ! quoted;
862 if ((token[i] == '(') && ! quoted)
863 bracket_unclosed++;
864 if ((token[i] == ')') && ! quoted)
865 bracket_unclosed--;
866 }
867 GNUNET_assert (strlen (token) < sizeof payload - (payload_pos - payload));
868 memcpy (payload_pos, token, strlen (token));
869 payload_pos += strlen (token);
870 if (bracket_unclosed > 0)
871 {
872 *payload_pos = ' ';
873 payload_pos++;
874 continue;
875 }
876 *payload_pos = '\0';
877 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "data is: %s\n\n", payload);
878 if (GNUNET_OK !=
880 &data,
881 &data_size))
882 {
883 fprintf (stderr,
884 _ ("Data `%s' invalid\n"),
885 payload);
886 ret = 1;
888 return;
889 }
890 rd[rd_count].data = data;
892 if (ZS_NAME_CHANGED == state)
893 break;
894 rd_count++;
895 }
896 if (rd_count > 0)
897 {
898 // We need to encode the lastname from punycode potentially.
899 // FIXME we want to probably queue this request here.
900 char *lastname_utf8;
901 idna_to_unicode_8z8z (lastname,
902 &lastname_utf8,
903 IDNA_ALLOW_UNASSIGNED);
905 "Queueing %d records\n",
906 rd_count);
907 queue (lastname_utf8,
908 rd_count,
909 rd,
913 for (int i = 0; i < rd_count; i++)
914 {
915 data = (void*) rd[i].data;
917 }
918 if (ZS_NAME_CHANGED == state)
919 {
920 rd[0] = rd[rd_count]; // recover last rd parsed.
921 rd_count = 1;
922 strcpy (lastname, newname);
924 }
925 else
926 rd_count = 0;
928 {
929 if (NULL != ego_name)
932 if (ego_name[strlen (ego_name) - 1] == '.')
933 ego_name[strlen (ego_name) - 1] = '\0';
935 "Changing origin to %s\n", ego_name);
937 return;
938 }
939 if (NULL != t)
942 return;
943 }
945 {
946 if (NULL != ego_name)
949 if (ego_name[strlen (ego_name) - 1] == '.')
950 ego_name[strlen (ego_name) - 1] = '\0';
952 "Changing origin to %s\n", ego_name);
954 return;
955 }
958 printf ("Published %u records sets with total %u records\n",
961}
962
963
964static void
965identity_cb (void *cls,
966 struct GNUNET_IDENTITY_Ego *ego,
967 void **ctx,
968 const char *name)
969{
970 (void) cls;
971 (void) ctx;
972 static int initial_iteration = GNUNET_YES;
973 static int ego_zone_found = GNUNET_NO;
974
975 if (GNUNET_NO == initial_iteration)
976 return;
977 if (NULL == ego)
978 {
979 if (NULL == zone_head)
980 {
981 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No zones found\n");
982 ret = 1;
984 return;
985 }
986 if ((NULL != ego_name) &&
987 (GNUNET_NO == ego_zone_found))
988 {
990 "Zone `%s' not found\n",
991 ego_name);
992 ret = 2;
994 }
995 initial_iteration = GNUNET_NO;
997 return;
998 }
999 if (NULL != name)
1000 {
1001 struct Zone *zone;
1002
1003 zone = GNUNET_new (struct Zone);
1005 zone->domain = GNUNET_strdup (name);
1007
1008 if ((NULL != ego_name) &&
1009 (0 == strcmp (name,
1010 ego_name)))
1011 {
1012 ego_zone_found = GNUNET_YES;
1013 sprintf (origin, "%s.", ego_name);
1015 }
1016 }
1017}
1018
1019
1020static void
1021run (void *cls,
1022 char *const *args,
1023 const char *cfgfile,
1024 const struct GNUNET_CONFIGURATION_Handle *_cfg)
1025{
1026 cfg = _cfg;
1030 if (NULL == ns)
1031 {
1032 fprintf (stderr,
1033 _ ("Failed to connect to NAMESTORE\n"));
1034 return;
1035 }
1037 if (NULL == id)
1038 {
1039 fprintf (stderr,
1040 _ ("Failed to connect to IDENTITY\n"));
1041 return;
1042 }
1043 state = ZS_READY;
1044}
1045
1046
1054int
1055main (int argc, char *const *argv)
1056{
1059 "zone",
1060 "EGO",
1061 gettext_noop (
1062 "name of the ego controlling the zone"),
1063 &ego_name),
1065 };
1066 int lret;
1067
1068 GNUNET_log_setup ("gnunet-namestore-dbtool", "WARNING", NULL);
1069 if (GNUNET_OK !=
1071 argc,
1072 argv,
1073 "gnunet-namestore-zonefile",
1074 _ (
1075 "GNUnet namestore database manipulation tool"),
1076 options,
1077 &run,
1078 NULL)))
1079 {
1080 return lret;
1081 }
1082 return ret;
1083}
struct GNUNET_GETOPT_CommandLineOption options[]
Definition 002.c:5
int main()
Program to simulate results from GCP_get_desirability_of_path() for various plausible inputs.
#define gettext_noop(String)
Definition gettext.h:74
static int do_shutdown
Set to GNUNET_YES if we are shutting down.
static struct GNUNET_SCHEDULER_Task * job
Task for main job.
static char * line
Desired phone line (string to be converted to a hash).
static char * data
The data to insert into the dht.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_FS_Handle * ctx
struct GNUNET_CRYPTO_PrivateKey pk
Private key from command line option, or NULL.
static char * name
Name (label) of the records to list.
static struct GNUNET_NAMESTORE_QueueEntry * ns_qe
Queue entry for the 'add' operation.
#define THRESH
Maximum number of queries pending at the same time.
static struct GNUNET_IDENTITY_Operation * id_op
Origin create operations.
static void insert_sorted(struct Job *job)
Insert req into DLL sorted by next fetch time.
static struct Job * req_tail
Active requests are kept in a DLL.
static struct Zone * zone_tail
Tail of list of zones we are managing.
static struct GNUNET_CONTAINER_Heap * req_heap
Heap of all requests to perform, sorted by the time we should next do the request (i....
static void process_queue(void *cls)
Process as many requests as possible from the queue.
static void parse(void *cls)
Main function that will be run.
static unsigned int published_records
Statistics, how many records published in aggregate.
static unsigned int pending
The number of DNS queries that are outstanding.
static void queue(const char *label, uint32_t rd_count, struct GNUNET_GNSRECORD_Data *rd, const struct Zone *zone)
Add hostname to the list of requests to be made.
static void origin_create_cb(void *cls, const struct GNUNET_CRYPTO_PrivateKey *pk, enum GNUNET_ErrorCode ec)
static const struct GNUNET_CONFIGURATION_Handle * cfg
Current configurataion.
static struct GNUNET_TIME_Relative ttl
Current record $TTL to use.
#define MAX_RECORDS_PER_NAME
static struct GNUNET_TIME_Absolute sleep_time_reg_proc
Last time we worked before going idle.
static struct GNUNET_SCHEDULER_Task * t
Main task.
static struct Zone * zone_head
Head of list of zones we are managing.
static int ret
Return code.
static char * ego_name
Name of the ego.
#define MAX_ZONEFILE_LINE_LEN
Maximum length of a zonefile line.
static char origin[GNUNET_DNSPARSER_MAX_NAME_LENGTH]
Current origin.
#define MAX_ZONEFILE_RECORD_DATA_LEN
FIXME: Soft limit this?
static int state
The current state of the parser.
static void add_continuation(void *cls, enum GNUNET_ErrorCode ec)
static unsigned int rd_count
Number of records for currently parsed set.
static int parse_origin(char *token, char *porigin)
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *_cfg)
static struct GNUNET_NAMESTORE_Handle * ns
Handle to the namestore.
static struct Job * req_head
Active requests are kept in a DLL.
static char * res
Currently read line or NULL on EOF.
static struct Zone * current_zone
Private key for the our zone.
static struct GNUNET_IDENTITY_Handle * id
Handle to IDENTITY.
static unsigned int pending_rs
The number of NAMESTORE record store operations that are outstanding.
static char * trim(char *line)
static void identity_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
static void ensure_ego_and_continue(const char *ego_name)
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
static int parse_ttl(char *token, struct GNUNET_TIME_Relative *pttl)
static char * next_token(char *token)
#define SERIES_DELAY
How long do we wait at least between series of requests?
static unsigned int published_sets
Statistics, how many published record sets.
static uint32_t type
Type string converted to DNS type value.
static size_t data_size
Number of bytes in data.
static unsigned long long payload
How much data are we currently storing in the database?
const char * GNUNET_ErrorCode_get_hint(enum GNUNET_ErrorCode ec)
Returns a hint for a given error code.
GNUNET_ErrorCode
Taler error codes.
@ GNUNET_EC_NONE
No error (success).
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_DNSPARSER_MAX_LABEL_LENGTH
Maximum length of a label in DNS.
#define GNUNET_DNSPARSER_MAX_NAME_LENGTH
Maximum length of a name in DNS.
#define GNUNET_GETOPT_OPTION_END
Marker for the end of the list of options.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
uint32_t GNUNET_GNSRECORD_typename_to_number(const char *dns_typename)
Convert a type name (e.g.
Definition gnsrecord.c:192
int GNUNET_GNSRECORD_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of the value s of a record of type type to the respective binary repre...
Definition gnsrecord.c:169
@ GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION
This expiration time of the record is a relative time (not an absolute time).
void * GNUNET_CONTAINER_heap_peek(const struct GNUNET_CONTAINER_Heap *heap)
Get element stored at the root of heap.
void * GNUNET_CONTAINER_heap_remove_root(struct GNUNET_CONTAINER_Heap *heap)
Remove root of the heap.
struct GNUNET_CONTAINER_HeapNode * GNUNET_CONTAINER_heap_insert(struct GNUNET_CONTAINER_Heap *heap, void *element, GNUNET_CONTAINER_HeapCostType cost)
Inserts a new element into the heap.
struct GNUNET_CONTAINER_Heap * GNUNET_CONTAINER_heap_create(enum GNUNET_CONTAINER_HeapOrder order)
Create a new heap.
@ GNUNET_CONTAINER_HEAP_ORDER_MIN
Heap with the minimum cost at the root.
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_create(struct GNUNET_IDENTITY_Handle *id, const char *name, const struct GNUNET_CRYPTO_PrivateKey *privkey, enum GNUNET_CRYPTO_KeyType ktype, GNUNET_IDENTITY_CreateContinuation cont, void *cont_cls)
Create a new ego with the given name.
const struct GNUNET_CRYPTO_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Connect to the identity service.
void GNUNET_IDENTITY_cancel(struct GNUNET_IDENTITY_Operation *op)
Cancel an identity operation.
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
#define GNUNET_log(kind,...)
void GNUNET_CRYPTO_hash_context_read(struct GNUNET_HashContext *hc, const void *buf, size_t size)
Add data to be hashed.
void GNUNET_CRYPTO_hash_context_finish(struct GNUNET_HashContext *hc, struct GNUNET_HashCode *r_hash)
Finish the hash computation.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
struct GNUNET_HashContext * GNUNET_CRYPTO_hash_context_start(void)
Start incremental hashing operation.
@ GNUNET_PUBLIC_KEY_TYPE_EDDSA
EDDSA identity.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
enum GNUNET_GenericReturnValue GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
@ GNUNET_ERROR_TYPE_INFO
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_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_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
Definition program.c:407
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition scheduler.c:567
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
Definition scheduler.c:1339
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition scheduler.c:980
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition scheduler.c:1304
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition scheduler.c:1277
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition time.c:406
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition time.c:111
#define _(String)
GNU gettext support macro.
Definition platform.h:179
Handle to a node in a heap.
A private key for an identity as per LSD0001.
Definition of a command line option.
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.
Handle for an ego.
Definition identity.h:37
Handle for the service.
Handle for an operation with the identity service.
Connection to the NAMESTORE service.
An QueueEntry used to store information for a pending NAMESTORE record operation.
Entry in list of pending tasks.
Definition scheduler.c:136
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
Request we should make.
struct Job * next
Active requests are kept in a DLL.
struct GNUNET_GNSRECORD_Data * rd
struct GNUNET_TIME_Absolute op_start_time
While we are fetching the record, the value is set to the starting time of the DNS operation.
struct Record * rec_tail
Tail of records that should be published in GNS for this hostname.
struct Job * prev
Active requests are kept in a DLL.
const struct Zone * zone
Zone responsible for this request.
struct Record * rec_head
Head of records that should be published in GNS for this hostname.
struct GNUNET_NAMESTORE_QueueEntry * qe
Namestore operation pending for this record.
char label[GNUNET_DNSPARSER_MAX_NAME_LENGTH]
Hostname we are resolving.
struct GNUNET_TIME_Absolute expires
At what time does the (earliest) of the returned records for this name expire? At this point,...
struct GNUNET_CONTAINER_HeapNode * hn
Requests are kept in a heap while waiting to be resolved.
Missing identity creation context.
struct MissingZoneCreationCtx * prev
struct MissingZoneCreationCtx * next
struct GNUNET_IDENTITY_Operation * id_op
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
Record for the request to be stored by GNS.
Egos / Zones.
struct Zone * prev
Kept in a DLL.
struct GNUNET_CRYPTO_PrivateKey key
Private key of the zone.
struct Zone * next
Kept in a DLL.
char * domain
Domain of the zone (i.e.

Enumeration Type Documentation

◆ ZonefileImportState

Enumerator
ZS_READY 
ZS_ORIGIN_SET 
ZS_ORIGIN_CHANGED 
ZS_NAME_CHANGED 

Definition at line 325 of file gnunet-namestore-zonefile.c.

326{
327
328 /* Uninitialized */
329 ZS_READY,
330
331 /* The initial state */
333
334 /* The $ORIGIN has changed */
336
337 /* The record name/label has changed */
339
340};

Function Documentation

◆ do_shutdown()

static void do_shutdown ( void *  cls)
static

Task run on shutdown.

Cleans up everything.

Parameters
clsunused

Definition at line 349 of file gnunet-namestore-zonefile.c.

350{
351 (void) cls;
352 if (NULL != ego_name)
354 if (NULL != ns_qe)
356 if (NULL != id_op)
358 if (NULL != ns)
360 if (NULL != id)
362 for (int i = 0; i < rd_count; i++)
363 {
364 void *rd_ptr = (void*) rd[i].data;
365 GNUNET_free (rd_ptr);
366 }
367 if (NULL != t)
369}

References data, ego_name, GNUNET_free, GNUNET_IDENTITY_cancel(), GNUNET_IDENTITY_disconnect(), GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_disconnect(), GNUNET_SCHEDULER_cancel(), id_op, ns, ns_qe, rd, rd_count, and t.

Here is the call graph for this function:

◆ parse()

static void parse ( void *  cls)
static

Main function that will be run.

TODO:

  • We must assume that names are not repeated later in the zonefile because our _store APIs are replacing. No sure if that is common in zonefiles.
  • We must only actually store a record set when the name to store changes or the end of the file is reached. that way we can group them and add (see above).
  • We need to hope our string formats are compatible, but seems ok.
Parameters
clsclosure
argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)
cfgconfiguration

Definition at line 660 of file gnunet-namestore-zonefile.c.

661{
662 char buf[MAX_ZONEFILE_LINE_LEN];
664 char *next;
665 char *token;
666 char *payload_pos;
667 static char lastname[GNUNET_DNSPARSER_MAX_LABEL_LENGTH];
669 void *data;
670 size_t data_size;
671 int ttl_line = 0;
672 int type;
673 int bracket_unclosed = 0;
674 int quoted = 0;
675 int ln = 0;
676
677 t = NULL;
678 /* use filename provided as 1st argument (stdin by default) */
679 while ((res = fgets (buf, sizeof(buf), stdin))) /* read each line of input */
680 {
681 ln++;
682 ttl_line = 0;
683 token = trim (buf);
685 "Trimmed line (bracket %s): `%s'\n",
686 (bracket_unclosed > 0) ? "unclosed" : "closed",
687 token);
688 if ((0 == strlen (token)) ||
689 ((1 == strlen (token)) && (' ' == *token)))
690 continue; // I guess we can safely ignore blank lines
691 if (bracket_unclosed == 0)
692 {
693 /* Payload is already parsed */
694 payload_pos = payload;
695 /* Find space */
696 next = strchr (token, ' ');
697 if (NULL == next)
698 {
699 fprintf (stderr, "Error at line %u: %s\n", ln, token);
700 ret = 1;
702 return;
703 }
704 next[0] = '\0';
705 next++;
706 if (0 == (strcmp (token, "$ORIGIN")))
707 {
709 token = next_token (next);
710 }
711 else if (0 == (strcmp (token, "$TTL")))
712 {
713 ttl_line = 1;
714 token = next_token (next);
715 }
716 else
717 {
718 if (0 == strcmp (token, "IN")) // Inherit name from before
719 {
721 "Old name: %s\n", lastname);
722 strcpy (newname, lastname);
723 token[strlen (token)] = ' ';
724 }
725 else if (token[strlen (token) - 1] != '.') // no fqdn
726 {
727 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New name: %s\n", token);
728 if (GNUNET_DNSPARSER_MAX_LABEL_LENGTH < strlen (token))
729 {
730 fprintf (stderr,
731 _ ("Name `%s' is too long\n"),
732 token);
733 ret = 1;
735 return;
736 }
737 strcpy (newname, token);
738 token = next_token (next);
739 }
740 else if (0 == strcmp (token, origin))
741 {
742 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New name: @\n");
743 strcpy (newname, "@");
744 token = next_token (next);
745 }
746 else
747 {
748 if (strlen (token) < strlen (origin))
749 {
750 fprintf (stderr, "Wrong origin: %s (expected %s)\n", token, origin);
751 break; // FIXME error?
752 }
753 if (0 != strcmp (token + (strlen (token) - strlen (origin)), origin))
754 {
755 fprintf (stderr, "Wrong origin: %s (expected %s)\n", token, origin);
756 break;
757 }
758 token[strlen (token) - strlen (origin) - 1] = '\0';
759 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New name: %s\n", token);
760 if (GNUNET_DNSPARSER_MAX_LABEL_LENGTH < strlen (token))
761 {
762 fprintf (stderr,
763 _ ("Name `%s' is too long\n"),
764 token);
765 ret = 1;
767 return;
768 }
769 strcpy (newname, token);
770 token = next_token (next);
771 }
772 if (0 != strcmp (newname, lastname) &&
773 (0 < rd_count))
774 {
776 "Name changed %s->%s, storing record set of %u elements\n",
777 lastname, newname,
778 rd_count);
780 }
781 else
782 {
783 strcpy (lastname, newname);
784 }
785 }
786
787 if (ttl_line)
788 {
789 if (GNUNET_SYSERR == parse_ttl (token, &ttl))
790 {
791 fprintf (stderr, _ ("Failed to parse $TTL\n"));
792 ret = 1;
794 return;
795 }
796 continue;
797 }
799 {
800 if (GNUNET_SYSERR == parse_origin (token, origin))
801 {
802 fprintf (stderr, _ ("Failed to parse $ORIGIN from %s\n"), token);
803 ret = 1;
805 return;
806 }
807 break;
808 }
809 if (ZS_READY == state)
810 {
811 fprintf (stderr,
812 _ (
813 "You must provide $ORIGIN in your zonefile or via arguments (--zone)!\n"));
814 ret = 1;
816 return;
817 }
818 // This is a record, let's go
820 {
821 fprintf (stderr,
822 _ ("Only %u records per unique name supported.\n"),
824 ret = 1;
826 return;
827 }
830 next = strchr (token, ' ');
831 if (NULL == next)
832 {
833 fprintf (stderr, "Error, last token: %s\n", token);
834 ret = 1;
836 break;
837 }
838 next[0] = '\0';
839 next++;
840 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "class is: %s\n", token);
841 while (*next == ' ')
842 next++;
843 token = next;
844 next = strchr (token, ' ');
845 if (NULL == next)
846 {
847 fprintf (stderr, "Error\n");
848 break;
849 }
850 next[0] = '\0';
851 next++;
852 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "type is: %s\n", token);
855 while (*next == ' ')
856 next++;
857 token = next;
858 }
859 for (int i = 0; i < strlen (token); i++)
860 {
861 if (token[i] == '"')
862 quoted = ! quoted;
863 if ((token[i] == '(') && ! quoted)
864 bracket_unclosed++;
865 if ((token[i] == ')') && ! quoted)
866 bracket_unclosed--;
867 }
868 GNUNET_assert (strlen (token) < sizeof payload - (payload_pos - payload));
869 memcpy (payload_pos, token, strlen (token));
870 payload_pos += strlen (token);
871 if (bracket_unclosed > 0)
872 {
873 *payload_pos = ' ';
874 payload_pos++;
875 continue;
876 }
877 *payload_pos = '\0';
878 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "data is: %s\n\n", payload);
879 if (GNUNET_OK !=
881 &data,
882 &data_size))
883 {
884 fprintf (stderr,
885 _ ("Data `%s' invalid\n"),
886 payload);
887 ret = 1;
889 return;
890 }
891 rd[rd_count].data = data;
893 if (ZS_NAME_CHANGED == state)
894 break;
895 rd_count++;
896 }
897 if (rd_count > 0)
898 {
899 // We need to encode the lastname from punycode potentially.
900 // FIXME we want to probably queue this request here.
901 char *lastname_utf8;
902 idna_to_unicode_8z8z (lastname,
903 &lastname_utf8,
904 IDNA_ALLOW_UNASSIGNED);
906 "Queueing %d records\n",
907 rd_count);
908 queue (lastname_utf8,
909 rd_count,
910 rd,
914 for (int i = 0; i < rd_count; i++)
915 {
916 data = (void*) rd[i].data;
918 }
919 if (ZS_NAME_CHANGED == state)
920 {
921 rd[0] = rd[rd_count]; // recover last rd parsed.
922 rd_count = 1;
923 strcpy (lastname, newname);
925 }
926 else
927 rd_count = 0;
929 {
930 if (NULL != ego_name)
933 if (ego_name[strlen (ego_name) - 1] == '.')
934 ego_name[strlen (ego_name) - 1] = '\0';
936 "Changing origin to %s\n", ego_name);
938 return;
939 }
940 if (NULL != t)
943 return;
944 }
946 {
947 if (NULL != ego_name)
950 if (ego_name[strlen (ego_name) - 1] == '.')
951 ego_name[strlen (ego_name) - 1] = '\0';
953 "Changing origin to %s\n", ego_name);
955 return;
956 }
959 printf ("Published %u records sets with total %u records\n",
962}

References _, current_zone, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, ego_name, ensure_ego_and_continue(), GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_assert, GNUNET_DNSPARSER_MAX_LABEL_LENGTH, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_string_to_value(), GNUNET_GNSRECORD_typename_to_number(), GNUNET_log, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, GNUNET_SYSERR, GNUNET_TIME_absolute_get(), MAX_RECORDS_PER_NAME, MAX_ZONEFILE_LINE_LEN, MAX_ZONEFILE_RECORD_DATA_LEN, next_token(), origin, parse(), parse_origin(), parse_ttl(), payload, process_queue(), published_records, published_sets, queue(), rd, rd_count, GNUNET_GNSRECORD_Data::record_type, GNUNET_TIME_Relative::rel_value_us, res, ret, sleep_time_reg_proc, state, t, trim(), ttl, type, ZS_NAME_CHANGED, ZS_ORIGIN_CHANGED, ZS_ORIGIN_SET, and ZS_READY.

Referenced by add_continuation(), ensure_ego_and_continue(), identity_cb(), origin_create_cb(), and parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trim()

static char * trim ( char *  line)
static

Definition at line 376 of file gnunet-namestore-zonefile.c.

377{
378 char *ltrimmed = line;
379 int ltrimmed_len;
380 int quoted = 0;
381
382 // Trim all whitespace to the left
383 while (*ltrimmed == ' ')
384 ltrimmed++;
385 ltrimmed_len = strlen (ltrimmed);
386 // Find the first occurrence of an unqoted ';', which is our comment
387 for (int i = 0; i < ltrimmed_len; i++)
388 {
389 if (ltrimmed[i] == '"')
390 quoted = ! quoted;
391 if ((ltrimmed[i] != ';') || quoted)
392 continue;
393 ltrimmed[i] = '\0';
394 }
395 ltrimmed_len = strlen (ltrimmed);
396 // Remove trailing whitespace
397 for (int i = ltrimmed_len; i > 0; i--)
398 {
399 if (ltrimmed[i - 1] != ' ')
400 break;
401 ltrimmed[i - 1] = '\0';
402 }
403 ltrimmed_len = strlen (ltrimmed);
404 if (ltrimmed[ltrimmed_len - 1] == '\n')
405 ltrimmed[ltrimmed_len - 1] = ' ';
406 return ltrimmed;
407}

References line.

Referenced by parse().

Here is the caller graph for this function:

◆ next_token()

static char * next_token ( char *  token)
static

Definition at line 411 of file gnunet-namestore-zonefile.c.

412{
413 char *next = token;
414 while (*next == ' ')
415 next++;
416 return next;
417}

Referenced by parse().

Here is the caller graph for this function:

◆ parse_ttl()

static int parse_ttl ( char *  token,
struct GNUNET_TIME_Relative pttl 
)
static

Definition at line 421 of file gnunet-namestore-zonefile.c.

422{
423 char *next;
424 unsigned int ttl_tmp;
425
426 next = strchr (token, ';');
427 if (NULL != next)
428 next[0] = '\0';
429 next = strchr (token, ' ');
430 if (NULL != next)
431 next[0] = '\0';
432 if (1 != sscanf (token, "%u", &ttl_tmp))
433 {
434 fprintf (stderr, "Unable to parse TTL `%s'\n", token);
435 return GNUNET_SYSERR;
436 }
437 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TTL is: %u\n", ttl_tmp);
438 pttl->rel_value_us = ttl_tmp * 1000 * 1000;
439 return GNUNET_OK;
440}

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, and GNUNET_TIME_Relative::rel_value_us.

Referenced by parse().

Here is the caller graph for this function:

◆ parse_origin()

static int parse_origin ( char *  token,
char *  porigin 
)
static

Definition at line 444 of file gnunet-namestore-zonefile.c.

445{
446 char *next;
447 next = strchr (token, ';');
448 if (NULL != next)
449 next[0] = '\0';
450 next = strchr (token, ' ');
451 if (NULL != next)
452 next[0] = '\0';
453 strcpy (porigin, token);
454 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Origin is: %s\n", porigin);
455 return GNUNET_OK;
456}

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, and GNUNET_OK.

Referenced by parse().

Here is the caller graph for this function:

◆ origin_create_cb()

static void origin_create_cb ( void *  cls,
const struct GNUNET_CRYPTO_PrivateKey pk,
enum GNUNET_ErrorCode  ec 
)
static

Definition at line 460 of file gnunet-namestore-zonefile.c.

463{
464 struct Zone *zone;
465 id_op = NULL;
466 if (GNUNET_EC_NONE != ec)
467 {
468 fprintf (stderr, "Error: %s\n", GNUNET_ErrorCode_get_hint (ec));
469 ret = 1;
471 return;
472 }
474 "Created missing ego `%s'\n",
475 ego_name);
476 zone = GNUNET_new (struct Zone);
477 zone->key = *pk;
478 zone->domain = GNUNET_strdup (ego_name);
480 // FIXME add delegation to parent zone
482 current_zone = zone;
484}

References current_zone, Zone::domain, ego_name, GNUNET_CONTAINER_DLL_insert, GNUNET_EC_NONE, GNUNET_ERROR_TYPE_ERROR, GNUNET_ErrorCode_get_hint(), GNUNET_log, GNUNET_new, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, id_op, Zone::key, parse(), pk, ret, state, t, zone_head, zone_tail, and ZS_ORIGIN_SET.

Referenced by ensure_ego_and_continue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ensure_ego_and_continue()

static void ensure_ego_and_continue ( const char *  ego_name)
static

Definition at line 488 of file gnunet-namestore-zonefile.c.

489{
490 struct Zone *zone;
491 for (zone = zone_head; NULL != zone; zone = zone->next)
492 if (0 == strcmp (zone->domain, ego_name))
493 break;
494 if (NULL == zone)
495 {
497 "$ORIGIN %s does not exist, creating...\n", ego_name);
499 GNUNET_PUBLIC_KEY_TYPE_EDDSA, // FIXME make configurable
501 NULL);
502 return;
503 }
505 current_zone = zone;
507}

References current_zone, Zone::domain, ego_name, GNUNET_ERROR_TYPE_DEBUG, GNUNET_IDENTITY_create(), GNUNET_log, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SCHEDULER_add_now(), id_op, Zone::next, origin_create_cb(), parse(), state, t, zone_head, and ZS_ORIGIN_SET.

Referenced by add_continuation(), and parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_continuation()

static void add_continuation ( void *  cls,
enum GNUNET_ErrorCode  ec 
)
static

Definition at line 511 of file gnunet-namestore-zonefile.c.

512{
513 ns_qe = NULL;
514 if (GNUNET_EC_NONE != ec)
515 {
516 fprintf (stderr,
517 _ ("Failed to store records...\n"));
519 ret = -1;
520 }
522 {
523 if (NULL != ego_name)
526 if (ego_name[strlen (ego_name) - 1] == '.')
527 ego_name[strlen (ego_name) - 1] = '\0';
529 "Changing origin to %s\n", ego_name);
531 return;
532 }
534}

References _, ego_name, ensure_ego_and_continue(), GNUNET_EC_NONE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, ns_qe, origin, parse(), ret, state, t, and ZS_ORIGIN_CHANGED.

Referenced by process_queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_queue()

static void process_queue ( void *  cls)
static

Process as many requests as possible from the queue.

Parameters
clsNULL

Definition at line 543 of file gnunet-namestore-zonefile.c.

544{
545 struct Job *job;
546
547 (void) cls;
548 t = NULL;
549 while (pending + pending_rs < THRESH)
550 {
552 if (NULL == job)
553 break;
554 if (NULL != job->qe)
555 return; /* namestore op still pending */
557 break;
559 job->hn = NULL;
562 "Requesting store for `%s'\n",
563 job->label);
564 job->op_start_time = GNUNET_TIME_absolute_get ();
566 &job->zone->key,
567 job->label,
568 job->rd_count,
569 job->rd,
571 job);
572 GNUNET_assert (NULL != job->qe);
573 pending++;
574 }
575 if (pending + pending_rs >= THRESH)
576 {
578 "Stopped processing queue (%u+%u/%u)]\n",
579 pending,
581 THRESH);
582 return; /* wait for replies */
583 }
585 if (NULL == job)
586 {
588 "Stopped processing queue: empty queue\n");
589 return;
590 }
591 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Throttling\n");
592 if (NULL != t)
596}

References add_continuation(), GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_heap_peek(), GNUNET_CONTAINER_heap_remove_root(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_NAMESTORE_record_set_store(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_cancel(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_remaining(), job, ns, pending, pending_rs, process_queue(), GNUNET_TIME_Relative::rel_value_us, req_head, req_heap, req_tail, SERIES_DELAY, sleep_time_reg_proc, t, and THRESH.

Referenced by parse(), and process_queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert_sorted()

static void insert_sorted ( struct Job job)
static

Insert req into DLL sorted by next fetch time.

Parameters
reqrequest to insert into req_heap

Definition at line 605 of file gnunet-namestore-zonefile.c.

606{
607 job->hn =
608 GNUNET_CONTAINER_heap_insert (req_heap, job, job->expires.abs_value_us);
609}

References GNUNET_CONTAINER_heap_insert(), job, and req_heap.

Referenced by queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ queue()

static void queue ( const char *  label,
uint32_t  rd_count,
struct GNUNET_GNSRECORD_Data rd,
const struct Zone zone 
)
static

Add hostname to the list of requests to be made.

Parameters
hostnamename to resolve

Definition at line 618 of file gnunet-namestore-zonefile.c.

622{
623 struct Job *job;
624 struct GNUNET_HashContext *hctx;
625 struct GNUNET_HashCode hc;
626 size_t hlen;
627
628 hlen = strlen (label) + 1;
629 job = GNUNET_new (struct Job);
630 job->rd = rd;
631 job->rd_count = rd_count;
632 GNUNET_assert (NULL != zone);
633 job->zone = zone;
634 GNUNET_memcpy (job->label, label, hlen);
636 GNUNET_CRYPTO_hash_context_read (hctx, job->label, hlen);
637 GNUNET_CRYPTO_hash_context_read (hctx, job->zone, sizeof *zone);
640}

References GNUNET_assert, GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hash_context_read(), GNUNET_CRYPTO_hash_context_start(), GNUNET_memcpy, GNUNET_new, insert_sorted(), job, rd, and rd_count.

Referenced by boot_queue(), boot_queue(), check_for_global_natted(), check_for_queue_with_higher_prio(), check_vl_transmission(), core_read_finished_cb(), core_read_finished_cb(), decrypt_and_check_tc(), decrypt_and_check_tc(), destroy_message_control(), do_rekey(), do_rekey(), enqueue_message_control(), fragment_message(), free_pending_acknowledgement(), free_queue(), free_queue_entry(), free_timedout_queue_entry(), get_audiobin(), get_queue_delete_it(), get_queue_delete_it(), get_queue_delete_it(), GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop(), handle_add_queue_message(), handle_del_queue_message(), handle_send_message_ack(), handshake_ack_monotime_cb(), handshake_ack_monotime_cb(), handshake_ack_monotime_store_cb(), handshake_ack_monotime_store_cb(), handshake_monotime_cb(), handshake_monotime_cb(), handshake_monotime_store_cb(), handshake_monotime_store_cb(), inject_rekey(), inject_rekey(), iterate_address_and_compare_cb(), iterate_message_control(), lookup_queue_it(), mq_cancel(), mq_cancel(), mq_cancel(), mq_destroy(), mq_destroy(), mq_destroy(), mq_error(), mq_error(), mq_error(), mq_init(), mq_init(), mq_init(), mq_send(), mq_send(), mq_send(), parse(), pass_plaintext_to_core(), pass_plaintext_to_core(), prepare_pending_acknowledgement(), proto_read_kx(), proto_read_kx(), queue_destroy(), queue_destroy(), queue_destroy(), queue_finish(), queue_finish(), queue_read(), queue_read(), queue_read_kx(), queue_read_kx(), queue_send_msg(), queue_timeout(), queue_write(), queue_write(), rekey_monotime_cb(), rekey_monotime_cb(), rekey_monotime_store_cb(), rekey_monotime_store_cb(), reliability_box_message(), reschedule_queue_timeout(), schedule_transmit_on_queue(), select_best_pending_from_link(), select_read_cb(), select_write_cb(), send_challenge(), send_challenge(), setup_in_cipher(), setup_in_cipher(), setup_in_cipher_elligator(), setup_in_cipher_elligator(), setup_out_cipher(), setup_out_cipher(), setup_queue(), start_initial_kx_out(), start_initial_kx_out(), task_message_control(), transmit_kx(), transmit_kx(), transmit_on_queue(), try_handle_plaintext(), and try_handle_plaintext().

Here is the call graph for this function:

◆ identity_cb()

static void identity_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego,
void **  ctx,
const char *  name 
)
static

Definition at line 966 of file gnunet-namestore-zonefile.c.

970{
971 (void) cls;
972 (void) ctx;
973 static int initial_iteration = GNUNET_YES;
974 static int ego_zone_found = GNUNET_NO;
975
976 if (GNUNET_NO == initial_iteration)
977 return;
978 if (NULL == ego)
979 {
980 if (NULL == zone_head)
981 {
982 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No zones found\n");
983 ret = 1;
985 return;
986 }
987 if ((NULL != ego_name) &&
988 (GNUNET_NO == ego_zone_found))
989 {
991 "Zone `%s' not found\n",
992 ego_name);
993 ret = 2;
995 }
996 initial_iteration = GNUNET_NO;
998 return;
999 }
1000 if (NULL != name)
1001 {
1002 struct Zone *zone;
1003
1004 zone = GNUNET_new (struct Zone);
1006 zone->domain = GNUNET_strdup (name);
1008
1009 if ((NULL != ego_name) &&
1010 (0 == strcmp (name,
1011 ego_name)))
1012 {
1013 ego_zone_found = GNUNET_YES;
1014 sprintf (origin, "%s.", ego_name);
1016 }
1017 }
1018}

References ctx, Zone::domain, ego_name, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_ERROR, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, GNUNET_YES, Zone::key, name, origin, parse(), ret, state, t, zone_head, zone_tail, and ZS_ORIGIN_SET.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle _cfg 
)
static

Definition at line 1022 of file gnunet-namestore-zonefile.c.

1026{
1027 cfg = _cfg;
1031 if (NULL == ns)
1032 {
1033 fprintf (stderr,
1034 _ ("Failed to connect to NAMESTORE\n"));
1035 return;
1036 }
1038 if (NULL == id)
1039 {
1040 fprintf (stderr,
1041 _ ("Failed to connect to IDENTITY\n"));
1042 return;
1043 }
1044 state = ZS_READY;
1045}

References _, cfg, do_shutdown, GNUNET_CONTAINER_heap_create(), GNUNET_CONTAINER_HEAP_ORDER_MIN, GNUNET_IDENTITY_connect(), GNUNET_NAMESTORE_connect(), GNUNET_SCHEDULER_add_shutdown(), identity_cb(), ns, req_heap, state, and ZS_READY.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const *  argv 
)

The main function for gnunet-namestore-dbtool.

Parameters
argcnumber of arguments from the command line
argvcommand line arguments
Returns
0 ok, 1 on error

Definition at line 1056 of file gnunet-namestore-zonefile.c.

1057{
1060 "zone",
1061 "EGO",
1062 gettext_noop (
1063 "name of the ego controlling the zone"),
1064 &ego_name),
1066 };
1067 int lret;
1068
1069 GNUNET_log_setup ("gnunet-namestore-dbtool", "WARNING", NULL);
1070 if (GNUNET_OK !=
1072 argc,
1073 argv,
1074 "gnunet-namestore-zonefile",
1075 _ (
1076 "GNUnet namestore database manipulation tool"),
1077 options,
1078 &run,
1079 NULL)))
1080 {
1081 return lret;
1082 }
1083 return ret;
1084}

References _, ego_name, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_string(), GNUNET_log_setup(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), options, ret, and run().

Here is the call graph for this function:

Variable Documentation

◆ req_heap

struct GNUNET_CONTAINER_Heap* req_heap
static

Heap of all requests to perform, sorted by the time we should next do the request (i.e.

by expires).

Definition at line 198 of file gnunet-namestore-zonefile.c.

Referenced by insert_sorted(), process_queue(), and run().

◆ req_head

struct Job* req_head
static

Active requests are kept in a DLL.

Definition at line 203 of file gnunet-namestore-zonefile.c.

Referenced by process_queue().

◆ req_tail

struct Job* req_tail
static

Active requests are kept in a DLL.

Definition at line 208 of file gnunet-namestore-zonefile.c.

Referenced by process_queue().

◆ zone_head

struct Zone* zone_head
static

Head of list of zones we are managing.

Definition at line 214 of file gnunet-namestore-zonefile.c.

Referenced by ensure_ego_and_continue(), identity_cb(), and origin_create_cb().

◆ zone_tail

struct Zone* zone_tail
static

Tail of list of zones we are managing.

Definition at line 219 of file gnunet-namestore-zonefile.c.

Referenced by identity_cb(), and origin_create_cb().

◆ rd

struct GNUNET_GNSRECORD_Data rd[50]
static

The record data under a single label.

Reused. Hard limit.

Definition at line 226 of file gnunet-namestore-zonefile.c.

Referenced by array_cleanup(), attr_iter_cb(), attr_store_task(), backward_resolution(), block_create2(), block_create_ecdsa(), block_create_eddsa(), block_decrypt_ecdsa(), block_decrypt_eddsa(), block_get_size_ecdsa(), block_get_size_eddsa(), bulk_tx_start(), cb_key_monitor(), check_pkey(), check_rd(), check_result(), check_result(), clean_blind_sign_priv(), clean_blind_sign_pub(), clean_blinded_sig(), clean_rsa_public_key(), clean_rsa_signature(), clean_string(), clean_unblinded_sig(), clean_varsize_blob(), collect_tickets_cb(), consistency_iter(), continue_store_activity(), cred_iter_cb(), del_monitor(), DID_resolve_gns_lookup_cb(), dispatch_job(), dispatch_job_monitor(), display_record(), display_record_iterator(), display_record_lookup(), display_record_monitor(), display_records_from_block(), dns_result_parser(), do_shutdown(), filter_tickets_cb(), forward_resolution(), get_existing_rd_exp(), get_existing_record(), get_existing_record(), get_records_and_call_iterator(), GNUNET_CONVERSATION_phone_get_record(), GNUNET_GNSRECORD_block_calculate_size(), GNUNET_GNSRECORD_block_create(), GNUNET_GNSRECORD_block_create2(), GNUNET_GNSRECORD_block_create_unsigned(), GNUNET_GNSRECORD_is_expired(), GNUNET_GNSRECORD_JSON_from_gnsrecord(), GNUNET_GNSRECORD_JSON_spec_gnsrecord(), GNUNET_GNSRECORD_normalize_record_set(), GNUNET_GNSRECORD_record_get_expiration_time(), GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), GNUNET_NAMESTORE_record_set_store(), GNUNET_NAMESTORE_records_store(), handle_delegate_collection_cb(), handle_edit_record_set_response(), handle_gns2dns_result(), handle_gns_namecache_resolution_result(), handle_gns_resolution_result(), handle_gns_response(), handle_gns_response(), handle_gns_result(), handle_lookup_result(), handle_monitor_event(), handle_record(), handle_record_result(), handle_result(), handle_result(), handle_reverse_lookup(), handle_zone_to_name_it(), handle_zone_to_name_response(), lookup_authz_cb(), lookup_it(), lookup_nick_it(), lookup_redirect_uri_result(), monitor_iterate_cb(), namestore_flat_store_records(), namestore_list_iteration(), namestore_postgres_store_records(), namestore_sqlite_store_records(), ns_get_lookup_cb(), ns_lookup_cb(), ns_lookup_result_cb(), parse(), parse_record(), parse_result_call_iterator(), print_record(), process_lookup_result(), process_lookup_result(), process_parallel_lookup_result(), process_result(), process_result(), process_tickets(), purge_orphans_iterator(), purge_zone_iterator(), queue(), recursive_cname_resolution(), recursive_gns2dns_resolution(), recursive_pkey_resolution(), recursive_redirect_resolution(), reply_to_dns(), result_processor(), revoke_attrs_cb(), run(), run_edkey(), run_pkey(), run_with_zone_pkey(), rvk_move_attr_cb(), rvk_ticket_update(), send_lookup_response(), send_lookup_response_with_filter(), start_phone(), start_resolver_lookup(), store_record_set(), transmit_lookup_dns_result(), update_tickets(), vpn_allocation_cb(), zone_iterate_proc(), and zone_iterator().

◆ ttl

◆ origin

◆ rd_count

unsigned int rd_count = 0
static

Number of records for currently parsed set.

Definition at line 241 of file gnunet-namestore-zonefile.c.

Referenced by attr_iter_cb(), backward_resolution(), block_create2(), block_create_ecdsa(), block_create_eddsa(), block_decrypt_ecdsa(), block_decrypt_eddsa(), block_get_size_ecdsa(), block_get_size_eddsa(), cb_key_monitor(), check_rd(), check_result(), check_result(), collect_tickets_cb(), consistency_iter(), continue_store_activity(), cred_iter_cb(), del_monitor(), DID_create_namestore_lookup_cb(), DID_resolve_gns_lookup_cb(), dispatch_job(), dispatch_job_monitor(), dns_result_parser(), do_shutdown(), filter_tickets_cb(), forward_resolution(), get_existing_rd_exp(), get_existing_record(), get_existing_record(), GNUNET_GNSRECORD_block_calculate_size(), GNUNET_GNSRECORD_block_create(), GNUNET_GNSRECORD_block_create2(), GNUNET_GNSRECORD_block_create_unsigned(), GNUNET_GNSRECORD_JSON_from_gnsrecord(), GNUNET_GNSRECORD_JSON_spec_gnsrecord(), GNUNET_GNSRECORD_normalize_record_set(), GNUNET_GNSRECORD_record_get_expiration_time(), GNUNET_GNSRECORD_records_deserialize(), GNUNET_GNSRECORD_records_deserialize_get_size(), GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), GNUNET_NAMESTORE_record_set_store(), GNUNET_NAMESTORE_records_store(), handle_delegate_collection_cb(), handle_edit_record_set_response(), handle_gns2dns_result(), handle_gns_namecache_resolution_result(), handle_gns_resolution_result(), handle_gns_response(), handle_gns_response(), handle_gns_result(), handle_lookup_result(), handle_monitor_event(), handle_record(), handle_record_result(), handle_result(), handle_result(), handle_reverse_lookup(), handle_zone_to_name_it(), handle_zone_to_name_response(), lookup_authz_cb(), lookup_it(), lookup_nick_it(), lookup_redirect_uri_result(), monitor_iterate_cb(), namestore_flat_store_records(), namestore_postgres_store_records(), namestore_sqlite_store_records(), ns_lookup_cb(), ns_lookup_result_cb(), parse(), process_command_stdin(), process_lookup_result(), process_lookup_result(), process_parallel_lookup_result(), process_result(), process_result(), process_tickets(), queue(), recursive_gns2dns_resolution(), reply_to_dns(), result_processor(), revoke_attrs_cb(), run_edkey(), run_pkey(), run_with_zone_pkey(), rvk_move_attr_cb(), rvk_ticket_update(), send_lookup_response(), send_lookup_response_with_filter(), store_record_set(), update_tickets(), vpn_allocation_cb(), and zone_iterate_proc().

◆ ret

int ret = 0
static

Return code.

Definition at line 246 of file gnunet-namestore-zonefile.c.

Referenced by add_continuation(), identity_cb(), main(), origin_create_cb(), and parse().

◆ ego_name

char* ego_name = NULL
static

◆ res

char* res
static

Currently read line or NULL on EOF.

Definition at line 256 of file gnunet-namestore-zonefile.c.

Referenced by add_dns_result(), add_services(), block_create2(), client_disconnect_cb(), decode_and_send(), decode_and_send(), delete_old_block(), extract_abs_time(), extract_blind_sign_priv(), extract_blind_sign_pub(), extract_blinded_sig(), extract_bool(), extract_filename(), extract_fixed_blob(), extract_int64(), extract_rel_time(), extract_rsa_public_key(), extract_rsa_signature(), extract_string(), extract_timestamp(), extract_uint16(), extract_uint32(), extract_uint64(), extract_unblinded_sig(), extract_varsize_blob(), file_hash_finish(), file_hash_task(), get_nick_record(), get_server_addresses(), get_server_addresses(), get_url_parameter_copy(), GNUNET_buffer_reap(), GNUNET_buffer_reap_str(), GNUNET_buffer_write_vfstr(), GNUNET_CONFIGURATION_get_data(), GNUNET_CONTAINER_bloomfilter_load(), GNUNET_CONTAINER_bloomfilter_test(), GNUNET_CRYPTO_ecc_dlog(), GNUNET_CRYPTO_ecdsa_sign_derived(), GNUNET_CRYPTO_eddsa_sign_(), GNUNET_CRYPTO_eddsa_sign_raw(), GNUNET_CRYPTO_eddsa_verify_(), GNUNET_CRYPTO_edx25519_verify_(), GNUNET_CRYPTO_hash_context_finish(), GNUNET_DISK_directory_create_for_file(), GNUNET_GNSRECORD_block_calculate_size(), GNUNET_GNSRECORD_block_create(), GNUNET_GNSRECORD_block_decrypt(), GNUNET_GNSRECORD_block_sign(), GNUNET_GNSRECORD_block_verify(), GNUNET_hton_double(), GNUNET_NT_scanner_get_type(), GNUNET_ntoh_double(), GNUNET_PQ_exec_prepared(), GNUNET_PQ_query_param_absolute_time(), GNUNET_PQ_query_param_blind_sign_priv(), GNUNET_PQ_query_param_blind_sign_pub(), GNUNET_PQ_query_param_blinded_sig(), GNUNET_PQ_query_param_fixed_size(), GNUNET_PQ_query_param_int16(), GNUNET_PQ_query_param_int64(), GNUNET_PQ_query_param_null(), GNUNET_PQ_query_param_relative_time(), GNUNET_PQ_query_param_rsa_public_key(), GNUNET_PQ_query_param_rsa_signature(), GNUNET_PQ_query_param_uint16(), GNUNET_PQ_query_param_uint32(), GNUNET_PQ_query_param_uint64(), GNUNET_PQ_query_param_unblinded_sig(), GNUNET_PQ_reconnect(), GNUNET_PQ_result_spec_absolute_time(), GNUNET_PQ_result_spec_absolute_time_nbo(), GNUNET_PQ_result_spec_array_abs_time(), GNUNET_PQ_result_spec_array_bool(), GNUNET_PQ_result_spec_array_fixed_size(), GNUNET_PQ_result_spec_array_rel_time(), GNUNET_PQ_result_spec_array_string(), GNUNET_PQ_result_spec_array_timestamp(), GNUNET_PQ_result_spec_array_uint16(), GNUNET_PQ_result_spec_array_uint32(), GNUNET_PQ_result_spec_array_uint64(), GNUNET_PQ_result_spec_array_variable_size(), GNUNET_PQ_result_spec_blind_sign_priv(), GNUNET_PQ_result_spec_blind_sign_pub(), GNUNET_PQ_result_spec_blinded_sig(), GNUNET_PQ_result_spec_bool(), GNUNET_PQ_result_spec_fixed_size(), GNUNET_PQ_result_spec_int64(), GNUNET_PQ_result_spec_relative_time(), GNUNET_PQ_result_spec_rsa_public_key(), GNUNET_PQ_result_spec_rsa_signature(), GNUNET_PQ_result_spec_string(), GNUNET_PQ_result_spec_timestamp(), GNUNET_PQ_result_spec_timestamp_nbo(), GNUNET_PQ_result_spec_uint16(), GNUNET_PQ_result_spec_uint32(), GNUNET_PQ_result_spec_uint64(), GNUNET_PQ_result_spec_unblinded_sig(), GNUNET_PQ_result_spec_variable_size(), GNUNET_SECRETSHARING_plaintext_generate_i(), GNUNET_STRINGS_string_to_data_alloc(), GNUNET_xstrdup_(), GNUNET_xstrndup_(), handle_arm_result(), handle_auto_result(), handle_block_cache(), handle_block_cache_response(), handle_edit_record_set(), handle_edit_record_set_cancel(), handle_generic_response(), handle_gns_redirect_result(), handle_monitor_notify(), handle_query_message(), handle_record_lookup(), handle_record_store(), handle_success_response(), handle_zone_to_name_response(), hash_for_index_cb(), hash_for_index_val(), list_count(), lookup_nick_it(), main(), namecache_postgres_cache_block(), namecache_postgres_expire_blocks(), namecache_postgres_lookup_block(), namestore_postgres_clear_editor_hint(), namestore_postgres_edit_records(), namestore_postgres_iterate_records(), namestore_postgres_lookup_records(), namestore_postgres_store_records(), namestore_postgres_zone_to_name(), open_static_resource(), pabc_get_issuer(), parse(), parse_result_call_iterator(), parse_rsa_signature(), postgres_plugin_del(), postgres_plugin_get(), postgres_plugin_get_closest(), postgres_plugin_get_key(), postgres_plugin_get_replication(), postgres_plugin_get_zero_anonymity(), pq_notice_receiver_cb(), prepare_check_patch(), prepare_get_oid_by_name(), process_peer_string(), process_result(), query_param_array_generic(), REGEX_BLOCK_check(), return_agpl(), return_agpl(), route_control_message_without_fc(), run(), run(), send_client_reply(), send_lookup_response_with_filter(), send_remaining_elements(), send_remaining_elements(), sign_cb(), store_record_set(), try_old_ax_keys(), and verify_fair().

◆ published_sets

unsigned int published_sets = 0
static

Statistics, how many published record sets.

Definition at line 261 of file gnunet-namestore-zonefile.c.

Referenced by parse().

◆ published_records

unsigned int published_records = 0
static

Statistics, how many records published in aggregate.

Definition at line 266 of file gnunet-namestore-zonefile.c.

Referenced by parse().

◆ current_zone

struct Zone* current_zone
static

Private key for the our zone.

Definition at line 272 of file gnunet-namestore-zonefile.c.

Referenced by ensure_ego_and_continue(), origin_create_cb(), and parse().

◆ ns_qe

struct GNUNET_NAMESTORE_QueueEntry* ns_qe
static

Queue entry for the 'add' operation.

Definition at line 277 of file gnunet-namestore-zonefile.c.

Referenced by add_continuation(), and do_shutdown().

◆ ns

struct GNUNET_NAMESTORE_Handle* ns
static

Handle to the namestore.

Definition at line 282 of file gnunet-namestore-zonefile.c.

Referenced by do_shutdown(), process_queue(), and run().

◆ id_op

struct GNUNET_IDENTITY_Operation* id_op
static

Origin create operations.

Definition at line 287 of file gnunet-namestore-zonefile.c.

Referenced by do_shutdown(), ensure_ego_and_continue(), and origin_create_cb().

◆ id

◆ cfg

const struct GNUNET_CONFIGURATION_Handle* cfg
static

Current configurataion.

Definition at line 297 of file gnunet-namestore-zonefile.c.

Referenced by run().

◆ t

struct GNUNET_SCHEDULER_Task* t
static

Main task.

Definition at line 302 of file gnunet-namestore-zonefile.c.

Referenced by add_continuation(), add_without_sets(), automaton_create_proofs(), automaton_destroy_state(), automaton_merge_states(), automaton_state_traverse(), block_create_ecdsa(), block_create_eddsa(), check_dht_p2p_hello(), compute_scalar_product(), connection_ready_cb(), consider_path_cb(), construct_task_graph(), destroy_t_connection(), destroy_task(), destroy_tunnel(), destroy_tunnels_now(), dfa_add_multi_strides_helper(), dfa_compress_paths(), dfa_compress_paths_helper(), dfa_move(), dfa_remove_dead_states(), do_send(), do_shutdown(), driver_add_multiple(), dump_backtrace(), ensure_ego_and_continue(), extract_abs_time(), extract_abs_time_nbo(), extract_timestamp_nbo(), find_peer_context(), GCCH_channel_incoming_new(), GCP_drop_tunnel(), GCT_2s(), GCT_add_channel(), GCT_add_inbound_connection(), GCT_change_estate(), GCT_connection_lost(), GCT_consider_path(), GCT_count_any_connections(), GCT_count_channels(), GCT_create_tunnel(), GCT_debug(), GCT_destroy_tunnel_now(), GCT_get_destination(), GCT_get_estate(), GCT_handle_encrypted(), GCT_handle_kx(), GCT_handle_kx_auth(), GCT_iterate_channels(), GCT_iterate_connections(), GCT_remove_channel(), GCT_send(), GCT_send_cancel(), GCT_send_channel_destroy(), GDS_u_connect(), GDS_u_disconnect(), GDS_u_receive(), get_all_tunnels_iterator(), get_next_free_ctn(), get_ready_connection(), GNUNET_CRYPTO_hash_xorcmp(), GNUNET_DISK_file_seek(), GNUNET_DISK_mkdtemp(), GNUNET_DISK_mktemp(), GNUNET_FS_meta_data_add_publication_date(), GNUNET_JSON_pack_timestamp(), GNUNET_JSON_spec_timestamp(), GNUNET_log_setup(), GNUNET_SCHEDULER_add_at_with_priority(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_add_with_reason_and_priority(), GNUNET_SERVICE_client_drop(), GNUNET_STRINGS_absolute_time_to_string(), GNUNET_STRINGS_fancy_time_to_absolute(), GNUNET_STRINGS_timestamp_to_string(), GNUNET_TIME_absolute2s(), GNUNET_TIME_absolute_approx_eq(), GNUNET_TIME_get_current_year(), GNUNET_TIME_randomized_backoff(), GNUNET_TIME_time_to_year(), GNUNET_TIME_timestamp_hton(), GNUNET_TIME_timestamp_ntoh(), GNUNET_TIME_year_to_time(), GNUNET_TRANSPORT_TESTING_done(), GNUNET_TRANSPORT_TESTING_get_test_plugin_name(), handle_connection_create(), handle_decrypted(), handle_dht_p2p_get(), handle_dht_p2p_hello(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_p2p_estimate(), handle_plaintext_channel_destroy(), handle_plaintext_channel_open(), handle_plaintext_channel_open_ack(), handle_plaintext_data(), handle_plaintext_data_ack(), handle_plaintext_keepalive(), helper_read(), helper_write(), identity_cb(), init_backtrace(), init_fd_info(), iterate_initial_edge(), lookup_channel(), maintain_connections_cb(), mark_connection_unready(), mktemp_name(), origin_create_cb(), parse(), parse_definitions(), parse_pattern(), process_queue(), progress_cb(), put_task(), REGEX_INTERNAL_dfa_add_multi_strides(), restore_fair(), retry_kx(), rsa_gcd_validate(), scc_tarjan_strongconnect(), send_create(), send_done_cb(), send_kx(), send_kx_auth(), set_timestamp(), shutdown_if_no_lifeness(), state_add_transition(), state_get_edges(), trigger_transmissions(), try_send_normal_payload(), and vec_for().

◆ pending

unsigned int pending
static

The number of DNS queries that are outstanding.

Definition at line 307 of file gnunet-namestore-zonefile.c.

Referenced by GNUNET_NETWORK_socket_recvfrom_amount(), and process_queue().

◆ pending_rs

unsigned int pending_rs
static

The number of NAMESTORE record store operations that are outstanding.

Definition at line 312 of file gnunet-namestore-zonefile.c.

Referenced by process_queue().

◆ state

◆ sleep_time_reg_proc

struct GNUNET_TIME_Absolute sleep_time_reg_proc
static

Last time we worked before going idle.

Definition at line 323 of file gnunet-namestore-zonefile.c.

Referenced by parse(), and process_queue().