gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated (3e1fd2b -> a7d37bf)


From: gnunet
Subject: [taler-anastasis] branch master updated (3e1fd2b -> a7d37bf)
Date: Sat, 12 Sep 2020 11:01:47 +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 3e1fd2b  small fix indent
     new b002a8e  work on reducer
     new 1e3923c  options for reducer cli
     new 09977c9  work on reducer cli
     new 74ca69c  work on backup redux
     new 09f7a55  work on backup redux
     new 514a95b  fixed anastasis-reducer to return init state
     new a7d37bf  merge

The 7 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:
 Makefile.am                             |   4 +-
 configure.ac                            |   4 +-
 contrib/Makefile.am                     |   1 -
 contrib/pogen.sh                        |   3 +
 contrib/redux.countries.json            |  11 ++
 src/cli/Makefile.am                     |  13 +-
 src/cli/anastasis-cli-redux.c           | 326 ++++++++++++++++++++++++++++++++
 src/include/anastasis_database_lib.h    |   2 +-
 src/include/anastasis_database_plugin.h |  26 +--
 src/include/anastasis_redux.h           |   4 +-
 src/lib/Makefile.am                     |  16 +-
 src/lib/anastasis_api_backup_redux.c    | 193 +++++++++++++++----
 12 files changed, 549 insertions(+), 54 deletions(-)
 create mode 100755 contrib/pogen.sh
 create mode 100644 src/cli/anastasis-cli-redux.c

diff --git a/Makefile.am b/Makefile.am
index 3227908..6880184 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,9 +8,9 @@ else
 endif
 else
 if ENABLE_DOC
-  SUBDIRS = . src doc
+  SUBDIRS = . contrib src doc
 else
-  SUBDIRS = . src doc
+  SUBDIRS = . contrib src doc
 endif
 endif
 
diff --git a/configure.ac b/configure.ac
index 6a8b94d..547b3f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -297,7 +297,9 @@ AC_MSG_RESULT($enable_experimental)
 AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
 
 
-AC_CONFIG_FILES([Makefile
+AC_CONFIG_FILES([
+Makefile
+contrib/Makefile
 doc/Makefile
 src/Makefile
 src/util/Makefile
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 84424af..f8ea7f5 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -7,7 +7,6 @@ pkgdatadir= $(prefix)/share/anastasis/
 
 EXTRA_DIST = \
   $(pkgdata_DATA) \
-  get_version.sh \
   pogen.sh
 
 pkgdata_DATA = \
diff --git a/contrib/pogen.sh b/contrib/pogen.sh
new file mode 100755
index 0000000..89140ea
--- /dev/null
+++ b/contrib/pogen.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+find src -name "*.c" | sort  > po/POTFILES.in
+find contrib -name "*.json" | sort >> po/POTFILES.in
diff --git a/contrib/redux.countries.json b/contrib/redux.countries.json
index 1d684e2..57a0262 100644
--- a/contrib/redux.countries.json
+++ b/contrib/redux.countries.json
@@ -22,6 +22,17 @@
                                                "fr": "Allemagne",
                                                "en": "Germany" },
                "currency": "EUR"
+       },
+       { 
+               "code" : "us",
+               "name" : "United States of America (USA)",
+               "continent" : "North America",
+               "continent_i18n" : { "de" : "Nordamerika" },
+               "name_i18n" : { "de_DE":"Vereinigte Staaten von Amerika (USA)",
+                                               "de_CH":"Vereinigte Staaten von 
Amerika (USA)",
+                                               "fr": "États-Unis d'Amérique 
(USA)",
+                                               "en": "United States of America 
(USA)" },
+               "currency": "USD"
        }
     ]
 }
diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index e7352b5..a6f4409 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -3,7 +3,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include
 
 bin_PROGRAMS = \
   anastasis-splitter \
-  anastasis-assembler
+  anastasis-assembler \
+  anastasis-reducer
 
 if USE_COVERAGE
   AM_CFLAGS = --coverage -O0
@@ -44,6 +45,16 @@ anastasis_assembler_LDADD = \
   -lreadline \
   $(XLIB)
 
+anastasis_reducer_SOURCES = \
+  anastasis-cli-redux.c
+anastasis_reducer_LDADD = \
+  $(top_builddir)/src/lib/libanastasisredux.la \
+  -lgnunetjson \
+  -lgnunetcurl \
+  -lgnunetutil \
+  -ljansson \
+  $(XLIB)
+
 if HAVE_LIBCURL
 anastasis_splitter_LDADD += -lcurl
 anastasis_assembler_LDADD += -lcurl
diff --git a/src/cli/anastasis-cli-redux.c b/src/cli/anastasis-cli-redux.c
new file mode 100644
index 0000000..bd32856
--- /dev/null
+++ b/src/cli/anastasis-cli-redux.c
@@ -0,0 +1,326 @@
+/*
+  This file is part of Anastasis
+  Copyright (C) 2020 Taler Systems SA
+
+  Anastasis is free software; you can redistribute it and/or modify it under 
the
+  terms of the GNU Lesser General Public License as published by the Free 
Software
+  Foundation; either version 3, or (at your option) any later version.
+
+  Anastasis 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
+  Anastasis; see the file COPYING.GPL.  If not, see 
<http://www.gnu.org/licenses/>
+*/
+/**
+ * @file cli/anastasis-cli-redux.c
+ * @brief command line tool for our reducer
+ * @author Christian Grothoff
+ * @author Dennis Neufeld
+ * @author Dominik Meister
+ */
+
+#include "platform.h"
+#include <gnunet/gnunet_util_lib.h>
+#include <gnunet/gnunet_curl_lib.h>
+#include "anastasis_redux.h"
+
+
+/**
+ * Closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
+ */
+static struct GNUNET_CURL_RescheduleContext *rc;
+
+/**
+ * Curl context for communication with anastasis backend
+ */
+static struct GNUNET_CURL_Context *ctx;
+
+/**
+ * -b option given.
+ */
+static int b_flag;
+
+/**
+ * -r option given.
+ */
+static int r_flag;
+
+/**
+ * -i option given.
+ */
+static int i_flag;
+
+/**
+ * JSON containing previous state
+ */
+static json_t *prev_state;
+
+/**
+ * JSON containing new state
+ */
+static json_t *new_state;
+
+/**
+ * path to new state
+ */
+static char *path_new_state;
+
+/**
+ * JSON containing arguments for action
+ */
+static json_t *arguments;
+
+/**
+ * action to do with previous state
+ */
+static char *action;
+
+
+static int
+persist_new_state ()
+{
+  return json_dump_file (new_state, path_new_state, JSON_COMPACT);
+}
+
+/**
+ * Function called with the results of #ANASTASIS_backup_action
+ * or #ANASTASIS_recovery_action.
+ *
+ * @param cls closure
+ * @param error_code Error code
+ * @param new_state new state as result
+ */
+static void
+action_cb (void *cls,
+           enum ANASTASIS_ErrorCode error_code,
+           json_t *result_state)
+{
+  new_state = result_state;
+  if (NULL != new_state)
+    if (0 == persist_new_state ())
+      return;
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+              "Failed to persist new state! \n");
+  GNUNET_SCHEDULER_shutdown ();
+}
+
+/**
+ * @brief Shutdown the application.
+ *
+ * @param cls closure
+ */
+static void
+shutdown_task (void *cls)
+{
+  (void) cls;
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Shutdown initiated\n");
+
+  // FIXME shutdown routine here
+  if (NULL != rc)
+  {
+    GNUNET_CURL_gnunet_rc_destroy (rc);
+    rc = NULL;
+  }
+
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Shutdown complete\n");
+}
+
+
+/**
+ * @brief Start the application
+ *
+ * @param cls closure
+ * @param args arguments left
+ * @param cfgfile config file name
+ * @param cfg handle for the configuration file
+ */
+static void
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  (void) cls;
+  (void) args;
+  (void) cfg;
+  // FIXME: error handling json error
+  json_error_t error;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Starting anastasis-reducer\n");
+
+  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                 NULL);
+
+  GNUNET_assert (GNUNET_OK ==
+                 GNUNET_log_setup ("anastasis-reducer",
+                                   "WARNING",
+                                   NULL));
+
+  if (! (r_flag ^ b_flag ^ i_flag) || (r_flag && b_flag && i_flag))
+  {
+    printf ("Please set one option: -b, -r, -i!\n");
+    printf (
+      "Example: anastasis-reducer -b prev.json action arguments.json 
new.json\n");
+    printf ("Example: anastasis-reducer -i init.json\n");
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
+
+  if (i_flag)
+  {
+    if (args[0])
+    {
+      path_new_state = (char *) args[0];
+      new_state = ANASTASIS_backup_start (cfg);
+      if (! new_state)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "At %s:%u failed to get an initial state!\n",
+                    __FILE__,
+                    __LINE__);
+        GNUNET_SCHEDULER_shutdown ();
+        return;
+      }
+      if (! (0 == json_dump_file (new_state,
+                                  path_new_state,
+                                  JSON_COMPACT)))
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "At %s:%u failed to dump json into file!\n",
+                    __FILE__,
+                    __LINE__);
+        GNUNET_SCHEDULER_shutdown ();
+        return;
+      }
+    }
+    else
+    {
+      printf ("Please give path for json containing initial state!\n");
+      printf ("Example: anastasis-reducer -i init.json\n");
+      GNUNET_SCHEDULER_shutdown ();
+      return;
+    }
+  }
+
+  if ((r_flag ^ b_flag))
+  {
+    if (args[0])
+      prev_state = json_load_file ((char *) args[0], JSON_DECODE_ANY, &error);
+    else
+    {
+      printf ("Please give path for json containing previous state!\n");
+      printf (
+        "Example: anastasis-reducer -b prev.json action arguments.json 
new.json\n");
+      GNUNET_SCHEDULER_shutdown ();
+      return;
+    }
+
+    if (args[1])
+      action = (char *) args[1];
+    else
+    {
+      printf ("Please give an action!\n");
+      printf (
+        "Example: anastasis-reducer -b prev.json action arguments.json 
new.json\n");
+      GNUNET_SCHEDULER_shutdown ();
+      return;
+    }
+
+    if (args[2])
+      arguments = json_load_file ((char *) args[2], JSON_DECODE_ANY, &error);
+    else
+    {
+      printf ("Please give path for json containing arguments for action!\n");
+      printf (
+        "Example: anastasis-reducer -b prev.json action arguments.json 
new.json\n");
+      GNUNET_SCHEDULER_shutdown ();
+      return;
+    }
+
+    if (args[3])
+      path_new_state = (char *) args[3];
+    else
+    {
+      printf ("Please give path for json containing new state!\n");
+      printf (
+        "Example: anastasis-reducer -b prev.json action arguments.json 
new.json\n");
+      GNUNET_SCHEDULER_shutdown ();
+      return;
+    }
+  }
+
+  /* initialize HTTP client FIXME: Do we need http client?*/
+  ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
+                          &rc);
+  rc = GNUNET_CURL_gnunet_rc_create (ctx);
+
+  if (i_flag)
+  {
+    new_state = ANASTASIS_backup_start (cfg);
+    if (NULL != new_state)
+      if (0 == persist_new_state ())
+        return;
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to persist new state! \n");
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
+
+  if (b_flag)
+    ANASTASIS_backup_action (prev_state,
+                             action,
+                             arguments,
+                             &action_cb,
+                             cls);
+
+
+//   if (r_flag)
+//     ANASTASIS_recovery_action (prev_state,
+//                                action,
+//                                arguments,
+//                                &action_cb,
+//                                cls);
+}
+
+
+int
+main (int argc,
+      char *const *argv)
+{
+  int ret;
+
+  /* the available command line options */
+  struct GNUNET_GETOPT_CommandLineOption options[] = {
+    GNUNET_GETOPT_option_flag ('b',
+                               "backup",
+                               "use reducer to handle states for backup 
process",
+                               &b_flag),
+    GNUNET_GETOPT_option_flag ('r',
+                               "restore",
+                               "use reducer to handle states for restore 
process",
+                               &r_flag),
+    GNUNET_GETOPT_option_flag ('i',
+                               "init",
+                               "returns an initial state to start with",
+                               &i_flag),
+
+    GNUNET_GETOPT_OPTION_END
+  };
+
+  ret = GNUNET_PROGRAM_run (argc,
+                            argv,
+                            "anastasis-reducer",
+                            "This is an application for using Anastasis to 
handle the states.\n",
+                            options,
+                            &run,
+                            NULL);
+
+  return (GNUNET_OK == ret) ? 0 : 1;
+}
+
+/* end of anastasis-cli-redux.c */
\ No newline at end of file
diff --git a/src/include/anastasis_database_lib.h 
b/src/include/anastasis_database_lib.h
index f524fec..faf1e3f 100644
--- a/src/include/anastasis_database_lib.h
+++ b/src/include/anastasis_database_lib.h
@@ -46,7 +46,7 @@ ANASTASIS_DB_plugin_unload (struct ANASTASIS_DatabasePlugin 
*plugin);
  * of results, so all non-negative values indicate success.
  */
 enum ANASTASIS_DB_QueryStatus
-{  
+{
   /**
    * Already valid code stored under this public key, please use the valid code
    */
diff --git a/src/include/anastasis_database_plugin.h 
b/src/include/anastasis_database_plugin.h
index 8d475be..96283ac 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -380,23 +380,23 @@ struct ANASTASIS_DatabasePlugin
                     uint32_t post_counter,
                     const struct ANASTASIS_PaymentSecretP *payment_secret,
                     const struct TALER_Amount *amount);
-                    
+
   /**
-   * Verify the provided code with the code on the server. 
+   * Verify the provided code with the code on the server.
    * If the code matches the function will return with success, if the code
    * does not match, the retry counter will be decreased by one.
    *
    * @param cls closure
    * @param truth_pub identification of the challenge which the code 
corresponds to
    * @param code code which the user provided and wants to verify
-     (already verified that this is a uint64_t no checks needed) 
+     (already verified that this is a uint64_t no checks needed)
    * @return transaction status
    */
-   enum ANASTASIS_DB_QueryStatus
-   (*verify_challenge_code)(void *cls,
-                            const struct
-                            ANASTASIS_CRYPTO_TruthPublicKeyP *truth_pub,
-                            uint64_t code);
+  enum ANASTASIS_DB_QueryStatus
+  (*verify_challenge_code)(void *cls,
+                           const struct
+                           ANASTASIS_CRYPTO_TruthPublicKeyP *truth_pub,
+                           uint64_t code);
   /**
    * Insert a new challenge code for a given challenge identified by the 
challenge
    * public key. The function will first check if there is already a valid code
@@ -409,21 +409,21 @@ struct ANASTASIS_DatabasePlugin
    * @param retry_counter amount of retries allowed
    * @return transaction status
    */
- 
+
   enum ANASTASIS_DB_QueryStatus
   (*store_challenge_code)(void *cls,
                           const struct
                           ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
-                          uint64_t code, 
+                          uint64_t code,
                           struct GNUNET_TIME_Relative expiration_time,
-                          unsigned int retry_counter); 
-  
+                          unsigned int retry_counter);
+
   /**
    * FIXME maybe implemented in the postgres_gc but want it seperate first
    * Function called to remove all expired codes in the database
    * @return transaction status
    */
   enum ANASTASIS_DB_QueryStatus
-  (*challenge_gc)(void *cls);                               
+  (*challenge_gc)(void *cls);
 };
 #endif
diff --git a/src/include/anastasis_redux.h b/src/include/anastasis_redux.h
index 72ab34e..1d066e4 100644
--- a/src/include/anastasis_redux.h
+++ b/src/include/anastasis_redux.h
@@ -43,7 +43,7 @@ extern json_t *redux_id_attr;
  * @return NULL on failure
  */
 json_t *
-ANASTASIS_backup_start (void);
+ANASTASIS_backup_start (const struct GNUNET_CONFIGURATION_Handle *cfg);
 
 
 /**
@@ -52,7 +52,7 @@ ANASTASIS_backup_start (void);
  * @return NULL on failure
  */
 json_t *
-ANASTASIS_recovery_start (void);
+ANASTASIS_recovery_start (const struct GNUNET_CONFIGURATION_Handle *cfg);
 
 
 /**
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 3bf9ac8..1607748 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -11,7 +11,8 @@ endif
 lib_LTLIBRARIES = \
   libanastasisrest.la \
   libanastasis.la \
-  libanastasistesting.la
+  libanastasistesting.la \
+  libanastasisredux.la
 
 libanastasisrest_la_LDFLAGS = \
   -version-info 0:0:0 \
@@ -95,6 +96,19 @@ libanastasistesting_la_LIBADD = \
   $(XLIB)
 
 
+libanastasisredux_la_LDFLAGS = \
+  -version-info 0:0:0 \
+  -no-undefined
+libanastasisredux_la_SOURCES = \
+  anastasis_api_backup_redux.c
+libanastasisredux_la_LIBADD = \
+  -lgnunetjson \
+  -lgnunetcurl \
+  -lgnunetutil \
+  -ljansson \
+  $(XLIB)
+
+
 check_PROGRAMS = \
   test_anastasisrest_api \
   test_anastasis
diff --git a/src/lib/anastasis_api_backup_redux.c 
b/src/lib/anastasis_api_backup_redux.c
index 533b199..6acbdfa 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -50,6 +50,43 @@ typedef void
                    ANASTASIS_ActionCallback cb,
                    void *cb_cls);
 
+static int
+redux_countries_init ()
+{
+  char *dn;
+  json_error_t error;
+
+  {
+    char *path;
+
+    path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
+    if (NULL == path)
+    {
+      GNUNET_break (0);
+      return GNUNET_SYSERR;
+    }
+    GNUNET_asprintf (&dn,
+                     "%s/share/anastasis/redux.countries.json",
+                     path);
+    GNUNET_free (path);
+  }
+  redux_countries = json_load_file (dn, JSON_COMPACT, &error);
+  if (NULL == redux_countries)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to parse `%s': %s at %d:%d (%d)\n",
+                dn,
+                error.text,
+                error.line,
+                error.column,
+                error.position);
+    GNUNET_free (dn);
+    return GNUNET_SYSERR;
+  }
+  GNUNET_free (dn);
+  return GNUNET_OK;
+}
+
 /**
  * Returns an initial ANASTASIS backup state.
  *
@@ -59,36 +96,41 @@ json_t *
 ANASTASIS_backup_start (const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   json_t *initial_state;
-  const char *temp_key;
-  json_t *temp_value;
-  json_t *root = json_object_get (redux_countries, "countries");
+  json_t *temp_country;
+  size_t index;
   json_t *continents = json_array ();
+  json_t *root;
+
+  if (GNUNET_SYSERR == redux_countries_init ())
+  {
+    GNUNET_break (0);
+    return NULL;
+  }
+  root = json_object_get (redux_countries, "countries");
 
-  json_object_foreach (root, temp_key, temp_value)
+  json_array_foreach (root, index, temp_country)
   {
-    size_t index;
-    json_t *inner_temp_value;
-    bool contains = false;
-
-    if (temp_key == "continent")
-      json_array_foreach (continents,
-                          index,
-                          inner_temp_value)
+    size_t inner_index;
+    json_t *inner_continent;
+    json_t *continent = json_object_get (json_array_get (root, index),
+                                         "continent");
+
+    bool existing = false;
+    json_array_foreach (continents, inner_index, inner_continent)
+    {
+      if (1 == json_equal (continent, inner_continent))
       {
-        if (inner_temp_value == temp_value)
-        {
-          contains = true;
-          break;
-        }
+        existing = true;
+        break;
       }
-
-      if (contains)
-        json_array_append_new (continents, temp_value);
+    }
+    if (! existing)
+      json_array_append_new (continents, continent);
   }
 
-  initial_state = json_object_pack ("{s:s, s:o}",
-                                    "backup-state", "ReduxInitialBackupState",
-                                    "continents", continents);
+  initial_state = json_pack ("{s:s, s:o}",
+                             "backup-state", "ReduxInitialBackupState",
+                             "continents", continents);
   return initial_state;
 }
 
@@ -100,15 +142,20 @@ select_continent (const json_t *state,
                   void *cb_cls)
 {
   json_t *new_state;
-  const char *continent = json_string_value (json_object_get (arguments,
-                                                              "continent"));
-  if (NULL == s)
+  size_t index;
+  json_t *country;
+  json_t *continent = json_object_get (arguments, "continent");
+  json_t *root = json_object_get (redux_countries, "countries");
+  json_t *countries = json_array ();
+
+  if (NULL == state)
   {
     GNUNET_break (0);
     cb (cb_cls,
-        error);
+        ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+        NULL);
   }
-  if (continent - not - in - array)
+  if (NULL == continent)
   {
     GNUNET_break (0);
     cb (cb_cls,
@@ -116,14 +163,34 @@ select_continent (const json_t *state,
         NULL);
   }
   new_state = json_deep_copy (state);
-  // FIXME: get list of countries for 'continent'
+
+  json_array_foreach (root, index, country)
+  {
+    size_t inner_index;
+    json_t *inner_country;
+    json_t *temp_continent = json_object_get (json_array_get (root, index),
+                                              "continent");
+
+    bool existing = false;
+    json_array_foreach (countries, inner_index, inner_country)
+    {
+      if (1 == json_equal (continent, temp_continent))
+      {
+        existing = true;
+        break;
+      }
+    }
+    if (! existing)
+      json_array_append_new (countries, country);
+  }
+
   json_object_set_new (new_state,
                        "countries",
                        countries);
   // optional:
   json_object_set_new (new_state,
                        "continent",
-                       json_string (continent));
+                       continent);
   cb (cb_cls,
       ANASTASIS_EC_NONE,
       new_state);
@@ -131,6 +198,46 @@ select_continent (const json_t *state,
 }
 
 
+static void
+select_country (const json_t *state,
+                const json_t *arguments,
+                ANASTASIS_ActionCallback cb,
+                void *cb_cls)
+{
+
+}
+
+
+static void
+enter_user_attributes (const json_t *state,
+                       const json_t *arguments,
+                       ANASTASIS_ActionCallback cb,
+                       void *cb_cls)
+{
+
+}
+
+
+static void
+add_authentication (const json_t *state,
+                    const json_t *arguments,
+                    ANASTASIS_ActionCallback cb,
+                    void *cb_cls)
+{
+
+}
+
+
+static void
+add_policy (const json_t *state,
+            const json_t *arguments,
+            ANASTASIS_ActionCallback cb,
+            void *cb_cls)
+{
+
+}
+
+
 /**
  * Operates on a backup state depending on given #ANASTASIS_BackupState
  * and #ANASTASIS_BackupAction. The new #ANASTASIS_BackupState is returned
@@ -162,6 +269,26 @@ ANASTASIS_backup_action (const json_t *state,
       "selection_continent",
       &select_continent
     },
+    {
+      "ReduxContinentSelectedState",
+      "selection_country",
+      &select_country
+    },
+    {
+      "ReduxCountrySelectedState",
+      "entering_user_attributes",
+      &enter_user_attributes
+    },
+    {
+      "ReduxUserAttributesAddedState",
+      "adding_authentication",
+      &add_authentication
+    },
+    {
+      "ReduxAuthenticationAddedState",
+      "adding_policy",
+      &add_policy
+    },
     { NULL, NULL, NULL }
   };
   const char *s = json_string_value (json_object_get (state,
@@ -170,7 +297,8 @@ ANASTASIS_backup_action (const json_t *state,
   {
     GNUNET_break (0);
     cb (cb_cls,
-        error);
+        ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+        NULL);
   }
   for (unsigned int i = 0; NULL != dispatchers[i].fun; i++)
   {
@@ -183,6 +311,7 @@ ANASTASIS_backup_action (const json_t *state,
   }
   GNUNET_break (0);
   cb (cb_cls,
-      error);
+      ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+      NULL);
 
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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