From e42f014cffae126a52c92fbf8151e6f5cecc9de0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 17 Nov 2018 17:19:02 +0100 Subject: use more const in taler_testing_lib.h --- .../testing_auditor_api_cmd_deposit_confirmation.c | 25 +++++++++- .../testing_auditor_api_cmd_exec_auditor.c | 3 +- .../testing_auditor_api_cmd_exec_wire_auditor.c | 3 +- src/bank-lib/testing_api_cmd_history.c | 3 +- src/bank-lib/testing_api_cmd_reject.c | 2 +- src/exchange-lib/testing_api_cmd_bank_check.c | 6 +-- src/exchange-lib/testing_api_cmd_batch.c | 3 +- src/exchange-lib/testing_api_cmd_deposit.c | 4 +- src/exchange-lib/testing_api_cmd_exec_aggregator.c | 4 +- .../testing_api_cmd_exec_auditor-sign.c | 2 +- src/exchange-lib/testing_api_cmd_exec_keyup.c | 2 +- src/exchange-lib/testing_api_cmd_exec_wirewatch.c | 4 +- .../testing_api_cmd_fakebank_transfer.c | 5 +- src/exchange-lib/testing_api_cmd_payback.c | 9 ++-- src/exchange-lib/testing_api_cmd_refresh.c | 10 ++-- src/exchange-lib/testing_api_cmd_status.c | 2 +- src/exchange-lib/testing_api_cmd_track.c | 9 ++-- src/exchange-lib/testing_api_cmd_withdraw.c | 6 +-- src/exchange-lib/testing_api_loop.c | 1 + src/exchange-lib/testing_api_trait_amount.c | 2 +- src/exchange-lib/testing_api_trait_blinding_key.c | 4 +- src/exchange-lib/testing_api_trait_cmd.c | 4 +- src/exchange-lib/testing_api_trait_coin_priv.c | 5 +- src/exchange-lib/testing_api_trait_denom_pub.c | 2 +- src/exchange-lib/testing_api_trait_denom_sig.c | 7 +-- src/exchange-lib/testing_api_trait_exchange_pub.c | 2 +- src/exchange-lib/testing_api_trait_exchange_sig.c | 2 +- src/exchange-lib/testing_api_trait_fresh_coin.c | 6 +-- src/exchange-lib/testing_api_trait_json.c | 5 +- src/exchange-lib/testing_api_trait_key_peer.c | 8 ++-- src/exchange-lib/testing_api_trait_number.c | 9 ++-- src/exchange-lib/testing_api_trait_process.c | 2 +- src/exchange-lib/testing_api_trait_reserve_priv.c | 6 +-- src/exchange-lib/testing_api_trait_string.c | 15 +++--- src/exchange-lib/testing_api_trait_wtid.c | 8 ++-- src/exchange-lib/testing_api_traits.c | 5 +- src/include/taler_testing_lib.h | 56 ++++++++++++++-------- 37 files changed, 134 insertions(+), 117 deletions(-) (limited to 'src') diff --git a/src/auditor-lib/testing_auditor_api_cmd_deposit_confirmation.c b/src/auditor-lib/testing_auditor_api_cmd_deposit_confirmation.c index 3ee8b14aa..015914210 100644 --- a/src/auditor-lib/testing_auditor_api_cmd_deposit_confirmation.c +++ b/src/auditor-lib/testing_auditor_api_cmd_deposit_confirmation.c @@ -310,6 +310,28 @@ deposit_confirmation_cleanup (void *cls, } +/** + * Offer internal data to other commands. + * + * @param cls closure. + * @param ret[out] set to the wanted data. + * @param trait name of the trait. + * @param index index number of the traits to be returned. + * + * @return #GNUNET_OK on success + */ +static int +deposit_confirmation_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + /* Must define this function because some callbacks + * look for certain traits on _all_ the commands. */ + return GNUNET_SYSERR; +} + + /** * Create a "deposit-confirmation" command. * @@ -346,7 +368,8 @@ TALER_TESTING_cmd_deposit_confirmation cmd.label = label; cmd.run = &deposit_confirmation_run; cmd.cleanup = &deposit_confirmation_cleanup; - + cmd.traits = &deposit_confirmation_traits; + return cmd; } diff --git a/src/auditor-lib/testing_auditor_api_cmd_exec_auditor.c b/src/auditor-lib/testing_auditor_api_cmd_exec_auditor.c index 273612497..afe9d38fc 100644 --- a/src/auditor-lib/testing_auditor_api_cmd_exec_auditor.c +++ b/src/auditor-lib/testing_auditor_api_cmd_exec_auditor.c @@ -114,12 +114,11 @@ auditor_cleanup (void *cls, * @param ret[out] result * @param trait name of the trait. * @param index index number of the object to offer. - * * @return #GNUNET_OK on success. */ static int auditor_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/auditor-lib/testing_auditor_api_cmd_exec_wire_auditor.c b/src/auditor-lib/testing_auditor_api_cmd_exec_wire_auditor.c index c32130397..8371f9690 100644 --- a/src/auditor-lib/testing_auditor_api_cmd_exec_wire_auditor.c +++ b/src/auditor-lib/testing_auditor_api_cmd_exec_wire_auditor.c @@ -114,12 +114,11 @@ wire_auditor_cleanup (void *cls, * @param ret[out] result * @param trait name of the trait. * @param index index number of the object to offer. - * * @return #GNUNET_OK on success. */ static int wire_auditor_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/bank-lib/testing_api_cmd_history.c b/src/bank-lib/testing_api_cmd_history.c index 9482361ae..b1bed3fc4 100644 --- a/src/bank-lib/testing_api_cmd_history.c +++ b/src/bank-lib/testing_api_cmd_history.c @@ -116,6 +116,7 @@ struct History */ extern struct TALER_BANK_AuthenticationData AUTHS[]; + /** * Offer internal data to other commands. * @@ -128,7 +129,7 @@ extern struct TALER_BANK_AuthenticationData AUTHS[]; */ static int history_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/bank-lib/testing_api_cmd_reject.c b/src/bank-lib/testing_api_cmd_reject.c index d2fffb865..2bec10ad7 100644 --- a/src/bank-lib/testing_api_cmd_reject.c +++ b/src/bank-lib/testing_api_cmd_reject.c @@ -166,7 +166,7 @@ reject_run (void *cls, */ static int reject_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/exchange-lib/testing_api_cmd_bank_check.c b/src/exchange-lib/testing_api_cmd_bank_check.c index 8bfb12b7c..70d836a3b 100644 --- a/src/exchange-lib/testing_api_cmd_bank_check.c +++ b/src/exchange-lib/testing_api_cmd_bank_check.c @@ -196,12 +196,11 @@ check_bank_transfer_cleanup * @param ret[out] result. * @param trait name of the trait. * @param index index number of the object to offer. - * * @return #GNUNET_OK on success. */ static int check_bank_transfer_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { @@ -316,13 +315,14 @@ check_bank_empty_run (void *cls, */ static int check_bank_empty_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { return GNUNET_SYSERR; } + /** * Checks wheter all the wire transfers got "checked" * by the "bank check" CMD. diff --git a/src/exchange-lib/testing_api_cmd_batch.c b/src/exchange-lib/testing_api_cmd_batch.c index e4d11ae50..582bea7c8 100644 --- a/src/exchange-lib/testing_api_cmd_batch.c +++ b/src/exchange-lib/testing_api_cmd_batch.c @@ -107,12 +107,11 @@ batch_cleanup (void *cls, * @param ret[out] result. * @param trait name of the trait. * @param index index number of the object to offer. - * * @return #GNUNET_OK on success. */ static int batch_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/exchange-lib/testing_api_cmd_deposit.c b/src/exchange-lib/testing_api_cmd_deposit.c index 59209fcc5..70e046c98 100644 --- a/src/exchange-lib/testing_api_cmd_deposit.c +++ b/src/exchange-lib/testing_api_cmd_deposit.c @@ -249,7 +249,7 @@ deposit_run (void *cls, const struct TALER_CoinSpendPrivateKeyP *coin_priv; struct TALER_CoinSpendPublicKeyP coin_pub; const struct TALER_EXCHANGE_DenomPublicKey *denom_pub; - struct TALER_DenominationSignature *denom_pub_sig; + const struct TALER_DenominationSignature *denom_pub_sig; struct TALER_CoinSpendSignatureP coin_sig; struct GNUNET_TIME_Absolute refund_deadline; struct GNUNET_TIME_Absolute wire_deadline; @@ -443,7 +443,7 @@ deposit_cleanup (void *cls, */ static int deposit_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/exchange-lib/testing_api_cmd_exec_aggregator.c b/src/exchange-lib/testing_api_cmd_exec_aggregator.c index 0af398710..a93f6deba 100644 --- a/src/exchange-lib/testing_api_cmd_exec_aggregator.c +++ b/src/exchange-lib/testing_api_cmd_exec_aggregator.c @@ -114,12 +114,11 @@ aggregator_cleanup (void *cls, * @param ret[out] result. * @param trait name of the trait. * @param index index number of the object to offer. - * * @return #GNUNET_OK on success */ static int aggregator_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { @@ -142,7 +141,6 @@ aggregator_traits (void *cls, * @param label command label. * @param config_filename configuration file for the * aggregator to use. - * * @return the command. */ struct TALER_TESTING_Command diff --git a/src/exchange-lib/testing_api_cmd_exec_auditor-sign.c b/src/exchange-lib/testing_api_cmd_exec_auditor-sign.c index 48791efb0..79f0a0a13 100644 --- a/src/exchange-lib/testing_api_cmd_exec_auditor-sign.c +++ b/src/exchange-lib/testing_api_cmd_exec_auditor-sign.c @@ -183,7 +183,7 @@ auditor_sign_cleanup (void *cls, */ static int auditor_sign_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/exchange-lib/testing_api_cmd_exec_keyup.c b/src/exchange-lib/testing_api_cmd_exec_keyup.c index eab7604ec..be08bacda 100644 --- a/src/exchange-lib/testing_api_cmd_exec_keyup.c +++ b/src/exchange-lib/testing_api_cmd_exec_keyup.c @@ -121,7 +121,7 @@ keyup_cleanup (void *cls, */ static int keyup_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/exchange-lib/testing_api_cmd_exec_wirewatch.c b/src/exchange-lib/testing_api_cmd_exec_wirewatch.c index 0953f24b7..c94be2d48 100644 --- a/src/exchange-lib/testing_api_cmd_exec_wirewatch.c +++ b/src/exchange-lib/testing_api_cmd_exec_wirewatch.c @@ -115,12 +115,11 @@ wirewatch_cleanup (void *cls, * @param ret[out] result. * @param trait name of the trait. * @param index index number of the object to offer. - * * @return #GNUNET_OK on success. */ static int wirewatch_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { @@ -143,7 +142,6 @@ wirewatch_traits (void *cls, * * @param label command label. * @param config_filename configuration filename. - * * @return the command. */ struct TALER_TESTING_Command diff --git a/src/exchange-lib/testing_api_cmd_fakebank_transfer.c b/src/exchange-lib/testing_api_cmd_fakebank_transfer.c index 1f6015192..6d826def1 100644 --- a/src/exchange-lib/testing_api_cmd_fakebank_transfer.c +++ b/src/exchange-lib/testing_api_cmd_fakebank_transfer.c @@ -259,7 +259,7 @@ fakebank_transfer_run (void *cls, if (NULL != fts->reserve_reference) { const struct TALER_TESTING_Command *ref; - struct TALER_ReservePrivateKeyP *reserve_priv; + const struct TALER_ReservePrivateKeyP *reserve_priv; ref = TALER_TESTING_interpreter_lookup_command (is, fts->reserve_reference); @@ -414,12 +414,11 @@ fakebank_transfer_cleanup (void *cls, * @param ret[out] result * @param trait name of the trait. * @param index index number of the object to offer. - * * @return #GNUNET_OK on success. */ static int fakebank_transfer_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/exchange-lib/testing_api_cmd_payback.c b/src/exchange-lib/testing_api_cmd_payback.c index 43118ef0a..bb7b302e3 100644 --- a/src/exchange-lib/testing_api_cmd_payback.c +++ b/src/exchange-lib/testing_api_cmd_payback.c @@ -134,7 +134,7 @@ payback_cb (void *cls, struct TALER_TESTING_Interpreter *is = ps->is; struct TALER_TESTING_Command *cmd = &is->commands[is->ip]; const struct TALER_TESTING_Command *reserve_cmd; - struct TALER_ReservePrivateKeyP *reserve_priv; + const struct TALER_ReservePrivateKeyP *reserve_priv; struct TALER_ReservePublicKeyP rp; struct TALER_Amount expected_amount; @@ -225,9 +225,9 @@ payback_run (void *cls, struct PaybackState *ps = cls; const struct TALER_TESTING_Command *coin_cmd; const struct TALER_CoinSpendPrivateKeyP *coin_priv; - struct TALER_DenominationBlindingKeyP *blinding_key; + const struct TALER_DenominationBlindingKeyP *blinding_key; const struct TALER_EXCHANGE_DenomPublicKey *denom_pub; - struct TALER_DenominationSignature *coin_sig; + const struct TALER_DenominationSignature *coin_sig; struct TALER_PlanchetSecretsP planchet; ps->is = is; @@ -349,13 +349,12 @@ payback_cleanup (void *cls, */ static int revoke_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { struct RevokeState *rs = cls; - struct TALER_TESTING_Trait traits[] = { /* Needed by the handler which waits the proc' * death and calls the next command */ diff --git a/src/exchange-lib/testing_api_cmd_refresh.c b/src/exchange-lib/testing_api_cmd_refresh.c index 93939bf8c..50ea46785 100644 --- a/src/exchange-lib/testing_api_cmd_refresh.c +++ b/src/exchange-lib/testing_api_cmd_refresh.c @@ -533,7 +533,7 @@ link_cb (void *cls, struct TALER_TESTING_Command *link_cmd = &rls->is->commands[rls->is->ip]; unsigned int found; - unsigned int *num_fresh_coins; + const unsigned int *num_fresh_coins; rls->rlh = NULL; if (rls->expected_response_code != http_status) @@ -613,7 +613,7 @@ link_cb (void *cls, found = 0; /* Will point to the pointer inside the cmd state. */ - struct FreshCoin *fc = NULL; + const struct FreshCoin *fc = NULL; if (GNUNET_OK != TALER_TESTING_get_trait_fresh_coins (reveal_cmd, 0, &fc)) @@ -906,7 +906,7 @@ refresh_melt_run (void *cls, const struct TALER_CoinSpendPrivateKeyP *melt_priv; struct TALER_Amount melt_amount; struct TALER_Amount fresh_amount; - struct TALER_DenominationSignature *melt_sig; + const struct TALER_DenominationSignature *melt_sig; const struct TALER_EXCHANGE_DenomPublicKey *melt_denom_pub; const struct MeltDetails *md = &rms->melted_coin; @@ -1051,7 +1051,7 @@ refresh_melt_cleanup (void *cls, */ static int refresh_melt_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { @@ -1184,7 +1184,7 @@ TALER_TESTING_cmd_refresh_melt_with_retry (struct TALER_TESTING_Command cmd) */ static int refresh_reveal_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/exchange-lib/testing_api_cmd_status.c b/src/exchange-lib/testing_api_cmd_status.c index 41144d3d8..f8186131e 100644 --- a/src/exchange-lib/testing_api_cmd_status.c +++ b/src/exchange-lib/testing_api_cmd_status.c @@ -150,7 +150,7 @@ status_run (void *cls, { struct StatusState *ss = cls; const struct TALER_TESTING_Command *create_reserve; - struct TALER_ReservePrivateKeyP *reserve_priv; + const struct TALER_ReservePrivateKeyP *reserve_priv; struct TALER_ReservePublicKeyP reserve_pub; ss->is = is; diff --git a/src/exchange-lib/testing_api_cmd_track.c b/src/exchange-lib/testing_api_cmd_track.c index 201ac3f98..6c9d9fd55 100644 --- a/src/exchange-lib/testing_api_cmd_track.c +++ b/src/exchange-lib/testing_api_cmd_track.c @@ -219,7 +219,8 @@ deposit_wtid_cb /* expected wire transfer subject line. */ const char *transfer_subject; - if (GNUNET_OK != TALER_TESTING_get_trait_transfer_subject + if (GNUNET_OK != + TALER_TESTING_get_trait_transfer_subject (bank_transfer_cmd, 0, &transfer_subject)) { GNUNET_break (0); @@ -393,12 +394,11 @@ track_transaction_cleanup */ static int track_transaction_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { struct TrackTransactionState *tts = cls; - struct TALER_TESTING_Trait traits[] = { TALER_TESTING_make_trait_wtid (0, &tts->wtid), TALER_TESTING_trait_end () @@ -410,6 +410,7 @@ track_transaction_traits (void *cls, index); } + /** * Create a "track transaction" command. * @@ -698,7 +699,7 @@ track_transfer_run (void *cls, /* looking for a wtid to track .. */ struct TrackTransferState *tts = cls; struct TALER_WireTransferIdentifierRawP wtid; - struct TALER_WireTransferIdentifierRawP *wtid_ptr; + const struct TALER_WireTransferIdentifierRawP *wtid_ptr; /* If no reference is given, we'll use a all-zeros * WTID */ diff --git a/src/exchange-lib/testing_api_cmd_withdraw.c b/src/exchange-lib/testing_api_cmd_withdraw.c index 51dd1d719..344a5c468 100644 --- a/src/exchange-lib/testing_api_cmd_withdraw.c +++ b/src/exchange-lib/testing_api_cmd_withdraw.c @@ -245,7 +245,7 @@ withdraw_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct WithdrawState *ws = cls; - struct TALER_ReservePrivateKeyP *rp; + const struct TALER_ReservePrivateKeyP *rp; const struct TALER_TESTING_Command *create_reserve; (void) cmd; @@ -333,13 +333,13 @@ withdraw_cleanup (void *cls, */ static int withdraw_traits (void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index) { struct WithdrawState *ws = cls; const struct TALER_TESTING_Command *reserve_cmd; - struct TALER_ReservePrivateKeyP *reserve_priv; + const struct TALER_ReservePrivateKeyP *reserve_priv; /* We offer the reserve key where these coins were withdrawn * from. */ diff --git a/src/exchange-lib/testing_api_loop.c b/src/exchange-lib/testing_api_loop.c index 67b9a7a7d..f20d93f89 100644 --- a/src/exchange-lib/testing_api_loop.c +++ b/src/exchange-lib/testing_api_loop.c @@ -368,6 +368,7 @@ maint_child_death (void *cls) if (TALER_TESTING_cmd_is_batch (cmd)) { struct TALER_TESTING_Command *batch_cmd; + GNUNET_assert (GNUNET_OK == TALER_TESTING_get_trait_cmd (cmd, 0, &batch_cmd)); /* bad? */ diff --git a/src/exchange-lib/testing_api_trait_amount.c b/src/exchange-lib/testing_api_trait_amount.c index 35bc86a20..8f2b79d45 100644 --- a/src/exchange-lib/testing_api_trait_amount.c +++ b/src/exchange-lib/testing_api_trait_amount.c @@ -49,7 +49,7 @@ TALER_TESTING_get_trait_amount_obj const struct TALER_Amount **amount) { return cmd->traits (cmd->cls, - (void **) amount, + (const void **) amount, TALER_TESTING_TRAIT_AMOUNT, index); } diff --git a/src/exchange-lib/testing_api_trait_blinding_key.c b/src/exchange-lib/testing_api_trait_blinding_key.c index 12ce12ae1..6e52d1148 100644 --- a/src/exchange-lib/testing_api_trait_blinding_key.c +++ b/src/exchange-lib/testing_api_trait_blinding_key.c @@ -45,10 +45,10 @@ int TALER_TESTING_get_trait_blinding_key (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct TALER_DenominationBlindingKeyP **blinding_key) + const struct TALER_DenominationBlindingKeyP **blinding_key) { return cmd->traits (cmd->cls, - (void **) blinding_key, + (const void **) blinding_key, TALER_TESTING_TRAIT_BLINDING_KEY, index); } diff --git a/src/exchange-lib/testing_api_trait_cmd.c b/src/exchange-lib/testing_api_trait_cmd.c index 8e7962199..61e976568 100644 --- a/src/exchange-lib/testing_api_trait_cmd.c +++ b/src/exchange-lib/testing_api_trait_cmd.c @@ -50,11 +50,12 @@ TALER_TESTING_get_trait_cmd struct TALER_TESTING_Command **_cmd) { return cmd->traits (cmd->cls, - (void **) _cmd, + (const void **) _cmd, TALER_TESTING_TRAIT_CMD, index); } + /** * Offer a command in a trait. * @@ -63,7 +64,6 @@ TALER_TESTING_get_trait_cmd * example, a "meta" CMD returns always the * CMD currently being executed. * @param cmd wire details to offer. - * * @return the trait. */ struct TALER_TESTING_Trait diff --git a/src/exchange-lib/testing_api_trait_coin_priv.c b/src/exchange-lib/testing_api_trait_coin_priv.c index baaa794bd..b06e4a207 100644 --- a/src/exchange-lib/testing_api_trait_coin_priv.c +++ b/src/exchange-lib/testing_api_trait_coin_priv.c @@ -39,7 +39,6 @@ * @param cmd command to extract trait from. * @param index index of the coin priv to obtain. * @param coin_priv[out] set to the private key of the coin. - * * @return #GNUNET_OK on success. */ int @@ -49,19 +48,17 @@ TALER_TESTING_get_trait_coin_priv const struct TALER_CoinSpendPrivateKeyP **coin_priv) { return cmd->traits (cmd->cls, - (void **) coin_priv, + (const void **) coin_priv, TALER_TESTING_TRAIT_COIN_PRIVATE_KEY, index); } - /** * Offer coin private key. * * @param index index number to associate with offered coin priv. * @param coin_priv coin private key to offer. - * * @return the trait. */ struct TALER_TESTING_Trait diff --git a/src/exchange-lib/testing_api_trait_denom_pub.c b/src/exchange-lib/testing_api_trait_denom_pub.c index 8caaf69fb..448a262c8 100644 --- a/src/exchange-lib/testing_api_trait_denom_pub.c +++ b/src/exchange-lib/testing_api_trait_denom_pub.c @@ -48,7 +48,7 @@ TALER_TESTING_get_trait_denom_pub const struct TALER_EXCHANGE_DenomPublicKey **denom_pub) { return cmd->traits (cmd->cls, - (void **) denom_pub, + (const void **) denom_pub, TALER_TESTING_TRAIT_DENOM_PUB, index); } diff --git a/src/exchange-lib/testing_api_trait_denom_sig.c b/src/exchange-lib/testing_api_trait_denom_sig.c index 5d7d708e8..03062c835 100644 --- a/src/exchange-lib/testing_api_trait_denom_sig.c +++ b/src/exchange-lib/testing_api_trait_denom_sig.c @@ -39,30 +39,27 @@ * @param cmd command to extract the denom sig from. * @param index index number associated with the denom sig. * @param denom_sig[out] set to the offered signature. - * * @return #GNUNET_OK on success. */ int TALER_TESTING_get_trait_denom_sig (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct TALER_DenominationSignature **denom_sig) + const struct TALER_DenominationSignature **denom_sig) { return cmd->traits (cmd->cls, - (void **) denom_sig, + (const void **) denom_sig, TALER_TESTING_TRAIT_DENOM_SIG, index); } - /** * Offer denom sig. * * @param index index number to associate to the signature on * offer. * @param denom_sig the denom sig on offer. - * * @return the trait. */ struct TALER_TESTING_Trait diff --git a/src/exchange-lib/testing_api_trait_exchange_pub.c b/src/exchange-lib/testing_api_trait_exchange_pub.c index 4bef98af6..e8cdfbb35 100644 --- a/src/exchange-lib/testing_api_trait_exchange_pub.c +++ b/src/exchange-lib/testing_api_trait_exchange_pub.c @@ -46,7 +46,7 @@ TALER_TESTING_get_trait_exchange_pub const struct TALER_ExchangePublicKeyP **exchange_pub) { return cmd->traits (cmd->cls, - (void **) exchange_pub, + (const void **) exchange_pub, TALER_TESTING_TRAIT_EXCHANGE_PUB, index); } diff --git a/src/exchange-lib/testing_api_trait_exchange_sig.c b/src/exchange-lib/testing_api_trait_exchange_sig.c index 00d4243f1..97ce2d969 100644 --- a/src/exchange-lib/testing_api_trait_exchange_sig.c +++ b/src/exchange-lib/testing_api_trait_exchange_sig.c @@ -46,7 +46,7 @@ TALER_TESTING_get_trait_exchange_sig const struct TALER_ExchangeSignatureP **exchange_sig) { return cmd->traits (cmd->cls, - (void **) exchange_sig, + (const void **) exchange_sig, TALER_TESTING_TRAIT_EXCHANGE_SIG, index); } diff --git a/src/exchange-lib/testing_api_trait_fresh_coin.c b/src/exchange-lib/testing_api_trait_fresh_coin.c index 8779593ab..1f6cdac2c 100644 --- a/src/exchange-lib/testing_api_trait_fresh_coin.c +++ b/src/exchange-lib/testing_api_trait_fresh_coin.c @@ -38,21 +38,21 @@ * @param index which array to pick if @a cmd has multiple * on offer. * @param fresh_coins[out] will point to the offered array. - * * @return #GNUNET_OK on success. */ int TALER_TESTING_get_trait_fresh_coins (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct FreshCoin **fresh_coins) + const struct FreshCoin **fresh_coins) { return cmd->traits (cmd->cls, - (void **) fresh_coins, + (const void **) fresh_coins, TALER_TESTING_TRAIT_FRESH_COINS, index); } + /** * Offer a _array_ of fresh coins. * diff --git a/src/exchange-lib/testing_api_trait_json.c b/src/exchange-lib/testing_api_trait_json.c index 675be6cf5..d27307918 100644 --- a/src/exchange-lib/testing_api_trait_json.c +++ b/src/exchange-lib/testing_api_trait_json.c @@ -39,7 +39,6 @@ * on offer; usually zero, as one command sticks to * one bank account. * @param wire_details[out] where to write the wire details. - * * @return #GNUNET_OK on success. */ int @@ -49,11 +48,12 @@ TALER_TESTING_get_trait_wire_details const json_t **wire_details) { return cmd->traits (cmd->cls, - (void **) wire_details, + (const void **) wire_details, TALER_TESTING_TRAIT_WIRE_DETAILS, index); } + /** * Offer wire details in a trait. * @@ -61,7 +61,6 @@ TALER_TESTING_get_trait_wire_details * on offer; usually zero, as one command sticks to * one bank account. * @param wire_details wire details to offer. - * * @return the trait. */ struct TALER_TESTING_Trait diff --git a/src/exchange-lib/testing_api_trait_key_peer.c b/src/exchange-lib/testing_api_trait_key_peer.c index 102fb1b58..d10623d28 100644 --- a/src/exchange-lib/testing_api_trait_key_peer.c +++ b/src/exchange-lib/testing_api_trait_key_peer.c @@ -40,7 +40,6 @@ * @param index (tipically zero) which key to return if there * are multiple on offer. * @param priv[out] set to the key coming from @a cmd. - * * @return #GNUNET_OK on success. */ int @@ -50,7 +49,7 @@ TALER_TESTING_get_trait_peer_key const struct GNUNET_CRYPTO_EddsaPrivateKey **priv) { return cmd->traits (cmd->cls, - (void **) priv, + (const void **) priv, TALER_TESTING_TRAIT_KEY_PEER, index); } @@ -62,13 +61,12 @@ TALER_TESTING_get_trait_peer_key * @param index (tipically zero) which key to return if there are * multiple on offer. * @param priv which object should be offered. - * * @return the trait. */ struct TALER_TESTING_Trait TALER_TESTING_make_trait_peer_key (unsigned int index, - struct GNUNET_CRYPTO_EddsaPrivateKey *priv) + const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) { struct TALER_TESTING_Trait ret = { .index = index, @@ -97,7 +95,7 @@ TALER_TESTING_get_trait_peer_key_pub const struct GNUNET_CRYPTO_EddsaPublicKey **pub) { return cmd->traits (cmd->cls, - (void **) pub, + (const void **) pub, TALER_TESTING_TRAIT_KEY_PEER_PUB, index); } diff --git a/src/exchange-lib/testing_api_trait_number.c b/src/exchange-lib/testing_api_trait_number.c index 67b01ae8e..ee2e76dbb 100644 --- a/src/exchange-lib/testing_api_trait_number.c +++ b/src/exchange-lib/testing_api_trait_number.c @@ -38,29 +38,26 @@ * @param cmd command to extract the number from. * @param index the number's index number. * @param n[out] set to the number coming from @a cmd. - * * @return #GNUNET_OK on success. */ int TALER_TESTING_get_trait_uint (const struct TALER_TESTING_Command *cmd, unsigned int index, - unsigned int **n) + const unsigned int **n) { return cmd->traits (cmd->cls, - (void **) n, + (const void **) n, TALER_TESTING_TRAIT_UINT, index); } - /** * Offer a number. * * @param index the number's index number. * @param n the number to offer. - * * @return #GNUNET_OK on success. */ struct TALER_TESTING_Trait @@ -92,7 +89,7 @@ TALER_TESTING_get_trait_uint64 const uint64_t **n) { return cmd->traits (cmd->cls, - (void **) n, + (const void **) n, TALER_TESTING_TRAIT_UINT64, index); } diff --git a/src/exchange-lib/testing_api_trait_process.c b/src/exchange-lib/testing_api_trait_process.c index 297b5d39c..449b6536f 100644 --- a/src/exchange-lib/testing_api_trait_process.c +++ b/src/exchange-lib/testing_api_trait_process.c @@ -51,7 +51,7 @@ TALER_TESTING_get_trait_process struct GNUNET_OS_Process ***processp) { return cmd->traits (cmd->cls, - (void **) processp, + (const void **) processp, TALER_TESTING_TRAIT_PROCESS, index); } diff --git a/src/exchange-lib/testing_api_trait_reserve_priv.c b/src/exchange-lib/testing_api_trait_reserve_priv.c index aa1ce3d6d..4a619d07f 100644 --- a/src/exchange-lib/testing_api_trait_reserve_priv.c +++ b/src/exchange-lib/testing_api_trait_reserve_priv.c @@ -38,17 +38,16 @@ * @param cmd command to extract the reserve priv from. * @param index reserve priv's index number. * @param reserve_priv[out] set to the reserve priv. - * * @return #GNUNET_OK on success. */ int TALER_TESTING_get_trait_reserve_priv (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct TALER_ReservePrivateKeyP **reserve_priv) + const struct TALER_ReservePrivateKeyP **reserve_priv) { return cmd->traits (cmd->cls, - (void **) reserve_priv, + (const void **) reserve_priv, TALER_TESTING_TRAIT_RESERVE_PRIVATE_KEY, index); } @@ -59,7 +58,6 @@ TALER_TESTING_get_trait_reserve_priv * * @param index reserve priv's index number. * @param reserve_priv reserve private key to offer. - * * @return the trait. */ struct TALER_TESTING_Trait diff --git a/src/exchange-lib/testing_api_trait_string.c b/src/exchange-lib/testing_api_trait_string.c index e04398e67..d26f2e046 100644 --- a/src/exchange-lib/testing_api_trait_string.c +++ b/src/exchange-lib/testing_api_trait_string.c @@ -43,7 +43,6 @@ * @param index contract terms index number. * @param contract_terms[out] where to write the contract * terms. - * * @return #GNUNET_OK on success. */ int @@ -53,7 +52,7 @@ TALER_TESTING_get_trait_contract_terms const char **contract_terms) { return cmd->traits (cmd->cls, - (void **) contract_terms, + (const void **) contract_terms, TALER_TESTING_TRAIT_CONTRACT_TERMS, index); } @@ -63,7 +62,6 @@ TALER_TESTING_get_trait_contract_terms * * @param index contract terms index number. * @param contract_terms contract terms to offer. - * * @return the trait. */ struct TALER_TESTING_Trait @@ -88,7 +86,6 @@ TALER_TESTING_make_trait_contract_terms * subject to offer. * @param transfer_subject[out] where to write the offered * transfer subject. - * * @return #GNUNET_OK on success. */ int @@ -98,7 +95,7 @@ TALER_TESTING_get_trait_transfer_subject const char **transfer_subject) { return cmd->traits (cmd->cls, - (void **) transfer_subject, + (const void **) transfer_subject, TALER_TESTING_TRAIT_TRANSFER_SUBJECT, index); } @@ -143,7 +140,7 @@ TALER_TESTING_get_trait_amount const char **amount) { return cmd->traits (cmd->cls, - (void **) amount, + (const void **) amount, TALER_TESTING_TRAIT_AMOUNT, index); } @@ -188,7 +185,7 @@ TALER_TESTING_get_trait_url const char **url) { return cmd->traits (cmd->cls, - (void **) url, + (const void **) url, TALER_TESTING_TRAIT_URL, index); } @@ -233,7 +230,7 @@ TALER_TESTING_get_trait_order_id const char **order_id) { return cmd->traits (cmd->cls, - (void **) order_id, + (const void **) order_id, TALER_TESTING_TRAIT_ORDER_ID, index); } @@ -278,7 +275,7 @@ TALER_TESTING_get_trait_rejected const char **rejected_reference) { return cmd->traits (cmd->cls, - (void **) rejected_reference, + (const void **) rejected_reference, TALER_TESTING_TRAIT_REJECTED, index); } diff --git a/src/exchange-lib/testing_api_trait_wtid.c b/src/exchange-lib/testing_api_trait_wtid.c index 8406dbbba..672329713 100644 --- a/src/exchange-lib/testing_api_trait_wtid.c +++ b/src/exchange-lib/testing_api_trait_wtid.c @@ -44,26 +44,26 @@ int TALER_TESTING_get_trait_wtid (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct TALER_WireTransferIdentifierRawP **wtid) + const struct TALER_WireTransferIdentifierRawP **wtid) { return cmd->traits (cmd->cls, - (void **) wtid, + (const void **) wtid, TALER_TESTING_TRAIT_WTID, index); } + /** * Offer a WTID. * * @param index associate the object with this index * @param wtid which object should be returned - * * @return the trait. */ struct TALER_TESTING_Trait TALER_TESTING_make_trait_wtid (unsigned int index, - struct TALER_WireTransferIdentifierRawP *wtid) + const struct TALER_WireTransferIdentifierRawP *wtid) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/exchange-lib/testing_api_traits.c b/src/exchange-lib/testing_api_traits.c index 81f96b8f9..aa6c79c83 100644 --- a/src/exchange-lib/testing_api_traits.c +++ b/src/exchange-lib/testing_api_traits.c @@ -53,12 +53,11 @@ TALER_TESTING_trait_end () * @param ret where to store the result. * @param trait type of the trait to extract. * @param index index number of the object to extract. - * - * @return GNUNET_OK if no error occurred, GNUNET_SYSERR otherwise. + * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. */ int TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, - void **ret, + const void **ret, const char *trait, unsigned int index) { diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 7d4094358..73581e3cd 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -434,7 +434,7 @@ struct TALER_TESTING_Command */ int (*traits)(void *cls, - void **ret, + const void **ret, const char *trait, unsigned int index); @@ -1499,7 +1499,7 @@ TALER_TESTING_trait_end (void); */ int TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, - void **ret, + const void **ret, const char *trait, unsigned int index); @@ -1535,7 +1535,7 @@ int TALER_TESTING_get_trait_reserve_priv (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct TALER_ReservePrivateKeyP **reserve_priv); + const struct TALER_ReservePrivateKeyP **reserve_priv); /** @@ -1602,7 +1602,7 @@ TALER_TESTING_get_trait_exchange_pub * @param cmd command to extract trait from. * @param index which process to pick if @a cmd * has multiple on offer. - * @param coin_priv[out] set to the address of the pointer to the + * @param processp[out] set to the address of the pointer to the * process. * * @return #GNUNET_OK on success. @@ -1611,8 +1611,7 @@ int TALER_TESTING_get_trait_process (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct GNUNET_OS_Process ***processp); - + struct GNUNET_OS_Process ***processp); // FIXME: why is this a ***!? ** should do! /** @@ -1627,7 +1626,7 @@ TALER_TESTING_get_trait_process struct TALER_TESTING_Trait TALER_TESTING_make_trait_process (unsigned int index, - struct GNUNET_OS_Process **processp); + struct GNUNET_OS_Process **processp); // FIXME: why is this a "**"? * should do! /** @@ -1658,6 +1657,7 @@ TALER_TESTING_get_trait_coin_priv unsigned int index, const struct TALER_CoinSpendPrivateKeyP **coin_priv); + /** * Offer blinding key. * @@ -1671,6 +1671,7 @@ TALER_TESTING_make_trait_blinding_key (unsigned int index, const struct TALER_DenominationBlindingKeyP *blinding_key); + /** * Obtain a blinding key from a @a cmd. * @@ -1684,7 +1685,8 @@ int TALER_TESTING_get_trait_blinding_key (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct TALER_DenominationBlindingKeyP **blinding_key); + const struct TALER_DenominationBlindingKeyP **blinding_key); + /** * Make a trait for a denomination public key. @@ -1699,6 +1701,7 @@ TALER_TESTING_make_trait_denom_pub (unsigned int index, const struct TALER_EXCHANGE_DenomPublicKey *dpk); + /** * Obtain a denomination public key from a @a cmd. * @@ -1728,7 +1731,8 @@ int TALER_TESTING_get_trait_denom_sig (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct TALER_DenominationSignature **dpk); + const struct TALER_DenominationSignature **dpk); + /** * Offer denom sig. @@ -1756,6 +1760,7 @@ TALER_TESTING_make_trait_uint64 (unsigned int index, const uint64_t *n); + /** * Obtain a "number" value from @a cmd, 64-bit version. * @@ -1771,6 +1776,7 @@ TALER_TESTING_get_trait_uint64 unsigned int index, const uint64_t **n); + /** * Offer a number. * @@ -1784,6 +1790,7 @@ TALER_TESTING_make_trait_uint (unsigned int index, const unsigned int *i); + /** * Obtain a number from @a cmd. * @@ -1797,7 +1804,8 @@ int TALER_TESTING_get_trait_uint (const struct TALER_TESTING_Command *cmd, unsigned int index, - unsigned int **n); + const unsigned int **n); + /** * Information about a fresh coin generated by the refresh @@ -1825,6 +1833,7 @@ struct FreshCoin struct TALER_CoinSpendPrivateKeyP coin_priv; }; + /** * Offer a _array_ of fresh coins. * @@ -1840,6 +1849,7 @@ TALER_TESTING_make_trait_fresh_coins (unsigned int index, struct FreshCoin *fresh_coins); + /** * Get a array of fresh coins. * @@ -1854,7 +1864,7 @@ int TALER_TESTING_get_trait_fresh_coins (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct FreshCoin **fresh_coins); + const struct FreshCoin **fresh_coins); /** @@ -1936,6 +1946,7 @@ TALER_TESTING_get_trait_peer_key unsigned int index, const struct GNUNET_CRYPTO_EddsaPrivateKey **priv); + /** * Offer private key, typically done when CMD_1 needs it to * sign a request. @@ -1943,13 +1954,12 @@ TALER_TESTING_get_trait_peer_key * @param index (tipically zero) which key to return if there are * multiple on offer. * @param priv which object should be offered. - * * @return the trait. */ struct TALER_TESTING_Trait TALER_TESTING_make_trait_peer_key (unsigned int index, - struct GNUNET_CRYPTO_EddsaPrivateKey *priv); + const struct GNUNET_CRYPTO_EddsaPrivateKey *priv); /** @@ -1969,6 +1979,7 @@ TALER_TESTING_get_trait_peer_key_pub unsigned int index, const struct GNUNET_CRYPTO_EddsaPublicKey **pub); + /** * Offer public key. * @@ -1984,6 +1995,7 @@ TALER_TESTING_make_trait_peer_key_pub (unsigned int index, struct GNUNET_CRYPTO_EddsaPublicKey *pub); + /** * Obtain a transfer subject from @a cmd. * @@ -2008,7 +2020,6 @@ TALER_TESTING_get_trait_transfer_subject * @param index index number associated with the transfer * subject being offered. * @param transfer_subject transfer subject to offer. - * * @return the trait. */ struct TALER_TESTING_Trait @@ -2030,20 +2041,20 @@ int TALER_TESTING_get_trait_wtid (const struct TALER_TESTING_Command *cmd, unsigned int index, - struct TALER_WireTransferIdentifierRawP **wtid); + const struct TALER_WireTransferIdentifierRawP **wtid); + /** * Offer a WTID. * * @param index associate the WTID with this index. * @param wtid pointer to the WTID to offer. - * * @return the trait. */ struct TALER_TESTING_Trait TALER_TESTING_make_trait_wtid (unsigned int index, - struct TALER_WireTransferIdentifierRawP *wtid); + const struct TALER_WireTransferIdentifierRawP *wtid); /** @@ -2052,7 +2063,6 @@ TALER_TESTING_make_trait_wtid * @param index which amount is to be offered, * in case multiple are offered. * @param amount the amount to offer. - * * @return the trait. */ struct TALER_TESTING_Trait @@ -2060,6 +2070,7 @@ TALER_TESTING_make_trait_amount (unsigned int index, const char *amount); + /** * Obtain an amount from @a cmd. * @@ -2091,6 +2102,7 @@ TALER_TESTING_make_trait_url (unsigned int index, const char *url); + /** * Obtain a url from @a cmd. * @@ -2124,6 +2136,7 @@ TALER_TESTING_get_trait_order_id unsigned int index, const char **order_id); + /** * Offer order id in a trait. * @@ -2155,6 +2168,7 @@ TALER_TESTING_get_trait_amount_obj unsigned int index, const struct TALER_Amount **amount); + /** * Offer amount. * @@ -2169,6 +2183,7 @@ TALER_TESTING_make_trait_amount_obj (unsigned int index, const struct TALER_Amount *amount); + /** * Offer a "reject" CMD reference. * @@ -2218,6 +2233,7 @@ TALER_TESTING_make_trait_cmd (unsigned int index, const struct TALER_TESTING_Command *cmd); + /** * Obtain a command from @a cmd. * @@ -2226,7 +2242,7 @@ TALER_TESTING_make_trait_cmd * kind of traits do not need this index. For * example, a "meta" CMD returns always the * CMD currently being executed. - * @param cmd_[out] where to write the wire details. + * @param _cmd[out] where to write the wire details. * * @return #GNUNET_OK on success. */ @@ -2235,4 +2251,6 @@ TALER_TESTING_get_trait_cmd (const struct TALER_TESTING_Command *cmd, unsigned int index, struct TALER_TESTING_Command **_cmd); + + #endif -- cgit v1.2.3