gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 02/12: worked on keyshare request


From: gnunet
Subject: [taler-anastasis] 02/12: worked on keyshare request
Date: Mon, 20 Apr 2020 09:45:57 +0200

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

dennis-neufeld pushed a commit to branch master
in repository anastasis.

commit b40824e456dae5f6111c2bfb11b9d9a6c97969bb
Author: Dennis Neufeld <address@hidden>
AuthorDate: Sat Apr 18 06:42:21 2020 +0000

    worked on keyshare request
---
 src/include/anastasis_service.h           |  18 +--
 src/include/anastasis_testing_lib.h       |  38 ++++--
 src/lib/Makefile.am                       |   3 +
 src/lib/anastasis_api_keyshare_lookup.c   | 127 +++++++++-----------
 src/lib/test_anastasis_api.c              |   4 +
 src/lib/testing_api_cmd_keyshare_lookup.c | 188 +++++++++++++++++++++++++++++-
 src/lib/testing_api_cmd_policy_lookup.c   |   2 +-
 src/lib/testing_api_cmd_truth_store.c     |   2 +
 src/lib/testing_api_trait_uuid.c          |  74 ++++++++++++
 9 files changed, 367 insertions(+), 89 deletions(-)

diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index cb40706..3e5cc34 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -469,13 +469,13 @@ typedef void
  * @return handle for this operation, NULL upon errors
  */
 struct ANASTASIS_KeyShareLookupOperation *
-ANASTASIS_key_share_lookup (struct GNUNET_CURL_Context *ctx,
-                            const char *backend_url,
-                            uuid_t *truth_uuid,
-                            const struct ANASTASIS_CRYPTO_TruthKey *truth_key,
-                            const struct GNUNET_HashCode *hashed_answer,
-                            ANASTASIS_KeyShareLookupCallback cb,
-                            void *cb_cls);
+ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context *ctx,
+                           const char *backend_url,
+                           uuid_t *truth_uuid,
+                           const struct ANASTASIS_CRYPTO_TruthKey *truth_key,
+                           const struct GNUNET_HashCode *hashed_answer,
+                           ANASTASIS_KeyShareLookupCallback cb,
+                           void *cb_cls);
 
 
 /**
@@ -484,8 +484,8 @@ ANASTASIS_key_share_lookup (struct GNUNET_CURL_Context *ctx,
  * @param tlo cancel the truth lookup operation
  */
 void
-ANASTASIS_key_share_lookup_cancel (struct
-                                   ANASTASIS_KeyShareLookupOperation *kslo);
+ANASTASIS_keyshare_lookup_cancel (struct
+                                  ANASTASIS_KeyShareLookupOperation *kslo);
 
 /**
  * Handle for a POST /truth operation.
diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index e7db0d9..d54c276 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -157,6 +157,30 @@ ANASTASIS_TESTING_make_trait_payment_identifier (unsigned 
int index,
                                                  const struct
                                                  ANASTASIS_PaymentSecretP *h);
 
+/**
+ * Obtain an uuid from @a cmd.
+ *
+ * @param cmd command to extract the number from.
+ * @param index the number's index number.
+ * @param u[out] set to the number coming from @a cmd.
+ * @return #GNUNET_OK on success.
+ */
+int
+ANASTASIS_TESTING_get_trait_uuid (const struct TALER_TESTING_Command *cmd,
+                                  unsigned int index,
+                                  const uuid_t **u);
+
+/**
+ * Offer an uuid.
+ *
+ * @param index the number's index number.
+ * @param u the uuid to offer.
+ * @return #GNUNET_OK on success.
+ */
+struct TALER_TESTING_Trait
+ANASTASIS_TESTING_make_trait_uuid (unsigned int index,
+                                   const uuid_t *u);
+
 /**
  * Prepare the merchant execution.  Create tables and check if
  * the port is available.
@@ -347,20 +371,20 @@ ANASTASIS_TESTING_cmd_truth_store (const char *label,
                                    json_t *truth_data);
 
 /**
- * Make the "truth lookup" command.
+ * Make the "keyshare lookup" command.
  *
  * @param label command label
- * @param ANASTASIS_url base URL of the ANASTASIS serving
- *        the truth lookup request.
+ * @param anastasis_url base URL of the ANASTASIS serving
+ *        the keyshare lookup request.
  * @param http_status expected HTTP status.
  * @param upload_ref reference to upload command
  * @return the command
  */
 struct TALER_TESTING_Command
-ANASTASIS_TESTING_cmd_truth_lookup (const char *label,
-                                    const char *ANASTASIS_url,
-                                    unsigned int http_status,
-                                    const char *upload_ref);
+ANASTASIS_TESTING_cmd_keyshare_lookup (const char *label,
+                                       const char *anastasis_url,
+                                       unsigned int http_status,
+                                       const char *upload_ref);
 
 /**
  * Make the "salt" command.
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 2ff47a5..d6706c5 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -21,6 +21,7 @@ libanastasisrest_la_SOURCES = \
   anastasis_api_policy_store.c \
   anastasis_api_truth_store.c \
   anastasis_api_policy_lookup.c \
+  anastasis_api_keyshare_lookup.c \
   anastasis_api_curl_defaults.c anastasis_api_curl_defaults.h
 libanastasisrest_la_LIBADD = \
   -lgnunetcurl \
@@ -58,11 +59,13 @@ libanastasistesting_la_SOURCES = \
   testing_api_cmd_policy_store.c \
   testing_api_cmd_truth_store.c \
   testing_api_cmd_policy_lookup.c \
+  testing_api_cmd_keyshare_lookup.c \
   testing_api_cmd_salt.c \
   testing_api_helpers.c \
   testing_api_trait_account_pub.c \
   testing_api_trait_account_priv.c \
   testing_api_trait_payment_identifier.c \
+  testing_api_trait_uuid.c \
   testing_api_trait_hash.c
 libanastasistesting_la_LIBADD = \
   $(top_builddir)/src/lib/libanastasisrest.la \
diff --git a/src/lib/anastasis_api_keyshare_lookup.c 
b/src/lib/anastasis_api_keyshare_lookup.c
index f6d9b4d..addad7a 100644
--- a/src/lib/anastasis_api_keyshare_lookup.c
+++ b/src/lib/anastasis_api_keyshare_lookup.c
@@ -15,7 +15,7 @@
 */
 /**
  * @file lib/anastasis_api_policy_lookup.c
- * @brief Implementation of the /policy GET and POST
+ * @brief Implementation of the /policy GET
  * @author Christian Grothoff
  * @author Dennis Neufeld
  * @author Dominik Meister
@@ -51,7 +51,7 @@ struct ANASTASIS_KeyShareLookupOperation
   /**
    * Function to call with the result.
    */
-  ANASTASIS_KeyshareLookupCallback cb;
+  ANASTASIS_KeyShareLookupCallback cb;
 
   /**
    * Closure for @a cb.
@@ -86,15 +86,15 @@ struct ANASTASIS_KeyShareLookupOperation
  */
 void
 ANASTASIS_key_share_lookup_cancel (struct
-                                   ANASTASIS_KeyShareLookupOperation *klo)
+                                   ANASTASIS_KeyShareLookupOperation *kslo)
 {
-  if (NULL != klo->job)
+  if (NULL != kslo->job)
   {
-    GNUNET_CURL_job_cancel (klo->job);
-    klo->job = NULL;
+    GNUNET_CURL_job_cancel (kslo->job);
+    kslo->job = NULL;
   }
-  GNUNET_free (klo->url);
-  GNUNET_free (klo);
+  GNUNET_free (kslo->url);
+  GNUNET_free (kslo);
 }
 
 
@@ -107,9 +107,9 @@ handle_key_share_lookup_finished (void *cls,
                                   const void *data,
                                   size_t data_size)
 {
-  struct ANASTASIS_KeyshareLookupOperation *klo = cls;
+  struct ANASTASIS_KeyShareLookupOperation *kslo = cls;
 
-  klo->job = NULL;
+  kslo->job = NULL;
   switch (response_code)
   {
   case 0:
@@ -123,14 +123,14 @@ handle_key_share_lookup_finished (void *cls,
       struct ANASTASIS_KeyShareDownloadDetails kdd;
 
       /* Success, call callback with all details! */
-      memset (&dd, 0, sizeof (dd));
-      kdd.keyshare = klo->data;
-      kdd.keyshare_size = klo->data_size;
-      klo->cb (klo->cb_cls,
-               response_code,
-               &kdd);
-      klo->cb = NULL;
-      ANASTASIS_key_share_lookup_cancel (klo);
+      memset (&kdd, 0, sizeof (kdd));
+      kdd.encrypted_key_share = data;
+      kdd.encrypted_key_share_size = data_size;
+      kslo->cb (kslo->cb_cls,
+                response_code,
+                &kdd);
+      kslo->cb = NULL;
+      ANASTASIS_key_share_lookup_cancel (kslo);
       return;
     }
   case MHD_HTTP_BAD_REQUEST:
@@ -153,14 +153,14 @@ handle_key_share_lookup_finished (void *cls,
     response_code = 0;
     break;
   }
-  if (NULL != klo->cb)
+  if (NULL != kslo->cb)
   {
-    klo->cb (klo->cb_cls,
-             response_code,
-             NULL);
-    klo->cb = NULL;
+    kslo->cb (kslo->cb_cls,
+              response_code,
+              NULL);
+    kslo->cb = NULL;
   }
-  ANASTASIS_key_share_lookup_cancel (klo);
+  ANASTASIS_key_share_lookup_cancel (kslo);
 }
 
 
@@ -179,7 +179,7 @@ handle_header (char *buffer,
                size_t nitems,
                void *userdata)
 {
-  struct ANASTASIS_KeyShareLookupOperation *klo = userdata;
+  struct ANASTASIS_KeyShareLookupOperation *kslo = userdata;
   size_t total = size * nitems;
   char *ndup;
   const char *hdr_type;
@@ -203,30 +203,17 @@ handle_header (char *buffer,
   }
   if (' ' == *hdr_val)
     hdr_val++;
-  if (0 == strcasecmp (hdr_type,
-                       "Anastasis-Policy-Signature"))
-  {
-    if (GNUNET_OK !=
-        GNUNET_STRINGS_string_to_data (hdr_val,
-                                       strlen (hdr_val),
-                                       &klo->account_sig,
-                                       sizeof (struct
-                                               ANASTASIS_AccountSignatureP)))
-    {
-      GNUNET_break_op (0);
-      GNUNET_free (ndup);
-      return 0;
-    }
-  }
+
   /* FIXME: reasonable?*/
   if (0 == strcasecmp (hdr_type,
-                       "Anastasis-Previous"))
+                       "Truth-Decryption-Key"))
   {
     if (GNUNET_OK !=
         GNUNET_STRINGS_string_to_data (hdr_val,
                                        strlen (hdr_val),
-                                       &plo->anastasis_previous,
-                                       sizeof (struct GNUNET_HashCode)))
+                                       &kslo->truth_key,
+                                       sizeof (struct
+                                               ANASTASIS_CRYPTO_TruthKey)))
     {
       GNUNET_break_op (0);
       GNUNET_free (ndup);
@@ -251,25 +238,25 @@ handle_header (char *buffer,
  * @return handle for this operation, NULL upon errors
  */
 struct ANASTASIS_KeyShareLookupOperation *
-ANASTASIS_key_share_lookup (struct GNUNET_CURL_Context *ctx,
-                            const char *backend_url,
-                            uuid_t *truth_uuid,
-                            const struct ANASTASIS_CRYPTO_TruthKey *truth_key,
-                            const struct GNUNET_HashCode *hashed_answer,
-                            ANASTASIS_KeyShareLookupCallback cb,
-                            void *cb_cls)
+ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context *ctx,
+                           const char *backend_url,
+                           uuid_t *truth_uuid,
+                           const struct ANASTASIS_CRYPTO_TruthKey *truth_key,
+                           const struct GNUNET_HashCode *hashed_answer,
+                           ANASTASIS_KeyShareLookupCallback cb,
+                           void *cb_cls)
 {
-  struct ANASTASIS_KeyShareLookupOperation *klo;
+  struct ANASTASIS_KeyShareLookupOperation *kslo;
   CURL *eh;
   char *uuid_str;
   char *hashed_answer;
   char *path;
 
-  klo = GNUNET_new (struct ANASTASIS_KeyShareLookupOperation);
-  klo->ctx = ctx;
-  klo->cb = cb;
-  klo->cb_cls = cb_cls;
-  klo->truth_key = truth_key;
+  kslo = GNUNET_new (struct ANASTASIS_KeyShareLookupOperation);
+  kslo->ctx = ctx;
+  kslo->cb = cb;
+  kslo->cb_cls = cb_cls;
+  kslo->truth_key = truth_key;
   uuid_str = GNUNET_STRINGS_data_to_string_alloc (&truth_uuid,
                                                   sizeof (truth_uuid));
   hashed_answer = GNUNET_STRINGS_data_to_string_alloc (&hashed_answer,
@@ -278,11 +265,11 @@ ANASTASIS_key_share_lookup (struct GNUNET_CURL_Context 
*ctx,
                    "truth/%s",
                    uuid_str);
   GNUNET_free (uuid_str);
-  klo->url = TALER_url_join (backend_url,
-                             path,
-                             "response",
-                             hashed_answer,
-                             NULL);
+  kslo->url = TALER_url_join (backend_url,
+                              path,
+                              "response",
+                              hashed_answer,
+                              NULL);
   GNUNET_free (path);
   GNUNET_free (hashed_answer);
   eh = curl_easy_init ();
@@ -292,15 +279,15 @@ ANASTASIS_key_share_lookup (struct GNUNET_CURL_Context 
*ctx,
                                    &handle_header));
   GNUNET_assert ((CURLE_OK != curl_easy_setopt (eh,
                                                 CURLOPT_URL,
-                                                klo)));
-  klo->cb = cb;
-  klo->cb_cls = cb_cls;
-  klo->job = GNUNET_CURL_job_add_raw (ctx,
-                                      eh,
-                                      GNUNET_NO,
-                                      &handle_key_share_lookup_finished,
-                                      klo);
-  return klo;
+                                                kslo)));
+  kslo->cb = cb;
+  kslo->cb_cls = cb_cls;
+  kslo->job = GNUNET_CURL_job_add_raw (ctx,
+                                       eh,
+                                       GNUNET_NO,
+                                       &handle_key_share_lookup_finished,
+                                       kslo);
+  return kslo;
 }
 
 /* end of anastasis_api_keyshare_lookup.c */
diff --git a/src/lib/test_anastasis_api.c b/src/lib/test_anastasis_api.c
index 3483056..4b52a72 100644
--- a/src/lib/test_anastasis_api.c
+++ b/src/lib/test_anastasis_api.c
@@ -240,6 +240,10 @@ run (void *cls,
                                        ANASTASIS_TESTING_make_truth_example (
                                          "Truth method",
                                          "Truth mime")),
+    ANASTASIS_TESTING_cmd_keyshare_lookup ("keyshare-lookup-1",
+                                           anastasis_url,
+                                           MHD_HTTP_OK,
+                                           "truth-store-1"),
 
     TALER_TESTING_cmd_end ()
   };
diff --git a/src/lib/testing_api_cmd_keyshare_lookup.c 
b/src/lib/testing_api_cmd_keyshare_lookup.c
index 1fb49ee..0758e30 100644
--- a/src/lib/testing_api_cmd_keyshare_lookup.c
+++ b/src/lib/testing_api_cmd_keyshare_lookup.c
@@ -14,12 +14,196 @@
   Anastasis; see the file COPYING.GPL.  If not, see 
<http://www.gnu.org/licenses/>
 */
 /**
- * @file lib/anastasis_api_policy_lookup.c
- * @brief Implementation of the /policy GET and POST
+ * @file lib/anastasis_api_keyshare_lookup.c
+ * @brief Testing of Implementation of the /truth GET
  * @author Christian Grothoff
  * @author Dennis Neufeld
  * @author Dominik Meister
  */
 
+#include "platform.h"
+#include "anastasis_testing_lib.h"
+#include <taler/taler_util.h>
+#include <taler/taler_testing_lib.h>
+
+
+/**
+ * State for a "keyshare lookup" CMD.
+ */
+struct KeyshareLookupState
+{
+  /**
+   * The interpreter state.
+   */
+  struct TALER_TESTING_Interpreter *is;
+
+  /**
+   * URL of the anastasis backend.
+   */
+  const char *anastasis_url;
+
+  /**
+   * Expected status code.
+   */
+  unsigned int http_status;
+
+  /**
+   * The /truth GET operation handle.
+   */
+  struct ANASTASIS_KeyshareLookupOperation *kslo;
+
+  /**
+   * Identification of the Truth Object
+   */
+  const uuid_t truth_uuid;
+
+  /**
+   * Reference to upload command we expect to lookup.
+   */
+  const char *upload_reference;
+};
+
+/**
+ * Function called with the results of a #ANASTASIS_keyshare_lookup().
+ *
+ * @param cls closure
+ * @param http_status HTTP status of the request
+ * @param ud details about the lookup operation
+ */
+static void
+keyshare_lookup_cb (void *cls,
+                    unsigned int http_status,
+                    const struct ANASTASIS_DownloadDetails *dd)
+{
+  struct KeyshareLookupState *ksls = cls;
+
+  ksls->kslo = NULL;
+  if (http_status != ksls->http_status)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Unexpected response code %u to command %s in %s:%u\n",
+                http_status,
+                ksls->is->commands[ksls->is->ip].label,
+                __FILE__,
+                __LINE__);
+    TALER_TESTING_interpreter_fail (ksls->is);
+    return;
+  }
+  TALER_TESTING_interpreter_next (ksls->is);
+}
+
+
+/**
+ * Run a "keyshare lookup" CMD.
+ *
+ * @param cls closure.
+ * @param cmd command currently being run.
+ * @param is interpreter state.
+ */
+static void
+keyshare_lookup_run (void *cls,
+                     const struct TALER_TESTING_Command *cmd,
+                     struct TALER_TESTING_Interpreter *is)
+{
+  struct KeyshareLookupState *ksls = cls;
+
+  ksls->is = is;
+  if (NULL != ksls->upload_reference)
+  {
+    const struct TALER_TESTING_Command *upload_cmd;
+
+    upload_cmd = TALER_TESTING_interpreter_lookup_command
+                   (is,
+                   ksls->upload_reference);
+    if (NULL == upload_cmd)
+    {
+      GNUNET_break (0);
+      TALER_TESTING_interpreter_fail (ksls->is);
+      return;
+    }
+    if (GNUNET_OK !=
+        ANASTASIS_TESTING_get_trait_uuid (upload_cmd,
+                                          0,
+                                          &ksls->truth_uuid))
+    {
+      GNUNET_break (0);
+      TALER_TESTING_interpreter_fail (ksls->is);
+      return;
+    }
+  }
+  ksls->kslo = ANASTASIS_keyshare_lookup (is->ctx,
+                                          ksls->anastasis_url,
+                                          &ksls->anastasis_pub,
+                                          &keyshare_lookup_cb,
+                                          ksls);
+  if (NULL == ksls->kslo)
+  {
+    GNUNET_break (0);
+    TALER_TESTING_interpreter_fail (ksls->is);
+    return;
+  }
+}
+
+
+/**
+ * Free the state of a "keyshare lookup" CMD, and possibly
+ * cancel it if it did not complete.
+ *
+ * @param cls closure.
+ * @param cmd command being freed.
+ */
+static void
+keyshare_lookup_cleanup (void *cls,
+                         const struct TALER_TESTING_Command *cmd)
+{
+  struct KeyshareLookupState *ksls = cls;
+
+  if (NULL != ksls->kslo)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Command '%s' did not complete (keyshare lookup)\n",
+                cmd->label);
+    ANASTASIS_keyshare_lookup_cancel (ksls->kslo);
+    ksls->kslo = NULL;
+  }
+  GNUNET_free (ksls);
+}
+
+
+/**
+ * Make the "keyshare lookup" command.
+ *
+ * @param label command label
+ * @param anastasis_url base URL of the ANASTASIS serving
+ *        the keyshare lookup request.
+ * @param http_status expected HTTP status.
+ * @param upload_ref reference to upload command
+ * @return the command
+ */
+struct TALER_TESTING_Command
+ANASTASIS_TESTING_cmd_keyshare_lookup (const char *label,
+                                       const char *anastasis_url,
+                                       unsigned int http_status,
+                                       const char *upload_ref)
+{
+  struct KeyshareLookupState *ksls;
+
+  GNUNET_assert (NULL != upload_ref);
+  ksls = GNUNET_new (struct KeyshareLookupState);
+  ksls->http_status = http_status;
+  ksls->anastasis_url = anastasis_url;
+  ksls->upload_reference = upload_ref;
+  {
+    struct TALER_TESTING_Command cmd = {
+      .cls = ksls,
+      .label = label,
+      .run = &keyshare_lookup_run,
+      .cleanup = &keyshare_lookup_cleanup
+    };
+
+    return cmd;
+  }
+}
+
 
 /* end of testing_api_cmd_keyshare_lookup.c */
\ No newline at end of file
diff --git a/src/lib/testing_api_cmd_policy_lookup.c 
b/src/lib/testing_api_cmd_policy_lookup.c
index 4c0ceb7..744466d 100644
--- a/src/lib/testing_api_cmd_policy_lookup.c
+++ b/src/lib/testing_api_cmd_policy_lookup.c
@@ -259,7 +259,7 @@ ANASTASIS_TESTING_cmd_policy_lookup (const char *label,
  *
  * @param label command label
  * @param anastasis_url base URL of the ANASTASIS serving
- *        the policy store request.
+ *        the policy lookup request.
  * @return the command
  */
 struct TALER_TESTING_Command
diff --git a/src/lib/testing_api_cmd_truth_store.c 
b/src/lib/testing_api_cmd_truth_store.c
index e5a0c1e..3095ea6 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -318,6 +318,8 @@ truth_store_traits (void *cls,
   struct TALER_TESTING_Trait traits[] = {
     ANASTASIS_TESTING_make_trait_hash (ANASTASIS_TESTING_TRAIT_HASH_CURRENT,
                                        &tss->curr_hash),
+    ANASTASIS_TESTING_make_trait_uuid (0,
+                                       &tss->truth_uuid),
     TALER_TESTING_make_trait_order_id (0,
                                        tss->payment_order_id),
     TALER_TESTING_trait_end ()
diff --git a/src/lib/testing_api_trait_uuid.c b/src/lib/testing_api_trait_uuid.c
new file mode 100644
index 0000000..b62a5eb
--- /dev/null
+++ b/src/lib/testing_api_trait_uuid.c
@@ -0,0 +1,74 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2020 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published
+  by the Free Software Foundation; either version 3, or (at your
+  option) any later version.
+
+  TALER is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public
+  License along with TALER; see the file COPYING.  If not, see
+  <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file lib/testing_api_trait_uuid.c
+ * @brief traits to offer a hash
+ * @author Christian Grothoff
+ * @author Dominik Meister
+ * @author Dennis Neufeld
+ */
+#include "platform.h"
+#include "anastasis_testing_lib.h"
+
+#define ANASTASIS_TESTING_TRAIT_UUID "anastasis-uuid"
+
+
+/**
+ * Obtain an uuid from @a cmd.
+ *
+ * @param cmd command to extract the number from.
+ * @param index the number's index number.
+ * @param u[out] set to the number coming from @a cmd.
+ * @return #GNUNET_OK on success.
+ */
+int
+ANASTASIS_TESTING_get_trait_uuid
+  (const struct TALER_TESTING_Command *cmd,
+  unsigned int index,
+  const uuid_t **u)
+{
+  return cmd->traits (cmd->cls,
+                      (const void **) u,
+                      ANASTASIS_TESTING_TRAIT_HASH,
+                      index);
+}
+
+
+/**
+ * Offer an uuid.
+ *
+ * @param index the number's index number.
+ * @param u the uuid to offer.
+ * @return #GNUNET_OK on success.
+ */
+struct TALER_TESTING_Trait
+ANASTASIS_TESTING_make_trait_uuid
+  (unsigned int index,
+  const uuid_t *u)
+{
+  struct TALER_TESTING_Trait ret = {
+    .index = index,
+    .trait_name = ANASTASIS_TESTING_TRAIT_HASH,
+    .ptr = (const void *) u
+  };
+  return ret;
+}
+
+
+/* end of testing_api_trait_uuid.c */

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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