gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: -comments; gitignore


From: gnunet
Subject: [gnunet] branch master updated: -comments; gitignore
Date: Wed, 19 Oct 2022 15:00:43 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new cfdf9ea8c -comments; gitignore
cfdf9ea8c is described below

commit cfdf9ea8c1246979f48174628872e79cfb1657a2
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Wed Oct 19 22:00:37 2022 +0900

    -comments; gitignore
---
 src/namestore/.gitignore                  |  1 +
 src/namestore/gnunet-namestore-zonefile.c | 41 +++++++++++++++++++++++++++++--
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/namestore/.gitignore b/src/namestore/.gitignore
index b26f32d1d..a1104c30b 100644
--- a/src/namestore/.gitignore
+++ b/src/namestore/.gitignore
@@ -1,6 +1,7 @@
 gnunet-service-namestore
 gnunet-namestore
 gnunet-namestore-dbtool
+gnunet-namestore-zonefile
 gnunet-namestore-fcfsd
 test_namestore_api_lookup_nick.nc
 test_namestore_api_lookup_private.nc
diff --git a/src/namestore/gnunet-namestore-zonefile.c 
b/src/namestore/gnunet-namestore-zonefile.c
index 645498257..a55e3a0aa 100644
--- a/src/namestore/gnunet-namestore-zonefile.c
+++ b/src/namestore/gnunet-namestore-zonefile.c
@@ -42,9 +42,22 @@ do_shutdown (void *cls)
 {
   (void) cls;
 }
+
 /**
  * Main function that will be run.
  *
+ * TODO:
+ *  - We need to actually create and store the records with in begin/commit
+ *  - We need to get as argument for what zone to import
+ *  - 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 currently do not allow multiline payloads which seem to be common
+ *  - We currently do not sanitize payloads (e.g. `()')
+ *  - We need to hope our string formats are compatible, but seems ok.
+ *
  * @param cls closure
  * @param args remaining command-line arguments
  * @param cfgfile name of the configuration file used (for saving, can be 
NULL!)
@@ -61,18 +74,23 @@ run (void *cls,
   char *token;
   char origin[255];
   char lastname[255];
+  struct GNUNET_TIME_Relative ttl;
   int origin_line = 0;
+  int ttl_line = 0;
+  uint32_t ttl_tmp;
 
   /* use filename provided as 1st argument (stdin by default) */
   int i = 0;
   while (fgets (buf, 5000, stdin))                     /* read each line of 
input */
   {
+    i++;
     origin_line = 0;
+    ttl_line = 0;
     /* Find space */
     next = strchr (buf, ' ');
     if (NULL == next)
     {
-      fprintf (stderr, "End?\n");
+      fprintf (stderr, "Error at line %u: %s\n", i, buf);
       break;
     }
     next[0] = '\0';
@@ -80,7 +98,9 @@ run (void *cls,
     if (0 == (strcmp (buf, "$ORIGIN")))
       origin_line = 1;
     else if (0 == (strcmp (buf, "$TTL")))
-      continue; // FIXME
+    {
+      ttl_line = 1;
+    }
     else
     {
       if (0 == strlen (buf)) // Inherit name from before
@@ -118,6 +138,23 @@ run (void *cls,
       next++;
     token = next;
 
+    if (ttl_line)
+    {
+      next = strchr (token, ';');
+      if (NULL != next)
+        next[0] = '\0';
+      next = strchr (token, ' ');
+      if (NULL != next)
+        next[0] = '\0';
+      if (1 != sscanf (token, "%u", &ttl_tmp))
+      {
+        fprintf (stderr, "Unable to parse TTL `%s'\n", token);
+        break;
+      }
+      printf ("TTL is: %u\n", ttl_tmp);
+      ttl.rel_value_us = ttl_tmp * 1000 * 1000;
+      continue;
+    }
     if (origin_line)
     {
       next = strchr (token, ';');

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]