From ed42d471aa6b5bf42bfc8e9186e69ab4c0ebc6ff Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Sun, 9 Jul 2017 16:15:09 +0200 Subject: [PATCH] -add attr list --- src/identity-provider/gnunet-idp.c | 138 +++++++++++++++++++++++++---- 1 file changed, 120 insertions(+), 18 deletions(-) diff --git a/src/identity-provider/gnunet-idp.c b/src/identity-provider/gnunet-idp.c index 0dd565da6..017e0dbb5 100644 --- a/src/identity-provider/gnunet-idp.c +++ b/src/identity-provider/gnunet-idp.c @@ -30,6 +30,11 @@ #include "gnunet_identity_service.h" #include "gnunet_signatures.h" +/** + * List attribute flag + */ +static int list; + /** * The attribute */ @@ -55,6 +60,11 @@ static struct GNUNET_IDENTITY_Handle *identity_handle; */ static struct GNUNET_NAMESTORE_Handle *namestore_handle; +/** + * Namestore iterator + */ +static struct GNUNET_NAMESTORE_ZoneIterator *ns_iterator; + /** * Namestore queue */ @@ -70,6 +80,8 @@ do_cleanup(void *cls) { if (NULL != ns_qe) GNUNET_NAMESTORE_cancel (ns_qe); + if (NULL != ns_iterator) + GNUNET_NAMESTORE_zone_iteration_stop (ns_iterator); if (NULL != namestore_handle) GNUNET_NAMESTORE_disconnect (namestore_handle); if (NULL != identity_handle) @@ -103,6 +115,58 @@ store_attr_cont (void *cls, GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); } +static void +store_abe_cont (void *cls, + int32_t success, + const char*emsg) +{ + if (GNUNET_SYSERR == success) { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "%s\n", emsg); + } else { + GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, + "Bootstrapped ABE master key. Please run command again.\n"); + } + GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); +} + +static void +iter_error (void *cls) +{ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to iterate over attributes\n"); + GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); +} + +static void +iter_finished (void *cls) +{ + GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); +} + +static void +iter_cb (void *cls, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, + const char *label, + unsigned int rd_count, + const struct GNUNET_GNSRECORD_Data *rd) +{ + int i; + char *attr_value; + + for (i=0;i