diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/Makefile.am | 4 | ||||
-rw-r--r-- | src/include/backoff.h | 33 | ||||
-rw-r--r-- | src/include/taler_bank_service.h | 1 | ||||
-rw-r--r-- | src/include/taler_testing_bank_lib.h | 120 | ||||
-rw-r--r-- | src/include/taler_testing_lib.h | 112 |
5 files changed, 156 insertions, 114 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 25bc67b25..ed42006f0 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -35,4 +35,6 @@ talerinclude_HEADERS = \ endif -EXTRA_DIST = gauger.h +EXTRA_DIST = \ + backoff.h \ + gauger.h diff --git a/src/include/backoff.h b/src/include/backoff.h new file mode 100644 index 000000000..0fd5683a9 --- /dev/null +++ b/src/include/backoff.h @@ -0,0 +1,33 @@ +/* + This file is part of TALER + Copyright (C) 2014-2018 GNUnet e.V. + + 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/> +*/ + +/** + * @file lib/backoff.h + * @brief backoff computation for the exchange lib + * @author Florian Dold + */ +#ifndef _TALER_BACKOFF_H +#define _TALER_BACKOFF_H + +/** + * Random exponential backoff used in the exchange lib. + */ +#define EXCHANGE_LIB_BACKOFF(r) GNUNET_TIME_randomized_backoff ( \ + (r), \ + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)); + +#endif diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h index a2eec49aa..08b29ed11 100644 --- a/src/include/taler_bank_service.h +++ b/src/include/taler_bank_service.h @@ -204,7 +204,6 @@ typedef void /** - * Execute a wire transfer. * * @param ctx context for HTTP interaction diff --git a/src/include/taler_testing_bank_lib.h b/src/include/taler_testing_bank_lib.h index 43d12d336..79712bac9 100644 --- a/src/include/taler_testing_bank_lib.h +++ b/src/include/taler_testing_bank_lib.h @@ -108,6 +108,7 @@ TALER_TESTING_has_in_name (const char *prog, * @param label command label. * @param account_url base URL of the account offering the "history" * operation. + * @param auth login data to use * @param start_row_reference reference to a command that can * offer a row identifier, to be used as the starting row * to accept in the result. @@ -118,6 +119,8 @@ TALER_TESTING_has_in_name (const char *prog, struct TALER_TESTING_Command TALER_TESTING_cmd_bank_credits (const char *label, const char *account_url, + const struct + TALER_BANK_AuthenticationData *auth, const char *start_row_reference, long long num_results); @@ -128,6 +131,7 @@ TALER_TESTING_cmd_bank_credits (const char *label, * @param label command label. * @param account_url base URL of the account offering the "history" * operation. + * @param auth authentication data * @param start_row_reference reference to a command that can * offer a row identifier, to be used as the starting row * to accept in the result. @@ -137,8 +141,124 @@ TALER_TESTING_cmd_bank_credits (const char *label, struct TALER_TESTING_Command TALER_TESTING_cmd_bank_debits (const char *label, const char *account_url, + const struct TALER_BANK_AuthenticationData *auth, const char *start_row_reference, long long num_results); +/** + * Create transfer command. + * + * @param label command label. + * @param amount amount to transfer. + * @param account_base_url base URL of the account that implements this + * wire transer (which account gives money). + * @param auth authentication data to use + * @param payto_credit_account which account receives money. + * @param wtid wire transfer identifier to use + * @param exchange_base_url exchange URL to use + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_transfer (const char *label, + const char *amount, + const char *account_base_url, + const struct TALER_BANK_AuthenticationData *auth, + const char *payto_credit_account, + const struct TALER_WireTransferIdentifierRawP *wtid, + const char *exchange_base_url); + + +/** + * Create /admin/add-incoming command. + * + * @param label command label. + * @param amount amount to transfer. + * @param account_base_url base URL of the account that implements this + * wire transer (which account gives money). + * @param payto_credit_account which account receives money. + * @param auth authentication data + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_admin_add_incoming (const char *label, + const char *amount, + const char *account_base_url, + const struct + TALER_BANK_AuthenticationData *auth, + const char *payto_credit_account); + + +/** + * Create "fakebank transfer" CMD, letting the caller specify + * a reference to a command that can offer a reserve private key. + * This private key will then be used to construct the subject line + * of the wire transfer. + * + * @param label command label. + * @param amount the amount to transfer. + * @param account_base_url base URL of the account that implements this + * wire transer (which account gives money). + * @param payto_credit_account which account receives money. + * @param auth authentication data + * @param ref reference to a command that can offer a reserve + * private key. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_admin_add_incoming_with_ref (const char *label, + const char *amount, + const char *account_base_url, + const struct + TALER_BANK_AuthenticationData * + auth, + const char *payto_credit_account, + const char *ref); + + +/** + * Create "fakebank transfer" CMD, letting the caller specifying + * the merchant instance. This version is useful when a tip + * reserve should be topped up, in fact the interpreter will need + * the "tipping instance" in order to get the instance public key + * and make a wire transfer subject out of it. + * + * @param label command label. + * @param amount amount to transfer. + * @param account_base_url base URL of the account that implements this + * wire transer (which account gives money). + * @param payto_credit_account which account receives money. + * @param auth authentication data + * @param instance the instance that runs the tipping. Under this + * instance, the configuration file will provide the private + * key of the tipping reserve. This data will then used to + * construct the wire transfer subject line. + * @param config_filename configuration file to use. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_admin_add_incoming_with_instance (const char *label, + const char *amount, + const char *account_base_url, + const struct + TALER_BANK_AuthenticationData + *auth, + const char * + payto_credit_account, + const char *instance, + const char *config_filename); + + +/** + * Modify a fakebank transfer command to enable retries when the + * reserve is not yet full or we get other transient errors from + * the fakebank. + * + * @param cmd a fakebank transfer command + * @return the command with retries enabled + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_admin_add_incoming_retry (struct TALER_TESTING_Command cmd); + + #endif diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 33f070701..af122abde 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -709,118 +709,6 @@ TALER_TESTING_setup_with_auditor_and_exchange (TALER_TESTING_Main main_cb, /* ************** Specific interpreter commands ************ */ -/** - * Create fakebank_transfer command, the subject line will be - * derived from a randomly created reserve priv. Note that that - * reserve priv will then be offered as trait. - * - * @param label command label. - * @param amount amount to transfer. - * @param account_base_url base URL of the account that implements this - * wire transer (which account gives money). - * @param payto_credit_account which account receives money. - * @param auth_username username identifying the @a - * debit_account_no at the bank. - * @param auth_password password for @a auth_username. - * @param exchange_url which exchange is involved in this transfer. - * This data is used for tracking purposes (FIXME: explain - * _how_). - * - * @return the command. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_fakebank_transfer (const char *label, - const char *amount, - const char *account_base_url, - const char *payto_credit_account, - const char *auth_username, - const char *auth_password, - const char *exchange_url); - - -/** - * Create "fakebank transfer" CMD, letting the caller specify - * a reference to a command that can offer a reserve private key. - * This private key will then be used to construct the subject line - * of the wire transfer. - * - * @param label command label. - * @param amount the amount to transfer. - * @param account_base_url base URL of the account that implements this - * wire transer (which account gives money). - * @param payto_credit_account which account receives money. - * @param auth_username username identifying the @a - * debit_account_no at the bank. - * @param auth_password password for @a auth_username. - * @param ref reference to a command that can offer a reserve - * private key. - * @param exchange_url the exchage involved in the transfer, - * tipically receiving the money in order to fuel a reserve. - * - * @return the command. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_fakebank_transfer_with_ref (const char *label, - const char *amount, - const char *account_base_url, - const char *payto_credit_account, - - const char *auth_username, - const char *auth_password, - const char *ref, - const char *exchange_url); - - -/** - * Create "fakebank transfer" CMD, letting the caller specifying - * the merchant instance. This version is useful when a tip - * reserve should be topped up, in fact the interpreter will need - * the "tipping instance" in order to get the instance public key - * and make a wire transfer subject out of it. - * - * @param label command label. - * @param amount amount to transfer. - * @param account_base_url base URL of the account that implements this - * wire transer (which account gives money). - * @param payto_credit_account which account receives money. - * @param auth_username username identifying the @a - * debit_account_no at the bank. - * @param auth_password password for @a auth_username. - * @param instance the instance that runs the tipping. Under this - * instance, the configuration file will provide the private - * key of the tipping reserve. This data will then used to - * construct the wire transfer subject line. - * @param exchange_url which exchange is involved in this transfer. - * This data is used for tracking purposes (FIXME: explain - * _how_). - * @param config_filename configuration file to use. - * - * @return the command. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_fakebank_transfer_with_instance (const char *label, - const char *amount, - const char *account_base_url, - const char * - payto_credit_account, - const char *auth_username, - const char *auth_password, - const char *instance, - const char *exchange_url, - const char *config_filename); - - -/** - * Modify a fakebank transfer command to enable retries when the - * reserve is not yet full or we get other transient errors from - * the fakebank. - * - * @param cmd a fakebank transfer command - * @return the command with retries enabled - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_fakebank_transfer_retry (struct TALER_TESTING_Command cmd); - /** * Make a "wirewatch" CMD. |