[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] 01/04: [build] Clean up src/lib/: Makefile and comment out
From: |
gnunet |
Subject: |
[taler-donau] 01/04: [build] Clean up src/lib/: Makefile and comment out portions of code in files |
Date: |
Wed, 29 Nov 2023 14:56:22 +0100 |
This is an automated email from the git hooks/post-receive script.
pius-loosli pushed a commit to branch master
in repository donau.
commit ff18df29fced99b4dc49f051a25ef2a9e6b6b689
Author: Pius Loosli <loosp2@bfh.ch>
AuthorDate: Wed Nov 29 14:49:41 2023 +0100
[build] Clean up src/lib/: Makefile and comment out portions of code in
files
---
src/lib/Makefile.am | 133 +----
src/lib/donau_api_charities_open.c | 1028 ++++++++++++++++++------------------
src/lib/donau_api_common.h | 34 +-
src/lib/donau_api_handle.h | 5 +-
4 files changed, 553 insertions(+), 647 deletions(-)
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 8035ae6..1b2fe8c 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -1,128 +1,35 @@
# This Makefile.am is in the public domain
AM_CPPFLAGS = \
- -I$(top_srcdir)/src/include \
- $(LIBGCRYPT_CFLAGS) \
- $(POSTGRESQL_CPPFLAGS)
+ -I$(top_srcdir)/src/include \
+ $(LIBGCRYPT_CFLAGS) \
+ $(POSTGRESQL_CPPFLAGS)
if USE_COVERAGE
- AM_CFLAGS = --coverage -O0
- XLIB = -lgcov
+ AM_CFLAGS = --coverage -O0
+ XLIB = -lgcov
endif
# Libraries
lib_LTLIBRARIES = \
- libtalerauditor.la \
- libtalerdonau.la
+ libtalerdonau.la
libtalerdonau_la_LDFLAGS = \
- -version-info 5:0:0 \
- -no-undefined
-libtalerdonau_la_SOURCES = \
- donau_api_add_aml_decision.c \
- donau_api_age_withdraw.c \
- donau_api_age_withdraw_reveal.c \
- donau_api_auditor_add_denomination.c \
- donau_api_batch_deposit.c \
- donau_api_batch_withdraw.c \
- donau_api_batch_withdraw2.c \
- donau_api_curl_defaults.c donau_api_curl_defaults.h \
- donau_api_common.c donau_api_common.h \
- donau_api_contracts_get.c \
- donau_api_csr_melt.c \
- donau_api_csr_withdraw.c \
- donau_api_handle.c donau_api_handle.h \
- donau_api_deposits_get.c \
- donau_api_kyc_check.c \
- donau_api_kyc_proof.c \
- donau_api_kyc_wallet.c \
- donau_api_link.c \
- donau_api_lookup_aml_decision.c \
- donau_api_lookup_aml_decisions.c \
- donau_api_management_add_partner.c \
- donau_api_management_auditor_disable.c \
- donau_api_management_auditor_enable.c \
- donau_api_management_drain_profits.c \
- donau_api_management_get_keys.c \
- donau_api_management_post_keys.c \
- donau_api_management_post_extensions.c \
- donau_api_management_revoke_denomination_key.c \
- donau_api_management_revoke_signing_key.c \
- donau_api_management_set_global_fee.c \
- donau_api_management_set_wire_fee.c \
- donau_api_management_update_aml_officer.c \
- donau_api_management_wire_disable.c \
- donau_api_management_wire_enable.c \
- donau_api_melt.c \
- donau_api_purse_create_with_deposit.c \
- donau_api_purse_create_with_merge.c \
- donau_api_purse_delete.c \
- donau_api_purse_deposit.c \
- donau_api_purse_merge.c \
- donau_api_purses_get.c \
- donau_api_recoup.c \
- donau_api_recoup_refresh.c \
- donau_api_refresh_common.c donau_api_refresh_common.h \
- donau_api_refreshes_reveal.c \
- donau_api_refund.c \
- donau_api_reserves_attest.c \
- donau_api_reserves_close.c \
- donau_api_reserves_get.c \
- donau_api_reserves_get_attestable.c \
- donau_api_reserves_history.c \
- donau_api_reserves_open.c \
- donau_api_reserves_status.c \
- donau_api_stefan.c \
- donau_api_transfers_get.c \
- donau_api_withdraw.c \
- donau_api_withdraw2.c
-libtalerdonau_la_LIBADD = \
- libtalerauditor.la \
- $(top_builddir)/src/json/libtalerjson.la \
- $(top_builddir)/src/kyclogic/libtalerkyclogic.la \
- $(top_builddir)/src/curl/libtalercurl.la \
- $(top_builddir)/src/util/libtalerdonauutil.la \
- $(top_builddir)/src/extensions/libtalerextensions.la \
- -lgnunetcurl \
- -lgnunetjson \
- -lgnunetutil \
- -ljansson \
- $(LIBGNURLCURL_LIBS) \
- $(XLIB)
-
-libtalerauditor_la_LDFLAGS = \
- -version-info 0:0:0 \
- -no-undefined
-libtalerauditor_la_SOURCES = \
- auditor_api_curl_defaults.c auditor_api_curl_defaults.h \
- auditor_api_get_config.c \
- auditor_api_deposit_confirmation.c \
- auditor_api_donaus.c
-libtalerauditor_la_LIBADD = \
- $(top_builddir)/src/curl/libtalercurl.la \
- $(top_builddir)/src/json/libtalerjson.la \
- $(top_builddir)/src/util/libtalerdonauutil.la \
- -lgnunetcurl \
- -lgnunetjson \
- -lgnunetutil \
- -ljansson \
- -lm \
- $(LIBGNURLCURL_LIBS) \
- $(XLIB)
-
-
-check_PROGRAMS = \
- test_stefan
-
-TESTS = \
- $(check_PROGRAMS)
+ -version-info 5:0:0 \
+ -no-undefined
+libtalerdonau_la_SOURCES = \
+ donau_api_charities_open.c
-test_stefan_SOURCES = \
- test_stefan.c
-test_stefan_LDADD = \
- $(top_builddir)/src/lib/libtalerdonau.la \
- $(top_builddir)/src/util/libtalerdonauutil.la \
- -lgnunetutil
+# maybe need libtalercurl
+libtalerdonau_la_LIBADD = \
+ $(top_builddir)/src/json/libtalerjson.la \
+ $(top_builddir)/src/util/libtalerdonauutil.la \
+ -lgnunetcurl \
+ -lgnunetjson \
+ -lgnunetutil \
+ -ljansson \
+ $(LIBGNURLCURL_LIBS) \
+ $(XLIB)
diff --git a/src/lib/donau_api_charities_open.c
b/src/lib/donau_api_charities_open.c
index f2509d8..57baa11 100644
--- a/src/lib/donau_api_charities_open.c
+++ b/src/lib/donau_api_charities_open.c
@@ -25,7 +25,7 @@
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_json_lib.h>
#include <gnunet/gnunet_curl_lib.h>
-#include "taler_donau_service.h"
+#include "donau_service.h"
#include "taler/taler_json_lib.h"
#include "donau_api_common.h"
#include "donau_api_handle.h"
@@ -63,66 +63,66 @@ struct CoinData
/**
* @brief A /reserves/$RID/open Handle
*/
-struct DONAU_ReservesOpenHandle
-{
-
- /**
- * The keys of the donau this request handle will use
- */
- struct DONAU_Keys *keys;
-
- /**
- * The url for this request.
- */
- char *url;
-
- /**
- * Handle for the request.
- */
- struct GNUNET_CURL_Job *job;
-
- /**
- * Context for #TEH_curl_easy_post(). Keeps the data that must
- * persist for Curl to make the upload.
- */
- struct TALER_CURL_PostContext post_ctx;
-
- /**
- * Function to call with the result.
- */
- DONAU_ReservesOpenCallback cb;
-
- /**
- * Closure for @a cb.
- */
- void *cb_cls;
-
- /**
- * Information we keep per coin to validate the reply.
- */
- struct CoinData *coins;
-
- /**
- * Length of the @e coins array.
- */
- unsigned int num_coins;
-
- /**
- * Public key of the reserve we are querying.
- */
- struct TALER_ReservePublicKeyP reserve_pub;
-
- /**
- * Our signature.
- */
- struct TALER_ReserveSignatureP reserve_sig;
-
- /**
- * When did we make the request.
- */
- struct GNUNET_TIME_Timestamp ts;
-
-};
+// struct DONAU_ReservesOpenHandle
+// {
+
+// /**
+// * The keys of the donau this request handle will use
+// */
+// struct DONAU_Keys *keys;
+
+// /**
+// * The url for this request.
+// */
+// char *url;
+
+// /**
+// * Handle for the request.
+// */
+// struct GNUNET_CURL_Job *job;
+
+// /**
+// * Context for #TEH_curl_easy_post(). Keeps the data that must
+// * persist for Curl to make the upload.
+// */
+// struct TALER_CURL_PostContext post_ctx;
+
+// /**
+// * Function to call with the result.
+// */
+// DONAU_ReservesOpenCallback cb;
+
+// /**
+// * Closure for @a cb.
+// */
+// void *cb_cls;
+
+// /**
+// * Information we keep per coin to validate the reply.
+// */
+// struct CoinData *coins;
+
+// /**
+// * Length of the @e coins array.
+// */
+// unsigned int num_coins;
+
+// /**
+// * Public key of the reserve we are querying.
+// */
+// struct TALER_ReservePublicKeyP reserve_pub;
+
+// /**
+// * Our signature.
+// */
+// struct TALER_ReserveSignatureP reserve_sig;
+
+// /**
+// * When did we make the request.
+// */
+// struct GNUNET_TIME_Timestamp ts;
+
+// };
/**
@@ -133,459 +133,459 @@ struct DONAU_ReservesOpenHandle
* @param j JSON response
* @return #GNUNET_OK on success
*/
-static enum GNUNET_GenericReturnValue
-handle_reserves_open_ok (struct DONAU_ReservesOpenHandle *roh,
- const json_t *j)
-{
- struct DONAU_ReserveOpenResult rs = {
- .hr.reply = j,
- .hr.http_status = MHD_HTTP_OK,
- };
- struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_amount_any ("open_cost",
- &rs.details.ok.open_cost),
- GNUNET_JSON_spec_timestamp ("reserve_expiration",
- &rs.details.ok.expiration_time),
- GNUNET_JSON_spec_end ()
- };
-
- if (GNUNET_OK !=
- GNUNET_JSON_parse (j,
- spec,
- NULL,
- NULL))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- roh->cb (roh->cb_cls,
- &rs);
- roh->cb = NULL;
- GNUNET_JSON_parse_free (spec);
- return GNUNET_OK;
-}
-
-
-/**
- * We received an #MHD_HTTP_PAYMENT_REQUIRED open code. Handle the JSON
- * response.
- *
- * @param roh handle of the request
- * @param j JSON response
- * @return #GNUNET_OK on success
- */
-static enum GNUNET_GenericReturnValue
-handle_reserves_open_pr (struct DONAU_ReservesOpenHandle *roh,
- const json_t *j)
-{
- struct DONAU_ReserveOpenResult rs = {
- .hr.reply = j,
- .hr.http_status = MHD_HTTP_PAYMENT_REQUIRED,
- };
- struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_amount_any ("open_cost",
- &rs.details.payment_required.open_cost),
- GNUNET_JSON_spec_timestamp ("reserve_expiration",
- &rs.details.payment_required.expiration_time),
- GNUNET_JSON_spec_end ()
- };
-
- if (GNUNET_OK !=
- GNUNET_JSON_parse (j,
- spec,
- NULL,
- NULL))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- roh->cb (roh->cb_cls,
- &rs);
- roh->cb = NULL;
- GNUNET_JSON_parse_free (spec);
- return GNUNET_OK;
-}
-
-
-/**
- * We received an #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS open code. Handle
the JSON
- * response.
- *
- * @param roh handle of the request
- * @param j JSON response
- * @return #GNUNET_OK on success
- */
-static enum GNUNET_GenericReturnValue
-handle_reserves_open_kyc (struct DONAU_ReservesOpenHandle *roh,
- const json_t *j)
-{
- struct DONAU_ReserveOpenResult rs = {
- .hr.reply = j,
- .hr.http_status = MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS,
- };
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto (
- "h_payto",
- &rs.details.unavailable_for_legal_reasons.h_payto),
- GNUNET_JSON_spec_uint64 (
- "requirement_row",
- &rs.details.unavailable_for_legal_reasons.requirement_row),
- GNUNET_JSON_spec_end ()
- };
-
- if (GNUNET_OK !=
- GNUNET_JSON_parse (j,
- spec,
- NULL,
- NULL))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- roh->cb (roh->cb_cls,
- &rs);
- roh->cb = NULL;
- GNUNET_JSON_parse_free (spec);
- return GNUNET_OK;
-}
-
-
-/**
- * Function called when we're done processing the
- * HTTP /reserves/$RID/open request.
- *
- * @param cls the `struct DONAU_ReservesOpenHandle`
- * @param response_code HTTP response code, 0 on error
- * @param response parsed JSON result, NULL on error
- */
-static void
-handle_reserves_open_finished (void *cls,
- long response_code,
- const void *response)
-{
- struct DONAU_ReservesOpenHandle *roh = cls;
- const json_t *j = response;
- struct DONAU_ReserveOpenResult rs = {
- .hr.reply = j,
- .hr.http_status = (unsigned int) response_code
- };
-
- roh->job = NULL;
- switch (response_code)
- {
- case 0:
- rs.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- break;
- case MHD_HTTP_OK:
- if (GNUNET_OK !=
- handle_reserves_open_ok (roh,
- j))
- {
- GNUNET_break_op (0);
- rs.hr.http_status = 0;
- rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
- }
- break;
- case MHD_HTTP_BAD_REQUEST:
- /* This should never happen, either us or the donau is buggy
- (or API version conflict); just pass JSON reply to the application */
- GNUNET_break (0);
- json_dumpf (j,
- stderr,
- JSON_INDENT (2));
- rs.hr.ec = TALER_JSON_get_error_code (j);
- rs.hr.hint = TALER_JSON_get_error_hint (j);
- break;
- case MHD_HTTP_PAYMENT_REQUIRED:
- if (GNUNET_OK !=
- handle_reserves_open_pr (roh,
- j))
- {
- GNUNET_break_op (0);
- rs.hr.http_status = 0;
- rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
- }
- break;
- case MHD_HTTP_FORBIDDEN:
- /* This should never happen, either us or the donau is buggy
- (or API version conflict); just pass JSON reply to the application */
- GNUNET_break (0);
- rs.hr.ec = TALER_JSON_get_error_code (j);
- rs.hr.hint = TALER_JSON_get_error_hint (j);
- break;
- case MHD_HTTP_NOT_FOUND:
- /* Nothing really to verify, this should never
- happen, we should pass the JSON reply to the application */
- rs.hr.ec = TALER_JSON_get_error_code (j);
- rs.hr.hint = TALER_JSON_get_error_hint (j);
- break;
- case MHD_HTTP_CONFLICT:
- {
- const struct CoinData *cd = NULL;
- struct TALER_CoinSpendPublicKeyP coin_pub;
- const struct DONAU_DenomPublicKey *dk;
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("coin_pub",
- &coin_pub),
- GNUNET_JSON_spec_end ()
- };
-
- if (GNUNET_OK !=
- GNUNET_JSON_parse (j,
- spec,
- NULL,
- NULL))
- {
- GNUNET_break_op (0);
- rs.hr.http_status = 0;
- rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
- break;
- }
- for (unsigned int i = 0; i<roh->num_coins; i++)
- {
- const struct CoinData *cdi = &roh->coins[i];
-
- if (0 == GNUNET_memcmp (&coin_pub,
- &cdi->coin_pub))
- {
- cd = cdi;
- break;
- }
- }
- if (NULL == cd)
- {
- GNUNET_break_op (0);
- rs.hr.http_status = 0;
- rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
- break;
- }
- dk = DONAU_get_denomination_key_by_hash (roh->keys,
- &cd->h_denom_pub);
- if (NULL == dk)
- {
- GNUNET_break_op (0);
- rs.hr.http_status = 0;
- rs.hr.ec = TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR;
- break;
- }
- if (GNUNET_OK !=
- DONAU_check_coin_conflict_ (roh->keys,
- j,
- dk,
- &coin_pub,
- &cd->coin_sig,
- &cd->contribution))
- {
- GNUNET_break_op (0);
- rs.hr.http_status = 0;
- rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
- break;
- }
- rs.hr.ec = TALER_JSON_get_error_code (j);
- rs.hr.hint = TALER_JSON_get_error_hint (j);
- break;
- }
- case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS:
- if (GNUNET_OK !=
- handle_reserves_open_kyc (roh,
- j))
- {
- GNUNET_break_op (0);
- rs.hr.http_status = 0;
- rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
- }
- break;
- case MHD_HTTP_INTERNAL_SERVER_ERROR:
- /* Server had an internal issue; we should retry, but this API
- leaves this to the application */
- rs.hr.ec = TALER_JSON_get_error_code (j);
- rs.hr.hint = TALER_JSON_get_error_hint (j);
- break;
- default:
- /* unexpected response code */
- GNUNET_break_op (0);
- rs.hr.ec = TALER_JSON_get_error_code (j);
- rs.hr.hint = TALER_JSON_get_error_hint (j);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u/%d for reserves open\n",
- (unsigned int) response_code,
- (int) rs.hr.ec);
- break;
- }
- if (NULL != roh->cb)
- {
- roh->cb (roh->cb_cls,
- &rs);
- roh->cb = NULL;
- }
- DONAU_reserves_open_cancel (roh);
-}
-
-
-struct DONAU_ReservesOpenHandle *
-DONAU_reserves_open (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- struct DONAU_Keys *keys,
- const struct TALER_ReservePrivateKeyP *reserve_priv,
- const struct TALER_Amount *reserve_contribution,
- unsigned int coin_payments_length,
- const struct DONAU_PurseDeposit coin_payments[
- static coin_payments_length],
- struct GNUNET_TIME_Timestamp expiration_time,
- uint32_t min_purses,
- DONAU_ReservesOpenCallback cb,
- void *cb_cls)
-{
- struct DONAU_ReservesOpenHandle *roh;
- CURL *eh;
- char arg_str[sizeof (struct TALER_ReservePublicKeyP) * 2 + 32];
- json_t *cpa;
-
- roh = GNUNET_new (struct DONAU_ReservesOpenHandle);
- roh->cb = cb;
- roh->cb_cls = cb_cls;
- roh->ts = GNUNET_TIME_timestamp_get ();
- GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv,
- &roh->reserve_pub.eddsa_pub);
- {
- char pub_str[sizeof (struct TALER_ReservePublicKeyP) * 2];
- char *end;
-
- end = GNUNET_STRINGS_data_to_string (
- &roh->reserve_pub,
- sizeof (roh->reserve_pub),
- pub_str,
- sizeof (pub_str));
- *end = '\0';
- GNUNET_snprintf (arg_str,
- sizeof (arg_str),
- "reserves/%s/open",
- pub_str);
- }
- roh->url = TALER_url_join (url,
- arg_str,
- NULL);
- if (NULL == roh->url)
- {
- GNUNET_free (roh);
- return NULL;
- }
- eh = DONAU_curl_easy_get_ (roh->url);
- if (NULL == eh)
- {
- GNUNET_break (0);
- GNUNET_free (roh->url);
- GNUNET_free (roh);
- return NULL;
- }
- TALER_wallet_reserve_open_sign (reserve_contribution,
- roh->ts,
- expiration_time,
- min_purses,
- reserve_priv,
- &roh->reserve_sig);
- roh->coins = GNUNET_new_array (coin_payments_length,
- struct CoinData);
- cpa = json_array ();
- GNUNET_assert (NULL != cpa);
- for (unsigned int i = 0; i<coin_payments_length; i++)
- {
- const struct DONAU_PurseDeposit *pd = &coin_payments[i];
- const struct TALER_AgeCommitmentProof *acp = pd->age_commitment_proof;
- struct TALER_AgeCommitmentHash ahac;
- struct TALER_AgeCommitmentHash *achp = NULL;
- struct CoinData *cd = &roh->coins[i];
- json_t *cp;
-
- cd->contribution = pd->amount;
- cd->h_denom_pub = pd->h_denom_pub;
- if (NULL != acp)
- {
- TALER_age_commitment_hash (&acp->commitment,
- &ahac);
- achp = &ahac;
- }
- TALER_wallet_reserve_open_deposit_sign (&pd->amount,
- &roh->reserve_sig,
- &pd->coin_priv,
- &cd->coin_sig);
- GNUNET_CRYPTO_eddsa_key_get_public (&pd->coin_priv.eddsa_priv,
- &cd->coin_pub.eddsa_pub);
-
- cp = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_data_auto ("h_age_commitment",
- achp)),
- TALER_JSON_pack_amount ("amount",
- &pd->amount),
- GNUNET_JSON_pack_data_auto ("denom_pub_hash",
- &pd->h_denom_pub),
- TALER_JSON_pack_denom_sig ("ub_sig",
- &pd->denom_sig),
- GNUNET_JSON_pack_data_auto ("coin_pub",
- &cd->coin_pub),
- GNUNET_JSON_pack_data_auto ("coin_sig",
- &cd->coin_sig));
- GNUNET_assert (0 ==
- json_array_append_new (cpa,
- cp));
- }
- {
- json_t *open_obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_timestamp ("request_timestamp",
- roh->ts),
- GNUNET_JSON_pack_timestamp ("reserve_expiration",
- expiration_time),
- GNUNET_JSON_pack_array_steal ("payments",
- cpa),
- TALER_JSON_pack_amount ("reserve_payment",
- reserve_contribution),
- GNUNET_JSON_pack_uint64 ("purse_limit",
- min_purses),
- GNUNET_JSON_pack_data_auto ("reserve_sig",
- &roh->reserve_sig));
-
- if (GNUNET_OK !=
- TALER_curl_easy_post (&roh->post_ctx,
- eh,
- open_obj))
- {
- GNUNET_break (0);
- curl_easy_cleanup (eh);
- json_decref (open_obj);
- GNUNET_free (roh->coins);
- GNUNET_free (roh->url);
- GNUNET_free (roh);
- return NULL;
- }
- json_decref (open_obj);
- }
- roh->keys = DONAU_keys_incref (keys);
- roh->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- roh->post_ctx.headers,
- &handle_reserves_open_finished,
- roh);
- return roh;
-}
-
-
-void
-DONAU_reserves_open_cancel (
- struct DONAU_ReservesOpenHandle *roh)
-{
- if (NULL != roh->job)
- {
- GNUNET_CURL_job_cancel (roh->job);
- roh->job = NULL;
- }
- TALER_curl_easy_post_finished (&roh->post_ctx);
- GNUNET_free (roh->coins);
- GNUNET_free (roh->url);
- DONAU_keys_decref (roh->keys);
- GNUNET_free (roh);
-}
+// static enum GNUNET_GenericReturnValue
+// handle_reserves_open_ok (struct DONAU_ReservesOpenHandle *roh,
+// const json_t *j)
+// {
+// struct DONAU_ReserveOpenResult rs = {
+// .hr.reply = j,
+// .hr.http_status = MHD_HTTP_OK,
+// };
+// struct GNUNET_JSON_Specification spec[] = {
+// TALER_JSON_spec_amount_any ("open_cost",
+// &rs.details.ok.open_cost),
+// GNUNET_JSON_spec_timestamp ("reserve_expiration",
+// &rs.details.ok.expiration_time),
+// GNUNET_JSON_spec_end ()
+// };
+
+// if (GNUNET_OK !=
+// GNUNET_JSON_parse (j,
+// spec,
+// NULL,
+// NULL))
+// {
+// GNUNET_break_op (0);
+// return GNUNET_SYSERR;
+// }
+// roh->cb (roh->cb_cls,
+// &rs);
+// roh->cb = NULL;
+// GNUNET_JSON_parse_free (spec);
+// return GNUNET_OK;
+// }
+
+
+// /**
+// * We received an #MHD_HTTP_PAYMENT_REQUIRED open code. Handle the JSON
+// * response.
+// *
+// * @param roh handle of the request
+// * @param j JSON response
+// * @return #GNUNET_OK on success
+// */
+// static enum GNUNET_GenericReturnValue
+// handle_reserves_open_pr (struct DONAU_ReservesOpenHandle *roh,
+// const json_t *j)
+// {
+// struct DONAU_ReserveOpenResult rs = {
+// .hr.reply = j,
+// .hr.http_status = MHD_HTTP_PAYMENT_REQUIRED,
+// };
+// struct GNUNET_JSON_Specification spec[] = {
+// TALER_JSON_spec_amount_any ("open_cost",
+// &rs.details.payment_required.open_cost),
+// GNUNET_JSON_spec_timestamp ("reserve_expiration",
+//
&rs.details.payment_required.expiration_time),
+// GNUNET_JSON_spec_end ()
+// };
+
+// if (GNUNET_OK !=
+// GNUNET_JSON_parse (j,
+// spec,
+// NULL,
+// NULL))
+// {
+// GNUNET_break_op (0);
+// return GNUNET_SYSERR;
+// }
+// roh->cb (roh->cb_cls,
+// &rs);
+// roh->cb = NULL;
+// GNUNET_JSON_parse_free (spec);
+// return GNUNET_OK;
+// }
+
+
+// /**
+// * We received an #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS open code. Handle
the JSON
+// * response.
+// *
+// * @param roh handle of the request
+// * @param j JSON response
+// * @return #GNUNET_OK on success
+// */
+// static enum GNUNET_GenericReturnValue
+// handle_reserves_open_kyc (struct DONAU_ReservesOpenHandle *roh,
+// const json_t *j)
+// {
+// struct DONAU_ReserveOpenResult rs = {
+// .hr.reply = j,
+// .hr.http_status = MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS,
+// };
+// struct GNUNET_JSON_Specification spec[] = {
+// GNUNET_JSON_spec_fixed_auto (
+// "h_payto",
+// &rs.details.unavailable_for_legal_reasons.h_payto),
+// GNUNET_JSON_spec_uint64 (
+// "requirement_row",
+// &rs.details.unavailable_for_legal_reasons.requirement_row),
+// GNUNET_JSON_spec_end ()
+// };
+
+// if (GNUNET_OK !=
+// GNUNET_JSON_parse (j,
+// spec,
+// NULL,
+// NULL))
+// {
+// GNUNET_break_op (0);
+// return GNUNET_SYSERR;
+// }
+// roh->cb (roh->cb_cls,
+// &rs);
+// roh->cb = NULL;
+// GNUNET_JSON_parse_free (spec);
+// return GNUNET_OK;
+// }
+
+
+// /**
+// * Function called when we're done processing the
+// * HTTP /reserves/$RID/open request.
+// *
+// * @param cls the `struct DONAU_ReservesOpenHandle`
+// * @param response_code HTTP response code, 0 on error
+// * @param response parsed JSON result, NULL on error
+// */
+// static void
+// handle_reserves_open_finished (void *cls,
+// long response_code,
+// const void *response)
+// {
+// struct DONAU_ReservesOpenHandle *roh = cls;
+// const json_t *j = response;
+// struct DONAU_ReserveOpenResult rs = {
+// .hr.reply = j,
+// .hr.http_status = (unsigned int) response_code
+// };
+
+// roh->job = NULL;
+// switch (response_code)
+// {
+// case 0:
+// rs.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+// break;
+// case MHD_HTTP_OK:
+// if (GNUNET_OK !=
+// handle_reserves_open_ok (roh,
+// j))
+// {
+// GNUNET_break_op (0);
+// rs.hr.http_status = 0;
+// rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
+// }
+// break;
+// case MHD_HTTP_BAD_REQUEST:
+// /* This should never happen, either us or the donau is buggy
+// (or API version conflict); just pass JSON reply to the application */
+// GNUNET_break (0);
+// json_dumpf (j,
+// stderr,
+// JSON_INDENT (2));
+// rs.hr.ec = TALER_JSON_get_error_code (j);
+// rs.hr.hint = TALER_JSON_get_error_hint (j);
+// break;
+// case MHD_HTTP_PAYMENT_REQUIRED:
+// if (GNUNET_OK !=
+// handle_reserves_open_pr (roh,
+// j))
+// {
+// GNUNET_break_op (0);
+// rs.hr.http_status = 0;
+// rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
+// }
+// break;
+// case MHD_HTTP_FORBIDDEN:
+// /* This should never happen, either us or the donau is buggy
+// (or API version conflict); just pass JSON reply to the application */
+// GNUNET_break (0);
+// rs.hr.ec = TALER_JSON_get_error_code (j);
+// rs.hr.hint = TALER_JSON_get_error_hint (j);
+// break;
+// case MHD_HTTP_NOT_FOUND:
+// /* Nothing really to verify, this should never
+// happen, we should pass the JSON reply to the application */
+// rs.hr.ec = TALER_JSON_get_error_code (j);
+// rs.hr.hint = TALER_JSON_get_error_hint (j);
+// break;
+// case MHD_HTTP_CONFLICT:
+// {
+// const struct CoinData *cd = NULL;
+// struct TALER_CoinSpendPublicKeyP coin_pub;
+// const struct DONAU_DenomPublicKey *dk;
+// struct GNUNET_JSON_Specification spec[] = {
+// GNUNET_JSON_spec_fixed_auto ("coin_pub",
+// &coin_pub),
+// GNUNET_JSON_spec_end ()
+// };
+
+// if (GNUNET_OK !=
+// GNUNET_JSON_parse (j,
+// spec,
+// NULL,
+// NULL))
+// {
+// GNUNET_break_op (0);
+// rs.hr.http_status = 0;
+// rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
+// break;
+// }
+// for (unsigned int i = 0; i<roh->num_coins; i++)
+// {
+// const struct CoinData *cdi = &roh->coins[i];
+
+// if (0 == GNUNET_memcmp (&coin_pub,
+// &cdi->coin_pub))
+// {
+// cd = cdi;
+// break;
+// }
+// }
+// if (NULL == cd)
+// {
+// GNUNET_break_op (0);
+// rs.hr.http_status = 0;
+// rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
+// break;
+// }
+// dk = DONAU_get_denomination_key_by_hash (roh->keys,
+// &cd->h_denom_pub);
+// if (NULL == dk)
+// {
+// GNUNET_break_op (0);
+// rs.hr.http_status = 0;
+// rs.hr.ec = TALER_EC_GENERIC_CLIENT_INTERNAL_ERROR;
+// break;
+// }
+// if (GNUNET_OK !=
+// DONAU_check_coin_conflict_ (roh->keys,
+// j,
+// dk,
+// &coin_pub,
+// &cd->coin_sig,
+// &cd->contribution))
+// {
+// GNUNET_break_op (0);
+// rs.hr.http_status = 0;
+// rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
+// break;
+// }
+// rs.hr.ec = TALER_JSON_get_error_code (j);
+// rs.hr.hint = TALER_JSON_get_error_hint (j);
+// break;
+// }
+// case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS:
+// if (GNUNET_OK !=
+// handle_reserves_open_kyc (roh,
+// j))
+// {
+// GNUNET_break_op (0);
+// rs.hr.http_status = 0;
+// rs.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
+// }
+// break;
+// case MHD_HTTP_INTERNAL_SERVER_ERROR:
+// /* Server had an internal issue; we should retry, but this API
+// leaves this to the application */
+// rs.hr.ec = TALER_JSON_get_error_code (j);
+// rs.hr.hint = TALER_JSON_get_error_hint (j);
+// break;
+// default:
+// /* unexpected response code */
+// GNUNET_break_op (0);
+// rs.hr.ec = TALER_JSON_get_error_code (j);
+// rs.hr.hint = TALER_JSON_get_error_hint (j);
+// GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+// "Unexpected response code %u/%d for reserves open\n",
+// (unsigned int) response_code,
+// (int) rs.hr.ec);
+// break;
+// }
+// if (NULL != roh->cb)
+// {
+// roh->cb (roh->cb_cls,
+// &rs);
+// roh->cb = NULL;
+// }
+// DONAU_reserves_open_cancel (roh);
+// }
+
+
+// struct DONAU_ReservesOpenHandle *
+// DONAU_reserves_open (
+// struct GNUNET_CURL_Context *ctx,
+// const char *url,
+// struct DONAU_Keys *keys,
+// const struct TALER_ReservePrivateKeyP *reserve_priv,
+// const struct TALER_Amount *reserve_contribution,
+// unsigned int coin_payments_length,
+// const struct DONAU_PurseDeposit coin_payments[
+// static coin_payments_length],
+// struct GNUNET_TIME_Timestamp expiration_time,
+// uint32_t min_purses,
+// DONAU_ReservesOpenCallback cb,
+// void *cb_cls)
+// {
+// struct DONAU_ReservesOpenHandle *roh;
+// CURL *eh;
+// char arg_str[sizeof (struct TALER_ReservePublicKeyP) * 2 + 32];
+// json_t *cpa;
+
+// roh = GNUNET_new (struct DONAU_ReservesOpenHandle);
+// roh->cb = cb;
+// roh->cb_cls = cb_cls;
+// roh->ts = GNUNET_TIME_timestamp_get ();
+// GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv,
+// &roh->reserve_pub.eddsa_pub);
+// {
+// char pub_str[sizeof (struct TALER_ReservePublicKeyP) * 2];
+// char *end;
+
+// end = GNUNET_STRINGS_data_to_string (
+// &roh->reserve_pub,
+// sizeof (roh->reserve_pub),
+// pub_str,
+// sizeof (pub_str));
+// *end = '\0';
+// GNUNET_snprintf (arg_str,
+// sizeof (arg_str),
+// "reserves/%s/open",
+// pub_str);
+// }
+// roh->url = TALER_url_join (url,
+// arg_str,
+// NULL);
+// if (NULL == roh->url)
+// {
+// GNUNET_free (roh);
+// return NULL;
+// }
+// eh = DONAU_curl_easy_get_ (roh->url);
+// if (NULL == eh)
+// {
+// GNUNET_break (0);
+// GNUNET_free (roh->url);
+// GNUNET_free (roh);
+// return NULL;
+// }
+// TALER_wallet_reserve_open_sign (reserve_contribution,
+// roh->ts,
+// expiration_time,
+// min_purses,
+// reserve_priv,
+// &roh->reserve_sig);
+// roh->coins = GNUNET_new_array (coin_payments_length,
+// struct CoinData);
+// cpa = json_array ();
+// GNUNET_assert (NULL != cpa);
+// for (unsigned int i = 0; i<coin_payments_length; i++)
+// {
+// const struct DONAU_PurseDeposit *pd = &coin_payments[i];
+// const struct TALER_AgeCommitmentProof *acp = pd->age_commitment_proof;
+// struct TALER_AgeCommitmentHash ahac;
+// struct TALER_AgeCommitmentHash *achp = NULL;
+// struct CoinData *cd = &roh->coins[i];
+// json_t *cp;
+
+// cd->contribution = pd->amount;
+// cd->h_denom_pub = pd->h_denom_pub;
+// if (NULL != acp)
+// {
+// TALER_age_commitment_hash (&acp->commitment,
+// &ahac);
+// achp = &ahac;
+// }
+// TALER_wallet_reserve_open_deposit_sign (&pd->amount,
+// &roh->reserve_sig,
+// &pd->coin_priv,
+// &cd->coin_sig);
+// GNUNET_CRYPTO_eddsa_key_get_public (&pd->coin_priv.eddsa_priv,
+// &cd->coin_pub.eddsa_pub);
+
+// cp = GNUNET_JSON_PACK (
+// GNUNET_JSON_pack_allow_null (
+// GNUNET_JSON_pack_data_auto ("h_age_commitment",
+// achp)),
+// TALER_JSON_pack_amount ("amount",
+// &pd->amount),
+// GNUNET_JSON_pack_data_auto ("denom_pub_hash",
+// &pd->h_denom_pub),
+// TALER_JSON_pack_denom_sig ("ub_sig",
+// &pd->denom_sig),
+// GNUNET_JSON_pack_data_auto ("coin_pub",
+// &cd->coin_pub),
+// GNUNET_JSON_pack_data_auto ("coin_sig",
+// &cd->coin_sig));
+// GNUNET_assert (0 ==
+// json_array_append_new (cpa,
+// cp));
+// }
+// {
+// json_t *open_obj = GNUNET_JSON_PACK (
+// GNUNET_JSON_pack_timestamp ("request_timestamp",
+// roh->ts),
+// GNUNET_JSON_pack_timestamp ("reserve_expiration",
+// expiration_time),
+// GNUNET_JSON_pack_array_steal ("payments",
+// cpa),
+// TALER_JSON_pack_amount ("reserve_payment",
+// reserve_contribution),
+// GNUNET_JSON_pack_uint64 ("purse_limit",
+// min_purses),
+// GNUNET_JSON_pack_data_auto ("reserve_sig",
+// &roh->reserve_sig));
+
+// if (GNUNET_OK !=
+// TALER_curl_easy_post (&roh->post_ctx,
+// eh,
+// open_obj))
+// {
+// GNUNET_break (0);
+// curl_easy_cleanup (eh);
+// json_decref (open_obj);
+// GNUNET_free (roh->coins);
+// GNUNET_free (roh->url);
+// GNUNET_free (roh);
+// return NULL;
+// }
+// json_decref (open_obj);
+// }
+// roh->keys = DONAU_keys_incref (keys);
+// roh->job = GNUNET_CURL_job_add2 (ctx,
+// eh,
+// roh->post_ctx.headers,
+// &handle_reserves_open_finished,
+// roh);
+// return roh;
+// }
+
+
+// void
+// DONAU_reserves_open_cancel (
+// struct DONAU_ReservesOpenHandle *roh)
+// {
+// if (NULL != roh->job)
+// {
+// GNUNET_CURL_job_cancel (roh->job);
+// roh->job = NULL;
+// }
+// TALER_curl_easy_post_finished (&roh->post_ctx);
+// GNUNET_free (roh->coins);
+// GNUNET_free (roh->url);
+// DONAU_keys_decref (roh->keys);
+// GNUNET_free (roh);
+// }
/* end of donau_api_reserves_open.c */
diff --git a/src/lib/donau_api_common.h b/src/lib/donau_api_common.h
index 12f1941..99e96a5 100644
--- a/src/lib/donau_api_common.h
+++ b/src/lib/donau_api_common.h
@@ -23,7 +23,7 @@
#define DONAU_API_COMMON_H
#include "taler/taler_json_lib.h"
-#include "taler_donau_service.h"
+#include "donau_service.h"
/**
@@ -174,14 +174,14 @@ DONAU_check_coin_signature_conflict_ (
* @param required balance required on the coin for the operation
* @return #GNUNET_OK if @a proof holds
*/
-enum GNUNET_GenericReturnValue
-DONAU_check_coin_conflict_ (
- const struct DONAU_Keys *keys,
- const json_t *proof,
- const struct DONAU_DenomPublicKey *dk,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct TALER_CoinSpendSignatureP *coin_sig,
- const struct TALER_Amount *required);
+// enum GNUNET_GenericReturnValue
+// DONAU_check_coin_conflict_ (
+// const struct DONAU_Keys *keys,
+// const json_t *proof,
+// const struct DONAU_DenomPublicKey *dk,
+// const struct TALER_CoinSpendPublicKeyP *coin_pub,
+// const struct TALER_CoinSpendSignatureP *coin_sig,
+// const struct TALER_Amount *required);
/**
@@ -190,7 +190,7 @@ DONAU_check_coin_conflict_ (
* @param keys keys to search
* @param[out] min set to the smallest amount
* @return #GNUNET_SYSERR if there are no denominations in @a keys
-
+*/
enum GNUNET_GenericReturnValue
DONAU_get_min_denomination_ (
const struct DONAU_Keys *keys,
@@ -207,13 +207,13 @@ DONAU_get_min_denomination_ (
* @param dki denomination of the coin
* @return #GNUNET_OK if signatures are OK, #GNUNET_SYSERR if not
*/
-enum GNUNET_GenericReturnValue
-DONAU_verify_deposit_signature_ (
- const struct DONAU_DepositContractDetail *dcd,
- const struct TALER_ExtensionPolicyHashP *ech,
- const struct TALER_CharityWireHashP *h_wire,
- const struct DONAU_CoinDepositDetail *cdd,
- const struct DONAU_DenomPublicKey *dki);
+// enum GNUNET_GenericReturnValue
+// DONAU_verify_deposit_signature_ (
+// const struct DONAU_DepositContractDetail *dcd,
+// const struct TALER_ExtensionPolicyHashP *ech,
+// const struct TALER_CharityWireHashP *h_wire,
+// const struct DONAU_CoinDepositDetail *cdd,
+// const struct DONAU_DenomPublicKey *dki);
#endif
diff --git a/src/lib/donau_api_handle.h b/src/lib/donau_api_handle.h
index bf251e9..ba1cc96 100644
--- a/src/lib/donau_api_handle.h
+++ b/src/lib/donau_api_handle.h
@@ -23,10 +23,9 @@
#define DONAU_API_HANDLE_H
#include <gnunet/gnunet_curl_lib.h>
-#include "taler_auditor_service.h"
-#include "taler_donau_service.h"
+#include "donau_service.h"
#include "taler_util.h"
-#include "taler_curl_lib.h"
+// #include "taler_curl_lib.h"
/**
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.