gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r28784 - in gnunet/src: gns include namestore


From: gnunet
Subject: [GNUnet-SVN] r28784 - in gnunet/src: gns include namestore
Date: Thu, 22 Aug 2013 09:49:19 +0200

Author: grothoff
Date: 2013-08-22 09:49:19 +0200 (Thu, 22 Aug 2013)
New Revision: 28784

Modified:
   gnunet/src/gns/gnunet-service-gns_resolver.c
   gnunet/src/include/gnunet_namestore_service.h
   gnunet/src/namestore/namestore_api_common.c
Log:
-expanding namestore API with pkey <-> zkey conversion functions

Modified: gnunet/src/gns/gnunet-service-gns_resolver.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.c        2013-08-22 07:34:41 UTC 
(rev 28783)
+++ gnunet/src/gns/gnunet-service-gns_resolver.c        2013-08-22 07:49:19 UTC 
(rev 28784)
@@ -29,9 +29,10 @@
  *        can likely be done in 'resolver_lookup_get_next_label'.
  * - GNS: expand ".+" in returned values to the respective absolute
  *        name using '.zkey'
- * - recursive DNS resolution
+ * - DNS: convert result format back to GNS
  * - shortening triggers
  * - revocation checks (make optional: privacy!)
+ * - DNAME support
  *
  * Issues:
  * - We currently go to the DHT simply if we find no local reply; this
@@ -861,6 +862,16 @@
 
 
 /**
+ * Begin the resolution process from 'name', starting with
+ * the identification of the zone specified by 'name'.
+ *
+ * @param rh resolution to perform
+ */
+static void
+start_resolver_lookup (struct GNS_ResolverHandle *rh);
+
+
+/**
  * Function called with the result of a DNS resolution.
  *
  * @param cls the request handle of the resolution that
@@ -891,10 +902,19 @@
     GNS_resolver_lookup_cancel (rh);
     return;
   }
-  // FIXME: 
-  // Check if the packet is the final answer, or
-  // just pointing us to another NS or another name (CNAME), or another domain 
(DNAME);
-  // then do the right thing (TM) -- possibly using "recursive_dns_resolution".
+
+  if ( (p->num_answers > 0) &&
+       (GNUNET_DNSPARSER_TYPE_CNAME == p->answers[0].type) &&
+       (GNUNET_DNSPARSER_TYPE_CNAME != rh->record_type) )
+    {
+      GNUNET_free (rh->name);
+      rh->name = GNUNET_strdup (p->answers[0].data.hostname);
+      start_resolver_lookup (rh);
+      return;     
+    }
+  /* FIXME: add DNAME support */
+
+  /* FIXME: convert from DNS to GNS format! */
   GNUNET_break (0);
   GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
              _("NOT IMPLEMENTED\n"));
@@ -978,16 +998,6 @@
 
 
 /**
- * Begin the resolution process from 'name', starting with
- * the identification of the zone specified by 'name'.
- *
- * @param rh resolution to perform
- */
-static void
-start_resolver_lookup (struct GNS_ResolverHandle *rh);
-
-
-/**
  * We encountered a CNAME record during our resolution.
  * Merge it into our chain.
  *

Modified: gnunet/src/include/gnunet_namestore_service.h
===================================================================
--- gnunet/src/include/gnunet_namestore_service.h       2013-08-22 07:34:41 UTC 
(rev 28783)
+++ gnunet/src/include/gnunet_namestore_service.h       2013-08-22 07:49:19 UTC 
(rev 28784)
@@ -613,6 +613,34 @@
 
 
 /**
+ * Convert public key to the respective absolute domain name in the
+ * ".zkey" pTLD. 
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ * 
+ * @param pkey a public key with (x,y) on the eliptic curve 
+ * @return string "Y.X.zkey" where X and Y are the coordinates of the public
+ *         key in an encoding suitable for DNS labels.
+ */
+const char *
+GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicKey *pkey);
+
+
+/**
+ * Convert an absolute domain name in the ".zkey" pTLD to the
+ * respective public key.
+ * 
+ * @param zkey string "Y.X.zkey" where X and Y are the coordinates of the 
public
+ *         key in an encoding suitable for DNS labels.
+ * @param pkey set to a public key with (x,y) on the eliptic curve 
+ * @return #GNUNET_SYSERR if @a zkey has the wrong syntax
+ */
+int
+GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey,
+                              struct GNUNET_CRYPTO_EccPublicKey *pkey);
+
+
+/**
  * Calculate the DHT query for a given @a label in a given @a zone.
  * 
  * @param zone private key of the zone

Modified: gnunet/src/namestore/namestore_api_common.c
===================================================================
--- gnunet/src/namestore/namestore_api_common.c 2013-08-22 07:34:41 UTC (rev 
28783)
+++ gnunet/src/namestore/namestore_api_common.c 2013-08-22 07:49:19 UTC (rev 
28784)
@@ -954,4 +954,40 @@
 }
 
 
+/**
+ * Convert public key to the respective absolute domain name in the
+ * ".zkey" pTLD. 
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ * 
+ * @param pkey a public key with (x,y) on the eliptic curve 
+ * @return string "Y.X.zkey" where X and Y are the coordinates of the public
+ *         key in an encoding suitable for DNS labels.
+ */
+const char *
+GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicKey *pkey)
+{
+  GNUNET_break (0); // not implemented
+  return NULL;
+}
+
+
+/**
+ * Convert an absolute domain name in the ".zkey" pTLD to the
+ * respective public key.
+ * 
+ * @param zkey string "Y.X.zkey" where X and Y are the coordinates of the 
public
+ *         key in an encoding suitable for DNS labels.
+ * @param pkey set to a public key with (x,y) on the eliptic curve 
+ * @return #GNUNET_SYSERR if @a zkey has the wrong syntax
+ */
+int
+GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey,
+                              struct GNUNET_CRYPTO_EccPublicKey *pkey)
+{
+  GNUNET_break (0); // not implemented
+  return GNUNET_SYSERR;
+}
+
+
 /* end of namestore_common.c */




reply via email to

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