gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: -get anastasis-helper-authoriza


From: gnunet
Subject: [taler-anastasis] branch master updated: -get anastasis-helper-authorization-iban to build
Date: Wed, 18 Aug 2021 17:38:01 +0200

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

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 5f28873  -get anastasis-helper-authorization-iban to build
5f28873 is described below

commit 5f288737d51441694b2c25a6e6591cf2735b0730
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Aug 18 17:37:58 2021 +0200

    -get anastasis-helper-authorization-iban to build
---
 src/authorization/.gitignore                       |  1 +
 src/authorization/Makefile.am                      | 20 ++++++++
 .../anastasis-helper-authorization-iban.c          | 60 ++++++++++++----------
 src/authorization/libanastasiseufin/lae_credit.c   | 12 ++---
 src/include/anastasis_eufin_lib.h                  |  7 ++-
 src/include/anastasis_util_lib.h                   |  7 +++
 src/include/platform.h                             | 27 ++++++++++
 7 files changed, 97 insertions(+), 37 deletions(-)

diff --git a/src/authorization/.gitignore b/src/authorization/.gitignore
new file mode 100644
index 0000000..0aebea9
--- /dev/null
+++ b/src/authorization/.gitignore
@@ -0,0 +1 @@
+anastasis-helper-authorization-iban
diff --git a/src/authorization/Makefile.am b/src/authorization/Makefile.am
index 5cf6db1..15b16d1 100644
--- a/src/authorization/Makefile.am
+++ b/src/authorization/Makefile.am
@@ -23,6 +23,22 @@ if USE_COVERAGE
   XLIB = -lgcov
 endif
 
+bin_PROGRAMS = \
+  anastasis-helper-authorization-iban
+
+anastasis_helper_authorization_iban_SOURCES = \
+  anastasis-helper-authorization-iban.c
+anastasis_helper_authorization_iban_LDADD = \
+  $(top_builddir)/src/stasis/libanastasisdb.la \
+  $(top_builddir)/src/authorization/libanastasiseufin/libanastasiseufin.la \
+  $(top_builddir)/src/util/libanastasisutil.la \
+  -lgnunetcurl \
+  -lgnunetutil \
+  -ljansson \
+  -lmicrohttpd \
+  -lpthread
+
+
 lib_LTLIBRARIES = \
   libanastasisauthorization.la
 
@@ -51,6 +67,7 @@ libanastasis_plugin_authorization_file_la_LIBADD = \
   $(LTLIBINTL)
 libanastasis_plugin_authorization_file_la_LDFLAGS = \
   $(ANASTASIS_PLUGIN_LDFLAGS) \
+  $(top_builddir)/src/stasis/libanastasisdb.la \
   -ltalerjson \
   -ltalermhd \
   -ltalerutil \
@@ -66,6 +83,7 @@ libanastasis_plugin_authorization_email_la_LIBADD = \
   $(LTLIBINTL)
 libanastasis_plugin_authorization_email_la_LDFLAGS = \
   $(ANASTASIS_PLUGIN_LDFLAGS) \
+  $(top_builddir)/src/stasis/libanastasisdb.la \
   -ltalerjson \
   -ltalermhd \
   -ltalerutil \
@@ -97,6 +115,7 @@ libanastasis_plugin_authorization_post_la_LIBADD = \
   $(LTLIBINTL)
 libanastasis_plugin_authorization_post_la_LDFLAGS = \
   $(ANASTASIS_PLUGIN_LDFLAGS) \
+  $(top_builddir)/src/stasis/libanastasisdb.la \
   -ltalerjson \
   -ltalermhd \
   -ltalerutil \
@@ -112,6 +131,7 @@ libanastasis_plugin_authorization_sms_la_LIBADD = \
   $(LTLIBINTL)
 libanastasis_plugin_authorization_sms_la_LDFLAGS = \
   $(ANASTASIS_PLUGIN_LDFLAGS) \
+  $(top_builddir)/src/stasis/libanastasisdb.la \
   -ltalerjson \
   -ltalermhd \
   -ltalerutil \
diff --git a/src/authorization/anastasis-helper-authorization-iban.c 
b/src/authorization/anastasis-helper-authorization-iban.c
index 946b008..066b4cb 100644
--- a/src/authorization/anastasis-helper-authorization-iban.c
+++ b/src/authorization/anastasis-helper-authorization-iban.c
@@ -25,13 +25,14 @@
  * - needs to add DB triggers to notify main service of inbound activity
  */
 #include "platform.h"
+#include "anastasis_eufin_lib.h"
+#include "anastasis_database_lib.h"
+#include "anastasis_util_lib.h"
+#include <taler/taler_json_lib.h>
 #include <gnunet/gnunet_util_lib.h>
 #include <jansson.h>
 #include <pthread.h>
 #include <microhttpd.h>
-#include <taler/taler_json_lib.h>
-#include <XXX_bank_service.h>
-#include "anastasis_db_lib.h"
 
 /**
  * How long to wait for an HTTP reply if there
@@ -39,20 +40,25 @@
  */
 #define LONGPOLL_TIMEOUT GNUNET_TIME_UNIT_HOURS
 
+/**
+ * How long to wait between HTTP requests?
+ */
+#define RETRY_TIMEOUT GNUNET_TIME_UNIT_MINUTES
+
 /**
  * Authentication data needed to access the account.
  */
-static struct BANK_AccountInfo *auth;
+static struct ANASTASIS_EUFIN_AuthenticationData auth;
 
 /**
  * Bank account payto://-URI this process is monitoring.
  */
-static struct credit_account_uri;
+static char *credit_account_uri;
 
 /**
  * Active request for history.
  */
-static struct BANK_CreditHistoryHandle *hh;
+static struct ANASTASIS_EUFIN_CreditHistoryHandle *hh;
 
 /**
  * Handle to the context for interacting with the bank.
@@ -91,6 +97,12 @@ static struct GNUNET_TIME_Relative idle_sleep_interval;
  */
 static int global_ret;
 
+/**
+ * Run in test-mode, do not background, only import currently
+ * pending transactions.
+ */
+static int test_mode;
+
 /**
  * Current task waiting for execution, if any.
  */
@@ -108,7 +120,7 @@ shutdown_task (void *cls)
   (void) cls;
   if (NULL != hh)
   {
-    BANK_credit_history_cancel (hh);
+    ANASTASIS_EUFIN_credit_history_cancel (hh);
     hh = NULL;
   }
   if (NULL != ctx)
@@ -157,11 +169,10 @@ history_cb (void *cls,
             unsigned int http_status,
             enum TALER_ErrorCode ec,
             uint64_t serial_id,
-            const struct BANK_CreditDetails *details)
+            const struct ANASTASIS_EUFIN_CreditDetails *details)
 {
   enum GNUNET_DB_QueryStatus qs;
 
-  (void) json;
   if (NULL == details)
   {
     hh = NULL;
@@ -175,9 +186,9 @@ history_cb (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "End of list.\n");
     GNUNET_assert (NULL == task);
-    task = GNUNET_SCHEDULER_add_at (delayed_until,
-                                    &find_transfers,
-                                    NULL);
+    task = GNUNET_SCHEDULER_add_delayed (idle_sleep_interval,
+                                         &find_transfers,
+                                         NULL);
     return GNUNET_OK; /* will be ignored anyway */
   }
   if (serial_id <= latest_row_off)
@@ -200,7 +211,7 @@ history_cb (void *cls,
                                             &details->amount,
                                             details->debit_account_uri,
                                             details->credit_account_uri,
-                                            details->execution_time);
+                                            details->execution_date);
   switch (qs)
   {
   case GNUNET_DB_STATUS_HARD_ERROR:
@@ -234,20 +245,18 @@ history_cb (void *cls,
 static void
 find_transfers (void *cls)
 {
-  enum GNUNET_DB_QueryStatus qs;
-
   (void) cls;
   task = NULL;
   GNUNET_assert (NULL == hh);
-  hh = BANK_credit_history (ctx,
-                            &auth,
-                            latest_row_off,
-                            1024,
-                            test_mode
-                            ? GNUNET_TIME_UNIT_ZERO
-                            : LONGPOLL_TIMEOUT,
-                            &history_cb,
-                            NULL);
+  hh = ANASTASIS_EUFIN_credit_history (ctx,
+                                       &auth,
+                                       latest_row_off,
+                                       1024,
+                                       test_mode
+                                       ? GNUNET_TIME_UNIT_ZERO
+                                       : LONGPOLL_TIMEOUT,
+                                       &history_cb,
+                                       NULL);
   if (NULL == hh)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -310,8 +319,7 @@ run (void *cls,
     GNUNET_break (0);
     return;
   }
-  latest_row_off = FIXME; // need new DB function!
-
+  idle_sleep_interval = RETRY_TIMEOUT;
   task = GNUNET_SCHEDULER_add_now (&find_transfers,
                                    NULL);
 }
diff --git a/src/authorization/libanastasiseufin/lae_credit.c 
b/src/authorization/libanastasiseufin/lae_credit.c
index b97536b..e8cabb5 100644
--- a/src/authorization/libanastasiseufin/lae_credit.c
+++ b/src/authorization/libanastasiseufin/lae_credit.c
@@ -117,8 +117,7 @@ parse_account_history (struct 
ANASTASIS_EUFIN_CreditHistoryHandle *hh,
                  MHD_HTTP_OK,
                  TALER_EC_NONE,
                  row_id,
-                 &td,
-                 transaction))
+                 &td))
     {
       hh->hcb = NULL;
       GNUNET_JSON_parse_free (hist_spec);
@@ -205,8 +204,7 @@ handle_credit_history_finished (void *cls,
              response_code,
              ec,
              0LLU,
-             NULL,
-             j);
+             NULL);
   ANASTASIS_EUFIN_credit_history_cancel (hh);
 }
 
@@ -272,9 +270,9 @@ ANASTASIS_EUFIN_credit_history (
   hh = GNUNET_new (struct ANASTASIS_EUFIN_CreditHistoryHandle);
   hh->hcb = hres_cb;
   hh->hcb_cls = hres_cb_cls;
-  hh->request_url = Anastasis_url_join (auth->wire_gateway_url,
-                                        url,
-                                        NULL);
+  hh->request_url = TALER_url_join (auth->wire_gateway_url,
+                                    url,
+                                    NULL);
   if (NULL == hh->request_url)
   {
     GNUNET_free (hh);
diff --git a/src/include/anastasis_eufin_lib.h 
b/src/include/anastasis_eufin_lib.h
index 38eb61d..daff98a 100644
--- a/src/include/anastasis_eufin_lib.h
+++ b/src/include/anastasis_eufin_lib.h
@@ -22,10 +22,11 @@
 #ifndef ANASTASIS_EUFIN_LIB_H
 #define ANASTASIS_EUFIN_LIB_H
 
+#define GNU_TALER_ERROR_CODES_H 1
+#include "anastasis_error_codes.h"
 #include <jansson.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include <taler/taler_util.h>
-#include <taler/taler_error_codes.h>
 
 
 /**
@@ -145,7 +146,6 @@ struct ANASTASIS_EUFIN_CreditDetails
  * @param ec detailed error code
  * @param serial_id monotonically increasing counter corresponding to the 
transaction
  * @param details details about the wire transfer
- * @param json detailed response from the HTTPD, or NULL if reply was not in 
JSON
  * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
  */
 typedef enum GNUNET_GenericReturnValue
@@ -154,8 +154,7 @@ typedef enum GNUNET_GenericReturnValue
   unsigned int http_status,
   enum TALER_ErrorCode ec,
   uint64_t serial_id,
-  const struct ANASTASIS_EUFIN_CreditDetails *details,
-  const json_t *json);
+  const struct ANASTASIS_EUFIN_CreditDetails *details);
 
 
 /**
diff --git a/src/include/anastasis_util_lib.h b/src/include/anastasis_util_lib.h
index 3d380a3..e780d82 100644
--- a/src/include/anastasis_util_lib.h
+++ b/src/include/anastasis_util_lib.h
@@ -36,6 +36,13 @@ const struct GNUNET_OS_ProjectData *
 ANASTASIS_project_data_default (void);
 
 
+/**
+ * Initialize libanastasisutil.
+ */
+void
+ANASTASIS_OS_init (void);
+
+
 /**
  * Handle for the child management
  */
diff --git a/src/include/platform.h b/src/include/platform.h
index 31aa7b9..7667460 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -39,6 +39,33 @@
 #define VERBOSE(cmd) do { break; } while (0)
 #endif
 
+
+/* LSB-style exit status codes */
+#ifndef EXIT_INVALIDARGUMENT
+#define EXIT_INVALIDARGUMENT 2
+#endif
+
+#ifndef EXIT_NOTIMPLEMENTED
+#define EXIT_NOTIMPLEMENTED 3
+#endif
+
+#ifndef EXIT_NOPERMISSION
+#define EXIT_NOPERMISSION 4
+#endif
+
+#ifndef EXIT_NOTINSTALLED
+#define EXIT_NOTINSTALLED 5
+#endif
+
+#ifndef EXIT_NOTCONFIGURED
+#define EXIT_NOTCONFIGURED 6
+#endif
+
+#ifndef EXIT_NOTRUNNING
+#define EXIT_NOTRUNNING 7
+#endif
+
+
 /* Include the features available for GNU source */
 #define _GNU_SOURCE
 

-- 
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]