gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated (e04be72 -> c5f1bf0)


From: gnunet
Subject: [taler-anastasis] branch master updated (e04be72 -> c5f1bf0)
Date: Tue, 19 May 2020 14:20:00 +0200

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

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

    from e04be72  pitch video
     new 22b01fd  worked on splitter
     new 646d607  added api for config
     new c5f1bf0  added professional presentation

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 doc/anastasis.pdf                                  | Bin 0 -> 1775690 bytes
 src/backend/Makefile.am                            |   1 +
 src/backend/anastasis-httpd.c                      |  25 ++-
 src/backend/anastasis-httpd.h                      |   5 +
 ...asis-httpd_terms.c => anastasis-httpd_config.c} |  24 +--
 ...asis-httpd_terms.h => anastasis-httpd_config.h} |  22 +--
 src/backend/anastasis-httpd_terms.c                |   3 +-
 src/backend/anastasis-httpd_terms.h                |   2 +-
 src/cli/Makefile.am                                |   2 +-
 src/cli/anastasis-cli-splitter.c                   | 185 +++++++++++++++++++--
 src/include/anastasis_service.h                    |  62 +++++++
 src/lib/Makefile.am                                |   1 +
 ...anastasis_api_salt.c => anastasis_api_config.c} |  97 +++++------
 src/lib/anastasis_api_salt.c                       |   2 +-
 src/lib/test_anastasis_api.conf                    |   2 +
 15 files changed, 345 insertions(+), 88 deletions(-)
 create mode 100644 doc/anastasis.pdf
 copy src/backend/{anastasis-httpd_terms.c => anastasis-httpd_config.c} (75%)
 copy src/backend/{anastasis-httpd_terms.h => anastasis-httpd_config.h} (74%)
 copy src/lib/{anastasis_api_salt.c => anastasis_api_config.c} (60%)

diff --git a/doc/anastasis.pdf b/doc/anastasis.pdf
new file mode 100644
index 0000000..fd96681
Binary files /dev/null and b/doc/anastasis.pdf differ
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index 28b892a..975f2dd 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -19,6 +19,7 @@ anastasis_httpd_SOURCES = \
   anastasis-httpd_salt.c anastasis-httpd_salt.h \
   anastasis-httpd_truth.c anastasis-httpd_truth.h \
   anastasis-httpd_terms.c anastasis-httpd_terms.h \
+  anastasis-httpd_config.c anastasis-httpd_config.h \
   anastasis-httpd_truth_upload.c
 
 anastasis_httpd_LDADD = \
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index 52a0201..11d48b5 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  (C) 2019 Taler Systems SA
+  (C) 2020 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU Affero General Public License as published by the Free 
Software
@@ -17,6 +17,8 @@
  * @file backup/anastasis-httpd.c
  * @brief HTTP serving layer intended to provide basic backup operations
  * @author Christian Grothoff
+ * @author Dennis Neufeld
+ * @author Dominik Meister
  */
 #include "platform.h"
 #include <microhttpd.h>
@@ -30,6 +32,7 @@
 #include "anastasis-httpd_truth.h"
 #include "anastasis-httpd_salt.h"
 #include "anastasis-httpd_terms.h"
+#include "anastasis-httpd_config.h"
 
 
 /**
@@ -42,6 +45,11 @@
  */
 unsigned long long int AH_upload_limit_mb;
 
+/**
+ * Supported methods.
+ */
+char *AH_supported_methods;
+
 /**
  * Annual fee for the backup account.
  */
@@ -225,6 +233,9 @@ url_handler (void *cls,
     { "/terms", MHD_HTTP_METHOD_GET, "text/plain",
       NULL, 0,
       &AH_handler_terms, MHD_HTTP_OK },
+    { "/config", MHD_HTTP_METHOD_GET, "text/plain",
+      NULL, 0,
+      &AH_handler_config, MHD_HTTP_OK },
     {NULL, NULL, NULL, NULL, 0, 0 }
   };
   static struct TMH_RequestHandler h404 = {
@@ -609,6 +620,18 @@ run (void *cls,
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_string (config,
+                                             "anastasis",
+                                             "SUPPORTED_METHODS",
+                                             &AH_supported_methods))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "anastasis",
+                               "SUPPORTED_METHODS");
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
 
   /* setup HTTP client event loop */
   AH_ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
diff --git a/src/backend/anastasis-httpd.h b/src/backend/anastasis-httpd.h
index 14c6230..1f78555 100644
--- a/src/backend/anastasis-httpd.h
+++ b/src/backend/anastasis-httpd.h
@@ -151,6 +151,11 @@ extern struct TALER_Amount AH_annual_fee;
  */
 extern char *AH_backend_url;
 
+/**
+ * Supported methods.
+ */
+extern char *AH_supported_methods;
+
 /**
  * Our fulfillment URL
  */
diff --git a/src/backend/anastasis-httpd_terms.c 
b/src/backend/anastasis-httpd_config.c
similarity index 75%
copy from src/backend/anastasis-httpd_terms.c
copy to src/backend/anastasis-httpd_config.c
index ede38c6..a33ef56 100644
--- a/src/backend/anastasis-httpd_terms.c
+++ b/src/backend/anastasis-httpd_config.c
@@ -14,18 +14,18 @@
   Anastasis; see the file COPYING.GPL.  If not, see 
<http://www.gnu.org/licenses/>
 */
 /**
- * @file backend/anastasis-httpd_terms.c
+ * @file backend/anastasis-httpd_config.c
  * @brief headers for /terms handler
  * @author Christian Grothoff
  * @author Dennis Neufeld
  * @author Dominik Meister
  */
 #include "platform.h"
-#include "anastasis-httpd_terms.h"
+#include "anastasis-httpd_config.h"
 #include <taler/taler_json_lib.h>
 
 /**
- * Manages a /terms call.
+ * Manages a /config call.
  *
  * @param rh context of the handler
  * @param connection the MHD connection to handle
@@ -35,16 +35,18 @@
  * @param mi merchant backend instance, never NULL
  * @return MHD result code
  */
-int
-AH_handler_terms (struct TMH_RequestHandler *rh,
-                  struct MHD_Connection *connection,
-                  void **connection_cls,
-                  const char *upload_data,
-                  size_t *upload_data_size)
+MHD_RESULT
+AH_handler_config (struct TMH_RequestHandler *rh,
+                   struct MHD_Connection *connection,
+                   void **connection_cls,
+                   const char *upload_data,
+                   size_t *upload_data_size)
 {
   return TALER_MHD_reply_json_pack (connection,
                                     MHD_HTTP_OK,
-                                    "{s:I, s:o, s:s}",
+                                    "{s:s, s:I, s:o, s:s}",
+                                    "methods",
+                                    AH_supported_methods,
                                     "storage_limit_in_megabytes",
                                     (json_int_t) AH_upload_limit_mb,
                                     "annual_fee",
@@ -53,4 +55,4 @@ AH_handler_terms (struct TMH_RequestHandler *rh,
                                     "0.0");
 }
 
-/* end of anastasis-httpd_terms.c */
\ No newline at end of file
+/* end of anastasis-httpd_config.c */
\ No newline at end of file
diff --git a/src/backend/anastasis-httpd_terms.h 
b/src/backend/anastasis-httpd_config.h
similarity index 74%
copy from src/backend/anastasis-httpd_terms.h
copy to src/backend/anastasis-httpd_config.h
index 7d61cbf..f096369 100644
--- a/src/backend/anastasis-httpd_terms.h
+++ b/src/backend/anastasis-httpd_config.h
@@ -14,19 +14,19 @@
   Anastasis; see the file COPYING.GPL.  If not, see 
<http://www.gnu.org/licenses/>
 */
 /**
- * @file backend/anastasis-httpd_terms.h
+ * @file backend/anastasis-httpd_config.h
  * @brief headers for /terms handler
  * @author Christian Grothoff
  * @author Dennis Neufeld
  * @author Dominik Meister
  */
-#ifndef ANASTASIS_HTTPD_TERMS_H
-#define ANASTASIS_HTTPD_TERMS_H
+#ifndef ANASTASIS_HTTPD_CONFIG_H
+#define ANASTASIS_HTTPD_CONFIG_H
 #include <microhttpd.h>
 #include "anastasis-httpd.h"
 
 /**
- * Manages a /terms call.
+ * Manages a /config call.
  *
  * @param rh context of the handler
  * @param connection the MHD connection to handle
@@ -35,13 +35,13 @@
  * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
  * @return MHD result code
  */
-int
-AH_handler_terms (struct TMH_RequestHandler *rh,
-                  struct MHD_Connection *connection,
-                  void **connection_cls,
-                  const char *upload_data,
-                  size_t *upload_data_size);
+MHD_RESULT
+AH_handler_config (struct TMH_RequestHandler *rh,
+                   struct MHD_Connection *connection,
+                   void **connection_cls,
+                   const char *upload_data,
+                   size_t *upload_data_size);
 
 #endif
 
-/* end of anastasis-httpd_terms.h */
\ No newline at end of file
+/* end of anastasis-httpd_config.h */
\ No newline at end of file
diff --git a/src/backend/anastasis-httpd_terms.c 
b/src/backend/anastasis-httpd_terms.c
index ede38c6..999e68f 100644
--- a/src/backend/anastasis-httpd_terms.c
+++ b/src/backend/anastasis-httpd_terms.c
@@ -35,13 +35,14 @@
  * @param mi merchant backend instance, never NULL
  * @return MHD result code
  */
-int
+MHD_RESULT
 AH_handler_terms (struct TMH_RequestHandler *rh,
                   struct MHD_Connection *connection,
                   void **connection_cls,
                   const char *upload_data,
                   size_t *upload_data_size)
 {
+  // FIXME AGB
   return TALER_MHD_reply_json_pack (connection,
                                     MHD_HTTP_OK,
                                     "{s:I, s:o, s:s}",
diff --git a/src/backend/anastasis-httpd_terms.h 
b/src/backend/anastasis-httpd_terms.h
index 7d61cbf..8d918d9 100644
--- a/src/backend/anastasis-httpd_terms.h
+++ b/src/backend/anastasis-httpd_terms.h
@@ -35,7 +35,7 @@
  * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
  * @return MHD result code
  */
-int
+MHD_RESULT
 AH_handler_terms (struct TMH_RequestHandler *rh,
                   struct MHD_Connection *connection,
                   void **connection_cls,
diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index 4860ff7..f0b2d15 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -1,5 +1,5 @@
 # This Makefile.am is in the public domain
-AM_CPPFLAGS = -I$(top_srcdir)/src/include
+AM_CPPFLAGS = -I$(top_srcdir)/src/include 
 
 bin_PROGRAMS = \
   anastasis-splitter \
diff --git a/src/cli/anastasis-cli-splitter.c b/src/cli/anastasis-cli-splitter.c
index d7033d2..69d82d8 100644
--- a/src/cli/anastasis-cli-splitter.c
+++ b/src/cli/anastasis-cli-splitter.c
@@ -171,6 +171,39 @@ struct SaltState
   struct ANASTASIS_CRYPTO_SaltP salt;
 };
 
+/**
+ * State for a "get config" CMD.
+ */
+struct ConfigState
+{
+  /**
+   * URL of the anastasis backend.
+   */
+  const char *anastasis_url;
+
+  /**
+   * Expected status code.
+   */
+  unsigned int http_status;
+
+  /**
+   * The /config GET operation handle.
+   */
+  struct ANASTASIS_ConfigOperation *co;
+
+  /**
+   * Cost.
+   */
+  struct TALER_Amount cost;
+
+  /**
+   * Supported methods.
+   */
+  const char *methods;
+
+  // FIXME add configs
+};
+
 /**
  * Global option '--me' to import json containing details of user.
  */
@@ -243,6 +276,53 @@ salt_cb (void *cls,
 }
 
 
+/**
+ * Function called with the results of a #ANASTASIS_get_config().
+ *
+ * @param cls closure
+ * @param http_status HTTP status of the request
+ * @param cost Cost of this service
+ * @param methods supported methods by this provider
+ */
+static void
+config_cb (void *cls,
+           unsigned int http_status,
+           const char *methods,
+           const struct TALER_Amount *cost)
+{
+  struct ConfigState *cs = cls;
+
+  cs->co = NULL;
+  if (http_status != cs->http_status)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Unexpected response code %u in %s:%u\n",
+                http_status,
+                __FILE__,
+                __LINE__);
+    return;
+  }
+  if (NULL == cost)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Cost is NULL in %s:%u\n",
+                __FILE__,
+                __LINE__);
+    return;
+  }
+  if (NULL == methods)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Methods is NULL in %s:%u\n",
+                __FILE__,
+                __LINE__);
+    return;
+  }
+  cs->cost = *cost;
+  cs->methods = methods;
+}
+
+
 static void
 start_read_keyboard (void);
 
@@ -320,15 +400,13 @@ read_keyboard_command (void *cls)
       for (unsigned int i = 0; i < tu_states_length; i++)
       {
         if (NULL != tu_states[i].backend_url)
-          printf ("server#%u: %s, %s, insured up to: %s, cost: %s\n",
+          printf ("server#%u: %s %s, insured up to: %s, cost: %s\n",
                   i,
                   tu_states[i].backend_url,
                   tu_states[i].backend_methods,
-                  "test_insurance", // FIXME
-                  "test_cost" // FIXME
-                  /* FIXME
-                  TALER_amount_to_string (tu_states[i].backend_insurance),
-                  TALER_amount_to_string (tu_states[i].backend_cost)*/);
+                  "test_insurance_amount", // FIXME
+                  TALER_amount_to_string (tu_states[i].backend_cost)
+                  );
       }
     }
     else
@@ -346,14 +424,17 @@ read_keyboard_command (void *cls)
     // FIXME "server add" logic here
     struct TruthUploadState tus;
     struct SaltState *ss;
+    struct ConfigState *cs;
     size_t url_len = characters - strlen ("server add ");
 
     ss = GNUNET_new (struct SaltState);
-    char *url_delim = &buffer[strlen ("server add ")];
+    cs = GNUNET_new (struct ConfigState);
+    char *url = &buffer[strlen ("server add ")];
     tus.backend_url = GNUNET_malloc (url_len);
     strncpy (tus.backend_url,
-             url_delim,
+             url,
              url_len);
+
     ss->anastasis_url = tus.backend_url;
     ss->http_status = MHD_HTTP_OK;
     ss->so = ANASTASIS_salt (ctx,
@@ -365,13 +446,29 @@ read_keyboard_command (void *cls)
       GNUNET_break (0);
       return;
     }
-
     tus.backend_salt = &ss->salt;
 
-    // FIXME /terms request here, DELETE next 3 lines!
-    tus.backend_methods = "Secure-Question";
-    // TALER_amount_get_zero ("KUDOS", tus.backend_insurance);
-    // TALER_amount_get_zero ("KUDOS", tus.backend_cost);
+    cs->anastasis_url = tus.backend_url;
+    cs->http_status = MHD_HTTP_OK;
+    /* FIXME: undefined reference to ANASTASIS_get_config
+    cs->co = ANASTASIS_get_config (ctx,
+                                   tus.backend_url,
+                                   config_cb,
+                                   cs); */
+    // FIXME: DELETE THIS, WHEN ABOVE IS FIXED_
+    cs->methods = "question"; // FIXME
+    TALER_string_to_amount ("EUR:3.99",
+                            &cs->cost);
+    /* FIXME: Uncomment this when aboce is fixed
+    if (NULL == cs->co)
+    {
+      GNUNET_break (0);
+      return;
+    }*/
+
+    tus.backend_methods = cs->methods;
+    tus.backend_cost = &cs->cost;
+    // FIXME add config max insurance amount
 
     GNUNET_array_append (tu_states,
                          tu_states_length,
@@ -425,6 +522,66 @@ read_keyboard_command (void *cls)
     if (NULL != tu_states)
     {
       // FIXME
+      char *truth_details = &buffer[strlen ("truth add ")];
+      char *token = strtok (truth_details, " ");
+      int server_num;
+
+      if (0 == strncmp ("server#",
+                        token,
+                        strlen ("server#")))
+      {
+        server_num = (int) token[strlen ("server#x")];
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "At %s:%d server is %s\n", __FILE__, __LINE__,
+                    token);
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "At %s:%d server number is %u\n", __FILE__, __LINE__,
+                    server_num);
+        token = strtok (NULL, " ");
+        char *method = GNUNET_malloc (strlen (token));
+        strcpy (method, token);
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "At %s:%d method is %s\n", __FILE__, __LINE__,
+                    method);
+
+        if (NULL != strstr (tu_states[server_num].backend_methods,
+                            method))
+        {
+          if (0 == strcmp ("question", method))
+          {
+            token = strtok (NULL, " ");
+            char *question = GNUNET_malloc (strlen (token));
+            strcpy (question, token);
+            GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                        "At %s:%d question is %s\n", __FILE__, __LINE__,
+                        question);
+
+            token = strtok (NULL, " ");
+            char *answer = GNUNET_malloc (strlen (token));
+            strcpy (answer, token);
+            GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                        "At %s:%d answer is %s\n", __FILE__, __LINE__,
+                        answer);
+
+            tu_states[server_num].method = "Secure-Question";
+            tu_states[server_num].secret_question = question;
+            tu_states[server_num].secret_answer = answer;
+          }
+          if (0 == strcmp ("sms", method))
+          {
+            char *phone = strtok (NULL, " ");
+            tu_states[server_num].method = "SMS";
+            tu_states[server_num].phone = phone;
+          }
+        }
+        else
+          printf ("Sorry, server#%u does not support '%s'\n",
+                  server_num,
+                  method);
+      }
+
+
+
     }
     else
       printf ("Please add a server before!\n");
@@ -442,7 +599,7 @@ read_keyboard_command (void *cls)
     // FIXME "truth add question" logic here
     if (NULL != tu_states)
     {
-      // FIXME
+
     }
     else
       printf ("Please add a server before!\n");
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index ad1a9aa..64ce9f6 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -249,6 +249,68 @@ struct ANASTASIS_UploadDetails
 };
 
 
+typedef void
+(*ANASTASIS_ConfigCallback)(void *cls,
+                            unsigned int http_status,
+                            const char *methods,
+                            const struct TALER_Amount *cost);
+
+
+struct ANASTASIS_ConfigOperation *
+ANASTASIS_get_config (struct GNUNET_CURL_Context *ctx,
+                      const char *base_url,
+                      ANASTASIS_ConfigCallback cb,
+                      void *cb_cls);
+
+
+void
+ANASTASIS_config_cancel (struct ANASTASIS_ConfigOperation *co);
+
+
+/**
+ * @brief A Contract Operation Handle
+ */
+struct ANASTASIS_ConfigOperation
+{
+  /**
+   * The url for this request.
+   */
+  char *url;
+
+  /**
+   * Handle for the request.
+   */
+  struct GNUNET_CURL_Job *job;
+
+  /**
+   * Reference to the execution context.
+   */
+  struct GNUNET_CURL_Context *ctx;
+
+  /**
+  * The callback to pass the backend response to
+  */
+  ANASTASIS_ConfigCallback cb;
+
+  /**
+   * Closure for @a cb.
+   */
+  void *cb_cls;
+
+  /**
+   * Cost.
+   */
+  struct TALER_Amount cost;
+
+  /**
+   * Supported methods.
+   */
+  const char *methods;
+
+  // FIXME add configs
+};
+
+
 typedef void
 (*ANASTASIS_SaltCallback)(void *cls,
                           unsigned int http_status,
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index de8cf44..2123a29 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -18,6 +18,7 @@ libanastasisrest_la_LDFLAGS = \
   -no-undefined
 libanastasisrest_la_SOURCES = \
   anastasis_api_salt.c \
+  anastasis_api_config.c \
   anastasis_api_policy_store.c \
   anastasis_api_truth_store.c \
   anastasis_api_policy_lookup.c \
diff --git a/src/lib/anastasis_api_salt.c b/src/lib/anastasis_api_config.c
similarity index 60%
copy from src/lib/anastasis_api_salt.c
copy to src/lib/anastasis_api_config.c
index eac5e9e..aefcd45 100644
--- a/src/lib/anastasis_api_salt.c
+++ b/src/lib/anastasis_api_config.c
@@ -14,9 +14,11 @@
   Anastasis; see the file COPYING.GPL.  If not, see 
<http://www.gnu.org/licenses/>
 */
 /**
- * @file lib/anastasis_api_salt.c
- * @brief Implementation of the /salt GET
+ * @file lib/anastasis_api_config.c
+ * @brief Implementation of the /config GET
  * @author Christian Grothoff
+ * @author Dennis Neufeld
+ * @author Dominik Meister
  */
 #include "platform.h"
 #include <curl/curl.h>
@@ -31,32 +33,34 @@
 
 /**
  * Function called when we're done processing the
- * HTTP /salt request.
+ * HTTP /config request.
  *
- * @param cls the `struct ANASTASIS_SaltOperation`
+ * @param cls the `struct ANASTASIS_ConfigOperation`
  * @param response_code HTTP response code, 0 on error
  * @param response parsed JSON result, NULL on error
  */
 static void
-handle_salt_finished (void *cls,
-                      long response_code,
-                      const void *response)
+handle_config_finished (void *cls,
+                        long response_code,
+                        const void *response)
 {
-  struct ANASTASIS_SaltOperation *so = cls;
+  struct ANASTASIS_ConfigOperation *co = cls;
   const json_t *json = response;
 
-  so->job = NULL;
+  co->job = NULL;
   switch (response_code)
   {
   case 0:
     /* Hard error */
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Backend didn't even return from GET /policy\n");
+                "Backend didn't even return from GET /config\n");
     break;
   case MHD_HTTP_OK:
     {
       struct GNUNET_JSON_Specification spec[] = {
-        GNUNET_JSON_spec_fixed_auto ("server_salt", &so->salt),
+        GNUNET_JSON_spec_string ("methods", &co->methods),
+        GNUNET_JSON_spec_fixed_auto ("annual_fee", &co->cost),
+        // FIXME add configs
         GNUNET_JSON_spec_end ()
       };
 
@@ -69,15 +73,13 @@ handle_salt_finished (void *cls,
         return;
       }
 
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "At %s:%d Server Salt from Download is %s-%llu b\n", 
__FILE__,
-                  __LINE__,
-                  TALER_B2S (&so->salt),
-                  (unsigned long long) sizeof (so->salt));
-      so->cb (so->cb_cls,
+      co->cb (co->cb_cls,
               response_code,
-              &so->salt);
-      ANASTASIS_salt_cancel (so);
+              co->methods,
+              &co->cost
+              // FIXME add configs
+              );
+      ANASTASIS_config_cancel (co);
       return;
     }
   case MHD_HTTP_BAD_REQUEST:
@@ -100,53 +102,54 @@ handle_salt_finished (void *cls,
     response_code = 0;
     break;
   }
-  if (NULL != so->cb)
+  if (NULL != co->cb)
   {
-    so->cb (so->cb_cls,
+    co->cb (co->cb_cls,
             response_code,
+            NULL,
             NULL);
-    so->cb = NULL;
+    co->cb = NULL;
   }
-  ANASTASIS_salt_cancel (so);
+  ANASTASIS_config_cancel (co);
 }
 
 
-struct ANASTASIS_SaltOperation *
-ANASTASIS_salt (struct GNUNET_CURL_Context *ctx,
-                const char *base_url,
-                ANASTASIS_SaltCallback cb,
-                void *cb_cls)
+struct ANASTASIS_ConfigOperation *
+ANASTASIS_config (struct GNUNET_CURL_Context *ctx,
+                  const char *base_url,
+                  ANASTASIS_ConfigCallback cb,
+                  void *cb_cls)
 {
-  struct ANASTASIS_SaltOperation *so;
+  struct ANASTASIS_ConfigOperation *co;
   CURL *eh;
 
-  so = GNUNET_new (struct ANASTASIS_SaltOperation);
-  so->url = TALER_url_join (base_url,
-                            "salt",
+  co = GNUNET_new (struct ANASTASIS_ConfigOperation);
+  co->url = TALER_url_join (base_url,
+                            "config",
                             NULL);
-  so->ctx = ctx;
-  so->cb = cb;
-  so->cb_cls = cb_cls;
-  eh = ANASTASIS_curl_easy_get_ (so->url);
-  so->job = GNUNET_CURL_job_add2 (ctx,
+  co->ctx = ctx;
+  co->cb = cb;
+  co->cb_cls = cb_cls;
+  eh = ANASTASIS_curl_easy_get_ (co->url);
+  co->job = GNUNET_CURL_job_add2 (ctx,
                                   eh,
                                   GNUNET_NO,
-                                  &handle_salt_finished,
-                                  so);
-  return so;
+                                  &handle_config_finished,
+                                  co);
+  return co;
 }
 
 
 void
-ANASTASIS_salt_cancel (struct ANASTASIS_SaltOperation *so)
+ANASTASIS_config_cancel (struct ANASTASIS_ConfigOperation *co)
 {
-  if (NULL != so->job)
+  if (NULL != co->job)
   {
-    GNUNET_CURL_job_cancel (so->job);
-    so->job = NULL;
+    GNUNET_CURL_job_cancel (co->job);
+    co->job = NULL;
   }
-  GNUNET_free (so->url);
-  GNUNET_free (so);
+  GNUNET_free (co->url);
+  GNUNET_free (co);
 }
 
-/* end of anastasis_api_salt.c */
+/* end of anastasis_api_config.c */
diff --git a/src/lib/anastasis_api_salt.c b/src/lib/anastasis_api_salt.c
index eac5e9e..834b3bf 100644
--- a/src/lib/anastasis_api_salt.c
+++ b/src/lib/anastasis_api_salt.c
@@ -51,7 +51,7 @@ handle_salt_finished (void *cls,
   case 0:
     /* Hard error */
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Backend didn't even return from GET /policy\n");
+                "Backend didn't even return from GET /salt\n");
     break;
   case MHD_HTTP_OK:
     {
diff --git a/src/lib/test_anastasis_api.conf b/src/lib/test_anastasis_api.conf
index 1838b95..3a9fee2 100644
--- a/src/lib/test_anastasis_api.conf
+++ b/src/lib/test_anastasis_api.conf
@@ -42,6 +42,8 @@ ANNUAL_FEE = EUR:4.99
 # Upload limit
 UPLOAD_LIMIT_MB = 1
 
+SUPPORTED_METHODS = Secure-Question
+
 # This specifies which database the postgres backend uses.
 [anastasisdb-postgres]
 CONFIG = postgres:///anastasischeck

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



reply via email to

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