diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-22 07:49:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-22 07:49:19 +0000 |
commit | a8c5af00cd450ce1c1bf5b2695e7168c526df071 (patch) | |
tree | a848ced6e20daf19548e5f9d3f8f7b77d1419269 | |
parent | 2cb19e37aa832394606af654199881f323f69dc8 (diff) | |
download | gnunet-a8c5af00cd450ce1c1bf5b2695e7168c526df071.tar.gz gnunet-a8c5af00cd450ce1c1bf5b2695e7168c526df071.zip |
-expanding namestore API with pkey <-> zkey conversion functions
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 40 | ||||
-rw-r--r-- | src/include/gnunet_namestore_service.h | 28 | ||||
-rw-r--r-- | src/namestore/namestore_api_common.c | 36 |
3 files changed, 89 insertions, 15 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 0fb6ffbd1..bd059eaa9 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -29,9 +29,10 @@ | |||
29 | * can likely be done in 'resolver_lookup_get_next_label'. | 29 | * can likely be done in 'resolver_lookup_get_next_label'. |
30 | * - GNS: expand ".+" in returned values to the respective absolute | 30 | * - GNS: expand ".+" in returned values to the respective absolute |
31 | * name using '.zkey' | 31 | * name using '.zkey' |
32 | * - recursive DNS resolution | 32 | * - DNS: convert result format back to GNS |
33 | * - shortening triggers | 33 | * - shortening triggers |
34 | * - revocation checks (make optional: privacy!) | 34 | * - revocation checks (make optional: privacy!) |
35 | * - DNAME support | ||
35 | * | 36 | * |
36 | * Issues: | 37 | * Issues: |
37 | * - We currently go to the DHT simply if we find no local reply; this | 38 | * - We currently go to the DHT simply if we find no local reply; this |
@@ -861,6 +862,16 @@ recursive_resolution (void *cls, | |||
861 | 862 | ||
862 | 863 | ||
863 | /** | 864 | /** |
865 | * Begin the resolution process from 'name', starting with | ||
866 | * the identification of the zone specified by 'name'. | ||
867 | * | ||
868 | * @param rh resolution to perform | ||
869 | */ | ||
870 | static void | ||
871 | start_resolver_lookup (struct GNS_ResolverHandle *rh); | ||
872 | |||
873 | |||
874 | /** | ||
864 | * Function called with the result of a DNS resolution. | 875 | * Function called with the result of a DNS resolution. |
865 | * | 876 | * |
866 | * @param cls the request handle of the resolution that | 877 | * @param cls the request handle of the resolution that |
@@ -891,10 +902,19 @@ dns_result_parser (void *cls, | |||
891 | GNS_resolver_lookup_cancel (rh); | 902 | GNS_resolver_lookup_cancel (rh); |
892 | return; | 903 | return; |
893 | } | 904 | } |
894 | // FIXME: | 905 | |
895 | // Check if the packet is the final answer, or | 906 | if ( (p->num_answers > 0) && |
896 | // just pointing us to another NS or another name (CNAME), or another domain (DNAME); | 907 | (GNUNET_DNSPARSER_TYPE_CNAME == p->answers[0].type) && |
897 | // then do the right thing (TM) -- possibly using "recursive_dns_resolution". | 908 | (GNUNET_DNSPARSER_TYPE_CNAME != rh->record_type) ) |
909 | { | ||
910 | GNUNET_free (rh->name); | ||
911 | rh->name = GNUNET_strdup (p->answers[0].data.hostname); | ||
912 | start_resolver_lookup (rh); | ||
913 | return; | ||
914 | } | ||
915 | /* FIXME: add DNAME support */ | ||
916 | |||
917 | /* FIXME: convert from DNS to GNS format! */ | ||
898 | GNUNET_break (0); | 918 | GNUNET_break (0); |
899 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 919 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
900 | _("NOT IMPLEMENTED\n")); | 920 | _("NOT IMPLEMENTED\n")); |
@@ -978,16 +998,6 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh) | |||
978 | 998 | ||
979 | 999 | ||
980 | /** | 1000 | /** |
981 | * Begin the resolution process from 'name', starting with | ||
982 | * the identification of the zone specified by 'name'. | ||
983 | * | ||
984 | * @param rh resolution to perform | ||
985 | */ | ||
986 | static void | ||
987 | start_resolver_lookup (struct GNS_ResolverHandle *rh); | ||
988 | |||
989 | |||
990 | /** | ||
991 | * We encountered a CNAME record during our resolution. | 1001 | * We encountered a CNAME record during our resolution. |
992 | * Merge it into our chain. | 1002 | * Merge it into our chain. |
993 | * | 1003 | * |
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 1e459a850..759b53581 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -613,6 +613,34 @@ GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicKey *z); | |||
613 | 613 | ||
614 | 614 | ||
615 | /** | 615 | /** |
616 | * Convert public key to the respective absolute domain name in the | ||
617 | * ".zkey" pTLD. | ||
618 | * This is one of the very few calls in the entire API that is | ||
619 | * NOT reentrant! | ||
620 | * | ||
621 | * @param pkey a public key with (x,y) on the eliptic curve | ||
622 | * @return string "Y.X.zkey" where X and Y are the coordinates of the public | ||
623 | * key in an encoding suitable for DNS labels. | ||
624 | */ | ||
625 | const char * | ||
626 | GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicKey *pkey); | ||
627 | |||
628 | |||
629 | /** | ||
630 | * Convert an absolute domain name in the ".zkey" pTLD to the | ||
631 | * respective public key. | ||
632 | * | ||
633 | * @param zkey string "Y.X.zkey" where X and Y are the coordinates of the public | ||
634 | * key in an encoding suitable for DNS labels. | ||
635 | * @param pkey set to a public key with (x,y) on the eliptic curve | ||
636 | * @return #GNUNET_SYSERR if @a zkey has the wrong syntax | ||
637 | */ | ||
638 | int | ||
639 | GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, | ||
640 | struct GNUNET_CRYPTO_EccPublicKey *pkey); | ||
641 | |||
642 | |||
643 | /** | ||
616 | * Calculate the DHT query for a given @a label in a given @a zone. | 644 | * Calculate the DHT query for a given @a label in a given @a zone. |
617 | * | 645 | * |
618 | * @param zone private key of the zone | 646 | * @param zone private key of the zone |
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c index b38a594db..4ca672f1e 100644 --- a/src/namestore/namestore_api_common.c +++ b/src/namestore/namestore_api_common.c | |||
@@ -954,4 +954,40 @@ GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicKey | |||
954 | } | 954 | } |
955 | 955 | ||
956 | 956 | ||
957 | /** | ||
958 | * Convert public key to the respective absolute domain name in the | ||
959 | * ".zkey" pTLD. | ||
960 | * This is one of the very few calls in the entire API that is | ||
961 | * NOT reentrant! | ||
962 | * | ||
963 | * @param pkey a public key with (x,y) on the eliptic curve | ||
964 | * @return string "Y.X.zkey" where X and Y are the coordinates of the public | ||
965 | * key in an encoding suitable for DNS labels. | ||
966 | */ | ||
967 | const char * | ||
968 | GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicKey *pkey) | ||
969 | { | ||
970 | GNUNET_break (0); // not implemented | ||
971 | return NULL; | ||
972 | } | ||
973 | |||
974 | |||
975 | /** | ||
976 | * Convert an absolute domain name in the ".zkey" pTLD to the | ||
977 | * respective public key. | ||
978 | * | ||
979 | * @param zkey string "Y.X.zkey" where X and Y are the coordinates of the public | ||
980 | * key in an encoding suitable for DNS labels. | ||
981 | * @param pkey set to a public key with (x,y) on the eliptic curve | ||
982 | * @return #GNUNET_SYSERR if @a zkey has the wrong syntax | ||
983 | */ | ||
984 | int | ||
985 | GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, | ||
986 | struct GNUNET_CRYPTO_EccPublicKey *pkey) | ||
987 | { | ||
988 | GNUNET_break (0); // not implemented | ||
989 | return GNUNET_SYSERR; | ||
990 | } | ||
991 | |||
992 | |||
957 | /* end of namestore_common.c */ | 993 | /* end of namestore_common.c */ |