From eb559970846f0fa27f1f25c482cd07210a56f4b1 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 25 Aug 2019 16:18:24 +0200 Subject: re-format code --- src/lib/auditor_api_deposit_confirmation.c | 47 ++- src/lib/auditor_api_exchanges.c | 9 +- src/lib/auditor_api_handle.c | 38 +-- src/lib/exchange_api_common.c | 50 +-- src/lib/exchange_api_deposit.c | 53 ++-- src/lib/exchange_api_handle.c | 275 +++++++++-------- src/lib/exchange_api_handle.h | 12 +- src/lib/exchange_api_payback.c | 57 ++-- src/lib/exchange_api_refresh.c | 131 ++++---- src/lib/exchange_api_refresh_link.c | 44 +-- src/lib/exchange_api_refund.c | 99 +++--- src/lib/exchange_api_reserve.c | 160 ++++++---- src/lib/exchange_api_track_transaction.c | 46 +-- src/lib/exchange_api_track_transfer.c | 49 +-- src/lib/exchange_api_wire.c | 12 +- src/lib/teah_common.c | 12 +- src/lib/test_auditor_api.c | 325 ++++++++++---------- src/lib/test_auditor_api_version.c | 28 +- src/lib/test_exchange_api.c | 341 +++++++++++---------- src/lib/test_exchange_api_interpreter_on-off.c | 8 +- src/lib/test_exchange_api_keys_cherry_picking.c | 70 ++--- src/lib/test_exchange_api_overlapping_keys_bug.c | 2 +- src/lib/test_exchange_api_revocation.c | 48 +-- src/lib/test_exchange_api_twisted.c | 176 +++++------ src/lib/testing_api_cmd_bank_check.c | 38 +-- src/lib/testing_api_cmd_batch.c | 4 +- src/lib/testing_api_cmd_check_keys.c | 28 +- src/lib/testing_api_cmd_deposit.c | 118 +++---- src/lib/testing_api_cmd_exec_auditor-sign.c | 32 +- src/lib/testing_api_cmd_exec_keyup.c | 42 +-- src/lib/testing_api_cmd_exec_wirewatch.c | 4 +- src/lib/testing_api_cmd_fakebank_transfer.c | 144 ++++----- src/lib/testing_api_cmd_payback.c | 38 +-- src/lib/testing_api_cmd_refresh.c | 187 +++++------ src/lib/testing_api_cmd_refund.c | 36 +-- src/lib/testing_api_cmd_serialize_keys.c | 32 +- src/lib/testing_api_cmd_signal.c | 2 +- src/lib/testing_api_cmd_sleep.c | 8 +- src/lib/testing_api_cmd_status.c | 28 +- src/lib/testing_api_cmd_track.c | 118 +++---- src/lib/testing_api_cmd_wire.c | 10 +- src/lib/testing_api_cmd_withdraw.c | 52 ++-- src/lib/testing_api_helpers.c | 154 +++++----- src/lib/testing_api_loop.c | 99 +++--- src/lib/testing_api_trait_amount.c | 6 +- src/lib/testing_api_trait_blinding_key.c | 6 +- src/lib/testing_api_trait_cmd.c | 6 +- src/lib/testing_api_trait_coin_priv.c | 6 +- src/lib/testing_api_trait_denom_pub.c | 6 +- src/lib/testing_api_trait_denom_sig.c | 6 +- src/lib/testing_api_trait_exchange_pub.c | 6 +- src/lib/testing_api_trait_exchange_sig.c | 6 +- src/lib/testing_api_trait_fresh_coin.c | 6 +- src/lib/testing_api_trait_json.c | 12 +- src/lib/testing_api_trait_key_peer.c | 12 +- src/lib/testing_api_trait_number.c | 12 +- src/lib/testing_api_trait_process.c | 8 +- src/lib/testing_api_trait_reserve_priv.c | 6 +- src/lib/testing_api_trait_string.c | 36 +-- src/lib/testing_api_trait_time.c | 6 +- src/lib/testing_api_trait_wtid.c | 6 +- src/lib/testing_api_traits.c | 2 +- .../testing_auditor_api_cmd_deposit_confirmation.c | 77 ++--- src/lib/testing_auditor_api_cmd_exchanges.c | 76 ++--- src/lib/testing_auditor_api_helpers.c | 6 +- 65 files changed, 1869 insertions(+), 1710 deletions(-) (limited to 'src/lib') diff --git a/src/lib/auditor_api_deposit_confirmation.c b/src/lib/auditor_api_deposit_confirmation.c index 2001a2c5f..f221b7fd7 100644 --- a/src/lib/auditor_api_deposit_confirmation.c +++ b/src/lib/auditor_api_deposit_confirmation.c @@ -82,8 +82,8 @@ struct TALER_AUDITOR_DepositConfirmationHandle */ static void handle_deposit_confirmation_finished (void *cls, - long response_code, - const void *djson) + long response_code, + const void *djson) { const json_t *json = djson; struct TALER_AUDITOR_DepositConfirmationHandle *dh = cls; @@ -123,7 +123,7 @@ handle_deposit_confirmation_finished (void *cls, } dh->cb (dh->cb_cls, response_code, - TALER_JSON_get_error_code (json), + TALER_JSON_get_error_code (json), json); TALER_AUDITOR_deposit_confirmation_cancel (dh); } @@ -254,20 +254,29 @@ verify_signatures (const struct GNUNET_HashCode *h_wire, struct TALER_AUDITOR_DepositConfirmationHandle * TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor, const struct GNUNET_HashCode *h_wire, - const struct GNUNET_HashCode *h_contract_terms, + const struct + GNUNET_HashCode *h_contract_terms, struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute refund_deadline, - const struct TALER_Amount *amount_without_fee, - const struct TALER_CoinSpendPublicKeyP *coin_pub, - const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct TALER_ExchangePublicKeyP *exchange_pub, - const struct TALER_ExchangeSignatureP *exchange_sig, - const struct TALER_MasterPublicKeyP *master_pub, + const struct + TALER_Amount *amount_without_fee, + const struct + TALER_CoinSpendPublicKeyP *coin_pub, + const struct + TALER_MerchantPublicKeyP *merchant_pub, + const struct + TALER_ExchangePublicKeyP *exchange_pub, + const struct + TALER_ExchangeSignatureP *exchange_sig, + const struct + TALER_MasterPublicKeyP *master_pub, struct GNUNET_TIME_Absolute ep_start, struct GNUNET_TIME_Absolute ep_expire, struct GNUNET_TIME_Absolute ep_end, - const struct TALER_MasterSignatureP *master_sig, - TALER_AUDITOR_DepositConfirmationResultCallback cb, + const struct + TALER_MasterSignatureP *master_sig, + TALER_AUDITOR_DepositConfirmationResultCallback + cb, void *cb_cls) { struct TALER_AUDITOR_DepositConfirmationHandle *dh; @@ -311,10 +320,12 @@ TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor, " s:o, s:o," /* ep_expire, ep_end */ " s:o, s:o}", /* master_sig, exchange_pub */ "h_wire", GNUNET_JSON_from_data_auto (h_wire), - "h_contract_terms", GNUNET_JSON_from_data_auto (h_contract_terms), + "h_contract_terms", GNUNET_JSON_from_data_auto ( + h_contract_terms), "timestamp", GNUNET_JSON_from_time_abs (timestamp), "refund_deadline", GNUNET_JSON_from_time_abs (refund_deadline), - "amount_without_fee", TALER_JSON_from_amount (amount_without_fee), + "amount_without_fee", TALER_JSON_from_amount ( + amount_without_fee), "coin_pub", GNUNET_JSON_from_data_auto (coin_pub), "merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub), "exchange_sig", GNUNET_JSON_from_data_auto (exchange_sig), @@ -344,8 +355,8 @@ TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor, "PUT")); if (GNUNET_OK != TALER_curl_easy_post (&dh->ctx, - eh, - deposit_confirmation_obj)) + eh, + deposit_confirmation_obj)) { GNUNET_break (0); curl_easy_cleanup (eh); @@ -375,7 +386,9 @@ TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor, * @param deposit-confirmation the deposit-confirmation permission request handle */ void -TALER_AUDITOR_deposit_confirmation_cancel (struct TALER_AUDITOR_DepositConfirmationHandle *deposit_confirmation) +TALER_AUDITOR_deposit_confirmation_cancel (struct + TALER_AUDITOR_DepositConfirmationHandle + *deposit_confirmation) { if (NULL != deposit_confirmation->job) { diff --git a/src/lib/auditor_api_exchanges.c b/src/lib/auditor_api_exchanges.c index 770eedda3..9f37f93f7 100644 --- a/src/lib/auditor_api_exchanges.c +++ b/src/lib/auditor_api_exchanges.c @@ -118,12 +118,12 @@ handle_exchanges_finished (void *cls, int ok; ok = GNUNET_YES; - for (unsigned int i=0;iauditor = auditor; @@ -230,7 +230,8 @@ TALER_AUDITOR_list_exchanges (struct TALER_AUDITOR_Handle *auditor, * @param deposit-confirmation the deposit-confirmation permission request handle */ void -TALER_AUDITOR_list_exchanges_cancel (struct TALER_AUDITOR_ListExchangesHandle *leh) +TALER_AUDITOR_list_exchanges_cancel (struct + TALER_AUDITOR_ListExchangesHandle *leh) { if (NULL != leh->job) { diff --git a/src/lib/auditor_api_handle.c b/src/lib/auditor_api_handle.c index bf8c31abb..dfccedaa9 100644 --- a/src/lib/auditor_api_handle.c +++ b/src/lib/auditor_api_handle.c @@ -50,8 +50,8 @@ * @param code what was the curl error code */ #define CURL_STRERROR(type, function, code) \ - GNUNET_log (type, "Curl function `%s' has failed at `%s:%d' with error: %s", \ - function, __FILE__, __LINE__, curl_easy_strerror (code)); + GNUNET_log (type, "Curl function `%s' has failed at `%s:%d' with error: %s", \ + function, __FILE__, __LINE__, curl_easy_strerror (code)); /** * Stages of initialization for the `struct TALER_AUDITOR_Handle` @@ -212,10 +212,10 @@ decode_version_json (const json_t *resp_obj, const char *ver; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("version", - &ver), + &ver), GNUNET_JSON_spec_fixed_auto ("auditor_public_key", - &vi->auditor_pub), - GNUNET_JSON_spec_end() + &vi->auditor_pub), + GNUNET_JSON_spec_end () }; if (JSON_OBJECT != json_typeof (resp_obj)) @@ -226,17 +226,17 @@ decode_version_json (const json_t *resp_obj, /* check the version */ if (GNUNET_OK != GNUNET_JSON_parse (resp_obj, - spec, - NULL, NULL)) + spec, + NULL, NULL)) { GNUNET_break_op (0); return GNUNET_SYSERR; } if (3 != sscanf (ver, - "%u:%u:%u", - ¤t, - &revision, - &age)) + "%u:%u:%u", + ¤t, + &revision, + &age)) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -277,8 +277,8 @@ request_version (void *cls); */ static void version_completed_cb (void *cls, - long response_code, - const void *gresp_obj) + long response_code, + const void *gresp_obj) { const json_t *resp_obj = gresp_obj; struct VersionRequest *vr = cls; @@ -331,17 +331,17 @@ version_completed_cb (void *cls, if (MHD_HTTP_OK != response_code) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "/version failed for auditor %p: %u!\n", - auditor, - (unsigned int) response_code); + "/version failed for auditor %p: %u!\n", + auditor, + (unsigned int) response_code); auditor->vr = NULL; free_version_request (vr); auditor->state = MHS_FAILED; free_version_info (&auditor->vi); /* notify application that we failed */ auditor->version_cb (auditor->version_cb_cls, - NULL, - vc); + NULL, + vc); return; } @@ -496,7 +496,7 @@ request_version (void *cls) vr = GNUNET_new (struct VersionRequest); vr->auditor = auditor; vr->url = MAH_path_to_url (auditor, - "/version"); + "/version"); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Requesting auditor version with URL `%s'.\n", vr->url); diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c index 7c70567df..2e13b678e 100644 --- a/src/lib/exchange_api_common.c +++ b/src/lib/exchange_api_common.c @@ -37,7 +37,8 @@ */ int TALER_EXCHANGE_verify_coin_history (const char *currency, - const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct + TALER_CoinSpendPublicKeyP *coin_pub, json_t *history, struct TALER_Amount *total) { @@ -61,7 +62,7 @@ TALER_EXCHANGE_verify_coin_history (const char *currency, GNUNET_assert (GNUNET_OK == TALER_amount_get_zero (currency, &rtotal)); - for (size_t off=0;offnum_sign_keys;i++) + for (unsigned int i = 0; inum_sign_keys; i++) { const struct TALER_EXCHANGE_SigningPublicKey *spk; diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index 6570a17f3..b9f535c7c 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -141,8 +141,10 @@ auditor_cb (void *cls, aie->dch = TALER_AUDITOR_deposit_confirmation (ah, &dh->depconf.h_wire, &dh->depconf.h_contract_terms, - GNUNET_TIME_absolute_ntoh (dh->depconf.timestamp), - GNUNET_TIME_absolute_ntoh (dh->depconf.refund_deadline), + GNUNET_TIME_absolute_ntoh ( + dh->depconf.timestamp), + GNUNET_TIME_absolute_ntoh ( + dh->depconf.refund_deadline), &amount_without_fee, &dh->depconf.coin_pub, &dh->depconf.merchant, @@ -179,7 +181,7 @@ verify_deposit_signature_ok (struct TALER_EXCHANGE_DepositHandle *dh, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("sig", exchange_sig), GNUNET_JSON_spec_fixed_auto ("pub", exchange_pub), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -225,7 +227,8 @@ verify_deposit_signature_ok (struct TALER_EXCHANGE_DepositHandle *dh, * @return #GNUNET_OK if the signature(s) is valid, #GNUNET_SYSERR if not */ static int -verify_deposit_signature_forbidden (const struct TALER_EXCHANGE_DepositHandle *dh, +verify_deposit_signature_forbidden (const struct + TALER_EXCHANGE_DepositHandle *dh, const json_t *json) { json_t *history; @@ -235,9 +238,9 @@ verify_deposit_signature_forbidden (const struct TALER_EXCHANGE_DepositHandle *d "history"); if (GNUNET_OK != TALER_EXCHANGE_verify_coin_history (dh->coin_value.currency, - &dh->depconf.coin_pub, - history, - &total)) + &dh->depconf.coin_pub, + history, + &total)) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -293,7 +296,7 @@ handle_deposit_finished (void *cls, if (GNUNET_OK != verify_deposit_signature_ok (dh, j, - &exchange_sig, + &exchange_sig, &exchange_pub)) { GNUNET_break_op (0); @@ -343,8 +346,8 @@ handle_deposit_finished (void *cls, } dh->cb (dh->cb_cls, response_code, - TALER_JSON_get_error_code (j), - es, + TALER_JSON_get_error_code (j), + es, ep, j); TALER_EXCHANGE_deposit_cancel (dh); @@ -500,7 +503,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, (void) GNUNET_TIME_round_abs (&refund_deadline); GNUNET_assert (refund_deadline.abs_value_us <= wire_deadline.abs_value_us); GNUNET_assert (GNUNET_YES == - TEAH_handle_is_ready (exchange)); + TEAH_handle_is_ready (exchange)); /* initialize h_wire */ if (GNUNET_OK != TALER_JSON_merchant_wire_signature_hash (wire_details, @@ -547,14 +550,20 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, "contribution", TALER_JSON_from_amount (amount), "wire", wire_details, "H_wire", GNUNET_JSON_from_data_auto (&h_wire), - "h_contract_terms", GNUNET_JSON_from_data_auto (h_contract_terms), + "h_contract_terms", GNUNET_JSON_from_data_auto ( + h_contract_terms), "coin_pub", GNUNET_JSON_from_data_auto (coin_pub), - "denom_pub_hash", GNUNET_JSON_from_data_auto (&denom_pub_hash), - "ub_sig", GNUNET_JSON_from_rsa_signature (denom_sig->rsa_signature), + "denom_pub_hash", GNUNET_JSON_from_data_auto ( + &denom_pub_hash), + "ub_sig", GNUNET_JSON_from_rsa_signature ( + denom_sig->rsa_signature), "timestamp", GNUNET_JSON_from_time_abs (timestamp), - "merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub), - "refund_deadline", GNUNET_JSON_from_time_abs (refund_deadline), - "wire_transfer_deadline", GNUNET_JSON_from_time_abs (wire_deadline), + "merchant_pub", GNUNET_JSON_from_data_auto ( + merchant_pub), + "refund_deadline", GNUNET_JSON_from_time_abs ( + refund_deadline), + "wire_transfer_deadline", GNUNET_JSON_from_time_abs ( + wire_deadline), "coin_sig", GNUNET_JSON_from_data_auto (coin_sig) ); if (NULL == deposit_obj) @@ -568,8 +577,10 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, dh->cb = cb; dh->cb_cls = cb_cls; dh->url = TEAH_path_to_url (exchange, "/deposit"); - dh->depconf.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS)); - dh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT); + dh->depconf.purpose.size = htonl (sizeof (struct + TALER_DepositConfirmationPS)); + dh->depconf.purpose.purpose = htonl ( + TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT); dh->depconf.h_contract_terms = *h_contract_terms; dh->depconf.h_wire = h_wire; dh->depconf.timestamp = GNUNET_TIME_absolute_hton (timestamp); @@ -584,8 +595,8 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, eh = TEL_curl_easy_get (dh->url); if (GNUNET_OK != TALER_curl_easy_post (&dh->ctx, - eh, - deposit_obj)) + eh, + deposit_obj)) { GNUNET_break (0); curl_easy_cleanup (eh); diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index d0c0c0bad..d0777dc01 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -61,8 +61,8 @@ * @param code what was the curl error code */ #define CURL_STRERROR(type, function, code) \ - GNUNET_log (type, "Curl function `%s' has failed at `%s:%d' with error: %s", \ - function, __FILE__, __LINE__, curl_easy_strerror (code)); + GNUNET_log (type, "Curl function `%s' has failed at `%s:%d' with error: %s", \ + function, __FILE__, __LINE__, curl_easy_strerror (code)); /** * Stages of initialization for the `struct TALER_EXCHANGE_Handle` @@ -281,7 +281,8 @@ TEAH_acc_confirmation_cb (void *cls, if (MHD_HTTP_OK != http_status) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _("Failed to submit deposit confirmation to auditor `%s' with HTTP status %d (EC: %d). This is acceptable if it does not happen often.\n"), + _ ( + "Failed to submit deposit confirmation to auditor `%s' with HTTP status %d (EC: %d). This is acceptable if it does not happen often.\n"), ale->auditor_url, http_status, (int) ec); @@ -310,7 +311,8 @@ TEAH_get_auditors_for_dc (struct TALER_EXCHANGE_Handle *h, if (NULL == h->auditors_head) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("No auditor available for exchange `%s'. Not submitting deposit confirmations.\n"), + _ ( + "No auditor available for exchange `%s'. Not submitting deposit confirmations.\n"), h->url); return; } @@ -385,7 +387,7 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key, &sign_key->valid_until), GNUNET_JSON_spec_absolute_time ("stamp_end", &sign_key->valid_legal), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -400,17 +402,19 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key, if (! check_sigs) return GNUNET_OK; sign_key_issue.signkey_pub = sign_key->key; - sign_key_issue.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY); - sign_key_issue.purpose.size = htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS)); + sign_key_issue.purpose.purpose = htonl ( + TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY); + sign_key_issue.purpose.size = htonl (sizeof (struct + TALER_ExchangeSigningKeyValidityPS)); sign_key_issue.master_public_key = *master_key; sign_key_issue.start = GNUNET_TIME_absolute_hton (sign_key->valid_from); sign_key_issue.expire = GNUNET_TIME_absolute_hton (sign_key->valid_until); sign_key_issue.end = GNUNET_TIME_absolute_hton (sign_key->valid_legal); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY, - &sign_key_issue.purpose, - &sign_key_issue_sig.eddsa_signature, - &master_key->eddsa_pub)) + &sign_key_issue.purpose, + &sign_key_issue_sig.eddsa_signature, + &master_key->eddsa_pub)) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -462,7 +466,7 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key, &denom_key->fee_refund), GNUNET_JSON_spec_rsa_public_key ("denom_pub", &denom_key->key.rsa_public_key), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -488,9 +492,12 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key, denom_key_issue.master = *master_key; denom_key_issue.denom_hash = denom_key->h_key; denom_key_issue.start = GNUNET_TIME_absolute_hton (denom_key->valid_from); - denom_key_issue.expire_withdraw = GNUNET_TIME_absolute_hton (denom_key->withdraw_valid_until); - denom_key_issue.expire_deposit = GNUNET_TIME_absolute_hton (denom_key->expire_deposit); - denom_key_issue.expire_legal = GNUNET_TIME_absolute_hton (denom_key->expire_legal); + denom_key_issue.expire_withdraw = GNUNET_TIME_absolute_hton ( + denom_key->withdraw_valid_until); + denom_key_issue.expire_deposit = GNUNET_TIME_absolute_hton ( + denom_key->expire_deposit); + denom_key_issue.expire_legal = GNUNET_TIME_absolute_hton ( + denom_key->expire_legal); TALER_amount_hton (&denom_key_issue.value, &denom_key->value); TALER_amount_hton (&denom_key_issue.fee_withdraw, @@ -502,16 +509,17 @@ parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key, TALER_amount_hton (&denom_key_issue.fee_refund, &denom_key->fee_refund); EXITIF (GNUNET_SYSERR == - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY, - &denom_key_issue.purpose, - &denom_key->master_sig.eddsa_signature, - &master_key->eddsa_pub)); + GNUNET_CRYPTO_eddsa_verify ( + TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY, + &denom_key_issue.purpose, + &denom_key->master_sig.eddsa_signature, + &master_key->eddsa_pub)); GNUNET_CRYPTO_hash_context_read (hash_context, &denom_key_issue.denom_hash, sizeof (struct GNUNET_HashCode)); return GNUNET_OK; - EXITIF_exit: + EXITIF_exit: GNUNET_JSON_parse_free (spec); return GNUNET_SYSERR; } @@ -547,7 +555,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, &auditor_url), GNUNET_JSON_spec_json ("denomination_keys", &keys), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -567,7 +575,8 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, kv.master = key_data->master_pub; len = json_array_size (keys); auditor->denom_keys = GNUNET_new_array (len, - struct TALER_EXCHANGE_AuditorDenominationInfo); + struct + TALER_EXCHANGE_AuditorDenominationInfo); i = 0; off = 0; json_array_foreach (keys, i, key) { @@ -580,7 +589,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, &auditor_sig), GNUNET_JSON_spec_fixed_auto ("denom_pub_h", &denom_h), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -593,7 +602,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, } dk = NULL; dk_off = UINT_MAX; - for (unsigned int j=0;jnum_denom_keys;j++) + for (unsigned int j = 0; jnum_denom_keys; j++) { if (0 == GNUNET_memcmp (&denom_h, &key_data->denom_keys[j].h_key)) @@ -617,20 +626,20 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, TALER_amount_hton (&kv.value, &dk->value); TALER_amount_hton (&kv.fee_withdraw, - &dk->fee_withdraw); + &dk->fee_withdraw); TALER_amount_hton (&kv.fee_deposit, - &dk->fee_deposit); + &dk->fee_deposit); TALER_amount_hton (&kv.fee_refresh, - &dk->fee_refresh); + &dk->fee_refresh); TALER_amount_hton (&kv.fee_refund, - &dk->fee_refund); + &dk->fee_refund); kv.denom_hash = dk->h_key; if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS, - &kv.purpose, - &auditor_sig.eddsa_sig, - &auditor->auditor_pub.eddsa_pub)) + GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS, + &kv.purpose, + &auditor_sig.eddsa_sig, + &auditor->auditor_pub.eddsa_pub)) { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); @@ -658,26 +667,27 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, static void auditor_version_cb (void *cls, - const struct TALER_AUDITOR_VersionInformation *vi, - enum TALER_AUDITOR_VersionCompatibility compat) + const struct TALER_AUDITOR_VersionInformation *vi, + enum TALER_AUDITOR_VersionCompatibility compat) { struct TEAH_AuditorListEntry *ale = cls; if (0 != (TALER_AUDITOR_VC_INCOMPATIBLE & compat)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _("Auditor `%s' runs incompatible protocol version!\n"), + _ ("Auditor `%s' runs incompatible protocol version!\n"), ale->auditor_url); if (0 != (TALER_AUDITOR_VC_OLDER & compat)) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Auditor `%s' runs outdated protocol version!\n"), + _ ("Auditor `%s' runs outdated protocol version!\n"), ale->auditor_url); } if (0 != (TALER_AUDITOR_VC_NEWER & compat)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _("Auditor `%s' runs more recent incompatible version. We should upgrade!\n"), + _ ( + "Auditor `%s' runs more recent incompatible version. We should upgrade!\n"), ale->auditor_url); } return; @@ -698,7 +708,7 @@ update_auditors (struct TALER_EXCHANGE_Handle *exchange) struct TALER_EXCHANGE_Keys *kd = &exchange->key_data; TALER_LOG_DEBUG ("Updating auditors\n"); - for (unsigned int i=0;inum_auditors;i++) + for (unsigned int i = 0; inum_auditors; i++) { /* Compare auditor data from /keys with auditor data * from owned exchange structures. */ @@ -752,8 +762,8 @@ TALER_denoms_cmp (struct TALER_EXCHANGE_DenomPublicKey *denom1, /* First check if pub is the same. */ if (0 != GNUNET_CRYPTO_rsa_public_key_cmp - (denom1->key.rsa_public_key, - denom2->key.rsa_public_key)) + (denom1->key.rsa_public_key, + denom2->key.rsa_public_key)) return 1; tmp1 = denom1->key.rsa_public_key; @@ -815,7 +825,7 @@ decode_keys_json (const json_t *resp_obj, &key_data->list_issue_date), GNUNET_JSON_spec_relative_time ("reserve_closing_delay", &key_data->reserve_closing_delay), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (JSON_OBJECT != json_typeof (resp_obj)) @@ -829,7 +839,7 @@ decode_keys_json (const json_t *resp_obj, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("version", &ver), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -882,11 +892,11 @@ decode_keys_json (const json_t *resp_obj, unsigned int index; EXITIF (NULL == (sign_keys_array = - json_object_get (resp_obj, - "signkeys"))); + json_object_get (resp_obj, + "signkeys"))); EXITIF (JSON_ARRAY != json_typeof (sign_keys_array)); EXITIF (0 == (key_data->num_sign_keys = - json_array_size (sign_keys_array))); + json_array_size (sign_keys_array))); key_data->sign_keys = GNUNET_new_array (key_data->num_sign_keys, struct TALER_EXCHANGE_SigningPublicKey); @@ -908,8 +918,8 @@ decode_keys_json (const json_t *resp_obj, unsigned int index; EXITIF (NULL == (denom_keys_array = - json_object_get (resp_obj, - "denoms"))); + json_object_get (resp_obj, + "denoms"))); EXITIF (JSON_ARRAY != json_typeof (denom_keys_array)); index = 0; @@ -924,7 +934,7 @@ decode_keys_json (const json_t *resp_obj, &key_data->master_pub, hash_context)); - for (unsigned int j=0; + for (unsigned int j = 0; jnum_denom_keys; j++) { @@ -965,8 +975,8 @@ decode_keys_json (const json_t *resp_obj, unsigned int index; EXITIF (NULL == (auditors_array = - json_object_get (resp_obj, - "auditors"))); + json_object_get (resp_obj, + "auditors"))); EXITIF (JSON_ARRAY != json_typeof (auditors_array)); /* Merge with the existing auditor information we have (/keys cherry picking) */ @@ -983,7 +993,7 @@ decode_keys_json (const json_t *resp_obj, check_sig, auditor_info, key_data)); - for (unsigned int j=0;jnum_auditors;j++) + for (unsigned int j = 0; jnum_auditors; j++) { struct TALER_EXCHANGE_AuditorInformation *aix = &key_data->auditors[j]; @@ -998,9 +1008,10 @@ decode_keys_json (const json_t *resp_obj, aix->num_denom_keys + ai.num_denom_keys); memcpy (&aix->denom_keys[aix->num_denom_keys - ai.num_denom_keys], ai.denom_keys, - ai.num_denom_keys * sizeof (struct TALER_EXCHANGE_AuditorDenominationInfo)); - break; - } + ai.num_denom_keys * sizeof (struct + TALER_EXCHANGE_AuditorDenominationInfo)); + break; + } } if (GNUNET_YES == found) continue; /* we are done */ @@ -1025,8 +1036,8 @@ decode_keys_json (const json_t *resp_obj, &ks.hc); hash_context = NULL; EXITIF (GNUNET_OK != - TALER_EXCHANGE_test_signing_key (key_data, - &pub)); + TALER_EXCHANGE_test_signing_key (key_data, + &pub)); EXITIF (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_KEY_SET, &ks.purpose, @@ -1034,7 +1045,7 @@ decode_keys_json (const json_t *resp_obj, &pub.eddsa_pub)); } return GNUNET_OK; - EXITIF_exit: + EXITIF_exit: *vc = TALER_EXCHANGE_VC_PROTOCOL_ERROR; if (NULL != hash_context) @@ -1054,13 +1065,14 @@ free_key_data (struct TALER_EXCHANGE_Keys *key_data) GNUNET_array_grow (key_data->sign_keys, key_data->num_sign_keys, 0); - for (unsigned int i=0;inum_denom_keys;i++) - GNUNET_CRYPTO_rsa_public_key_free (key_data->denom_keys[i].key.rsa_public_key); + for (unsigned int i = 0; inum_denom_keys; i++) + GNUNET_CRYPTO_rsa_public_key_free ( + key_data->denom_keys[i].key.rsa_public_key); GNUNET_array_grow (key_data->denom_keys, key_data->denom_keys_size, 0); - for (unsigned int i=0;inum_auditors;i++) + for (unsigned int i = 0; inum_auditors; i++) { GNUNET_array_grow (key_data->auditors[i].denom_keys, key_data->auditors[i].num_denom_keys, @@ -1157,7 +1169,8 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange, TEAH_handle_reset (exchange); } if ( (GNUNET_NO == force_download) && - (0 < GNUNET_TIME_absolute_get_remaining (exchange->key_data_expiration).rel_value_us) ) + (0 < GNUNET_TIME_absolute_get_remaining ( + exchange->key_data_expiration).rel_value_us) ) return exchange->key_data_expiration; if (NULL == exchange->retry_task) exchange->retry_task = GNUNET_SCHEDULER_add_now (&request_keys, @@ -1223,19 +1236,22 @@ keys_completed_cb (void *cls, /* First make a shallow copy, we then need another pass for the RSA key... */ memcpy (kd.denom_keys, kd_old.denom_keys, - kd_old.num_denom_keys * sizeof (struct TALER_EXCHANGE_DenomPublicKey)); + kd_old.num_denom_keys * sizeof (struct + TALER_EXCHANGE_DenomPublicKey)); - for (unsigned int i=0;iauditor_pub = aold->auditor_pub; @@ -1246,7 +1262,8 @@ keys_completed_cb (void *cls, aold->num_denom_keys); memcpy (anew->denom_keys, aold->denom_keys, - aold->num_denom_keys * sizeof (struct TALER_EXCHANGE_AuditorDenominationInfo)); + aold->num_denom_keys * sizeof (struct + TALER_EXCHANGE_AuditorDenominationInfo)); } /* Old auditors got just copied into new ones. */ @@ -1258,7 +1275,7 @@ keys_completed_cb (void *cls, { TALER_LOG_ERROR ("Could not decode /keys response\n"); response_code = 0; - for (unsigned int i=0;iurl, - path); + path); } @@ -1391,7 +1408,7 @@ TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h, */ char * TEAH_path_to_url2 (const char *base_url, - const char *path) + const char *path) { char *url; @@ -1515,14 +1532,14 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange, struct GNUNET_TIME_Absolute expire; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_uint32 ("version", - &version), + &version), GNUNET_JSON_spec_json ("keys", - &keys), + &keys), GNUNET_JSON_spec_string ("url", - &url), + &url), GNUNET_JSON_spec_absolute_time ("expire", &expire), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; struct TALER_EXCHANGE_Keys key_data; @@ -1539,23 +1556,23 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange, if (0 != version) return; /* unsupported version */ if (0 != strcmp (url, - exchange->url)) + exchange->url)) { GNUNET_break (0); return; } memset (&key_data, - 0, + 0, sizeof (struct TALER_EXCHANGE_Keys)); if (GNUNET_OK != decode_keys_json (keys, GNUNET_NO, &key_data, &vc)) - { - GNUNET_break (0); - return; - } + { + GNUNET_break (0); + return; + } /* decode successful, initialize with the result */ GNUNET_assert (NULL == exchange->key_data_raw); exchange->key_data_raw = json_deep_copy (keys); @@ -1566,7 +1583,7 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange, /* notify application about the key information */ exchange->cert_cb (exchange->cert_cb_cls, &exchange->key_data, - vc); + vc); } @@ -1599,7 +1616,7 @@ TALER_EXCHANGE_serialize_data GNUNET_break (0); return NULL; } - for (unsigned int i=0;inum_sign_keys;i++) + for (unsigned int i = 0; inum_sign_keys; i++) { const struct TALER_EXCHANGE_SigningPublicKey *sk = &kd->sign_keys[i]; json_t *signkey; @@ -1609,19 +1626,19 @@ TALER_EXCHANGE_serialize_data signkey = json_pack ("{s:o, s:o, s:o, s:o, s:o}", "key", GNUNET_JSON_from_data_auto - (&sk->key), + (&sk->key), "master_sig", GNUNET_JSON_from_data_auto - (&sk->master_sig), + (&sk->master_sig), "stamp_start", GNUNET_JSON_from_time_abs - (sk->valid_from), + (sk->valid_from), "stamp_expire", GNUNET_JSON_from_time_abs - (sk->valid_until), + (sk->valid_until), "stamp_end", GNUNET_JSON_from_time_abs - (sk->valid_legal)); + (sk->valid_legal)); if (NULL == signkey) { GNUNET_break (0); @@ -1643,7 +1660,7 @@ TALER_EXCHANGE_serialize_data json_decref (signkeys); return NULL; } - for (unsigned int i=0;inum_denom_keys;i++) + for (unsigned int i = 0; inum_denom_keys; i++) { const struct TALER_EXCHANGE_DenomPublicKey *dk = &kd->denom_keys[i]; json_t *denom; @@ -1676,14 +1693,15 @@ TALER_EXCHANGE_serialize_data GNUNET_JSON_from_data_auto (&dk->master_sig), /* #10 */ "denom_pub", - GNUNET_JSON_from_rsa_public_key (dk->key.rsa_public_key)); + GNUNET_JSON_from_rsa_public_key ( + dk->key.rsa_public_key)); if (NULL == denom) { GNUNET_break (0); continue; } if (0 != json_array_append_new (denoms, - denom)) + denom)) { GNUNET_break (0); json_decref (denom); @@ -1700,7 +1718,7 @@ TALER_EXCHANGE_serialize_data json_decref (signkeys); return NULL; } - for (unsigned int i=0;inum_auditors;i++) + for (unsigned int i = 0; inum_auditors; i++) { const struct TALER_EXCHANGE_AuditorInformation *ai = &kd->auditors[i]; json_t *a; @@ -1715,10 +1733,12 @@ TALER_EXCHANGE_serialize_data json_decref (auditors); return NULL; } - for (unsigned int j=0;jnum_denom_keys;j++) + for (unsigned int j = 0; jnum_denom_keys; j++) { - const struct TALER_EXCHANGE_AuditorDenominationInfo *adi = &ai->denom_keys[j]; - const struct TALER_EXCHANGE_DenomPublicKey *dk = &kd->denom_keys[adi->denom_key_offset]; + const struct TALER_EXCHANGE_AuditorDenominationInfo *adi = + &ai->denom_keys[j]; + const struct TALER_EXCHANGE_DenomPublicKey *dk = + &kd->denom_keys[adi->denom_key_offset]; json_t *k; if (now.abs_value_us > dk->expire_deposit.abs_value_us) @@ -1832,10 +1852,10 @@ TALER_EXCHANGE_serialize_data struct TALER_EXCHANGE_Handle * TALER_EXCHANGE_connect (struct GNUNET_CURL_Context *ctx, - const char *url, - TALER_EXCHANGE_CertificationCallback cert_cb, - void *cert_cb_cls, - ...) + const char *url, + TALER_EXCHANGE_CertificationCallback cert_cb, + void *cert_cb_cls, + ...) { struct TALER_EXCHANGE_Handle *exchange; va_list ap; @@ -1845,8 +1865,8 @@ TALER_EXCHANGE_connect url); /* Disable 100 continue processing */ GNUNET_break (GNUNET_OK == - GNUNET_CURL_append_header (ctx, - "Expect:")); + GNUNET_CURL_append_header (ctx, + "Expect:")); exchange = GNUNET_new (struct TALER_EXCHANGE_Handle); exchange->ctx = ctx; exchange->url = GNUNET_strdup (url); @@ -1856,20 +1876,21 @@ TALER_EXCHANGE_connect exchange); va_start (ap, cert_cb_cls); while (TALER_EXCHANGE_OPTION_END != - (opt = va_arg (ap, int))) + (opt = va_arg (ap, int))) { - switch (opt) { + switch (opt) + { case TALER_EXCHANGE_OPTION_END: GNUNET_assert (0); break; case TALER_EXCHANGE_OPTION_DATA: - { - const json_t *data = va_arg (ap, const json_t *); + { + const json_t *data = va_arg (ap, const json_t *); - deserialize_data (exchange, - data); - break; - } + deserialize_data (exchange, + data); + break; + } default: GNUNET_assert (0); break; @@ -1902,10 +1923,13 @@ request_keys (void *cls) if (GNUNET_YES == TEAH_handle_is_ready (exchange)) { TALER_LOG_DEBUG ("Last DK issue date (before GETting /keys): %s\n", - GNUNET_STRINGS_absolute_time_to_string (exchange->key_data.last_denom_issue_date)); + GNUNET_STRINGS_absolute_time_to_string ( + exchange->key_data.last_denom_issue_date)); sprintf (&url[strlen (url)], "last_issue_date=%llu&", - (unsigned long long) exchange->key_data.last_denom_issue_date.abs_value_us / 1000000LLU); + (unsigned long + long) exchange->key_data.last_denom_issue_date.abs_value_us + / 1000000LLU); } if (GNUNET_YES == exchange->with_now) @@ -1969,7 +1993,8 @@ TALER_EXCHANGE_disconnect (struct TALER_EXCHANGE_Handle *exchange) { GNUNET_assert (aie->ale == ale); GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Not sending deposit confirmation to auditor `%s' due to exchange disconnect\n"), + _ ( + "Not sending deposit confirmation to auditor `%s' due to exchange disconnect\n"), ale->auditor_url); TALER_AUDITOR_deposit_confirmation_cancel (aie->dch); GNUNET_CONTAINER_DLL_remove (ale->ai_head, @@ -2017,9 +2042,10 @@ TALER_EXCHANGE_disconnect (struct TALER_EXCHANGE_Handle *exchange) */ const struct TALER_EXCHANGE_SigningPublicKey * TALER_EXCHANGE_get_signing_key_details (const struct TALER_EXCHANGE_Keys *keys, - const struct TALER_ExchangePublicKeyP *pub) + const struct + TALER_ExchangePublicKeyP *pub) { - for (unsigned int i=0;inum_sign_keys;i++) + for (unsigned int i = 0; inum_sign_keys; i++) { struct TALER_EXCHANGE_SigningPublicKey *spk = &keys->sign_keys[i]; @@ -2047,9 +2073,11 @@ TALER_EXCHANGE_test_signing_key (const struct TALER_EXCHANGE_Keys *keys, /* we will check using a tolerance of 1h for the time */ now = GNUNET_TIME_absolute_get (); - for (unsigned int i=0;inum_sign_keys;i++) - if ( (keys->sign_keys[i].valid_from.abs_value_us <= now.abs_value_us + 60 * 60 * 1000LL * 1000LL) && - (keys->sign_keys[i].valid_until.abs_value_us > now.abs_value_us - 60 * 60 * 1000LL * 1000LL) && + for (unsigned int i = 0; inum_sign_keys; i++) + if ( (keys->sign_keys[i].valid_from.abs_value_us <= now.abs_value_us + 60 + * 60 * 1000LL * 1000LL) && + (keys->sign_keys[i].valid_until.abs_value_us > now.abs_value_us - 60 + * 60 * 1000LL * 1000LL) && (0 == GNUNET_memcmp (pub, &keys->sign_keys[i].key)) ) return GNUNET_OK; @@ -2080,11 +2108,13 @@ TALER_EXCHANGE_get_base_url (const struct TALER_EXCHANGE_Handle *exchange) */ const struct TALER_EXCHANGE_DenomPublicKey * TALER_EXCHANGE_get_denomination_key (const struct TALER_EXCHANGE_Keys *keys, - const struct TALER_DenominationPublicKey *pk) + const struct + TALER_DenominationPublicKey *pk) { - for (unsigned int i=0;inum_denom_keys;i++) + for (unsigned int i = 0; inum_denom_keys; i++) if (0 == GNUNET_CRYPTO_rsa_public_key_cmp (pk->rsa_public_key, - keys->denom_keys[i].key.rsa_public_key)) + keys->denom_keys[i].key. + rsa_public_key)) return &keys->denom_keys[i]; return NULL; } @@ -2098,10 +2128,11 @@ TALER_EXCHANGE_get_denomination_key (const struct TALER_EXCHANGE_Keys *keys, * @return details about the given denomination key */ const struct TALER_EXCHANGE_DenomPublicKey * -TALER_EXCHANGE_get_denomination_key_by_hash (const struct TALER_EXCHANGE_Keys *keys, +TALER_EXCHANGE_get_denomination_key_by_hash (const struct + TALER_EXCHANGE_Keys *keys, const struct GNUNET_HashCode *hc) { - for (unsigned int i=0;inum_denom_keys;i++) + for (unsigned int i = 0; inum_denom_keys; i++) if (0 == GNUNET_memcmp (hc, &keys->denom_keys[i].h_key)) return &keys->denom_keys[i]; diff --git a/src/lib/exchange_api_handle.h b/src/lib/exchange_api_handle.h index 81e6d7c5e..a88cb70de 100644 --- a/src/lib/exchange_api_handle.h +++ b/src/lib/exchange_api_handle.h @@ -70,8 +70,8 @@ struct TEAH_AuditorInteractionEntry */ typedef struct TEAH_AuditorInteractionEntry * (*TEAH_AuditorCallback)(void *cls, - struct TALER_AUDITOR_Handle *ah, - const struct TALER_AuditorPublicKeyP *auditor_pub); + struct TALER_AUDITOR_Handle *ah, + const struct TALER_AuditorPublicKeyP *auditor_pub); /** @@ -101,8 +101,8 @@ TEAH_acc_confirmation_cb (void *cls, */ void TEAH_get_auditors_for_dc (struct TALER_EXCHANGE_Handle *h, - TEAH_AuditorCallback ac, - void *ac_cls); + TEAH_AuditorCallback ac, + void *ac_cls); /** @@ -134,7 +134,7 @@ TEAH_handle_is_ready (struct TALER_EXCHANGE_Handle *h); */ char * TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h, - const char *path); + const char *path); /** @@ -146,7 +146,7 @@ TEAH_path_to_url (struct TALER_EXCHANGE_Handle *h, */ char * TEAH_path_to_url2 (const char *base_url, - const char *path); + const char *path); /* end of exchange_api_handle.h */ diff --git a/src/lib/exchange_api_payback.c b/src/lib/exchange_api_payback.c index 64dfa3796..912548cfe 100644 --- a/src/lib/exchange_api_payback.c +++ b/src/lib/exchange_api_payback.c @@ -114,7 +114,7 @@ verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph, TALER_JSON_spec_amount ("amount", &amount), GNUNET_JSON_spec_absolute_time ("timestamp", ×tamp), GNUNET_JSON_spec_fixed_auto ("reserve_pub", &pc.reserve_pub), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; struct GNUNET_JSON_Specification spec_refresh[] = { GNUNET_JSON_spec_fixed_auto ("exchange_sig", &exchange_sig), @@ -122,7 +122,7 @@ verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph, TALER_JSON_spec_amount ("amount", &amount), GNUNET_JSON_spec_absolute_time ("timestamp", ×tamp), GNUNET_JSON_spec_fixed_auto ("old_coin_pub", &pr.old_coin_pub), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -143,17 +143,19 @@ verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph, } if (ph->was_refreshed) { - pr.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH); + pr.purpose.purpose = htonl ( + TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH); pr.purpose.size = htonl (sizeof (pr)); pr.timestamp = GNUNET_TIME_absolute_hton (timestamp); TALER_amount_hton (&pr.payback_amount, &amount); pr.coin_pub = ph->coin_pub; if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH, - &pr.purpose, - &exchange_sig.eddsa_signature, - &exchange_pub.eddsa_pub)) + GNUNET_CRYPTO_eddsa_verify ( + TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH, + &pr.purpose, + &exchange_sig.eddsa_signature, + &exchange_pub.eddsa_pub)) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -233,12 +235,12 @@ handle_payback_finished (void *cls, dki = &ph->pk; history = json_object_get (j, - "history"); + "history"); if (GNUNET_OK != - TALER_EXCHANGE_verify_coin_history (dki->fee_deposit.currency, - &ph->coin_pub, - history, - &total)) + TALER_EXCHANGE_verify_coin_history (dki->fee_deposit.currency, + &ph->coin_pub, + history, + &total)) { GNUNET_break_op (0); response_code = 0; @@ -326,7 +328,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, CURL *eh; GNUNET_assert (GNUNET_YES == - TEAH_handle_is_ready (exchange)); + TEAH_handle_is_ready (exchange)); pr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_PAYBACK); pr.purpose.size = htonl (sizeof (struct TALER_PaybackRequestPS)); GNUNET_CRYPTO_eddsa_key_get_public (&ps->coin_priv.eddsa_priv, @@ -343,13 +345,17 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, payback_obj = json_pack ("{s:o, s:o," /* denom pub/sig */ " s:o, s:o," /* coin pub/sig */ " s:o, s:o}", /* coin_bks */ - "denom_pub_hash", GNUNET_JSON_from_data_auto (&h_denom_pub), - "denom_sig", GNUNET_JSON_from_rsa_signature (denom_sig->rsa_signature), - "coin_pub", GNUNET_JSON_from_data_auto (&pr.coin_pub), + "denom_pub_hash", GNUNET_JSON_from_data_auto ( + &h_denom_pub), + "denom_sig", GNUNET_JSON_from_rsa_signature ( + denom_sig->rsa_signature), + "coin_pub", GNUNET_JSON_from_data_auto ( + &pr.coin_pub), "coin_sig", GNUNET_JSON_from_data_auto (&coin_sig), - "coin_blind_key_secret", GNUNET_JSON_from_data_auto (&ps->blinding_key), + "coin_blind_key_secret", GNUNET_JSON_from_data_auto ( + &ps->blinding_key), "refreshed", json_boolean (was_refreshed) - ); + ); if (NULL == payback_obj) { GNUNET_break (0); @@ -360,7 +366,8 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, ph->coin_pub = pr.coin_pub; ph->exchange = exchange; ph->pk = *pk; - ph->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key); + ph->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup ( + pk->key.rsa_public_key); ph->cb = payback_cb; ph->cb_cls = payback_cb_cls; ph->url = TEAH_path_to_url (exchange, "/payback"); @@ -368,8 +375,8 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, eh = TEL_curl_easy_get (ph->url); if (GNUNET_OK != TALER_curl_easy_post (&ph->ctx, - eh, - payback_obj)) + eh, + payback_obj)) { GNUNET_break (0); curl_easy_cleanup (eh); @@ -385,10 +392,10 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange, ph->url); ctx = TEAH_handle_to_context (exchange); ph->job = GNUNET_CURL_job_add2 (ctx, - eh, - ph->ctx.headers, - &handle_payback_finished, - ph); + eh, + ph->ctx.headers, + &handle_payback_finished, + ph); return ph; } diff --git a/src/lib/exchange_api_refresh.c b/src/lib/exchange_api_refresh.c index 617eab393..f99f3ab02 100644 --- a/src/lib/exchange_api_refresh.c +++ b/src/lib/exchange_api_refresh.c @@ -239,13 +239,13 @@ free_melt_data (struct MeltData *md) free_melted_coin (&md->melted_coin); if (NULL != md->fresh_pks) { - for (unsigned int i=0;inum_fresh_coins;i++) + for (unsigned int i = 0; inum_fresh_coins; i++) if (NULL != md->fresh_pks[i].rsa_public_key) GNUNET_CRYPTO_rsa_public_key_free (md->fresh_pks[i].rsa_public_key); GNUNET_free (md->fresh_pks); } - for (unsigned int i=0;ifresh_coins[i]); /* Finally, clean up a bit... (NOTE: compilers might optimize this away, so this is @@ -302,7 +302,7 @@ serialize_melted_coin (const struct MeltedCoin *mc, &mc->fee_melt); TALER_amount_hton (&mcp.original_value, &mc->original_value); - for (i=0;itransfer_priv[i]; mcp.expire_deposit = GNUNET_TIME_absolute_hton (mc->expire_deposit); mcp.pbuf_size = htons ((uint16_t) pbuf_size); @@ -384,7 +384,7 @@ deserialize_melted_coin (struct MeltedCoin *mc, &mcp.fee_melt); TALER_amount_ntoh (&mc->original_value, &mcp.original_value); - for (i=0;itransfer_priv[i] = mcp.transfer_priv[i]; mc->expire_deposit = GNUNET_TIME_absolute_ntoh (mcp.expire_deposit); return off; @@ -493,8 +493,8 @@ serialize_fresh_coin (const struct TALER_PlanchetSecretsP *fc, { if (NULL != buf) memcpy (&buf[off], - fc, - sizeof (struct TALER_PlanchetSecretsP)); + fc, + sizeof (struct TALER_PlanchetSecretsP)); return sizeof (struct TALER_PlanchetSecretsP); } @@ -566,12 +566,12 @@ serialize_melt_data (const struct MeltData *md, size += serialize_melted_coin (&md->melted_coin, buf, size); - for (unsigned int i=0;inum_fresh_coins;i++) + for (unsigned int i = 0; inum_fresh_coins; i++) size += serialize_denomination_key (&md->fresh_pks[i], buf, size); - for (unsigned int i=0;inum_fresh_coins;j++) + for (unsigned int i = 0; inum_fresh_coins; j++) size += serialize_fresh_coin (&md->fresh_coins[i][j], buf, size); @@ -608,7 +608,7 @@ deserialize_melt_data (const char *buf, md->num_fresh_coins = ntohs (mdp.num_fresh_coins); md->fresh_pks = GNUNET_new_array (md->num_fresh_coins, struct TALER_DenominationPublicKey); - for (unsigned int i=0;ifresh_coins[i] = GNUNET_new_array (md->num_fresh_coins, struct TALER_PlanchetSecretsP); off = sizeof (struct MeltDataP); @@ -617,14 +617,14 @@ deserialize_melt_data (const char *buf, &buf[off], buf_size - off, &ok); - for (unsigned int i=0;(inum_fresh_coins)&&(GNUNET_YES == ok);i++) + for (unsigned int i = 0; (inum_fresh_coins)&&(GNUNET_YES == ok); i++) off += deserialize_denomination_key (&md->fresh_pks[i], &buf[off], buf_size - off, &ok); - for (unsigned int i=0;inum_fresh_coins)&&(GNUNET_YES == ok);j++) + for (unsigned int i = 0; inum_fresh_coins)&&(GNUNET_YES == ok); j++) off += deserialize_fresh_coin (&md->fresh_coins[i][j], &buf[off], buf_size - off, @@ -686,13 +686,17 @@ deserialize_melt_data (const char *buf, * Non-null results should be freed using GNUNET_free(). */ char * -TALER_EXCHANGE_refresh_prepare (const struct TALER_CoinSpendPrivateKeyP *melt_priv, +TALER_EXCHANGE_refresh_prepare (const struct + TALER_CoinSpendPrivateKeyP *melt_priv, const struct TALER_Amount *melt_amount, - const struct TALER_DenominationSignature *melt_sig, - const struct TALER_EXCHANGE_DenomPublicKey *melt_pk, + const struct + TALER_DenominationSignature *melt_sig, + const struct + TALER_EXCHANGE_DenomPublicKey *melt_pk, int check_sig, unsigned int fresh_pks_len, - const struct TALER_EXCHANGE_DenomPublicKey *fresh_pks, + const struct + TALER_EXCHANGE_DenomPublicKey *fresh_pks, size_t *res_size) { struct MeltData md; @@ -722,7 +726,7 @@ TALER_EXCHANGE_refresh_prepare (const struct TALER_CoinSpendPrivateKeyP *melt_pr = GNUNET_CRYPTO_rsa_signature_dup (melt_sig->rsa_signature); md.fresh_pks = GNUNET_new_array (fresh_pks_len, struct TALER_DenominationPublicKey); - for (unsigned int i=0;imd->rc; confirm.noreveal_index = htonl (*noreveal_index); if (GNUNET_OK != @@ -941,7 +947,8 @@ verify_refresh_melt_signature_ok (struct TALER_EXCHANGE_RefreshMeltHandle *rmh, * @return #GNUNET_OK if the signature(s) is valid, #GNUNET_SYSERR if not */ static int -verify_refresh_melt_signature_forbidden (struct TALER_EXCHANGE_RefreshMeltHandle *rmh, +verify_refresh_melt_signature_forbidden (struct + TALER_EXCHANGE_RefreshMeltHandle *rmh, const json_t *json) { json_t *history; @@ -954,7 +961,7 @@ verify_refresh_melt_signature_forbidden (struct TALER_EXCHANGE_RefreshMeltHandle GNUNET_JSON_spec_fixed_auto ("coin_pub", &coin_pub), TALER_JSON_spec_amount ("original_value", &original_value), TALER_JSON_spec_amount ("requested_value", &melt_value_with_fee), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; const struct MeltedCoin *mc; @@ -994,9 +1001,9 @@ verify_refresh_melt_signature_forbidden (struct TALER_EXCHANGE_RefreshMeltHandle "history"); if (GNUNET_OK != TALER_EXCHANGE_verify_coin_history (original_value.currency, - &coin_pub, - history, - &total)) + &coin_pub, + history, + &total)) { GNUNET_break_op (0); json_decref (history); @@ -1111,7 +1118,7 @@ handle_refresh_melt_finished (void *cls, if (NULL != rmh->melt_cb) rmh->melt_cb (rmh->melt_cb_cls, response_code, - TALER_JSON_get_error_code (j), + TALER_JSON_get_error_code (j), UINT32_MAX, NULL, j); @@ -1156,7 +1163,7 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange, struct GNUNET_HashCode h_denom_pub; GNUNET_assert (GNUNET_YES == - TEAH_handle_is_ready (exchange)); + TEAH_handle_is_ready (exchange)); md = deserialize_melt_data (refresh_data, refresh_data_length); if (NULL == md) @@ -1166,7 +1173,8 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange, } melt.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT); - melt.purpose.size = htonl (sizeof (struct TALER_RefreshMeltCoinAffirmationPS)); + melt.purpose.size = htonl (sizeof (struct + TALER_RefreshMeltCoinAffirmationPS)); melt.rc = md->rc; TALER_amount_hton (&melt.amount_with_fee, &md->melted_coin.melt_amount_with_fee); @@ -1185,11 +1193,13 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange, "denom_pub_hash", GNUNET_JSON_from_data_auto (&h_denom_pub), "denom_sig", - GNUNET_JSON_from_rsa_signature (md->melted_coin.sig.rsa_signature), + GNUNET_JSON_from_rsa_signature ( + md->melted_coin.sig.rsa_signature), "confirm_sig", GNUNET_JSON_from_data_auto (&confirm_sig), "value_with_fee", - TALER_JSON_from_amount (&md->melted_coin.melt_amount_with_fee), + TALER_JSON_from_amount ( + &md->melted_coin.melt_amount_with_fee), "rc", GNUNET_JSON_from_data_auto (&melt.rc)); if (NULL == melt_obj) @@ -1206,12 +1216,12 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange, rmh->melt_cb_cls = melt_cb_cls; rmh->md = md; rmh->url = TEAH_path_to_url (exchange, - "/refresh/melt"); + "/refresh/melt"); eh = TEL_curl_easy_get (rmh->url); if (GNUNET_OK != TALER_curl_easy_post (&rmh->ctx, - eh, - melt_obj)) + eh, + melt_obj)) { GNUNET_break (0); curl_easy_cleanup (eh); @@ -1238,7 +1248,8 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange, * @param rmh the refresh melt handle */ void -TALER_EXCHANGE_refresh_melt_cancel (struct TALER_EXCHANGE_RefreshMeltHandle *rmh) +TALER_EXCHANGE_refresh_melt_cancel (struct + TALER_EXCHANGE_RefreshMeltHandle *rmh) { if (NULL != rmh->job) { @@ -1329,7 +1340,7 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh, json_t *jsona; struct GNUNET_JSON_Specification outer_spec[] = { GNUNET_JSON_spec_json ("ev_sigs", &jsona), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -1354,7 +1365,7 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh, GNUNET_JSON_parse_free (outer_spec); return GNUNET_SYSERR; } - for (unsigned int i=0;imd->num_fresh_coins;i++) + for (unsigned int i = 0; imd->num_fresh_coins; i++) { const struct TALER_PlanchetSecretsP *fc; struct TALER_DenominationPublicKey *pk; @@ -1364,7 +1375,7 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh, struct GNUNET_HashCode coin_hash; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_rsa_signature ("ev_sig", &blind_sig), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; struct TALER_FreshCoin coin; @@ -1455,7 +1466,7 @@ handle_refresh_reveal_finished (void *cls, j); rrh->reveal_cb = NULL; } - for (unsigned int i=0;imd->num_fresh_coins;i++) + for (unsigned int i = 0; imd->num_fresh_coins; i++) if (NULL != sigs[i].rsa_signature) GNUNET_CRYPTO_rsa_signature_free (sigs[i].rsa_signature); } @@ -1559,14 +1570,15 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange, } /* now transfer_pub */ - GNUNET_CRYPTO_ecdhe_key_get_public (&md->melted_coin.transfer_priv[noreveal_index].ecdhe_priv, - &transfer_pub.ecdhe_pub); + GNUNET_CRYPTO_ecdhe_key_get_public ( + &md->melted_coin.transfer_priv[noreveal_index].ecdhe_priv, + &transfer_pub.ecdhe_pub); /* now new_denoms */ GNUNET_assert (NULL != (new_denoms_h = json_array ())); GNUNET_assert (NULL != (coin_evs = json_array ())); GNUNET_assert (NULL != (link_sigs = json_array ())); - for (unsigned int i=0;inum_fresh_coins;i++) + for (unsigned int i = 0; inum_fresh_coins; i++) { struct GNUNET_HashCode denom_hash; struct TALER_PlanchetDetail pd; @@ -1575,7 +1587,8 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange, &denom_hash); GNUNET_assert (0 == json_array_append_new (new_denoms_h, - GNUNET_JSON_from_data_auto (&denom_hash))); + GNUNET_JSON_from_data_auto ( + &denom_hash))); if (GNUNET_OK != TALER_planchet_prepare (&md->fresh_pks[i], @@ -1608,12 +1621,14 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange, pd.coin_ev_size, &ldp.coin_envelope_hash); GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_eddsa_sign (&md->melted_coin.coin_priv.eddsa_priv, - &ldp.purpose, - &link_sig.eddsa_signature)); + GNUNET_CRYPTO_eddsa_sign ( + &md->melted_coin.coin_priv.eddsa_priv, + &ldp.purpose, + &link_sig.eddsa_signature)); GNUNET_assert (0 == json_array_append_new (link_sigs, - GNUNET_JSON_from_data_auto (&link_sig))); + GNUNET_JSON_from_data_auto ( + &link_sig))); } GNUNET_free (pd.coin_ev); @@ -1621,17 +1636,18 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange, /* build array of transfer private keys */ GNUNET_assert (NULL != (transfer_privs = json_array ())); - for (unsigned int j=0;jmelted_coin.transfer_priv[j]))); + GNUNET_JSON_from_data_auto ( + &md->melted_coin.transfer_priv[j]))); } /* build main JSON request */ @@ -1662,13 +1678,13 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange, rrh->reveal_cb_cls = reveal_cb_cls; rrh->md = md; rrh->url = TEAH_path_to_url (rrh->exchange, - "/refresh/reveal"); + "/refresh/reveal"); eh = TEL_curl_easy_get (rrh->url); if (GNUNET_OK != TALER_curl_easy_post (&rrh->ctx, - eh, - reveal_obj)) + eh, + reveal_obj)) { GNUNET_break (0); curl_easy_cleanup (eh); @@ -1695,7 +1711,8 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange, * @param rrh the refresh reval handle */ void -TALER_EXCHANGE_refresh_reveal_cancel (struct TALER_EXCHANGE_RefreshRevealHandle *rrh) +TALER_EXCHANGE_refresh_reveal_cancel (struct + TALER_EXCHANGE_RefreshRevealHandle *rrh) { if (NULL != rrh->job) { diff --git a/src/lib/exchange_api_refresh_link.c b/src/lib/exchange_api_refresh_link.c index 02b9f2387..2369b90b3 100644 --- a/src/lib/exchange_api_refresh_link.c +++ b/src/lib/exchange_api_refresh_link.c @@ -98,7 +98,7 @@ parse_refresh_link_coin (const struct TALER_EXCHANGE_RefreshLinkHandle *rlh, GNUNET_JSON_spec_rsa_public_key ("denom_pub", &rpub), GNUNET_JSON_spec_rsa_signature ("ev_sig", &bsig), GNUNET_JSON_spec_fixed_auto ("link_sig", &link_sig), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; struct TALER_TransferSecretP secret; struct TALER_PlanchetSecretsP fc; @@ -151,7 +151,7 @@ parse_refresh_link_coin (const struct TALER_EXCHANGE_RefreshLinkHandle *rlh, pd.coin_ev_size, &ldp.coin_envelope_hash); GNUNET_free (pd.coin_ev); - + if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_LINK, &ldp.purpose, @@ -163,7 +163,7 @@ parse_refresh_link_coin (const struct TALER_EXCHANGE_RefreshLinkHandle *rlh, return GNUNET_SYSERR; } } - + /* clean up */ pub->rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (rpub); GNUNET_JSON_parse_free (spec); @@ -204,12 +204,12 @@ parse_refresh_link_ok (struct TALER_EXCHANGE_RefreshLinkHandle *rlh, num_coins tracks the size of the 1d array we return, whilst 'i' and 'session' track the 2d array. */ - for (session=0;sessioneddsa_priv, &coin_pub.eddsa_pub); pub_str = GNUNET_STRINGS_data_to_string_alloc (&coin_pub, - sizeof (struct TALER_CoinSpendPublicKeyP)); + sizeof (struct + TALER_CoinSpendPublicKeyP)); GNUNET_asprintf (&arg_str, "/refresh/link?coin_pub=%s", pub_str); @@ -454,10 +455,10 @@ TALER_EXCHANGE_refresh_link (struct TALER_EXCHANGE_Handle *exchange, eh = TEL_curl_easy_get (rlh->url); ctx = TEAH_handle_to_context (exchange); rlh->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_YES, - &handle_refresh_link_finished, - rlh); + eh, + GNUNET_YES, + &handle_refresh_link_finished, + rlh); return rlh; } @@ -469,7 +470,8 @@ TALER_EXCHANGE_refresh_link (struct TALER_EXCHANGE_Handle *exchange, * @param rlh the refresh link handle */ void -TALER_EXCHANGE_refresh_link_cancel (struct TALER_EXCHANGE_RefreshLinkHandle *rlh) +TALER_EXCHANGE_refresh_link_cancel (struct + TALER_EXCHANGE_RefreshLinkHandle *rlh) { if (NULL != rlh->job) { diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c index 5ce0152d2..e8ae6b74a 100644 --- a/src/lib/exchange_api_refund.c +++ b/src/lib/exchange_api_refund.c @@ -96,7 +96,7 @@ verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("sig", &exchange_sig), GNUNET_JSON_spec_fixed_auto ("pub", exchange_pub), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -154,7 +154,7 @@ handle_refund_finished (void *cls, case MHD_HTTP_OK: if (GNUNET_OK != verify_refund_signature_ok (rh, - j, + j, &exchange_pub)) { GNUNET_break_op (0); @@ -205,7 +205,7 @@ handle_refund_finished (void *cls, } rh->cb (rh->cb_cls, response_code, - TALER_JSON_get_error_code (j), + TALER_JSON_get_error_code (j), ep, j); TALER_EXCHANGE_refund_cancel (rh); @@ -244,20 +244,20 @@ handle_refund_finished (void *cls, */ struct TALER_EXCHANGE_RefundHandle * TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, - const struct TALER_Amount *amount, - const struct TALER_Amount *refund_fee, - const struct GNUNET_HashCode *h_contract_terms, - const struct TALER_CoinSpendPublicKeyP *coin_pub, - uint64_t rtransaction_id, - const struct TALER_MerchantPrivateKeyP *merchant_priv, - TALER_EXCHANGE_RefundResultCallback cb, - void *cb_cls) + const struct TALER_Amount *amount, + const struct TALER_Amount *refund_fee, + const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + uint64_t rtransaction_id, + const struct TALER_MerchantPrivateKeyP *merchant_priv, + TALER_EXCHANGE_RefundResultCallback cb, + void *cb_cls) { struct TALER_RefundRequestPS rr; struct TALER_MerchantSignatureP merchant_sig; GNUNET_assert (GNUNET_YES == - TEAH_handle_is_ready (exchange)); + TEAH_handle_is_ready (exchange)); rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND); rr.purpose.size = htonl (sizeof (struct TALER_RefundRequestPS)); rr.h_contract_terms = *h_contract_terms; @@ -274,15 +274,15 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, &rr.purpose, &merchant_sig.eddsa_sig)); return TALER_EXCHANGE_refund2 (exchange, - amount, - refund_fee, - h_contract_terms, - coin_pub, - rtransaction_id, - &rr.merchant, - &merchant_sig, - cb, - cb_cls); + amount, + refund_fee, + h_contract_terms, + coin_pub, + rtransaction_id, + &rr.merchant, + &merchant_sig, + cb, + cb_cls); } @@ -319,33 +319,36 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, */ struct TALER_EXCHANGE_RefundHandle * TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange, - const struct TALER_Amount *amount, - const struct TALER_Amount *refund_fee, - const struct GNUNET_HashCode *h_contract_terms, - const struct TALER_CoinSpendPublicKeyP *coin_pub, - uint64_t rtransaction_id, - const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct TALER_MerchantSignatureP *merchant_sig, - TALER_EXCHANGE_RefundResultCallback cb, - void *cb_cls) + const struct TALER_Amount *amount, + const struct TALER_Amount *refund_fee, + const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + uint64_t rtransaction_id, + const struct TALER_MerchantPublicKeyP *merchant_pub, + const struct TALER_MerchantSignatureP *merchant_sig, + TALER_EXCHANGE_RefundResultCallback cb, + void *cb_cls) { struct TALER_EXCHANGE_RefundHandle *rh; struct GNUNET_CURL_Context *ctx; json_t *refund_obj; CURL *eh; -refund_obj = json_pack ("{s:o, s:o," /* amount/fee */ - " s:o, s:o," /* h_contract_terms, coin_pub */ - " s:I," /* rtransaction id */ - " s:o, s:o}", /* merchant_pub, merchant_sig */ - "refund_amount", TALER_JSON_from_amount (amount), - "refund_fee", TALER_JSON_from_amount (refund_fee), - "h_contract_terms", GNUNET_JSON_from_data_auto (h_contract_terms), - "coin_pub", GNUNET_JSON_from_data_auto (coin_pub), - "rtransaction_id", (json_int_t) rtransaction_id, - "merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub), - "merchant_sig", GNUNET_JSON_from_data_auto (merchant_sig) - ); + refund_obj = json_pack ("{s:o, s:o," /* amount/fee */ + " s:o, s:o," /* h_contract_terms, coin_pub */ + " s:I," /* rtransaction id */ + " s:o, s:o}", /* merchant_pub, merchant_sig */ + "refund_amount", TALER_JSON_from_amount (amount), + "refund_fee", TALER_JSON_from_amount (refund_fee), + "h_contract_terms", GNUNET_JSON_from_data_auto ( + h_contract_terms), + "coin_pub", GNUNET_JSON_from_data_auto (coin_pub), + "rtransaction_id", (json_int_t) rtransaction_id, + "merchant_pub", GNUNET_JSON_from_data_auto ( + merchant_pub), + "merchant_sig", GNUNET_JSON_from_data_auto ( + merchant_sig) + ); if (NULL == refund_obj) { GNUNET_break (0); @@ -371,8 +374,8 @@ refund_obj = json_pack ("{s:o, s:o," /* amount/fee */ eh = TEL_curl_easy_get (rh->url); if (GNUNET_OK != TALER_curl_easy_post (&rh->ctx, - eh, - refund_obj)) + eh, + refund_obj)) { GNUNET_break (0); curl_easy_cleanup (eh); @@ -387,10 +390,10 @@ refund_obj = json_pack ("{s:o, s:o," /* amount/fee */ rh->url); ctx = TEAH_handle_to_context (exchange); rh->job = GNUNET_CURL_job_add2 (ctx, - eh, - rh->ctx.headers, - &handle_refund_finished, - rh); + eh, + rh->ctx.headers, + &handle_refund_finished, + rh); return rh; } diff --git a/src/lib/exchange_api_reserve.c b/src/lib/exchange_api_reserve.c index 3a77f606a..f90bdbb8c 100644 --- a/src/lib/exchange_api_reserve.c +++ b/src/lib/exchange_api_reserve.c @@ -111,7 +111,7 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange, TALER_amount_get_zero (currency, &total_out)); uuid_off = 0; - for (off=0;offcb (rsh->cb_cls, response_code, - TALER_JSON_get_error_code (j), + TALER_JSON_get_error_code (j), j, NULL, 0, NULL); @@ -597,7 +611,8 @@ handle_reserve_status_finished (void *cls, */ struct TALER_EXCHANGE_ReserveStatusHandle * TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange, - const struct TALER_ReservePublicKeyP *reserve_pub, + const struct + TALER_ReservePublicKeyP *reserve_pub, TALER_EXCHANGE_ReserveStatusResultCallback cb, void *cb_cls) { @@ -614,7 +629,8 @@ TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange, return NULL; } pub_str = GNUNET_STRINGS_data_to_string_alloc (reserve_pub, - sizeof (struct TALER_ReservePublicKeyP)); + sizeof (struct + TALER_ReservePublicKeyP)); GNUNET_asprintf (&arg_str, "/reserve/status?reserve_pub=%s", pub_str); @@ -625,16 +641,16 @@ TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange, rsh->cb_cls = cb_cls; rsh->reserve_pub = *reserve_pub; rsh->url = TEAH_path_to_url (exchange, - arg_str); + arg_str); GNUNET_free (arg_str); eh = TEL_curl_easy_get (rsh->url); ctx = TEAH_handle_to_context (exchange); rsh->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_NO, - &handle_reserve_status_finished, - rsh); + eh, + GNUNET_NO, + &handle_reserve_status_finished, + rsh); return rsh; } @@ -646,7 +662,8 @@ TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange, * @param rsh the reserve status request handle */ void -TALER_EXCHANGE_reserve_status_cancel (struct TALER_EXCHANGE_ReserveStatusHandle *rsh) +TALER_EXCHANGE_reserve_status_cancel (struct + TALER_EXCHANGE_ReserveStatusHandle *rsh) { if (NULL != rsh->job) { @@ -743,7 +760,7 @@ reserve_withdraw_ok (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_rsa_signature ("ev_sig", &blind_sig), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -793,7 +810,8 @@ reserve_withdraw_ok (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh, * @return #GNUNET_OK on success, #GNUNET_SYSERR on errors */ static int -reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh, +reserve_withdraw_payment_required (struct + TALER_EXCHANGE_ReserveWithdrawHandle *wsh, const json_t *json) { struct TALER_Amount balance; @@ -803,7 +821,7 @@ reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle * size_t len; struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_amount ("balance", &balance), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -832,7 +850,9 @@ reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle * not fit on the stack. Use "GNUNET_malloc_large" as a malicious exchange may theoretically try to crash us by giving a history that does not fit into our memory. */ - rhistory = GNUNET_malloc_large (sizeof (struct TALER_EXCHANGE_ReserveHistory) * len); + rhistory = GNUNET_malloc_large (sizeof (struct + TALER_EXCHANGE_ReserveHistory) + * len); if (NULL == rhistory) { GNUNET_break (0); @@ -962,7 +982,7 @@ handle_reserve_withdraw_finished (void *cls, { wsh->cb (wsh->cb_cls, response_code, - TALER_JSON_get_error_code (j), + TALER_JSON_get_error_code (j), NULL, j); wsh->cb = NULL; @@ -1009,18 +1029,22 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, wsh->cb = res_cb; wsh->cb_cls = res_cb_cls; wsh->pk = *pk; - wsh->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key); + wsh->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup ( + pk->key.rsa_public_key); wsh->reserve_pub = *reserve_pub; wsh->c_hash = pd->c_hash; GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key, &h_denom_pub); withdraw_obj = json_pack ("{s:o, s:o," /* denom_pub_hash and coin_ev */ " s:o, s:o}",/* reserve_pub and reserve_sig */ - "denom_pub_hash", GNUNET_JSON_from_data_auto (&h_denom_pub), + "denom_pub_hash", GNUNET_JSON_from_data_auto ( + &h_denom_pub), "coin_ev", GNUNET_JSON_from_data (pd->coin_ev, pd->coin_ev_size), - "reserve_pub", GNUNET_JSON_from_data_auto (reserve_pub), - "reserve_sig", GNUNET_JSON_from_data_auto (reserve_sig)); + "reserve_pub", GNUNET_JSON_from_data_auto ( + reserve_pub), + "reserve_sig", GNUNET_JSON_from_data_auto ( + reserve_sig)); if (NULL == withdraw_obj) { GNUNET_break (0); @@ -1034,8 +1058,8 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, eh = TEL_curl_easy_get (wsh->url); if (GNUNET_OK != TALER_curl_easy_post (&wsh->ctx, - eh, - withdraw_obj)) + eh, + withdraw_obj)) { GNUNET_break (0); curl_easy_cleanup (eh); @@ -1077,9 +1101,11 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, struct TALER_EXCHANGE_ReserveWithdrawHandle * TALER_EXCHANGE_reserve_withdraw (struct TALER_EXCHANGE_Handle *exchange, const struct TALER_EXCHANGE_DenomPublicKey *pk, - const struct TALER_ReservePrivateKeyP *reserve_priv, + const struct + TALER_ReservePrivateKeyP *reserve_priv, const struct TALER_PlanchetSecretsP *ps, - TALER_EXCHANGE_ReserveWithdrawResultCallback res_cb, + TALER_EXCHANGE_ReserveWithdrawResultCallback + res_cb, void *res_cb_cls) { struct TALER_Amount amount_with_fee; @@ -1158,11 +1184,15 @@ TALER_EXCHANGE_reserve_withdraw (struct TALER_EXCHANGE_Handle *exchange, */ struct TALER_EXCHANGE_ReserveWithdrawHandle * TALER_EXCHANGE_reserve_withdraw2 (struct TALER_EXCHANGE_Handle *exchange, - const struct TALER_EXCHANGE_DenomPublicKey *pk, - const struct TALER_ReserveSignatureP *reserve_sig, - const struct TALER_ReservePublicKeyP *reserve_pub, + const struct + TALER_EXCHANGE_DenomPublicKey *pk, + const struct + TALER_ReserveSignatureP *reserve_sig, + const struct + TALER_ReservePublicKeyP *reserve_pub, const struct TALER_PlanchetSecretsP *ps, - TALER_EXCHANGE_ReserveWithdrawResultCallback res_cb, + TALER_EXCHANGE_ReserveWithdrawResultCallback + res_cb, void *res_cb_cls) { struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh; @@ -1196,7 +1226,9 @@ TALER_EXCHANGE_reserve_withdraw2 (struct TALER_EXCHANGE_Handle *exchange, * @param sign the withdraw sign request handle */ void -TALER_EXCHANGE_reserve_withdraw_cancel (struct TALER_EXCHANGE_ReserveWithdrawHandle *sign) +TALER_EXCHANGE_reserve_withdraw_cancel (struct + TALER_EXCHANGE_ReserveWithdrawHandle * + sign) { if (NULL != sign->job) { diff --git a/src/lib/exchange_api_track_transaction.c b/src/lib/exchange_api_track_transaction.c index 1cc99dbb8..29b85facf 100644 --- a/src/lib/exchange_api_track_transaction.c +++ b/src/lib/exchange_api_track_transaction.c @@ -88,7 +88,8 @@ struct TALER_EXCHANGE_TrackTransactionHandle * @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not */ static int -verify_deposit_wtid_signature_ok (const struct TALER_EXCHANGE_TrackTransactionHandle *dwh, +verify_deposit_wtid_signature_ok (const struct + TALER_EXCHANGE_TrackTransactionHandle *dwh, const json_t *json, struct TALER_ExchangePublicKeyP *exchange_pub) { @@ -97,7 +98,7 @@ verify_deposit_wtid_signature_ok (const struct TALER_EXCHANGE_TrackTransactionHa struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("exchange_sig", &exchange_sig), GNUNET_JSON_spec_fixed_auto ("exchange_pub", exchange_pub), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -162,7 +163,7 @@ handle_deposit_wtid_finished (void *cls, GNUNET_JSON_spec_fixed_auto ("wtid", &dwh->depconf.wtid), GNUNET_JSON_spec_absolute_time ("execution_time", &execution_time), TALER_JSON_spec_amount ("coin_contribution", &coin_contribution_s), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -198,7 +199,7 @@ handle_deposit_wtid_finished (void *cls, /* Transaction known, but not executed yet */ struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_absolute_time ("execution_time", &execution_time), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -240,7 +241,7 @@ handle_deposit_wtid_finished (void *cls, } dwh->cb (dwh->cb_cls, response_code, - TALER_JSON_get_error_code (j), + TALER_JSON_get_error_code (j), ep, j, wtid, @@ -265,12 +266,15 @@ handle_deposit_wtid_finished (void *cls, */ struct TALER_EXCHANGE_TrackTransactionHandle * TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange, - const struct TALER_MerchantPrivateKeyP *merchant_priv, - const struct GNUNET_HashCode *h_wire, - const struct GNUNET_HashCode *h_contract_terms, - const struct TALER_CoinSpendPublicKeyP *coin_pub, - TALER_EXCHANGE_TrackTransactionCallback cb, - void *cb_cls) + const struct + TALER_MerchantPrivateKeyP *merchant_priv, + const struct GNUNET_HashCode *h_wire, + const struct + GNUNET_HashCode *h_contract_terms, + const struct + TALER_CoinSpendPublicKeyP *coin_pub, + TALER_EXCHANGE_TrackTransactionCallback cb, + void *cb_cls) { struct TALER_DepositTrackPS dtp; struct TALER_MerchantSignatureP merchant_sig; @@ -301,10 +305,14 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange, " s:o," /* coin_pub */ " s:o, s:o}", /* merchant_pub, merchant_sig */ "H_wire", GNUNET_JSON_from_data_auto (h_wire), - "h_contract_terms", GNUNET_JSON_from_data_auto (h_contract_terms), - "coin_pub", GNUNET_JSON_from_data_auto (coin_pub), - "merchant_pub", GNUNET_JSON_from_data_auto (&dtp.merchant), - "merchant_sig", GNUNET_JSON_from_data_auto (&merchant_sig)); + "h_contract_terms", GNUNET_JSON_from_data_auto ( + h_contract_terms), + "coin_pub", GNUNET_JSON_from_data_auto ( + coin_pub), + "merchant_pub", GNUNET_JSON_from_data_auto ( + &dtp.merchant), + "merchant_sig", GNUNET_JSON_from_data_auto ( + &merchant_sig)); if (NULL == deposit_wtid_obj) { GNUNET_break (0); @@ -325,8 +333,8 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange, eh = TEL_curl_easy_get (dwh->url); if (GNUNET_OK != TALER_curl_easy_post (&dwh->ctx, - eh, - deposit_wtid_obj)) + eh, + deposit_wtid_obj)) { GNUNET_break (0); curl_easy_cleanup (eh); @@ -353,7 +361,9 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange, * @param dwh the wire deposits request handle */ void -TALER_EXCHANGE_track_transaction_cancel (struct TALER_EXCHANGE_TrackTransactionHandle *dwh) +TALER_EXCHANGE_track_transaction_cancel (struct + TALER_EXCHANGE_TrackTransactionHandle * + dwh) { if (NULL != dwh->job) { diff --git a/src/lib/exchange_api_track_transfer.c b/src/lib/exchange_api_track_transfer.c index 88043b7ba..419998a2c 100644 --- a/src/lib/exchange_api_track_transfer.c +++ b/src/lib/exchange_api_track_transfer.c @@ -80,7 +80,8 @@ struct TALER_EXCHANGE_TrackTransferHandle * #GNUNET_SYSERR if the response was bogus */ static int -check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh, +check_track_transfer_response_ok (struct + TALER_EXCHANGE_TrackTransferHandle *wdh, const json_t *json) { json_t *details_j; @@ -102,7 +103,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh GNUNET_JSON_spec_json ("deposits", &details_j), GNUNET_JSON_spec_fixed_auto ("exchange_sig", &exchange_sig), GNUNET_JSON_spec_fixed_auto ("exchange_pub", &exchange_pub), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -129,16 +130,17 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh struct TALER_WireDepositDataPS wdp; hash_context = GNUNET_CRYPTO_hash_context_start (); - for (i=0;ih_contract_terms), + GNUNET_JSON_spec_fixed_auto ("h_contract_terms", + &detail->h_contract_terms), GNUNET_JSON_spec_fixed_auto ("coin_pub", &detail->coin_pub), TALER_JSON_spec_amount ("deposit_value", &detail->coin_value), TALER_JSON_spec_amount ("deposit_fee", &detail->coin_fee), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -175,7 +177,8 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh } GNUNET_CRYPTO_hash_context_read (hash_context, &dd, - sizeof (struct TALER_WireDepositDetailP)); + sizeof (struct + TALER_WireDepositDetailP)); } /* Check signature */ wdp.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT); @@ -189,7 +192,8 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh GNUNET_CRYPTO_hash_context_finish (hash_context, &wdp.h_details); if (GNUNET_OK != - TALER_EXCHANGE_test_signing_key (TALER_EXCHANGE_get_keys (wdh->exchange), + TALER_EXCHANGE_test_signing_key (TALER_EXCHANGE_get_keys ( + wdh->exchange), &exchange_pub)) { GNUNET_break_op (0); @@ -197,10 +201,10 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh return GNUNET_SYSERR; } if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify - (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT, - &wdp.purpose, - &exchange_sig.eddsa_signature, - &exchange_pub.eddsa_pub)) + (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT, + &wdp.purpose, + &exchange_sig.eddsa_signature, + &exchange_pub.eddsa_pub)) { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); @@ -226,7 +230,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh } wdh->cb (wdh->cb_cls, MHD_HTTP_OK, - TALER_EC_NONE, + TALER_EC_NONE, &exchange_pub, json, &h_wire, @@ -299,7 +303,7 @@ handle_track_transfer_finished (void *cls, } wdh->cb (wdh->cb_cls, response_code, - TALER_JSON_get_error_code (j), + TALER_JSON_get_error_code (j), NULL, j, NULL, @@ -323,7 +327,8 @@ handle_track_transfer_finished (void *cls, */ struct TALER_EXCHANGE_TrackTransferHandle * TALER_EXCHANGE_track_transfer (struct TALER_EXCHANGE_Handle *exchange, - const struct TALER_WireTransferIdentifierRawP *wtid, + const struct + TALER_WireTransferIdentifierRawP *wtid, TALER_EXCHANGE_TrackTransferCallback cb, void *cb_cls) { @@ -346,22 +351,23 @@ TALER_EXCHANGE_track_transfer (struct TALER_EXCHANGE_Handle *exchange, wdh->cb_cls = cb_cls; buf = GNUNET_STRINGS_data_to_string_alloc (wtid, - sizeof (struct TALER_WireTransferIdentifierRawP)); + sizeof (struct + TALER_WireTransferIdentifierRawP)); GNUNET_asprintf (&path, "/track/transfer?wtid=%s", buf); wdh->url = TEAH_path_to_url (wdh->exchange, - path); + path); GNUNET_free (buf); GNUNET_free (path); eh = TEL_curl_easy_get (wdh->url); ctx = TEAH_handle_to_context (exchange); wdh->job = GNUNET_CURL_job_add (ctx, - eh, - GNUNET_YES, - &handle_track_transfer_finished, - wdh); + eh, + GNUNET_YES, + &handle_track_transfer_finished, + wdh); return wdh; } @@ -373,7 +379,8 @@ TALER_EXCHANGE_track_transfer (struct TALER_EXCHANGE_Handle *exchange, * @param wdh the wire deposits request handle */ void -TALER_EXCHANGE_track_transfer_cancel (struct TALER_EXCHANGE_TrackTransferHandle *wdh) +TALER_EXCHANGE_track_transfer_cancel (struct + TALER_EXCHANGE_TrackTransferHandle *wdh) { if (NULL != wdh->job) { diff --git a/src/lib/exchange_api_wire.c b/src/lib/exchange_api_wire.c index 85d1835cf..8bfa4ed12 100644 --- a/src/lib/exchange_api_wire.c +++ b/src/lib/exchange_api_wire.c @@ -149,12 +149,12 @@ parse_fees (json_t *fees) TALER_JSON_spec_amount ("wire_fee", &wa->wire_fee), TALER_JSON_spec_amount ("closing_fee", - &wa->closing_fee), + &wa->closing_fee), GNUNET_JSON_spec_absolute_time ("start_date", &wa->start_date), GNUNET_JSON_spec_absolute_time ("end_date", &wa->end_date), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -188,7 +188,7 @@ static const struct TALER_EXCHANGE_WireAggregateFees * lookup_fee (const struct FeeMap *fm, const char *method) { - for (;NULL != fm; fm = fm->next) + for (; NULL != fm; fm = fm->next) if (0 == strcasecmp (fm->method, method)) return fm->fee_list; @@ -230,7 +230,7 @@ handle_wire_finished (void *cls, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_json ("accounts", &accounts), GNUNET_JSON_spec_json ("fees", &fees), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -268,14 +268,14 @@ handle_wire_finished (void *cls, { struct TALER_EXCHANGE_WireAccount was[num_accounts]; - for (unsigned int i=0;iurl), GNUNET_JSON_spec_fixed_auto ("master_sig", &wa->master_sig), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; char *method; diff --git a/src/lib/teah_common.c b/src/lib/teah_common.c index cc8a23754..3e56c7536 100644 --- a/src/lib/teah_common.c +++ b/src/lib/teah_common.c @@ -78,17 +78,17 @@ TALER_curl_easy_post (struct TEAH_PostContext *ctx, ctx->json_enc = (char *) cbuf; } GNUNET_assert - (NULL != (ctx->headers = curl_slist_append - (ctx->headers, - "Content-Encoding: deflate"))); + (NULL != (ctx->headers = curl_slist_append + (ctx->headers, + "Content-Encoding: deflate"))); #else ctx->json_enc = str; #endif GNUNET_assert - (NULL != (ctx->headers = curl_slist_append - (ctx->headers, - "Content-Type: application/json"))); + (NULL != (ctx->headers = curl_slist_append + (ctx->headers, + "Content-Type: application/json"))); GNUNET_assert (CURLE_OK == curl_easy_setopt (eh, diff --git a/src/lib/test_auditor_api.c b/src/lib/test_auditor_api.c index f8861bc43..656819aa3 100644 --- a/src/lib/test_auditor_api.c +++ b/src/lib/test_auditor_api.c @@ -42,7 +42,8 @@ */ #define CONFIG_FILE "test_auditor_api.conf" -#define CONFIG_FILE_EXPIRE_RESERVE_NOW "test_auditor_api_expire_reserve_now.conf" +#define CONFIG_FILE_EXPIRE_RESERVE_NOW \ + "test_auditor_api_expire_reserve_now.conf" /** * URL of the fakebank. Obtained from CONFIG_FILE's @@ -91,7 +92,7 @@ static char *exchange_url; * @param label label to use for the command. */ #define CMD_EXEC_WIREWATCH(label) \ - TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) /** * Execute the taler-exchange-aggregator command with @@ -100,7 +101,7 @@ static char *exchange_url; * @param label label to use for the command. */ #define CMD_EXEC_AGGREGATOR(label) \ - TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE) /** * Run wire transfer of funds from some user's account to the @@ -110,9 +111,11 @@ static char *exchange_url; * @param amount amount to transfer, i.e. "EUR:1" */ #define CMD_TRANSFER_TO_EXCHANGE(label,amount) \ - TALER_TESTING_cmd_fakebank_transfer (label, amount, \ - fakebank_url, USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO, \ - USER_LOGIN_NAME, USER_LOGIN_PASS, exchange_url) + TALER_TESTING_cmd_fakebank_transfer (label, amount, \ + fakebank_url, USER_ACCOUNT_NO, \ + EXCHANGE_ACCOUNT_NO, \ + USER_LOGIN_NAME, USER_LOGIN_PASS, \ + exchange_url) /** * Run wire transfer of funds from some user's account to the @@ -122,10 +125,10 @@ static char *exchange_url; * @param amount amount to transfer, i.e. "EUR:1" */ #define CMD_TRANSFER_TO_EXCHANGE_SUBJECT(label,amount,subject) \ - TALER_TESTING_cmd_fakebank_transfer_with_subject \ - (label, amount, fakebank_url, USER_ACCOUNT_NO, \ - EXCHANGE_ACCOUNT_NO, USER_LOGIN_NAME, USER_LOGIN_PASS, \ - subject, exchange_url) + TALER_TESTING_cmd_fakebank_transfer_with_subject \ + (label, amount, fakebank_url, USER_ACCOUNT_NO, \ + EXCHANGE_ACCOUNT_NO, USER_LOGIN_NAME, USER_LOGIN_PASS, \ + subject, exchange_url) /** * Run the taler-auditor. @@ -270,88 +273,88 @@ run (void *cls, */ TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-499c", exchange_url, - "EUR:4.98", 2, 42), + "EUR:4.98", 2, 42), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-99c1", exchange_url, - "EUR:0.98", 2, 42), + "EUR:0.98", 2, 42), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-99c", exchange_url, - "EUR:0.08", 2, 43), + "EUR:0.08", 2, 43), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-aai-1", exchange_url, - "EUR:5.01", 42, 2), + "EUR:5.01", 42, 2), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-aai-2", exchange_url, - "EUR:5.01", 42, 2), + "EUR:5.01", 42, 2), /* The following transactions got originated within * the "massive deposit confirms" batch. */ TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer", - exchange_url, - "EUR:10.10", - 42, - 2), + exchange_url, + "EUR:10.10", + 42, + 2), TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer-1", - exchange_url, - "EUR:0.98", - 2, - 43), + exchange_url, + "EUR:0.98", + 2, + 43), TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer-2", - exchange_url, - "EUR:0.98", - 2, - 43), + exchange_url, + "EUR:0.98", + 2, + 43), TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer-3", - exchange_url, - "EUR:0.98", - 2, - 43), + exchange_url, + "EUR:0.98", + 2, + 43), TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer-4", - exchange_url, - "EUR:0.98", - 2, - 43), + exchange_url, + "EUR:0.98", + 2, + 43), TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer-5", - exchange_url, - "EUR:0.98", - 2, - 43), + exchange_url, + "EUR:0.98", + 2, + 43), TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer-6", - exchange_url, - "EUR:0.98", - 2, - 43), + exchange_url, + "EUR:0.98", + 2, + 43), TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer-7", - exchange_url, - "EUR:0.98", - 2, - 43), + exchange_url, + "EUR:0.98", + 2, + 43), TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer-8", - exchange_url, - "EUR:0.98", - 2, - 43), + exchange_url, + "EUR:0.98", + 2, + 43), TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer-9", - exchange_url, - "EUR:0.98", - 2, - 43), + exchange_url, + "EUR:0.98", + 2, + 43), TALER_TESTING_cmd_check_bank_transfer ("check-massive-transfer-10", - exchange_url, - "EUR:0.98", - 2, - 43), + exchange_url, + "EUR:0.98", + 2, + 43), TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"), TALER_TESTING_cmd_end () }; @@ -379,12 +382,12 @@ run (void *cls, "withdraw-coin-unaggregated", 0, TALER_TESTING_make_wire_details - (43, - fakebank_url), + (43, + fakebank_url), "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", GNUNET_TIME_relative_multiply - (GNUNET_TIME_UNIT_YEARS, - 3000), + (GNUNET_TIME_UNIT_YEARS, + 3000), "EUR:5", MHD_HTTP_OK), CMD_EXEC_AGGREGATOR ("aggregation-attempt"), @@ -593,121 +596,121 @@ run (void *cls, MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("massive-deposit-1", - "massive-withdraw-1", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + "massive-withdraw-1", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("massive-deposit-2", - "massive-withdraw-2", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + "massive-withdraw-2", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("massive-deposit-3", - "massive-withdraw-3", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + "massive-withdraw-3", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("massive-deposit-4", - "massive-withdraw-4", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + "massive-withdraw-4", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("massive-deposit-5", - "massive-withdraw-5", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + "massive-withdraw-5", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("massive-deposit-6", - "massive-withdraw-6", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + "massive-withdraw-6", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("massive-deposit-7", - "massive-withdraw-7", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + "massive-withdraw-7", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("massive-deposit-8", - "massive-withdraw-8", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + "massive-withdraw-8", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("massive-deposit-9", - "massive-withdraw-9", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + "massive-withdraw-9", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("massive-deposit-10", - "massive-withdraw-10", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + "massive-withdraw-10", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit_confirmation ("deposit-confirmation", is->auditor, "massive-deposit-10", 0, "EUR:0.99", MHD_HTTP_OK), - CMD_RUN_AUDITOR("massive-auditor"), + CMD_RUN_AUDITOR ("massive-auditor"), TALER_TESTING_cmd_end () }; @@ -734,8 +737,8 @@ run (void *cls, refund), TALER_TESTING_cmd_batch ("payback", payback), - CMD_RUN_AUDITOR("normal-auditor"), - CMD_RUN_WIRE_AUDITOR("normal-wire-auditor"), + CMD_RUN_AUDITOR ("normal-auditor"), + CMD_RUN_WIRE_AUDITOR ("normal-wire-auditor"), TALER_TESTING_cmd_end () }; @@ -747,7 +750,7 @@ run (void *cls, int main (int argc, - char * const *argv) + char *const *argv) { /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); @@ -756,10 +759,10 @@ main (int argc, "INFO", NULL); if (NULL == (fakebank_url - /* Check fakebank port is available and config cares - * about bank url. */ - = TALER_TESTING_prepare_fakebank (CONFIG_FILE, - "account-2"))) + /* Check fakebank port is available and config cares + * about bank url. */ + = TALER_TESTING_prepare_fakebank (CONFIG_FILE, + "account-2"))) return 77; TALER_TESTING_cleanup_files (CONFIG_FILE); /* @helpers. Run keyup, create tables, ... Note: it diff --git a/src/lib/test_auditor_api_version.c b/src/lib/test_auditor_api_version.c index 7a21430da..696e3db27 100644 --- a/src/lib/test_auditor_api_version.c +++ b/src/lib/test_auditor_api_version.c @@ -87,8 +87,8 @@ do_timeout (void *cls) */ static void version_cb (void *cls, - const struct TALER_AUDITOR_VersionInformation *vi, - enum TALER_AUDITOR_VersionCompatibility compat) + const struct TALER_AUDITOR_VersionInformation *vi, + enum TALER_AUDITOR_VersionCompatibility compat) { if ( (NULL != vi) && (TALER_AUDITOR_VC_MATCH == compat) ) @@ -109,29 +109,29 @@ static void run (void *cls) { const char *auditor_url = "http://localhost:8083/"; - + (void) cls; ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule, - &rc); + &rc); rc = GNUNET_CURL_gnunet_rc_create (ctx); ah = TALER_AUDITOR_connect (ctx, - auditor_url, - &version_cb, - NULL); + auditor_url, + &version_cb, + NULL); GNUNET_SCHEDULER_add_shutdown (&do_shutdown, - NULL); + NULL); tt = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, - &do_timeout, - NULL); + &do_timeout, + NULL); } int main (int argc, - char * const *argv) + char *const *argv) { struct GNUNET_OS_Process *proc; - + /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); @@ -148,12 +148,12 @@ main (int argc, if (NULL == proc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to run `taler-auditor-httpd`," + "Failed to run `taler-auditor-httpd`," " is your PATH correct?\n"); return 77; } GNUNET_SCHEDULER_run (&run, - NULL); + NULL); GNUNET_OS_process_kill (proc, SIGTERM); GNUNET_OS_process_wait (proc); GNUNET_OS_process_destroy (proc); diff --git a/src/lib/test_exchange_api.c b/src/lib/test_exchange_api.c index 33a2df9dd..eeccd3bc2 100644 --- a/src/lib/test_exchange_api.c +++ b/src/lib/test_exchange_api.c @@ -42,7 +42,8 @@ */ #define CONFIG_FILE "test_exchange_api.conf" -#define CONFIG_FILE_EXPIRE_RESERVE_NOW "test_exchange_api_expire_reserve_now.conf" +#define CONFIG_FILE_EXPIRE_RESERVE_NOW \ + "test_exchange_api_expire_reserve_now.conf" /** * Is the configuration file is set to include wire format 'ebics'? @@ -99,7 +100,7 @@ static char *auditor_url; * @param label label to use for the command. */ #define CMD_EXEC_WIREWATCH(label) \ - TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) /** * Execute the taler-exchange-aggregator command with @@ -108,7 +109,7 @@ static char *auditor_url; * @param label label to use for the command. */ #define CMD_EXEC_AGGREGATOR(label) \ - TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE) /** * Run wire transfer of funds from some user's account to the @@ -118,9 +119,11 @@ static char *auditor_url; * @param amount amount to transfer, i.e. "EUR:1" */ #define CMD_TRANSFER_TO_EXCHANGE(label,amount) \ - TALER_TESTING_cmd_fakebank_transfer (label, amount, \ - fakebank_url, USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO, \ - USER_LOGIN_NAME, USER_LOGIN_PASS, exchange_url) + TALER_TESTING_cmd_fakebank_transfer (label, amount, \ + fakebank_url, USER_ACCOUNT_NO, \ + EXCHANGE_ACCOUNT_NO, \ + USER_LOGIN_NAME, USER_LOGIN_PASS, \ + exchange_url) /** * Run wire transfer of funds from some user's account to the @@ -130,10 +133,10 @@ static char *auditor_url; * @param amount amount to transfer, i.e. "EUR:1" */ #define CMD_TRANSFER_TO_EXCHANGE_SUBJECT(label,amount,subject) \ - TALER_TESTING_cmd_fakebank_transfer_with_subject \ - (label, amount, fakebank_url, USER_ACCOUNT_NO, \ - EXCHANGE_ACCOUNT_NO, USER_LOGIN_NAME, USER_LOGIN_PASS, \ - subject, exchange_url) + TALER_TESTING_cmd_fakebank_transfer_with_subject \ + (label, amount, fakebank_url, USER_ACCOUNT_NO, \ + EXCHANGE_ACCOUNT_NO, USER_LOGIN_NAME, USER_LOGIN_PASS, \ + subject, exchange_url) /** * Main function that will tell the interpreter what commands to @@ -214,10 +217,10 @@ run (void *cls, */ TALER_TESTING_cmd_deposit ("deposit-simple", "withdraw-coin-1", 0, - TALER_TESTING_make_wire_details (42, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_OK), + TALER_TESTING_make_wire_details (42, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_OK), /** * Try to overdraw. @@ -232,10 +235,10 @@ run (void *cls, */ TALER_TESTING_cmd_deposit ("deposit-double-1", "withdraw-coin-1", 0, - TALER_TESTING_make_wire_details (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_FORBIDDEN), + TALER_TESTING_make_wire_details (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_FORBIDDEN), /** * Try to double spend using a different transaction id. @@ -248,20 +251,20 @@ run (void *cls, */ TALER_TESTING_cmd_deposit ("deposit-double-1", "withdraw-coin-1", 0, - TALER_TESTING_make_wire_details (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_FORBIDDEN), + TALER_TESTING_make_wire_details (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_FORBIDDEN), /** * Try to double spend with different proposal. */ TALER_TESTING_cmd_deposit ("deposit-double-2", "withdraw-coin-1", 0, - TALER_TESTING_make_wire_details (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":2}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_FORBIDDEN), + TALER_TESTING_make_wire_details (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":2}]}", + GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_FORBIDDEN), TALER_TESTING_cmd_end () }; @@ -288,9 +291,9 @@ run (void *cls, */ TALER_TESTING_cmd_withdraw_amount ("refresh-withdraw-coin-1", - "refresh-create-reserve-1", - "EUR:5", - MHD_HTTP_OK), + "refresh-create-reserve-1", + "EUR:5", + MHD_HTTP_OK), /** * Try to partially spend (deposit) 1 EUR of the 5 EUR coin * (in full) (merchant would receive EUR:0.99 due to 1 ct @@ -298,74 +301,74 @@ run (void *cls, */ TALER_TESTING_cmd_deposit ("refresh-deposit-partial", - "refresh-withdraw-coin-1", 0, - TALER_TESTING_make_wire_details (42, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\ + "refresh-withdraw-coin-1", 0, + TALER_TESTING_make_wire_details (42, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\ \"value\":\"EUR:1\"}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), + GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), /** * Melt the rest of the coin's value * (EUR:4.00 = 3x EUR:1.03 + 7x EUR:0.13) */ TALER_TESTING_cmd_refresh_melt_double ("refresh-melt-1", - "refresh-withdraw-coin-1", - MHD_HTTP_OK, - NULL), + "refresh-withdraw-coin-1", + MHD_HTTP_OK, + NULL), /** * Complete (successful) melt operation, and * withdraw the coins */ TALER_TESTING_cmd_refresh_reveal ("refresh-reveal-1", - "refresh-melt-1", MHD_HTTP_OK), + "refresh-melt-1", MHD_HTTP_OK), /** * Do it again to check idempotency */ TALER_TESTING_cmd_refresh_reveal ("refresh-reveal-1-idempotency", - "refresh-melt-1", MHD_HTTP_OK), + "refresh-melt-1", MHD_HTTP_OK), /** * Test that /refresh/link works */ TALER_TESTING_cmd_refresh_link ("refresh-link-1", - "refresh-reveal-1", MHD_HTTP_OK), + "refresh-reveal-1", MHD_HTTP_OK), /** * Try to spend a refreshed EUR:1 coin */ TALER_TESTING_cmd_deposit ("refresh-deposit-refreshed-1a", - "refresh-reveal-1-idempotency", 0, - TALER_TESTING_make_wire_details (42, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\ + "refresh-reveal-1-idempotency", 0, + TALER_TESTING_make_wire_details (42, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\ \"value\":3}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), + GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), /** * Try to spend a refreshed EUR:0.1 coin */ TALER_TESTING_cmd_deposit ("refresh-deposit-refreshed-1b", - "refresh-reveal-1", 3, - TALER_TESTING_make_wire_details (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\ + "refresh-reveal-1", 3, + TALER_TESTING_make_wire_details (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\ \"value\":3}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:0.1", MHD_HTTP_OK), + GNUNET_TIME_UNIT_ZERO, "EUR:0.1", MHD_HTTP_OK), /* Test running a failing melt operation (same operation * again must fail) */ TALER_TESTING_cmd_refresh_melt ("refresh-melt-failing", - "refresh-withdraw-coin-1", - MHD_HTTP_FORBIDDEN, - NULL), + "refresh-withdraw-coin-1", + MHD_HTTP_FORBIDDEN, + NULL), /* FIXME: also test with coin that was already melted * (signature differs from coin that was deposited...) */ @@ -380,8 +383,8 @@ run (void *cls, * the exchange knows about the deposit, but has no WTID yet. */ TALER_TESTING_cmd_track_transaction - ("deposit-wtid-found", - "deposit-simple", 0, MHD_HTTP_ACCEPTED, NULL), + ("deposit-wtid-found", + "deposit-simple", 0, MHD_HTTP_ACCEPTED, NULL), /** * Try resolving a deposit's WTID for a failed deposit. @@ -389,8 +392,8 @@ run (void *cls, * exchange does NOT know about the deposit. */ TALER_TESTING_cmd_track_transaction - ("deposit-wtid-failing", - "deposit-double-2", 0, MHD_HTTP_NOT_FOUND, NULL), + ("deposit-wtid-failing", + "deposit-double-2", 0, MHD_HTTP_NOT_FOUND, NULL), /** * Try resolving an undefined (all zeros) WTID; this @@ -399,7 +402,7 @@ run (void *cls, */ TALER_TESTING_cmd_track_transfer_empty ("wire-deposit-failing", - NULL, 0, MHD_HTTP_NOT_FOUND), + NULL, 0, MHD_HTTP_NOT_FOUND), /** * Run transfers. Note that _actual_ aggregation will NOT @@ -415,23 +418,23 @@ run (void *cls, */ TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-499c", exchange_url, - "EUR:4.98", 2, 42), + "EUR:4.98", 2, 42), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-99c1", exchange_url, - "EUR:0.98", 2, 42), + "EUR:0.98", 2, 42), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-99c2", exchange_url, - "EUR:0.98", 2, 42), + "EUR:0.98", 2, 42), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-99c", exchange_url, - "EUR:0.08", 2, 43), + "EUR:0.08", 2, 43), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-aai-1", exchange_url, - "EUR:5.01", 42, 2), + "EUR:5.01", 42, 2), /** * NOTE: the old test-suite had this "check bank transfer" @@ -439,23 +442,23 @@ run (void *cls, */ TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-aai-2", exchange_url, - "EUR:5.01", 42, 2), + "EUR:5.01", 42, 2), TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"), TALER_TESTING_cmd_track_transaction - ("deposit-wtid-ok", - "deposit-simple", 0, MHD_HTTP_OK, "check_bank_transfer-499c"), + ("deposit-wtid-ok", + "deposit-simple", 0, MHD_HTTP_OK, "check_bank_transfer-499c"), TALER_TESTING_cmd_track_transfer ("wire-deposit-success-bank", - "check_bank_transfer-99c1", 0, MHD_HTTP_OK, "EUR:0.98", - "EUR:0.01"), + "check_bank_transfer-99c1", 0, MHD_HTTP_OK, "EUR:0.98", + "EUR:0.01"), TALER_TESTING_cmd_track_transfer ("wire-deposits-success-wtid", - "deposit-wtid-ok", 0, MHD_HTTP_OK, "EUR:4.98", - "EUR:0.01"), + "deposit-wtid-ok", 0, MHD_HTTP_OK, "EUR:4.98", + "EUR:0.01"), TALER_TESTING_cmd_end () }; @@ -478,30 +481,30 @@ run (void *cls, /* "consume" reserve creation transfer. */ TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-unaggregated", - exchange_url, - "EUR:5.01", - 42, - 2), + exchange_url, + "EUR:5.01", + 42, + 2), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-unaggregated", - "create-reserve-unaggregated", - "EUR:5", - MHD_HTTP_OK), + "create-reserve-unaggregated", + "EUR:5", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("deposit-unaggregated", - "withdraw-coin-unaggregated", - 0, - TALER_TESTING_make_wire_details - (43, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", - GNUNET_TIME_relative_multiply - (GNUNET_TIME_UNIT_YEARS, - 3000), - "EUR:5", - MHD_HTTP_OK), + "withdraw-coin-unaggregated", + 0, + TALER_TESTING_make_wire_details + (43, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_relative_multiply + (GNUNET_TIME_UNIT_YEARS, + 3000), + "EUR:5", + MHD_HTTP_OK), CMD_EXEC_AGGREGATOR ("aggregation-attempt"), @@ -538,11 +541,11 @@ run (void *cls, */ TALER_TESTING_cmd_deposit ("deposit-refund-1", "withdraw-coin-r1", 0, - TALER_TESTING_make_wire_details (42, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\"," - "\"value\":\"EUR:5\"}]}", - GNUNET_TIME_UNIT_MINUTES, "EUR:5", MHD_HTTP_OK), + TALER_TESTING_make_wire_details (42, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\"," + "\"value\":\"EUR:5\"}]}", + GNUNET_TIME_UNIT_MINUTES, "EUR:5", MHD_HTTP_OK), /** @@ -561,23 +564,23 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-pre-refund", exchange_url, - "EUR:5.01", 42, 2), + "EUR:5.01", 42, 2), TALER_TESTING_cmd_check_bank_empty ("check_bank_transfer-pre-refund"), TALER_TESTING_cmd_refund ("refund-ok", MHD_HTTP_OK, - "EUR:5", "EUR:0.01", "deposit-refund-1"), + "EUR:5", "EUR:0.01", "deposit-refund-1"), TALER_TESTING_cmd_refund ("refund-ok-double", MHD_HTTP_OK, - "EUR:5", "EUR:0.01", "deposit-refund-1"), + "EUR:5", "EUR:0.01", "deposit-refund-1"), /* Previous /refund(s) had id == 0. */ TALER_TESTING_cmd_refund_with_id ("refund-conflicting", MHD_HTTP_CONFLICT, - "EUR:5", "EUR:0.01", "deposit-refund-1", 1), + "EUR:5", "EUR:0.01", "deposit-refund-1", 1), /** * Spend 4.99 EUR of the refunded 4.99 EUR coin (1ct gone @@ -585,11 +588,11 @@ run (void *cls, * 1 ct deposit fee) */ TALER_TESTING_cmd_deposit ("deposit-refund-2", "withdraw-coin-r1", 0, - TALER_TESTING_make_wire_details (42, - fakebank_url), - "{\"items\":[{\"name\":\"more ice cream\"," - "\"value\":\"EUR:5\"}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:4.99", MHD_HTTP_OK), + TALER_TESTING_make_wire_details (42, + fakebank_url), + "{\"items\":[{\"name\":\"more ice cream\"," + "\"value\":\"EUR:5\"}]}", + GNUNET_TIME_UNIT_ZERO, "EUR:4.99", MHD_HTTP_OK), /** @@ -603,14 +606,14 @@ run (void *cls, */ TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-pre-refund", exchange_url, - "EUR:4.97", 2, 42), + "EUR:4.97", 2, 42), /** * Run failing refund, as past deadline & aggregation. */ TALER_TESTING_cmd_refund ("refund-fail", MHD_HTTP_GONE, - "EUR:4.99", "EUR:0.01", "deposit-refund-2"), + "EUR:4.99", "EUR:0.01", "deposit-refund-2"), TALER_TESTING_cmd_check_bank_empty ("check-empty-after-refund"), @@ -631,16 +634,16 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-aai-3b", exchange_url, - "EUR:5.01", 42, 2), + "EUR:5.01", 42, 2), TALER_TESTING_cmd_deposit ("deposit-refund-1b", "withdraw-coin-rb", 0, - TALER_TESTING_make_wire_details (42, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\"," - "\"value\":\"EUR:5\"}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_OK), + TALER_TESTING_make_wire_details (42, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\"," + "\"value\":\"EUR:5\"}]}", + GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_OK), /** * Trigger refund (before aggregator had a chance to execute @@ -648,7 +651,7 @@ run (void *cls, */ TALER_TESTING_cmd_refund ("refund-ok-fast", MHD_HTTP_OK, - "EUR:5", "EUR:0.01", "deposit-refund-1b"), + "EUR:5", "EUR:0.01", "deposit-refund-1b"), /** * Run transfers. This will do the transfer as refund deadline @@ -713,9 +716,9 @@ run (void *cls, */ TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2-over", - "payback-create-reserve-1", - "EUR:10", - MHD_HTTP_FORBIDDEN), + "payback-create-reserve-1", + "EUR:10", + MHD_HTTP_FORBIDDEN), TALER_TESTING_cmd_status ("payback-reserve-status-2", "payback-create-reserve-1", @@ -729,15 +732,15 @@ run (void *cls, */ CMD_TRANSFER_TO_EXCHANGE ("short-lived-reserve", - "EUR:5.01"), + "EUR:5.01"), TALER_TESTING_cmd_exec_wirewatch ("short-lived-aggregation", - CONFIG_FILE_EXPIRE_RESERVE_NOW), + CONFIG_FILE_EXPIRE_RESERVE_NOW), TALER_TESTING_cmd_exec_aggregator ("close-reserves", - CONFIG_FILE_EXPIRE_RESERVE_NOW), + CONFIG_FILE_EXPIRE_RESERVE_NOW), TALER_TESTING_cmd_status ("short-lived-status", "short-lived-reserve", @@ -746,23 +749,23 @@ run (void *cls, TALER_TESTING_cmd_withdraw_amount ("expired-withdraw", - "short-lived-reserve", - "EUR:1", - MHD_HTTP_FORBIDDEN), + "short-lived-reserve", + "EUR:1", + MHD_HTTP_FORBIDDEN), TALER_TESTING_cmd_check_bank_transfer ("check_bank_short-lived_transfer", - exchange_url, - "EUR:5.01", - 42, - 2), + exchange_url, + "EUR:5.01", + 42, + 2), TALER_TESTING_cmd_check_bank_transfer ("check_bank_short-lived_reimburse", - exchange_url, - "EUR:5", - 2, - 42), + exchange_url, + "EUR:5", + 2, + 42), /** * Fill reserve with EUR:2.02, as withdraw fee is 1 ct per @@ -791,11 +794,11 @@ run (void *cls, TALER_TESTING_cmd_deposit ("payback-deposit-partial", - "payback-withdraw-coin-2a", 0, - TALER_TESTING_make_wire_details (42, - fakebank_url), - "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:0.5", MHD_HTTP_OK), + "payback-withdraw-coin-2a", 0, + TALER_TESTING_make_wire_details (42, + fakebank_url), + "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, "EUR:0.5", MHD_HTTP_OK), TALER_TESTING_cmd_revoke ("revoke-2", MHD_HTTP_OK, @@ -814,11 +817,11 @@ run (void *cls, TALER_TESTING_cmd_deposit ("payback-deposit-revoked", - "payback-withdraw-coin-2b", 0, - TALER_TESTING_make_wire_details (42, - fakebank_url), - "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_NOT_FOUND), + "payback-withdraw-coin-2b", 0, + TALER_TESTING_make_wire_details (42, + fakebank_url), + "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_NOT_FOUND), /* Test deposit fails after payback, with proof in payback */ @@ -828,15 +831,15 @@ run (void *cls, * 404 on the DK! */ TALER_TESTING_cmd_deposit ("payback-deposit-partial-after-payback", - "payback-withdraw-coin-2a", - 0, - TALER_TESTING_make_wire_details - (42, - fakebank_url), - "{\"items\":[{\"name\":\"extra ice cream\",\"value\":1}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:0.5", - MHD_HTTP_NOT_FOUND), + "payback-withdraw-coin-2a", + 0, + TALER_TESTING_make_wire_details + (42, + fakebank_url), + "{\"items\":[{\"name\":\"extra ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:0.5", + MHD_HTTP_NOT_FOUND), /* Test that revoked coins cannot be withdrawn */ CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-3", @@ -846,20 +849,20 @@ run (void *cls, TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-3-revoked", - "payback-create-reserve-3", - "EUR:1", - MHD_HTTP_NOT_FOUND), + "payback-create-reserve-3", + "EUR:1", + MHD_HTTP_NOT_FOUND), /* check that we are empty before the rejection test */ TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-pr1", exchange_url, - "EUR:5.01", 42, 2), + "EUR:5.01", 42, 2), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-pr2", exchange_url, - "EUR:2.02", 42, 2), + "EUR:2.02", 42, 2), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-pr3", exchange_url, - "EUR:1.01", 42, 2), + "EUR:1.01", 42, 2), TALER_TESTING_cmd_check_bank_empty ("check-empty-again"), @@ -867,8 +870,8 @@ run (void *cls, /* Test rejection of bogus wire transfers */ CMD_TRANSFER_TO_EXCHANGE_SUBJECT ("bogus-subject", - "EUR:1.01", - "not a reserve public key"), + "EUR:1.01", + "not a reserve public key"), CMD_EXEC_WIREWATCH ("wirewatch-7"), @@ -881,11 +884,11 @@ run (void *cls, #define RESERVE_OPEN_CLOSE_CHUNK 4 #define RESERVE_OPEN_CLOSE_ITERATIONS 3 #define CONSTANT_KEY \ - "09QGYPEKNHBACK135BNXZFHA0YTQXT1KJDRVXF4J822G99AYNQ8G" + "09QGYPEKNHBACK135BNXZFHA0YTQXT1KJDRVXF4J822G99AYNQ8G" struct TALER_TESTING_Command reserve_open_close - [(RESERVE_OPEN_CLOSE_ITERATIONS - * RESERVE_OPEN_CLOSE_CHUNK) + 1]; + [(RESERVE_OPEN_CLOSE_ITERATIONS + * RESERVE_OPEN_CLOSE_CHUNK) + 1]; for (unsigned int i = 0; i < RESERVE_OPEN_CLOSE_ITERATIONS; @@ -894,18 +897,18 @@ run (void *cls, reserve_open_close[i * RESERVE_OPEN_CLOSE_CHUNK] = CMD_TRANSFER_TO_EXCHANGE_SUBJECT ("reserve-open-close-key", - "EUR:20", - CONSTANT_KEY); + "EUR:20", + CONSTANT_KEY); reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 1] = TALER_TESTING_cmd_exec_wirewatch ("reserve-open-close-wirewatch", - CONFIG_FILE_EXPIRE_RESERVE_NOW); + CONFIG_FILE_EXPIRE_RESERVE_NOW); reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 2] = TALER_TESTING_cmd_exec_aggregator ("reserve-open-close-aggregation", - CONFIG_FILE_EXPIRE_RESERVE_NOW); + CONFIG_FILE_EXPIRE_RESERVE_NOW); reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 3] = TALER_TESTING_cmd_status ("reserve-open-close-status", @@ -914,8 +917,8 @@ run (void *cls, MHD_HTTP_OK); } reserve_open_close - [RESERVE_OPEN_CLOSE_ITERATIONS * RESERVE_OPEN_CLOSE_CHUNK] - = TALER_TESTING_cmd_end (); + [RESERVE_OPEN_CLOSE_ITERATIONS * RESERVE_OPEN_CLOSE_CHUNK] + = TALER_TESTING_cmd_end (); struct TALER_TESTING_Command commands[] = { @@ -960,7 +963,7 @@ run (void *cls, int main (int argc, - char * const *argv) + char *const *argv) { /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); @@ -969,10 +972,10 @@ main (int argc, "INFO", NULL); if (NULL == (fakebank_url - /* Check fakebank port is available and config cares - * about bank url. */ - = TALER_TESTING_prepare_fakebank (CONFIG_FILE, - "account-2"))) + /* Check fakebank port is available and config cares + * about bank url. */ + = TALER_TESTING_prepare_fakebank (CONFIG_FILE, + "account-2"))) return 77; TALER_TESTING_cleanup_files (CONFIG_FILE); /* @helpers. Run keyup, create tables, ... Note: it diff --git a/src/lib/test_exchange_api_interpreter_on-off.c b/src/lib/test_exchange_api_interpreter_on-off.c index ee49dd45e..40094ad4b 100644 --- a/src/lib/test_exchange_api_interpreter_on-off.c +++ b/src/lib/test_exchange_api_interpreter_on-off.c @@ -40,7 +40,7 @@ * * This test helps in finding a way to use/modify the "normal" * cert_cb to handle reconnections from serialized states as well. - * + * * 1st step: simply turn the interpreter off and on again. * 2nd step: turn the interpreter off and give a serial state * to reconnect. @@ -80,13 +80,13 @@ run (void *cls, }; TALER_TESTING_run (is, - commands); + commands); } int main (int argc, - char * const *argv) + char *const *argv) { /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); @@ -99,7 +99,7 @@ main (int argc, * if it's available. */ switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, &auditor_url, - &exchange_url)) + &exchange_url)) { case GNUNET_SYSERR: GNUNET_break (0); diff --git a/src/lib/test_exchange_api_keys_cherry_picking.c b/src/lib/test_exchange_api_keys_cherry_picking.c index 97fa5a268..3acc27536 100644 --- a/src/lib/test_exchange_api_keys_cherry_picking.c +++ b/src/lib/test_exchange_api_keys_cherry_picking.c @@ -65,8 +65,8 @@ #define ADDSECS(base, secs) \ GNUNET_TIME_absolute_add \ (base, \ - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ - secs)) + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ + secs)) /** * Subtract seconds. @@ -78,8 +78,8 @@ #define SUBSECS(base, secs) \ GNUNET_TIME_absolute_subtract \ (base, \ - GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ - secs)) + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ + secs)) #define JAN1971 "1971-01-01" #define JAN2030 "2030-01-01" @@ -128,28 +128,28 @@ run (void *cls, ("serialize-keys"), TALER_TESTING_cmd_connect_with_state ("reconnect-with-state", - "serialize-keys"), + "serialize-keys"), /** * Make sure we have the same keys situation as * it was before the serialization. */ TALER_TESTING_cmd_check_keys_with_now ("check-keys-after-deserialization", - 4, - NDKS_RIGHT_BEFORE_SERIALIZATION, - /** - * Pretend 5 seconds passed. - */ - ADDSECS (TTH_parse_time (JAN2030), - 5)), + 4, + NDKS_RIGHT_BEFORE_SERIALIZATION, + /** + * Pretend 5 seconds passed. + */ + ADDSECS (TTH_parse_time (JAN2030), + 5)), /** * Use one of the deserialized keys. */ TALER_TESTING_cmd_wire ("verify-/wire-with-serialized-keys", - "x-taler-bank", - NULL, - MHD_HTTP_OK), + "x-taler-bank", + NULL, + MHD_HTTP_OK), TALER_TESTING_cmd_end (), }; @@ -169,26 +169,26 @@ run (void *cls, */ TALER_TESTING_cmd_exec_keyup_with_now ("keyup-1", - CONFIG_FILE, - TTH_parse_time (JAN2030)), - /** - * Should return 1 new key, + the original one. NOTE: the - * original DK will never be 'cancelled' as for the current - * libtalerexchange logic, so it must always be counted. - */ + CONFIG_FILE, + TTH_parse_time (JAN2030)), + /** + * Should return 1 new key, + the original one. NOTE: the + * original DK will never be 'cancelled' as for the current + * libtalerexchange logic, so it must always be counted. + */ TALER_TESTING_cmd_check_keys_with_now ("check-keys-2", - 2, /* generation */ - 2, - TTH_parse_time (JAN2030)), + 2, /* generation */ + 2, + TTH_parse_time (JAN2030)), TALER_TESTING_cmd_exec_keyup_with_now ("keyup-3", - CONFIG_FILE_EXTENDED_2, - /* Taking care of not using a 'now' that equals the - * last DK timestamp, otherwise it would get silently - * overridden. */ - ADDSECS (TTH_parse_time (JAN2030), - 10)), + CONFIG_FILE_EXTENDED_2, + /* Taking care of not using a 'now' that equals the + * last DK timestamp, otherwise it would get silently + * overridden. */ + ADDSECS (TTH_parse_time (JAN2030), + 10)), /** * Expected number of DK: @@ -208,9 +208,9 @@ run (void *cls, TALER_TESTING_cmd_check_keys_with_now ("check-keys-3", - 3, - NDKS_RIGHT_BEFORE_SERIALIZATION, - TTH_parse_time (JAN2030)), + 3, + NDKS_RIGHT_BEFORE_SERIALIZATION, + TTH_parse_time (JAN2030)), TALER_TESTING_cmd_end () }; @@ -230,7 +230,7 @@ run (void *cls, int main (int argc, - char * const *argv) + char *const *argv) { /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); diff --git a/src/lib/test_exchange_api_overlapping_keys_bug.c b/src/lib/test_exchange_api_overlapping_keys_bug.c index 7b1458447..6680fbbc9 100644 --- a/src/lib/test_exchange_api_overlapping_keys_bug.c +++ b/src/lib/test_exchange_api_overlapping_keys_bug.c @@ -94,7 +94,7 @@ run (void *cls, int main (int argc, - char * const *argv) + char *const *argv) { /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); diff --git a/src/lib/test_exchange_api_revocation.c b/src/lib/test_exchange_api_revocation.c index 14bb4553f..c0c96766c 100644 --- a/src/lib/test_exchange_api_revocation.c +++ b/src/lib/test_exchange_api_revocation.c @@ -88,7 +88,7 @@ static char *auditor_url; * @param label label to use for the command. */ #define CMD_EXEC_WIREWATCH(label) \ - TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) /** * Run wire transfer of funds from some user's account to the @@ -98,9 +98,11 @@ static char *auditor_url; * @param amount amount to transfer, i.e. "EUR:1" */ #define CMD_TRANSFER_TO_EXCHANGE(label,amount) \ - TALER_TESTING_cmd_fakebank_transfer (label, amount, \ - fakebank_url, USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO, \ - USER_LOGIN_NAME, USER_LOGIN_PASS, exchange_url) + TALER_TESTING_cmd_fakebank_transfer (label, amount, \ + fakebank_url, USER_ACCOUNT_NO, \ + EXCHANGE_ACCOUNT_NO, \ + USER_LOGIN_NAME, USER_LOGIN_PASS, \ + exchange_url) /** * Main function that will tell the interpreter what commands to @@ -135,26 +137,26 @@ run (void *cls, */ TALER_TESTING_cmd_deposit ("deposit-partial", - "withdraw-coin-1", 0, - TALER_TESTING_make_wire_details (42, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\ + "withdraw-coin-1", 0, + TALER_TESTING_make_wire_details (42, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\ \"value\":\"EUR:1\"}]}", - GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), + GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), /** * Melt SOME of the rest of the coin's value * (EUR:3.17 = 3x EUR:1.03 + 7x EUR:0.13) */ TALER_TESTING_cmd_refresh_melt ("refresh-melt-1", - "withdraw-coin-1", - MHD_HTTP_OK, - NULL), + "withdraw-coin-1", + MHD_HTTP_OK, + NULL), /** * Complete (successful) melt operation, and withdraw the coins */ TALER_TESTING_cmd_refresh_reveal ("refresh-reveal-1", - "refresh-melt-1", MHD_HTTP_OK), + "refresh-melt-1", MHD_HTTP_OK), /* Make refreshed coin invalid */ TALER_TESTING_cmd_revoke ("revoke-1", MHD_HTTP_OK, @@ -182,16 +184,16 @@ run (void *cls, leaving EUR:3.69. */ TALER_TESTING_cmd_refresh_melt ("refresh-melt-2", - "withdraw-coin-1", - MHD_HTTP_OK, - "EUR:0.1", - NULL), + "withdraw-coin-1", + MHD_HTTP_OK, + "EUR:0.1", + NULL), /** * Complete (successful) melt operation, and withdraw the coins */ TALER_TESTING_cmd_refresh_reveal ("refresh-reveal-2", - "refresh-melt-2", MHD_HTTP_OK), + "refresh-melt-2", MHD_HTTP_OK), /* Revokes refreshed EUR:0.1 coin */ TALER_TESTING_cmd_revoke ("revoke-2", MHD_HTTP_OK, @@ -231,7 +233,7 @@ run (void *cls, int main (int argc, - char * const *argv) + char *const *argv) { /* These environment variables get in the way... */ unsetenv ("XDG_DATA_HOME"); @@ -240,10 +242,10 @@ main (int argc, "INFO", NULL); if (NULL == (fakebank_url - /* Check fakebank port is available and config cares - * about bank url. */ - = TALER_TESTING_prepare_fakebank (CONFIG_FILE, - "account-2"))) + /* Check fakebank port is available and config cares + * about bank url. */ + = TALER_TESTING_prepare_fakebank (CONFIG_FILE, + "account-2"))) return 77; TALER_TESTING_cleanup_files (CONFIG_FILE); /* @helpers. Run keyup, create tables, ... Note: it diff --git a/src/lib/test_exchange_api_twisted.c b/src/lib/test_exchange_api_twisted.c index 48a4ed36e..52c928341 100644 --- a/src/lib/test_exchange_api_twisted.c +++ b/src/lib/test_exchange_api_twisted.c @@ -97,7 +97,7 @@ static struct GNUNET_OS_Process *twisterd; * @param label label to use for the command. */ #define CMD_EXEC_WIREWATCH(label) \ - TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) /** * Execute the taler-exchange-aggregator command with @@ -106,7 +106,7 @@ static struct GNUNET_OS_Process *twisterd; * @param label label to use for the command. */ #define CMD_EXEC_AGGREGATOR(label) \ - TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE) /** * Run wire transfer of funds from some user's account to the @@ -117,9 +117,11 @@ static struct GNUNET_OS_Process *twisterd; * @param url exchange_url */ #define CMD_TRANSFER_TO_EXCHANGE(label,amount) \ - TALER_TESTING_cmd_fakebank_transfer (label, amount, \ - fakebank_url, USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO, \ - USER_LOGIN_NAME, USER_LOGIN_PASS, exchange_url) + TALER_TESTING_cmd_fakebank_transfer (label, amount, \ + fakebank_url, USER_ACCOUNT_NO, \ + EXCHANGE_ACCOUNT_NO, \ + USER_LOGIN_NAME, USER_LOGIN_PASS, \ + exchange_url) /** * Run wire transfer of funds from some user's account to the @@ -129,10 +131,10 @@ static struct GNUNET_OS_Process *twisterd; * @param amount amount to transfer, i.e. "EUR:1" */ #define CMD_TRANSFER_TO_EXCHANGE_SUBJECT(label,amount,subject) \ - TALER_TESTING_cmd_fakebank_transfer_with_subject \ - (label, amount, fakebank_url, USER_ACCOUNT_NO, \ - EXCHANGE_ACCOUNT_NO, USER_LOGIN_NAME, USER_LOGIN_PASS, \ - subject) + TALER_TESTING_cmd_fakebank_transfer_with_subject \ + (label, amount, fakebank_url, USER_ACCOUNT_NO, \ + EXCHANGE_ACCOUNT_NO, USER_LOGIN_NAME, USER_LOGIN_PASS, \ + subject) /** * Main function that will tell the interpreter what commands to @@ -152,7 +154,7 @@ run (void *cls, CMD_TRANSFER_TO_EXCHANGE ("refresh-create-reserve", - "EUR:5.01"), + "EUR:5.01"), /** * Make previous command effective. @@ -165,42 +167,42 @@ run (void *cls, */ TALER_TESTING_cmd_withdraw_amount ("refresh-withdraw-coin", - "refresh-create-reserve", - "EUR:5", - MHD_HTTP_OK), + "refresh-create-reserve", + "EUR:5", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("refresh-deposit-partial", - "refresh-withdraw-coin", - 0, - TALER_TESTING_make_wire_details - (42, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\",\ + "refresh-withdraw-coin", + 0, + TALER_TESTING_make_wire_details + (42, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\",\ \"value\":\"EUR:1\"}]}", - GNUNET_TIME_UNIT_ZERO, - "EUR:1", - MHD_HTTP_OK), + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_OK), /** * Melt the rest of the coin's value * (EUR:4.00 = 3x EUR:1.03 + 7x EUR:0.13) */ TALER_TESTING_cmd_refresh_melt ("refresh-melt", - "refresh-withdraw-coin", - MHD_HTTP_OK, - NULL), + "refresh-withdraw-coin", + MHD_HTTP_OK, + NULL), /* Trigger 409 Conflict. */ TALER_TESTING_cmd_flip_upload ("flip-upload", - CONFIG_FILE, - "transfer_privs.0"), + CONFIG_FILE, + "transfer_privs.0"), TALER_TESTING_cmd_refresh_reveal ("refresh-(flipped-)reveal", - "refresh-melt", - MHD_HTTP_CONFLICT), + "refresh-melt", + MHD_HTTP_CONFLICT), TALER_TESTING_cmd_end () @@ -216,55 +218,55 @@ run (void *cls, CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r1", - "EUR:5.01"), + "EUR:5.01"), CMD_EXEC_WIREWATCH ("wirewatch-r1"), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r1", - "create-reserve-r1", - "EUR:5", - MHD_HTTP_OK), + "create-reserve-r1", + "EUR:5", + MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("deposit-refund-1", - "withdraw-coin-r1", - 0, - TALER_TESTING_make_wire_details - (42, - fakebank_url), - "{\"items\":[{\"name\":\"ice cream\"," - "\"value\":\"EUR:5\"}]}", - GNUNET_TIME_UNIT_MINUTES, - "EUR:5", - MHD_HTTP_OK), + "withdraw-coin-r1", + 0, + TALER_TESTING_make_wire_details + (42, + fakebank_url), + "{\"items\":[{\"name\":\"ice cream\"," + "\"value\":\"EUR:5\"}]}", + GNUNET_TIME_UNIT_MINUTES, + "EUR:5", + MHD_HTTP_OK), TALER_TESTING_cmd_refund ("refund-currency-missmatch", - MHD_HTTP_PRECONDITION_FAILED, - "USD:5", - "USD:0.01", - "deposit-refund-1"), + MHD_HTTP_PRECONDITION_FAILED, + "USD:5", + "USD:0.01", + "deposit-refund-1"), TALER_TESTING_cmd_refund ("refund-fee-above-amount", - MHD_HTTP_BAD_REQUEST, - "EUR:5", - "EUR:10", - "deposit-refund-1"), + MHD_HTTP_BAD_REQUEST, + "EUR:5", + "EUR:10", + "deposit-refund-1"), TALER_TESTING_cmd_flip_upload ("flip-upload", - CONFIG_FILE, - "merchant_sig"), + CONFIG_FILE, + "merchant_sig"), TALER_TESTING_cmd_refund ("refund-bad-sig", - MHD_HTTP_UNAUTHORIZED, - "EUR:5", - "EUR:0.01", - "deposit-refund-1"), + MHD_HTTP_UNAUTHORIZED, + "EUR:5", + "EUR:0.01", + "deposit-refund-1"), /* This next deposit CMD is only used to provide a * good merchant signature to the next (failing) refund @@ -272,40 +274,40 @@ run (void *cls, TALER_TESTING_cmd_deposit ("deposit-refund-to-fail", - "withdraw-coin-r1", - 0, /* coin index. */ - TALER_TESTING_make_wire_details - (42, - fakebank_url), - /* This parameter will make any comparison about - h_contract_terms fail, when /refund will be handled. - So in other words, this is h_contract missmatch. */ - "{\"items\":[{\"name\":\"ice skate\"," - "\"value\":\"EUR:5\"}]}", - GNUNET_TIME_UNIT_MINUTES, - "EUR:5", - MHD_HTTP_FORBIDDEN), + "withdraw-coin-r1", + 0, /* coin index. */ + TALER_TESTING_make_wire_details + (42, + fakebank_url), + /* This parameter will make any comparison about + h_contract_terms fail, when /refund will be handled. + So in other words, this is h_contract missmatch. */ + "{\"items\":[{\"name\":\"ice skate\"," + "\"value\":\"EUR:5\"}]}", + GNUNET_TIME_UNIT_MINUTES, + "EUR:5", + MHD_HTTP_FORBIDDEN), TALER_TESTING_cmd_refund ("refund-deposit-not-found", - MHD_HTTP_NOT_FOUND, - "EUR:5", - "EUR:0.01", - "deposit-refund-to-fail"), + MHD_HTTP_NOT_FOUND, + "EUR:5", + "EUR:0.01", + "deposit-refund-to-fail"), TALER_TESTING_cmd_refund ("refund-insufficient-funds", - MHD_HTTP_PRECONDITION_FAILED, - "EUR:50", - "EUR:0.01", - "deposit-refund-1"), + MHD_HTTP_PRECONDITION_FAILED, + "EUR:50", + "EUR:0.01", + "deposit-refund-1"), TALER_TESTING_cmd_refund ("refund-fee-too-low", - MHD_HTTP_BAD_REQUEST, - "EUR:5", - "EUR:0.000001", - "deposit-refund-1"), + MHD_HTTP_BAD_REQUEST, + "EUR:5", + "EUR:0.000001", + "deposit-refund-1"), TALER_TESTING_cmd_end () }; @@ -341,7 +343,7 @@ purge_process (struct GNUNET_OS_Process *process) int main (int argc, - char * const *argv) + char *const *argv) { unsigned int ret; /* These environment variables get in the way... */ @@ -351,12 +353,12 @@ main (int argc, "DEBUG", NULL); if (NULL == (fakebank_url = TALER_TESTING_prepare_fakebank - (CONFIG_FILE, - "account-2"))) + (CONFIG_FILE, + "account-2"))) return 77; if (NULL == (twister_url = TALER_TESTING_prepare_twister - (CONFIG_FILE))) + (CONFIG_FILE))) return 77; TALER_TESTING_cleanup_files (CONFIG_FILE); @@ -374,7 +376,7 @@ main (int argc, case GNUNET_OK: if (NULL == (twisterd = TALER_TESTING_run_twister - (CONFIG_FILE))) + (CONFIG_FILE))) return 77; ret = TALER_TESTING_setup_with_exchange (&run, diff --git a/src/lib/testing_api_cmd_bank_check.c b/src/lib/testing_api_cmd_bank_check.c index 67dbc0e19..0006b6e5e 100644 --- a/src/lib/testing_api_cmd_bank_check.c +++ b/src/lib/testing_api_cmd_bank_check.c @@ -53,7 +53,7 @@ struct BankCheckState * Expected debit bank account. */ uint64_t debit_account; - + /** * Expected credit bank account. */ @@ -133,7 +133,7 @@ check_bank_transfer_run (void *cls, bcs->deposit_reference, bcs->deposit_reference); deposit_cmd = TALER_TESTING_interpreter_lookup_command - (is, bcs->deposit_reference); + (is, bcs->deposit_reference); if (NULL == deposit_cmd) TALER_TESTING_FAIL (is); @@ -181,10 +181,10 @@ check_bank_transfer_run (void *cls, static void check_bank_transfer_cleanup (void *cls, - const struct TALER_TESTING_Command *cmd) + const struct TALER_TESTING_Command *cmd) { struct BankCheckState *bcs = cls; - + GNUNET_free_non_null (bcs->subject); GNUNET_free (bcs); } @@ -204,14 +204,14 @@ check_bank_transfer_traits (void *cls, const char *trait, unsigned int index) { - struct BankCheckState *bcs = cls; + struct BankCheckState *bcs = cls; struct TALER_WireTransferIdentifierRawP *wtid_ptr; if (GNUNET_OK != GNUNET_STRINGS_string_to_data - (bcs->subject, - strlen (bcs->subject), - &bcs->wtid, - sizeof (struct TALER_WireTransferIdentifierRawP))) + (bcs->subject, + strlen (bcs->subject), + &bcs->wtid, + sizeof (struct TALER_WireTransferIdentifierRawP))) wtid_ptr = NULL; else wtid_ptr = &bcs->wtid; @@ -227,7 +227,7 @@ check_bank_transfer_traits (void *cls, ret, trait, index); -} +} @@ -247,10 +247,10 @@ check_bank_transfer_traits (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_check_bank_transfer (const char *label, - const char *exchange_base_url, - const char *amount, - uint64_t debit_account, - uint64_t credit_account) + const char *exchange_base_url, + const char *amount, + uint64_t debit_account, + uint64_t credit_account) { struct BankCheckState *bcs; @@ -282,7 +282,7 @@ TALER_TESTING_cmd_check_bank_transfer static void check_bank_empty_cleanup (void *cls, - const struct TALER_TESTING_Command *cmd) + const struct TALER_TESTING_Command *cmd) { return; } @@ -304,7 +304,7 @@ check_bank_empty_run (void *cls, { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); - return; + return; } TALER_TESTING_interpreter_next (is); } @@ -321,7 +321,7 @@ check_bank_empty_traits (void *cls, unsigned int index) { return GNUNET_SYSERR; -} +} /** @@ -342,7 +342,7 @@ TALER_TESTING_cmd_check_bank_empty (const char *label) .cleanup = &check_bank_empty_cleanup, .traits = &check_bank_empty_traits }; - + return cmd; } @@ -361,7 +361,7 @@ TALER_TESTING_cmd_check_bank_empty (const char *label) struct TALER_TESTING_Command TALER_TESTING_cmd_check_bank_transfer_with_ref (const char *label, - const char *deposit_reference) + const char *deposit_reference) { struct BankCheckState *bcs; diff --git a/src/lib/testing_api_cmd_batch.c b/src/lib/testing_api_cmd_batch.c index b1a6a3e01..f5fbc8117 100644 --- a/src/lib/testing_api_cmd_batch.c +++ b/src/lib/testing_api_cmd_batch.c @@ -91,7 +91,7 @@ batch_cleanup (void *cls, { struct BatchState *bs = cls; - for (unsigned int i=0; + for (unsigned int i = 0; NULL != bs->batch[i].label; i++) bs->batch[i].cleanup (bs->batch[i].cls, @@ -158,7 +158,7 @@ TALER_TESTING_cmd_batch (const char *label, bs = GNUNET_new (struct BatchState); /* Get number of commands. */ - for (i=0;NULL != batch[i].label;i++) + for (i = 0; NULL != batch[i].label; i++) /* noop */ ; diff --git a/src/lib/testing_api_cmd_check_keys.c b/src/lib/testing_api_cmd_check_keys.c index ff9647ad8..a0b61c1b0 100644 --- a/src/lib/testing_api_cmd_check_keys.c +++ b/src/lib/testing_api_cmd_check_keys.c @@ -116,12 +116,12 @@ check_keys_run (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Triggering GET /keys, cmd `%s'\n", cmd->label); - + if (GNUNET_YES == cks->set_last_denom) { TALER_LOG_DEBUG ("Forcing last_denom_date URL argument\n"); TALER_EXCHANGE_set_last_denom (is->exchange, - cks->last_denom_date); + cks->last_denom_date); } if (GNUNET_YES == cks->with_now) @@ -131,8 +131,8 @@ check_keys_run (void *cls, GNUNET_break (0 == TALER_EXCHANGE_check_keys_current (is->exchange, - GNUNET_YES, - cks->pull_all_keys).abs_value_us); + GNUNET_YES, + cks->pull_all_keys).abs_value_us); return; } @@ -215,9 +215,9 @@ check_keys_cleanup (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_check_keys_with_last_denom (const char *label, - unsigned int generation, - unsigned int num_denom_keys, - struct GNUNET_TIME_Absolute last_denom_date) + unsigned int generation, + unsigned int num_denom_keys, + struct GNUNET_TIME_Absolute last_denom_date) { struct CheckKeysState *cks; @@ -256,8 +256,8 @@ TALER_TESTING_cmd_check_keys_with_last_denom struct TALER_TESTING_Command TALER_TESTING_cmd_check_keys (const char *label, - unsigned int generation, - unsigned int num_denom_keys) + unsigned int generation, + unsigned int num_denom_keys) { struct CheckKeysState *cks; @@ -295,9 +295,9 @@ TALER_TESTING_cmd_check_keys struct TALER_TESTING_Command TALER_TESTING_cmd_check_keys_with_now (const char *label, - unsigned int generation, - unsigned int num_denom_keys, - struct GNUNET_TIME_Absolute now) + unsigned int generation, + unsigned int num_denom_keys, + struct GNUNET_TIME_Absolute now) { struct CheckKeysState *cks; @@ -341,8 +341,8 @@ TALER_TESTING_cmd_check_keys_with_now struct TALER_TESTING_Command TALER_TESTING_cmd_check_keys_pull_all_keys (const char *label, - unsigned int generation, - unsigned int num_denom_keys) + unsigned int generation, + unsigned int num_denom_keys) { struct CheckKeysState *cks; diff --git a/src/lib/testing_api_cmd_deposit.c b/src/lib/testing_api_cmd_deposit.c index d6e3ef548..84fba8f31 100644 --- a/src/lib/testing_api_cmd_deposit.c +++ b/src/lib/testing_api_cmd_deposit.c @@ -191,21 +191,21 @@ deposit_cb (void *cls, { if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || - (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) + (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Retrying deposit failed with %u/%d\n", http_status, (int) ec); - /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) - ds->backoff = GNUNET_TIME_UNIT_ZERO; - else - ds->backoff = EXCHANGE_LIB_BACKOFF (ds->backoff); - ds->retry_task - = GNUNET_SCHEDULER_add_delayed (ds->backoff, - &do_retry, - ds); + /* on DB conflicts, do not use backoff */ + if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) + ds->backoff = GNUNET_TIME_UNIT_ZERO; + else + ds->backoff = EXCHANGE_LIB_BACKOFF (ds->backoff); + ds->retry_task + = GNUNET_SCHEDULER_add_delayed (ds->backoff, + &do_retry, + ds); return; } } @@ -260,8 +260,8 @@ deposit_run (void *cls, GNUNET_assert (ds->coin_reference); coin_cmd = TALER_TESTING_interpreter_lookup_command - (is, - ds->coin_reference); + (is, + ds->coin_reference); if (NULL == coin_cmd) { GNUNET_break (0); @@ -274,26 +274,26 @@ deposit_run (void *cls, GNUNET_assert (NULL != coin_cmd); GNUNET_assert (GNUNET_OK - == TALER_TESTING_get_trait_coin_priv (coin_cmd, - ds->coin_index, - &coin_priv)); + == TALER_TESTING_get_trait_coin_priv (coin_cmd, + ds->coin_index, + &coin_priv)); GNUNET_assert (GNUNET_OK - == TALER_TESTING_get_trait_denom_pub (coin_cmd, - ds->coin_index, - &denom_pub)); + == TALER_TESTING_get_trait_denom_pub (coin_cmd, + ds->coin_index, + &denom_pub)); GNUNET_assert (GNUNET_OK - == TALER_TESTING_get_trait_denom_sig (coin_cmd, - ds->coin_index, - &denom_pub_sig)); + == TALER_TESTING_get_trait_denom_sig (coin_cmd, + ds->coin_index, + &denom_pub_sig)); if (GNUNET_OK != TALER_string_to_amount (ds->amount, &amount)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to parse amount `%s' at '%u/%s'\n", - ds->amount, is->ip, this_cmd->label); + ds->amount, is->ip, this_cmd->label); TALER_TESTING_interpreter_fail (is); return; } @@ -315,17 +315,17 @@ deposit_run (void *cls, refund_deadline = GNUNET_TIME_absolute_get_remaining (ds->refund_deadline); wire_deadline = GNUNET_TIME_relative_to_absolute - (GNUNET_TIME_relative_multiply (refund_deadline, 2)); + (GNUNET_TIME_relative_multiply (refund_deadline, 2)); } else { ds->refund_deadline = ds->timestamp; wire_deadline = GNUNET_TIME_relative_to_absolute - (GNUNET_TIME_UNIT_ZERO); + (GNUNET_TIME_UNIT_ZERO); } GNUNET_CRYPTO_eddsa_key_get_public (&ds->merchant_priv.eddsa_priv, - &merchant_pub.eddsa_pub); + &merchant_pub.eddsa_pub); (void) GNUNET_TIME_round_abs (&wire_deadline); @@ -334,42 +334,42 @@ deposit_run (void *cls, memset (&dr, 0, sizeof (dr)); dr.purpose.size = htonl - (sizeof (struct TALER_DepositRequestPS)); + (sizeof (struct TALER_DepositRequestPS)); dr.purpose.purpose = htonl - (TALER_SIGNATURE_WALLET_COIN_DEPOSIT); + (TALER_SIGNATURE_WALLET_COIN_DEPOSIT); dr.h_contract_terms = h_contract_terms; GNUNET_assert (GNUNET_OK == - TALER_JSON_merchant_wire_signature_hash (ds->wire_details, - &dr.h_wire)); + TALER_JSON_merchant_wire_signature_hash (ds->wire_details, + &dr.h_wire)); dr.timestamp = GNUNET_TIME_absolute_hton (ds->timestamp); dr.refund_deadline = GNUNET_TIME_absolute_hton - (ds->refund_deadline); + (ds->refund_deadline); TALER_amount_hton (&dr.amount_with_fee, &amount); TALER_amount_hton (&dr.deposit_fee, &denom_pub->fee_deposit); dr.merchant = merchant_pub; dr.coin_pub = coin_pub; GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign - (&coin_priv->eddsa_priv, - &dr.purpose, - &coin_sig.eddsa_signature)); + (&coin_priv->eddsa_priv, + &dr.purpose, + &coin_sig.eddsa_signature)); } ds->dh = TALER_EXCHANGE_deposit - (is->exchange, - &amount, - wire_deadline, - ds->wire_details, - &h_contract_terms, - &coin_pub, - denom_pub_sig, - &denom_pub->key, - ds->timestamp, - &merchant_pub, - ds->refund_deadline, - &coin_sig, - &deposit_cb, - ds); + (is->exchange, + &amount, + wire_deadline, + ds->wire_details, + &h_contract_terms, + &coin_pub, + denom_pub_sig, + &denom_pub->key, + ds->timestamp, + &merchant_pub, + ds->refund_deadline, + &coin_sig, + &deposit_cb, + ds); if (NULL == ds->dh) { @@ -436,8 +436,8 @@ deposit_traits (void *cls, const struct TALER_CoinSpendPrivateKeyP *coin_spent_priv; coin_cmd = TALER_TESTING_interpreter_lookup_command - (ds->is, - ds->coin_reference); + (ds->is, + ds->coin_reference); if (NULL == coin_cmd) { @@ -510,13 +510,13 @@ deposit_traits (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_deposit (const char *label, - const char *coin_reference, - unsigned int coin_index, - json_t *wire_details, - const char *contract_terms, - struct GNUNET_TIME_Relative refund_deadline, - const char *amount, - unsigned int expected_response_code) + const char *coin_reference, + unsigned int coin_index, + json_t *wire_details, + const char *contract_terms, + struct GNUNET_TIME_Relative refund_deadline, + const char *amount, + unsigned int expected_response_code) { struct DepositState *ds; @@ -531,9 +531,9 @@ TALER_TESTING_cmd_deposit { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to parse contract terms `%s' for CMD `%s'\n", - contract_terms, - label); + "Failed to parse contract terms `%s' for CMD `%s'\n", + contract_terms, + label); GNUNET_assert (0); } ds->timestamp = GNUNET_TIME_absolute_get (); diff --git a/src/lib/testing_api_cmd_exec_auditor-sign.c b/src/lib/testing_api_cmd_exec_auditor-sign.c index db58b44c9..1a722ad2f 100644 --- a/src/lib/testing_api_cmd_exec_auditor-sign.c +++ b/src/lib/testing_api_cmd_exec_auditor-sign.c @@ -74,7 +74,7 @@ auditor_sign_run (void *cls, cfg = GNUNET_CONFIGURATION_create (); if (GNUNET_OK != GNUNET_CONFIGURATION_load - (cfg, ass->config_filename)) + (cfg, ass->config_filename)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -99,9 +99,9 @@ auditor_sign_run (void *cls, now = GNUNET_TIME_absolute_get (); GNUNET_asprintf (&ass->signed_keys_out, - "%s/.local/share/taler/auditors/auditor-%llu.out", - test_home_dir, - (unsigned long long) now.abs_value_us); + "%s/.local/share/taler/auditors/auditor-%llu.out", + test_home_dir, + (unsigned long long) now.abs_value_us); GNUNET_free (test_home_dir); if (GNUNET_OK != @@ -123,17 +123,17 @@ auditor_sign_run (void *cls, GNUNET_CONFIGURATION_destroy (cfg); ass->auditor_sign_proc = GNUNET_OS_start_process - (GNUNET_NO, - GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-auditor-sign", - "taler-auditor-sign", - "-c", ass->config_filename, - "-u", "http://auditor/", - "-m", exchange_master_pub, - "-r", "auditor.in", - "-o", ass->signed_keys_out, - NULL); + (GNUNET_NO, + GNUNET_OS_INHERIT_STD_ALL, + NULL, NULL, NULL, + "taler-auditor-sign", + "taler-auditor-sign", + "-c", ass->config_filename, + "-u", "http://auditor/", + "-m", exchange_master_pub, + "-r", "auditor.in", + "-o", ass->signed_keys_out, + NULL); GNUNET_free (exchange_master_pub); if (NULL == ass->auditor_sign_proc) { @@ -161,7 +161,7 @@ auditor_sign_cleanup (void *cls, if (NULL != ass->auditor_sign_proc) { GNUNET_break (0 == GNUNET_OS_process_kill - (ass->auditor_sign_proc, SIGKILL)); + (ass->auditor_sign_proc, SIGKILL)); GNUNET_OS_process_wait (ass->auditor_sign_proc); GNUNET_OS_process_destroy (ass->auditor_sign_proc); ass->auditor_sign_proc = NULL; diff --git a/src/lib/testing_api_cmd_exec_keyup.c b/src/lib/testing_api_cmd_exec_keyup.c index e457a28e6..65f23693e 100644 --- a/src/lib/testing_api_cmd_exec_keyup.c +++ b/src/lib/testing_api_cmd_exec_keyup.c @@ -77,28 +77,28 @@ keyup_run (void *cls, if (GNUNET_YES == ks->with_now) { - ks->keyup_proc = GNUNET_OS_start_process - (GNUNET_NO, - GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-exchange-keyup", - "taler-exchange-keyup", - "-c", ks->config_filename, - "-o", "auditor.in", - "--time", - GNUNET_STRINGS_absolute_time_to_string (ks->now), - NULL); + ks->keyup_proc = GNUNET_OS_start_process + (GNUNET_NO, + GNUNET_OS_INHERIT_STD_ALL, + NULL, NULL, NULL, + "taler-exchange-keyup", + "taler-exchange-keyup", + "-c", ks->config_filename, + "-o", "auditor.in", + "--time", + GNUNET_STRINGS_absolute_time_to_string (ks->now), + NULL); } else ks->keyup_proc = GNUNET_OS_start_process - (GNUNET_NO, - GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-exchange-keyup", - "taler-exchange-keyup", - "-c", ks->config_filename, - "-o", "auditor.in", - NULL); + (GNUNET_NO, + GNUNET_OS_INHERIT_STD_ALL, + NULL, NULL, NULL, + "taler-exchange-keyup", + "taler-exchange-keyup", + "-c", ks->config_filename, + "-o", "auditor.in", + NULL); if (NULL == ks->keyup_proc) { @@ -180,8 +180,8 @@ keyup_traits (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_exec_keyup_with_now (const char *label, - const char *config_filename, - struct GNUNET_TIME_Absolute now) + const char *config_filename, + struct GNUNET_TIME_Absolute now) { struct KeyupState *ks; diff --git a/src/lib/testing_api_cmd_exec_wirewatch.c b/src/lib/testing_api_cmd_exec_wirewatch.c index a81bf5c2b..c9ca42549 100644 --- a/src/lib/testing_api_cmd_exec_wirewatch.c +++ b/src/lib/testing_api_cmd_exec_wirewatch.c @@ -58,8 +58,8 @@ struct WirewatchState */ static void wirewatch_run (void *cls, - const struct TALER_TESTING_Command *cmd, - struct TALER_TESTING_Interpreter *is) + const struct TALER_TESTING_Command *cmd, + struct TALER_TESTING_Interpreter *is) { struct WirewatchState *ws = cls; diff --git a/src/lib/testing_api_cmd_fakebank_transfer.c b/src/lib/testing_api_cmd_fakebank_transfer.c index 570dee37a..729536b56 100644 --- a/src/lib/testing_api_cmd_fakebank_transfer.c +++ b/src/lib/testing_api_cmd_fakebank_transfer.c @@ -209,23 +209,23 @@ add_incoming_cb (void *cls, { if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || - (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) + (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Retrying fakebank transfer failed with %u/%d\n", - http_status, - (int) ec); - /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) - fts->backoff = GNUNET_TIME_UNIT_ZERO; - else - fts->backoff = EXCHANGE_LIB_BACKOFF (fts->backoff); - fts->retry_task = GNUNET_SCHEDULER_add_delayed - (fts->backoff, - &do_retry, - fts); - return; + "Retrying fakebank transfer failed with %u/%d\n", + http_status, + (int) ec); + /* on DB conflicts, do not use backoff */ + if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) + fts->backoff = GNUNET_TIME_UNIT_ZERO; + else + fts->backoff = EXCHANGE_LIB_BACKOFF (fts->backoff); + fts->retry_task = GNUNET_SCHEDULER_add_delayed + (fts->backoff, + &do_retry, + fts); + return; } } GNUNET_break (0); @@ -273,7 +273,7 @@ fakebank_transfer_run (void *cls, const struct TALER_ReservePrivateKeyP *reserve_priv; ref = TALER_TESTING_interpreter_lookup_command - (is, fts->reserve_reference); + (is, fts->reserve_reference); if (NULL == ref) { GNUNET_break (0); @@ -317,9 +317,9 @@ fakebank_transfer_run (void *cls, if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, - section, - "TIP_RESERVE_PRIV_FILENAME", - &keys)) + section, + "TIP_RESERVE_PRIV_FILENAME", + &keys)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Configuration fails to specify reserve" @@ -335,9 +335,9 @@ fakebank_transfer_run (void *cls, { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, - section, - "TIP_RESERVE_PRIV_FILENAME", - "Failed to read private key"); + section, + "TIP_RESERVE_PRIV_FILENAME", + "Failed to read private key"); GNUNET_free (section); TALER_TESTING_interpreter_fail (is); return; @@ -349,19 +349,19 @@ fakebank_transfer_run (void *cls, } else { - /* No referenced reserve, no instance to take priv - * from, no explicit subject given: create new key! */ - struct GNUNET_CRYPTO_EddsaPrivateKey *priv; + /* No referenced reserve, no instance to take priv + * from, no explicit subject given: create new key! */ + struct GNUNET_CRYPTO_EddsaPrivateKey *priv; - priv = GNUNET_CRYPTO_eddsa_key_create (); - fts->reserve_priv.eddsa_priv = *priv; - GNUNET_free (priv); + priv = GNUNET_CRYPTO_eddsa_key_create (); + fts->reserve_priv.eddsa_priv = *priv; + GNUNET_free (priv); } } GNUNET_CRYPTO_eddsa_key_get_public (&fts->reserve_priv.eddsa_priv, &reserve_pub.eddsa_pub); subject = GNUNET_STRINGS_data_to_string_alloc - (&reserve_pub, sizeof (reserve_pub)); + (&reserve_pub, sizeof (reserve_pub)); } auth.method = TALER_BANK_AUTH_BASIC; @@ -369,16 +369,16 @@ fakebank_transfer_run (void *cls, auth.details.basic.password = (char *) fts->auth_password; fts->is = is; fts->aih = TALER_BANK_admin_add_incoming - (TALER_TESTING_interpreter_get_context (is), - fts->bank_url, - &auth, - fts->exchange_url, - subject, - &fts->amount, - fts->debit_account_no, - fts->credit_account_no, - &add_incoming_cb, - fts); + (TALER_TESTING_interpreter_get_context (is), + fts->bank_url, + &auth, + fts->exchange_url, + subject, + &fts->amount, + fts->debit_account_no, + fts->credit_account_no, + &add_incoming_cb, + fts); GNUNET_free (subject); if (NULL == fts->aih) { @@ -456,9 +456,9 @@ fakebank_transfer_traits (void *cls, /* A reserve priv must exist if no subject was given. */ else traits[MANDATORY - 1] = TALER_TESTING_make_trait_reserve_priv - (0, &fts->reserve_priv), + (0, &fts->reserve_priv), - traits[MANDATORY] = TALER_TESTING_trait_end (); + traits[MANDATORY] = TALER_TESTING_trait_end (); return TALER_TESTING_get_trait (traits, ret, @@ -491,13 +491,13 @@ fakebank_transfer_traits (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_fakebank_transfer (const char *label, - const char *amount, - const char *bank_url, - uint64_t debit_account_no, - uint64_t credit_account_no, - const char *auth_username, - const char *auth_password, - const char *exchange_url) + const char *amount, + const char *bank_url, + uint64_t debit_account_no, + uint64_t credit_account_no, + const char *auth_username, + const char *auth_password, + const char *exchange_url) { struct FakebankTransferState *fts; @@ -556,14 +556,14 @@ TALER_TESTING_cmd_fakebank_transfer struct TALER_TESTING_Command TALER_TESTING_cmd_fakebank_transfer_with_subject (const char *label, - const char *amount, - const char *bank_url, - uint64_t debit_account_no, - uint64_t credit_account_no, - const char *auth_username, - const char *auth_password, - const char *subject, - const char *exchange_url) + const char *amount, + const char *bank_url, + uint64_t debit_account_no, + uint64_t credit_account_no, + const char *auth_username, + const char *auth_password, + const char *subject, + const char *exchange_url) { struct FakebankTransferState *fts; @@ -629,14 +629,14 @@ TALER_TESTING_cmd_fakebank_transfer_with_subject struct TALER_TESTING_Command TALER_TESTING_cmd_fakebank_transfer_with_ref (const char *label, - const char *amount, - const char *bank_url, - uint64_t debit_account_no, - uint64_t credit_account_no, - const char *auth_username, - const char *auth_password, - const char *ref, - const char *exchange_url) + const char *amount, + const char *bank_url, + uint64_t debit_account_no, + uint64_t credit_account_no, + const char *auth_username, + const char *auth_password, + const char *ref, + const char *exchange_url) { struct FakebankTransferState *fts; @@ -703,15 +703,15 @@ TALER_TESTING_cmd_fakebank_transfer_with_ref struct TALER_TESTING_Command TALER_TESTING_cmd_fakebank_transfer_with_instance (const char *label, - const char *amount, - const char *bank_url, - uint64_t debit_account_no, - uint64_t credit_account_no, - const char *auth_username, - const char *auth_password, - const char *instance, - const char *exchange_url, - const char *config_filename) + const char *amount, + const char *bank_url, + uint64_t debit_account_no, + uint64_t credit_account_no, + const char *auth_username, + const char *auth_password, + const char *instance, + const char *exchange_url, + const char *config_filename) { struct FakebankTransferState *fts; diff --git a/src/lib/testing_api_cmd_payback.c b/src/lib/testing_api_cmd_payback.c index de394fe26..c69d1d089 100644 --- a/src/lib/testing_api_cmd_payback.c +++ b/src/lib/testing_api_cmd_payback.c @@ -209,7 +209,7 @@ payback_cb (void *cls, } reserve_cmd = TALER_TESTING_interpreter_lookup_command - (is, cref); + (is, cref); GNUNET_free (cref); if (NULL == reserve_cmd) @@ -289,7 +289,7 @@ payback_cb (void *cls, return; } if (GNUNET_OK != TALER_TESTING_get_trait_reserve_priv - (reserve_cmd, idx, &reserve_priv)) + (reserve_cmd, idx, &reserve_priv)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -348,7 +348,7 @@ payback_run (void *cls, } coin_cmd = TALER_TESTING_interpreter_lookup_command - (is, cref); + (is, cref); GNUNET_free (cref); if (NULL == coin_cmd) @@ -359,7 +359,7 @@ payback_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv - (coin_cmd, idx, &coin_priv)) + (coin_cmd, idx, &coin_priv)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -367,7 +367,7 @@ payback_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_blinding_key - (coin_cmd, idx, &blinding_key)) + (coin_cmd, idx, &blinding_key)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -377,7 +377,7 @@ payback_run (void *cls, planchet.blinding_key = *blinding_key; if (GNUNET_OK != TALER_TESTING_get_trait_denom_pub - (coin_cmd, idx, &denom_pub)) + (coin_cmd, idx, &denom_pub)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -385,7 +385,7 @@ payback_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_denom_sig - (coin_cmd, idx, &coin_sig)) + (coin_cmd, idx, &coin_sig)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -423,7 +423,7 @@ revoke_cleanup (void *cls, if (NULL != rs->revoke_proc) { GNUNET_break (0 == GNUNET_OS_process_kill - (rs->revoke_proc, SIGKILL)); + (rs->revoke_proc, SIGKILL)); GNUNET_OS_process_wait (rs->revoke_proc); GNUNET_OS_process_destroy (rs->revoke_proc); rs->revoke_proc = NULL; @@ -506,7 +506,7 @@ revoke_run (void *cls, rs->is = is; /* Get denom pub from trait */ coin_cmd = TALER_TESTING_interpreter_lookup_command - (is, rs->coin_reference); + (is, rs->coin_reference); if (NULL == coin_cmd) { @@ -516,24 +516,24 @@ revoke_run (void *cls, } GNUNET_assert (GNUNET_OK == TALER_TESTING_get_trait_denom_pub - (coin_cmd, 0, &denom_pub)); + (coin_cmd, 0, &denom_pub)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Trying to revoke denom '%s..'\n", TALER_B2S (&denom_pub->h_key)); rs->dhks = GNUNET_STRINGS_data_to_string_alloc - (&denom_pub->h_key, sizeof (struct GNUNET_HashCode)); + (&denom_pub->h_key, sizeof (struct GNUNET_HashCode)); rs->revoke_proc = GNUNET_OS_start_process - (GNUNET_NO, - GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "taler-exchange-keyup", - "taler-exchange-keyup", - "-c", rs->config_filename, - "-r", rs->dhks, - NULL); + (GNUNET_NO, + GNUNET_OS_INHERIT_STD_ALL, + NULL, NULL, NULL, + "taler-exchange-keyup", + "taler-exchange-keyup", + "-c", rs->config_filename, + "-r", rs->dhks, + NULL); if (NULL == rs->revoke_proc) { diff --git a/src/lib/testing_api_cmd_refresh.c b/src/lib/testing_api_cmd_refresh.c index b2754edd8..5d1472a01 100644 --- a/src/lib/testing_api_cmd_refresh.c +++ b/src/lib/testing_api_cmd_refresh.c @@ -304,7 +304,7 @@ reveal_cb (void *cls, { if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || - (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) + (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Retrying refresh reveal failed with %u/%d\n", @@ -333,7 +333,7 @@ reveal_cb (void *cls, return; } melt_cmd = TALER_TESTING_interpreter_lookup_command - (rrs->is, rrs->melt_reference); + (rrs->is, rrs->melt_reference); if (NULL == melt_cmd) { GNUNET_break (0); @@ -345,8 +345,8 @@ reveal_cb (void *cls, { case MHD_HTTP_OK: rrs->fresh_coins = GNUNET_new_array - (num_coins, struct TALER_TESTING_FreshCoinData); - for (unsigned int i=0; ifresh_coins[i]; @@ -362,7 +362,7 @@ reveal_cb (void *cls, fc->coin_priv = coin_privs[i].coin_priv; fc->blinding_key = coin_privs[i].blinding_key; fc->sig.rsa_signature = GNUNET_CRYPTO_rsa_signature_dup - (sigs[i].rsa_signature); + (sigs[i].rsa_signature); } break; default: @@ -392,7 +392,7 @@ refresh_reveal_run (void *cls, rrs->is = is; melt_cmd = TALER_TESTING_interpreter_lookup_command - (is, rrs->melt_reference); + (is, rrs->melt_reference); if (NULL == melt_cmd) { @@ -402,11 +402,11 @@ refresh_reveal_run (void *cls, } rms = melt_cmd->cls; rrs->rrh = TALER_EXCHANGE_refresh_reveal - (is->exchange, - rms->refresh_data_length, - rms->refresh_data, - rms->noreveal_index, - &reveal_cb, rrs); + (is->exchange, + rms->refresh_data_length, + rms->refresh_data, + rms->noreveal_index, + &reveal_cb, rrs); if (NULL == rrs->rrh) { @@ -446,7 +446,7 @@ refresh_reveal_cleanup (void *cls, rrs->retry_task = NULL; } - for (unsigned int j=0; j < rrs->num_fresh_coins; j++) + for (unsigned int j = 0; j < rrs->num_fresh_coins; j++) GNUNET_CRYPTO_rsa_signature_free (rrs->fresh_coins[j].sig.rsa_signature); GNUNET_free_non_null (rrs->fresh_coins); @@ -530,18 +530,18 @@ link_cb (void *cls, { if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || - (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) + (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Retrying refresh link failed with %u/%d\n", http_status, (int) ec); - /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) - rls->backoff = GNUNET_TIME_UNIT_ZERO; - else - rls->backoff = EXCHANGE_LIB_BACKOFF (rls->backoff); - rls->retry_task = GNUNET_SCHEDULER_add_delayed (rls->backoff, + /* on DB conflicts, do not use backoff */ + if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) + rls->backoff = GNUNET_TIME_UNIT_ZERO; + else + rls->backoff = EXCHANGE_LIB_BACKOFF (rls->backoff); + rls->retry_task = GNUNET_SCHEDULER_add_delayed (rls->backoff, &do_link_retry, rls); return; @@ -559,7 +559,7 @@ link_cb (void *cls, return; } reveal_cmd = TALER_TESTING_interpreter_lookup_command - (rls->is, rls->reveal_reference); + (rls->is, rls->reveal_reference); if (NULL == reveal_cmd) { @@ -573,7 +573,7 @@ link_cb (void *cls, case MHD_HTTP_OK: /* check that number of coins returned matches */ if (GNUNET_OK != TALER_TESTING_get_trait_uint - (reveal_cmd, 0, &num_fresh_coins)) + (reveal_cmd, 0, &num_fresh_coins)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (rls->is); @@ -586,15 +586,15 @@ link_cb (void *cls, num_coins, *num_fresh_coins, __FILE__, - __LINE__); + __LINE__); TALER_TESTING_interpreter_fail (rls->is); return; } /* check that the coins match */ - for (unsigned int i=0;iis); return; } - for (unsigned int i=0;ikey.rsa_public_key, - pubs[j].rsa_public_key)) ) + (fc[i].pk->key.rsa_public_key, + pubs[j].rsa_public_key)) ) { found++; break; @@ -630,7 +630,7 @@ link_cb (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Only %u/%u coins match expectations\n", - found, num_coins); + found, num_coins); GNUNET_break (0); TALER_TESTING_interpreter_fail (rls->is); return; @@ -666,7 +666,7 @@ refresh_link_run (void *cls, rls->is = is; reveal_cmd = TALER_TESTING_interpreter_lookup_command - (rls->is, rls->reveal_reference); + (rls->is, rls->reveal_reference); if (NULL == reveal_cmd) { @@ -676,7 +676,7 @@ refresh_link_run (void *cls, } rrs = reveal_cmd->cls; melt_cmd = TALER_TESTING_interpreter_lookup_command - (rls->is, rrs->melt_reference); + (rls->is, rrs->melt_reference); if (NULL == melt_cmd) { @@ -689,7 +689,7 @@ refresh_link_run (void *cls, { rms = melt_cmd->cls; coin_cmd = TALER_TESTING_interpreter_lookup_command - (rls->is, rms->coin_reference); + (rls->is, rms->coin_reference); if (NULL == coin_cmd) { GNUNET_break (0); @@ -700,7 +700,7 @@ refresh_link_run (void *cls, const struct TALER_CoinSpendPrivateKeyP *coin_priv; if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv - (coin_cmd, 0, &coin_priv)) + (coin_cmd, 0, &coin_priv)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (rls->is); @@ -709,7 +709,7 @@ refresh_link_run (void *cls, /* finally, use private key from withdraw sign command */ rls->rlh = TALER_EXCHANGE_refresh_link - (is->exchange, coin_priv, &link_cb, rls); + (is->exchange, coin_priv, &link_cb, rls); if (NULL == rls->rlh) { @@ -812,32 +812,32 @@ melt_cb (void *cls, { if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || - (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) + (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Retrying refresh melt failed with %u/%d\n", http_status, (int) ec); - /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) - rms->backoff = GNUNET_TIME_UNIT_ZERO; - else - rms->backoff = EXCHANGE_LIB_BACKOFF (rms->backoff); - rms->retry_task = GNUNET_SCHEDULER_add_delayed - (rms->backoff, - &do_melt_retry, - rms); + /* on DB conflicts, do not use backoff */ + if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) + rms->backoff = GNUNET_TIME_UNIT_ZERO; + else + rms->backoff = EXCHANGE_LIB_BACKOFF (rms->backoff); + rms->retry_task = GNUNET_SCHEDULER_add_delayed + (rms->backoff, + &do_melt_retry, + rms); return; } } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u/%d to command %s in %s:%u\n", - http_status, - (int) ec, - rms->is->commands[rms->is->ip].label, - __FILE__, - __LINE__); + "Unexpected response code %u/%d to command %s in %s:%u\n", + http_status, + (int) ec, + rms->is->commands[rms->is->ip].label, + __FILE__, + __LINE__); json_dumpf (full_response, stderr, 0); TALER_TESTING_interpreter_fail (rms->is); return; @@ -849,8 +849,8 @@ melt_cb (void *cls, TALER_LOG_DEBUG ("Doubling the melt (%s)\n", rms->is->commands[rms->is->ip].label); rms->rmh = TALER_EXCHANGE_refresh_melt - (rms->is->exchange, rms->refresh_data_length, - rms->refresh_data, &melt_cb, rms); + (rms->is->exchange, rms->refresh_data_length, + rms->refresh_data, &melt_cb, rms); rms->double_melt = GNUNET_NO; return; } @@ -882,13 +882,13 @@ refresh_melt_run (void *cls, melt_fresh_amounts = default_melt_fresh_amounts; rms->is = is; rms->noreveal_index = UINT16_MAX; - for (num_fresh_coins=0; + for (num_fresh_coins = 0; NULL != melt_fresh_amounts[num_fresh_coins]; - num_fresh_coins++) ; + num_fresh_coins++); rms->num_fresh_coins = num_fresh_coins; rms->fresh_pks = GNUNET_new_array - (num_fresh_coins, - struct TALER_EXCHANGE_DenomPublicKey); + (num_fresh_coins, + struct TALER_EXCHANGE_DenomPublicKey); { struct TALER_Amount melt_amount; struct TALER_Amount fresh_amount; @@ -897,8 +897,8 @@ refresh_melt_run (void *cls, const struct TALER_TESTING_Command *coin_command; if (NULL == (coin_command - = TALER_TESTING_interpreter_lookup_command - (is, rms->coin_reference))) + = TALER_TESTING_interpreter_lookup_command + (is, rms->coin_reference))) { GNUNET_break (0); TALER_TESTING_interpreter_fail (rms->is); @@ -906,7 +906,7 @@ refresh_melt_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv - (coin_command, 0, &rms->melt_priv)) + (coin_command, 0, &rms->melt_priv)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (rms->is); @@ -923,7 +923,7 @@ refresh_melt_run (void *cls, return; } if (GNUNET_OK != TALER_TESTING_get_trait_denom_pub - (coin_command, 0, &melt_denom_pub)) + (coin_command, 0, &melt_denom_pub)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (rms->is); @@ -932,12 +932,12 @@ refresh_melt_run (void *cls, /* Melt amount starts with the melt fee of the old coin; we'll add the values and withdraw fees of the fresh coins next */ melt_amount = melt_denom_pub->fee_refresh; - for (unsigned int i=0;iexchange), &fresh_amount); + (TALER_EXCHANGE_get_keys (is->exchange), &fresh_amount); if (NULL == fresh_pk) { GNUNET_break (0); @@ -966,9 +966,10 @@ refresh_melt_run (void *cls, rms->fresh_pks[i] = *fresh_pk; } rms->refresh_data = TALER_EXCHANGE_refresh_prepare - (rms->melt_priv, &melt_amount, melt_sig, melt_denom_pub, - GNUNET_YES, num_fresh_coins, rms->fresh_pks, - &rms->refresh_data_length); + (rms->melt_priv, &melt_amount, melt_sig, + melt_denom_pub, + GNUNET_YES, num_fresh_coins, rms->fresh_pks, + &rms->refresh_data_length); if (NULL == rms->refresh_data) { @@ -977,8 +978,8 @@ refresh_melt_run (void *cls, return; } rms->rmh = TALER_EXCHANGE_refresh_melt - (is->exchange, rms->refresh_data_length, - rms->refresh_data, &melt_cb, rms); + (is->exchange, rms->refresh_data_length, + rms->refresh_data, &melt_cb, rms); if (NULL == rms->rmh) { @@ -1126,9 +1127,9 @@ parse_amounts (struct RefreshMeltState *rms, struct TALER_TESTING_Command TALER_TESTING_cmd_refresh_melt (const char *label, - const char *coin_reference, - unsigned int expected_response_code, - ...) + const char *coin_reference, + unsigned int expected_response_code, + ...) { struct RefreshMeltState *rms; va_list ap; @@ -1170,9 +1171,9 @@ TALER_TESTING_cmd_refresh_melt struct TALER_TESTING_Command TALER_TESTING_cmd_refresh_melt_double (const char *label, - const char *coin_reference, - unsigned int expected_response_code, - ...) + const char *coin_reference, + unsigned int expected_response_code, + ...) { struct RefreshMeltState *rms; va_list ap; @@ -1239,30 +1240,30 @@ refresh_reveal_traits (void *cls, struct TALER_TESTING_Trait traits[NUM_TRAITS]; /* Making coin privs traits */ - for (unsigned int i=0; ifresh_coins[i].coin_priv); + (i, &rrs->fresh_coins[i].coin_priv); /* Making denom pubs traits */ - for (unsigned int i=0; ifresh_coins[i].pk); + (i, rrs->fresh_coins[i].pk); /* Making denom sigs traits */ - for (unsigned int i=0; ifresh_coins[i].sig); + (i, &rrs->fresh_coins[i].sig); /* blinding key traits */ - for (unsigned int i=0; ifresh_coins[i].blinding_key), - /* number of fresh coins */ - traits[(num_coins * 4)] = TALER_TESTING_make_trait_uint - (0, &rrs->num_fresh_coins); + /* number of fresh coins */ + traits[(num_coins * 4)] = TALER_TESTING_make_trait_uint + (0, &rrs->num_fresh_coins); /* whole array of fresh coins */ traits[(num_coins * 4) + 1] @@ -1291,8 +1292,8 @@ refresh_reveal_traits (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_refresh_reveal (const char *label, - const char *melt_reference, - unsigned int expected_response_code) + const char *melt_reference, + unsigned int expected_response_code) { struct RefreshRevealState *rrs; @@ -1343,8 +1344,8 @@ TALER_TESTING_cmd_refresh_reveal_with_retry (struct TALER_TESTING_Command cmd) struct TALER_TESTING_Command TALER_TESTING_cmd_refresh_link (const char *label, - const char *reveal_reference, - unsigned int expected_response_code) + const char *reveal_reference, + unsigned int expected_response_code) { struct RefreshLinkState *rrs; diff --git a/src/lib/testing_api_cmd_refund.c b/src/lib/testing_api_cmd_refund.c index 55f329dd0..91085f364 100644 --- a/src/lib/testing_api_cmd_refund.c +++ b/src/lib/testing_api_cmd_refund.c @@ -92,7 +92,7 @@ struct RefundState static void refund_cb (void *cls, unsigned int http_status, - enum TALER_ErrorCode ec, + enum TALER_ErrorCode ec, const struct TALER_ExchangePublicKeyP *exchange_pub, const json_t *obj) { @@ -169,7 +169,7 @@ refund_run (void *cls, } coin_cmd = TALER_TESTING_interpreter_lookup_command - (is, rs->coin_reference); + (is, rs->coin_reference); if (NULL == coin_cmd) { @@ -179,7 +179,7 @@ refund_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_contract_terms - (coin_cmd, 0, &contract_terms)) + (coin_cmd, 0, &contract_terms)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -192,7 +192,7 @@ refund_run (void *cls, /* Hunting for a coin .. */ if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv - (coin_cmd, 0, &coin_priv)) + (coin_cmd, 0, &coin_priv)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -202,7 +202,7 @@ refund_run (void *cls, GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv, &coin.eddsa_pub); if (GNUNET_OK != TALER_TESTING_get_trait_peer_key - (coin_cmd, 0, &merchant_priv)) + (coin_cmd, 0, &merchant_priv)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -210,14 +210,14 @@ refund_run (void *cls, } rs->rh = TALER_EXCHANGE_refund - (rs->exchange, - &refund_amount, - &refund_fee, - &h_contract_terms, - &coin, - rs->refund_transaction_id, - (const struct TALER_MerchantPrivateKeyP *) merchant_priv, - &refund_cb, rs); + (rs->exchange, + &refund_amount, + &refund_fee, + &h_contract_terms, + &coin, + rs->refund_transaction_id, + (const struct TALER_MerchantPrivateKeyP *) merchant_priv, + &refund_cb, rs); GNUNET_assert (NULL != rs->rh); } @@ -307,11 +307,11 @@ TALER_TESTING_cmd_refund (const char *label, struct TALER_TESTING_Command TALER_TESTING_cmd_refund_with_id (const char *label, - unsigned int expected_response_code, - const char *refund_amount, - const char *refund_fee, - const char *coin_reference, - uint64_t refund_transaction_id) + unsigned int expected_response_code, + const char *refund_amount, + const char *refund_fee, + const char *coin_reference, + uint64_t refund_transaction_id) { struct RefundState *rs; diff --git a/src/lib/testing_api_cmd_serialize_keys.c b/src/lib/testing_api_cmd_serialize_keys.c index bacd041a7..7ef03fe5d 100644 --- a/src/lib/testing_api_cmd_serialize_keys.c +++ b/src/lib/testing_api_cmd_serialize_keys.c @@ -96,7 +96,7 @@ serialize_keys_run (void *cls, TALER_TESTING_interpreter_fail (is); sks->exchange_url = GNUNET_strdup - (TALER_EXCHANGE_get_base_url (is->exchange)); + (TALER_EXCHANGE_get_base_url (is->exchange)); TALER_EXCHANGE_disconnect (is->exchange); is->exchange = NULL; is->working = GNUNET_NO; @@ -182,7 +182,7 @@ connect_with_state_run (void *cls, cwss->is = is; state_cmd = TALER_TESTING_interpreter_lookup_command - (is, cwss->state_reference); + (is, cwss->state_reference); /* Command providing serialized keys not found. */ if (NULL == state_cmd) @@ -195,27 +195,27 @@ connect_with_state_run (void *cls, GNUNET_assert (GNUNET_OK == TALER_TESTING_get_trait_exchange_keys (state_cmd, - 0, - &serialized_keys)); + 0, + &serialized_keys)); TALER_LOG_DEBUG ("Serialized key-state: %s\n", json_dumps (serialized_keys, JSON_INDENT (1))); GNUNET_assert - (GNUNET_OK == TALER_TESTING_get_trait_url - (state_cmd, - 0, - &exchange_url)); + (GNUNET_OK == TALER_TESTING_get_trait_url + (state_cmd, + 0, + &exchange_url)); is->exchange = TALER_EXCHANGE_connect - (is->ctx, - exchange_url, - TALER_TESTING_cert_cb, - cwss, - TALER_EXCHANGE_OPTION_DATA, - serialized_keys, - TALER_EXCHANGE_OPTION_END); + (is->ctx, + exchange_url, + TALER_TESTING_cert_cb, + cwss, + TALER_EXCHANGE_OPTION_DATA, + serialized_keys, + TALER_EXCHANGE_OPTION_END); cwss->consumed = GNUNET_YES; } @@ -231,7 +231,7 @@ connect_with_state_run (void *cls, static void connect_with_state_cleanup (void *cls, - const struct TALER_TESTING_Command *cmd) + const struct TALER_TESTING_Command *cmd) { struct ConnectWithStateState *cwss = cls; diff --git a/src/lib/testing_api_cmd_signal.c b/src/lib/testing_api_cmd_signal.c index f4fd8bb76..5a6332947 100644 --- a/src/lib/testing_api_cmd_signal.c +++ b/src/lib/testing_api_cmd_signal.c @@ -59,7 +59,7 @@ signal_run (void *cls, struct SignalState *ss = cls; GNUNET_break (0 == GNUNET_OS_process_kill - (ss->process, ss->signal)); + (ss->process, ss->signal)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Signaling '%d'..\n", ss->signal); diff --git a/src/lib/testing_api_cmd_sleep.c b/src/lib/testing_api_cmd_sleep.c index 188671bee..326f38b53 100644 --- a/src/lib/testing_api_cmd_sleep.c +++ b/src/lib/testing_api_cmd_sleep.c @@ -183,13 +183,13 @@ wait_service_run (void *cls, if (10 == iter++) { TALER_LOG_ERROR ("Could not reach the proxied service\n"); - TALER_TESTING_interpreter_fail (is); + TALER_TESTING_interpreter_fail (is); GNUNET_free (wget_cmd); - return; + return; } } while (0 != system (wget_cmd)); - + GNUNET_free (wget_cmd); TALER_TESTING_interpreter_next (is); } @@ -214,7 +214,7 @@ TALER_TESTING_cmd_wait_service (const char *label, .traits = wait_service_traits, .cls = (void *) url }; - + return cmd; } diff --git a/src/lib/testing_api_cmd_status.c b/src/lib/testing_api_cmd_status.c index 40c8c550b..0dcea1233 100644 --- a/src/lib/testing_api_cmd_status.c +++ b/src/lib/testing_api_cmd_status.c @@ -76,12 +76,12 @@ struct StatusState static void reserve_status_cb (void *cls, - unsigned int http_status, - enum TALER_ErrorCode ec, - const json_t *json, - const struct TALER_Amount *balance, - unsigned int history_length, - const struct TALER_EXCHANGE_ReserveHistory *history) + unsigned int http_status, + enum TALER_ErrorCode ec, + const json_t *json, + const struct TALER_Amount *balance, + unsigned int history_length, + const struct TALER_EXCHANGE_ReserveHistory *history) { struct StatusState *ss = cls; struct TALER_Amount eb; @@ -99,7 +99,7 @@ reserve_status_cb } GNUNET_assert (GNUNET_OK == TALER_string_to_amount - (ss->expected_balance, &eb)); + (ss->expected_balance, &eb)); if (0 != TALER_amount_cmp (&eb, balance)) { @@ -154,7 +154,7 @@ status_run (void *cls, create_reserve = TALER_TESTING_interpreter_lookup_command - (is, ss->reserve_reference); + (is, ss->reserve_reference); if (NULL == create_reserve) { @@ -166,9 +166,9 @@ status_run (void *cls, /* NOTE: the following line might generate a ERROR log * statements, but it can be ignored. */ if (GNUNET_OK == TALER_TESTING_get_trait_reserve_priv - (create_reserve, - 0, - &reserve_priv)) + (create_reserve, + 0, + &reserve_priv)) { GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv, &reserve_pub.eddsa_pub); @@ -178,9 +178,9 @@ status_run (void *cls, const char *transfer_subject; if (GNUNET_OK != TALER_TESTING_get_trait_transfer_subject - (create_reserve, - 0, - &transfer_subject)) + (create_reserve, + 0, + &transfer_subject)) { GNUNET_break (0); TALER_LOG_ERROR ("The reserve has neither a priv nor a subject line.\n"); diff --git a/src/lib/testing_api_cmd_track.c b/src/lib/testing_api_cmd_track.c index 1c2130839..e32d24ce2 100644 --- a/src/lib/testing_api_cmd_track.c +++ b/src/lib/testing_api_cmd_track.c @@ -158,13 +158,13 @@ struct TrackTransferState static void deposit_wtid_cb (void *cls, - unsigned int http_status, - enum TALER_ErrorCode ec, - const struct TALER_ExchangePublicKeyP *exchange_pub, - const json_t *json, - const struct TALER_WireTransferIdentifierRawP *wtid, - struct GNUNET_TIME_Absolute execution_time, - const struct TALER_Amount *coin_contribution) + unsigned int http_status, + enum TALER_ErrorCode ec, + const struct TALER_ExchangePublicKeyP *exchange_pub, + const json_t *json, + const struct TALER_WireTransferIdentifierRawP *wtid, + struct GNUNET_TIME_Absolute execution_time, + const struct TALER_Amount *coin_contribution) { struct TrackTransactionState *tts = cls; struct TALER_TESTING_Interpreter *is = tts->is; @@ -197,7 +197,7 @@ deposit_wtid_cb sizeof (*wtid)); bank_transfer_cmd = TALER_TESTING_interpreter_lookup_command - (is, tts->bank_transfer_reference); + (is, tts->bank_transfer_reference); if (NULL == bank_transfer_cmd) { @@ -210,8 +210,8 @@ deposit_wtid_cb const char *transfer_subject; if (GNUNET_OK != - TALER_TESTING_get_trait_transfer_subject - (bank_transfer_cmd, 0, &transfer_subject)) + TALER_TESTING_get_trait_transfer_subject + (bank_transfer_cmd, 0, &transfer_subject)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -268,7 +268,7 @@ track_transaction_run (void *cls, tts->is = is; transaction_cmd = TALER_TESTING_interpreter_lookup_command - (tts->is, tts->transaction_reference); + (tts->is, tts->transaction_reference); if (NULL == transaction_cmd) { @@ -278,7 +278,7 @@ track_transaction_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_coin_priv - (transaction_cmd, tts->coin_index, &coin_priv)) + (transaction_cmd, tts->coin_index, &coin_priv)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (tts->is); @@ -290,7 +290,7 @@ track_transaction_run (void *cls, /* Get the strings.. */ if (GNUNET_OK != TALER_TESTING_get_trait_wire_details - (transaction_cmd, 0, &wire_details)) + (transaction_cmd, 0, &wire_details)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (tts->is); @@ -298,7 +298,7 @@ track_transaction_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_contract_terms - (transaction_cmd, 0, &contract_terms)) + (transaction_cmd, 0, &contract_terms)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (tts->is); @@ -317,12 +317,12 @@ track_transaction_run (void *cls, ( (GNUNET_OK == TALER_JSON_merchant_wire_signature_hash (wire_details, &h_wire_details)) && - (GNUNET_OK == - TALER_JSON_hash (contract_terms, - &h_contract_terms)) ); + (GNUNET_OK == + TALER_JSON_hash (contract_terms, + &h_contract_terms)) ); if (GNUNET_OK != TALER_TESTING_get_trait_peer_key - (transaction_cmd, 0, &merchant_priv)) + (transaction_cmd, 0, &merchant_priv)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (tts->is); @@ -330,13 +330,13 @@ track_transaction_run (void *cls, } tts->tth = TALER_EXCHANGE_track_transaction - (is->exchange, - (struct TALER_MerchantPrivateKeyP *) merchant_priv, - &h_wire_details, - &h_contract_terms, - &coin_pub, - &deposit_wtid_cb, - tts); + (is->exchange, + (struct TALER_MerchantPrivateKeyP *) merchant_priv, + &h_wire_details, + &h_contract_terms, + &coin_pub, + &deposit_wtid_cb, + tts); GNUNET_assert (NULL != tts->tth); } @@ -352,7 +352,7 @@ track_transaction_run (void *cls, static void track_transaction_cleanup (void *cls, - const struct TALER_TESTING_Command *cmd) + const struct TALER_TESTING_Command *cmd) { struct TrackTransactionState *tts = cls; @@ -415,10 +415,10 @@ track_transaction_traits (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_track_transaction (const char *label, - const char *transaction_reference, - unsigned int coin_index, - unsigned int expected_response_code, - const char *bank_transfer_reference) + const char *transaction_reference, + unsigned int coin_index, + unsigned int expected_response_code, + const char *bank_transfer_reference) { struct TrackTransactionState *tts; @@ -494,16 +494,16 @@ track_transfer_cleanup (void *cls, static void track_transfer_cb (void *cls, - unsigned int http_status, - enum TALER_ErrorCode ec, - const struct TALER_ExchangePublicKeyP *exchange_pub, - const json_t *json, - const struct GNUNET_HashCode *h_wire, - struct GNUNET_TIME_Absolute execution_time, - const struct TALER_Amount *total_amount, - const struct TALER_Amount *wire_fee, - unsigned int details_length, - const struct TALER_TrackTransferDetails *details) + unsigned int http_status, + enum TALER_ErrorCode ec, + const struct TALER_ExchangePublicKeyP *exchange_pub, + const json_t *json, + const struct GNUNET_HashCode *h_wire, + struct GNUNET_TIME_Absolute execution_time, + const struct TALER_Amount *total_amount, + const struct TALER_Amount *wire_fee, + unsigned int details_length, + const struct TALER_TrackTransferDetails *details) { struct TrackTransferState *tts = cls; struct TALER_TESTING_Interpreter *is = tts->is; @@ -598,8 +598,8 @@ track_transfer_cb struct GNUNET_HashCode h_wire_details; if (NULL == (wire_details_cmd - = TALER_TESTING_interpreter_lookup_command - (is, tts->wire_details_reference))) + = TALER_TESTING_interpreter_lookup_command + (is, tts->wire_details_reference))) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -618,8 +618,8 @@ track_transfer_cb GNUNET_assert (GNUNET_OK == - TALER_JSON_merchant_wire_signature_hash (wire_details, - &h_wire_details)); + TALER_JSON_merchant_wire_signature_hash (wire_details, + &h_wire_details)); if (0 != GNUNET_memcmp (&h_wire_details, h_wire)) @@ -639,8 +639,8 @@ track_transfer_cb struct TALER_Amount total_amount_from_reference; if (NULL == (total_amount_cmd - = TALER_TESTING_interpreter_lookup_command - (is, tts->total_amount_reference))) + = TALER_TESTING_interpreter_lookup_command + (is, tts->total_amount_reference))) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -648,7 +648,7 @@ track_transfer_cb } if (GNUNET_OK != TALER_TESTING_get_trait_amount - (total_amount_cmd, 0, &total_amount_from_reference_str)) + (total_amount_cmd, 0, &total_amount_from_reference_str)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -656,8 +656,8 @@ track_transfer_cb } GNUNET_assert (GNUNET_OK == TALER_string_to_amount - (total_amount_from_reference_str, - &total_amount_from_reference)); + (total_amount_from_reference_str, + &total_amount_from_reference)); if (0 != TALER_amount_cmp (total_amount, &total_amount_from_reference)) @@ -702,7 +702,7 @@ track_transfer_run (void *cls, const struct TALER_TESTING_Command *wtid_cmd; wtid_cmd = TALER_TESTING_interpreter_lookup_command - (tts->is, tts->wtid_reference); + (tts->is, tts->wtid_reference); if (NULL == wtid_cmd) { @@ -712,7 +712,7 @@ track_transfer_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_wtid - (wtid_cmd, tts->index, &wtid_ptr)) + (wtid_cmd, tts->index, &wtid_ptr)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (tts->is); @@ -747,9 +747,9 @@ track_transfer_run (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_track_transfer_empty (const char *label, - const char *wtid_reference, - unsigned int index, - unsigned int expected_response_code) + const char *wtid_reference, + unsigned int index, + unsigned int expected_response_code) { struct TrackTransferState *tts; @@ -788,11 +788,11 @@ TALER_TESTING_cmd_track_transfer_empty struct TALER_TESTING_Command TALER_TESTING_cmd_track_transfer (const char *label, - const char *wtid_reference, - unsigned int index, - unsigned int expected_response_code, - const char *expected_total_amount, - const char *expected_wire_fee) + const char *wtid_reference, + unsigned int index, + unsigned int expected_response_code, + const char *expected_total_amount, + const char *expected_wire_fee) { struct TrackTransferState *tts; diff --git a/src/lib/testing_api_cmd_wire.c b/src/lib/testing_api_cmd_wire.c index 113545499..e2a8d7f1f 100644 --- a/src/lib/testing_api_cmd_wire.c +++ b/src/lib/testing_api_cmd_wire.c @@ -85,7 +85,7 @@ struct WireState static void wire_cb (void *cls, unsigned int http_status, - enum TALER_ErrorCode ec, + enum TALER_ErrorCode ec, unsigned int accounts_len, const struct TALER_EXCHANGE_WireAccount *accounts) { @@ -105,7 +105,7 @@ wire_cb (void *cls, if (MHD_HTTP_OK == http_status) { - for (unsigned int i=0;iexpected_fee, - &expected_fee)); - const struct TALER_EXCHANGE_WireAggregateFees *waf; + TALER_string_to_amount (ws->expected_fee, + &expected_fee)); + const struct TALER_EXCHANGE_WireAggregateFees *waf; for (waf = accounts[i].fees; NULL != waf; waf = waf->next) diff --git a/src/lib/testing_api_cmd_withdraw.c b/src/lib/testing_api_cmd_withdraw.c index 41cd22249..92b587b5a 100644 --- a/src/lib/testing_api_cmd_withdraw.c +++ b/src/lib/testing_api_cmd_withdraw.c @@ -133,8 +133,8 @@ do_retry (void *cls) ws->retry_task = NULL; withdraw_run (ws, - NULL, - ws->is); + NULL, + ws->is); } @@ -152,7 +152,7 @@ do_retry (void *cls) static void reserve_withdraw_cb (void *cls, unsigned int http_status, - enum TALER_ErrorCode ec, + enum TALER_ErrorCode ec, const struct TALER_DenominationSignature *sig, const json_t *full_response) { @@ -166,23 +166,23 @@ reserve_withdraw_cb (void *cls, { if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || - (TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS == ec) || - (TALER_EC_WITHDRAW_RESERVE_UNKNOWN == ec) || - (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) + (TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS == ec) || + (TALER_EC_WITHDRAW_RESERVE_UNKNOWN == ec) || + (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Retrying withdraw failed with %u/%d\n", http_status, (int) ec); - /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) - ws->backoff = GNUNET_TIME_UNIT_ZERO; - else - ws->backoff = EXCHANGE_LIB_BACKOFF (ws->backoff); - ws->retry_task = GNUNET_SCHEDULER_add_delayed (ws->backoff, - &do_retry, - ws); - return; + /* on DB conflicts, do not use backoff */ + if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) + ws->backoff = GNUNET_TIME_UNIT_ZERO; + else + ws->backoff = EXCHANGE_LIB_BACKOFF (ws->backoff); + ws->retry_task = GNUNET_SCHEDULER_add_delayed (ws->backoff, + &do_retry, + ws); + return; } } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -244,7 +244,7 @@ withdraw_run (void *cls, (void) cmd; create_reserve = TALER_TESTING_interpreter_lookup_command - (is, ws->reserve_reference); + (is, ws->reserve_reference); if (NULL == create_reserve) { GNUNET_break (0); @@ -264,8 +264,8 @@ withdraw_run (void *cls, ws->is = is; ws->pk = TALER_TESTING_find_pk - (TALER_EXCHANGE_get_keys (is->exchange), - &ws->amount); + (TALER_EXCHANGE_get_keys (is->exchange), + &ws->amount); if (NULL == ws->pk) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -349,7 +349,7 @@ withdraw_traits (void *cls, /* We offer the reserve key where these coins were withdrawn * from. */ reserve_cmd = TALER_TESTING_interpreter_lookup_command - (ws->is, ws->reserve_reference); + (ws->is, ws->reserve_reference); if (NULL == reserve_cmd) { @@ -359,7 +359,7 @@ withdraw_traits (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_reserve_priv - (reserve_cmd, 0, &reserve_priv)) + (reserve_cmd, 0, &reserve_priv)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (ws->is); @@ -407,9 +407,9 @@ withdraw_traits (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_withdraw_amount (const char *label, - const char *reserve_reference, - const char *amount, - unsigned int expected_response_code) + const char *reserve_reference, + const char *amount, + unsigned int expected_response_code) { struct WithdrawState *ws; @@ -457,9 +457,9 @@ TALER_TESTING_cmd_withdraw_amount struct TALER_TESTING_Command TALER_TESTING_cmd_withdraw_denomination (const char *label, - const char *reserve_reference, - const struct TALER_EXCHANGE_DenomPublicKey *dk, - unsigned int expected_response_code) + const char *reserve_reference, + const struct TALER_EXCHANGE_DenomPublicKey *dk, + unsigned int expected_response_code) { struct WithdrawState *ws; diff --git a/src/lib/testing_api_helpers.c b/src/lib/testing_api_helpers.c index 0f2575d98..84221c065 100644 --- a/src/lib/testing_api_helpers.c +++ b/src/lib/testing_api_helpers.c @@ -41,8 +41,8 @@ TALER_TESTING_cleanup_files (const char *config_name) { if (GNUNET_OK != GNUNET_CONFIGURATION_parse_and_run (config_name, - &TALER_TESTING_cleanup_files_cfg, - NULL)) + &TALER_TESTING_cleanup_files_cfg, + NULL)) exit (77); } @@ -56,19 +56,19 @@ TALER_TESTING_cleanup_files (const char *config_name) */ int TALER_TESTING_cleanup_files_cfg (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) + const struct GNUNET_CONFIGURATION_Handle *cfg) { char *dir; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, - "exchange", - "keydir", - &dir)) + "exchange", + "keydir", + &dir)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "exchange", - "keydir"); + "exchange", + "keydir"); return GNUNET_SYSERR; } if (GNUNET_YES == @@ -91,7 +91,7 @@ TALER_TESTING_cleanup_files_cfg (void *cls, */ int TALER_TESTING_run_keyup (const char *config_filename, - const char *output_filename) + const char *output_filename) { struct GNUNET_OS_Process *proc; @@ -106,7 +106,7 @@ TALER_TESTING_run_keyup (const char *config_filename, if (NULL == proc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to run `taler-exchange-keyup`, is your PATH correct?\n"); + "Failed to run `taler-exchange-keyup`, is your PATH correct?\n"); return GNUNET_SYSERR; } GNUNET_OS_process_wait (proc); @@ -127,10 +127,10 @@ TALER_TESTING_run_keyup (const char *config_filename, */ int TALER_TESTING_run_auditor_sign (const char *config_filename, - const char *exchange_master_pub, - const char *auditor_base_url, - const char *signdata_in, - const char *signdata_out) + const char *exchange_master_pub, + const char *auditor_base_url, + const char *signdata_in, + const char *signdata_out) { struct GNUNET_OS_Process *proc; @@ -148,7 +148,7 @@ TALER_TESTING_run_auditor_sign (const char *config_filename, if (NULL == proc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to run `taler-auditor-sign`, is your PATH correct?\n"); + "Failed to run `taler-auditor-sign`, is your PATH correct?\n"); return GNUNET_SYSERR; } GNUNET_OS_process_wait (proc); @@ -195,7 +195,7 @@ TALER_TESTING_run_auditor_exchange (const char *config_filename, if (NULL == proc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to run `taler-auditor-exchange`, is your PATH correct?\n"); + "Failed to run `taler-auditor-exchange`, is your PATH correct?\n"); return GNUNET_SYSERR; } GNUNET_assert (GNUNET_OK == @@ -207,7 +207,7 @@ TALER_TESTING_run_auditor_exchange (const char *config_filename, (GNUNET_OS_PROCESS_EXITED != type) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "taler-auditor-exchange terminated with error (%d/%d)\n", + "taler-auditor-exchange terminated with error (%d/%d)\n", (int) type, (int) code); return GNUNET_SYSERR; @@ -240,7 +240,7 @@ TALER_TESTING_exchange_db_reset (const char *config_filename) if (NULL == proc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to run `taler-exchange-dbinit`, is your PATH correct?\n"); + "Failed to run `taler-exchange-dbinit`, is your PATH correct?\n"); return GNUNET_NO; } if (GNUNET_SYSERR == @@ -257,7 +257,7 @@ TALER_TESTING_exchange_db_reset (const char *config_filename) (0 != code) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to setup (exchange) database, exit code %d\n", + "Failed to setup (exchange) database, exit code %d\n", (int) code); return GNUNET_NO; } @@ -265,7 +265,7 @@ TALER_TESTING_exchange_db_reset (const char *config_filename) (0 != code) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected error (%d/%d) running `taler-exchange-dbinit'!\n", + "Unexpected error (%d/%d) running `taler-exchange-dbinit'!\n", (int) type, (int) code); return GNUNET_SYSERR; @@ -298,7 +298,7 @@ TALER_TESTING_auditor_db_reset (const char *config_filename) if (NULL == proc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to run `taler-auditor-dbinit`, is your PATH correct?\n"); + "Failed to run `taler-auditor-dbinit`, is your PATH correct?\n"); return GNUNET_NO; } if (GNUNET_SYSERR == @@ -315,7 +315,7 @@ TALER_TESTING_auditor_db_reset (const char *config_filename) (0 != code) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to setup (auditor) database, exit code %d\n", + "Failed to setup (auditor) database, exit code %d\n", (int) code); return GNUNET_NO; } @@ -323,7 +323,7 @@ TALER_TESTING_auditor_db_reset (const char *config_filename) (0 != code) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected error (%d/%d) running `taler-auditor-dbinit'!\n", + "Unexpected error (%d/%d) running `taler-auditor-dbinit'!\n", (int) type, (int) code); return GNUNET_SYSERR; @@ -373,7 +373,7 @@ struct SignInfo */ static int sign_keys_for_exchange (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) + const struct GNUNET_CONFIGURATION_Handle *cfg) { struct SignInfo *si = cls; char *test_home_dir; @@ -460,10 +460,10 @@ sign_keys_for_exchange (void *cls, if (GNUNET_OK != TALER_TESTING_run_auditor_sign (si->config_filename, - exchange_master_pub, - si->auditor_base_url, - si->auditor_sign_input_filename, - signed_keys_out)) + exchange_master_pub, + si->auditor_base_url, + si->auditor_sign_input_filename, + signed_keys_out)) { GNUNET_free (si->exchange_base_url); GNUNET_free (si->auditor_base_url); @@ -495,8 +495,8 @@ sign_keys_for_exchange (void *cls, */ int TALER_TESTING_prepare_exchange (const char *config_filename, - char **auditor_base_url, - char **exchange_base_url) + char **auditor_base_url, + char **exchange_base_url) { struct SignInfo si = { .config_filename = config_filename, @@ -507,7 +507,7 @@ TALER_TESTING_prepare_exchange (const char *config_filename, if (GNUNET_OK != TALER_TESTING_run_keyup (config_filename, - si.auditor_sign_input_filename)) + si.auditor_sign_input_filename)) return GNUNET_NO; if (GNUNET_OK != TALER_TESTING_exchange_db_reset (config_filename)) @@ -517,8 +517,8 @@ TALER_TESTING_prepare_exchange (const char *config_filename, return GNUNET_NO; if (GNUNET_OK != GNUNET_CONFIGURATION_parse_and_run (config_filename, - &sign_keys_for_exchange, - &si)) + &sign_keys_for_exchange, + &si)) return GNUNET_NO; *exchange_base_url = si.exchange_base_url; *auditor_base_url = si.auditor_base_url; @@ -542,7 +542,7 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys, char *str; now = GNUNET_TIME_absolute_get (); - for (unsigned int i=0;inum_denom_keys;i++) + for (unsigned int i = 0; inum_denom_keys; i++) { pk = &keys->denom_keys[i]; if ( (0 == TALER_amount_cmp (amount, @@ -555,7 +555,7 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys, /* do 2nd pass to check if expiration times are to blame for * failure */ str = TALER_amount_to_string (amount); - for (unsigned int i=0;inum_denom_keys;i++) + for (unsigned int i = 0; inum_denom_keys; i++) { pk = &keys->denom_keys[i]; if ( (0 == TALER_amount_cmp (amount, @@ -566,13 +566,13 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Have denomination key for `%s', but with wrong" - " expiration range %llu vs [%llu,%llu)\n", - str, - (unsigned long long) now.abs_value_us, - (unsigned long long) pk->valid_from.abs_value_us, - (unsigned long long) - pk->withdraw_valid_until.abs_value_us); + "Have denomination key for `%s', but with wrong" + " expiration range %llu vs [%llu,%llu)\n", + str, + (unsigned long long) now.abs_value_us, + (unsigned long long) pk->valid_from.abs_value_us, + (unsigned long long) + pk->withdraw_valid_until.abs_value_us); GNUNET_free (str); return NULL; } @@ -609,18 +609,18 @@ TALER_TESTING_wait_exchange_ready (const char *base_url) wget_cmd); iter = 0; do + { + if (10 == iter) { - if (10 == iter) - { - fprintf (stderr, - "Failed to launch `taler-exchange-httpd' (or `wget')\n"); - GNUNET_free (wget_cmd); - return 77; - } - fprintf (stderr, ".\n"); - sleep (1); - iter++; + fprintf (stderr, + "Failed to launch `taler-exchange-httpd' (or `wget')\n"); + GNUNET_free (wget_cmd); + return 77; } + fprintf (stderr, ".\n"); + sleep (1); + iter++; + } while (0 != system (wget_cmd)); GNUNET_free (wget_cmd); return 0; @@ -650,18 +650,18 @@ TALER_TESTING_wait_auditor_ready (const char *base_url) "Waiting for `taler-auditor-httpd' to be ready\n"); iter = 0; do + { + if (10 == iter) { - if (10 == iter) - { - fprintf (stderr, - "Failed to launch `taler-auditor-httpd' (or `wget')\n"); - GNUNET_free (wget_cmd); - return 77; - } - fprintf (stderr, ".\n"); - sleep (1); - iter++; + fprintf (stderr, + "Failed to launch `taler-auditor-httpd' (or `wget')\n"); + GNUNET_free (wget_cmd); + return 77; } + fprintf (stderr, ".\n"); + sleep (1); + iter++; + } while (0 != system (wget_cmd)); GNUNET_free (wget_cmd); return 0; @@ -695,7 +695,8 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb, if (GNUNET_OK != (result = GNUNET_CONFIGURATION_parse_and_run (config_filename, - &TALER_TESTING_setup_with_exchange_cfg, + & + TALER_TESTING_setup_with_exchange_cfg, &setup_ctx))) return result; return GNUNET_OK; @@ -713,7 +714,8 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb, */ int TALER_TESTING_setup_with_exchange_cfg (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) + const struct + GNUNET_CONFIGURATION_Handle *cfg) { const struct TALER_TESTING_SetupContext *setup_ctx = cls; struct GNUNET_OS_Process *exchanged; @@ -751,7 +753,7 @@ TALER_TESTING_setup_with_exchange_cfg (void *cls, if (GNUNET_OK != GNUNET_NETWORK_test_port_free (IPPROTO_TCP, - (uint16_t) port)) + (uint16_t) port)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Required port %llu not available, skipping.\n", @@ -816,7 +818,9 @@ TALER_TESTING_setup_with_exchange_cfg (void *cls, */ int TALER_TESTING_setup_with_auditor_and_exchange_cfg (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) + const struct + GNUNET_CONFIGURATION_Handle * + cfg) { const struct TALER_TESTING_SetupContext *setup_ctx = cls; struct GNUNET_OS_Process *auditord; @@ -854,7 +858,7 @@ TALER_TESTING_setup_with_auditor_and_exchange_cfg (void *cls, if (GNUNET_OK != GNUNET_NETWORK_test_port_free (IPPROTO_TCP, - (uint16_t) port)) + (uint16_t) port)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Required port %llu not available, skipping.\n", @@ -937,7 +941,8 @@ TALER_TESTING_setup_with_auditor_and_exchange (TALER_TESTING_Main main_cb, }; return GNUNET_CONFIGURATION_parse_and_run (config_file, - &TALER_TESTING_setup_with_auditor_and_exchange_cfg, + & + TALER_TESTING_setup_with_auditor_and_exchange_cfg, &setup_ctx); } @@ -959,7 +964,7 @@ TALER_TESTING_url_port_free (const char *url) pnum = strtol (port + 1, NULL, 10); if (GNUNET_OK != GNUNET_NETWORK_test_port_free (IPPROTO_TCP, - pnum)) + pnum)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Port %u not available.\n", @@ -989,7 +994,7 @@ TALER_TESTING_make_wire_details (unsigned long long account_no, int ends_slash; if (0 < strlen (bank_url)) - ends_slash = '/' == bank_url[strlen(bank_url)-1]; + ends_slash = '/' == bank_url[strlen (bank_url) - 1]; else ends_slash = 0; @@ -1001,7 +1006,8 @@ TALER_TESTING_make_wire_details (unsigned long long account_no, account_no); ret = json_pack ("{s:s, s:s}", "url", payto, - "salt", "test-salt (must be constant for aggregation tests)"); + "salt", + "test-salt (must be constant for aggregation tests)"); GNUNET_free (payto); return ret; } @@ -1049,9 +1055,9 @@ TALER_TESTING_prepare_fakebank (const char *config_filename, { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, - config_section, - "URL", - "expected `x-taler-bank' payto://-URL"); + config_section, + "URL", + "expected `x-taler-bank' payto://-URL"); GNUNET_CONFIGURATION_destroy (cfg); GNUNET_free (payto_url); return NULL; diff --git a/src/lib/testing_api_loop.c b/src/lib/testing_api_loop.c index bebd159de..38139de25 100644 --- a/src/lib/testing_api_loop.c +++ b/src/lib/testing_api_loop.c @@ -47,7 +47,7 @@ static struct GNUNET_DISK_PipeHandle *sigpipe; const struct TALER_TESTING_Command * TALER_TESTING_interpreter_lookup_command (struct TALER_TESTING_Interpreter *is, - const char *label) + const char *label) { if (NULL == label) { @@ -56,7 +56,7 @@ TALER_TESTING_interpreter_lookup_command return NULL; } /* Search backwards as we most likely reference recent commands */ - for (int i=is->ip; i >= 0; i--) + for (int i = is->ip; i >= 0; i--) { const struct TALER_TESTING_Command *cmd = &is->commands[i]; @@ -75,7 +75,7 @@ TALER_TESTING_interpreter_lookup_command TALER_TESTING_get_trait_cmd (cmd, BATCH_INDEX, &batch)); - for (unsigned int j=0; + for (unsigned int j = 0; NULL != (cmd = &batch[j])->label; j++) { @@ -125,8 +125,8 @@ TALER_TESTING_interpreter_get_fakebank void TALER_TESTING_run_with_fakebank (struct TALER_TESTING_Interpreter *is, - struct TALER_TESTING_Command *commands, - const char *bank_url) + struct TALER_TESTING_Command *commands, + const char *bank_url) { const char *port; long pnum; @@ -183,8 +183,9 @@ TALER_TESTING_interpreter_next (struct TALER_TESTING_Interpreter *is) if (0 != ipc) GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Interpreter executed 1000 instructions in %s\n", - GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (last_report), - GNUNET_YES)); + GNUNET_STRINGS_relative_time_to_string ( + GNUNET_TIME_absolute_get_duration (last_report), + GNUNET_YES)); last_report = GNUNET_TIME_absolute_get (); } ipc++; @@ -208,12 +209,12 @@ TALER_TESTING_interpreter_fail "Failed at command `%s'\n", cmd->label); while (TALER_TESTING_cmd_is_batch (cmd)) - { - cmd = TALER_TESTING_cmd_batch_get_current (cmd); - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Batch is at command `%s'\n", - cmd->label); - } + { + cmd = TALER_TESTING_cmd_batch_get_current (cmd); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Batch is at command `%s'\n", + cmd->label); + } is->result = GNUNET_SYSERR; GNUNET_SCHEDULER_shutdown (); } @@ -301,7 +302,7 @@ do_shutdown (void *cls) "Executing shutdown at `%s'\n", label); - for (unsigned int j=0; + for (unsigned int j = 0; NULL != (cmd = &is->commands[j])->label; j++) cmd->cleanup (cmd->cls, @@ -433,7 +434,7 @@ maint_child_death (void *cls) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Triggering key state reload at exchange\n"); GNUNET_break (0 == GNUNET_OS_process_kill - (is->exchanged, SIGUSR1)); + (is->exchanged, SIGUSR1)); sleep (5); /* make sure signal was received and processed */ } } @@ -490,16 +491,16 @@ TALER_TESTING_run2 (struct TALER_TESTING_Interpreter *is, is->timeout_task = NULL; } /* get the number of commands */ - for (i=0;NULL != commands[i].label;i++) ; + for (i = 0; NULL != commands[i].label; i++); is->commands = GNUNET_new_array (i + 1, struct TALER_TESTING_Command); memcpy (is->commands, commands, sizeof (struct TALER_TESTING_Command) * i); is->timeout_task = GNUNET_SCHEDULER_add_delayed - (timeout, - &do_timeout, - is); + (timeout, + &do_timeout, + is); GNUNET_SCHEDULER_add_shutdown (&do_shutdown, is); is->task = GNUNET_SCHEDULER_add_now (&interpreter_run, is); } @@ -570,12 +571,13 @@ static void sighandler_child_death () { static char c; - int old_errno = errno; /* back-up errno */ + int old_errno = errno; /* back-up errno */ GNUNET_break (1 == GNUNET_DISK_file_write - (GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_WRITE), - &c, sizeof (c))); - errno = old_errno; /* restore errno */ + (GNUNET_DISK_pipe_handle (sigpipe, + GNUNET_DISK_PIPE_END_WRITE), + &c, sizeof (c))); + errno = old_errno; /* restore errno */ } @@ -591,8 +593,8 @@ sighandler_child_death () void TALER_TESTING_cert_cb (void *cls, - const struct TALER_EXCHANGE_Keys *keys, - enum TALER_EXCHANGE_VersionCompatibility compat) + const struct TALER_EXCHANGE_Keys *keys, + enum TALER_EXCHANGE_VersionCompatibility compat) { struct MainContext *main_ctx = cls; struct TALER_TESTING_Interpreter *is = main_ctx->is; @@ -603,23 +605,23 @@ TALER_TESTING_cert_cb { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Got NULL response for /keys" - " during startup, retrying!\n"); + "Got NULL response for /keys" + " during startup, retrying!\n"); TALER_EXCHANGE_disconnect (is->exchange); GNUNET_assert (NULL != (is->exchange = TALER_EXCHANGE_connect - (is->ctx, - main_ctx->exchange_url, - &TALER_TESTING_cert_cb, - main_ctx, - TALER_EXCHANGE_OPTION_END))); + (is->ctx, + main_ctx->exchange_url, + &TALER_TESTING_cert_cb, + main_ctx, + TALER_EXCHANGE_OPTION_END))); return; } else GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Got NULL response for /keys" - " during execution!\n"); + "Got NULL response for /keys" + " during execution!\n"); } else { @@ -705,7 +707,7 @@ do_abort (void *cls) static int main_exchange_connect_with_cfg (void *cls, - const struct GNUNET_CONFIGURATION_Handle *cfg) + const struct GNUNET_CONFIGURATION_Handle *cfg) { struct MainContext *main_ctx = cls; struct TALER_TESTING_Interpreter *is = main_ctx->is; @@ -725,14 +727,14 @@ main_exchange_connect_with_cfg main_ctx->exchange_url = exchange_url; is->cfg = cfg; is->timeout_task = GNUNET_SCHEDULER_add_shutdown (&do_abort, - main_ctx); + main_ctx); GNUNET_break (NULL != (is->exchange = TALER_EXCHANGE_connect - (is->ctx, - exchange_url, - &TALER_TESTING_cert_cb, - main_ctx, - TALER_EXCHANGE_OPTION_END))); + (is->ctx, + exchange_url, + &TALER_TESTING_cert_cb, + main_ctx, + TALER_EXCHANGE_OPTION_END))); is->cfg = NULL; return GNUNET_OK; } @@ -751,7 +753,8 @@ main_wrapper_exchange_connect (void *cls) GNUNET_break (GNUNET_OK == GNUNET_CONFIGURATION_parse_and_run (main_ctx->config_filename, - &main_exchange_connect_with_cfg, + & + main_exchange_connect_with_cfg, main_ctx)); } @@ -802,11 +805,11 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb, GNUNET_NO, GNUNET_NO); GNUNET_assert (NULL != sigpipe); shc_chld = GNUNET_SIGNAL_handler_install - (GNUNET_SIGCHLD, - &sighandler_child_death); + (GNUNET_SIGCHLD, + &sighandler_child_death); is.ctx = GNUNET_CURL_init - (&GNUNET_CURL_gnunet_scheduler_reschedule, - &is.rc); + (&GNUNET_CURL_gnunet_scheduler_reschedule, + &is.rc); GNUNET_CURL_enable_async_scope_header (is.ctx, "Taler-Correlation-Id"); GNUNET_assert (NULL != is.ctx); is.rc = GNUNET_CURL_gnunet_rc_create (is.ctx); @@ -817,8 +820,8 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb, GNUNET_SCHEDULER_run (&main_wrapper_exchange_connect, &main_ctx); else - GNUNET_SCHEDULER_run (&main_wrapper_exchange_agnostic, - &main_ctx); + GNUNET_SCHEDULER_run (&main_wrapper_exchange_agnostic, + &main_ctx); if (NULL != is.final_cleanup_cb) is.final_cleanup_cb (is.final_cleanup_cb_cls); GNUNET_free_non_null (main_ctx.exchange_url); diff --git a/src/lib/testing_api_trait_amount.c b/src/lib/testing_api_trait_amount.c index 8f2b79d45..962948bc5 100644 --- a/src/lib/testing_api_trait_amount.c +++ b/src/lib/testing_api_trait_amount.c @@ -45,8 +45,8 @@ int TALER_TESTING_get_trait_amount_obj (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_Amount **amount) + unsigned int index, + const struct TALER_Amount **amount) { return cmd->traits (cmd->cls, (const void **) amount, @@ -67,7 +67,7 @@ TALER_TESTING_get_trait_amount_obj struct TALER_TESTING_Trait TALER_TESTING_make_trait_amount_obj (unsigned int index, - const struct TALER_Amount *amount) + const struct TALER_Amount *amount) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_blinding_key.c b/src/lib/testing_api_trait_blinding_key.c index 6e52d1148..b723e5cfc 100644 --- a/src/lib/testing_api_trait_blinding_key.c +++ b/src/lib/testing_api_trait_blinding_key.c @@ -44,8 +44,8 @@ int TALER_TESTING_get_trait_blinding_key (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_DenominationBlindingKeyP **blinding_key) + unsigned int index, + const struct TALER_DenominationBlindingKeyP **blinding_key) { return cmd->traits (cmd->cls, (const void **) blinding_key, @@ -66,7 +66,7 @@ TALER_TESTING_get_trait_blinding_key struct TALER_TESTING_Trait TALER_TESTING_make_trait_blinding_key (unsigned int index, - const struct TALER_DenominationBlindingKeyP *blinding_key) + const struct TALER_DenominationBlindingKeyP *blinding_key) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_cmd.c b/src/lib/testing_api_trait_cmd.c index 61e976568..faf8799be 100644 --- a/src/lib/testing_api_trait_cmd.c +++ b/src/lib/testing_api_trait_cmd.c @@ -46,8 +46,8 @@ int TALER_TESTING_get_trait_cmd (const struct TALER_TESTING_Command *cmd, - unsigned int index, - struct TALER_TESTING_Command **_cmd) + unsigned int index, + struct TALER_TESTING_Command **_cmd) { return cmd->traits (cmd->cls, (const void **) _cmd, @@ -69,7 +69,7 @@ TALER_TESTING_get_trait_cmd struct TALER_TESTING_Trait TALER_TESTING_make_trait_cmd (unsigned int index, - const struct TALER_TESTING_Command *cmd) + const struct TALER_TESTING_Command *cmd) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_coin_priv.c b/src/lib/testing_api_trait_coin_priv.c index b06e4a207..85331de7e 100644 --- a/src/lib/testing_api_trait_coin_priv.c +++ b/src/lib/testing_api_trait_coin_priv.c @@ -44,8 +44,8 @@ int TALER_TESTING_get_trait_coin_priv (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_CoinSpendPrivateKeyP **coin_priv) + unsigned int index, + const struct TALER_CoinSpendPrivateKeyP **coin_priv) { return cmd->traits (cmd->cls, (const void **) coin_priv, @@ -64,7 +64,7 @@ TALER_TESTING_get_trait_coin_priv struct TALER_TESTING_Trait TALER_TESTING_make_trait_coin_priv (unsigned int index, - const struct TALER_CoinSpendPrivateKeyP *coin_priv) + const struct TALER_CoinSpendPrivateKeyP *coin_priv) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_denom_pub.c b/src/lib/testing_api_trait_denom_pub.c index 8bc482176..b11c459ee 100644 --- a/src/lib/testing_api_trait_denom_pub.c +++ b/src/lib/testing_api_trait_denom_pub.c @@ -44,8 +44,8 @@ int TALER_TESTING_get_trait_denom_pub (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_EXCHANGE_DenomPublicKey **denom_pub) + unsigned int index, + const struct TALER_EXCHANGE_DenomPublicKey **denom_pub) { return cmd->traits (cmd->cls, (const void **) denom_pub, @@ -64,7 +64,7 @@ TALER_TESTING_get_trait_denom_pub struct TALER_TESTING_Trait TALER_TESTING_make_trait_denom_pub (unsigned int index, - const struct TALER_EXCHANGE_DenomPublicKey *denom_pub) + const struct TALER_EXCHANGE_DenomPublicKey *denom_pub) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_denom_sig.c b/src/lib/testing_api_trait_denom_sig.c index 03062c835..83c19cb82 100644 --- a/src/lib/testing_api_trait_denom_sig.c +++ b/src/lib/testing_api_trait_denom_sig.c @@ -44,8 +44,8 @@ int TALER_TESTING_get_trait_denom_sig (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_DenominationSignature **denom_sig) + unsigned int index, + const struct TALER_DenominationSignature **denom_sig) { return cmd->traits (cmd->cls, (const void **) denom_sig, @@ -65,7 +65,7 @@ TALER_TESTING_get_trait_denom_sig struct TALER_TESTING_Trait TALER_TESTING_make_trait_denom_sig (unsigned int index, - const struct TALER_DenominationSignature *denom_sig) + const struct TALER_DenominationSignature *denom_sig) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_exchange_pub.c b/src/lib/testing_api_trait_exchange_pub.c index e8cdfbb35..711d56f0c 100644 --- a/src/lib/testing_api_trait_exchange_pub.c +++ b/src/lib/testing_api_trait_exchange_pub.c @@ -42,8 +42,8 @@ int TALER_TESTING_get_trait_exchange_pub (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_ExchangePublicKeyP **exchange_pub) + unsigned int index, + const struct TALER_ExchangePublicKeyP **exchange_pub) { return cmd->traits (cmd->cls, (const void **) exchange_pub, @@ -63,7 +63,7 @@ TALER_TESTING_get_trait_exchange_pub struct TALER_TESTING_Trait TALER_TESTING_make_trait_exchange_pub (unsigned int index, - const struct TALER_ExchangePublicKeyP *exchange_pub) + const struct TALER_ExchangePublicKeyP *exchange_pub) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_exchange_sig.c b/src/lib/testing_api_trait_exchange_sig.c index 97ce2d969..c7ed29b2c 100644 --- a/src/lib/testing_api_trait_exchange_sig.c +++ b/src/lib/testing_api_trait_exchange_sig.c @@ -42,8 +42,8 @@ int TALER_TESTING_get_trait_exchange_sig (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_ExchangeSignatureP **exchange_sig) + unsigned int index, + const struct TALER_ExchangeSignatureP **exchange_sig) { return cmd->traits (cmd->cls, (const void **) exchange_sig, @@ -63,7 +63,7 @@ TALER_TESTING_get_trait_exchange_sig struct TALER_TESTING_Trait TALER_TESTING_make_trait_exchange_sig (unsigned int index, - const struct TALER_ExchangeSignatureP *exchange_sig) + const struct TALER_ExchangeSignatureP *exchange_sig) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_fresh_coin.c b/src/lib/testing_api_trait_fresh_coin.c index 464e7e74c..92d6d4b9c 100644 --- a/src/lib/testing_api_trait_fresh_coin.c +++ b/src/lib/testing_api_trait_fresh_coin.c @@ -43,8 +43,8 @@ int TALER_TESTING_get_trait_fresh_coins (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_TESTING_FreshCoinData **fresh_coins) + unsigned int index, + const struct TALER_TESTING_FreshCoinData **fresh_coins) { return cmd->traits (cmd->cls, (const void **) fresh_coins, @@ -66,7 +66,7 @@ TALER_TESTING_get_trait_fresh_coins struct TALER_TESTING_Trait TALER_TESTING_make_trait_fresh_coins (unsigned int index, - struct TALER_TESTING_FreshCoinData *fresh_coins) + struct TALER_TESTING_FreshCoinData *fresh_coins) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_json.c b/src/lib/testing_api_trait_json.c index 5f6647fbb..5307dc370 100644 --- a/src/lib/testing_api_trait_json.c +++ b/src/lib/testing_api_trait_json.c @@ -43,8 +43,8 @@ int TALER_TESTING_get_trait_exchange_keys (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const json_t **keys) + unsigned int index, + const json_t **keys) { return cmd->traits (cmd->cls, (const void **) keys, @@ -64,7 +64,7 @@ TALER_TESTING_get_trait_exchange_keys struct TALER_TESTING_Trait TALER_TESTING_make_trait_exchange_keys (unsigned int index, - const json_t *keys) + const json_t *keys) { struct TALER_TESTING_Trait ret = { .index = index, @@ -87,8 +87,8 @@ TALER_TESTING_make_trait_exchange_keys int TALER_TESTING_get_trait_wire_details (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const json_t **wire_details) + unsigned int index, + const json_t **wire_details) { return cmd->traits (cmd->cls, (const void **) wire_details, @@ -109,7 +109,7 @@ TALER_TESTING_get_trait_wire_details struct TALER_TESTING_Trait TALER_TESTING_make_trait_wire_details (unsigned int index, - const json_t *wire_details) + const json_t *wire_details) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_key_peer.c b/src/lib/testing_api_trait_key_peer.c index d10623d28..f26169eb6 100644 --- a/src/lib/testing_api_trait_key_peer.c +++ b/src/lib/testing_api_trait_key_peer.c @@ -45,8 +45,8 @@ int TALER_TESTING_get_trait_peer_key (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct GNUNET_CRYPTO_EddsaPrivateKey **priv) + unsigned int index, + const struct GNUNET_CRYPTO_EddsaPrivateKey **priv) { return cmd->traits (cmd->cls, (const void **) priv, @@ -66,7 +66,7 @@ TALER_TESTING_get_trait_peer_key struct TALER_TESTING_Trait TALER_TESTING_make_trait_peer_key (unsigned int index, - const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) + const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) { struct TALER_TESTING_Trait ret = { .index = index, @@ -91,8 +91,8 @@ TALER_TESTING_make_trait_peer_key int TALER_TESTING_get_trait_peer_key_pub (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct GNUNET_CRYPTO_EddsaPublicKey **pub) + unsigned int index, + const struct GNUNET_CRYPTO_EddsaPublicKey **pub) { return cmd->traits (cmd->cls, (const void **) pub, @@ -113,7 +113,7 @@ TALER_TESTING_get_trait_peer_key_pub struct TALER_TESTING_Trait TALER_TESTING_make_trait_peer_key_pub (unsigned int index, - struct GNUNET_CRYPTO_EddsaPublicKey *pub) + struct GNUNET_CRYPTO_EddsaPublicKey *pub) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_number.c b/src/lib/testing_api_trait_number.c index ee2e76dbb..b2c545457 100644 --- a/src/lib/testing_api_trait_number.c +++ b/src/lib/testing_api_trait_number.c @@ -43,8 +43,8 @@ int TALER_TESTING_get_trait_uint (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const unsigned int **n) + unsigned int index, + const unsigned int **n) { return cmd->traits (cmd->cls, (const void **) n, @@ -63,7 +63,7 @@ TALER_TESTING_get_trait_uint struct TALER_TESTING_Trait TALER_TESTING_make_trait_uint (unsigned int index, - const unsigned int *n) + const unsigned int *n) { struct TALER_TESTING_Trait ret = { .index = index, @@ -85,8 +85,8 @@ TALER_TESTING_make_trait_uint int TALER_TESTING_get_trait_uint64 (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const uint64_t **n) + unsigned int index, + const uint64_t **n) { return cmd->traits (cmd->cls, (const void **) n, @@ -103,7 +103,7 @@ TALER_TESTING_get_trait_uint64 struct TALER_TESTING_Trait TALER_TESTING_make_trait_uint64 (unsigned int index, - const uint64_t *n) + const uint64_t *n) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_process.c b/src/lib/testing_api_trait_process.c index 449b6536f..a35314ef3 100644 --- a/src/lib/testing_api_trait_process.c +++ b/src/lib/testing_api_trait_process.c @@ -47,8 +47,8 @@ int TALER_TESTING_get_trait_process (const struct TALER_TESTING_Command *cmd, - unsigned int index, - struct GNUNET_OS_Process ***processp) + unsigned int index, + struct GNUNET_OS_Process ***processp) { return cmd->traits (cmd->cls, (const void **) processp, @@ -59,7 +59,7 @@ TALER_TESTING_get_trait_process /** * Offer location where a command stores a pointer to a process. - * + * * @param index offered location index number, in case there are * multiple on offer. * @param processp process location to offer. @@ -69,7 +69,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) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_reserve_priv.c b/src/lib/testing_api_trait_reserve_priv.c index 4a619d07f..b920c43d9 100644 --- a/src/lib/testing_api_trait_reserve_priv.c +++ b/src/lib/testing_api_trait_reserve_priv.c @@ -43,8 +43,8 @@ int TALER_TESTING_get_trait_reserve_priv (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_ReservePrivateKeyP **reserve_priv) + unsigned int index, + const struct TALER_ReservePrivateKeyP **reserve_priv) { return cmd->traits (cmd->cls, (const void **) reserve_priv, @@ -63,7 +63,7 @@ TALER_TESTING_get_trait_reserve_priv struct TALER_TESTING_Trait TALER_TESTING_make_trait_reserve_priv (unsigned int index, - const struct TALER_ReservePrivateKeyP *reserve_priv) + const struct TALER_ReservePrivateKeyP *reserve_priv) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_string.c b/src/lib/testing_api_trait_string.c index 8b8f511a7..606c6e0b6 100644 --- a/src/lib/testing_api_trait_string.c +++ b/src/lib/testing_api_trait_string.c @@ -48,8 +48,8 @@ int TALER_TESTING_get_trait_contract_terms (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const json_t **contract_terms) + unsigned int index, + const json_t **contract_terms) { return cmd->traits (cmd->cls, (const void **) contract_terms, @@ -67,7 +67,7 @@ TALER_TESTING_get_trait_contract_terms struct TALER_TESTING_Trait TALER_TESTING_make_trait_contract_terms (unsigned int index, - const json_t *contract_terms) + const json_t *contract_terms) { struct TALER_TESTING_Trait ret = { .index = index, @@ -91,8 +91,8 @@ TALER_TESTING_make_trait_contract_terms int TALER_TESTING_get_trait_transfer_subject (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const char **transfer_subject) + unsigned int index, + const char **transfer_subject) { return cmd->traits (cmd->cls, (const void **) transfer_subject, @@ -112,7 +112,7 @@ TALER_TESTING_get_trait_transfer_subject struct TALER_TESTING_Trait TALER_TESTING_make_trait_transfer_subject (unsigned int index, - const char *transfer_subject) + const char *transfer_subject) { struct TALER_TESTING_Trait ret = { .index = index, @@ -136,8 +136,8 @@ TALER_TESTING_make_trait_transfer_subject int TALER_TESTING_get_trait_amount (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const char **amount) + unsigned int index, + const char **amount) { return cmd->traits (cmd->cls, (const void **) amount, @@ -157,7 +157,7 @@ TALER_TESTING_get_trait_amount struct TALER_TESTING_Trait TALER_TESTING_make_trait_amount (unsigned int index, - const char *amount) + const char *amount) { struct TALER_TESTING_Trait ret = { .index = index, @@ -181,8 +181,8 @@ TALER_TESTING_make_trait_amount int TALER_TESTING_get_trait_url (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const char **url) + unsigned int index, + const char **url) { return cmd->traits (cmd->cls, (const void **) url, @@ -202,7 +202,7 @@ TALER_TESTING_get_trait_url struct TALER_TESTING_Trait TALER_TESTING_make_trait_url (unsigned int index, - const char *url) + const char *url) { struct TALER_TESTING_Trait ret = { .index = index, @@ -226,8 +226,8 @@ TALER_TESTING_make_trait_url int TALER_TESTING_get_trait_order_id (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const char **order_id) + unsigned int index, + const char **order_id) { return cmd->traits (cmd->cls, (const void **) order_id, @@ -247,7 +247,7 @@ TALER_TESTING_get_trait_order_id struct TALER_TESTING_Trait TALER_TESTING_make_trait_order_id (unsigned int index, - const char *order_id) + const char *order_id) { struct TALER_TESTING_Trait ret = { .index = index, @@ -271,8 +271,8 @@ TALER_TESTING_make_trait_order_id int TALER_TESTING_get_trait_rejected (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const char **rejected_reference) + unsigned int index, + const char **rejected_reference) { return cmd->traits (cmd->cls, (const void **) rejected_reference, @@ -292,7 +292,7 @@ TALER_TESTING_get_trait_rejected struct TALER_TESTING_Trait TALER_TESTING_make_trait_rejected (unsigned int index, - const char *rejected) + const char *rejected) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_time.c b/src/lib/testing_api_trait_time.c index 384ff807d..0cd71ad94 100644 --- a/src/lib/testing_api_trait_time.c +++ b/src/lib/testing_api_trait_time.c @@ -43,8 +43,8 @@ int TALER_TESTING_get_trait_absolute_time (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct GNUNET_TIME_Absolute **time) + unsigned int index, + const struct GNUNET_TIME_Absolute **time) { return cmd->traits (cmd->cls, (const void **) time, @@ -62,7 +62,7 @@ TALER_TESTING_get_trait_absolute_time struct TALER_TESTING_Trait TALER_TESTING_make_trait_absolute_time (unsigned int index, - const struct GNUNET_TIME_Absolute *time) + const struct GNUNET_TIME_Absolute *time) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_trait_wtid.c b/src/lib/testing_api_trait_wtid.c index 672329713..1353327af 100644 --- a/src/lib/testing_api_trait_wtid.c +++ b/src/lib/testing_api_trait_wtid.c @@ -43,8 +43,8 @@ int TALER_TESTING_get_trait_wtid (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_WireTransferIdentifierRawP **wtid) + unsigned int index, + const struct TALER_WireTransferIdentifierRawP **wtid) { return cmd->traits (cmd->cls, (const void **) wtid, @@ -63,7 +63,7 @@ TALER_TESTING_get_trait_wtid struct TALER_TESTING_Trait TALER_TESTING_make_trait_wtid (unsigned int index, - const struct TALER_WireTransferIdentifierRawP *wtid) + const struct TALER_WireTransferIdentifierRawP *wtid) { struct TALER_TESTING_Trait ret = { .index = index, diff --git a/src/lib/testing_api_traits.c b/src/lib/testing_api_traits.c index aa6c79c83..45e7668ee 100644 --- a/src/lib/testing_api_traits.c +++ b/src/lib/testing_api_traits.c @@ -61,7 +61,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, const char *trait, unsigned int index) { - for (unsigned int i=0; NULL != traits[i].trait_name; i++) + for (unsigned int i = 0; NULL != traits[i].trait_name; i++) { if ( (0 == strcmp (trait, traits[i].trait_name)) && (index == traits[i].index) ) diff --git a/src/lib/testing_auditor_api_cmd_deposit_confirmation.c b/src/lib/testing_auditor_api_cmd_deposit_confirmation.c index f52352669..3ea6390d8 100644 --- a/src/lib/testing_auditor_api_cmd_deposit_confirmation.c +++ b/src/lib/testing_auditor_api_cmd_deposit_confirmation.c @@ -117,8 +117,8 @@ do_retry (void *cls) dcs->retry_task = NULL; deposit_confirmation_run (dcs, - NULL, - dcs->is); + NULL, + dcs->is); } @@ -141,12 +141,12 @@ deposit_confirmation_cb (void *cls, dcs->dc = NULL; if (dcs->expected_response_code != http_status) - { + { if (GNUNET_YES == dcs->do_retry) { if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || - (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) + (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Retrying deposit confirmation failed with %u/%d\n", @@ -220,22 +220,22 @@ deposit_confirmation_run (void *cls, } GNUNET_assert (GNUNET_OK == - TALER_TESTING_get_trait_exchange_pub (deposit_cmd, - dcs->coin_index, - &exchange_pub)); + TALER_TESTING_get_trait_exchange_pub (deposit_cmd, + dcs->coin_index, + &exchange_pub)); GNUNET_assert (GNUNET_OK == - TALER_TESTING_get_trait_exchange_sig (deposit_cmd, - dcs->coin_index, - &exchange_sig)); + TALER_TESTING_get_trait_exchange_sig (deposit_cmd, + dcs->coin_index, + &exchange_sig)); keys = TALER_EXCHANGE_get_keys (dcs->is->exchange); GNUNET_assert (NULL != keys); spk = TALER_EXCHANGE_get_exchange_signing_key_info (keys, exchange_pub); GNUNET_assert (GNUNET_OK == - TALER_TESTING_get_trait_contract_terms (deposit_cmd, - dcs->coin_index, - &contract_terms)); + TALER_TESTING_get_trait_contract_terms (deposit_cmd, + dcs->coin_index, + &contract_terms)); /* Very unlikely to fail */ GNUNET_assert (NULL != contract_terms); GNUNET_assert (GNUNET_OK == @@ -267,7 +267,7 @@ deposit_confirmation_run (void *cls, { struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_absolute_time ("timestamp", ×tamp), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -284,7 +284,7 @@ deposit_confirmation_run (void *cls, { struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_absolute_time ("refund_deadline", &refund_deadline), - GNUNET_JSON_spec_end() + GNUNET_JSON_spec_end () }; if (GNUNET_OK != @@ -296,23 +296,23 @@ deposit_confirmation_run (void *cls, } } dcs->dc = TALER_AUDITOR_deposit_confirmation - (dcs->auditor, - &h_wire, - &h_contract_terms, - timestamp, - refund_deadline, - &amount_without_fee, - &coin_pub, - &merchant_pub, - exchange_pub, - exchange_sig, - &keys->master_pub, - spk->valid_from, - spk->valid_until, - spk->valid_legal, - &spk->master_sig, - &deposit_confirmation_cb, - dcs); + (dcs->auditor, + &h_wire, + &h_contract_terms, + timestamp, + refund_deadline, + &amount_without_fee, + &coin_pub, + &merchant_pub, + exchange_pub, + exchange_sig, + &keys->master_pub, + spk->valid_from, + spk->valid_until, + spk->valid_legal, + &spk->master_sig, + &deposit_confirmation_cb, + dcs); if (NULL == dcs->dc) { @@ -395,11 +395,11 @@ deposit_confirmation_traits (void *cls, 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, - const char *amount_without_fee, - unsigned int expected_response_code) + struct TALER_AUDITOR_Handle *auditor, + const char *deposit_reference, + unsigned int coin_index, + const char *amount_without_fee, + unsigned int expected_response_code) { struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/ struct DepositConfirmationState *dcs; @@ -429,7 +429,8 @@ TALER_TESTING_cmd_deposit_confirmation * @return the command with retries enabled */ struct TALER_TESTING_Command -TALER_TESTING_cmd_deposit_confirmation_with_retry (struct TALER_TESTING_Command cmd) +TALER_TESTING_cmd_deposit_confirmation_with_retry (struct TALER_TESTING_Command + cmd) { struct DepositConfirmationState *dcs; diff --git a/src/lib/testing_auditor_api_cmd_exchanges.c b/src/lib/testing_auditor_api_cmd_exchanges.c index 2f002627e..014441761 100644 --- a/src/lib/testing_auditor_api_cmd_exchanges.c +++ b/src/lib/testing_auditor_api_cmd_exchanges.c @@ -88,8 +88,8 @@ struct ExchangesState */ static void exchanges_run (void *cls, - const struct TALER_TESTING_Command *cmd, - struct TALER_TESTING_Interpreter *is); + const struct TALER_TESTING_Command *cmd, + struct TALER_TESTING_Interpreter *is); /** @@ -104,8 +104,8 @@ do_retry (void *cls) es->retry_task = NULL; exchanges_run (es, - NULL, - es->is); + NULL, + es->is); } @@ -119,11 +119,11 @@ do_retry (void *cls) */ static void exchanges_cb (void *cls, - unsigned int http_status, - enum TALER_ErrorCode ec, - unsigned int num_exchanges, - const struct TALER_AUDITOR_ExchangeInfo *ei, - const json_t *raw_response) + unsigned int http_status, + enum TALER_ErrorCode ec, + unsigned int num_exchanges, + const struct TALER_AUDITOR_ExchangeInfo *ei, + const json_t *raw_response) { struct ExchangesState *es = cls; @@ -134,30 +134,30 @@ exchanges_cb (void *cls, { if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || - (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) + (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Retrying list exchanges failed with %u/%d\n", http_status, (int) ec); - /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) - es->backoff = GNUNET_TIME_UNIT_ZERO; - else - es->backoff = EXCHANGE_LIB_BACKOFF (es->backoff); - es->retry_task = GNUNET_SCHEDULER_add_delayed (es->backoff, - &do_retry, - es); + /* on DB conflicts, do not use backoff */ + if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) + es->backoff = GNUNET_TIME_UNIT_ZERO; + else + es->backoff = EXCHANGE_LIB_BACKOFF (es->backoff); + es->retry_task = GNUNET_SCHEDULER_add_delayed (es->backoff, + &do_retry, + es); return; } } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - http_status, - es->is->commands[es->is->ip].label, - __FILE__, - __LINE__); + "Unexpected response code %u to command %s in %s:%u\n", + http_status, + es->is->commands[es->is->ip].label, + __FILE__, + __LINE__); json_dumpf (raw_response, stderr, 0); TALER_TESTING_interpreter_fail (es->is); return; @@ -166,7 +166,7 @@ exchanges_cb (void *cls, { unsigned int found = GNUNET_NO; - for (unsigned int i=0; + for (unsigned int i = 0; iexchange_url, @@ -176,7 +176,7 @@ exchanges_cb (void *cls, { TALER_LOG_ERROR ("Exchange '%s' doesn't exist at this auditor\n", - es->exchange_url); + es->exchange_url); TALER_TESTING_interpreter_fail (es->is); return; } @@ -197,16 +197,16 @@ exchanges_cb (void *cls, */ static void exchanges_run (void *cls, - const struct TALER_TESTING_Command *cmd, - struct TALER_TESTING_Interpreter *is) + const struct TALER_TESTING_Command *cmd, + struct TALER_TESTING_Interpreter *is) { struct ExchangesState *es = cls; es->is = is; es->leh = TALER_AUDITOR_list_exchanges - (is->auditor, - &exchanges_cb, - es); + (is->auditor, + &exchanges_cb, + es); if (NULL == es->leh) { @@ -227,7 +227,7 @@ exchanges_run (void *cls, */ static void exchanges_cleanup (void *cls, - const struct TALER_TESTING_Command *cmd) + const struct TALER_TESTING_Command *cmd) { struct ExchangesState *es = cls; @@ -261,9 +261,9 @@ exchanges_cleanup (void *cls, */ static int exchanges_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) + const void **ret, + const char *trait, + unsigned int index) { /* Must define this function because some callbacks * look for certain traits on _all_ the commands. */ @@ -282,8 +282,8 @@ exchanges_traits (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_exchanges (const char *label, - struct TALER_AUDITOR_Handle *auditor, - unsigned int expected_response_code) + struct TALER_AUDITOR_Handle *auditor, + unsigned int expected_response_code) { struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/ struct ExchangesState *es; @@ -316,8 +316,8 @@ TALER_TESTING_cmd_exchanges struct TALER_TESTING_Command TALER_TESTING_cmd_exchanges_with_url (const char *label, - unsigned int expected_response_code, - const char *exchange_url) + unsigned int expected_response_code, + const char *exchange_url) { struct TALER_TESTING_Command cmd = {0}; /* need explicit zeroing..*/ struct ExchangesState *es; diff --git a/src/lib/testing_auditor_api_helpers.c b/src/lib/testing_auditor_api_helpers.c index 4bbfc51d1..59b0e05de 100644 --- a/src/lib/testing_auditor_api_helpers.c +++ b/src/lib/testing_auditor_api_helpers.c @@ -108,8 +108,8 @@ struct MainWrapperContext static void auditor_version_cb (void *cls, - const struct TALER_AUDITOR_VersionInformation *vi, - enum TALER_AUDITOR_VersionCompatibility compat) + const struct TALER_AUDITOR_VersionInformation *vi, + enum TALER_AUDITOR_VersionCompatibility compat) { struct TALER_TESTING_Interpreter *is = cls; @@ -141,7 +141,7 @@ auditor_main_wrapper (void *cls, "auditor", "BASE_URL", &auditor_base_url)) - { + { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "auditor", "BASE_URL"); -- cgit v1.2.3