diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-11-17 15:15:51 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-11-17 15:15:51 +0100 |
commit | 4d058c4eb7283b1a77a877d583daaefa847213ec (patch) | |
tree | cded82c1127f7060e359caca09a702c662d56319 /src/include | |
parent | 17edb09f384689da5923689dfe4b6d071797091c (diff) |
work towards testing auditor deposit-confirmation API
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_auditor_service.h | 2 | ||||
-rw-r--r-- | src/include/taler_exchange_service.h | 4 | ||||
-rw-r--r-- | src/include/taler_testing_auditor_lib.h | 61 | ||||
-rw-r--r-- | src/include/taler_testing_lib.h | 62 |
4 files changed, 125 insertions, 4 deletions
diff --git a/src/include/taler_auditor_service.h b/src/include/taler_auditor_service.h index 6f9fef5af..78f878fed 100644 --- a/src/include/taler_auditor_service.h +++ b/src/include/taler_auditor_service.h @@ -221,7 +221,7 @@ TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_ExchangePublicKeyP *exchange_pub, - const struct TALER_CoinSpendSignatureP *exchange_sig, + const struct TALER_ExchangeSignatureP *exchange_sig, const struct TALER_MasterPublicKeyP *master_pub, struct GNUNET_TIME_Absolute ep_start, struct GNUNET_TIME_Absolute ep_expire, diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index f40387514..9ccbf9ef1 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -628,6 +628,7 @@ struct TALER_EXCHANGE_DepositHandle; * @param cls closure * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit; * 0 if the exchange's reply is bogus (fails to follow the protocol) + * @param exchange_sig signature provided by the exchange * @param sign_key exchange key used to sign @a obj, or NULL * @param obj the received JSON reply, should be kept as proof (and, in case of errors, * be forwarded to the customer) @@ -636,7 +637,8 @@ typedef void (*TALER_EXCHANGE_DepositResultCallback) (void *cls, unsigned int http_status, enum TALER_ErrorCode ec, - const struct TALER_ExchangePublicKeyP *sign_key, + const struct TALER_ExchangeSignatureP *exchange_sig, + const struct TALER_ExchangePublicKeyP *sign_key, const json_t *obj); diff --git a/src/include/taler_testing_auditor_lib.h b/src/include/taler_testing_auditor_lib.h index 554fadf5c..2d7e8e14b 100644 --- a/src/include/taler_testing_auditor_lib.h +++ b/src/include/taler_testing_auditor_lib.h @@ -33,6 +33,67 @@ #include <microhttpd.h> +/* ********************* Commands ********************* */ + +/** + * Make the "exec-auditor" CMD. + * + * @param label command label. + * @param config_filename configuration filename. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_exec_auditor (const char *label, + const char *config_filename); + + +/** + * Make the "exec wire-auditor" CMD. + * + * @param label command label. + * @param config_filename configuration filename. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_exec_wire_auditor (const char *label, + const char *config_filename); + + +/** + * Create a "deposit-confirmation" command. + * + * @param label command label. + * @param auditor auditor connection. + * @param deposit_reference reference to any operation that can + * provide a coin. + * @param coin_index if @a deposit_reference offers an array of + * coins, this parameter selects which one in that array. + * This value is currently ignored, as only one-coin + * deposits are implemented. + * @param expected_response_code expected HTTP response code. + * + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_deposit_confirmation + (const char *label, + struct TALER_AUDITOR_Handle *auditor, + const char *deposit_reference, + unsigned int coin_index, + unsigned int expected_response_code); + + +/** + * Modify a deposit confirmation command to enable retries when we get + * transient errors from the auditor. + * + * @param cmd a deposit confirmation command + * @return the command with retries enabled + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_deposit_confirmation_with_retry (struct TALER_TESTING_Command cmd); + + /* ********************* Helper functions ********************* */ diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 9ea10f7e7..ffb092ad2 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -1539,6 +1539,64 @@ TALER_TESTING_get_trait_reserve_priv /** + * Make a trait for a exchange signature. + * + * @param index index number to associate to the offered exchange pub. + * @param exchange_sig exchange signature to offer with this trait. + * + * @return the trait. + */ +struct TALER_TESTING_Trait +TALER_TESTING_make_trait_exchange_sig + (unsigned int index, + const struct TALER_ExchangeSignatureP *exchange_sig); + + +/** + * Obtain a exchange signature (online sig) from a @a cmd. + * + * @param cmd command to extract trait from + * @param index index number of the exchange to obtain. + * @param exchange_sig[out] set to the offered exchange signature. + * @return #GNUNET_OK on success. + */ +int +TALER_TESTING_get_trait_exchange_sig + (const struct TALER_TESTING_Command *cmd, + unsigned int index, + const struct TALER_ExchangeSignatureP **exchange_sig); + + +/** + * Make a trait for a exchange public key. + * + * @param index index number to associate to the offered exchange pub. + * @param exchange_pub exchange pub to offer with this trait. + * + * @return the trait. + */ +struct TALER_TESTING_Trait +TALER_TESTING_make_trait_exchange_pub + (unsigned int index, + const struct TALER_ExchangePublicKeyP *exchange_pub); + + +/** + * Obtain a exchange public key from a @a cmd. + * + * @param cmd command to extract trait from + * @param index index number of the exchange to obtain. + * @param exchange_pub[out] set to the offered exchange pub. + * @return #GNUNET_OK on success. + */ +int +TALER_TESTING_get_trait_exchange_pub + (const struct TALER_TESTING_Command *cmd, + unsigned int index, + const struct TALER_ExchangePublicKeyP **exchange_pub); + + +/** * Obtain location where a command stores a pointer to a process. * * @param cmd command to extract trait from. @@ -1798,6 +1856,7 @@ TALER_TESTING_get_trait_fresh_coins unsigned int index, struct FreshCoin **fresh_coins); + /** * Obtain contract terms from @a cmd. * @@ -1805,7 +1864,6 @@ TALER_TESTING_get_trait_fresh_coins * @param index contract terms index number. * @param contract_terms[out] where to write the contract * terms. - * * @return #GNUNET_OK on success. */ int @@ -1814,12 +1872,12 @@ TALER_TESTING_get_trait_contract_terms unsigned int index, const char **contract_terms); + /** * Offer contract terms. * * @param index contract terms index number. * @param contract_terms contract terms to offer. - * * @return the trait. */ struct TALER_TESTING_Trait |