aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bank-lib/bank_api_admin.c39
-rw-r--r--src/bank-lib/bank_api_transfer.c37
-rw-r--r--src/bank-lib/taler-exchange-wire-gateway-client.c48
-rw-r--r--src/benchmark/Makefile.am10
-rw-r--r--src/benchmark/bank-benchmark-cs.conf123
-rw-r--r--src/benchmark/bank-benchmark-rsa.conf130
-rw-r--r--src/benchmark/benchmark-common.conf59
-rw-r--r--src/benchmark/benchmark-cs.conf116
-rw-r--r--src/benchmark/benchmark-rsa.conf121
-rw-r--r--src/benchmark/coins-cs.conf58
-rw-r--r--src/benchmark/coins-rsa.conf63
-rwxr-xr-xsrc/benchmark/taler-benchmark-setup.sh556
-rw-r--r--src/benchmark/taler-exchange-benchmark.c27
-rw-r--r--src/exchange-tools/taler-auditor-offline.c21
-rw-r--r--src/exchange-tools/taler-exchange-offline.c107
-rw-r--r--src/exchange/taler-exchange-httpd_age-withdraw_reveal.c34
-rw-r--r--src/exchange/taler-exchange-httpd_aml-decision.c21
-rw-r--r--src/exchange/taler-exchange-httpd_batch-deposit.c6
-rw-r--r--src/exchange/taler-exchange-httpd_batch-withdraw.c14
-rw-r--r--src/exchange/taler-exchange-httpd_csr.c10
-rw-r--r--src/exchange/taler-exchange-httpd_management_extensions.c28
-rw-r--r--src/exchange/taler-exchange-httpd_management_post_keys.c27
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_enable.c12
-rw-r--r--src/exchange/taler-exchange-httpd_purses_create.c17
-rw-r--r--src/exchange/taler-exchange-httpd_purses_deposit.c11
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c51
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_attest.c6
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_open.c7
-rw-r--r--src/exchange/taler-exchange-transfer.c28
-rw-r--r--src/exchangedb/Makefile.am5
-rw-r--r--src/exchangedb/pg_insert_wire.c4
-rw-r--r--src/exchangedb/pg_insert_wire.h4
-rw-r--r--src/exchangedb/pg_update_wire.c4
-rw-r--r--src/exchangedb/pg_update_wire.h4
-rwxr-xr-xsrc/exchangedb/test_idempotency.sh11
-rw-r--r--src/extensions/extensions.c40
-rw-r--r--src/include/taler_bank_service.h122
-rw-r--r--src/include/taler_exchange_service.h123
-rw-r--r--src/include/taler_exchangedb_plugin.h8
-rw-r--r--src/include/taler_extensions.h12
-rw-r--r--src/json/json_helper.c5
-rw-r--r--src/kyclogic/plugin_kyclogic_kycaid.c18
-rw-r--r--src/kyclogic/plugin_kyclogic_oauth2.c9
-rw-r--r--src/kyclogic/plugin_kyclogic_persona.c45
-rw-r--r--src/lib/exchange_api_add_aml_decision.c26
-rw-r--r--src/lib/exchange_api_auditor_add_denomination.c34
-rw-r--r--src/lib/exchange_api_batch_deposit.c11
-rw-r--r--src/lib/exchange_api_common.c23
-rw-r--r--src/lib/exchange_api_handle.c30
-rw-r--r--src/lib/exchange_api_kyc_check.c6
-rw-r--r--src/lib/exchange_api_link.c27
-rw-r--r--src/lib/exchange_api_lookup_aml_decision.c25
-rw-r--r--src/lib/exchange_api_lookup_aml_decisions.c6
-rw-r--r--src/lib/exchange_api_management_add_partner.c26
-rw-r--r--src/lib/exchange_api_management_auditor_disable.c26
-rw-r--r--src/lib/exchange_api_management_auditor_enable.c22
-rw-r--r--src/lib/exchange_api_management_get_keys.c18
-rw-r--r--src/lib/exchange_api_management_post_extensions.c4
-rw-r--r--src/lib/exchange_api_management_set_global_fee.c26
-rw-r--r--src/lib/exchange_api_management_set_wire_fee.c26
-rw-r--r--src/lib/exchange_api_refreshes_reveal.c17
-rw-r--r--src/lib/exchange_api_refund.c37
-rw-r--r--src/lib/exchange_api_reserves_attest.c6
-rw-r--r--src/lib/exchange_api_reserves_get_attestable.c8
-rw-r--r--src/lib/exchange_api_reserves_history.c8
-rw-r--r--src/lib/exchange_api_reserves_status.c7
-rw-r--r--src/lib/exchange_api_transfers_get.c13
-rw-r--r--src/testing/testing_api_cmd_auditor_add.c8
-rw-r--r--src/testing/testing_api_cmd_auditor_add_denom_sig.c8
-rw-r--r--src/testing/testing_api_cmd_auditor_del.c9
-rw-r--r--src/testing/testing_api_cmd_bank_admin_add_incoming.c47
-rw-r--r--src/testing/testing_api_cmd_bank_transfer.c34
-rw-r--r--src/testing/testing_api_cmd_set_wire_fee.c5
-rw-r--r--src/testing/testing_api_cmd_take_aml_decision.c10
-rw-r--r--src/util/paths.conf6
75 files changed, 1506 insertions, 1254 deletions
diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c
index f0d97bda1..0b8e80e98 100644
--- a/src/bank-lib/bank_api_admin.c
+++ b/src/bank-lib/bank_api_admin.c
@@ -74,25 +74,25 @@ handle_admin_add_incoming_finished (void *cls,
const void *response)
{
struct TALER_BANK_AdminAddIncomingHandle *aai = cls;
- uint64_t row_id = UINT64_MAX;
- struct GNUNET_TIME_Timestamp timestamp;
- enum TALER_ErrorCode ec;
const json_t *j = response;
+ struct TALER_BANK_AdminAddIncomingResponse ir = {
+ .http_status = response_code,
+ .response = response
+ };
aai->job = NULL;
- timestamp = GNUNET_TIME_UNIT_FOREVER_TS;
switch (response_code)
{
case 0:
- ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ ir.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
break;
case MHD_HTTP_OK:
{
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint64 ("row_id",
- &row_id),
+ &ir.details.ok.serial_id),
GNUNET_JSON_spec_timestamp ("timestamp",
- &timestamp),
+ &ir.details.ok.timestamp),
GNUNET_JSON_spec_end ()
};
@@ -102,42 +102,41 @@ handle_admin_add_incoming_finished (void *cls,
NULL, NULL))
{
GNUNET_break_op (0);
- response_code = 0;
- ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ ir.http_status = 0;
+ ir.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
break;
}
- ec = TALER_EC_NONE;
}
break;
case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the bank is buggy
(or API version conflict); just pass JSON reply to the application */
GNUNET_break_op (0);
- ec = TALER_JSON_get_error_code (j);
+ ir.ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_FORBIDDEN:
/* Access denied */
- ec = TALER_JSON_get_error_code (j);
+ ir.ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_UNAUTHORIZED:
/* Nothing really to verify, bank says the password is invalid; we should
pass the JSON reply to the application */
- ec = TALER_JSON_get_error_code (j);
+ ir.ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_NOT_FOUND:
/* Nothing really to verify, maybe account really does not exist.
We should pass the JSON reply to the application */
- ec = TALER_JSON_get_error_code (j);
+ ir.ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_CONFLICT:
/* Nothing to verify, we used the same wire subject
twice? */
- ec = TALER_JSON_get_error_code (j);
+ ir.ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_INTERNAL_SERVER_ERROR:
/* Server had an internal issue; we should retry, but this API
leaves this to the application */
- ec = TALER_JSON_get_error_code (j);
+ ir.ec = TALER_JSON_get_error_code (j);
break;
default:
/* unexpected response code */
@@ -145,15 +144,11 @@ handle_admin_add_incoming_finished (void *cls,
"Unexpected response code %u\n",
(unsigned int) response_code);
GNUNET_break (0);
- ec = TALER_JSON_get_error_code (j);
+ ir.ec = TALER_JSON_get_error_code (j);
break;
}
aai->cb (aai->cb_cls,
- response_code,
- ec,
- row_id,
- timestamp,
- j);
+ &ir);
TALER_BANK_admin_add_incoming_cancel (aai);
}
diff --git a/src/bank-lib/bank_api_transfer.c b/src/bank-lib/bank_api_transfer.c
index 94d8c6b61..0748a0d7e 100644
--- a/src/bank-lib/bank_api_transfer.c
+++ b/src/bank-lib/bank_api_transfer.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015--2020 Taler Systems SA
+ Copyright (C) 2015--2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -158,23 +158,24 @@ handle_transfer_finished (void *cls,
{
struct TALER_BANK_TransferHandle *th = cls;
const json_t *j = response;
- uint64_t row_id = UINT64_MAX;
- struct GNUNET_TIME_Timestamp timestamp = GNUNET_TIME_UNIT_FOREVER_TS;
- enum TALER_ErrorCode ec;
+ struct TALER_BANK_TransferResponse tr = {
+ .http_status = response_code,
+ .response = j
+ };
th->job = NULL;
switch (response_code)
{
case 0:
- ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ tr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
break;
case MHD_HTTP_OK:
{
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint64 ("row_id",
- &row_id),
+ &tr.details.ok.row_id),
GNUNET_JSON_spec_timestamp ("timestamp",
- &timestamp),
+ &tr.details.ok.timestamp),
GNUNET_JSON_spec_end ()
};
@@ -184,39 +185,38 @@ handle_transfer_finished (void *cls,
NULL, NULL))
{
GNUNET_break_op (0);
- response_code = 0;
- ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ tr.http_status = 0;
+ tr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
break;
}
- ec = TALER_EC_NONE;
}
break;
case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the bank is buggy
(or API version conflict); just pass JSON reply to the application */
GNUNET_break_op (0);
- ec = TALER_JSON_get_error_code (j);
+ tr.ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_UNAUTHORIZED:
/* Nothing really to verify, bank says our credentials are
invalid. We should pass the JSON reply to the application. */
- ec = TALER_JSON_get_error_code (j);
+ tr.ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_NOT_FOUND:
/* Nothing really to verify, endpoint wrong -- could be user unknown */
- ec = TALER_JSON_get_error_code (j);
+ tr.ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_CONFLICT:
/* Nothing really to verify. Server says we used the same transfer request
UID before, but with different details. Should not happen if the user
properly used #TALER_BANK_prepare_transfer() and our PRNG is not
broken... */
- ec = TALER_JSON_get_error_code (j);
+ tr.ec = TALER_JSON_get_error_code (j);
break;
case MHD_HTTP_INTERNAL_SERVER_ERROR:
/* Server had an internal issue; we should retry, but this API
leaves this to the application */
- ec = TALER_JSON_get_error_code (j);
+ tr.ec = TALER_JSON_get_error_code (j);
break;
default:
/* unexpected response code */
@@ -224,14 +224,11 @@ handle_transfer_finished (void *cls,
"Unexpected response code %u\n",
(unsigned int) response_code);
GNUNET_break (0);
- ec = TALER_JSON_get_error_code (j);
+ tr.ec = TALER_JSON_get_error_code (j);
break;
}
th->cb (th->cb_cls,
- response_code,
- ec,
- row_id,
- timestamp);
+ &tr);
TALER_BANK_transfer_cancel (th);
}
diff --git a/src/bank-lib/taler-exchange-wire-gateway-client.c b/src/bank-lib/taler-exchange-wire-gateway-client.c
index a972bcfd2..0d4bba000 100644
--- a/src/bank-lib/taler-exchange-wire-gateway-client.c
+++ b/src/bank-lib/taler-exchange-wire-gateway-client.c
@@ -357,34 +357,28 @@ execute_debit_history (void)
* execution.
*
* @param cls closure
- * @param response_code HTTP status code
- * @param ec taler error code
- * @param row_id unique ID of the wire transfer in the bank's records
- * @param timestamp when did the transaction go into effect
+ * @param tr response details
*/
static void
confirmation_cb (void *cls,
- unsigned int response_code,
- enum TALER_ErrorCode ec,
- uint64_t row_id,
- struct GNUNET_TIME_Timestamp timestamp)
+ const struct TALER_BANK_TransferResponse *tr)
{
(void) cls;
eh = NULL;
- if (MHD_HTTP_OK != response_code)
+ if (MHD_HTTP_OK != tr->http_status)
{
fprintf (stderr,
"The wire transfer didn't execute correctly (%u/%d).\n",
- response_code,
- ec);
+ tr->http_status,
+ tr->ec);
GNUNET_SCHEDULER_shutdown ();
return;
}
fprintf (stdout,
"Wire transfer #%llu executed successfully at %s.\n",
- (unsigned long long) row_id,
- GNUNET_TIME_timestamp2s (timestamp));
+ (unsigned long long) tr->details.ok.row_id,
+ GNUNET_TIME_timestamp2s (tr->details.ok.timestamp));
global_ret = 0;
GNUNET_SCHEDULER_shutdown ();
}
@@ -464,39 +458,29 @@ execute_wire_transfer (void)
* Function called with the result of the operation.
*
* @param cls closure
- * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
- * 0 if the bank's reply is bogus (fails to follow the protocol)
- * @param ec detailed error code
- * @param serial_id unique ID of the wire transfer in the bank's records; UINT64_MAX on error
- * @param timestamp timestamp when the transaction got settled at the bank.
- * @param json detailed response from the HTTPD, or NULL if reply was not in JSON
+ * @param air response details
*/
static void
res_cb (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
- uint64_t serial_id,
- struct GNUNET_TIME_Timestamp timestamp,
- const json_t *json)
+ const struct TALER_BANK_AdminAddIncomingResponse *air)
{
(void) cls;
- (void) timestamp;
op = NULL;
- switch (ec)
+ switch (air->http_status)
{
- case TALER_EC_NONE:
+ case MHD_HTTP_OK:
global_ret = 0;
fprintf (stdout,
"%llu\n",
- (unsigned long long) serial_id);
+ (unsigned long long) air->details.ok.serial_id);
break;
default:
fprintf (stderr,
"Operation failed with status code %u/%u\n",
- (unsigned int) ec,
- http_status);
- if (NULL != json)
- json_dumpf (json,
+ (unsigned int) air->ec,
+ air->http_status);
+ if (NULL != air->response)
+ json_dumpf (air->response,
stderr,
JSON_INDENT (2));
break;
diff --git a/src/benchmark/Makefile.am b/src/benchmark/Makefile.am
index b62e88465..de93cc748 100644
--- a/src/benchmark/Makefile.am
+++ b/src/benchmark/Makefile.am
@@ -15,6 +15,10 @@ bin_PROGRAMS = \
taler-bank-benchmark \
taler-exchange-benchmark
+bin_SCRIPTS = \
+ taler-benchmark-setup.sh
+
+
taler_aggregator_benchmark_SOURCES = \
taler-aggregator-benchmark.c
taler_aggregator_benchmark_LDADD = \
@@ -64,6 +68,12 @@ taler_exchange_benchmark_LDADD = \
$(XLIB)
EXTRA_DIST = \
+ benchmark-common.conf \
benchmark-cs.conf \
benchmark-rsa.conf \
+ bank-benchmark-cs.conf \
+ bank-benchmark-rsa.conf \
+ coins-cs.conf \
+ coins-rsa.conf \
+ $(bin_SCRIPTS) \
exchange_benchmark_home/.local/share/taler/exchange/offline-keys/master.priv
diff --git a/src/benchmark/bank-benchmark-cs.conf b/src/benchmark/bank-benchmark-cs.conf
index e32370f89..d1d75d740 100644
--- a/src/benchmark/bank-benchmark-cs.conf
+++ b/src/benchmark/bank-benchmark-cs.conf
@@ -1,128 +1,17 @@
# This file is in the public domain.
-#
-[paths]
-# Persistent data storage for the testcase
-# This value is a default for `taler_config_home'
-taler_test_home = exchange_benchmark_home/
-
-[taler]
-# Currency supported by the exchange (can only be one)
-currency = EUR
-CURRENCY_ROUND_UNIT = EUR:0.01
-
-[exchange]
-# how long is one signkey valid?
-signkey_duration = 4 weeks
-signkey_legal_duration = 2 years
-# how long do we provide to clients denomination and signing keys
-# ahead of time?
-# Keep it short so the test runs fast.
-lookahead_sign = 12h
-# HTTP port the exchange listens to
-port = 8081
-# Master public key used to sign the exchange's various keys
-master_public_key = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
-# How to access our database
-DB = postgres
-# Base URL of the exchange. Must be set to a URL where the
-# exchange (or the twister) is actually listening.
-base_url = "http://localhost:8081/"
-
-WIREWATCH_IDLE_SLEEP_INTERVAL = 500 ms
-
-[exchange-offline]
-MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv
-
-[auditor]
-BASE_URL = "http://localhost:8083/"
-
-[exchangedb-postgres]
-config = "postgres:///talercheck"
-
-[benchmark-remote-exchange]
-host = localhost
-# Adjust $HOME to match remote target!
-dir = $HOME/repos/taler/exchange/src/benchmark
-
-[bank]
-HTTP_PORT = 8082
-SERVE = http
-MAX_DEBT = EUR:100000000000.0
-MAX_DEBT_BANK = EUR:1000000000000000.0
-
-[benchmark]
-USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42?receiver-name=user42
+@INLINE@ benchmark-common.conf
+@INLINE@ coins-cs.conf
[exchange-account-2]
# What is the payto://-URL of the exchange (to generate wire response)
PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange?receiver-name=Exchange"
-enable_debit = YES
-enable_credit = YES
+ENABLE_DEBIT = YES
+ENABLE_CREDIT = YES
[exchange-accountcredentials-2]
# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
# Authentication information for basic authentication
WIRE_GATEWAY_AUTH_METHOD = "basic"
-username = Exchange
-password = x
-
-
-
-
-# Sections starting with "coin_" specify which denominations
-# the exchange should support (and their respective fee structure)
-[coin_eur_ct_1]
-value = EUR:0.01
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.00
-fee_deposit = EUR:0.00
-fee_refresh = EUR:0.01
-fee_refund = EUR:0.01
-CIPHER = CS
-
-[coin_eur_ct_10]
-value = EUR:0.10
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = CS
-
-[coin_eur_1]
-value = EUR:1
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = CS
-
-[coin_eur_5]
-value = EUR:5
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = CS
-
-[coin_eur_10]
-value = EUR:10
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = CS
+USERNAME = Exchange
+PASSWORD = x
diff --git a/src/benchmark/bank-benchmark-rsa.conf b/src/benchmark/bank-benchmark-rsa.conf
index 41934b086..d1d75d740 100644
--- a/src/benchmark/bank-benchmark-rsa.conf
+++ b/src/benchmark/bank-benchmark-rsa.conf
@@ -1,133 +1,17 @@
# This file is in the public domain.
-#
-[paths]
-# Persistent data storage for the testcase
-# This value is a default for `taler_config_home'
-taler_test_home = exchange_benchmark_home/
-
-[taler]
-# Currency supported by the exchange (can only be one)
-currency = EUR
-CURRENCY_ROUND_UNIT = EUR:0.01
-
-[exchange]
-# how long is one signkey valid?
-signkey_duration = 4 weeks
-signkey_legal_duration = 2 years
-# how long do we provide to clients denomination and signing keys
-# ahead of time?
-# Keep it short so the test runs fast.
-lookahead_sign = 12h
-# HTTP port the exchange listens to
-port = 8081
-# Master public key used to sign the exchange's various keys
-master_public_key = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
-# How to access our database
-DB = postgres
-# Base URL of the exchange. Must be set to a URL where the
-# exchange (or the twister) is actually listening.
-base_url = "http://localhost:8081/"
-
-WIREWATCH_IDLE_SLEEP_INTERVAL = 1500 ms
-
-[exchange-offline]
-MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv
-
-[auditor]
-BASE_URL = "http://localhost:8083/"
-
-[exchangedb-postgres]
-config = "postgres://exchange:taler@192.168.42.42/exchange"
-
-[benchmark-remote-exchange]
-host = localhost
-# Adjust $HOME to match remote target!
-dir = $HOME/repos/taler/exchange/src/benchmark
-
-[bank]
-HTTP_PORT = 8082
-SERVE = http
-MAX_DEBT = EUR:100000000000.0
-MAX_DEBT_BANK = EUR:1000000000000000.0
-
-[benchmark]
-USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42
+@INLINE@ benchmark-common.conf
+@INLINE@ coins-cs.conf
[exchange-account-2]
# What is the payto://-URL of the exchange (to generate wire response)
-PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange"
-enable_debit = YES
-enable_credit = YES
+PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange?receiver-name=Exchange"
+ENABLE_DEBIT = YES
+ENABLE_CREDIT = YES
[exchange-accountcredentials-2]
# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
# Authentication information for basic authentication
WIRE_GATEWAY_AUTH_METHOD = "basic"
-username = Exchange
-password = x
-
-
-
-
-# Sections starting with "coin_" specify which denominations
-# the exchange should support (and their respective fee structure)
-[coin_eur_ct_1]
-value = EUR:0.01
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.00
-fee_deposit = EUR:0.00
-fee_refresh = EUR:0.01
-fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 2048
-
-[coin_eur_ct_10]
-value = EUR:0.10
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 2048
-
-[coin_eur_1]
-value = EUR:1
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 2048
-
-[coin_eur_5]
-value = EUR:5
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 2048
-
-[coin_eur_10]
-value = EUR:10
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 2048
+USERNAME = Exchange
+PASSWORD = x
diff --git a/src/benchmark/benchmark-common.conf b/src/benchmark/benchmark-common.conf
new file mode 100644
index 000000000..1cd28d622
--- /dev/null
+++ b/src/benchmark/benchmark-common.conf
@@ -0,0 +1,59 @@
+# This file is in the public domain.
+[paths]
+TALER_TEST_HOME=exchange_benchmark_home/
+
+[taler]
+CURRENCY=EUR
+CURRENCY_ROUND_UNIT=EUR:0.01
+
+[exchange]
+AML_THRESHOLD=EUR:99999999
+SIGNKEY_LEGAL_DURATION=2 years
+PORT=8081
+MASTER_PUBLIC_KEY=98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
+DB=postgres
+BASE_URL="http://localhost:8081/"
+AGGREGATOR_SHARD_SIZE=67108864
+WIREWATCH_IDLE_SLEEP_INTERVAL=5 ms
+
+[taler-exchange-secmod-rsa]
+LOOKAHEAD_SIGN="1 d"
+
+[taler-exchange-secmod-cs]
+LOOKAHEAD_SIGN="1 d"
+
+[taler-exchange-secmod-eddsa]
+DURATION="2 d"
+LOOKAHEAD_SIGN="1 d"
+
+[exchangedb-postgres]
+CONFIG="postgres:///talercheck"
+
+[exchange-offline]
+MASTER_PRIV_FILE=${TALER_DATA_HOME}/exchange/offline-keys/master.priv
+
+[bank]
+HTTP_PORT=8082
+SERVE=http
+MAX_DEBT=EUR:100000000000.0
+MAX_DEBT_BANK=EUR:1000000000000000.0
+DATABASE=bank-db.sqlite3
+
+[libeufin-nexus]
+DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix."
+#DB_CONNECTION="jdbc:sqlite:libeufin-nexus.sqlite3"
+
+[libeufin-sandbox]
+DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix."
+#DB_CONNECTION="jdbc:sqlite:libeufin-sandbox.sqlite3"
+
+[auditor]
+BASE_URL="http://localhost:8083/"
+
+[benchmark-remote-exchange]
+HOST=localhost
+# Adjust $HOME to match remote target!
+DIR=$HOME/repos/taler/exchange/src/benchmark
+
+[benchmark]
+USER_PAYTO_URI="payto://x-taler-bank/localhost:8082/42?receiver-name=user42"
diff --git a/src/benchmark/benchmark-cs.conf b/src/benchmark/benchmark-cs.conf
index 79721be14..db44e4d1b 100644
--- a/src/benchmark/benchmark-cs.conf
+++ b/src/benchmark/benchmark-cs.conf
@@ -1,60 +1,6 @@
# This file is in the public domain.
-#
-[paths]
-# Persistent data storage for the testcase
-# This value is a default for `taler_config_home'
-TALER_TEST_HOME = exchange_benchmark_home/
-
-[taler]
-# Currency supported by the exchange (can only be one)
-CURRENCY = EUR
-CURRENCY_ROUND_UNIT = EUR:0.01
-
-[exchange]
-
-AML_THRESHOLD = EUR:99999999
-SIGNKEY_LEGAL_DURATION = 2 years
-
-# HTTP port the exchange listens to
-PORT = 8081
-# Master public key used to sign the exchange's various keys
-MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
-# How to access our database
-DB = postgres
-# Base URL of the exchange. Must be set to a URL where the
-# exchange (or the twister) is actually listening.
-BASE_URL = "http://localhost:8081/"
-
-AGGREGATOR_SHARD_SIZE = 67108864
-#AGGREGATOR_SHARD_SIZE = 2147483648
-
-
-
-WIREWATCH_IDLE_SLEEP_INTERVAL = 5 ms
-
-[exchange-offline]
-MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv
-
-[auditor]
-BASE_URL = "http://localhost:8083/"
-
-[exchangedb-postgres]
-CONFIG = "postgres:///talercheck"
-
-[benchmark-remote-exchange]
-HOST = localhost
-# Adjust $HOME to match remote target!
-DIR = $HOME/repos/taler/exchange/src/benchmark
-
-[bank]
-HTTP_PORT = 8082
-SERVE = http
-MAX_DEBT = EUR:100000000000.0
-MAX_DEBT_BANK = EUR:1000000000000000.0
-DATABASE = bank-db.sqlite3
-
-[benchmark]
-USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42
+@INLINE@ benchmark-common.conf
+@INLINE@ coins-cs.conf
[exchange-account-test]
# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
@@ -68,61 +14,3 @@ WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
WIRE_GATEWAY_AUTH_METHOD = "basic"
USERNAME = Exchange
PASSWORD = x
-
-
-# Sections starting with "coin_" specify which denominations
-# the exchange should support (and their respective fee structure)
-[coin_eur_ct_1]
-value = EUR:0.01
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.00
-fee_deposit = EUR:0.00
-fee_refresh = EUR:0.01
-fee_refund = EUR:0.01
-CIPHER = CS
-
-[coin_eur_ct_10]
-value = EUR:0.10
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = CS
-
-[coin_eur_1]
-value = EUR:1
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = CS
-
-[coin_eur_5]
-value = EUR:5
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = CS
-
-[coin_eur_10]
-value = EUR:10
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = CS
diff --git a/src/benchmark/benchmark-rsa.conf b/src/benchmark/benchmark-rsa.conf
index 5e44781d1..bd4a90cf3 100644
--- a/src/benchmark/benchmark-rsa.conf
+++ b/src/benchmark/benchmark-rsa.conf
@@ -1,60 +1,6 @@
# This file is in the public domain.
-#
-[paths]
-# Persistent data storage for the testcase
-# This value is a default for `taler_config_home'
-TALER_TEST_HOME = exchange_benchmark_home/
-
-[taler]
-# Currency supported by the exchange (can only be one)
-CURRENCY = EUR
-CURRENCY_ROUND_UNIT = EUR:0.01
-
-[exchange]
-
-AML_THRESHOLD = EUR:99999999
-SIGNKEY_LEGAL_DURATION = 2 years
-
-# HTTP port the exchange listens to
-PORT = 8081
-# Master public key used to sign the exchange's various keys
-MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
-# How to access our database
-DB = postgres
-# Base URL of the exchange. Must be set to a URL where the
-# exchange (or the twister) is actually listening.
-BASE_URL = "http://localhost:8081/"
-
-AGGREGATOR_SHARD_SIZE = 67108864
-#AGGREGATOR_SHARD_SIZE = 2147483648
-
-
-
-WIREWATCH_IDLE_SLEEP_INTERVAL = 5 ms
-
-[exchange-offline]
-MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv
-
-[auditor]
-BASE_URL = "http://localhost:8083/"
-
-[exchangedb-postgres]
-CONFIG = "postgres:///talercheck"
-
-[benchmark-remote-exchange]
-HOST = localhost
-# Adjust $HOME to match remote target!
-DIR = $HOME/repos/taler/exchange/src/benchmark
-
-[bank]
-HTTP_PORT = 8082
-SERVE = http
-MAX_DEBT = EUR:100000000000.0
-MAX_DEBT_BANK = EUR:1000000000000000.0
-DATABASE = bank-db.sqlite3
-
-[benchmark]
-USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42
+@INLINE@ benchmark-common.conf
+@INLINE@ coins-rsa.conf
[exchange-account-test]
# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
@@ -68,66 +14,3 @@ WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
WIRE_GATEWAY_AUTH_METHOD = "basic"
USERNAME = Exchange
PASSWORD = x
-
-
-# Sections starting with "coin_" specify which denominations
-# the exchange should support (and their respective fee structure)
-[coin_eur_ct_1]
-value = EUR:0.01
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.00
-fee_deposit = EUR:0.00
-fee_refresh = EUR:0.01
-fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 2048
-
-[coin_eur_ct_10]
-value = EUR:0.10
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 2048
-
-[coin_eur_1]
-value = EUR:1
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 2048
-
-[coin_eur_5]
-value = EUR:5
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 2048
-
-[coin_eur_10]
-value = EUR:10
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 2048
diff --git a/src/benchmark/coins-cs.conf b/src/benchmark/coins-cs.conf
new file mode 100644
index 000000000..c4b5a45c1
--- /dev/null
+++ b/src/benchmark/coins-cs.conf
@@ -0,0 +1,58 @@
+# This file is in the public domain.
+#
+# Sections starting with "coin_" specify which denominations
+# the exchange should support (and their respective fee structure)
+[coin_eur_ct_1]
+value = EUR:0.01
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = EUR:0.00
+fee_deposit = EUR:0.00
+fee_refresh = EUR:0.01
+fee_refund = EUR:0.01
+CIPHER = CS
+
+[coin_eur_ct_10]
+value = EUR:0.10
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = EUR:0.01
+fee_deposit = EUR:0.01
+fee_refresh = EUR:0.03
+fee_refund = EUR:0.01
+CIPHER = CS
+
+[coin_eur_1]
+value = EUR:1
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = EUR:0.01
+fee_deposit = EUR:0.01
+fee_refresh = EUR:0.03
+fee_refund = EUR:0.01
+CIPHER = CS
+
+[coin_eur_5]
+value = EUR:5
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = EUR:0.01
+fee_deposit = EUR:0.01
+fee_refresh = EUR:0.03
+fee_refund = EUR:0.01
+CIPHER = CS
+
+[coin_eur_10]
+value = EUR:10
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = EUR:0.01
+fee_deposit = EUR:0.01
+fee_refresh = EUR:0.03
+fee_refund = EUR:0.01
+CIPHER = CS
diff --git a/src/benchmark/coins-rsa.conf b/src/benchmark/coins-rsa.conf
new file mode 100644
index 000000000..42eb8acfc
--- /dev/null
+++ b/src/benchmark/coins-rsa.conf
@@ -0,0 +1,63 @@
+# This file is in the public domain.
+#
+# Sections starting with "coin_" specify which denominations
+# the exchange should support (and their respective fee structure)
+[coin_eur_ct_1]
+value = EUR:0.01
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = EUR:0.00
+fee_deposit = EUR:0.00
+fee_refresh = EUR:0.01
+fee_refund = EUR:0.01
+CIPHER = RSA
+rsa_keysize = 2048
+
+[coin_eur_ct_10]
+value = EUR:0.10
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = EUR:0.01
+fee_deposit = EUR:0.01
+fee_refresh = EUR:0.03
+fee_refund = EUR:0.01
+CIPHER = RSA
+rsa_keysize = 2048
+
+[coin_eur_1]
+value = EUR:1
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = EUR:0.01
+fee_deposit = EUR:0.01
+fee_refresh = EUR:0.03
+fee_refund = EUR:0.01
+CIPHER = RSA
+rsa_keysize = 2048
+
+[coin_eur_5]
+value = EUR:5
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = EUR:0.01
+fee_deposit = EUR:0.01
+fee_refresh = EUR:0.03
+fee_refund = EUR:0.01
+CIPHER = RSA
+rsa_keysize = 2048
+
+[coin_eur_10]
+value = EUR:10
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = EUR:0.01
+fee_deposit = EUR:0.01
+fee_refresh = EUR:0.03
+fee_refund = EUR:0.01
+CIPHER = RSA
+rsa_keysize = 2048
diff --git a/src/benchmark/taler-benchmark-setup.sh b/src/benchmark/taler-benchmark-setup.sh
new file mode 100755
index 000000000..52e0e08bc
--- /dev/null
+++ b/src/benchmark/taler-benchmark-setup.sh
@@ -0,0 +1,556 @@
+#!/bin/bash
+#
+# This file is part of TALER
+# Copyright (C) 2023 Taler Systems SA
+#
+# TALER is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3, or
+# (at your option) any later version.
+#
+# TALER is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with TALER; see the file COPYING. If not, see
+# <http://www.gnu.org/licenses/>
+#
+
+set -eu
+
+# Exit, with status code "skip" (no 'real' failure)
+function exit_skip() {
+ echo " SKIP: " "$@"
+ exit 77
+}
+
+# Exit, with error message (hard failure)
+function exit_fail() {
+ echo " FAIL: " "$@"
+ exit 1
+}
+
+# Cleanup to run whenever we exit
+function cleanup()
+{
+ for n in $(jobs -p)
+ do
+ kill $n 2> /dev/null || true
+ done
+ wait
+}
+
+# Install cleanup handler (except for kill -9)
+trap cleanup EXIT
+
+START_AUDITOR=0
+START_EXCHANGE=0
+START_FAKEBANK=0
+START_MERCHANT=0
+START_NEXUS=0
+START_SANDBOX=0
+CONF_ORIG="~/.config/taler.conf"
+LOGLEVEL="DEBUG"
+
+# Parse command-line options
+while getopts ':abc:efhl:ms' OPTION; do
+ case "$OPTION" in
+ a)
+ START_AUDITOR="1"
+ ;;
+ c)
+ CONF_ORIG="$OPTARG"
+ ;;
+ e)
+ START_EXCHANGE="1"
+ ;;
+ f)
+ START_FAKEBANK="1"
+ ;;
+ h)
+ echo 'Supported options:'
+ echo ' -a -- start auditor'
+ echo ' -c $CONF -- set configuration'
+ echo ' -e -- start exchange'
+ echo ' -f -- start fakebank'
+ echo ' -h -- print this help'
+ echo ' -l $LOGLEVEL -- set log level'
+ echo ' -m -- start merchant'
+ echo ' -n -- start nexus'
+ echo ' -s -- start sandbox'
+ exit 0
+ ;;
+ l)
+ LOGLEVEL="$OPTARG"
+ ;;
+ m)
+ START_MERCHANT="1"
+ ;;
+ n)
+ START_NEXUS="1"
+ ;;
+ s)
+ START_SANDBOX="1"
+ ;;
+ ?)
+ exit_fail "Unrecognized command line option"
+ ;;
+ esac
+done
+
+echo "Starting with configuration file at: $CONF_ORIG"
+CONF="$CONF_ORIG.edited"
+cp "${CONF_ORIG}" "${CONF}"
+
+echo -n "Testing for jq"
+jq -h > /dev/null || exit_skip " jq required"
+echo " FOUND"
+
+if [ "1" = "$START_EXCHANGE" ]
+then
+ echo -n "Testing for Taler exchange"
+ taler-exchange-httpd -h > /dev/null || exit_skip " taler-exchange-httpd required"
+ echo " FOUND"
+fi
+
+if [ "1" = "$START_MERCHANT" ]
+then
+ echo -n "Testing for Taler merchant"
+ taler-merchant-httpd -h > /dev/null || exit_skip " taler-merchant-httpd required"
+ echo " FOUND"
+fi
+
+if [ "1" = "$START_NEXUS" ]
+then
+ echo -n "Testing for libeufin-cli"
+ libeufin-cli --help >/dev/null </dev/null || exit_skip " MISSING"
+ echo " FOUND"
+fi
+
+EXCHANGE_URL=$(taler-config -c "$CONF" -s "EXCHANGE" -o "BASE_URL")
+CURRENCY=$(taler-config -c "$CONF" -s "TALER" -o "CURRENCY")
+
+register_sandbox_account() {
+ export LIBEUFIN_SANDBOX_USERNAME="$1"
+ export LIBEUFIN_SANDBOX_PASSWORD="$2"
+ libeufin-cli sandbox \
+ demobank \
+ register --name "$3"
+ unset LIBEUFIN_SANDBOX_USERNAME
+ unset LIBEUFIN_SANDBOX_PASSWORD
+}
+
+
+BANK_PORT=$(taler-config -c "$CONF" -s "BANK" -o "HTTP_PORT")
+if [ "1" = "$START_NEXUS" ]
+then
+ NEXUS_PORT="$BANK_PORT"
+ SANDBOX_PORT="1$BANK_PORT"
+else
+ NEXUS_PORT="0"
+ SANDBOX_PORT="1$BANK_PORT"
+fi
+
+if [ "1" = "$START_SANDBOX" ]
+then
+ export LIBEUFIN_SANDBOX_DB_CONNECTION=$(taler-config -c "$CONF" -s "libeufin-sandbox" -o "DB_CONNECTION")
+
+ # Create the default demobank.
+ libeufin-sandbox config --currency "$CURRENCY" default
+ export LIBEUFIN_SANDBOX_ADMIN_PASSWORD="secret"
+ libeufin-sandbox serve \
+ --port "$SANDBOX_PORT" \
+ > libeufin-sandbox-stdout.log \
+ 2> libeufin-sandbox-stderr.log &
+ echo $! > libeufin-sandbox.pid
+ export LIBEUFIN_SANDBOX_URL="http://localhost:$SANDBOX_PORT/"
+ set +e
+ OK="0"
+ echo -n "Waiting for Sandbox ..."
+ for n in $(seq 1 100); do
+ echo -n "."
+ sleep 0.2
+ if wget --timeout=1 \
+ --tries=3 \
+ --waitretry=0 \
+ -o /dev/null \
+ -O /dev/null \
+ "$LIBEUFIN_SANDBOX_URL";
+ then
+ OK="1"
+ break
+ fi
+ done
+ if [ "1" != "$OK" ]
+ then
+ exit_skip "Failed to launch services (sandbox)"
+ fi
+ echo "OK"
+ set -e
+ echo -n "Register Sandbox users ..."
+ register_sandbox_account fortytwo x "Forty Two"
+ register_sandbox_account fortythree x "Forty Three"
+ register_sandbox_account exchange x "Exchange Company"
+ register_sandbox_account tor x "Tor Project"
+ register_sandbox_account gnunet x "GNUnet"
+ register_sandbox_account tutorial x "Tutorial"
+ register_sandbox_account survey x "Survey"
+ echo " DONE"
+
+ echo -n "Fixing up exchange's PAYTO_URI in the config ..."
+ export LIBEUFIN_SANDBOX_USERNAME="exchange"
+ export LIBEUFIN_SANDBOX_PASSWORD="x"
+ EXCHANGE_PAYTO=$(libeufin-cli sandbox demobank info --bank-account exchange | jq --raw-output '.paytoUri')
+ taler-config -c "$CONF" -s exchange-account-1 -o "PAYTO_URI" -V "$EXCHANGE_PAYTO"
+ echo " OK"
+
+ echo -n "Setting this exchange as the bank's default ..."
+ libeufin-sandbox default-exchange "$EXCHANGE_URL" "$EXCHANGE_PAYTO"
+ echo " OK"
+
+ # Prepare EBICS: create Ebics host and Exchange subscriber.
+ # Shortly becoming admin to setup Ebics.
+ export LIBEUFIN_SANDBOX_USERNAME="admin"
+ export LIBEUFIN_SANDBOX_PASSWORD="secret"
+ echo -n "Create EBICS host at Sandbox.."
+ libeufin-cli sandbox \
+ --sandbox-url "$LIBEUFIN_SANDBOX_URL" \
+ ebicshost create --host-id talerebics
+ echo "OK"
+ echo -n "Create exchange EBICS subscriber at Sandbox.."
+ libeufin-cli sandbox \
+ demobank new-ebicssubscriber --host-id talerebics \
+ --user-id exchangeebics --partner-id talerpartner \
+ --bank-account exchange # that's a username _and_ a bank account name
+ echo "OK"
+ unset LIBEUFIN_SANDBOX_USERNAME
+ unset LIBEUFIN_SANDBOX_PASSWORD
+fi
+
+if [ "1" = "$START_NEXUS" ]
+then
+ echo "Setting up Nexus ..."
+
+ # Prepare Nexus, which is the side actually talking
+ # to the exchange.
+ export LIBEUFIN_SANDBOX_DB_CONNECTION=$(taler-config -c "$CONF" -s "libeufin-nexus" -o "DB_CONNECTION")
+
+ # For convenience, username and password are
+ # identical to those used at the Sandbox.
+ echo -n "Create exchange Nexus user ..."
+ libeufin-nexus superuser exchange --password x
+ echo "OK"
+ libeufin-nexus serve --port "$NEXUS_PORT" \
+ 2> libeufin-nexus-stderr.log \
+ > libeufin-nexus-stdout.log &
+ echo $! > libeufin-nexus.pid
+ export LIBEUFIN_NEXUS_URL="http://localhost:$NEXUS_PORT"
+ echo -n "Waiting for Nexus ..."
+ set +e
+ OK="0"
+ for n in $(seq 1 100); do
+ echo -n "."
+ sleep 0.2
+ if wget --timeout=1 \
+ --tries=3 \
+ --waitretry=0 \
+ -o /dev/null \
+ -O /dev/null \
+ "$LIBEUFIN_NEXUS_URL";
+ then
+ OK="1"
+ break
+ fi
+ done
+ if [ "1" != "$OK" ]
+ then
+ exit_skip "Failed to launch services (bank)"
+ fi
+ set -e
+ echo " OK"
+
+ export LIBEUFIN_NEXUS_USERNAME=exchange
+ export LIBEUFIN_NEXUS_PASSWORD=x
+ echo -n "Creating a EBICS connection at Nexus ..."
+ libeufin-cli connections new-ebics-connection \
+ --ebics-url "http://localhost:$SANDBOX_PORT/ebicsweb" \
+ --host-id talerebics \
+ --partner-id talerpartner \
+ --ebics-user-id exchangeebics \
+ talerconn
+ echo "OK"
+
+ echo -n "Setup EBICS keying ..."
+ libeufin-cli connections connect talerconn > /dev/null
+ echo "OK"
+ echo -n "Download bank account name from Sandbox ..."
+ libeufin-cli connections download-bank-accounts talerconn
+ echo "OK"
+ echo -n "Importing bank account info into Nexus ..."
+ libeufin-cli connections import-bank-account \
+ --offered-account-id exchange \
+ --nexus-bank-account-id exchange-nexus \
+ talerconn
+ echo "OK"
+ echo -n "Setup payments submission task..."
+ # Tries every second.
+ libeufin-cli accounts task-schedule \
+ --task-type submit \
+ --task-name exchange-payments \
+ --task-cronspec "* * *" \
+ exchange-nexus
+ echo "OK"
+ # Tries every second. Ask C52
+ echo -n "Setup history fetch task..."
+ libeufin-cli accounts task-schedule \
+ --task-type fetch \
+ --task-name exchange-history \
+ --task-cronspec "* * *" \
+ --task-param-level report \
+ --task-param-range-type latest \
+ exchange-nexus
+ echo "OK"
+ # create Taler facade.
+ echo -n "Create the Taler facade at Nexus..."
+ libeufin-cli facades \
+ new-taler-wire-gateway-facade \
+ --currency TESTKUDOS --facade-name test-facade \
+ talerconn exchange-nexus
+ echo "OK"
+ # Facade schema: http://localhost:$NEXUS_PORT/facades/test-facade/taler-wire-gateway/
+ # FIXME: set the above URL automatically in the configuration?
+fi
+
+if [ "1" = "$START_FAKEBANK" ]
+then
+ echo "Setting up fakebank ..."
+ taler-fakebank-run -c "$CONF" -L "$LOGLEVEL" 2> taler-fakebank-run.log &
+fi
+
+
+if [ "1" = "$START_EXCHANGE" ]
+then
+ echo -n "Starting exchange ..."
+
+ MASTER_PRIV_FILE=$(taler-config -f -c "${CONF}" -s "EXCHANGE-OFFLINE" -o "MASTER_PRIV_FILE")
+ MASTER_PRIV_DIR=$(dirname "$MASTER_PRIV_FILE")
+ mkdir -p "${MASTER_PRIV_DIR}"
+ gnunet-ecc -g1 "$MASTER_PRIV_FILE" > /dev/null 2> /dev/null
+ MASTER_PUB=$(gnunet-ecc -p "${MASTER_PRIV_FILE}")
+ MPUB=$(taler-config -c "$CONF" -s exchange -o MASTER_PUBLIC_KEY)
+ if [ "$MPUB" != "$MASTER_PUB" ]
+ then
+ echo -n " patching master_pub ($MASTER_PUB)..."
+ taler-config -c $CONF -s exchange -o MASTER_PUBLIC_KEY -V "$MASTER_PUB"
+ fi
+ taler-exchange-dbinit -c "$CONF"
+ taler-exchange-secmod-eddsa -c "$CONF" -L "$LOGLEVEL" 2> taler-exchange-secmod-eddsa.log &
+ taler-exchange-secmod-rsa -c "$CONF" -L "$LOGLEVEL" 2> taler-exchange-secmod-rsa.log &
+ taler-exchange-secmod-cs -c "$CONF" -L "$LOGLEVEL" 2> taler-exchange-secmod-cs.log &
+ taler-exchange-httpd -c "$CONF" -L "$LOGLEVEL" 2> taler-exchange-httpd.log &
+ EXCHANGE_HTTPD_PID=$!
+ taler-exchange-wirewatch -c "$CONF" 2> taler-exchange-wirewatch.log &
+ WIREWATCH_PID=$!
+ echo " DONE"
+fi
+
+if [ "1" = "$START_MERCHANT" ]
+then
+ echo -n "Starting merchant ..."
+ MERCHANT_PORT=$(taler-config -c "$CONF" -s MERCHANT -o PORT)
+ MERCHANT_URL="http://localhost:${MERCHANT_PORT}/"
+ taler-merchant-dbinit -c "$CONF"
+ taler-merchant-httpd -c "$CONF" -L "$LOGLEVEL" 2> taler-merchant-httpd.log &
+ MERCHANT_HTTPD_PID=$!
+ echo " DONE"
+fi
+
+if [ "1" = "$START_AUDITOR" ]
+then
+ echo -n "Starting auditor ..."
+ AUDITOR_URL="http://localhost:8083/"
+ AUDITOR_PRIV_FILE=$(taler-config -f -c "$CONF" -s AUDITOR -o AUDITOR_PRIV_FILE)
+ AUDITOR_PRIV_DIR=$(dirname "$AUDITOR_PRIV_FILE")
+ mkdir -p "$AUDITOR_PRIV_DIR"
+ gnunet-ecc -g1 "$AUDITOR_PRIV_FILE" > /dev/null 2> /dev/null
+ AUDITOR_PUB=$(gnunet-ecc -p "${AUDITOR_PRIV_FILE}")
+ taler-auditor-dbinit -c "$CONF"
+ taler-auditor-exchange -c "$CONF" -m "$MASTER_PUB" -u "$EXCHANGE_URL"
+ taler-auditor-httpd -L "$LOGLEVEL" -c "$CONF" 2> taler-auditor-httpd.log &
+ echo " DONE"
+fi
+
+if [[ "1" = "$START_NEXUS" || "1" = "$START_FAKEBANK" ]]
+then
+ echo -n "Waiting for the bank"
+ # Wait for bank to be available (usually the slowest)
+ OK="0"
+ for n in $(seq 1 300)
+ do
+ echo -n "."
+ sleep 0.1
+ # bank
+ wget --tries=1 \
+ --waitretry=0 \
+ --timeout=1 \
+ --user admin \
+ --password secret \
+ "http://localhost:8082/" \
+ -o /dev/null \
+ -O /dev/null >/dev/null || continue
+ OK="1"
+ break
+ done
+ if [ "1" != "$OK" ]
+ then
+ exit_skip "Failed to launch services (bank)"
+ fi
+ echo " OK"
+fi
+
+echo -n "Waiting for Taler services ..."
+# Wait for all other taler services to be available
+for n in $(seq 1 20)
+do
+ echo -n "."
+ sleep 0.1
+ OK="0"
+ if [ "1" = "$START_EXCHANGE" ]
+ then
+ wget \
+ --tries=1 \
+ --timeout=1 \
+ "http://localhost:8081/seed" \
+ -o /dev/null \
+ -O /dev/null >/dev/null || continue
+ fi
+ if [ "1" = "$START_MERCHANT" ]
+ then
+ wget \
+ --tries=1 \
+ --timeout=1 \
+ "http://localhost:9966/" \
+ -o /dev/null \
+ -O /dev/null >/dev/null || continue
+ fi
+ if [ "1" = "$START_AUDITOR" ]
+ then
+ wget \
+ --tries=1 \
+ --timeout=1 \
+ "http://localhost:8083/" \
+ -o /dev/null \
+ -O /dev/null >/dev/null || continue
+ fi
+ OK="1"
+ break
+done
+if [ 1 != "$OK" ]
+then
+ exit_skip "Failed to launch (some) Taler services"
+fi
+echo " OK"
+
+if [ "1" = "$START_EXCHANGE" ]
+then
+ set +e
+ echo -n "Wait for exchange /management/keys to be ready "
+ OK="0"
+ LAST_RESPONSE=$(mktemp tmp-last-response.XXXXXXXX)
+ for n in $(seq 1 50)
+ do
+ echo -n "."
+ sleep 0.1
+ # exchange
+ wget \
+ --tries=3 \
+ --waitretry=0 \
+ --timeout=1 \
+ "http://localhost:8081/management/keys"\
+ -o /dev/null \
+ -O "$LAST_RESPONSE" \
+ >/dev/null
+ DENOMS_COUNT=$(jq '.future_denoms|length' < $LAST_RESPONSE)
+ SIGNKEYS_COUNT=$(jq '.future_signkeys|length' < $LAST_RESPONSE)
+ [[ -z "$SIGNKEYS_COUNT" || "$SIGNKEYS_COUNT" == "0" || -z "$DENOMS_COUNT" || "$DENOMS_COUNT" == "0" ]] && continue
+ OK="1"
+ break;
+ done
+ set -e
+ if [ "1" != "$OK" ]
+ then
+ exit_skip "Failed to setup exchange keys, check secmod logs"
+ fi
+ rm "$LAST_RESPONSE"
+ echo " OK"
+
+ echo -n "Setting up exchange keys ..."
+ taler-exchange-offline -c "$CONF" \
+ download \
+ sign \
+ wire-fee now iban "$CURRENCY:0.01" "$CURRENCY:0.01" \
+ global-fee now "$CURRENCY:0.01" "$CURRENCY:0.01" "$CURRENCY:0.01" 1h 1year 5 \
+ upload &> taler-exchange-offline.log
+ echo "OK"
+ for ASEC in $(taler-config -c "$CONF" -S | grep -i "exchange-account-")
+ do
+ ENABLED=$(taler-config -c "$CONF" -s "$ASEC" -o "ENABLE_CREDIT")
+ if [ "YES" = "$ENABLED" ]
+ then
+ echo -n "Configuring bank account $ASEC ..."
+ EXCHANGE_PAYTO_URI=$(taler-config -c "$CONF" -s "$ASEC" -o "PAYTO_URI")
+ taler-exchange-offline -c "$CONF" \
+ enable-account "$EXCHANGE_PAYTO_URI" \
+ upload &> "taler-exchange-offline-account-$ASEC.log"
+ echo "OK"
+ fi
+ done
+ if [ "1" = "$START_AUDITOR" ]
+ then
+ echo -n "Enabling auditor ..."
+ taler-exchange-offline -c "$CONF" \
+ enable-auditor $AUDITOR_PUB $AUDITOR_URL "$CURRENCY Auditor" \
+ upload &> taler-exchange-offline-auditor.log
+ echo "OK"
+ fi
+
+ echo -n "Checking /keys "
+ OK="0"
+ for n in $(seq 1 3)
+ do
+ echo -n "."
+ wget \
+ --tries=1 \
+ --timeout=1 \
+ "http://localhost:8081/keys" \
+ -o /dev/null \
+ -O /dev/null >/dev/null || continue
+ OK="1"
+ break
+ done
+ if [ "1" != "$OK" ]
+ then
+ exit_skip " Failed to setup keys"
+ fi
+ echo " OK"
+fi
+
+if [ "1" = "$START_AUDITOR" ]
+then
+ echo -n "Setting up auditor signatures ..."
+ taler-auditor-offline -c "$CONF" \
+ download \
+ sign \
+ upload &> taler-auditor-offline.log
+ echo " OK"
+fi
+
+# Signal caller that we are ready.
+echo "<<READY>>"
+
+# Wait until caller stops us.
+read
+
+exit 0
diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c
index 8e61129f0..e29e117de 100644
--- a/src/benchmark/taler-exchange-benchmark.c
+++ b/src/benchmark/taler-exchange-benchmark.c
@@ -306,8 +306,9 @@ run (void *cls,
GNUNET_asprintf (&amount_5, "%s:5", currency);
GNUNET_asprintf (&amount_4, "%s:4", currency);
GNUNET_asprintf (&amount_1, "%s:1", currency);
- GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (currency,
- &total_reserve_amount));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (currency,
+ &total_reserve_amount));
total_reserve_amount.value = 5 * howmany_coins;
GNUNET_asprintf (&withdraw_fee_str,
"%s:0.1",
@@ -537,7 +538,8 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
struct GNUNET_OS_Process *exchange_slave = NULL;
struct GNUNET_DISK_PipeHandle *exchange_slave_pipe;
- if ( (MODE_CLIENT == mode) || (MODE_BOTH == mode) )
+ if ( (MODE_CLIENT == mode) ||
+ (MODE_BOTH == mode) )
{
if (use_fakebank)
{
@@ -587,7 +589,8 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
"-c", config_file,
"-C",
NULL);
- if ( (NULL == exchanged) && (MODE_BOTH == mode) )
+ if ( (NULL == exchanged) &&
+ (MODE_BOTH == mode) )
{
if (-1 != fakebank)
{
@@ -978,15 +981,19 @@ main (int argc,
logfile);
if (NULL == mode_str)
mode = MODE_BOTH;
- else if (0 == strcmp (mode_str, "exchange"))
+ else if (0 == strcmp (mode_str,
+ "exchange"))
mode = MODE_EXCHANGE;
- else if (0 == strcmp (mode_str, "client"))
+ else if (0 == strcmp (mode_str,
+ "client"))
mode = MODE_CLIENT;
- else if (0 == strcmp (mode_str, "both"))
+ else if (0 == strcmp (mode_str,
+ "both"))
mode = MODE_BOTH;
else
{
- TALER_LOG_ERROR ("Unknown mode given: '%s'\n", mode_str);
+ TALER_LOG_ERROR ("Unknown mode given: '%s'\n",
+ mode_str);
GNUNET_free (cfg_filename);
return BAD_CONFIG_FILE;
}
@@ -1137,7 +1144,9 @@ main (int argc,
if (GNUNET_OK == result)
{
struct rusage usage;
- GNUNET_assert (0 == getrusage (RUSAGE_CHILDREN, &usage));
+
+ GNUNET_assert (0 == getrusage (RUSAGE_CHILDREN,
+ &usage));
fprintf (stdout,
"Executed (Withdraw=%u, Deposit=%u, Refresh~=%5.2f) * Reserve=%u * Parallel=%u, operations in %s\n",
howmany_coins,
diff --git a/src/exchange-tools/taler-auditor-offline.c b/src/exchange-tools/taler-auditor-offline.c
index f239c11a9..39495311c 100644
--- a/src/exchange-tools/taler-auditor-offline.c
+++ b/src/exchange-tools/taler-auditor-offline.c
@@ -388,14 +388,15 @@ load_offline_key (int do_create)
* add operation result.
*
* @param cls closure with a `struct DenominationAddRequest`
- * @param hr HTTP response data
+ * @param adr response data
*/
static void
denomination_add_cb (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+ const struct TALER_EXCHANGE_AuditorAddDenominationResponse *adr)
{
struct DenominationAddRequest *dar = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &adr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
@@ -949,11 +950,11 @@ do_show (char *const *args)
json_t *keys;
const char *err_name;
unsigned int err_line;
- json_t *denomkeys;
+ const json_t *denomkeys;
struct TALER_MasterPublicKeyP mpub;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("denoms",
- &denomkeys),
+ GNUNET_JSON_spec_array_const ("denoms",
+ &denomkeys),
GNUNET_JSON_spec_fixed_auto ("master_public_key",
&mpub),
GNUNET_JSON_spec_end ()
@@ -997,11 +998,9 @@ do_show (char *const *args)
{
global_ret = EXIT_FAILURE;
test_shutdown ();
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
return;
}
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
/* do NOT consume input if next argument is '-' */
if ( (NULL != args[0]) &&
@@ -1138,10 +1137,10 @@ do_sign (char *const *args)
const char *err_name;
unsigned int err_line;
struct TALER_MasterPublicKeyP mpub;
- json_t *denomkeys;
+ const json_t *denomkeys;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("denoms",
- &denomkeys),
+ GNUNET_JSON_spec_array_const ("denoms",
+ &denomkeys),
GNUNET_JSON_spec_fixed_auto ("master_public_key",
&mpub),
GNUNET_JSON_spec_end ()
@@ -1196,11 +1195,9 @@ do_sign (char *const *args)
{
global_ret = EXIT_FAILURE;
test_shutdown ();
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
return;
}
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
next (args);
}
diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c
index b1aababc4..fed29437e 100644
--- a/src/exchange-tools/taler-exchange-offline.c
+++ b/src/exchange-tools/taler-exchange-offline.c
@@ -1301,13 +1301,15 @@ upload_signkey_revocation (const char *exchange_url,
* Function called with information about the post auditor add operation result.
*
* @param cls closure with a `struct AuditorAddRequest`
- * @param hr HTTP response data
+ * @param mer response data
*/
static void
-auditor_add_cb (void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+auditor_add_cb (
+ void *cls,
+ const struct TALER_EXCHANGE_ManagementAuditorEnableResponse *mer)
{
struct AuditorAddRequest *aar = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &mer->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
@@ -1401,13 +1403,15 @@ upload_auditor_add (const char *exchange_url,
* Function called with information about the post auditor del operation result.
*
* @param cls closure with a `struct AuditorDelRequest`
- * @param hr HTTP response data
+ * @param mdr response data
*/
static void
auditor_del_cb (void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+ const struct
+ TALER_EXCHANGE_ManagementAuditorDisableResponse *mdr)
{
struct AuditorDelRequest *adr = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &mdr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
@@ -1539,8 +1543,8 @@ upload_wire_add (const char *exchange_url,
struct WireAddRequest *war;
const char *err_name;
const char *conversion_url = NULL;
- json_t *debit_restrictions;
- json_t *credit_restrictions;
+ const json_t *debit_restrictions;
+ const json_t *credit_restrictions;
unsigned int err_line;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("payto_uri",
@@ -1549,10 +1553,10 @@ upload_wire_add (const char *exchange_url,
GNUNET_JSON_spec_string ("conversion_url",
&conversion_url),
NULL),
- GNUNET_JSON_spec_json ("debit_restrictions",
- &debit_restrictions),
- GNUNET_JSON_spec_json ("credit_restrictions",
- &credit_restrictions),
+ GNUNET_JSON_spec_array_const ("debit_restrictions",
+ &debit_restrictions),
+ GNUNET_JSON_spec_array_const ("credit_restrictions",
+ &credit_restrictions),
GNUNET_JSON_spec_timestamp ("validity_start",
&start_time),
GNUNET_JSON_spec_fixed_auto ("master_sig_add",
@@ -1577,7 +1581,6 @@ upload_wire_add (const char *exchange_url,
stderr,
JSON_INDENT (2));
global_ret = EXIT_FAILURE;
- GNUNET_JSON_parse_free (spec);
test_shutdown ();
return;
}
@@ -1591,7 +1594,6 @@ upload_wire_add (const char *exchange_url,
"payto:// URI `%s' is malformed\n",
payto_uri);
global_ret = EXIT_FAILURE;
- GNUNET_JSON_parse_free (spec);
test_shutdown ();
return;
}
@@ -1606,7 +1608,6 @@ upload_wire_add (const char *exchange_url,
"payto URI is malformed: %s\n",
msg);
GNUNET_free (msg);
- GNUNET_JSON_parse_free (spec);
test_shutdown ();
global_ret = EXIT_INVALIDARGUMENT;
return;
@@ -1629,7 +1630,6 @@ upload_wire_add (const char *exchange_url,
GNUNET_CONTAINER_DLL_insert (war_head,
war_tail,
war);
- GNUNET_JSON_parse_free (spec);
}
@@ -1730,14 +1730,15 @@ upload_wire_del (const char *exchange_url,
* Function called with information about the post wire fee operation result.
*
* @param cls closure with a `struct WireFeeRequest`
- * @param hr HTTP response data
+ * @param swr response data
*/
static void
wire_fee_cb (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+ const struct TALER_EXCHANGE_ManagementSetWireFeeResponse *swr)
{
struct WireFeeRequest *wfr = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &swr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
@@ -1835,14 +1836,15 @@ upload_wire_fee (const char *exchange_url,
* Function called with information about the post global fee operation result.
*
* @param cls closure with a `struct WireFeeRequest`
- * @param hr HTTP response data
+ * @param gr response data
*/
static void
global_fee_cb (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+ const struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse *gr)
{
struct GlobalFeeRequest *gfr = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &gr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
@@ -2102,13 +2104,13 @@ upload_keys (const char *exchange_url,
struct UploadKeysRequest *ukr;
const char *err_name;
unsigned int err_line;
- json_t *denom_sigs;
- json_t *signkey_sigs;
+ const json_t *denom_sigs;
+ const json_t *signkey_sigs;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("denom_sigs",
- &denom_sigs),
- GNUNET_JSON_spec_json ("signkey_sigs",
- &signkey_sigs),
+ GNUNET_JSON_spec_array_const ("denom_sigs",
+ &denom_sigs),
+ GNUNET_JSON_spec_array_const ("signkey_sigs",
+ &signkey_sigs),
GNUNET_JSON_spec_end ()
};
bool ok = true;
@@ -2224,7 +2226,6 @@ upload_keys (const char *exchange_url,
}
GNUNET_free (pkd.sign_sigs);
GNUNET_free (pkd.denom_sigs);
- GNUNET_JSON_parse_free (spec);
}
@@ -2272,13 +2273,13 @@ upload_extensions (const char *exchange_url,
size_t idx,
const json_t *value)
{
- json_t *extensions;
+ const json_t *extensions;
struct TALER_MasterSignatureP sig;
const char *err_name;
unsigned int err_line;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("extensions",
- &extensions),
+ GNUNET_JSON_spec_object_const ("extensions",
+ &extensions),
GNUNET_JSON_spec_fixed_auto ("extensions_sig",
&sig),
GNUNET_JSON_spec_end ()
@@ -2309,9 +2310,9 @@ upload_extensions (const char *exchange_url,
struct TALER_ExtensionManifestsHashP h_manifests;
if (GNUNET_OK !=
- TALER_JSON_extensions_manifests_hash (extensions, &h_manifests))
+ TALER_JSON_extensions_manifests_hash (extensions,
+ &h_manifests))
{
- GNUNET_JSON_parse_free (spec);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"couldn't hash extensions' manifests\n");
global_ret = EXIT_FAILURE;
@@ -2328,7 +2329,6 @@ upload_extensions (const char *exchange_url,
&master_pub,
&sig))
{
- GNUNET_JSON_parse_free (spec);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"invalid signature for extensions\n");
global_ret = EXIT_FAILURE;
@@ -2343,8 +2343,9 @@ upload_extensions (const char *exchange_url,
.extensions = extensions,
.extensions_sig = sig,
};
- struct UploadExtensionsRequest *uer = GNUNET_new (struct
- UploadExtensionsRequest);
+ struct UploadExtensionsRequest *uer
+ = GNUNET_new (struct UploadExtensionsRequest);
+
uer->idx = idx;
uer->h = TALER_EXCHANGE_management_post_extensions (
ctx,
@@ -2356,7 +2357,6 @@ upload_extensions (const char *exchange_url,
uer_tail,
uer);
}
- GNUNET_JSON_parse_free (spec);
}
@@ -2364,14 +2364,15 @@ upload_extensions (const char *exchange_url,
* Function called with information about the add partner operation.
*
* @param cls closure with a `struct PartnerAddRequest`
- * @param hr HTTP response data
+ * @param apr response data
*/
static void
add_partner_cb (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+ const struct TALER_EXCHANGE_ManagementAddPartnerResponse *apr)
{
struct PartnerAddRequest *par = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &apr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
@@ -4482,15 +4483,15 @@ do_show (char *const *args)
json_t *keys;
const char *err_name;
unsigned int err_line;
- json_t *denomkeys;
- json_t *signkeys;
+ const json_t *denomkeys;
+ const json_t *signkeys;
struct TALER_MasterPublicKeyP mpub;
struct TALER_SecurityModulePublicKeySetP secmset;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("future_denoms",
- &denomkeys),
- GNUNET_JSON_spec_json ("future_signkeys",
- &signkeys),
+ GNUNET_JSON_spec_array_const ("future_denoms",
+ &denomkeys),
+ GNUNET_JSON_spec_array_const ("future_signkeys",
+ &signkeys),
GNUNET_JSON_spec_fixed_auto ("master_pub",
&mpub),
GNUNET_JSON_spec_fixed_auto ("denom_secmod_public_key",
@@ -4535,7 +4536,6 @@ do_show (char *const *args)
"Fatal: exchange uses different master key!\n");
global_ret = EXIT_FAILURE;
test_shutdown ();
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
return;
}
@@ -4544,7 +4544,6 @@ do_show (char *const *args)
{
global_ret = EXIT_FAILURE;
test_shutdown ();
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
return;
}
@@ -4558,12 +4557,10 @@ do_show (char *const *args)
{
global_ret = EXIT_FAILURE;
test_shutdown ();
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
return;
}
json_decref (keys);
- GNUNET_JSON_parse_free (spec);
next (args);
}
@@ -4883,15 +4880,15 @@ do_sign (char *const *args)
json_t *keys;
const char *err_name;
unsigned int err_line;
- json_t *denomkeys;
- json_t *signkeys;
+ const json_t *denomkeys;
+ const json_t *signkeys;
struct TALER_MasterPublicKeyP mpub;
struct TALER_SecurityModulePublicKeySetP secmset;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("future_denoms",
- &denomkeys),
- GNUNET_JSON_spec_json ("future_signkeys",
- &signkeys),
+ GNUNET_JSON_spec_array_const ("future_denoms",
+ &denomkeys),
+ GNUNET_JSON_spec_array_const ("future_signkeys",
+ &signkeys),
GNUNET_JSON_spec_fixed_auto ("master_pub",
&mpub),
GNUNET_JSON_spec_fixed_auto ("denom_secmod_public_key",
@@ -4938,7 +4935,6 @@ do_sign (char *const *args)
"Fatal: exchange uses different master key!\n");
global_ret = EXIT_FAILURE;
test_shutdown ();
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
return;
}
@@ -4949,7 +4945,6 @@ do_sign (char *const *args)
"Fatal: security module keys changed!\n");
global_ret = EXIT_FAILURE;
test_shutdown ();
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
return;
}
@@ -4973,7 +4968,6 @@ do_sign (char *const *args)
test_shutdown ();
json_decref (signkey_sig_array);
json_decref (denomkey_sig_array);
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
return;
}
@@ -4985,7 +4979,6 @@ do_sign (char *const *args)
GNUNET_JSON_pack_array_steal ("signkey_sigs",
signkey_sig_array)));
}
- GNUNET_JSON_parse_free (spec);
json_decref (keys);
next (args);
}
diff --git a/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c b/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
index 776c0d8d9..d604632d9 100644
--- a/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
+++ b/src/exchange/taler-exchange-httpd_age-withdraw_reveal.c
@@ -984,14 +984,18 @@ TEH_handler_age_withdraw_reveal (
MHD_RESULT result = MHD_NO;
enum GNUNET_GenericReturnValue ret = GNUNET_SYSERR;
struct AgeRevealContext actx = {0};
- json_t *j_denoms_h;
- json_t *j_coin_evs;
- json_t *j_disclosed_coin_secrets;
+ const json_t *j_denoms_h;
+ const json_t *j_coin_evs;
+ const json_t *j_disclosed_coin_secrets;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("reserve_pub", &actx.reserve_pub),
- GNUNET_JSON_spec_json ("denoms_h", &j_denoms_h),
- GNUNET_JSON_spec_json ("coin_evs", &j_coin_evs),
- GNUNET_JSON_spec_json ("disclosed_coin_secrets", &j_disclosed_coin_secrets),
+ GNUNET_JSON_spec_fixed_auto ("reserve_pub",
+ &actx.reserve_pub),
+ GNUNET_JSON_spec_array_const ("denoms_h",
+ &j_denoms_h),
+ GNUNET_JSON_spec_array_const ("coin_evs",
+ &j_coin_evs),
+ GNUNET_JSON_spec_array_const ("disclosed_coin_secrets",
+ &j_disclosed_coin_secrets),
GNUNET_JSON_spec_end ()
};
@@ -1010,7 +1014,8 @@ TEH_handler_age_withdraw_reveal (
do {
/* Extract denominations, blinded and disclosed coins */
- if (GNUNET_OK != parse_age_withdraw_reveal_json (
+ if (GNUNET_OK !=
+ parse_age_withdraw_reveal_json (
rc->connection,
j_denoms_h,
j_coin_evs,
@@ -1020,7 +1025,8 @@ TEH_handler_age_withdraw_reveal (
break;
/* Find original commitment */
- if (GNUNET_OK != find_original_commitment (
+ if (GNUNET_OK !=
+ find_original_commitment (
rc->connection,
&actx.ach,
&actx.reserve_pub,
@@ -1029,7 +1035,8 @@ TEH_handler_age_withdraw_reveal (
break;
/* Ensure validity of denoms and the sum of amounts and fees */
- if (GNUNET_OK != are_denominations_valid (
+ if (GNUNET_OK !=
+ are_denominations_valid (
rc->connection,
actx.num_coins,
actx.denoms_h,
@@ -1043,7 +1050,8 @@ TEH_handler_age_withdraw_reveal (
/* Verify the computed h_commitment equals the committed one and that coins
* have a maximum age group corresponding max_age (age-mask dependent) */
- if (GNUNET_OK != verify_commitment_and_max_age (
+ if (GNUNET_OK !=
+ verify_commitment_and_max_age (
rc->connection,
&actx.commitment.h_commitment,
actx.commitment.max_age,
@@ -1056,7 +1064,8 @@ TEH_handler_age_withdraw_reveal (
break;
/* Finally, sign and persist the coins */
- if (GNUNET_OK != sign_and_finalize_age_withdraw (
+ if (GNUNET_OK !=
+ sign_and_finalize_age_withdraw (
rc->connection,
&actx.commitment.h_commitment,
actx.num_coins,
@@ -1068,7 +1077,6 @@ TEH_handler_age_withdraw_reveal (
} while(0);
age_reveal_context_free (&actx);
- GNUNET_JSON_parse_free (spec);
return result;
}
diff --git a/src/exchange/taler-exchange-httpd_aml-decision.c b/src/exchange/taler-exchange-httpd_aml-decision.c
index 2830e54ed..c1439adc1 100644
--- a/src/exchange/taler-exchange-httpd_aml-decision.c
+++ b/src/exchange/taler-exchange-httpd_aml-decision.c
@@ -74,7 +74,7 @@ struct DecisionContext
/**
* KYC requirements imposed, NULL for none.
*/
- json_t *kyc_requirements;
+ const json_t *kyc_requirements;
};
@@ -261,8 +261,8 @@ TEH_handler_post_aml_decision (
GNUNET_JSON_spec_uint32 ("new_state",
&new_state32),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_json ("kyc_requirements",
- &dc.kyc_requirements),
+ GNUNET_JSON_spec_array_const ("kyc_requirements",
+ &dc.kyc_requirements),
NULL),
GNUNET_JSON_spec_end ()
};
@@ -306,17 +306,6 @@ TEH_handler_post_aml_decision (
size_t index;
json_t *elem;
- if (! json_is_array (dc.kyc_requirements))
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "kyc_requirements must be an array");
- }
-
json_array_foreach (dc.kyc_requirements, index, elem)
{
const char *val;
@@ -324,7 +313,6 @@ TEH_handler_post_aml_decision (
if (! json_is_string (elem))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_BAD_REQUEST,
@@ -336,7 +324,6 @@ TEH_handler_post_aml_decision (
TALER_KYCLOGIC_check_satisfiable (val))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_BAD_REQUEST,
@@ -357,11 +344,9 @@ TEH_handler_post_aml_decision (
&make_aml_decision,
&dc))
{
- GNUNET_JSON_parse_free (spec);
return mhd_ret;
}
}
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_static (
connection,
MHD_HTTP_NO_CONTENT,
diff --git a/src/exchange/taler-exchange-httpd_batch-deposit.c b/src/exchange/taler-exchange-httpd_batch-deposit.c
index d000c454f..488f85ab2 100644
--- a/src/exchange/taler-exchange-httpd_batch-deposit.c
+++ b/src/exchange/taler-exchange-httpd_batch-deposit.c
@@ -545,7 +545,7 @@ TEH_handler_batch_deposit (struct TEH_RequestContext *rc,
{
struct MHD_Connection *connection = rc->connection;
struct BatchDepositContext dc;
- json_t *coins;
+ const json_t *coins;
bool no_refund_deadline = true;
bool no_policy_json = true;
struct GNUNET_JSON_Specification spec[] = {
@@ -557,8 +557,8 @@ TEH_handler_batch_deposit (struct TEH_RequestContext *rc,
&dc.merchant_pub),
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
&dc.h_contract_terms),
- GNUNET_JSON_spec_json ("coins",
- &coins),
+ GNUNET_JSON_spec_array_const ("coins",
+ &coins),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("policy",
&dc.policy_json),
diff --git a/src/exchange/taler-exchange-httpd_batch-withdraw.c b/src/exchange/taler-exchange-httpd_batch-withdraw.c
index d97a5f0ad..04a9d7208 100644
--- a/src/exchange/taler-exchange-httpd_batch-withdraw.c
+++ b/src/exchange/taler-exchange-httpd_batch-withdraw.c
@@ -848,10 +848,10 @@ TEH_handler_batch_withdraw (struct TEH_RequestContext *rc,
.reserve_pub = reserve_pub,
.rc = rc
};
- json_t *planchets;
+ const json_t *planchets;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("planchets",
- &planchets),
+ GNUNET_JSON_spec_array_const ("planchets",
+ &planchets),
GNUNET_JSON_spec_end ()
};
@@ -867,20 +867,17 @@ TEH_handler_batch_withdraw (struct TEH_RequestContext *rc,
if (GNUNET_OK != res)
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
}
- if ( (! json_is_array (planchets)) ||
- (0 == json_array_size (planchets)) )
+ wc.planchets_length = json_array_size (planchets);
+ if (0 == wc.planchets_length)
{
- GNUNET_JSON_parse_free (spec);
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
"planchets");
}
- wc.planchets_length = json_array_size (planchets);
if (wc.planchets_length > TALER_MAX_FRESH_COINS)
{
- GNUNET_JSON_parse_free (spec);
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_BAD_REQUEST,
@@ -906,7 +903,6 @@ TEH_handler_batch_withdraw (struct TEH_RequestContext *rc,
TALER_blinded_planchet_free (&pc->blinded_planchet);
TALER_blinded_denom_sig_free (&pc->collectable.sig);
}
- GNUNET_JSON_parse_free (spec);
return ret;
}
}
diff --git a/src/exchange/taler-exchange-httpd_csr.c b/src/exchange/taler-exchange-httpd_csr.c
index 29f83c2c9..3ceb319cd 100644
--- a/src/exchange/taler-exchange-httpd_csr.c
+++ b/src/exchange/taler-exchange-httpd_csr.c
@@ -39,12 +39,12 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
{
struct TALER_RefreshMasterSecretP rms;
unsigned int csr_requests_num;
- json_t *csr_requests;
+ const json_t *csr_requests;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("rms",
&rms),
- GNUNET_JSON_spec_json ("nks",
- &csr_requests),
+ GNUNET_JSON_spec_array_const ("nks",
+ &csr_requests),
GNUNET_JSON_spec_end ()
};
enum TALER_ErrorCode ec;
@@ -65,7 +65,7 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
if ( (TALER_MAX_FRESH_COINS <= csr_requests_num) ||
(0 == csr_requests_num) )
{
- GNUNET_JSON_parse_free (spec);
+ GNUNET_break_op (0);
return TALER_MHD_reply_with_error (
rc->connection,
MHD_HTTP_BAD_REQUEST,
@@ -101,14 +101,12 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
-1);
if (GNUNET_OK != res)
{
- GNUNET_JSON_parse_free (spec);
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
}
TALER_cs_refresh_nonce_derive (&rms,
coin_off,
&nonces[i]);
}
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i < csr_requests_num; i++)
{
diff --git a/src/exchange/taler-exchange-httpd_management_extensions.c b/src/exchange/taler-exchange-httpd_management_extensions.c
index d5841a3c4..3b24bace7 100644
--- a/src/exchange/taler-exchange-httpd_management_extensions.c
+++ b/src/exchange/taler-exchange-httpd_management_extensions.c
@@ -145,7 +145,7 @@ set_extensions (void *cls,
static enum GNUNET_GenericReturnValue
verify_extensions_from_json (
- json_t *extensions,
+ const json_t *extensions,
struct SetExtensionsContext *sec)
{
const char*name;
@@ -160,7 +160,7 @@ verify_extensions_from_json (
sec->extensions = GNUNET_new_array (sec->num_extensions,
struct Extension);
- json_object_foreach (extensions, name, manifest)
+ json_object_foreach ((json_t *) extensions, name, manifest)
{
int critical = 0;
json_t *config;
@@ -200,11 +200,11 @@ TEH_handler_management_post_extensions (
const json_t *root)
{
MHD_RESULT ret;
- json_t *extensions;
+ const json_t *extensions;
struct SetExtensionsContext sec = {0};
struct GNUNET_JSON_Specification top_spec[] = {
- GNUNET_JSON_spec_json ("extensions",
- &extensions),
+ GNUNET_JSON_spec_object_const ("extensions",
+ &extensions),
GNUNET_JSON_spec_fixed_auto ("extensions_sig",
&sec.extensions_sig),
GNUNET_JSON_spec_end ()
@@ -223,31 +223,19 @@ TEH_handler_management_post_extensions (
return MHD_YES; /* failure */
}
- /* Ensure we have an object */
- if ((! json_is_object (extensions)) &&
- (! json_is_null (extensions)))
- {
- GNUNET_JSON_parse_free (top_spec);
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "invalid object");
- }
-
/* Verify the signature */
{
struct TALER_ExtensionManifestsHashP h_manifests;
if (GNUNET_OK !=
- TALER_JSON_extensions_manifests_hash (extensions, &h_manifests) ||
+ TALER_JSON_extensions_manifests_hash (extensions,
+ &h_manifests) ||
GNUNET_OK !=
TALER_exchange_offline_extension_manifests_hash_verify (
&h_manifests,
&TEH_master_public_key,
&sec.extensions_sig))
{
- GNUNET_JSON_parse_free (top_spec);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_BAD_REQUEST,
@@ -263,7 +251,6 @@ TEH_handler_management_post_extensions (
if (GNUNET_OK !=
verify_extensions_from_json (extensions, &sec))
{
- GNUNET_JSON_parse_free (top_spec);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_BAD_REQUEST,
@@ -306,7 +293,6 @@ CLEANUP:
}
}
GNUNET_free (sec.extensions);
- GNUNET_JSON_parse_free (top_spec);
return ret;
}
diff --git a/src/exchange/taler-exchange-httpd_management_post_keys.c b/src/exchange/taler-exchange-httpd_management_post_keys.c
index df351ad5f..0ddc46916 100644
--- a/src/exchange/taler-exchange-httpd_management_post_keys.c
+++ b/src/exchange/taler-exchange-httpd_management_post_keys.c
@@ -340,13 +340,13 @@ TEH_handler_management_post_keys (
const json_t *root)
{
struct AddKeysContext akc;
- json_t *denom_sigs;
- json_t *signkey_sigs;
+ const json_t *denom_sigs;
+ const json_t *signkey_sigs;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("denom_sigs",
- &denom_sigs),
- GNUNET_JSON_spec_json ("signkey_sigs",
- &signkey_sigs),
+ GNUNET_JSON_spec_array_const ("denom_sigs",
+ &denom_sigs),
+ GNUNET_JSON_spec_array_const ("signkey_sigs",
+ &signkey_sigs),
GNUNET_JSON_spec_end ()
};
bool ok;
@@ -363,24 +363,12 @@ TEH_handler_management_post_keys (
if (GNUNET_NO == res)
return MHD_YES; /* failure */
}
- if (! (json_is_array (denom_sigs) &&
- json_is_array (signkey_sigs)) )
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "array expected for denom_sigs and signkey_sigs");
- }
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received /management/keys\n");
akc.ksh = TEH_keys_get_state_for_management_only (); /* may start its own transaction, thus must be done here, before we run ours! */
if (NULL == akc.ksh)
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
@@ -423,7 +411,6 @@ TEH_handler_management_post_keys (
if (! ok)
{
GNUNET_free (akc.d_sigs);
- GNUNET_JSON_parse_free (spec);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failure to handle /management/keys\n");
return ret;
@@ -466,7 +453,6 @@ TEH_handler_management_post_keys (
"Failure to handle /management/keys\n");
GNUNET_free (akc.d_sigs);
GNUNET_free (akc.s_sigs);
- GNUNET_JSON_parse_free (spec);
return ret;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -484,7 +470,6 @@ TEH_handler_management_post_keys (
&akc);
GNUNET_free (akc.d_sigs);
GNUNET_free (akc.s_sigs);
- GNUNET_JSON_parse_free (spec);
if (GNUNET_SYSERR == res)
return ret;
}
diff --git a/src/exchange/taler-exchange-httpd_management_wire_enable.c b/src/exchange/taler-exchange-httpd_management_wire_enable.c
index 6743b485c..a67d1ad69 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_enable.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_enable.c
@@ -62,12 +62,12 @@ struct AddWireContext
/**
* Restrictions imposed when crediting this account.
*/
- json_t *credit_restrictions;
+ const json_t *credit_restrictions;
/**
* Restrictions imposed when debiting this account.
*/
- json_t *debit_restrictions;
+ const json_t *debit_restrictions;
/**
* Timestamp for checking against replay attacks.
@@ -176,10 +176,10 @@ TEH_handler_management_post_wire (
GNUNET_JSON_spec_string ("conversion_url",
&awc.conversion_url),
NULL),
- GNUNET_JSON_spec_json ("credit_restrictions",
- &awc.credit_restrictions),
- GNUNET_JSON_spec_json ("debit_restrictions",
- &awc.debit_restrictions),
+ GNUNET_JSON_spec_array_const ("credit_restrictions",
+ &awc.credit_restrictions),
+ GNUNET_JSON_spec_array_const ("debit_restrictions",
+ &awc.debit_restrictions),
GNUNET_JSON_spec_timestamp ("validity_start",
&awc.validity_start),
GNUNET_JSON_spec_end ()
diff --git a/src/exchange/taler-exchange-httpd_purses_create.c b/src/exchange/taler-exchange-httpd_purses_create.c
index 130f9faec..2de9468fe 100644
--- a/src/exchange/taler-exchange-httpd_purses_create.c
+++ b/src/exchange/taler-exchange-httpd_purses_create.c
@@ -430,7 +430,7 @@ TEH_handler_purses_create (
.pd.purse_pub = *purse_pub,
.exchange_timestamp = GNUNET_TIME_timestamp_get ()
};
- json_t *deposits;
+ const json_t *deposits;
json_t *deposit;
unsigned int idx;
struct GNUNET_JSON_Specification spec[] = {
@@ -449,8 +449,8 @@ TEH_handler_purses_create (
&pcc.purse_sig),
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
&pcc.pd.h_contract_terms),
- GNUNET_JSON_spec_json ("deposits",
- &deposits),
+ GNUNET_JSON_spec_array_const ("deposits",
+ &deposits),
GNUNET_JSON_spec_timestamp ("purse_expiration",
&pcc.pd.purse_expiration),
GNUNET_JSON_spec_end ()
@@ -482,7 +482,6 @@ TEH_handler_purses_create (
pcc.exchange_timestamp))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_EXCHANGE_PURSE_CREATE_EXPIRATION_BEFORE_NOW,
@@ -491,7 +490,6 @@ TEH_handler_purses_create (
if (GNUNET_TIME_absolute_is_never (pcc.pd.purse_expiration.abs_time))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_EXCHANGE_PURSE_CREATE_EXPIRATION_IS_NEVER,
@@ -502,7 +500,6 @@ TEH_handler_purses_create (
(pcc.num_coins > TALER_MAX_FRESH_COINS) )
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -515,7 +512,6 @@ TEH_handler_purses_create (
if (NULL == keys)
{
GNUNET_break (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING,
@@ -547,7 +543,6 @@ TEH_handler_purses_create (
deposit);
if (GNUNET_OK != res)
{
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<idx; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -559,7 +554,6 @@ TEH_handler_purses_create (
&pcc.deposit_total))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
GNUNET_free (pcc.coins);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
@@ -579,7 +573,6 @@ TEH_handler_purses_create (
&pcc.purse_sig))
{
TALER_LOG_WARNING ("Invalid signature on /purses/$PID/create request\n");
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -597,7 +590,6 @@ TEH_handler_purses_create (
&pcc.econtract.econtract_sig)) )
{
TALER_LOG_WARNING ("Invalid signature on /purses/$PID/create request\n");
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -612,7 +604,6 @@ TEH_handler_purses_create (
TEH_plugin->preflight (TEH_plugin->cls))
{
GNUNET_break (0);
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -634,7 +625,6 @@ TEH_handler_purses_create (
&create_transaction,
&pcc))
{
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -653,7 +643,6 @@ TEH_handler_purses_create (
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
- GNUNET_JSON_parse_free (spec);
return res;
}
}
diff --git a/src/exchange/taler-exchange-httpd_purses_deposit.c b/src/exchange/taler-exchange-httpd_purses_deposit.c
index 291807aaa..973dfccf1 100644
--- a/src/exchange/taler-exchange-httpd_purses_deposit.c
+++ b/src/exchange/taler-exchange-httpd_purses_deposit.c
@@ -329,12 +329,12 @@ TEH_handler_purses_deposit (
.purse_pub = purse_pub,
.exchange_timestamp = GNUNET_TIME_timestamp_get ()
};
- json_t *deposits;
+ const json_t *deposits;
json_t *deposit;
unsigned int idx;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("deposits",
- &deposits),
+ GNUNET_JSON_spec_array_const ("deposits",
+ &deposits),
GNUNET_JSON_spec_end ()
};
@@ -363,7 +363,6 @@ TEH_handler_purses_deposit (
(pcc.num_coins > TALER_MAX_FRESH_COINS) )
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -435,7 +434,6 @@ TEH_handler_purses_deposit (
deposit);
if (GNUNET_OK != res)
{
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<idx; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -447,7 +445,6 @@ TEH_handler_purses_deposit (
TEH_plugin->preflight (TEH_plugin->cls))
{
GNUNET_break (0);
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -469,7 +466,6 @@ TEH_handler_purses_deposit (
&deposit_transaction,
&pcc))
{
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -501,7 +497,6 @@ TEH_handler_purses_deposit (
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
- GNUNET_JSON_parse_free (spec);
return res;
}
}
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index 89bdf2724..47926a740 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -983,26 +983,26 @@ TEH_handler_reveal (struct TEH_RequestContext *rc,
const json_t *root,
const char *const args[2])
{
- json_t *coin_evs;
- json_t *transfer_privs;
- json_t *link_sigs;
- json_t *new_denoms_h;
- json_t *old_age_commitment;
+ const json_t *coin_evs;
+ const json_t *transfer_privs;
+ const json_t *link_sigs;
+ const json_t *new_denoms_h;
+ const json_t *old_age_commitment;
struct RevealContext rctx;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("transfer_pub",
&rctx.gamma_tp),
- GNUNET_JSON_spec_json ("transfer_privs",
- &transfer_privs),
- GNUNET_JSON_spec_json ("link_sigs",
- &link_sigs),
- GNUNET_JSON_spec_json ("coin_evs",
- &coin_evs),
- GNUNET_JSON_spec_json ("new_denoms_h",
- &new_denoms_h),
+ GNUNET_JSON_spec_array_const ("transfer_privs",
+ &transfer_privs),
+ GNUNET_JSON_spec_array_const ("link_sigs",
+ &link_sigs),
+ GNUNET_JSON_spec_array_const ("coin_evs",
+ &coin_evs),
+ GNUNET_JSON_spec_array_const ("new_denoms_h",
+ &new_denoms_h),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_json ("old_age_commitment",
- &old_age_commitment),
+ GNUNET_JSON_spec_array_const ("old_age_commitment",
+ &old_age_commitment),
NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("rms",
@@ -1053,7 +1053,6 @@ TEH_handler_reveal (struct TEH_RequestContext *rc,
/* Note we do +1 as 1 row (cut-and-choose!) is missing! */
if (TALER_CNC_KAPPA != json_array_size (transfer_privs) + 1)
{
- GNUNET_JSON_parse_free (spec);
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_BAD_REQUEST,
@@ -1061,19 +1060,13 @@ TEH_handler_reveal (struct TEH_RequestContext *rc,
NULL);
}
- {
- MHD_RESULT res;
-
- res = handle_refreshes_reveal_json (rc->connection,
- &rctx,
- transfer_privs,
- link_sigs,
- new_denoms_h,
- old_age_commitment,
- coin_evs);
- GNUNET_JSON_parse_free (spec);
- return res;
- }
+ return handle_refreshes_reveal_json (rc->connection,
+ &rctx,
+ transfer_privs,
+ link_sigs,
+ new_denoms_h,
+ old_age_commitment,
+ coin_evs);
}
diff --git a/src/exchange/taler-exchange-httpd_reserves_attest.c b/src/exchange/taler-exchange-httpd_reserves_attest.c
index d0f3614e6..7bbebaad7 100644
--- a/src/exchange/taler-exchange-httpd_reserves_attest.c
+++ b/src/exchange/taler-exchange-httpd_reserves_attest.c
@@ -68,7 +68,7 @@ struct ReserveAttestContext
/**
* List of requested details.
*/
- json_t *details;
+ const json_t *details;
/**
* Client signature approving the request.
@@ -287,8 +287,8 @@ TEH_handler_reserves_attest (struct TEH_RequestContext *rc,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_timestamp ("request_timestamp",
&rsc.timestamp),
- GNUNET_JSON_spec_json ("details",
- &rsc.details),
+ GNUNET_JSON_spec_array_const ("details",
+ &rsc.details),
GNUNET_JSON_spec_fixed_auto ("reserve_sig",
&rsc.reserve_sig),
GNUNET_JSON_spec_end ()
diff --git a/src/exchange/taler-exchange-httpd_reserves_open.c b/src/exchange/taler-exchange-httpd_reserves_open.c
index 6909c862a..50487990a 100644
--- a/src/exchange/taler-exchange-httpd_reserves_open.c
+++ b/src/exchange/taler-exchange-httpd_reserves_open.c
@@ -303,7 +303,7 @@ TEH_handler_reserves_open (struct TEH_RequestContext *rc,
const json_t *root)
{
struct ReserveOpenContext rsc;
- json_t *payments;
+ const json_t *payments;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_timestamp ("request_timestamp",
&rsc.timestamp),
@@ -313,8 +313,8 @@ TEH_handler_reserves_open (struct TEH_RequestContext *rc,
&rsc.reserve_sig),
GNUNET_JSON_spec_uint32 ("purse_limit",
&rsc.purse_limit),
- GNUNET_JSON_spec_json ("payments",
- &payments),
+ GNUNET_JSON_spec_array_const ("payments",
+ &payments),
TALER_JSON_spec_amount ("reserve_payment",
TEH_currency,
&rsc.reserve_payment),
@@ -403,7 +403,6 @@ TEH_handler_reserves_open (struct TEH_RequestContext *rc,
if (NULL == keys)
{
GNUNET_break (0);
- GNUNET_JSON_parse_free (spec);
cleanup_rsc (&rsc);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
diff --git a/src/exchange/taler-exchange-transfer.c b/src/exchange/taler-exchange-transfer.c
index 255fe76a0..ae2b4fe7f 100644
--- a/src/exchange/taler-exchange-transfer.c
+++ b/src/exchange/taler-exchange-transfer.c
@@ -406,25 +406,17 @@ batch_done (void)
* except for irrecoverable errors.
*
* @param cls `struct WirePrepareData` we are working on
- * @param http_status_code #MHD_HTTP_OK on success
- * @param ec taler error code
- * @param row_id unique ID of the wire transfer in the bank's records
- * @param wire_timestamp when did the transfer happen
+ * @param tr transfer response
*/
static void
wire_confirm_cb (void *cls,
- unsigned int http_status_code,
- enum TALER_ErrorCode ec,
- uint64_t row_id,
- struct GNUNET_TIME_Timestamp wire_timestamp)
+ const struct TALER_BANK_TransferResponse *tr)
{
struct WirePrepareData *wpd = cls;
enum GNUNET_DB_QueryStatus qs;
- (void) row_id;
- (void) wire_timestamp;
wpd->eh = NULL;
- switch (http_status_code)
+ switch (tr->http_status)
{
case MHD_HTTP_OK:
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -438,8 +430,8 @@ wire_confirm_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transaction %llu failed: %u/%d\n",
(unsigned long long) wpd->row_id,
- http_status_code,
- ec);
+ tr->http_status,
+ tr->ec);
qs = db_plugin->wire_prepare_data_mark_failed (db_plugin->cls,
wpd->row_id);
/* continued below */
@@ -456,7 +448,7 @@ wire_confirm_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Wire transfer %llu failed (%u), trying again\n",
(unsigned long long) wpd->row_id,
- http_status_code);
+ tr->http_status);
wpd->eh = TALER_BANK_transfer (ctx,
wpd->wa->auth,
&wpd[1],
@@ -468,8 +460,8 @@ wire_confirm_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transaction %llu failed: %u/%d\n",
(unsigned long long) wpd->row_id,
- http_status_code,
- ec);
+ tr->http_status,
+ tr->ec);
cleanup_wpd ();
db_plugin->rollback (db_plugin->cls);
global_ret = EXIT_FAILURE;
@@ -479,8 +471,8 @@ wire_confirm_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transfer %llu failed: %u/%d\n",
(unsigned long long) wpd->row_id,
- http_status_code,
- ec);
+ tr->http_status,
+ tr->ec);
db_plugin->rollback (db_plugin->cls);
cleanup_wpd ();
global_ret = EXIT_FAILURE;
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index 4df9cb406..c2e87e5da 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -65,6 +65,9 @@ exchange-0004.sql: exchange-0004.sql.in 0004-*.sql
gcc -E -P -undef - < exchange-0004.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@
chmod ugo-w $@
+check_SCRIPTS = \
+ test_idempotency.sh
+
EXTRA_DIST = \
exchangedb.conf \
exchangedb-postgres.conf \
@@ -72,6 +75,7 @@ EXTRA_DIST = \
test-exchange-db-postgres.conf \
$(sqlinputs) \
$(sql_DATA) \
+ $(check_SCRIPTS) \
pg_template.h pg_template.c \
pg_template.sh
@@ -311,6 +315,7 @@ noinst_PROGRAMS = \
AM_TESTS_ENVIRONMENT=export TALER_PREFIX=$${TALER_PREFIX:-@libdir@};export PATH=$${TALER_PREFIX:-@prefix@}/bin:$$PATH;
TESTS = \
+ $(check_SCRIPTS) \
$(check_PROGRAMS)
test_exchangedb_postgres_SOURCES = \
diff --git a/src/exchangedb/pg_insert_wire.c b/src/exchangedb/pg_insert_wire.c
index 8329a04af..066143b92 100644
--- a/src/exchangedb/pg_insert_wire.c
+++ b/src/exchangedb/pg_insert_wire.c
@@ -30,8 +30,8 @@ enum GNUNET_DB_QueryStatus
TEH_PG_insert_wire (void *cls,
const char *payto_uri,
const char *conversion_url,
- json_t *debit_restrictions,
- json_t *credit_restrictions,
+ const json_t *debit_restrictions,
+ const json_t *credit_restrictions,
struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterSignatureP *master_sig)
{
diff --git a/src/exchangedb/pg_insert_wire.h b/src/exchangedb/pg_insert_wire.h
index c949327d7..358946719 100644
--- a/src/exchangedb/pg_insert_wire.h
+++ b/src/exchangedb/pg_insert_wire.h
@@ -42,8 +42,8 @@ enum GNUNET_DB_QueryStatus
TEH_PG_insert_wire (void *cls,
const char *payto_uri,
const char *conversion_url,
- json_t *debit_restrictions,
- json_t *credit_restrictions,
+ const json_t *debit_restrictions,
+ const json_t *credit_restrictions,
struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterSignatureP *master_sig);
diff --git a/src/exchangedb/pg_update_wire.c b/src/exchangedb/pg_update_wire.c
index 0c4ec7b58..f3b074686 100644
--- a/src/exchangedb/pg_update_wire.c
+++ b/src/exchangedb/pg_update_wire.c
@@ -30,8 +30,8 @@ enum GNUNET_DB_QueryStatus
TEH_PG_update_wire (void *cls,
const char *payto_uri,
const char *conversion_url,
- json_t *debit_restrictions,
- json_t *credit_restrictions,
+ const json_t *debit_restrictions,
+ const json_t *credit_restrictions,
struct GNUNET_TIME_Timestamp change_date,
bool enabled)
{
diff --git a/src/exchangedb/pg_update_wire.h b/src/exchangedb/pg_update_wire.h
index 360b8845a..ecdbc405a 100644
--- a/src/exchangedb/pg_update_wire.h
+++ b/src/exchangedb/pg_update_wire.h
@@ -43,8 +43,8 @@ enum GNUNET_DB_QueryStatus
TEH_PG_update_wire (void *cls,
const char *payto_uri,
const char *conversion_url,
- json_t *debit_restrictions,
- json_t *credit_restrictions,
+ const json_t *debit_restrictions,
+ const json_t *credit_restrictions,
struct GNUNET_TIME_Timestamp change_date,
bool enabled);
diff --git a/src/exchangedb/test_idempotency.sh b/src/exchangedb/test_idempotency.sh
new file mode 100755
index 000000000..6ab5d1332
--- /dev/null
+++ b/src/exchangedb/test_idempotency.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# This file is in the public domain.
+set -eu
+echo "Initializing DB"
+taler-exchange-dbinit -r test-exchange-db-postgres.conf
+echo "Re-initializing DB"
+taler-exchange-dbinit test-exchange-db-postgres.conf
+echo "Re-loading procedures"
+psql talercheck < procedures.sql
+echo "Test PASSED"
+exit 0
diff --git a/src/extensions/extensions.c b/src/extensions/extensions.c
index fc361e08c..731ccfd08 100644
--- a/src/extensions/extensions.c
+++ b/src/extensions/extensions.c
@@ -138,7 +138,7 @@ TALER_extensions_get_by_name (
enum GNUNET_GenericReturnValue
TALER_extensions_verify_manifests_signature (
- json_t *manifests,
+ const json_t *manifests,
struct TALER_MasterSignatureP *extensions_sig,
struct TALER_MasterPublicKeyP *master_pub)
{
@@ -274,72 +274,76 @@ TALER_extensions_parse_manifest (
json_t **config)
{
enum GNUNET_GenericReturnValue ret;
- json_t *cfg;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_boolean ("critical",
critical),
GNUNET_JSON_spec_string ("version",
version),
GNUNET_JSON_spec_json ("config",
- &cfg),
+ config),
GNUNET_JSON_spec_end ()
};
+ *config = NULL;
if (GNUNET_OK !=
(ret = GNUNET_JSON_parse (obj,
spec,
NULL,
NULL)))
return ret;
-
- *config = json_copy (cfg);
- GNUNET_JSON_parse_free (spec);
-
return GNUNET_OK;
}
enum GNUNET_GenericReturnValue
TALER_extensions_load_manifests (
- json_t *extensions)
+ const json_t *extensions)
{
- const char*name;
+ const char *name;
json_t *manifest;
GNUNET_assert (NULL != extensions);
GNUNET_assert (json_is_object (extensions));
- json_object_foreach (extensions, name, manifest)
+ json_object_foreach ((json_t *) extensions, name, manifest)
{
int critical;
const char *version;
json_t *config;
- struct TALER_Extension *extension = (struct
- TALER_Extension *)
- TALER_extensions_get_by_name (name);
+ struct TALER_Extension *extension
+ = (struct TALER_Extension *)
+ TALER_extensions_get_by_name (name);
if (NULL == extension)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "no such extension: %s\n", name);
+ "no such extension: %s\n",
+ name);
return GNUNET_SYSERR;
}
/* load and verify criticality, version, etc. */
if (GNUNET_OK !=
TALER_extensions_parse_manifest (
- manifest, &critical, &version, &config))
+ manifest,
+ &critical,
+ &version,
+ &config))
return GNUNET_SYSERR;
if (critical != extension->critical
- || 0 != strcmp (version, extension->version) // TODO: libtool compare?
+ || 0 != strcmp (version,
+ extension->version) // TODO: libtool compare?
|| NULL == config
- || GNUNET_OK != extension->load_config (config, NULL))
+ || (GNUNET_OK !=
+ extension->load_config (config,
+ NULL)) )
return GNUNET_SYSERR;
/* This _should_ work now */
if (GNUNET_OK !=
- extension->load_config (config, extension))
+ extension->load_config (config,
+ extension))
return GNUNET_SYSERR;
extension->enabled = true;
diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h
index 5ce5e254d..e0970cb12 100644
--- a/src/include/taler_bank_service.h
+++ b/src/include/taler_bank_service.h
@@ -100,26 +100,64 @@ struct TALER_BANK_AdminAddIncomingHandle;
/**
+ * Response details for a history request.
+ */
+struct TALER_BANK_AdminAddIncomingResponse
+{
+
+ /**
+ * HTTP status.
+ */
+ unsigned int http_status;
+
+ /**
+ * Taler error code, #TALER_EC_NONE on success.
+ */
+ enum TALER_ErrorCode ec;
+
+ /**
+ * Full response, NULL if body was not in JSON format.
+ */
+ const json_t *response;
+
+ /**
+ * Details returned depending on the @e http_status.
+ */
+ union
+ {
+
+ /**
+ * Details if status was #MHD_HTTP_OK
+ */
+ struct
+ {
+ /**
+ * unique ID of the wire transfer in the bank's records
+ */
+ uint64_t serial_id;
+
+ /**
+ * time when the transaction was made.
+ */
+ struct GNUNET_TIME_Timestamp timestamp;
+
+ } ok;
+
+ } details;
+
+};
+
+/**
* Callbacks of this type are used to return the result of submitting
* a request to transfer funds to the exchange.
*
* @param cls closure
- * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
- * 0 if the bank's reply is bogus (fails to follow the protocol)
- * @param ec detailed error code
- * @param serial_id unique ID of the wire transfer in the bank's records; UINT64_MAX on error
- * @param timestamp time when the transaction was made.
- * @param json detailed response from the HTTPD, or NULL if reply was not in JSON
+ * @param air response details
*/
-// FIXME: bad API
typedef void
(*TALER_BANK_AdminAddIncomingCallback) (
void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
- uint64_t serial_id,
- struct GNUNET_TIME_Timestamp timestamp,
- const json_t *json);
+ const struct TALER_BANK_AdminAddIncomingResponse *air);
/**
@@ -192,22 +230,64 @@ struct TALER_BANK_TransferHandle;
/**
+ * Response details for a history request.
+ */
+struct TALER_BANK_TransferResponse
+{
+
+ /**
+ * HTTP status.
+ */
+ unsigned int http_status;
+
+ /**
+ * Taler error code, #TALER_EC_NONE on success.
+ */
+ enum TALER_ErrorCode ec;
+
+ /**
+ * Full response, NULL if body was not in JSON format.
+ */
+ const json_t *response;
+
+ /**
+ * Details returned depending on the @e http_status.
+ */
+ union
+ {
+
+ /**
+ * Details if status was #MHD_HTTP_OK
+ */
+ struct
+ {
+
+
+ /**
+ * unique ID of the wire transfer in the bank's records
+ */
+ uint64_t row_id;
+
+ /**
+ * when did the transaction go into effect
+ */
+ struct GNUNET_TIME_Timestamp timestamp;
+
+ } ok;
+ } details;
+};
+
+
+/**
* Function called with the result from the execute step.
*
* @param cls closure
- * @param response_code HTTP status code
- * @param ec taler error code
- * @param row_id unique ID of the wire transfer in the bank's records
- * @param timestamp when did the transaction go into effect
+ * @param tr response details
*/
-// FIXME: bad API
typedef void
(*TALER_BANK_TransferCallback)(
void *cls,
- unsigned int response_code,
- enum TALER_ErrorCode ec,
- uint64_t row_id,
- struct GNUNET_TIME_Timestamp timestamp);
+ const struct TALER_BANK_TransferResponse *tr);
/**
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 6d4ca1091..c6c1d3a13 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -3592,7 +3592,7 @@ enum GNUNET_GenericReturnValue
TALER_EXCHANGE_verify_coin_history (
const struct TALER_EXCHANGE_DenomPublicKey *dk,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
- json_t *history,
+ const json_t *history,
struct TALER_Amount *total);
@@ -4498,7 +4498,7 @@ TALER_EXCHANGE_post_management_keys_cancel (
*/
struct TALER_EXCHANGE_ManagementPostExtensionsData
{
- json_t *extensions;
+ const json_t *extensions;
struct TALER_MasterSignatureP extensions_sig;
};
@@ -4548,7 +4548,7 @@ struct TALER_EXCHANGE_ManagementPostExtensionsHandle *
TALER_EXCHANGE_management_post_extensions (
struct GNUNET_CURL_Context *ctx,
const char *url,
- struct TALER_EXCHANGE_ManagementPostExtensionsData *ped,
+ const struct TALER_EXCHANGE_ManagementPostExtensionsData *ped,
TALER_EXCHANGE_ManagementPostExtensionsCallback cb,
void *cb_cls);
@@ -5091,7 +5091,7 @@ TALER_EXCHANGE_lookup_aml_decision (
/**
- * Cancel #TALER_EXCHANGE_add_aml_decision() operation.
+ * Cancel #TALER_EXCHANGE_lookup_aml_decision() operation.
*
* @param rh handle of the operation to cancel
*/
@@ -5105,18 +5105,30 @@ TALER_EXCHANGE_lookup_aml_decision_cancel (
*/
struct TALER_EXCHANGE_AddAmlDecision;
+
+/**
+ * Response when making an AML decision.
+ */
+struct TALER_EXCHANGE_AddAmlDecisionResponse
+{
+ /**
+ * HTTP response data.
+ */
+ struct TALER_EXCHANGE_HttpResponse hr;
+};
+
+
/**
* Function called with information about storing an
* an AML decision.
*
* @param cls closure
- * @param hr HTTP response data
+ * @param adr response data
*/
-// FIXME: bad API
typedef void
(*TALER_EXCHANGE_AddAmlDecisionCallback) (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr);
+ const struct TALER_EXCHANGE_AddAmlDecisionResponse *adr);
/**
* Inform the exchange that an AML decision has been taken.
@@ -5162,17 +5174,27 @@ TALER_EXCHANGE_add_aml_decision_cancel (
/**
+ * Response when adding a partner exchange.
+ */
+struct TALER_EXCHANGE_ManagementAddPartnerResponse
+{
+ /**
+ * HTTP response data.
+ */
+ struct TALER_EXCHANGE_HttpResponse hr;
+};
+
+/**
* Function called with information about the change to
* an AML officer status.
*
* @param cls closure
- * @param hr HTTP response data
+ * @param apr response data
*/
-// FIXME: bad API
typedef void
(*TALER_EXCHANGE_ManagementAddPartnerCallback) (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr);
+ const struct TALER_EXCHANGE_ManagementAddPartnerResponse *apr);
/**
@@ -5224,16 +5246,26 @@ TALER_EXCHANGE_management_add_partner_cancel (
/**
+ * Response when enabling an auditor.
+ */
+struct TALER_EXCHANGE_ManagementAuditorEnableResponse
+{
+ /**
+ * HTTP response data.
+ */
+ struct TALER_EXCHANGE_HttpResponse hr;
+};
+
+/**
* Function called with information about the auditor setup operation result.
*
* @param cls closure
- * @param hr HTTP response data
+ * @param aer response data
*/
-// FIXME: bad API
typedef void
(*TALER_EXCHANGE_ManagementAuditorEnableCallback) (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr);
+ const struct TALER_EXCHANGE_ManagementAuditorEnableResponse *aer);
/**
@@ -5278,18 +5310,27 @@ void
TALER_EXCHANGE_management_enable_auditor_cancel (
struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah);
+/**
+ * Response when disabling an auditor.
+ */
+struct TALER_EXCHANGE_ManagementAuditorDisableResponse
+{
+ /**
+ * HTTP response data.
+ */
+ struct TALER_EXCHANGE_HttpResponse hr;
+};
/**
* Function called with information about the auditor disable operation result.
*
* @param cls closure
- * @param hr HTTP response data
+ * @param adr HTTP response data
*/
-// FIXME: bad API
typedef void
(*TALER_EXCHANGE_ManagementAuditorDisableCallback) (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr);
+ const struct TALER_EXCHANGE_ManagementAuditorDisableResponse *adr);
/**
@@ -5468,16 +5509,26 @@ TALER_EXCHANGE_management_disable_wire_cancel (
/**
+ * Response when setting wire fees.
+ */
+struct TALER_EXCHANGE_ManagementSetWireFeeResponse
+{
+ /**
+ * HTTP response data.
+ */
+ struct TALER_EXCHANGE_HttpResponse hr;
+};
+
+/**
* Function called with information about the wire enable operation result.
*
* @param cls closure
- * @param hr HTTP response data
+ * @param wfr response data
*/
-// FIXME: bad API
typedef void
(*TALER_EXCHANGE_ManagementSetWireFeeCallback) (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr);
+ const struct TALER_EXCHANGE_ManagementSetWireFeeResponse *wfr);
/**
@@ -5525,16 +5576,27 @@ TALER_EXCHANGE_management_set_wire_fees_cancel (
/**
+ * Response when setting global fees.
+ */
+struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse
+{
+ /**
+ * HTTP response data.
+ */
+ struct TALER_EXCHANGE_HttpResponse hr;
+};
+
+
+/**
* Function called with information about the global fee setting operation result.
*
* @param cls closure
- * @param hr HTTP response data
+ * @param gfr HTTP response data
*/
-// FIXME: bad API
typedef void
(*TALER_EXCHANGE_ManagementSetGlobalFeeCallback) (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr);
+ const struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse *gfr);
/**
@@ -5586,17 +5648,28 @@ TALER_EXCHANGE_management_set_global_fees_cancel (
/**
+ * Response when adding denomination signature by auditor.
+ */
+struct TALER_EXCHANGE_AuditorAddDenominationResponse
+{
+ /**
+ * HTTP response data.
+ */
+ struct TALER_EXCHANGE_HttpResponse hr;
+};
+
+
+/**
* Function called with information about the POST
* /auditor/$AUDITOR_PUB/$H_DENOM_PUB operation result.
*
* @param cls closure
- * @param hr HTTP response data
+ * @param adr HTTP response data
*/
-// FIXME: bad API
typedef void
(*TALER_EXCHANGE_AuditorAddDenominationCallback) (
void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr);
+ const struct TALER_EXCHANGE_AuditorAddDenominationResponse *adr);
/**
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 92fb36fb2..5404f0b16 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -5577,8 +5577,8 @@ struct TALER_EXCHANGEDB_Plugin
(*insert_wire)(void *cls,
const char *payto_uri,
const char *conversion_url,
- json_t *debit_restrictions,
- json_t *credit_restrictions,
+ const json_t *debit_restrictions,
+ const json_t *credit_restrictions,
struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterSignatureP *master_sig);
@@ -5600,8 +5600,8 @@ struct TALER_EXCHANGEDB_Plugin
(*update_wire)(void *cls,
const char *payto_uri,
const char *conversion_url,
- json_t *debit_restrictions,
- json_t *credit_restrictions,
+ const json_t *debit_restrictions,
+ const json_t *credit_restrictions,
struct GNUNET_TIME_Timestamp change_date,
bool enabled);
diff --git a/src/include/taler_extensions.h b/src/include/taler_extensions.h
index 75f225344..cd9d7ddd4 100644
--- a/src/include/taler_extensions.h
+++ b/src/include/taler_extensions.h
@@ -259,13 +259,13 @@ TALER_extensions_parse_manifest (
*/
enum GNUNET_GenericReturnValue
TALER_extensions_load_manifests (
- json_t *manifests);
+ const json_t *manifests);
/*
* @brief Returns the head of the linked list of extensions.
*/
const struct TALER_Extensions *
-TALER_extensions_get_head ();
+TALER_extensions_get_head (void);
/**
* @brief Finds and returns a supported extension by a given type.
@@ -323,7 +323,7 @@ TALER_extensions_is_enabled (
*/
enum GNUNET_GenericReturnValue
TALER_extensions_verify_manifests_signature (
- json_t *manifests,
+ const json_t *manifests,
struct TALER_MasterSignatureP *extensions_sig,
struct TALER_MasterPublicKeyP *master_pub);
@@ -363,7 +363,7 @@ struct TALER_AgeRestrictionConfig
* @return age restriction configuration if present, otherwise NULL.
*/
const struct TALER_AgeRestrictionConfig *
-TALER_extensions_get_age_restriction_config ();
+TALER_extensions_get_age_restriction_config (void);
/**
* @brief Check if age restriction is enabled
@@ -371,7 +371,7 @@ TALER_extensions_get_age_restriction_config ();
* @return true, if age restriction is loaded, configured and enabled; otherwise false.
*/
bool
-TALER_extensions_is_age_restriction_enabled ();
+TALER_extensions_is_age_restriction_enabled (void);
/**
* @brief Return the age mask for age restriction
@@ -379,6 +379,6 @@ TALER_extensions_is_age_restriction_enabled ();
* @return configured age mask, if age restriction is loaded, configured and enabled; otherwise zero mask.
*/
struct TALER_AgeMask
-TALER_extensions_get_age_restriction_mask ();
+TALER_extensions_get_age_restriction_mask (void);
#endif
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index fd7e99d93..5c0f8bad8 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -1237,11 +1237,6 @@ parse_i18n_string (void *cls,
const char *str;
str = json_string_value (val);
- if (NULL == str)
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
*(const char **) spec->ptr = str;
}
return GNUNET_OK;
diff --git a/src/kyclogic/plugin_kyclogic_kycaid.c b/src/kyclogic/plugin_kyclogic_kycaid.c
index 95dc4bb78..058c41e17 100644
--- a/src/kyclogic/plugin_kyclogic_kycaid.c
+++ b/src/kyclogic/plugin_kyclogic_kycaid.c
@@ -758,11 +758,12 @@ kycaid_webhook_cancel (struct TALER_KYCLOGIC_WebhookHandle *wh)
* @param verifications JSON object with failure details
*/
static void
-log_failure (json_t *verifications)
+log_failure (const json_t *verifications)
{
- json_t *member;
+ const json_t *member;
const char *name;
- json_object_foreach (verifications, name, member)
+
+ json_object_foreach ((json_t *) verifications, name, member)
{
bool iverified;
const char *comment;
@@ -1176,7 +1177,7 @@ kycaid_webhook (void *cls,
const char *status = NULL;
bool verified = false;
bool no_verified = true;
- json_t *verifications = NULL;
+ const json_t *verifications = NULL;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("request_id",
&request_id),
@@ -1195,8 +1196,8 @@ kycaid_webhook (void *cls,
&verified),
&no_verified),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_json ("verifications",
- &verifications),
+ GNUNET_JSON_spec_object_const ("verifications",
+ &verifications),
NULL),
GNUNET_JSON_spec_end ()
};
@@ -1253,7 +1254,6 @@ kycaid_webhook (void *cls,
wh->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
wh->task = GNUNET_SCHEDULER_add_now (&async_webhook_reply,
wh);
- GNUNET_JSON_parse_free (spec);
return wh;
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
@@ -1267,7 +1267,6 @@ kycaid_webhook (void *cls,
wh->response_code = MHD_HTTP_NOT_FOUND;
wh->task = GNUNET_SCHEDULER_add_now (&async_webhook_reply,
wh);
- GNUNET_JSON_parse_free (spec);
return wh;
}
wh->verification_id = GNUNET_strdup (verification_id);
@@ -1286,7 +1285,6 @@ kycaid_webhook (void *cls,
MHD_RESPMEM_PERSISTENT);
wh->task = GNUNET_SCHEDULER_add_now (&async_webhook_reply,
wh);
- GNUNET_JSON_parse_free (spec);
return wh;
}
@@ -1300,7 +1298,6 @@ kycaid_webhook (void *cls,
wh->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
wh->task = GNUNET_SCHEDULER_add_now (&async_webhook_reply,
wh);
- GNUNET_JSON_parse_free (spec);
return wh;
}
@@ -1324,7 +1321,6 @@ kycaid_webhook (void *cls,
pd->slist,
&handle_webhook_finished,
wh);
- GNUNET_JSON_parse_free (spec);
return wh;
}
diff --git a/src/kyclogic/plugin_kyclogic_oauth2.c b/src/kyclogic/plugin_kyclogic_oauth2.c
index e7350f01c..c9e5d8dcf 100644
--- a/src/kyclogic/plugin_kyclogic_oauth2.c
+++ b/src/kyclogic/plugin_kyclogic_oauth2.c
@@ -951,12 +951,12 @@ parse_proof_success_reply (struct TALER_KYCLOGIC_ProofHandle *ph,
const json_t *j)
{
const char *state;
- json_t *data;
+ const json_t *data;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("status",
&state),
- GNUNET_JSON_spec_json ("data",
- &data),
+ GNUNET_JSON_spec_object_const ("data",
+ &data),
GNUNET_JSON_spec_end ()
};
enum GNUNET_GenericReturnValue res;
@@ -988,7 +988,6 @@ parse_proof_success_reply (struct TALER_KYCLOGIC_ProofHandle *ph,
GNUNET_break_op (0);
handle_proof_error (ph,
j);
- GNUNET_JSON_parse_free (spec);
return;
}
{
@@ -1016,7 +1015,6 @@ parse_proof_success_reply (struct TALER_KYCLOGIC_ProofHandle *ph,
"Unexpected response from KYC gateway: data must contain id");
ph->http_status
= MHD_HTTP_BAD_GATEWAY;
- GNUNET_JSON_parse_free (spec);
return;
}
ph->status = TALER_KYCLOGIC_STATUS_SUCCESS;
@@ -1034,7 +1032,6 @@ parse_proof_success_reply (struct TALER_KYCLOGIC_ProofHandle *ph,
}
ph->attributes = data2attributes (ph->pd,
data);
- GNUNET_JSON_parse_free (spec);
}
diff --git a/src/kyclogic/plugin_kyclogic_persona.c b/src/kyclogic/plugin_kyclogic_persona.c
index e14a50390..406307838 100644
--- a/src/kyclogic/plugin_kyclogic_persona.c
+++ b/src/kyclogic/plugin_kyclogic_persona.c
@@ -1113,17 +1113,17 @@ handle_proof_finished (void *cls,
const char *inquiry_id;
const char *account_id;
const char *type = NULL;
- json_t *attributes;
- json_t *relationships;
+ const json_t *attributes;
+ const json_t *relationships;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("type",
&type),
GNUNET_JSON_spec_string ("id",
&inquiry_id),
- GNUNET_JSON_spec_json ("attributes",
- &attributes),
- GNUNET_JSON_spec_json ("relationships",
- &relationships),
+ GNUNET_JSON_spec_object_const ("attributes",
+ &attributes),
+ GNUNET_JSON_spec_object_const ("relationships",
+ &relationships),
GNUNET_JSON_spec_end ()
};
@@ -1141,7 +1141,6 @@ handle_proof_finished (void *cls,
inquiry_id,
"data",
data);
- GNUNET_JSON_parse_free (spec);
break;
}
@@ -1172,8 +1171,6 @@ handle_proof_finished (void *cls,
inquiry_id,
"data-attributes",
data);
- GNUNET_JSON_parse_free (ispec);
- GNUNET_JSON_parse_free (spec);
break;
}
{
@@ -1192,8 +1189,6 @@ handle_proof_finished (void *cls,
inquiry_id,
"data-attributes-reference_id",
data);
- GNUNET_JSON_parse_free (ispec);
- GNUNET_JSON_parse_free (spec);
break;
}
}
@@ -1207,8 +1202,6 @@ handle_proof_finished (void *cls,
inquiry_id,
"data-id",
data);
- GNUNET_JSON_parse_free (ispec);
- GNUNET_JSON_parse_free (spec);
break;
}
@@ -1240,8 +1233,6 @@ handle_proof_finished (void *cls,
GNUNET_JSON_pack_object_incref ("data",
(json_t *)
data))));
- GNUNET_JSON_parse_free (ispec);
- GNUNET_JSON_parse_free (spec);
break;
}
@@ -1260,9 +1251,7 @@ handle_proof_finished (void *cls,
j,
&proof_post_conversion_cb,
ph);
- GNUNET_JSON_parse_free (ispec);
}
- GNUNET_JSON_parse_free (spec);
return; /* continued in proof_post_conversion_cb */
}
case MHD_HTTP_BAD_REQUEST:
@@ -1649,17 +1638,17 @@ handle_webhook_finished (void *cls,
const char *inquiry_id;
const char *account_id;
const char *type = NULL;
- json_t *attributes;
- json_t *relationships;
+ const json_t *attributes;
+ const json_t *relationships;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("type",
&type),
GNUNET_JSON_spec_string ("id",
&inquiry_id),
- GNUNET_JSON_spec_json ("attributes",
- &attributes),
- GNUNET_JSON_spec_json ("relationships",
- &relationships),
+ GNUNET_JSON_spec_object_const ("attributes",
+ &attributes),
+ GNUNET_JSON_spec_object_const ("relationships",
+ &relationships),
GNUNET_JSON_spec_end ()
};
@@ -1709,8 +1698,6 @@ handle_webhook_finished (void *cls,
webhook_reply_error (wh,
inquiry_id,
MHD_HTTP_BAD_GATEWAY);
- GNUNET_JSON_parse_free (ispec);
- GNUNET_JSON_parse_free (spec);
break;
}
{
@@ -1727,8 +1714,6 @@ handle_webhook_finished (void *cls,
webhook_reply_error (wh,
inquiry_id,
MHD_HTTP_BAD_GATEWAY);
- GNUNET_JSON_parse_free (ispec);
- GNUNET_JSON_parse_free (spec);
break;
}
}
@@ -1740,8 +1725,6 @@ handle_webhook_finished (void *cls,
webhook_reply_error (wh,
inquiry_id,
MHD_HTTP_BAD_GATEWAY);
- GNUNET_JSON_parse_free (ispec);
- GNUNET_JSON_parse_free (spec);
break;
}
@@ -1763,8 +1746,6 @@ handle_webhook_finished (void *cls,
inquiry_id,
NULL,
MHD_HTTP_OK);
- GNUNET_JSON_parse_free (ispec);
- GNUNET_JSON_parse_free (spec);
break;
}
@@ -1784,9 +1765,7 @@ handle_webhook_finished (void *cls,
j,
&webhook_post_conversion_cb,
wh);
- GNUNET_JSON_parse_free (ispec);
}
- GNUNET_JSON_parse_free (spec);
return; /* continued in webhook_post_conversion_cb */
}
case MHD_HTTP_BAD_REQUEST:
diff --git a/src/lib/exchange_api_add_aml_decision.c b/src/lib/exchange_api_add_aml_decision.c
index 7245db3b1..342e1e3dc 100644
--- a/src/lib/exchange_api_add_aml_decision.c
+++ b/src/lib/exchange_api_add_aml_decision.c
@@ -79,9 +79,9 @@ handle_add_aml_decision_finished (void *cls,
{
struct TALER_EXCHANGE_AddAmlDecision *wh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_HttpResponse hr = {
- .http_status = (unsigned int) response_code,
- .reply = json
+ struct TALER_EXCHANGE_AddAmlDecisionResponse adr = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
};
wh->job = NULL;
@@ -89,34 +89,34 @@ handle_add_aml_decision_finished (void *cls,
{
case 0:
/* no reply */
- hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- hr.hint = "server offline?";
+ adr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ adr.hr.hint = "server offline?";
break;
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_CONFLICT:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
break;
default:
/* unexpected response code */
GNUNET_break_op (0);
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange AML decision\n",
(unsigned int) response_code,
- (int) hr.ec);
+ (int) adr.hr.ec);
break;
}
if (NULL != wh->cb)
{
wh->cb (wh->cb_cls,
- &hr);
+ &adr);
wh->cb = NULL;
}
TALER_EXCHANGE_add_aml_decision_cancel (wh);
diff --git a/src/lib/exchange_api_auditor_add_denomination.c b/src/lib/exchange_api_auditor_add_denomination.c
index 71f421d4d..89de0d7f1 100644
--- a/src/lib/exchange_api_auditor_add_denomination.c
+++ b/src/lib/exchange_api_auditor_add_denomination.c
@@ -79,9 +79,9 @@ handle_auditor_add_denomination_finished (void *cls,
{
struct TALER_EXCHANGE_AuditorAddDenominationHandle *ah = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_HttpResponse hr = {
- .http_status = (unsigned int) response_code,
- .reply = json
+ struct TALER_EXCHANGE_AuditorAddDenominationResponse adr = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
};
ah->job = NULL;
@@ -90,37 +90,37 @@ handle_auditor_add_denomination_finished (void *cls,
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_NOT_FOUND:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_GONE:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_PRECONDITION_FAILED:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
break;
default:
/* unexpected response code */
if (NULL != json)
{
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange auditor-add-denomination at URL `%s'\n",
(unsigned int) response_code,
- (int) hr.ec,
+ (int) adr.hr.ec,
ah->url);
}
else
{
- hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- hr.hint = NULL;
+ adr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ adr.hr.hint = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected HTTP response code %u (no JSON returned) at URL `%s'\n",
(unsigned int) response_code,
@@ -131,7 +131,7 @@ handle_auditor_add_denomination_finished (void *cls,
if (NULL != ah->cb)
{
ah->cb (ah->cb_cls,
- &hr);
+ &adr);
ah->cb = NULL;
}
TALER_EXCHANGE_add_auditor_denomination_cancel (ah);
diff --git a/src/lib/exchange_api_batch_deposit.c b/src/lib/exchange_api_batch_deposit.c
index c583d5add..544407a38 100644
--- a/src/lib/exchange_api_batch_deposit.c
+++ b/src/lib/exchange_api_batch_deposit.c
@@ -237,12 +237,12 @@ handle_deposit_finished (void *cls,
case MHD_HTTP_OK:
{
const struct TALER_EXCHANGE_Keys *key_state;
- json_t *sigs;
+ const json_t *sigs;
json_t *sig;
unsigned int idx;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("exchange_sigs",
- &sigs),
+ GNUNET_JSON_spec_array_const ("exchange_sigs",
+ &sigs),
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&dh->exchange_pub),
GNUNET_JSON_spec_mark_optional (
@@ -269,7 +269,6 @@ handle_deposit_finished (void *cls,
GNUNET_break_op (0);
dr.hr.http_status = 0;
dr.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
- GNUNET_JSON_parse_free (spec);
break;
}
dh->exchange_sigs = GNUNET_new_array (dh->num_cdds,
@@ -282,7 +281,6 @@ handle_deposit_finished (void *cls,
GNUNET_break_op (0);
dr.hr.http_status = 0;
dr.hr.ec = TALER_EC_EXCHANGE_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE;
- GNUNET_JSON_parse_free (spec);
break;
}
json_array_foreach (sigs, idx, sig)
@@ -303,7 +301,6 @@ handle_deposit_finished (void *cls,
GNUNET_break_op (0);
dr.hr.http_status = 0;
dr.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
- GNUNET_JSON_parse_free (spec);
break;
}
dki = TALER_EXCHANGE_get_denomination_key_by_hash (key_state,
@@ -332,14 +329,12 @@ handle_deposit_finished (void *cls,
GNUNET_break_op (0);
dr.hr.http_status = 0;
dr.hr.ec = TALER_EC_EXCHANGE_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE;
- GNUNET_JSON_parse_free (spec);
break;
}
}
TEAH_get_auditors_for_dc (dh->exchange,
&auditor_cb,
dh);
- GNUNET_JSON_parse_free (spec);
}
dr.details.ok.exchange_sigs = dh->exchange_sigs;
dr.details.ok.exchange_pub = &dh->exchange_pub;
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 588b12834..8bbc6c472 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -1465,7 +1465,7 @@ enum GNUNET_GenericReturnValue
TALER_EXCHANGE_verify_coin_history (
const struct TALER_EXCHANGE_DenomPublicKey *dk,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
- json_t *history,
+ const json_t *history,
struct TALER_Amount *total)
{
const char *currency = dk->value.currency;
@@ -1865,7 +1865,7 @@ TALER_EXCHANGE_check_coin_amount_conflict_ (
struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_Amount *remaining)
{
- json_t *history;
+ const json_t *history;
struct TALER_Amount total;
struct TALER_DenominationHashP h_denom_pub;
const struct TALER_EXCHANGE_DenomPublicKey *dki;
@@ -1874,8 +1874,8 @@ TALER_EXCHANGE_check_coin_amount_conflict_ (
coin_pub),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&h_denom_pub),
- GNUNET_JSON_spec_json ("history",
- &history),
+ GNUNET_JSON_spec_array_const ("history",
+ &history),
GNUNET_JSON_spec_end ()
};
@@ -1902,10 +1902,8 @@ TALER_EXCHANGE_check_coin_amount_conflict_ (
&total))
{
GNUNET_break_op (0);
- json_decref (history);
return GNUNET_SYSERR;
}
- json_decref (history);
if (0 >
TALER_amount_subtract (remaining,
&dki->value,
@@ -2298,8 +2296,8 @@ TALER_EXCHANGE_parse_accounts (const struct TALER_MasterPublicKeyP *master_pub,
i++)
{
struct TALER_EXCHANGE_WireAccount *wa = &was[i];
- json_t *credit_restrictions;
- json_t *debit_restrictions;
+ const json_t *credit_restrictions;
+ const json_t *debit_restrictions;
struct GNUNET_JSON_Specification spec_account[] = {
GNUNET_JSON_spec_string ("payto_uri",
&wa->payto_uri),
@@ -2307,10 +2305,10 @@ TALER_EXCHANGE_parse_accounts (const struct TALER_MasterPublicKeyP *master_pub,
GNUNET_JSON_spec_string ("conversion_url",
&wa->conversion_url),
NULL),
- GNUNET_JSON_spec_json ("credit_restrictions",
- &credit_restrictions),
- GNUNET_JSON_spec_json ("debit_restrictions",
- &debit_restrictions),
+ GNUNET_JSON_spec_array_const ("credit_restrictions",
+ &credit_restrictions),
+ GNUNET_JSON_spec_array_const ("debit_restrictions",
+ &debit_restrictions),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&wa->master_sig),
GNUNET_JSON_spec_end ()
@@ -2366,7 +2364,6 @@ TALER_EXCHANGE_parse_accounts (const struct TALER_MasterPublicKeyP *master_pub,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- GNUNET_JSON_parse_free (spec_account);
} /* end 'for all accounts */
return GNUNET_OK;
}
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 601b163db..d78b6185b 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -400,7 +400,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
json_t *auditor_obj,
const struct TALER_EXCHANGE_Keys *key_data)
{
- json_t *keys;
+ const json_t *keys;
json_t *key;
unsigned int len;
unsigned int off;
@@ -411,8 +411,8 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
&auditor->auditor_pub),
GNUNET_JSON_spec_string ("auditor_url",
&auditor_url),
- GNUNET_JSON_spec_json ("denomination_keys",
- &keys),
+ GNUNET_JSON_spec_array_const ("denomination_keys",
+ &keys),
GNUNET_JSON_spec_end ()
};
@@ -492,7 +492,6 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
&auditor_sig))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
}
@@ -501,7 +500,6 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
off++;
}
auditor->num_denom_keys = off;
- GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}
@@ -734,7 +732,7 @@ decode_keys_json (const json_t *resp_obj,
const char *currency;
const char *asset_type;
bool tipping_allowed = true;
- json_t *wblwk = NULL;
+ const json_t *wblwk = NULL;
struct GNUNET_JSON_Specification mspec[] = {
GNUNET_JSON_spec_fixed_auto ("denominations_sig",
&denominations_sig),
@@ -755,8 +753,8 @@ decode_keys_json (const json_t *resp_obj,
&tipping_allowed),
NULL),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_json ("wallet_balance_limit_without_kyc",
- &wblwk),
+ GNUNET_JSON_spec_array_const ("wallet_balance_limit_without_kyc",
+ &wblwk),
NULL),
GNUNET_JSON_spec_end ()
};
@@ -908,14 +906,14 @@ decode_keys_json (const json_t *resp_obj,
/* TODO: maybe lift all this into a FP in TALER_Extension ? */
{
struct TALER_MasterSignatureP extensions_sig = {0};
- json_t *manifests = NULL;
+ const json_t *manifests = NULL;
bool no_extensions = false;
bool no_signature = false;
struct GNUNET_JSON_Specification ext_spec[] = {
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_json ("extensions",
- &manifests),
+ GNUNET_JSON_spec_object_const ("extensions",
+ &manifests),
&no_extensions),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto (
@@ -1707,15 +1705,15 @@ static void
deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
const json_t *data)
{
- json_t *keys;
+ const json_t *keys;
const char *url;
uint32_t version;
struct GNUNET_TIME_Timestamp expire;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_uint32 ("version",
&version),
- GNUNET_JSON_spec_json ("keys",
- &keys),
+ GNUNET_JSON_spec_array_const ("keys",
+ &keys),
GNUNET_JSON_spec_string ("exchange_url",
&url),
GNUNET_JSON_spec_timestamp ("expire",
@@ -1742,14 +1740,12 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
}
if (0 != version)
{
- GNUNET_JSON_parse_free (spec);
return; /* unsupported version */
}
if (0 != strcmp (url,
exchange->url))
{
GNUNET_break (0);
- GNUNET_JSON_parse_free (spec);
return;
}
memset (&key_data,
@@ -1762,7 +1758,6 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
&kresp.details.ok.compat))
{
GNUNET_break (0);
- GNUNET_JSON_parse_free (spec);
return;
}
/* decode successful, initialize with the result */
@@ -1777,7 +1772,6 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
/* notify application about the key information */
exchange->cert_cb (exchange->cert_cb_cls,
&kresp);
- GNUNET_JSON_parse_free (spec);
}
diff --git a/src/lib/exchange_api_kyc_check.c b/src/lib/exchange_api_kyc_check.c
index d1580e76c..472a7d2d2 100644
--- a/src/lib/exchange_api_kyc_check.c
+++ b/src/lib/exchange_api_kyc_check.c
@@ -96,7 +96,7 @@ handle_kyc_check_finished (void *cls,
break;
case MHD_HTTP_OK:
{
- json_t *kyc_details;
+ const json_t *kyc_details;
uint32_t status;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
@@ -105,8 +105,8 @@ handle_kyc_check_finished (void *cls,
&ks.details.ok.exchange_pub),
GNUNET_JSON_spec_timestamp ("now",
&ks.details.ok.timestamp),
- GNUNET_JSON_spec_json ("kyc_details",
- &kyc_details),
+ GNUNET_JSON_spec_object_const ("kyc_details",
+ &kyc_details),
GNUNET_JSON_spec_uint32 ("aml_status",
&status),
GNUNET_JSON_spec_end ()
diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c
index 3b998f23a..c2b7ac0b4 100644
--- a/src/lib/exchange_api_link.c
+++ b/src/lib/exchange_api_link.c
@@ -270,9 +270,10 @@ parse_link_ok (struct TALER_EXCHANGE_LinkHandle *lh,
whilst 'i' and 'session' track the 2d array. *///
for (session = 0; session<json_array_size (json); session++)
{
- json_t *jsona;
+ const json_t *jsona;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("new_coins", &jsona),
+ GNUNET_JSON_spec_array_const ("new_coins",
+ &jsona),
GNUNET_JSON_spec_end ()
};
@@ -285,16 +286,8 @@ parse_link_ok (struct TALER_EXCHANGE_LinkHandle *lh,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- if (! json_is_array (jsona))
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return GNUNET_SYSERR;
- }
-
/* count all coins over all sessions */
num_coins += json_array_size (jsona);
- GNUNET_JSON_parse_free (spec);
}
/* Now that we know how big the 1d array is, allocate
and fill it. */
@@ -307,11 +300,11 @@ parse_link_ok (struct TALER_EXCHANGE_LinkHandle *lh,
off_coin = 0;
for (session = 0; session<json_array_size (json); session++)
{
- json_t *jsona;
+ const json_t *jsona;
struct TALER_TransferPublicKeyP trans_pub;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("new_coins",
- &jsona),
+ GNUNET_JSON_spec_array_const ("new_coins",
+ &jsona),
GNUNET_JSON_spec_fixed_auto ("transfer_pub",
&trans_pub),
GNUNET_JSON_spec_end ()
@@ -326,12 +319,6 @@ parse_link_ok (struct TALER_EXCHANGE_LinkHandle *lh,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- if (! json_is_array (jsona))
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return GNUNET_SYSERR;
- }
/* decode all coins */
for (i = 0; i<json_array_size (jsona); i++)
@@ -357,10 +344,8 @@ parse_link_ok (struct TALER_EXCHANGE_LinkHandle *lh,
{
GNUNET_break_op (0);
ret = GNUNET_SYSERR;
- GNUNET_JSON_parse_free (spec);
break;
}
- GNUNET_JSON_parse_free (spec);
} /* end of for (session) */
if (off_coin == num_coins)
diff --git a/src/lib/exchange_api_lookup_aml_decision.c b/src/lib/exchange_api_lookup_aml_decision.c
index 9e20c83b8..01e98213b 100644
--- a/src/lib/exchange_api_lookup_aml_decision.c
+++ b/src/lib/exchange_api_lookup_aml_decision.c
@@ -127,13 +127,12 @@ parse_kyc_attributes (const json_t *kyc_attributes,
json_array_foreach (kyc_attributes, idx, obj)
{
struct TALER_EXCHANGE_KycHistoryDetail *kyc = &kyc_attributes_ar[idx];
- json_t *attributes = NULL;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_timestamp ("collection_time",
&kyc->collection_time),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_json ("attributes",
- &attributes),
+ GNUNET_JSON_spec_object_const ("attributes",
+ &kyc->attributes),
NULL),
GNUNET_JSON_spec_string ("provider_section",
&kyc->provider_section),
@@ -149,8 +148,6 @@ parse_kyc_attributes (const json_t *kyc_attributes,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- kyc->attributes = attributes;
- json_decref (attributes); /* this is OK, RC preserved via 'kyc_attributes' as long as needed! */
}
return GNUNET_OK;
}
@@ -171,13 +168,13 @@ parse_decision_ok (struct TALER_EXCHANGE_LookupAmlDecision *lh,
.hr.reply = json,
.hr.http_status = MHD_HTTP_OK
};
- json_t *aml_history;
- json_t *kyc_attributes;
+ const json_t *aml_history;
+ const json_t *kyc_attributes;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("aml_history",
- &aml_history),
- GNUNET_JSON_spec_json ("kyc_attributes",
- &kyc_attributes),
+ GNUNET_JSON_spec_array_const ("aml_history",
+ &aml_history),
+ GNUNET_JSON_spec_array_const ("kyc_attributes",
+ &kyc_attributes),
GNUNET_JSON_spec_end ()
};
@@ -199,6 +196,12 @@ parse_decision_ok (struct TALER_EXCHANGE_LookupAmlDecision *lh,
GNUNET_NZL (lr.details.ok.kyc_attributes_length)];
enum GNUNET_GenericReturnValue ret = GNUNET_SYSERR;
+ memset (aml_history_ar,
+ 0,
+ sizeof (aml_history_ar));
+ memset (kyc_attributes_ar,
+ 0,
+ sizeof (kyc_attributes_ar));
lr.details.ok.aml_history = aml_history_ar;
lr.details.ok.kyc_attributes = kyc_attributes_ar;
ret = parse_aml_history (aml_history,
diff --git a/src/lib/exchange_api_lookup_aml_decisions.c b/src/lib/exchange_api_lookup_aml_decisions.c
index 403acb54a..22222b1e4 100644
--- a/src/lib/exchange_api_lookup_aml_decisions.c
+++ b/src/lib/exchange_api_lookup_aml_decisions.c
@@ -123,10 +123,10 @@ parse_decisions_ok (struct TALER_EXCHANGE_LookupAmlDecisions *lh,
.hr.reply = json,
.hr.http_status = MHD_HTTP_OK
};
- json_t *records;
+ const json_t *records;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("records",
- &records),
+ GNUNET_JSON_spec_array_const ("records",
+ &records),
GNUNET_JSON_spec_end ()
};
diff --git a/src/lib/exchange_api_management_add_partner.c b/src/lib/exchange_api_management_add_partner.c
index 75fb8aa6f..fec66c567 100644
--- a/src/lib/exchange_api_management_add_partner.c
+++ b/src/lib/exchange_api_management_add_partner.c
@@ -79,9 +79,9 @@ handle_add_partner_finished (void *cls,
{
struct TALER_EXCHANGE_ManagementAddPartner *wh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_HttpResponse hr = {
- .http_status = (unsigned int) response_code,
- .reply = json
+ struct TALER_EXCHANGE_ManagementAddPartnerResponse apr = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
};
wh->job = NULL;
@@ -89,34 +89,34 @@ handle_add_partner_finished (void *cls,
{
case 0:
/* no reply */
- hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- hr.hint = "server offline?";
+ apr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ apr.hr.hint = "server offline?";
break;
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ apr.hr.ec = TALER_JSON_get_error_code (json);
+ apr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_CONFLICT:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ apr.hr.ec = TALER_JSON_get_error_code (json);
+ apr.hr.hint = TALER_JSON_get_error_hint (json);
break;
default:
/* unexpected response code */
GNUNET_break_op (0);
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ apr.hr.ec = TALER_JSON_get_error_code (json);
+ apr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for adding exchange partner\n",
(unsigned int) response_code,
- (int) hr.ec);
+ (int) apr.hr.ec);
break;
}
if (NULL != wh->cb)
{
wh->cb (wh->cb_cls,
- &hr);
+ &apr);
wh->cb = NULL;
}
TALER_EXCHANGE_management_add_partner_cancel (wh);
diff --git a/src/lib/exchange_api_management_auditor_disable.c b/src/lib/exchange_api_management_auditor_disable.c
index b1de80f0e..8bce7f74f 100644
--- a/src/lib/exchange_api_management_auditor_disable.c
+++ b/src/lib/exchange_api_management_auditor_disable.c
@@ -81,9 +81,9 @@ handle_auditor_disable_finished (void *cls,
{
struct TALER_EXCHANGE_ManagementAuditorDisableHandle *ah = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_HttpResponse hr = {
- .http_status = (unsigned int) response_code,
- .reply = json
+ struct TALER_EXCHANGE_ManagementAuditorDisableResponse adr = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
};
ah->job = NULL;
@@ -92,32 +92,32 @@ handle_auditor_disable_finished (void *cls,
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_NOT_FOUND:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_CONFLICT:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
break;
default:
/* unexpected response code */
GNUNET_break_op (0);
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ adr.hr.ec = TALER_JSON_get_error_code (json);
+ adr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management auditor disable\n",
(unsigned int) response_code,
- (int) hr.ec);
+ (int) adr.hr.ec);
break;
}
if (NULL != ah->cb)
{
ah->cb (ah->cb_cls,
- &hr);
+ &adr);
ah->cb = NULL;
}
TALER_EXCHANGE_management_disable_auditor_cancel (ah);
diff --git a/src/lib/exchange_api_management_auditor_enable.c b/src/lib/exchange_api_management_auditor_enable.c
index af75215ec..65018577c 100644
--- a/src/lib/exchange_api_management_auditor_enable.c
+++ b/src/lib/exchange_api_management_auditor_enable.c
@@ -82,9 +82,9 @@ handle_auditor_enable_finished (void *cls,
{
struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_HttpResponse hr = {
- .http_status = (unsigned int) response_code,
- .reply = json
+ struct TALER_EXCHANGE_ManagementAuditorEnableResponse aer = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
};
ah->job = NULL;
@@ -93,28 +93,28 @@ handle_auditor_enable_finished (void *cls,
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ aer.hr.ec = TALER_JSON_get_error_code (json);
+ aer.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_CONFLICT:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ aer.hr.ec = TALER_JSON_get_error_code (json);
+ aer.hr.hint = TALER_JSON_get_error_hint (json);
break;
default:
/* unexpected response code */
GNUNET_break_op (0);
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ aer.hr.ec = TALER_JSON_get_error_code (json);
+ aer.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management auditor enable\n",
(unsigned int) response_code,
- (int) hr.ec);
+ (int) aer.hr.ec);
break;
}
if (NULL != ah->cb)
{
ah->cb (ah->cb_cls,
- &hr);
+ &aer);
ah->cb = NULL;
}
TALER_EXCHANGE_management_enable_auditor_cancel (ah);
diff --git a/src/lib/exchange_api_management_get_keys.c b/src/lib/exchange_api_management_get_keys.c
index c649f397f..df14f2e70 100644
--- a/src/lib/exchange_api_management_get_keys.c
+++ b/src/lib/exchange_api_management_get_keys.c
@@ -85,14 +85,14 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
};
struct TALER_EXCHANGE_FutureKeys *fk
= &gkr.details.ok.keys;
- json_t *sk;
- json_t *dk;
+ const json_t *sk;
+ const json_t *dk;
bool ok;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("future_denoms",
- &dk),
- GNUNET_JSON_spec_json ("future_signkeys",
- &sk),
+ GNUNET_JSON_spec_array_const ("future_denoms",
+ &dk),
+ GNUNET_JSON_spec_array_const ("future_signkeys",
+ &sk),
GNUNET_JSON_spec_fixed_auto ("master_pub",
&fk->master_pub),
GNUNET_JSON_spec_fixed_auto ("denom_secmod_public_key",
@@ -127,7 +127,7 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
i);
struct TALER_EXCHANGE_FutureSigningPublicKey *sign_key
= &fk->sign_keys[i];
- struct GNUNET_JSON_Specification spec[] = {
+ struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_fixed_auto ("key",
&sign_key->key),
GNUNET_JSON_spec_fixed_auto ("signkey_secmod_sig",
@@ -143,7 +143,7 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
if (GNUNET_OK !=
GNUNET_JSON_parse (j,
- spec,
+ ispec,
NULL, NULL))
{
GNUNET_break_op (0);
@@ -276,7 +276,6 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
break;
}
}
- GNUNET_JSON_parse_free (spec);
if (! ok)
break;
}
@@ -289,7 +288,6 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
TALER_denom_pub_free (&fk->denom_keys[i].key);
GNUNET_free (fk->sign_keys);
GNUNET_free (fk->denom_keys);
- GNUNET_JSON_parse_free (spec);
return (ok) ? GNUNET_OK : GNUNET_SYSERR;
}
diff --git a/src/lib/exchange_api_management_post_extensions.c b/src/lib/exchange_api_management_post_extensions.c
index b9721a982..99d1653d0 100644
--- a/src/lib/exchange_api_management_post_extensions.c
+++ b/src/lib/exchange_api_management_post_extensions.c
@@ -126,7 +126,7 @@ struct TALER_EXCHANGE_ManagementPostExtensionsHandle *
TALER_EXCHANGE_management_post_extensions (
struct GNUNET_CURL_Context *ctx,
const char *url,
- struct TALER_EXCHANGE_ManagementPostExtensionsData *ped,
+ const struct TALER_EXCHANGE_ManagementPostExtensionsData *ped,
TALER_EXCHANGE_ManagementPostExtensionsCallback cb,
void *cb_cls)
{
@@ -151,7 +151,7 @@ TALER_EXCHANGE_management_post_extensions (
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_object_steal ("extensions",
- ped->extensions),
+ (json_t *) ped->extensions),
GNUNET_JSON_pack_data_auto ("extensions_sig",
&ped->extensions_sig));
diff --git a/src/lib/exchange_api_management_set_global_fee.c b/src/lib/exchange_api_management_set_global_fee.c
index c8fae5c18..518e710cd 100644
--- a/src/lib/exchange_api_management_set_global_fee.c
+++ b/src/lib/exchange_api_management_set_global_fee.c
@@ -79,9 +79,9 @@ handle_set_global_fee_finished (void *cls,
{
struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *sgfh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_HttpResponse hr = {
- .http_status = (unsigned int) response_code,
- .reply = json
+ struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse sfr = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
};
sgfh->job = NULL;
@@ -90,32 +90,32 @@ handle_set_global_fee_finished (void *cls,
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ sfr.hr.ec = TALER_JSON_get_error_code (json);
+ sfr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_CONFLICT:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ sfr.hr.ec = TALER_JSON_get_error_code (json);
+ sfr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_PRECONDITION_FAILED:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ sfr.hr.ec = TALER_JSON_get_error_code (json);
+ sfr.hr.hint = TALER_JSON_get_error_hint (json);
break;
default:
/* unexpected response code */
GNUNET_break_op (0);
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ sfr.hr.ec = TALER_JSON_get_error_code (json);
+ sfr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management set global fee\n",
(unsigned int) response_code,
- (int) hr.ec);
+ (int) sfr.hr.ec);
break;
}
if (NULL != sgfh->cb)
{
sgfh->cb (sgfh->cb_cls,
- &hr);
+ &sfr);
sgfh->cb = NULL;
}
TALER_EXCHANGE_management_set_global_fees_cancel (sgfh);
diff --git a/src/lib/exchange_api_management_set_wire_fee.c b/src/lib/exchange_api_management_set_wire_fee.c
index 725261161..01ed7742b 100644
--- a/src/lib/exchange_api_management_set_wire_fee.c
+++ b/src/lib/exchange_api_management_set_wire_fee.c
@@ -79,9 +79,9 @@ handle_set_wire_fee_finished (void *cls,
{
struct TALER_EXCHANGE_ManagementSetWireFeeHandle *swfh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_HttpResponse hr = {
- .http_status = (unsigned int) response_code,
- .reply = json
+ struct TALER_EXCHANGE_ManagementSetWireFeeResponse swr = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
};
swfh->job = NULL;
@@ -90,32 +90,32 @@ handle_set_wire_fee_finished (void *cls,
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ swr.hr.ec = TALER_JSON_get_error_code (json);
+ swr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_CONFLICT:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ swr.hr.ec = TALER_JSON_get_error_code (json);
+ swr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_PRECONDITION_FAILED:
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ swr.hr.ec = TALER_JSON_get_error_code (json);
+ swr.hr.hint = TALER_JSON_get_error_hint (json);
break;
default:
/* unexpected response code */
GNUNET_break_op (0);
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ swr.hr.ec = TALER_JSON_get_error_code (json);
+ swr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management set wire fee\n",
(unsigned int) response_code,
- (int) hr.ec);
+ (int) swr.hr.ec);
break;
}
if (NULL != swfh->cb)
{
swfh->cb (swfh->cb_cls,
- &hr);
+ &swr);
swfh->cb = NULL;
}
TALER_EXCHANGE_management_set_wire_fees_cancel (swfh);
diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c
index 3bdef2020..50de76810 100644
--- a/src/lib/exchange_api_refreshes_reveal.c
+++ b/src/lib/exchange_api_refreshes_reveal.c
@@ -107,10 +107,10 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh,
const json_t *json,
struct TALER_EXCHANGE_RevealedCoinInfo *rcis)
{
- json_t *jsona;
+ const json_t *jsona;
struct GNUNET_JSON_Specification outer_spec[] = {
- GNUNET_JSON_spec_json ("ev_sigs",
- &jsona),
+ GNUNET_JSON_spec_array_const ("ev_sigs",
+ &jsona),
GNUNET_JSON_spec_end ()
};
@@ -122,18 +122,10 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- if (! json_is_array (jsona))
- {
- /* We expected an array of coins */
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (outer_spec);
- return GNUNET_SYSERR;
- }
if (rrh->md.num_fresh_coins != json_array_size (jsona))
{
/* Number of coins generated does not match our expectation */
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR;
}
for (unsigned int i = 0; i<rrh->md.num_fresh_coins; i++)
@@ -180,7 +172,6 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh,
NULL, NULL))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR;
}
@@ -209,13 +200,11 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh,
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
- GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR;
}
GNUNET_JSON_parse_free (spec);
rci->sig = coin.sig;
}
- GNUNET_JSON_parse_free (outer_spec);
return GNUNET_OK;
}
diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c
index 7c9616ea5..35524ca4b 100644
--- a/src/lib/exchange_api_refund.c
+++ b/src/lib/exchange_api_refund.c
@@ -172,11 +172,11 @@ static enum GNUNET_GenericReturnValue
verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
const json_t *json)
{
- json_t *history;
+ const json_t *history;
struct TALER_DenominationHashP h_denom_pub;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("history",
- &history),
+ GNUNET_JSON_spec_array_const ("history",
+ &history),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&h_denom_pub),
GNUNET_JSON_spec_end ()
@@ -199,7 +199,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
if (0 == len)
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
have_deposit = false;
@@ -225,7 +224,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
NULL, NULL))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (0 == strcasecmp (type,
@@ -274,7 +272,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
NULL, NULL))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -292,7 +289,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&sig))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if ( (0 != GNUNET_memcmp (&rh->h_contract_terms,
@@ -302,7 +298,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
{
/* deposit information is about a different merchant/contract */
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (have_deposit)
@@ -313,7 +308,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&dtotal))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
GNUNET_break (0 <=
@@ -356,7 +350,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
NULL, NULL))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (0 >
@@ -365,7 +358,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&amount))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -377,7 +369,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&sig))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if ( (0 != GNUNET_memcmp (&rh->h_contract_terms,
@@ -387,7 +378,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
{
/* refund is about a different merchant/contract */
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (rtransaction_id == rh->rtransaction_id)
@@ -395,7 +385,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
/* Eh, this shows either a dependency failure or idempotency,
but must not happen in a conflict reply. Fail! */
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
@@ -406,7 +395,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&rtotal))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
GNUNET_break (0 <=
@@ -427,7 +415,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
"Unexpected type `%s' in response for exchange refund\n",
type);
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
}
@@ -440,7 +427,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&rh->refund_amount))
{
GNUNET_break (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
}
@@ -452,7 +438,6 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
if (! have_deposit)
{
GNUNET_break (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (-1 != TALER_amount_cmp (&dtotal,
@@ -460,11 +445,9 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
{
/* rtotal <= dtotal is fine, no conflict! */
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
/* dtotal < rtotal: that's a conflict! */
- GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}
@@ -482,11 +465,11 @@ static enum GNUNET_GenericReturnValue
verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
const json_t *json)
{
- json_t *h;
+ const json_t *h;
json_t *e;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("history",
- &h),
+ GNUNET_JSON_spec_array_const ("history",
+ &h),
GNUNET_JSON_spec_end ()
};
@@ -498,11 +481,9 @@ verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- if ( (! json_is_array (h)) ||
- (1 != json_array_size (h) ) )
+ if (1 != json_array_size (h))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
e = json_array_get (h, 0);
@@ -538,7 +519,6 @@ verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
NULL, NULL))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -550,7 +530,6 @@ verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&sig))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if ( (rtransaction_id != rh->rtransaction_id) ||
@@ -562,11 +541,9 @@ verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&amount)) )
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
}
- GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}
diff --git a/src/lib/exchange_api_reserves_attest.c b/src/lib/exchange_api_reserves_attest.c
index 0a9134e85..82d5785b7 100644
--- a/src/lib/exchange_api_reserves_attest.c
+++ b/src/lib/exchange_api_reserves_attest.c
@@ -93,7 +93,7 @@ handle_reserves_attest_ok (struct TALER_EXCHANGE_ReservesAttestHandle *rsh,
.hr.reply = j,
.hr.http_status = MHD_HTTP_OK
};
- json_t *attributes;
+ const json_t *attributes;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_timestamp ("exchange_timestamp",
&rs.details.ok.exchange_time),
@@ -103,8 +103,8 @@ handle_reserves_attest_ok (struct TALER_EXCHANGE_ReservesAttestHandle *rsh,
&rs.details.ok.exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
&rs.details.ok.exchange_pub),
- GNUNET_JSON_spec_json ("attributes",
- &attributes),
+ GNUNET_JSON_spec_object_const ("attributes",
+ &attributes),
GNUNET_JSON_spec_end ()
};
diff --git a/src/lib/exchange_api_reserves_get_attestable.c b/src/lib/exchange_api_reserves_get_attestable.c
index 3a5fd25d8..b272d478a 100644
--- a/src/lib/exchange_api_reserves_get_attestable.c
+++ b/src/lib/exchange_api_reserves_get_attestable.c
@@ -88,10 +88,10 @@ handle_reserves_get_attestable_ok (
.hr.reply = j,
.hr.http_status = MHD_HTTP_OK
};
- json_t *details;
+ const json_t *details;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("details",
- &details),
+ GNUNET_JSON_spec_array_const ("details",
+ &details),
GNUNET_JSON_spec_end ()
};
@@ -116,7 +116,6 @@ handle_reserves_get_attestable_ok (
if (NULL == attributes[i])
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
}
@@ -126,7 +125,6 @@ handle_reserves_get_attestable_ok (
&rs);
rgah->cb = NULL;
}
- GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}
diff --git a/src/lib/exchange_api_reserves_history.c b/src/lib/exchange_api_reserves_history.c
index 2a0dd5651..ccc11a270 100644
--- a/src/lib/exchange_api_reserves_history.c
+++ b/src/lib/exchange_api_reserves_history.c
@@ -99,7 +99,7 @@ static enum GNUNET_GenericReturnValue
handle_reserves_history_ok (struct TALER_EXCHANGE_ReservesHistoryHandle *rsh,
const json_t *j)
{
- json_t *history;
+ const json_t *history;
unsigned int len;
struct TALER_EXCHANGE_ReserveHistory rs = {
.hr.reply = j,
@@ -110,8 +110,8 @@ handle_reserves_history_ok (struct TALER_EXCHANGE_ReservesHistoryHandle *rsh,
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount_any ("balance",
&rs.details.ok.balance),
- GNUNET_JSON_spec_json ("history",
- &history),
+ GNUNET_JSON_spec_array_const ("history",
+ &history),
GNUNET_JSON_spec_end ()
};
@@ -143,7 +143,6 @@ handle_reserves_history_ok (struct TALER_EXCHANGE_ReservesHistoryHandle *rsh,
GNUNET_break_op (0);
TALER_EXCHANGE_free_reserve_history (rhistory,
len);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (NULL != rsh->cb)
@@ -157,7 +156,6 @@ handle_reserves_history_ok (struct TALER_EXCHANGE_ReservesHistoryHandle *rsh,
TALER_EXCHANGE_free_reserve_history (rhistory,
len);
}
- GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}
diff --git a/src/lib/exchange_api_reserves_status.c b/src/lib/exchange_api_reserves_status.c
index 27f63d244..57fb04276 100644
--- a/src/lib/exchange_api_reserves_status.c
+++ b/src/lib/exchange_api_reserves_status.c
@@ -89,7 +89,7 @@ static enum GNUNET_GenericReturnValue
handle_reserves_status_ok (struct TALER_EXCHANGE_ReservesStatusHandle *rsh,
const json_t *j)
{
- json_t *history;
+ const json_t *history;
unsigned int len;
struct TALER_EXCHANGE_ReserveStatus rs = {
.hr.reply = j,
@@ -98,8 +98,8 @@ handle_reserves_status_ok (struct TALER_EXCHANGE_ReservesStatusHandle *rsh,
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount_any ("balance",
&rs.details.ok.balance),
- GNUNET_JSON_spec_json ("history",
- &history),
+ GNUNET_JSON_spec_array_const ("history",
+ &history),
GNUNET_JSON_spec_end ()
};
@@ -145,7 +145,6 @@ handle_reserves_status_ok (struct TALER_EXCHANGE_ReservesStatusHandle *rsh,
TALER_EXCHANGE_free_reserve_history (rhistory,
len);
}
- GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}
diff --git a/src/lib/exchange_api_transfers_get.c b/src/lib/exchange_api_transfers_get.c
index f00e36ce3..3a5a64fd5 100644
--- a/src/lib/exchange_api_transfers_get.c
+++ b/src/lib/exchange_api_transfers_get.c
@@ -84,7 +84,7 @@ check_transfers_get_response_ok (
struct TALER_EXCHANGE_TransfersGetHandle *wdh,
const json_t *json)
{
- json_t *details_j;
+ const json_t *details_j;
struct TALER_Amount total_expected;
struct TALER_MerchantPublicKeyP merchant_pub;
struct TALER_EXCHANGE_TransfersGetResponse tgr = {
@@ -104,8 +104,8 @@ check_transfers_get_response_ok (
&td->h_payto),
GNUNET_JSON_spec_timestamp ("execution_time",
&td->execution_time),
- GNUNET_JSON_spec_json ("deposits",
- &details_j),
+ GNUNET_JSON_spec_array_const ("deposits",
+ &details_j),
GNUNET_JSON_spec_fixed_auto ("exchange_sig",
&td->exchange_sig),
GNUNET_JSON_spec_fixed_auto ("exchange_pub",
@@ -126,7 +126,6 @@ check_transfers_get_response_ok (
&total_expected))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -135,7 +134,6 @@ check_transfers_get_response_ok (
&td->exchange_pub))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
td->details_length = json_array_size (details_j);
@@ -181,7 +179,6 @@ check_transfers_get_response_ok (
{
GNUNET_break_op (0);
GNUNET_CRYPTO_hash_context_abort (hash_context);
- GNUNET_JSON_parse_free (spec);
GNUNET_free (details);
return GNUNET_SYSERR;
}
@@ -211,7 +208,6 @@ check_transfers_get_response_ok (
&td->exchange_sig))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
GNUNET_free (details);
return GNUNET_SYSERR;
}
@@ -223,7 +219,6 @@ check_transfers_get_response_ok (
&td->wire_fee))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
GNUNET_free (details);
return GNUNET_SYSERR;
}
@@ -232,7 +227,6 @@ check_transfers_get_response_ok (
&td->total_amount))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
GNUNET_free (details);
return GNUNET_SYSERR;
}
@@ -240,7 +234,6 @@ check_transfers_get_response_ok (
&tgr);
GNUNET_free (details);
}
- GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}
diff --git a/src/testing/testing_api_cmd_auditor_add.c b/src/testing/testing_api_cmd_auditor_add.c
index 8362b66c9..41182b7c7 100644
--- a/src/testing/testing_api_cmd_auditor_add.c
+++ b/src/testing/testing_api_cmd_auditor_add.c
@@ -62,13 +62,15 @@ struct AuditorAddState
* if the response code is acceptable.
*
* @param cls closure.
- * @param hr HTTP response details
+ * @param aer response details
*/
static void
-auditor_add_cb (void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+auditor_add_cb (
+ void *cls,
+ const struct TALER_EXCHANGE_ManagementAuditorEnableResponse *aer)
{
struct AuditorAddState *ds = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &aer->hr;
ds->dh = NULL;
if (ds->expected_response_code != hr->http_status)
diff --git a/src/testing/testing_api_cmd_auditor_add_denom_sig.c b/src/testing/testing_api_cmd_auditor_add_denom_sig.c
index 3d7ea82f1..55b9f77ae 100644
--- a/src/testing/testing_api_cmd_auditor_add_denom_sig.c
+++ b/src/testing/testing_api_cmd_auditor_add_denom_sig.c
@@ -67,13 +67,15 @@ struct AuditorAddDenomSigState
* if the response code is acceptable.
*
* @param cls closure.
- * @param hr HTTP response details
+ * @param adr response details
*/
static void
-denom_sig_add_cb (void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+denom_sig_add_cb (
+ void *cls,
+ const struct TALER_EXCHANGE_AuditorAddDenominationResponse *adr)
{
struct AuditorAddDenomSigState *ds = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &adr->hr;
ds->dh = NULL;
if (ds->expected_response_code != hr->http_status)
diff --git a/src/testing/testing_api_cmd_auditor_del.c b/src/testing/testing_api_cmd_auditor_del.c
index de03d1632..5bf77bb50 100644
--- a/src/testing/testing_api_cmd_auditor_del.c
+++ b/src/testing/testing_api_cmd_auditor_del.c
@@ -62,13 +62,16 @@ struct AuditorDelState
* if the response code is acceptable.
*
* @param cls closure.
- * @param hr HTTP response details
+ * @param adr response details
*/
static void
-auditor_del_cb (void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+auditor_del_cb (
+ void *cls,
+ const struct TALER_EXCHANGE_ManagementAuditorDisableResponse *adr)
+
{
struct AuditorDelState *ds = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &adr->hr;
ds->dh = NULL;
if (ds->expected_response_code != hr->http_status)
diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
index 973209f28..a7c5dd45c 100644
--- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c
+++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
@@ -194,28 +194,15 @@ do_retry (void *cls)
* acceptable.
*
* @param cls closure with the interpreter state
- * @param http_status HTTP response code, #MHD_HTTP_OK (200) for
- * successful status request; 0 if the exchange's reply is
- * bogus (fails to follow the protocol)
- * @param ec taler-specific error code, #TALER_EC_NONE on success
- * @param serial_id unique ID of the wire transfer
- * @param timestamp time stamp of the transaction made.
- * @param json raw response
+ * @param air response details
*/
static void
confirmation_cb (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
- uint64_t serial_id,
- struct GNUNET_TIME_Timestamp timestamp,
- const json_t *json)
+ const struct TALER_BANK_AdminAddIncomingResponse *air)
{
struct AdminAddIncomingState *fts = cls;
struct TALER_TESTING_Interpreter *is = fts->is;
- (void) json;
- fts->reserve_history.details.in_details.timestamp = timestamp;
- fts->reserve_history.details.in_details.wire_reference = serial_id;
fts->aih = NULL;
/**
* Test case not caring about the HTTP status code.
@@ -237,17 +224,23 @@ confirmation_cb (void *cls,
TALER_TESTING_interpreter_next (is);
return;
}
- if (http_status != fts->expected_http_status)
+ if (air->http_status != fts->expected_http_status)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
- switch (http_status)
+ switch (air->http_status)
{
case MHD_HTTP_OK:
- fts->serial_id = serial_id;
- fts->timestamp = timestamp;
+ fts->reserve_history.details.in_details.timestamp
+ = air->details.ok.timestamp;
+ fts->reserve_history.details.in_details.wire_reference
+ = air->details.ok.serial_id;
+ fts->serial_id
+ = air->details.ok.serial_id;
+ fts->timestamp
+ = air->details.ok.timestamp;
TALER_TESTING_interpreter_next (is);
return;
case MHD_HTTP_UNAUTHORIZED:
@@ -271,17 +264,17 @@ confirmation_cb (void *cls,
if (0 != fts->do_retry)
{
fts->do_retry--;
- if ( (0 == http_status) ||
- (TALER_EC_GENERIC_DB_SOFT_FAILURE == ec) ||
- (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) )
+ if ( (0 == air->http_status) ||
+ (TALER_EC_GENERIC_DB_SOFT_FAILURE == air->ec) ||
+ (MHD_HTTP_INTERNAL_SERVER_ERROR == air->http_status) )
{
GNUNET_log (
GNUNET_ERROR_TYPE_INFO,
"Retrying fakebank transfer failed with %u/%d\n",
- http_status,
- (int) ec);
+ air->http_status,
+ (int) air->ec);
/* on DB conflicts, do not use backoff */
- if (TALER_EC_GENERIC_DB_SOFT_FAILURE == ec)
+ if (TALER_EC_GENERIC_DB_SOFT_FAILURE == air->ec)
fts->backoff = GNUNET_TIME_UNIT_ZERO;
else
fts->backoff = GNUNET_TIME_randomized_backoff (fts->backoff,
@@ -299,8 +292,8 @@ confirmation_cb (void *cls,
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fakebank returned HTTP status %u/%d\n",
- http_status,
- (int) ec);
+ air->http_status,
+ (int) air->ec);
TALER_TESTING_interpreter_fail (is);
}
diff --git a/src/testing/testing_api_cmd_bank_transfer.c b/src/testing/testing_api_cmd_bank_transfer.c
index 8c14aac19..d44776455 100644
--- a/src/testing/testing_api_cmd_bank_transfer.c
+++ b/src/testing/testing_api_cmd_bank_transfer.c
@@ -163,39 +163,31 @@ do_retry (void *cls)
* acceptable.
*
* @param cls closure with the interpreter state
- * @param http_status HTTP response code, #MHD_HTTP_OK (200) for
- * successful status request; 0 if the exchange's reply is
- * bogus (fails to follow the protocol)
- * @param ec taler-specific error code, #TALER_EC_NONE on success
- * @param serial_id unique ID of the wire transfer
- * @param timestamp time stamp of the transaction made.
+ * @param tr response details
*/
static void
confirmation_cb (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
- uint64_t serial_id,
- struct GNUNET_TIME_Timestamp timestamp)
+ const struct TALER_BANK_TransferResponse *tr)
{
struct TransferState *fts = cls;
struct TALER_TESTING_Interpreter *is = fts->is;
fts->weh = NULL;
- if (MHD_HTTP_OK != http_status)
+ if (MHD_HTTP_OK != tr->http_status)
{
if (0 != fts->do_retry)
{
fts->do_retry--;
- if ( (0 == http_status) ||
- (TALER_EC_GENERIC_DB_SOFT_FAILURE == ec) ||
- (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) )
+ if ( (0 == tr->http_status) ||
+ (TALER_EC_GENERIC_DB_SOFT_FAILURE == tr->ec) ||
+ (MHD_HTTP_INTERNAL_SERVER_ERROR == tr->http_status) )
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Retrying transfer failed with %u/%d\n",
- http_status,
- (int) ec);
+ tr->http_status,
+ (int) tr->ec);
/* on DB conflicts, do not use backoff */
- if (TALER_EC_GENERIC_DB_SOFT_FAILURE == ec)
+ if (TALER_EC_GENERIC_DB_SOFT_FAILURE == tr->ec)
fts->backoff = GNUNET_TIME_UNIT_ZERO;
else
fts->backoff = EXCHANGE_LIB_BACKOFF (fts->backoff);
@@ -210,14 +202,14 @@ confirmation_cb (void *cls,
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Bank returned HTTP status %u/%d\n",
- http_status,
- (int) ec);
+ tr->http_status,
+ (int) tr->ec);
TALER_TESTING_interpreter_fail (is);
return;
}
- fts->serial_id = serial_id;
- fts->timestamp = timestamp;
+ fts->serial_id = tr->details.ok.row_id;
+ fts->timestamp = tr->details.ok.timestamp;
TALER_TESTING_interpreter_next (is);
}
diff --git a/src/testing/testing_api_cmd_set_wire_fee.c b/src/testing/testing_api_cmd_set_wire_fee.c
index ed3448ac5..f0f76a874 100644
--- a/src/testing/testing_api_cmd_set_wire_fee.c
+++ b/src/testing/testing_api_cmd_set_wire_fee.c
@@ -77,13 +77,14 @@ struct WireFeeState
* if the response code is acceptable.
*
* @param cls closure.
- * @param hr HTTP response details
+ * @param sfr response details
*/
static void
wire_add_cb (void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+ const struct TALER_EXCHANGE_ManagementSetWireFeeResponse *sfr)
{
struct WireFeeState *ds = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &sfr->hr;
ds->dh = NULL;
if (ds->expected_response_code != hr->http_status)
diff --git a/src/testing/testing_api_cmd_take_aml_decision.c b/src/testing/testing_api_cmd_take_aml_decision.c
index 21ba9af6f..c355c6864 100644
--- a/src/testing/testing_api_cmd_take_aml_decision.c
+++ b/src/testing/testing_api_cmd_take_aml_decision.c
@@ -90,17 +90,19 @@ struct AmlDecisionState
/**
- * Callback to analyze the /management/XXX response, just used to check
+ * Callback to analyze the /aml-decision/$OFFICER_PUB response, just used to check
* if the response code is acceptable.
*
* @param cls closure.
- * @param hr HTTP response details
+ * @param adr response details
*/
static void
-take_aml_decision_cb (void *cls,
- const struct TALER_EXCHANGE_HttpResponse *hr)
+take_aml_decision_cb (
+ void *cls,
+ const struct TALER_EXCHANGE_AddAmlDecisionResponse *adr)
{
struct AmlDecisionState *ds = cls;
+ const struct TALER_EXCHANGE_HttpResponse *hr = &adr->hr;
ds->dh = NULL;
if (ds->expected_response != hr->http_status)
diff --git a/src/util/paths.conf b/src/util/paths.conf
index c1d2194d8..3415b7095 100644
--- a/src/util/paths.conf
+++ b/src/util/paths.conf
@@ -17,13 +17,13 @@ TALER_HOME = ${TALER_TEST_HOME:-${HOME:-${USERPROFILE}}}
# for how these should be used.
# Persistent data storage
-TALER_DATA_HOME = ${XDG_DATA_HOME:-$TALER_HOME/.local/share}/taler/
+TALER_DATA_HOME = ${TALER_TEST_HOME:-${XDG_DATA_HOME:-${TALER_HOME}/.local/share/}/.local/share/}taler/
# Configuration files
-TALER_CONFIG_HOME = ${XDG_CONFIG_HOME:-$TALER_HOME/.config}/taler/
+TALER_CONFIG_HOME = ${TALER_TEST_HOME:-${XDG_CONFIG_HOME:-${TALER_HOME}/.config/}/.config/}taler/
# Cached data, no big deal if lost
-TALER_CACHE_HOME = ${XDG_CACHE_HOME:-$TALER_HOME/.cache}/taler/
+TALER_CACHE_HOME = ${TALER_TEST_HOME:-${XDG_CACHE_HOME:-${TALER_HOME}/.cache/}/.cache/}taler/
# Runtime data (always lost on system boot)
TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/taler-system-runtime/