From f1a71f180c7bac551c8d4de2531172be561d5103 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 30 Sep 2016 23:19:18 +0200 Subject: [PATCH] mint->exchange leftovers --- src/exchange/taler-exchange-httpd.c | 178 +++---- src/exchange/taler-exchange-httpd.h | 16 +- src/exchange/taler-exchange-httpd_admin.c | 18 +- src/exchange/taler-exchange-httpd_admin.h | 2 +- src/exchange/taler-exchange-httpd_db.c | 446 +++++++++--------- src/exchange/taler-exchange-httpd_db.h | 24 +- src/exchange/taler-exchange-httpd_deposit.c | 58 +-- src/exchange/taler-exchange-httpd_deposit.h | 2 +- src/exchange/taler-exchange-httpd_keystate.c | 106 ++--- src/exchange/taler-exchange-httpd_keystate.h | 38 +- src/exchange/taler-exchange-httpd_mhd.c | 12 +- src/exchange/taler-exchange-httpd_mhd.h | 8 +- src/exchange/taler-exchange-httpd_parsing.c | 30 +- src/exchange/taler-exchange-httpd_parsing.h | 14 +- src/exchange/taler-exchange-httpd_refresh.c | 106 ++--- src/exchange/taler-exchange-httpd_refresh.h | 10 +- src/exchange/taler-exchange-httpd_refund.c | 14 +- src/exchange/taler-exchange-httpd_refund.h | 2 +- src/exchange/taler-exchange-httpd_reserve.c | 30 +- src/exchange/taler-exchange-httpd_reserve.h | 4 +- src/exchange/taler-exchange-httpd_responses.c | 150 +++--- src/exchange/taler-exchange-httpd_responses.h | 76 +-- src/exchange/taler-exchange-httpd_test.c | 78 +-- src/exchange/taler-exchange-httpd_test.h | 18 +- src/exchange/taler-exchange-httpd_tracking.c | 16 +- src/exchange/taler-exchange-httpd_tracking.h | 4 +- .../taler-exchange-httpd_validation.c | 14 +- .../taler-exchange-httpd_validation.h | 8 +- src/exchange/taler-exchange-httpd_wire.c | 6 +- src/exchange/taler-exchange-httpd_wire.h | 2 +- 30 files changed, 745 insertions(+), 745 deletions(-) diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index 230c31a64..9462695f3 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -52,17 +52,17 @@ /** * Which currency is used by this exchange? */ -char *TMH_exchange_currency_string; +char *TEH_exchange_currency_string; /** * Should we return "Connection: close" in each response? */ -int TMH_exchange_connection_close; +int TEH_exchange_connection_close; /** * Base directory of the exchange (global) */ -char *TMH_exchange_directory; +char *TEH_exchange_directory; /** * The exchange's configuration (global) @@ -73,12 +73,12 @@ struct GNUNET_CONFIGURATION_Handle *cfg; * Master public key (according to the * configuration in the exchange directory). */ -struct TALER_MasterPublicKeyP TMH_master_public_key; +struct TALER_MasterPublicKeyP TEH_master_public_key; /** * Our DB plugin. */ -struct TALER_EXCHANGEDB_Plugin *TMH_plugin; +struct TALER_EXCHANGEDB_Plugin *TEH_plugin; /** * Default timeout in seconds for HTTP requests. @@ -155,7 +155,7 @@ handle_mhd_completion_callback (void *cls, { if (NULL == *con_cls) return; - TMH_PARSE_post_cleanup_callback (*con_cls); + TEH_PARSE_post_cleanup_callback (*con_cls); *con_cls = NULL; } @@ -183,122 +183,122 @@ handle_mhd_request (void *cls, size_t *upload_data_size, void **con_cls) { - static struct TMH_RequestHandler handlers[] = + static struct TEH_RequestHandler handlers[] = { /* Landing page, tell humans to go away. */ { "/", MHD_HTTP_METHOD_GET, "text/plain", "Hello, I'm the Taler exchange. This HTTP server is not for humans.\n", 0, - &TMH_MHD_handler_static_response, MHD_HTTP_OK }, + &TEH_MHD_handler_static_response, MHD_HTTP_OK }, /* /robots.txt: disallow everything */ { "/robots.txt", MHD_HTTP_METHOD_GET, "text/plain", "User-agent: *\nDisallow: /\n", 0, - &TMH_MHD_handler_static_response, MHD_HTTP_OK }, + &TEH_MHD_handler_static_response, MHD_HTTP_OK }, /* AGPL licensing page, redirect to source. As per the AGPL-license, every deployment is required to offer the user a download of the source. We make this easy by including a redirect to the source here. */ { "/agpl", MHD_HTTP_METHOD_GET, "text/plain", NULL, 0, - &TMH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND }, + &TEH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND }, /* Return key material and fundamental properties for this exchange */ { "/keys", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, - &TMH_KS_handler_keys, MHD_HTTP_OK }, + &TEH_KS_handler_keys, MHD_HTTP_OK }, { "/keys", NULL, "text/plain", "Only GET is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, /* Requests for wiring information */ { "/wire", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, - &TMH_WIRE_handler_wire, MHD_HTTP_OK }, + &TEH_WIRE_handler_wire, MHD_HTTP_OK }, { "/wire", NULL, "text/plain", "Only GET is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, /* Withdrawing coins / interaction with reserves */ { "/reserve/status", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, - &TMH_RESERVE_handler_reserve_status, MHD_HTTP_OK }, + &TEH_RESERVE_handler_reserve_status, MHD_HTTP_OK }, { "/reserve/status", NULL, "text/plain", "Only GET is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/reserve/withdraw", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_RESERVE_handler_reserve_withdraw, MHD_HTTP_OK }, + &TEH_RESERVE_handler_reserve_withdraw, MHD_HTTP_OK }, { "/reserve/withdraw", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, /* Depositing coins */ { "/deposit", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_DEPOSIT_handler_deposit, MHD_HTTP_OK }, + &TEH_DEPOSIT_handler_deposit, MHD_HTTP_OK }, { "/deposit", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, /* Refunding coins */ { "/refund", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_REFUND_handler_refund, MHD_HTTP_OK }, + &TEH_REFUND_handler_refund, MHD_HTTP_OK }, { "/refund", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, /* Dealing with change */ { "/refresh/melt", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_REFRESH_handler_refresh_melt, MHD_HTTP_OK }, + &TEH_REFRESH_handler_refresh_melt, MHD_HTTP_OK }, { "/refresh/melt", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/refresh/reveal", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_REFRESH_handler_refresh_reveal, MHD_HTTP_OK }, + &TEH_REFRESH_handler_refresh_reveal, MHD_HTTP_OK }, { "/refresh/reveal", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/refresh/reveal", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_REFRESH_handler_refresh_reveal, MHD_HTTP_OK }, + &TEH_REFRESH_handler_refresh_reveal, MHD_HTTP_OK }, { "/refresh/reveal", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/refresh/link", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, - &TMH_REFRESH_handler_refresh_link, MHD_HTTP_OK }, + &TEH_REFRESH_handler_refresh_link, MHD_HTTP_OK }, { "/refresh/link", NULL, "text/plain", "Only GET is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/track/transfer", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, - &TMH_TRACKING_handler_track_transfer, MHD_HTTP_OK }, + &TEH_TRACKING_handler_track_transfer, MHD_HTTP_OK }, { "/track/transfer", NULL, "text/plain", "Only GET is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/track/transaction", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_TRACKING_handler_track_transaction, MHD_HTTP_OK }, + &TEH_TRACKING_handler_track_transaction, MHD_HTTP_OK }, { "/track/transaction", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { NULL, NULL, NULL, NULL, 0, 0 } }; - static struct TMH_RequestHandler h404 = + static struct TEH_RequestHandler h404 = { "", NULL, "text/html", "404: not found", 0, - &TMH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND + &TEH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND }; - struct TMH_RequestHandler *rh; + struct TEH_RequestHandler *rh; unsigned int i; GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -318,7 +318,7 @@ handle_mhd_request (void *cls, upload_data, upload_data_size); } - return TMH_MHD_handler_static_response (&h404, + return TEH_MHD_handler_static_response (&h404, connection, con_cls, upload_data, @@ -349,90 +349,90 @@ handle_mhd_admin_request (void *cls, size_t *upload_data_size, void **con_cls) { - static struct TMH_RequestHandler handlers[] = + static struct TEH_RequestHandler handlers[] = { { "/admin/add/incoming", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_ADMIN_handler_admin_add_incoming, MHD_HTTP_OK }, + &TEH_ADMIN_handler_admin_add_incoming, MHD_HTTP_OK }, { "/admin/add/incoming", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, #if HAVE_DEVELOPER /* Client crypto-interoperability test functions */ { "/test", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_TEST_handler_test, MHD_HTTP_OK }, + &TEH_TEST_handler_test, MHD_HTTP_OK }, { "/test", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/test/base32", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_TEST_handler_test_base32, MHD_HTTP_OK }, + &TEH_TEST_handler_test_base32, MHD_HTTP_OK }, { "/test/base32", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/test/encrypt", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_TEST_handler_test_encrypt, MHD_HTTP_OK }, + &TEH_TEST_handler_test_encrypt, MHD_HTTP_OK }, { "/test/encrypt", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/test/hkdf", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_TEST_handler_test_hkdf, MHD_HTTP_OK }, + &TEH_TEST_handler_test_hkdf, MHD_HTTP_OK }, { "/test/hkdf", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/test/ecdhe", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_TEST_handler_test_ecdhe, MHD_HTTP_OK }, + &TEH_TEST_handler_test_ecdhe, MHD_HTTP_OK }, { "/test/ecdhe", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/test/eddsa", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_TEST_handler_test_eddsa, MHD_HTTP_OK }, + &TEH_TEST_handler_test_eddsa, MHD_HTTP_OK }, { "/test/eddsa", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/test/rsa/get", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, - &TMH_TEST_handler_test_rsa_get, MHD_HTTP_OK }, + &TEH_TEST_handler_test_rsa_get, MHD_HTTP_OK }, { "/test/rsa/get", NULL, "text/plain", "Only GET is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/test/rsa/sign", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_TEST_handler_test_rsa_sign, MHD_HTTP_OK }, + &TEH_TEST_handler_test_rsa_sign, MHD_HTTP_OK }, { "/test/rsa/sign", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, { "/test/transfer", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_TEST_handler_test_transfer, MHD_HTTP_OK }, + &TEH_TEST_handler_test_transfer, MHD_HTTP_OK }, { "/test/transfer", NULL, "text/plain", "Only POST is allowed", 0, - &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, + &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, #endif { NULL, NULL, NULL, NULL, 0, 0 } }; - static struct TMH_RequestHandler h404 = + static struct TEH_RequestHandler h404 = { "", NULL, "text/html", "404: not found", 0, - &TMH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND + &TEH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND }; - struct TMH_RequestHandler *rh; + struct TEH_RequestHandler *rh; unsigned int i; GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -452,7 +452,7 @@ handle_mhd_admin_request (void *cls, upload_data, upload_data_size); } - return TMH_MHD_handler_static_response (&h404, + return TEH_MHD_handler_static_response (&h404, connection, con_cls, upload_data, @@ -587,13 +587,13 @@ parse_port_config (const char *section, static int exchange_serve_process_config () { - char *TMH_master_public_key_str; + char *TEH_master_public_key_str; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "exchange", "KEYDIR", - &TMH_exchange_directory)) + &TEH_exchange_directory)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "exchange", @@ -604,56 +604,56 @@ exchange_serve_process_config () GNUNET_CONFIGURATION_get_value_string (cfg, "taler", "currency", - &TMH_exchange_currency_string)) + &TEH_exchange_currency_string)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "taler", "currency"); return GNUNET_SYSERR; } - if (strlen (TMH_exchange_currency_string) >= TALER_CURRENCY_LEN) + if (strlen (TEH_exchange_currency_string) >= TALER_CURRENCY_LEN) { fprintf (stderr, "Currency `%s' longer than the allowed limit of %u characters.", - TMH_exchange_currency_string, + TEH_exchange_currency_string, (unsigned int) TALER_CURRENCY_LEN); return GNUNET_SYSERR; } if (GNUNET_OK != - TMH_VALIDATION_init (cfg)) + TEH_VALIDATION_init (cfg)) return GNUNET_SYSERR; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "exchange", "master_public_key", - &TMH_master_public_key_str)) + &TEH_master_public_key_str)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "exchange", "master_public_key"); - TMH_VALIDATION_done (); + TEH_VALIDATION_done (); return GNUNET_SYSERR; } if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_public_key_from_string (TMH_master_public_key_str, - strlen (TMH_master_public_key_str), - &TMH_master_public_key.eddsa_pub)) + GNUNET_CRYPTO_eddsa_public_key_from_string (TEH_master_public_key_str, + strlen (TEH_master_public_key_str), + &TEH_master_public_key.eddsa_pub)) { fprintf (stderr, "Invalid master public key given in exchange configuration."); - GNUNET_free (TMH_master_public_key_str); - TMH_VALIDATION_done (); + GNUNET_free (TEH_master_public_key_str); + TEH_VALIDATION_done (); return GNUNET_SYSERR; } - GNUNET_free (TMH_master_public_key_str); + GNUNET_free (TEH_master_public_key_str); if (NULL == - (TMH_plugin = TALER_EXCHANGEDB_plugin_load (cfg))) + (TEH_plugin = TALER_EXCHANGEDB_plugin_load (cfg))) { fprintf (stderr, "Failed to initialize DB subsystem\n"); - TMH_VALIDATION_done (); + TEH_VALIDATION_done (); return GNUNET_SYSERR; } if (GNUNET_YES == @@ -663,7 +663,7 @@ exchange_serve_process_config () { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Running in TEST mode! Database contents will not persist!\n"); - TMH_plugin->create_tables (TMH_plugin->cls); + TEH_plugin->create_tables (TEH_plugin->cls); } if (GNUNET_OK != @@ -672,7 +672,7 @@ exchange_serve_process_config () &serve_unixpath, &unixpath_mode)) { - TMH_VALIDATION_done (); + TEH_VALIDATION_done (); return GNUNET_SYSERR; } if (GNUNET_OK != @@ -681,7 +681,7 @@ exchange_serve_process_config () &serve_admin_unixpath, &unixpath_admin_mode)) { - TMH_VALIDATION_done (); + TEH_VALIDATION_done (); return GNUNET_SYSERR; } return GNUNET_OK; @@ -700,7 +700,7 @@ static char *input_filename; /** * Run 'nc' or 'ncat' as a fake HTTP client using #input_filename * as the input for the request. If launching the client worked, - * run the #TMH_KS_loop() event loop as usual. + * run the #TEH_KS_loop() event loop as usual. * * @return #GNUNET_OK */ @@ -754,7 +754,7 @@ run_fake_client () } /* parent process */ GNUNET_break (0 == close (fd)); - ret = TMH_KS_loop (); + ret = TEH_KS_loop (); if (cld != waitpid (cld, &status, 0)) fprintf (stderr, "Waiting for `nc' child failed: %s\n", @@ -933,7 +933,7 @@ main (int argc, const struct GNUNET_GETOPT_CommandLineOption options[] = { {'C', "connection-close", NULL, "force HTTP connections to be closed after each request", 0, - &GNUNET_GETOPT_set_one, &TMH_exchange_connection_close}, + &GNUNET_GETOPT_set_one, &TEH_exchange_connection_close}, GNUNET_GETOPT_OPTION_CFG_FILE (&cfgfile), {'D', "disable-admin", NULL, "do not run the /admin-HTTP server", 0, @@ -1101,11 +1101,11 @@ main (int argc, else { /* normal behavior */ - ret = TMH_KS_loop (); + ret = TEH_KS_loop (); } #else /* normal behavior */ - ret = TMH_KS_loop (); + ret = TEH_KS_loop (); #endif switch (ret) @@ -1195,8 +1195,8 @@ main (int argc, MHD_stop_daemon (mhd_admin); break; } - TALER_EXCHANGEDB_plugin_unload (TMH_plugin); - TMH_VALIDATION_done (); + TALER_EXCHANGEDB_plugin_unload (TEH_plugin); + TEH_VALIDATION_done (); return (GNUNET_SYSERR == ret) ? 1 : 0; } diff --git a/src/exchange/taler-exchange-httpd.h b/src/exchange/taler-exchange-httpd.h index fe0f40b22..69da3c243 100644 --- a/src/exchange/taler-exchange-httpd.h +++ b/src/exchange/taler-exchange-httpd.h @@ -31,12 +31,12 @@ /** * Which currency is used by this exchange? */ -extern char *TMH_exchange_currency_string; +extern char *TEH_exchange_currency_string; /** * Should we return "Connection: close" in each response? */ -extern int TMH_exchange_connection_close; +extern int TEH_exchange_connection_close; /** * The exchange's configuration. @@ -46,29 +46,29 @@ extern struct GNUNET_CONFIGURATION_Handle *cfg; /** * Main directory with exchange data. */ -extern char *TMH_exchange_directory; +extern char *TEH_exchange_directory; /** * Master public key (according to the * configuration in the exchange directory). */ -extern struct TALER_MasterPublicKeyP TMH_master_public_key; +extern struct TALER_MasterPublicKeyP TEH_master_public_key; /** * Private key of the exchange we use to sign messages. */ -extern struct GNUNET_CRYPTO_EddsaPrivateKey TMH_exchange_private_signing_key; +extern struct GNUNET_CRYPTO_EddsaPrivateKey TEH_exchange_private_signing_key; /** * Our DB plugin. */ -extern struct TALER_EXCHANGEDB_Plugin *TMH_plugin; +extern struct TALER_EXCHANGEDB_Plugin *TEH_plugin; /** * @brief Struct describing an URL and the handler for it. */ -struct TMH_RequestHandler +struct TEH_RequestHandler { /** @@ -107,7 +107,7 @@ struct TMH_RequestHandler * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ - int (*handler)(struct TMH_RequestHandler *rh, + int (*handler)(struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, diff --git a/src/exchange/taler-exchange-httpd_admin.c b/src/exchange/taler-exchange-httpd_admin.c index 584c45a81..e99448f87 100644 --- a/src/exchange/taler-exchange-httpd_admin.c +++ b/src/exchange/taler-exchange-httpd_admin.c @@ -41,7 +41,7 @@ * @return MHD result code */ int -TMH_ADMIN_handler_admin_add_incoming (struct TMH_RequestHandler *rh, +TEH_ADMIN_handler_admin_add_incoming (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -63,7 +63,7 @@ TMH_ADMIN_handler_admin_add_incoming (struct TMH_RequestHandler *rh, }; int res; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -72,7 +72,7 @@ TMH_ADMIN_handler_admin_add_incoming (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == root) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, root, spec); json_decref (root); @@ -83,26 +83,26 @@ TMH_ADMIN_handler_admin_add_incoming (struct TMH_RequestHandler *rh, return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; } if (GNUNET_YES != - TMH_json_validate_wireformat (sender_account_details, + TEH_json_validate_wireformat (sender_account_details, GNUNET_NO)) { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_arg_unknown (connection, + return TEH_RESPONSE_reply_arg_unknown (connection, "sender_account_details"); } if (0 != strcasecmp (amount.currency, - TMH_exchange_currency_string)) + TEH_exchange_currency_string)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Exchange uses currency `%s', but /admin/add/incoming tried to use currency `%s'\n", - TMH_exchange_currency_string, + TEH_exchange_currency_string, amount.currency); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "amount:currency"); } - res = TMH_DB_execute_admin_add_incoming (connection, + res = TEH_DB_execute_admin_add_incoming (connection, &reserve_pub, &amount, at, diff --git a/src/exchange/taler-exchange-httpd_admin.h b/src/exchange/taler-exchange-httpd_admin.h index 7127a438b..8ed1e3d54 100644 --- a/src/exchange/taler-exchange-httpd_admin.h +++ b/src/exchange/taler-exchange-httpd_admin.h @@ -37,7 +37,7 @@ * @return MHD result code */ int -TMH_ADMIN_handler_admin_add_incoming (struct TMH_RequestHandler *rh, +TEH_ADMIN_handler_admin_add_incoming (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c index d265f6f47..374b588c1 100644 --- a/src/exchange/taler-exchange-httpd_db.c +++ b/src/exchange/taler-exchange-httpd_db.c @@ -38,7 +38,7 @@ * of retries. Note that this code may call "return" internally, so * it must be called within a function where any cleanup will be done * by the caller. Furthermore, the function's return value must - * match that of a #TMH_RESPONSE_reply_internal_db_error() status code. + * match that of a #TEH_RESPONSE_reply_internal_db_error() status code. * * @param session session handle * @param connection connection handle @@ -49,11 +49,11 @@ int transaction_commit_result; \ transaction_start_label: /* we will use goto for retries */ \ if (GNUNET_OK != \ - TMH_plugin->start (TMH_plugin->cls, \ + TEH_plugin->start (TEH_plugin->cls, \ session)) \ { \ GNUNET_break (0); \ - return TMH_RESPONSE_reply_internal_db_error (connection); \ + return TEH_RESPONSE_reply_internal_db_error (connection); \ } /** @@ -61,19 +61,19 @@ transaction_start_label: /* we will use goto for retries */ \ * that this code may call "return" internally, so it must be called * within a function where any cleanup will be done by the caller. * Furthermore, the function's return value must match that of a - * #TMH_RESPONSE_reply_internal_db_error() status code. + * #TEH_RESPONSE_reply_internal_db_error() status code. * * @param session session handle * @param connection connection handle */ #define COMMIT_TRANSACTION(session,connection) \ transaction_commit_result = \ - TMH_plugin->commit (TMH_plugin->cls, \ + TEH_plugin->commit (TEH_plugin->cls, \ session); \ if (GNUNET_SYSERR == transaction_commit_result) \ { \ TALER_LOG_WARNING ("Transaction commit failed in %s\n", __FUNCTION__); \ - return TMH_RESPONSE_reply_commit_error (connection); \ + return TEH_RESPONSE_reply_commit_error (connection); \ } \ if (GNUNET_NO == transaction_commit_result) \ { \ @@ -83,7 +83,7 @@ transaction_start_label: /* we will use goto for retries */ \ TALER_LOG_WARNING ("Transaction commit failed %u times in %s\n", \ transaction_retries, \ __FUNCTION__); \ - return TMH_RESPONSE_reply_commit_error (connection); \ + return TEH_RESPONSE_reply_commit_error (connection); \ } \ } /* end of scope opened by BEGIN_TRANSACTION */ @@ -182,7 +182,7 @@ calculate_transaction_list_totals (struct TALER_EXCHANGEDB_TransactionList *tl, * @return MHD result code */ int -TMH_DB_execute_deposit (struct MHD_Connection *connection, +TEH_DB_execute_deposit (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_Deposit *deposit) { struct TALER_EXCHANGEDB_Session *session; @@ -190,17 +190,17 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, struct TALER_Amount spent; struct TALER_Amount value; struct TALER_Amount amount_without_fee; - struct TMH_KS_StateHandle *mks; + struct TEH_KS_StateHandle *mks; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; int ret; - if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls))) + if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } if (GNUNET_YES == - TMH_plugin->have_deposit (TMH_plugin->cls, + TEH_plugin->have_deposit (TEH_plugin->cls, session, deposit)) { @@ -208,7 +208,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, TALER_amount_subtract (&amount_without_fee, &deposit->amount_with_fee, &deposit->deposit_fee)); - return TMH_RESPONSE_reply_deposit_success (connection, + return TEH_RESPONSE_reply_deposit_success (connection, &deposit->coin.coin_pub, &deposit->h_wire, &deposit->h_contract, @@ -218,26 +218,26 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, &deposit->merchant_pub, &amount_without_fee); } - mks = TMH_KS_acquire (); - dki = TMH_KS_denomination_key_lookup (mks, + mks = TEH_KS_acquire (); + dki = TEH_KS_denomination_key_lookup (mks, &deposit->coin.denom_pub, - TMH_KS_DKU_DEPOSIT); + TEH_KS_DKU_DEPOSIT); if (NULL == dki) { - TMH_KS_release (mks); - return TMH_RESPONSE_reply_arg_invalid (connection, + TEH_KS_release (mks); + return TEH_RESPONSE_reply_arg_invalid (connection, "denom_pub"); } TALER_amount_ntoh (&value, &dki->issue.properties.value); - TMH_KS_release (mks); + TEH_KS_release (mks); START_TRANSACTION (session, connection); /* fee for THIS transaction */ spent = deposit->amount_with_fee; /* add cost of all previous transactions */ - tl = TMH_plugin->get_coin_transactions (TMH_plugin->cls, + tl = TEH_plugin->get_coin_transactions (TEH_plugin->cls, session, &deposit->coin.coin_pub); if (GNUNET_OK != @@ -245,36 +245,36 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, &spent, &spent)) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } /* Check that cost of all transactions is smaller than the value of the coin. */ if (0 < TALER_amount_cmp (&spent, &value)) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - ret = TMH_RESPONSE_reply_deposit_insufficient_funds (connection, + ret = TEH_RESPONSE_reply_deposit_insufficient_funds (connection, tl); - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); return ret; } - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); if (GNUNET_OK != - TMH_plugin->insert_deposit (TMH_plugin->cls, + TEH_plugin->insert_deposit (TEH_plugin->cls, session, deposit)) { TALER_LOG_WARNING ("Failed to store /deposit information in database\n"); - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } COMMIT_TRANSACTION(session, connection); @@ -282,7 +282,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, TALER_amount_subtract (&amount_without_fee, &deposit->amount_with_fee, &deposit->deposit_fee)); - return TMH_RESPONSE_reply_deposit_success (connection, + return TEH_RESPONSE_reply_deposit_success (connection, &deposit->coin.coin_pub, &deposit->h_wire, &deposit->h_contract, @@ -304,7 +304,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_refund (struct MHD_Connection *connection, +TEH_DB_execute_refund (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_Refund *refund) { struct TALER_EXCHANGEDB_Session *session; @@ -312,7 +312,7 @@ TMH_DB_execute_refund (struct MHD_Connection *connection, struct TALER_EXCHANGEDB_TransactionList *tlp; const struct TALER_EXCHANGEDB_Deposit *dep; const struct TALER_EXCHANGEDB_Refund *ref; - struct TMH_KS_StateHandle *mks; + struct TEH_KS_StateHandle *mks; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; struct TALER_Amount expect_fee; int ret; @@ -321,22 +321,22 @@ TMH_DB_execute_refund (struct MHD_Connection *connection, int done; int fee_cmp; - if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls))) + if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } dep = NULL; ref = NULL; START_TRANSACTION (session, connection); - tl = TMH_plugin->get_coin_transactions (TMH_plugin->cls, + tl = TEH_plugin->get_coin_transactions (TEH_plugin->cls, session, &refund->coin.coin_pub); if (NULL == tl) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_refund_failure (connection, + return TEH_RESPONSE_reply_refund_failure (connection, MHD_HTTP_NOT_FOUND); } deposit_found = GNUNET_NO; @@ -407,20 +407,20 @@ TMH_DB_execute_refund (struct MHD_Connection *connection, /* handle if deposit was NOT found */ if (GNUNET_NO == deposit_found) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - return TMH_RESPONSE_reply_transaction_unknown (connection); + return TEH_RESPONSE_reply_transaction_unknown (connection); } /* handle if conflicting refund found */ if (GNUNET_SYSERR == refund_found) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - ret = TMH_RESPONSE_reply_refund_conflict (connection, + ret = TEH_RESPONSE_reply_refund_conflict (connection, tl); - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); return ret; } @@ -428,11 +428,11 @@ TMH_DB_execute_refund (struct MHD_Connection *connection, if (GNUNET_YES == refund_found) { /* /refund already done, simply re-transmit confirmation */ - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - ret = TMH_RESPONSE_reply_refund_success (connection, + ret = TEH_RESPONSE_reply_refund_success (connection, ref); - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); return ret; } @@ -446,14 +446,14 @@ TMH_DB_execute_refund (struct MHD_Connection *connection, &dep->deposit_fee)) ) { GNUNET_break_op (0); /* currency missmatch */ - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_refund_failure (connection, + return TEH_RESPONSE_reply_refund_failure (connection, MHD_HTTP_PRECONDITION_FAILED); } /* check if we already send the money for the /deposit */ - done = TMH_plugin->test_deposit_done (TMH_plugin->cls, + done = TEH_plugin->test_deposit_done (TEH_plugin->cls, session, dep); if (GNUNET_SYSERR == done) @@ -461,21 +461,21 @@ TMH_DB_execute_refund (struct MHD_Connection *connection, /* Internal error, we first had the deposit in the history, but now it is gone? */ GNUNET_break (0); - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "database inconsistent"); } if (GNUNET_YES == done) { /* money was already transferred to merchant, can no longer refund */ - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - return TMH_RESPONSE_reply_refund_failure (connection, + return TEH_RESPONSE_reply_refund_failure (connection, MHD_HTTP_GONE); } @@ -484,41 +484,41 @@ TMH_DB_execute_refund (struct MHD_Connection *connection, &dep->amount_with_fee) ) { GNUNET_break_op (0); /* cannot refund more than original value */ - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - return TMH_RESPONSE_reply_refund_failure (connection, + return TEH_RESPONSE_reply_refund_failure (connection, MHD_HTTP_PRECONDITION_FAILED); } /* Check refund fee matches fee of denomination key! */ - mks = TMH_KS_acquire (); - dki = TMH_KS_denomination_key_lookup (mks, + mks = TEH_KS_acquire (); + dki = TEH_KS_denomination_key_lookup (mks, &dep->coin.denom_pub, - TMH_KS_DKU_DEPOSIT); + TEH_KS_DKU_DEPOSIT); if (NULL == dki) { /* DKI not found, but we do have a coin with this DK in our database; not good... */ GNUNET_break (0); - TMH_KS_release (mks); - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_KS_release (mks); + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "denomination key not found"); } TALER_amount_ntoh (&expect_fee, &dki->issue.properties.fee_refund); fee_cmp = TALER_amount_cmp (&refund->refund_fee, &expect_fee); - TMH_KS_release (mks); + TEH_KS_release (mks); if (-1 == fee_cmp) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "refund_fee"); } if (1 == fee_cmp) @@ -526,23 +526,23 @@ TMH_DB_execute_refund (struct MHD_Connection *connection, GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Refund fee proposed by merchant is higher than necessary.\n"); } - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); /* Finally, store new refund data */ if (GNUNET_OK != - TMH_plugin->insert_refund (TMH_plugin->cls, + TEH_plugin->insert_refund (TEH_plugin->cls, session, refund)) { TALER_LOG_WARNING ("Failed to store /refund information in database\n"); - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } COMMIT_TRANSACTION(session, connection); - return TMH_RESPONSE_reply_refund_success (connection, + return TEH_RESPONSE_reply_refund_success (connection, refund); } @@ -556,30 +556,30 @@ TMH_DB_execute_refund (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_reserve_status (struct MHD_Connection *connection, +TEH_DB_execute_reserve_status (struct MHD_Connection *connection, const struct TALER_ReservePublicKeyP *reserve_pub) { struct TALER_EXCHANGEDB_Session *session; struct TALER_EXCHANGEDB_ReserveHistory *rh; int res; - if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls))) + if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } - rh = TMH_plugin->get_reserve_history (TMH_plugin->cls, + rh = TEH_plugin->get_reserve_history (TEH_plugin->cls, session, reserve_pub); if (NULL == rh) - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_NOT_FOUND, "{s:s, s:s}", "error", "Reserve not found", "parameter", "withdraw_pub"); - res = TMH_RESPONSE_reply_reserve_status_success (connection, + res = TEH_RESPONSE_reply_reserve_status_success (connection, rh); - TMH_plugin->free_reserve_history (TMH_plugin->cls, + TEH_plugin->free_reserve_history (TEH_plugin->cls, rh); return res; } @@ -605,7 +605,7 @@ TMH_DB_execute_reserve_status (struct MHD_Connection *connection, static int execute_reserve_withdraw_transaction (struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - struct TMH_KS_StateHandle *key_state, + struct TEH_KS_StateHandle *key_state, const struct TALER_ReservePublicKeyP *reserve, const struct TALER_DenominationPublicKey *denomination_pub, const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki, @@ -629,14 +629,14 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection, /* Check if balance is sufficient */ START_TRANSACTION (session, connection); - rh = TMH_plugin->get_reserve_history (TMH_plugin->cls, + rh = TEH_plugin->get_reserve_history (TEH_plugin->cls, session, reserve); if (NULL == rh) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_arg_unknown (connection, + return TEH_RESPONSE_reply_arg_unknown (connection, "reserve_pub"); } @@ -651,9 +651,9 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection, &value, &fee_withdraw)) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } /* calculate balance of the reserve */ @@ -671,22 +671,22 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection, &deposit_total, &pos->details.bank->amount)) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } res |= 1; break; case TALER_EXCHANGEDB_RO_WITHDRAW_COIN: - tdki = TMH_KS_denomination_key_lookup (key_state, + tdki = TEH_KS_denomination_key_lookup (key_state, &pos->details.withdraw->denom_pub, - TMH_KS_DKU_WITHDRAW); + TEH_KS_DKU_WITHDRAW); if (NULL == tdki) { GNUNET_break (0); - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } TALER_amount_ntoh (&value, &tdki->issue.properties.value); @@ -698,9 +698,9 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection, &withdraw_total, &value)) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } res |= 2; break; @@ -710,7 +710,7 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection, { /* did not encounter any deposit operations, how can we have a reserve? */ GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } if (0 == (res & 2)) { @@ -726,15 +726,15 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection, if (0 < TALER_amount_cmp (&amount_required, &balance)) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - res = TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (connection, + res = TEH_RESPONSE_reply_reserve_withdraw_insufficient_funds (connection, rh); - TMH_plugin->free_reserve_history (TMH_plugin->cls, + TEH_plugin->free_reserve_history (TEH_plugin->cls, rh); return res; } - TMH_plugin->free_reserve_history (TMH_plugin->cls, + TEH_plugin->free_reserve_history (TEH_plugin->cls, rh); /* Balance is good, sign the coin! */ @@ -745,9 +745,9 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection, if (NULL == denom_sig->rsa_signature) { GNUNET_break (0); - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "Internal error"); } collectable.sig = *denom_sig; @@ -758,18 +758,18 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection, collectable.h_coin_envelope = *h_blind; collectable.reserve_sig = *signature; if (GNUNET_OK != - TMH_plugin->insert_withdraw_info (TMH_plugin->cls, + TEH_plugin->insert_withdraw_info (TEH_plugin->cls, session, &collectable)) { GNUNET_break (0); - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } COMMIT_TRANSACTION (session, connection); - return TMH_RESPONSE_reply_reserve_withdraw_success (connection, + return TEH_RESPONSE_reply_reserve_withdraw_success (connection, &collectable); } @@ -790,7 +790,7 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, +TEH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, const struct TALER_ReservePublicKeyP *reserve, const struct TALER_DenominationPublicKey *denomination_pub, const char *blinded_msg, @@ -798,7 +798,7 @@ TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, const struct TALER_ReserveSignatureP *signature) { struct TALER_EXCHANGEDB_Session *session; - struct TMH_KS_StateHandle *key_state; + struct TEH_KS_StateHandle *key_state; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; struct TALER_EXCHANGEDB_CollectableBlindcoin collectable; struct TALER_DenominationSignature denom_sig; @@ -808,25 +808,25 @@ TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, GNUNET_CRYPTO_hash (blinded_msg, blinded_msg_len, &h_blind); - if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls))) + if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } - res = TMH_plugin->get_withdraw_info (TMH_plugin->cls, + res = TEH_plugin->get_withdraw_info (TEH_plugin->cls, session, &h_blind, &collectable); if (GNUNET_SYSERR == res) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } /* Don't sign again if we have already signed the coin */ if (GNUNET_YES == res) { - res = TMH_RESPONSE_reply_reserve_withdraw_success (connection, + res = TEH_RESPONSE_reply_reserve_withdraw_success (connection, &collectable); GNUNET_CRYPTO_rsa_signature_free (collectable.sig.rsa_signature); GNUNET_CRYPTO_rsa_public_key_free (collectable.denom_pub.rsa_public_key); @@ -834,14 +834,14 @@ TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, } GNUNET_assert (GNUNET_NO == res); - key_state = TMH_KS_acquire (); - dki = TMH_KS_denomination_key_lookup (key_state, + key_state = TEH_KS_acquire (); + dki = TEH_KS_denomination_key_lookup (key_state, denomination_pub, - TMH_KS_DKU_WITHDRAW); + TEH_KS_DKU_WITHDRAW); if (NULL == dki) { - TMH_KS_release (key_state); - return TMH_RESPONSE_reply_json_pack (connection, + TEH_KS_release (key_state); + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_NOT_FOUND, "{s:s}", "error", @@ -861,7 +861,7 @@ TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, &denom_sig); if (NULL != denom_sig.rsa_signature) GNUNET_CRYPTO_rsa_signature_free (denom_sig.rsa_signature); - TMH_KS_release (key_state); + TEH_KS_release (key_state); return res; } @@ -883,9 +883,9 @@ TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, static int refresh_check_melt (struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - const struct TMH_KS_StateHandle *key_state, + const struct TEH_KS_StateHandle *key_state, const struct GNUNET_HashCode *session_hash, - const struct TMH_DB_MeltDetails *coin_details, + const struct TEH_DB_MeltDetails *coin_details, struct TALER_EXCHANGEDB_RefreshMelt *meltp) { struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dk; @@ -896,12 +896,12 @@ refresh_check_melt (struct MHD_Connection *connection, struct TALER_Amount spent; int res; - dk = TMH_KS_denomination_key_lookup (key_state, + dk = TEH_KS_denomination_key_lookup (key_state, &coin_details->coin_info.denom_pub, - TMH_KS_DKU_DEPOSIT); + TEH_KS_DKU_DEPOSIT); if (NULL == dk) return (MHD_YES == - TMH_RESPONSE_reply_arg_unknown (connection, + TEH_RESPONSE_reply_arg_unknown (connection, "denom_pub")) ? GNUNET_NO : GNUNET_SYSERR; dki = &dk->issue; @@ -910,7 +910,7 @@ refresh_check_melt (struct MHD_Connection *connection, /* fee for THIS transaction; the melt amount includes the fee! */ spent = coin_details->melt_amount_with_fee; /* add historic transaction costs of this coin */ - tl = TMH_plugin->get_coin_transactions (TMH_plugin->cls, + tl = TEH_plugin->get_coin_transactions (TEH_plugin->cls, session, &coin_details->coin_info.coin_pub); if (GNUNET_OK != @@ -919,10 +919,10 @@ refresh_check_melt (struct MHD_Connection *connection, &spent)) { GNUNET_break (0); - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); return (MHD_YES == - TMH_RESPONSE_reply_internal_db_error (connection)) + TEH_RESPONSE_reply_internal_db_error (connection)) ? GNUNET_NO : GNUNET_SYSERR; } /* Refuse to refresh when the coin's value is insufficient @@ -935,18 +935,18 @@ refresh_check_melt (struct MHD_Connection *connection, &spent, &coin_details->melt_amount_with_fee)); res = (MHD_YES == - TMH_RESPONSE_reply_refresh_melt_insufficient_funds (connection, + TEH_RESPONSE_reply_refresh_melt_insufficient_funds (connection, &coin_details->coin_info.coin_pub, coin_value, tl, coin_details->melt_amount_with_fee, coin_residual)) ? GNUNET_NO : GNUNET_SYSERR; - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); return res; } - TMH_plugin->free_coin_transaction_list (TMH_plugin->cls, + TEH_plugin->free_coin_transaction_list (TEH_plugin->cls, tl); meltp->coin = coin_details->coin_info; @@ -979,43 +979,43 @@ refresh_check_melt (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, +TEH_DB_execute_refresh_melt (struct MHD_Connection *connection, const struct GNUNET_HashCode *session_hash, unsigned int num_new_denoms, const struct TALER_DenominationPublicKey *denom_pubs, - const struct TMH_DB_MeltDetails *coin_melt_detail, + const struct TEH_DB_MeltDetails *coin_melt_detail, struct TALER_EXCHANGEDB_RefreshCommitCoin *const* commit_coin, const struct TALER_TransferPublicKeyP *transfer_pubs) { - struct TMH_KS_StateHandle *key_state; + struct TEH_KS_StateHandle *key_state; struct TALER_EXCHANGEDB_RefreshSession refresh_session; struct TALER_EXCHANGEDB_Session *session; int res; - if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls))) + if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } START_TRANSACTION (session, connection); - res = TMH_plugin->get_refresh_session (TMH_plugin->cls, + res = TEH_plugin->get_refresh_session (TEH_plugin->cls, session, session_hash, &refresh_session); if (GNUNET_YES == res) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - res = TMH_RESPONSE_reply_refresh_melt_success (connection, + res = TEH_RESPONSE_reply_refresh_melt_success (connection, session_hash, refresh_session.noreveal_index); return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; } if (GNUNET_SYSERR == res) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } /* store 'global' session data */ @@ -1023,7 +1023,7 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, refresh_session.noreveal_index = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, TALER_CNC_KAPPA); - key_state = TMH_KS_acquire (); + key_state = TEH_KS_acquire (); if (GNUNET_OK != (res = refresh_check_melt (connection, session, @@ -1032,61 +1032,61 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, coin_melt_detail, &refresh_session.melt))) { - TMH_KS_release (key_state); - TMH_plugin->rollback (TMH_plugin->cls, + TEH_KS_release (key_state); + TEH_plugin->rollback (TEH_plugin->cls, session); return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; } - TMH_KS_release (key_state); + TEH_KS_release (key_state); if (GNUNET_OK != - (res = TMH_plugin->create_refresh_session (TMH_plugin->cls, + (res = TEH_plugin->create_refresh_session (TEH_plugin->cls, session, session_hash, &refresh_session))) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } /* store requested new denominations */ if (GNUNET_OK != - TMH_plugin->insert_refresh_order (TMH_plugin->cls, + TEH_plugin->insert_refresh_order (TEH_plugin->cls, session, session_hash, num_new_denoms, denom_pubs)) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } if (GNUNET_OK != - TMH_plugin->insert_refresh_commit_coins (TMH_plugin->cls, + TEH_plugin->insert_refresh_commit_coins (TEH_plugin->cls, session, session_hash, num_new_denoms, commit_coin[refresh_session.noreveal_index])) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } if (GNUNET_OK != - TMH_plugin->insert_refresh_transfer_public_key (TMH_plugin->cls, + TEH_plugin->insert_refresh_transfer_public_key (TEH_plugin->cls, session, session_hash, &transfer_pubs[refresh_session.noreveal_index])) { - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } COMMIT_TRANSACTION (session, connection); - return TMH_RESPONSE_reply_refresh_melt_success (connection, + return TEH_RESPONSE_reply_refresh_melt_success (connection, session_hash, refresh_session.noreveal_index); } @@ -1158,7 +1158,7 @@ check_commitment (struct MHD_Connection *connection, { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Blind failed (bad denomination key!?)\n"); - return (MHD_YES == TMH_RESPONSE_reply_internal_error (connection, + return (MHD_YES == TEH_RESPONSE_reply_internal_error (connection, "Blinding error")) ? GNUNET_NO : GNUNET_SYSERR; } @@ -1188,7 +1188,7 @@ static struct TALER_DenominationSignature refresh_exchange_coin (struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, const struct GNUNET_HashCode *session_hash, - struct TMH_KS_StateHandle *key_state, + struct TEH_KS_StateHandle *key_state, const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coin, unsigned int coin_off) @@ -1196,9 +1196,9 @@ refresh_exchange_coin (struct MHD_Connection *connection, struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; struct TALER_DenominationSignature ev_sig; - dki = TMH_KS_denomination_key_lookup (key_state, + dki = TEH_KS_denomination_key_lookup (key_state, denom_pub, - TMH_KS_DKU_WITHDRAW); + TEH_KS_DKU_WITHDRAW); if (NULL == dki) { GNUNET_break (0); @@ -1215,7 +1215,7 @@ refresh_exchange_coin (struct MHD_Connection *connection, return ev_sig; } if (GNUNET_OK != - TMH_plugin->insert_refresh_out (TMH_plugin->cls, + TEH_plugin->insert_refresh_out (TEH_plugin->cls, session, session_hash, coin_off, @@ -1257,11 +1257,11 @@ execute_refresh_reveal_transaction (struct MHD_Connection *connection, struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins) { unsigned int j; - struct TMH_KS_StateHandle *key_state; + struct TEH_KS_StateHandle *key_state; int ret; START_TRANSACTION (session, connection); - key_state = TMH_KS_acquire (); + key_state = TEH_KS_acquire (); for (j=0;jnum_newcoins;j++) { if (NULL == ev_sigs[j].rsa_signature) /* could be non-NULL during retries */ @@ -1274,16 +1274,16 @@ execute_refresh_reveal_transaction (struct MHD_Connection *connection, j); if (NULL == ev_sigs[j].rsa_signature) { - ret = TMH_RESPONSE_reply_internal_db_error (connection); + ret = TEH_RESPONSE_reply_internal_db_error (connection); goto cleanup; } } COMMIT_TRANSACTION (session, connection); - ret = TMH_RESPONSE_reply_refresh_reveal_success (connection, + ret = TEH_RESPONSE_reply_refresh_reveal_success (connection, refresh_session->num_newcoins, ev_sigs); cleanup: - TMH_KS_release (key_state); + TEH_KS_release (key_state); return ret; } @@ -1302,7 +1302,7 @@ execute_refresh_reveal_transaction (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, +TEH_DB_execute_refresh_reveal (struct MHD_Connection *connection, const struct GNUNET_HashCode *session_hash, struct TALER_TransferPrivateKeyP *transfer_privs) { @@ -1320,26 +1320,26 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, int ret; struct TALER_TransferPublicKeyP gamma_tp; - if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls))) + if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } - res = TMH_plugin->get_refresh_session (TMH_plugin->cls, + res = TEH_plugin->get_refresh_session (TEH_plugin->cls, session, session_hash, &refresh_session); if (GNUNET_NO == res) - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "session_hash"); if ( (GNUNET_SYSERR == res) || (refresh_session.noreveal_index >= TALER_CNC_KAPPA) ) - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); denom_pubs = GNUNET_new_array (refresh_session.num_newcoins, struct TALER_DenominationPublicKey); if (GNUNET_OK != - TMH_plugin->get_refresh_order (TMH_plugin->cls, + TEH_plugin->get_refresh_order (TEH_plugin->cls, session, session_hash, refresh_session.num_newcoins, @@ -1349,7 +1349,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, GNUNET_free (denom_pubs); GNUNET_CRYPTO_rsa_signature_free (refresh_session.melt.coin.denom_sig.rsa_signature); GNUNET_CRYPTO_rsa_public_key_free (refresh_session.melt.coin.denom_pub.rsa_public_key); - return (MHD_YES == TMH_RESPONSE_reply_internal_db_error (connection)) + return (MHD_YES == TEH_RESPONSE_reply_internal_db_error (connection)) ? GNUNET_NO : GNUNET_SYSERR; } @@ -1363,7 +1363,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, off = 1; /* obtain gamma_tp from db */ if (GNUNET_OK != - TMH_plugin->get_refresh_transfer_public_key (TMH_plugin->cls, + TEH_plugin->get_refresh_transfer_public_key (TEH_plugin->cls, session, session_hash, &gamma_tp)) @@ -1373,7 +1373,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, GNUNET_CRYPTO_rsa_signature_free (refresh_session.melt.coin.denom_sig.rsa_signature); GNUNET_CRYPTO_rsa_public_key_free (refresh_session.melt.coin.denom_pub.rsa_public_key); GNUNET_CRYPTO_hash_context_abort (hash_context); - return (MHD_YES == TMH_RESPONSE_reply_internal_db_error (connection)) + return (MHD_YES == TEH_RESPONSE_reply_internal_db_error (connection)) ? GNUNET_NO : GNUNET_SYSERR; } GNUNET_CRYPTO_hash_context_read (hash_context, @@ -1399,7 +1399,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, struct TALER_DenominationPublicKey denom_pubs[refresh_session.num_newcoins]; if (GNUNET_OK != - TMH_plugin->get_refresh_order (TMH_plugin->cls, + TEH_plugin->get_refresh_order (TEH_plugin->cls, session, session_hash, refresh_session.num_newcoins, @@ -1410,7 +1410,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, GNUNET_CRYPTO_rsa_signature_free (refresh_session.melt.coin.denom_sig.rsa_signature); GNUNET_CRYPTO_rsa_public_key_free (refresh_session.melt.coin.denom_pub.rsa_public_key); GNUNET_CRYPTO_hash_context_abort (hash_context); - return (MHD_YES == TMH_RESPONSE_reply_internal_db_error (connection)) + return (MHD_YES == TEH_RESPONSE_reply_internal_db_error (connection)) ? GNUNET_NO : GNUNET_SYSERR; } for (i=0;iget_refresh_commit_coins (TMH_plugin->cls, + TEH_plugin->get_refresh_commit_coins (TEH_plugin->cls, session, session_hash, refresh_session.num_newcoins, @@ -1463,7 +1463,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, GNUNET_CRYPTO_rsa_signature_free (refresh_session.melt.coin.denom_sig.rsa_signature); GNUNET_CRYPTO_rsa_public_key_free (refresh_session.melt.coin.denom_pub.rsa_public_key); GNUNET_CRYPTO_hash_context_abort (hash_context); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } /* add envelopes to hash_context */ for (j=0;jstatus) return; - ldl = TMH_plugin->get_link_data_list (TMH_plugin->cls, + ldl = TEH_plugin->get_link_data_list (TEH_plugin->cls, ctx->session, session_hash); if (NULL == ldl) { ctx->status = GNUNET_NO; if (MHD_NO == - TMH_RESPONSE_reply_json_pack (ctx->connection, + TEH_RESPONSE_reply_json_pack (ctx->connection, MHD_HTTP_NOT_FOUND, "{s:s}", "error", @@ -1648,23 +1648,23 @@ handle_transfer_data (void *cls, * @return MHD result code */ int -TMH_DB_execute_refresh_link (struct MHD_Connection *connection, +TEH_DB_execute_refresh_link (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub) { struct HTD_Context ctx; int res; unsigned int i; - if (NULL == (ctx.session = TMH_plugin->get_session (TMH_plugin->cls))) + if (NULL == (ctx.session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } ctx.connection = connection; ctx.num_sessions = 0; ctx.sessions = NULL; ctx.status = GNUNET_OK; - res = TMH_plugin->get_transfer (TMH_plugin->cls, + res = TEH_plugin->get_transfer (TEH_plugin->cls, ctx.session, coin_pub, &handle_transfer_data, @@ -1681,14 +1681,14 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection, } GNUNET_assert (GNUNET_OK == ctx.status); if (0 == ctx.num_sessions) - return TMH_RESPONSE_reply_arg_unknown (connection, + return TEH_RESPONSE_reply_arg_unknown (connection, "coin_pub"); - res = TMH_RESPONSE_reply_refresh_link_success (connection, + res = TEH_RESPONSE_reply_refresh_link_success (connection, ctx.num_sessions, ctx.sessions); cleanup: for (i=0;ifree_link_data_list (TMH_plugin->cls, + TEH_plugin->free_link_data_list (TEH_plugin->cls, ctx.sessions[i].ldl); GNUNET_free_non_null (ctx.sessions); return res; @@ -1709,7 +1709,7 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection, +TEH_DB_execute_admin_add_incoming (struct MHD_Connection *connection, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_Amount *amount, struct GNUNET_TIME_Absolute execution_time, @@ -1719,12 +1719,12 @@ TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session; int ret; - if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls))) + if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } - ret = TMH_plugin->reserves_in_insert (TMH_plugin->cls, + ret = TEH_plugin->reserves_in_insert (TEH_plugin->cls, session, reserve_pub, amount, @@ -1734,9 +1734,9 @@ TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection, if (GNUNET_SYSERR == ret) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:s}", "status", @@ -1780,12 +1780,12 @@ struct WtidTransactionContext /** * Head of DLL with details for /wire/deposit response. */ - struct TMH_TrackTransferDetail *wdd_head; + struct TEH_TrackTransferDetail *wdd_head; /** * Head of DLL with details for /wire/deposit response. */ - struct TMH_TrackTransferDetail *wdd_tail; + struct TEH_TrackTransferDetail *wdd_tail; /** * JSON array with details about the individual deposits. @@ -1831,7 +1831,7 @@ handle_transaction_data (void *cls, { struct WtidTransactionContext *ctx = cls; struct TALER_Amount delta; - struct TMH_TrackTransferDetail *wdd; + struct TEH_TrackTransferDetail *wdd; if (GNUNET_SYSERR == ctx->is_valid) return; @@ -1883,7 +1883,7 @@ handle_transaction_data (void *cls, return; } } - wdd = GNUNET_new (struct TMH_TrackTransferDetail); + wdd = GNUNET_new (struct TEH_TrackTransferDetail); wdd->deposit_value = *deposit_value; wdd->deposit_fee = *deposit_fee; wdd->h_contract = *h_contract; @@ -1904,23 +1904,23 @@ handle_transaction_data (void *cls, * @return MHD result code */ int -TMH_DB_execute_track_transfer (struct MHD_Connection *connection, +TEH_DB_execute_track_transfer (struct MHD_Connection *connection, const struct TALER_WireTransferIdentifierRawP *wtid) { int ret; struct WtidTransactionContext ctx; struct TALER_EXCHANGEDB_Session *session; - struct TMH_TrackTransferDetail *wdd; + struct TEH_TrackTransferDetail *wdd; - if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls))) + if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } ctx.is_valid = GNUNET_NO; ctx.wdd_head = NULL; ctx.wdd_tail = NULL; - ret = TMH_plugin->lookup_wire_transfer (TMH_plugin->cls, + ret = TEH_plugin->lookup_wire_transfer (TEH_plugin->cls, session, wtid, &handle_transaction_data, @@ -1928,22 +1928,22 @@ TMH_DB_execute_track_transfer (struct MHD_Connection *connection, if (GNUNET_SYSERR == ret) { GNUNET_break (0); - ret = TMH_RESPONSE_reply_internal_db_error (connection); + ret = TEH_RESPONSE_reply_internal_db_error (connection); goto cleanup; } if (GNUNET_SYSERR == ctx.is_valid) { GNUNET_break (0); - ret = TMH_RESPONSE_reply_internal_db_error (connection); + ret = TEH_RESPONSE_reply_internal_db_error (connection); goto cleanup; } if (GNUNET_NO == ctx.is_valid) { - ret = TMH_RESPONSE_reply_arg_unknown (connection, + ret = TEH_RESPONSE_reply_arg_unknown (connection, "wtid"); goto cleanup; } - ret = TMH_RESPONSE_reply_track_transfer_details (connection, + ret = TEH_RESPONSE_reply_track_transfer_details (connection, &ctx.total, &ctx.merchant_pub, &ctx.h_wire, @@ -2026,7 +2026,7 @@ handle_wtid_data (void *cls, if (NULL == wtid) { - ctx->res = TMH_RESPONSE_reply_transfer_pending (ctx->connection, + ctx->res = TEH_RESPONSE_reply_transfer_pending (ctx->connection, execution_time); } else @@ -2037,11 +2037,11 @@ handle_wtid_data (void *cls, coin_fee)) { GNUNET_break (0); - ctx->res = TMH_RESPONSE_reply_internal_db_error (ctx->connection); + ctx->res = TEH_RESPONSE_reply_internal_db_error (ctx->connection); } else { - ctx->res = TMH_RESPONSE_reply_track_transaction (ctx->connection, + ctx->res = TEH_RESPONSE_reply_track_transaction (ctx->connection, &ctx->h_contract, &ctx->h_wire, &ctx->coin_pub, @@ -2067,7 +2067,7 @@ handle_wtid_data (void *cls, * @return MHD result code */ int -TMH_DB_execute_track_transaction (struct MHD_Connection *connection, +TEH_DB_execute_track_transaction (struct MHD_Connection *connection, const struct GNUNET_HashCode *h_contract, const struct GNUNET_HashCode *h_wire, const struct TALER_CoinSpendPublicKeyP *coin_pub, @@ -2078,10 +2078,10 @@ TMH_DB_execute_track_transaction (struct MHD_Connection *connection, struct DepositWtidContext ctx; struct TALER_EXCHANGEDB_Session *session; - if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls))) + if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } ctx.connection = connection; ctx.h_contract = *h_contract; @@ -2089,7 +2089,7 @@ TMH_DB_execute_track_transaction (struct MHD_Connection *connection, ctx.coin_pub = *coin_pub; ctx.transaction_id = transaction_id; ctx.res = GNUNET_SYSERR; - ret = TMH_plugin->wire_lookup_deposit_wtid (TMH_plugin->cls, + ret = TEH_plugin->wire_lookup_deposit_wtid (TEH_plugin->cls, session, h_contract, h_wire, @@ -2102,17 +2102,17 @@ TMH_DB_execute_track_transaction (struct MHD_Connection *connection, { GNUNET_break (0); GNUNET_break (GNUNET_SYSERR == ctx.res); - return TMH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_internal_db_error (connection); } if (GNUNET_NO == ret) { GNUNET_break (GNUNET_SYSERR == ctx.res); - return TMH_RESPONSE_reply_transaction_unknown (connection); + return TEH_RESPONSE_reply_transaction_unknown (connection); } if (GNUNET_SYSERR == ctx.res) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "bug resolving deposit wtid"); } return ctx.res; diff --git a/src/exchange/taler-exchange-httpd_db.h b/src/exchange/taler-exchange-httpd_db.h index 67fe8d5b4..87db87f19 100644 --- a/src/exchange/taler-exchange-httpd_db.h +++ b/src/exchange/taler-exchange-httpd_db.h @@ -36,7 +36,7 @@ * @return MHD result code */ int -TMH_DB_execute_deposit (struct MHD_Connection *connection, +TEH_DB_execute_deposit (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_Deposit *deposit); @@ -50,7 +50,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_refund (struct MHD_Connection *connection, +TEH_DB_execute_refund (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_Refund *refund); @@ -63,7 +63,7 @@ TMH_DB_execute_refund (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_reserve_status (struct MHD_Connection *connection, +TEH_DB_execute_reserve_status (struct MHD_Connection *connection, const struct TALER_ReservePublicKeyP *reserve_pub); @@ -82,7 +82,7 @@ TMH_DB_execute_reserve_status (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, +TEH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, const struct TALER_ReservePublicKeyP *reserve, const struct TALER_DenominationPublicKey *denomination_pub, const char *blinded_msg, @@ -93,7 +93,7 @@ TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, /** * @brief Details about a melt operation of an individual coin. */ -struct TMH_DB_MeltDetails +struct TEH_DB_MeltDetails { /** @@ -142,11 +142,11 @@ struct TMH_DB_MeltDetails * @return MHD result code */ int -TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, +TEH_DB_execute_refresh_melt (struct MHD_Connection *connection, const struct GNUNET_HashCode *session_hash, unsigned int num_new_denoms, const struct TALER_DenominationPublicKey *denom_pubs, - const struct TMH_DB_MeltDetails *coin_melt_details, + const struct TEH_DB_MeltDetails *coin_melt_details, struct TALER_EXCHANGEDB_RefreshCommitCoin *const* commit_coin, const struct TALER_TransferPublicKeyP *transfer_pubs); @@ -164,7 +164,7 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, +TEH_DB_execute_refresh_reveal (struct MHD_Connection *connection, const struct GNUNET_HashCode *session_hash, struct TALER_TransferPrivateKeyP *transfer_privs); @@ -179,7 +179,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_refresh_link (struct MHD_Connection *connection, +TEH_DB_execute_refresh_link (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub); @@ -196,7 +196,7 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection, +TEH_DB_execute_admin_add_incoming (struct MHD_Connection *connection, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_Amount *amount, struct GNUNET_TIME_Absolute execution_time, @@ -213,7 +213,7 @@ TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_track_transfer (struct MHD_Connection *connection, +TEH_DB_execute_track_transfer (struct MHD_Connection *connection, const struct TALER_WireTransferIdentifierRawP *wtid); @@ -230,7 +230,7 @@ TMH_DB_execute_track_transfer (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_track_transaction (struct MHD_Connection *connection, +TEH_DB_execute_track_transaction (struct MHD_Connection *connection, const struct GNUNET_HashCode *h_contract, const struct GNUNET_HashCode *h_wire, const struct TALER_CoinSpendPublicKeyP *coin_pub, diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index 144edfa96..a97dd0514 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -50,7 +50,7 @@ static int verify_and_execute_deposit (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_Deposit *deposit) { - struct TMH_KS_StateHandle *key_state; + struct TEH_KS_StateHandle *key_state; struct TALER_DepositRequestPS dr; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; struct TALER_Amount fee_deposit; @@ -75,19 +75,19 @@ verify_and_execute_deposit (struct MHD_Connection *connection, &deposit->coin.coin_pub.eddsa_pub)) { TALER_LOG_WARNING ("Invalid signature on /deposit request\n"); - return TMH_RESPONSE_reply_signature_invalid (connection, + return TEH_RESPONSE_reply_signature_invalid (connection, "coin_sig"); } /* check denomination exists and is valid */ - key_state = TMH_KS_acquire (); - dki = TMH_KS_denomination_key_lookup (key_state, + key_state = TEH_KS_acquire (); + dki = TEH_KS_denomination_key_lookup (key_state, &deposit->coin.denom_pub, - TMH_KS_DKU_DEPOSIT); + TEH_KS_DKU_DEPOSIT); if (NULL == dki) { - TMH_KS_release (key_state); + TEH_KS_release (key_state); TALER_LOG_WARNING ("Unknown denomination key in /deposit request\n"); - return TMH_RESPONSE_reply_arg_unknown (connection, + return TEH_RESPONSE_reply_arg_unknown (connection, "denom_pub"); } /* check coin signature */ @@ -95,8 +95,8 @@ verify_and_execute_deposit (struct MHD_Connection *connection, TALER_test_coin_valid (&deposit->coin)) { TALER_LOG_WARNING ("Invalid coin passed for /deposit\n"); - TMH_KS_release (key_state); - return TMH_RESPONSE_reply_signature_invalid (connection, + TEH_KS_release (key_state); + return TEH_RESPONSE_reply_signature_invalid (connection, "ub_sig"); } TALER_amount_ntoh (&fee_deposit, @@ -104,13 +104,13 @@ verify_and_execute_deposit (struct MHD_Connection *connection, if (0 < TALER_amount_cmp (&fee_deposit, &deposit->amount_with_fee)) { - TMH_KS_release (key_state); - return TMH_RESPONSE_reply_external_error (connection, + TEH_KS_release (key_state); + return TEH_RESPONSE_reply_external_error (connection, "deposited amount smaller than depositing fee"); } - TMH_KS_release (key_state); + TEH_KS_release (key_state); - return TMH_DB_execute_deposit (connection, + return TEH_DB_execute_deposit (connection, deposit); } @@ -130,7 +130,7 @@ verify_and_execute_deposit (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh, +TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -141,7 +141,7 @@ TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh, json_t *wire; struct TALER_EXCHANGEDB_Deposit deposit; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; - struct TMH_KS_StateHandle *ks; + struct TEH_KS_StateHandle *ks; struct GNUNET_HashCode my_h_wire; struct TALER_Amount amount; struct GNUNET_JSON_Specification spec[] = { @@ -161,7 +161,7 @@ TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -171,7 +171,7 @@ TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh, if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; memset (&deposit, 0, sizeof (deposit)); - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, json, spec); json_decref (json); @@ -184,16 +184,16 @@ TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh, { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "refund_deadline"); } if (GNUNET_YES != - TMH_json_validate_wireformat (wire, + TEH_json_validate_wireformat (wire, GNUNET_NO)) { GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_arg_unknown (connection, + return TEH_RESPONSE_reply_arg_unknown (connection, "wire"); } if (GNUNET_OK != @@ -202,7 +202,7 @@ TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh, { TALER_LOG_WARNING ("Failed to parse JSON wire format specification for /deposit request\n"); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "wire"); } if (0 != memcmp (&deposit.h_wire, @@ -211,23 +211,23 @@ TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh, { /* Client hashed contract differently than we did, reject */ GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "H_wire"); } - ks = TMH_KS_acquire (); - dki = TMH_KS_denomination_key_lookup (ks, + ks = TEH_KS_acquire (); + dki = TEH_KS_denomination_key_lookup (ks, &deposit.coin.denom_pub, - TMH_KS_DKU_DEPOSIT); + TEH_KS_DKU_DEPOSIT); if (NULL == dki) { - TMH_KS_release (ks); + TEH_KS_release (ks); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_arg_unknown (connection, + return TEH_RESPONSE_reply_arg_unknown (connection, "denom_pub"); } TALER_amount_ntoh (&deposit.deposit_fee, &dki->issue.properties.fee_deposit); - TMH_KS_release (ks); + TEH_KS_release (ks); deposit.receiver_wire_account = wire; deposit.amount_with_fee = amount; if (-1 == TALER_amount_cmp (&deposit.amount_with_fee, @@ -235,7 +235,7 @@ TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh, { /* Total amount smaller than fee, invalid */ GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "f"); } res = verify_and_execute_deposit (connection, diff --git a/src/exchange/taler-exchange-httpd_deposit.h b/src/exchange/taler-exchange-httpd_deposit.h index 602f69c3c..7bfe5720b 100644 --- a/src/exchange/taler-exchange-httpd_deposit.h +++ b/src/exchange/taler-exchange-httpd_deposit.h @@ -41,7 +41,7 @@ * @return MHD result code */ int -TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh, +TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index 748f41ed3..ef83f305c 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -33,12 +33,12 @@ * the exchange. There can be multiple instances of this struct, as it is * reference counted and only destroyed once the last user is done * with it. The current instance is acquired using - * #TMH_KS_acquire(). Using this function increases the + * #TEH_KS_acquire(). Using this function increases the * reference count. The contents of this structure (except for the * reference counter) should be considered READ-ONLY until it is * ultimately destroyed (as there can be many concurrent users). */ -struct TMH_KS_StateHandle +struct TEH_KS_StateHandle { /** * JSON array with denomination keys. (Currently not really used @@ -60,7 +60,7 @@ struct TMH_KS_StateHandle /** * Cached JSON text that the exchange will send for a "/keys" request. - * Includes our @e TMH_master_public_key public key, the signing and + * Includes our @e TEH_master_public_key public key, the signing and * denomination keys as well as the @e reload_time. */ char *keys_json; @@ -107,9 +107,9 @@ struct TMH_KS_StateHandle /** * Exchange key state. Never use directly, instead access via - * #TMH_KS_acquire() and #TMH_KS_release(). + * #TEH_KS_acquire() and #TEH_KS_release(). */ -static struct TMH_KS_StateHandle *internal_key_state; +static struct TEH_KS_StateHandle *internal_key_state; /** * Mutex protecting access to #internal_key_state. @@ -219,7 +219,7 @@ reload_keys_denom_iter (void *cls, const char *alias, const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki) { - struct TMH_KS_StateHandle *ctx = cls; + struct TEH_KS_StateHandle *ctx = cls; struct GNUNET_TIME_Absolute now; struct GNUNET_TIME_Absolute horizon; struct GNUNET_TIME_Absolute expire_deposit; @@ -257,7 +257,7 @@ reload_keys_denom_iter (void *cls, sizeof (struct GNUNET_HashCode)); if (0 != memcmp (&dki->issue.properties.master, - &TMH_master_public_key, + &TEH_master_public_key, sizeof (struct TALER_MasterPublicKeyP))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -267,7 +267,7 @@ reload_keys_denom_iter (void *cls, } - session = TMH_plugin->get_session (TMH_plugin->cls); + session = TEH_plugin->get_session (TEH_plugin->cls); if (NULL == session) return GNUNET_SYSERR; /* Try to insert DKI into DB until we succeed; note that if the DB @@ -277,7 +277,7 @@ reload_keys_denom_iter (void *cls, res = GNUNET_SYSERR; while (GNUNET_OK != res) { - res = TMH_plugin->start (TMH_plugin->cls, + res = TEH_plugin->start (TEH_plugin->cls, session); if (GNUNET_OK != res) { @@ -285,7 +285,7 @@ reload_keys_denom_iter (void *cls, GNUNET_break (0); continue; } - res = TMH_plugin->get_denomination_info (TMH_plugin->cls, + res = TEH_plugin->get_denomination_info (TEH_plugin->cls, session, &dki->denom_pub, NULL); @@ -293,18 +293,18 @@ reload_keys_denom_iter (void *cls, { /* Fetch failed!? Very bad error, log and retry */ GNUNET_break (0); - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); continue; } if (GNUNET_OK == res) { /* Record exists, we're good, just exit */ - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); break; } - res = TMH_plugin->insert_denomination_info (TMH_plugin->cls, + res = TEH_plugin->insert_denomination_info (TEH_plugin->cls, session, &dki->denom_pub, &dki->issue); @@ -312,11 +312,11 @@ reload_keys_denom_iter (void *cls, { /* Insert failed!? Very bad error, log and retry */ GNUNET_break (0); - TMH_plugin->rollback (TMH_plugin->cls, + TEH_plugin->rollback (TEH_plugin->cls, session); continue; } - res = TMH_plugin->commit (TMH_plugin->cls, + res = TEH_plugin->commit (TEH_plugin->cls, session); /* If commit succeeded, we're done, otherwise we retry; this time without logging, as theroetically commits can fail @@ -382,7 +382,7 @@ sign_key_issue_to_json (const struct TALER_ExchangeSigningKeyValidityPS *ski) /** * Iterator for sign keys. * - * @param cls closure with the `struct TMH_KS_StateHandle *` + * @param cls closure with the `struct TEH_KS_StateHandle *` * @param filename name of the file the key came from * @param ski the sign key issue * @return #GNUNET_OK to continue to iterate, @@ -394,7 +394,7 @@ reload_keys_sign_iter (void *cls, const char *filename, const struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP *ski) { - struct TMH_KS_StateHandle *ctx = cls; + struct TEH_KS_StateHandle *ctx = cls; struct GNUNET_TIME_Absolute now; struct GNUNET_TIME_Absolute horizon; @@ -418,7 +418,7 @@ reload_keys_sign_iter (void *cls, } if (0 != memcmp (&ski->issue.master_public_key, - &TMH_master_public_key, + &TEH_master_public_key, sizeof (struct TALER_MasterPublicKeyP))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -489,7 +489,7 @@ auditor_to_json (const struct TALER_AuditorPublicKeyP *apub, * add the auditor information to our /keys response (if it is * (still) applicable). * - * @param cls closure with the `struct TMH_KS_StateHandle *` + * @param cls closure with the `struct TEH_KS_StateHandle *` * @param apub the auditor's public key * @param auditor_url URL of the auditor * @param mpub the exchange's public key (as expected by the auditor) @@ -509,7 +509,7 @@ reload_auditor_iter (void *cls, const struct TALER_AuditorSignatureP *asigs, const struct TALER_DenominationKeyValidityPS *dki) { - struct TMH_KS_StateHandle *ctx = cls; + struct TEH_KS_StateHandle *ctx = cls; unsigned int i; unsigned int keep; const struct TALER_AuditorSignatureP *kept_asigs[dki_len]; @@ -517,7 +517,7 @@ reload_auditor_iter (void *cls, /* Check if the signature is at least for this exchange. */ if (0 != memcmp (&mpub->eddsa_pub, - &TMH_master_public_key, + &TEH_master_public_key, sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -553,7 +553,7 @@ reload_auditor_iter (void *cls, /** * Iterator for freeing denomination keys. * - * @param cls closure with the `struct TMH_KS_StateHandle` + * @param cls closure with the `struct TEH_KS_StateHandle` * @param key key for the denomination key * @param value coin details * @return #GNUNET_OK to continue to iterate, @@ -581,7 +581,7 @@ free_denom_key (void *cls, * @param key_state the key state to release */ static void -ks_release_ (struct TMH_KS_StateHandle *key_state) +ks_release_ (struct TEH_KS_StateHandle *key_state) { GNUNET_assert (0 < key_state->refcnt); key_state->refcnt--; @@ -618,8 +618,8 @@ ks_release_ (struct TMH_KS_StateHandle *key_state) * @param key_state the key state to release */ void -TMH_KS_release_ (const char *location, - struct TMH_KS_StateHandle *key_state) +TEH_KS_release_ (const char *location, + struct TEH_KS_StateHandle *key_state) { GNUNET_assert (0 == pthread_mutex_lock (&internal_key_state_mutex)); ks_release_ (key_state); @@ -629,17 +629,17 @@ TMH_KS_release_ (const char *location, /** * Acquire the key state of the exchange. Updates keys if necessary. - * For every call to #TMH_KS_acquire(), a matching call - * to #TMH_KS_release() must be made. + * For every call to #TEH_KS_acquire(), a matching call + * to #TEH_KS_release() must be made. * * @param location name of the function in which the lock is acquired * @return the key state */ -struct TMH_KS_StateHandle * -TMH_KS_acquire_ (const char *location) +struct TEH_KS_StateHandle * +TEH_KS_acquire_ (const char *location) { struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); - struct TMH_KS_StateHandle *key_state; + struct TEH_KS_StateHandle *key_state; json_t *keys; struct TALER_ExchangeKeySetPS ks; struct TALER_ExchangeSignatureP sig; @@ -653,7 +653,7 @@ TMH_KS_acquire_ (const char *location) } if (NULL == internal_key_state) { - key_state = GNUNET_new (struct TMH_KS_StateHandle); + key_state = GNUNET_new (struct TEH_KS_StateHandle); key_state->hash_context = GNUNET_CRYPTO_hash_context_start (); key_state->min_dk_expire = GNUNET_TIME_UNIT_FOREVER_ABS; @@ -672,11 +672,11 @@ TMH_KS_acquire_ (const char *location) GNUNET_TIME_round_abs (&key_state->reload_time); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loading keys from `%s'\n", - TMH_exchange_directory); - TALER_EXCHANGEDB_denomination_keys_iterate (TMH_exchange_directory, + TEH_exchange_directory); + TALER_EXCHANGEDB_denomination_keys_iterate (TEH_exchange_directory, &reload_keys_denom_iter, key_state); - TALER_EXCHANGEDB_signing_keys_iterate (TMH_exchange_directory, + TALER_EXCHANGEDB_signing_keys_iterate (TEH_exchange_directory, &reload_keys_sign_iter, key_state); TALER_EXCHANGEDB_auditor_iterate (cfg, @@ -684,7 +684,7 @@ TMH_KS_acquire_ (const char *location) key_state); if (0 != memcmp (&key_state->current_sign_key_issue.issue.master_public_key, - &TMH_master_public_key, + &TEH_master_public_key, sizeof (struct TALER_MasterPublicKeyP))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -712,7 +712,7 @@ TMH_KS_acquire_ (const char *location) keys = json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o, s:o}", "master_public_key", - GNUNET_JSON_from_data_auto (&TMH_master_public_key), + GNUNET_JSON_from_data_auto (&TEH_master_public_key), "signkeys", key_state->sign_keys_array, "denoms", key_state->denom_keys_array, "auditors", key_state->auditors_array, @@ -747,9 +747,9 @@ TMH_KS_acquire_ (const char *location) * or NULL if denom_pub could not be found */ struct TALER_EXCHANGEDB_DenominationKeyIssueInformation * -TMH_KS_denomination_key_lookup (const struct TMH_KS_StateHandle *key_state, +TEH_KS_denomination_key_lookup (const struct TEH_KS_StateHandle *key_state, const struct TALER_DenominationPublicKey *denom_pub, - enum TMH_KS_DenominationKeyUse use) + enum TEH_KS_DenominationKeyUse use) { struct GNUNET_HashCode hc; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; @@ -773,7 +773,7 @@ TMH_KS_denomination_key_lookup (const struct TMH_KS_StateHandle *key_state, now = GNUNET_TIME_absolute_get (); switch (use) { - case TMH_KS_DKU_WITHDRAW: + case TEH_KS_DKU_WITHDRAW: if (now.abs_value_us > GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_withdraw).abs_value_us) { @@ -783,7 +783,7 @@ TMH_KS_denomination_key_lookup (const struct TMH_KS_StateHandle *key_state, return NULL; } break; - case TMH_KS_DKU_DEPOSIT: + case TEH_KS_DKU_DEPOSIT: if (now.abs_value_us > GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_deposit).abs_value_us) { @@ -891,7 +891,7 @@ handle_sigchld () * #GNUNET_NO to restart an update version of the binary */ int -TMH_KS_loop (void) +TEH_KS_loop (void) { struct GNUNET_SIGNAL_Context *sigusr1; struct GNUNET_SIGNAL_Context *sigterm; @@ -927,12 +927,12 @@ TMH_KS_loop (void) "(re-)loading keys\n"); if (NULL != internal_key_state) { - TMH_KS_release (internal_key_state); + TEH_KS_release (internal_key_state); internal_key_state = NULL; } /* This will re-initialize 'internal_key_state' with an initial refcnt of 1 */ - if (NULL == TMH_KS_acquire ()) + if (NULL == TEH_KS_acquire ()) { ret = GNUNET_SYSERR; break; @@ -978,7 +978,7 @@ read_again: } if (NULL != internal_key_state) { - TMH_KS_release (internal_key_state); + TEH_KS_release (internal_key_state); internal_key_state = NULL; } GNUNET_SIGNAL_handler_uninstall (sigusr1); @@ -998,20 +998,20 @@ read_again: * @param[out] sig signature over purpose using current signing key */ void -TMH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, +TEH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct TALER_ExchangePublicKeyP *pub, struct TALER_ExchangeSignatureP *sig) { - struct TMH_KS_StateHandle *key_state; + struct TEH_KS_StateHandle *key_state; - key_state = TMH_KS_acquire (); + key_state = TEH_KS_acquire (); *pub = key_state->current_sign_key_issue.issue.signkey_pub; GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (&key_state->current_sign_key_issue.signkey_priv.eddsa_priv, purpose, &sig->eddsa_signature)); - TMH_KS_release (key_state); + TEH_KS_release (key_state); } @@ -1079,28 +1079,28 @@ get_date_string (struct GNUNET_TIME_Absolute at, * @return MHD result code */ int -TMH_KS_handler_keys (struct TMH_RequestHandler *rh, +TEH_KS_handler_keys (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, size_t *upload_data_size) { - struct TMH_KS_StateHandle *key_state; + struct TEH_KS_StateHandle *key_state; struct MHD_Response *response; int ret; char dat[128]; - key_state = TMH_KS_acquire (); + key_state = TEH_KS_acquire (); response = MHD_create_response_from_buffer (strlen (key_state->keys_json), key_state->keys_json, MHD_RESPMEM_MUST_COPY); - TMH_KS_release (key_state); + TEH_KS_release (key_state); if (NULL == response) { GNUNET_break (0); return MHD_NO; } - TMH_RESPONSE_add_global_headers (response); + TEH_RESPONSE_add_global_headers (response); GNUNET_break (MHD_YES == MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, diff --git a/src/exchange/taler-exchange-httpd_keystate.h b/src/exchange/taler-exchange-httpd_keystate.h index 76427dbbd..12aa241d7 100644 --- a/src/exchange/taler-exchange-httpd_keystate.h +++ b/src/exchange/taler-exchange-httpd_keystate.h @@ -33,19 +33,19 @@ * Snapshot of the (coin and signing) * keys (including private keys) of the exchange. */ -struct TMH_KS_StateHandle; +struct TEH_KS_StateHandle; /** * Acquire the key state of the exchange. Updates keys if necessary. - * For every call to #TMH_KS_acquire(), a matching call - * to #TMH_KS_release() must be made. + * For every call to #TEH_KS_acquire(), a matching call + * to #TEH_KS_release() must be made. * * @param location name of the function in which the lock is acquired * @return the key state */ -struct TMH_KS_StateHandle * -TMH_KS_acquire_ (const char *location); +struct TEH_KS_StateHandle * +TEH_KS_acquire_ (const char *location); /** @@ -55,18 +55,18 @@ TMH_KS_acquire_ (const char *location); * @param key_state the key state to release */ void -TMH_KS_release_ (const char *location, - struct TMH_KS_StateHandle *key_state); +TEH_KS_release_ (const char *location, + struct TEH_KS_StateHandle *key_state); /** * Acquire the key state of the exchange. Updates keys if necessary. - * For every call to #TMH_KS_acquire(), a matching call - * to #TMH_KS_release() must be made. + * For every call to #TEH_KS_acquire(), a matching call + * to #TEH_KS_release() must be made. * * @return the key state */ -#define TMH_KS_acquire(void) TMH_KS_acquire_(__FUNCTION__) +#define TEH_KS_acquire(void) TEH_KS_acquire_(__FUNCTION__) /** @@ -74,7 +74,7 @@ TMH_KS_release_ (const char *location, * * @param key_state the key state to release */ -#define TMH_KS_release(key_state) TMH_KS_release_ (__FUNCTION__, key_state) +#define TEH_KS_release(key_state) TEH_KS_release_ (__FUNCTION__, key_state) /** @@ -83,18 +83,18 @@ TMH_KS_release_ (const char *location, * periods for a key differ, the caller must specify which * use is relevant for the current operation. */ -enum TMH_KS_DenominationKeyUse { +enum TEH_KS_DenominationKeyUse { /** * The key is to be used for a /reserve/withdraw or /refresh (exchange) * operation. */ - TMH_KS_DKU_WITHDRAW, + TEH_KS_DKU_WITHDRAW, /** * The key is to be usd for a /deposit or /refresh (melt) operation. */ - TMH_KS_DKU_DEPOSIT + TEH_KS_DKU_DEPOSIT }; @@ -110,9 +110,9 @@ enum TMH_KS_DenominationKeyUse { * or NULL if denom_pub could not be found (or is not valid at this time for the given @a use) */ struct TALER_EXCHANGEDB_DenominationKeyIssueInformation * -TMH_KS_denomination_key_lookup (const struct TMH_KS_StateHandle *key_state, +TEH_KS_denomination_key_lookup (const struct TEH_KS_StateHandle *key_state, const struct TALER_DenominationPublicKey *denom_pub, - enum TMH_KS_DenominationKeyUse use); + enum TEH_KS_DenominationKeyUse use); /** @@ -125,7 +125,7 @@ TMH_KS_denomination_key_lookup (const struct TMH_KS_StateHandle *key_state, * #GNUNET_NO to restart an update version of the binary */ int -TMH_KS_loop (void); +TEH_KS_loop (void); /** @@ -137,7 +137,7 @@ TMH_KS_loop (void); * @param[out] sig signature over purpose using current signing key */ void -TMH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, +TEH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct TALER_ExchangePublicKeyP *pub, struct TALER_ExchangeSignatureP *sig); @@ -153,7 +153,7 @@ TMH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, * @return MHD result code */ int -TMH_KS_handler_keys (struct TMH_RequestHandler *rh, +TEH_KS_handler_keys (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, diff --git a/src/exchange/taler-exchange-httpd_mhd.c b/src/exchange/taler-exchange-httpd_mhd.c index 88debdd07..62db5a86f 100644 --- a/src/exchange/taler-exchange-httpd_mhd.c +++ b/src/exchange/taler-exchange-httpd_mhd.c @@ -44,7 +44,7 @@ * @return MHD result code */ int -TMH_MHD_handler_static_response (struct TMH_RequestHandler *rh, +TEH_MHD_handler_static_response (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -63,7 +63,7 @@ TMH_MHD_handler_static_response (struct TMH_RequestHandler *rh, GNUNET_break (0); return MHD_NO; } - TMH_RESPONSE_add_global_headers (response); + TEH_RESPONSE_add_global_headers (response); if (NULL != rh->mime_type) (void) MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, @@ -88,7 +88,7 @@ TMH_MHD_handler_static_response (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh, +TEH_MHD_handler_agpl_redirect (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -107,7 +107,7 @@ TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh, GNUNET_break (0); return MHD_NO; } - TMH_RESPONSE_add_global_headers (response); + TEH_RESPONSE_add_global_headers (response); if (NULL != rh->mime_type) (void) MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, @@ -135,13 +135,13 @@ TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_MHD_handler_send_json_pack_error (struct TMH_RequestHandler *rh, +TEH_MHD_handler_send_json_pack_error (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, size_t *upload_data_size) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, rh->response_code, "{s:s}", "error", diff --git a/src/exchange/taler-exchange-httpd_mhd.h b/src/exchange/taler-exchange-httpd_mhd.h index c53c3997a..62454b77e 100644 --- a/src/exchange/taler-exchange-httpd_mhd.h +++ b/src/exchange/taler-exchange-httpd_mhd.h @@ -40,7 +40,7 @@ * @return MHD result code */ int -TMH_MHD_handler_static_response (struct TMH_RequestHandler *rh, +TEH_MHD_handler_static_response (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -59,7 +59,7 @@ TMH_MHD_handler_static_response (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh, +TEH_MHD_handler_agpl_redirect (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -80,7 +80,7 @@ TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_MHD_helper_send_json_pack (struct TMH_RequestHandler *rh, +TEH_MHD_helper_send_json_pack (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void *connection_cls, int response_code, @@ -101,7 +101,7 @@ TMH_MHD_helper_send_json_pack (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_MHD_handler_send_json_pack_error (struct TMH_RequestHandler *rh, +TEH_MHD_handler_send_json_pack_error (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, diff --git a/src/exchange/taler-exchange-httpd_parsing.c b/src/exchange/taler-exchange-httpd_parsing.c index 3f2edb498..c7118c462 100644 --- a/src/exchange/taler-exchange-httpd_parsing.c +++ b/src/exchange/taler-exchange-httpd_parsing.c @@ -42,7 +42,7 @@ * realizes an MHD POST processor that will (incrementally) process * JSON data uploaded to the HTTP server. It will store the required * state in the @a con_cls, which must be cleaned up using - * #TMH_PARSE_post_cleanup_callback(). + * #TEH_PARSE_post_cleanup_callback(). * * @param connection the MHD connection * @param con_cls the closure (points to a `struct Buffer *`) @@ -61,7 +61,7 @@ * close HTTP session with MHD_NO) */ int -TMH_PARSE_post_json (struct MHD_Connection *connection, +TEH_PARSE_post_json (struct MHD_Connection *connection, void **con_cls, const char *upload_data, size_t *upload_data_size, @@ -78,18 +78,18 @@ TMH_PARSE_post_json (struct MHD_Connection *connection, { case GNUNET_JSON_PR_OUT_OF_MEMORY: return (MHD_NO == - TMH_RESPONSE_reply_internal_error (connection, + TEH_RESPONSE_reply_internal_error (connection, "out of memory")) ? GNUNET_SYSERR : GNUNET_NO; case GNUNET_JSON_PR_CONTINUE: return GNUNET_YES; case GNUNET_JSON_PR_REQUEST_TOO_LARGE: return (MHD_NO == - TMH_RESPONSE_reply_request_too_large (connection)) + TEH_RESPONSE_reply_request_too_large (connection)) ? GNUNET_SYSERR : GNUNET_NO; case GNUNET_JSON_PR_JSON_INVALID: return (MHD_YES == - TMH_RESPONSE_reply_invalid_json (connection)) + TEH_RESPONSE_reply_invalid_json (connection)) ? GNUNET_NO : GNUNET_SYSERR; case GNUNET_JSON_PR_SUCCESS: GNUNET_break (NULL != *json); @@ -106,10 +106,10 @@ TMH_PARSE_post_json (struct MHD_Connection *connection, * to clean up our state. * * @param con_cls value as it was left by - * #TMH_PARSE_post_json(), to be cleaned up + * #TEH_PARSE_post_json(), to be cleaned up */ void -TMH_PARSE_post_cleanup_callback (void *con_cls) +TEH_PARSE_post_cleanup_callback (void *con_cls) { GNUNET_JSON_post_parser_cleanup (con_cls); } @@ -131,7 +131,7 @@ TMH_PARSE_post_cleanup_callback (void *con_cls) * #GNUNET_SYSERR on internal error (error response could not be sent) */ int -TMH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection, +TEH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection, const char *param_name, void *out_data, size_t out_size) @@ -144,7 +144,7 @@ TMH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection, if (NULL == str) { return (MHD_NO == - TMH_RESPONSE_reply_arg_missing (connection, param_name)) + TEH_RESPONSE_reply_arg_missing (connection, param_name)) ? GNUNET_SYSERR : GNUNET_NO; } if (GNUNET_OK != @@ -153,7 +153,7 @@ TMH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection, out_data, out_size)) return (MHD_NO == - TMH_RESPONSE_reply_arg_invalid (connection, param_name)) + TEH_RESPONSE_reply_arg_invalid (connection, param_name)) ? GNUNET_SYSERR : GNUNET_NO; return GNUNET_OK; } @@ -174,7 +174,7 @@ TMH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection, * #GNUNET_SYSERR on internal error */ int -TMH_PARSE_json_data (struct MHD_Connection *connection, +TEH_PARSE_json_data (struct MHD_Connection *connection, const json_t *root, struct GNUNET_JSON_Specification *spec) { @@ -191,7 +191,7 @@ TMH_PARSE_json_data (struct MHD_Connection *connection, if (NULL == error_json_name) error_json_name = ""; ret = (MHD_YES == - TMH_RESPONSE_reply_json_pack (connection, + TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, "{s:s, s:s, s:I}", "error", "parse error", @@ -220,7 +220,7 @@ TMH_PARSE_json_data (struct MHD_Connection *connection, * #GNUNET_SYSERR on internal error */ int -TMH_PARSE_json_array (struct MHD_Connection *connection, +TEH_PARSE_json_array (struct MHD_Connection *connection, const json_t *root, struct GNUNET_JSON_Specification *spec, ...) @@ -243,7 +243,7 @@ TMH_PARSE_json_array (struct MHD_Connection *connection, if (NULL == root) { ret = (MHD_YES == - TMH_RESPONSE_reply_json_pack (connection, + TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, "{s:s, s:I}", "error", "parse error", @@ -260,7 +260,7 @@ TMH_PARSE_json_array (struct MHD_Connection *connection, if (NULL == error_json_name) error_json_name = ""; ret = (MHD_YES == - TMH_RESPONSE_reply_json_pack (connection, + TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, "{s:s, s:s, s:I}", "error", "parse error", diff --git a/src/exchange/taler-exchange-httpd_parsing.h b/src/exchange/taler-exchange-httpd_parsing.h index 05d1ea553..bd705d586 100644 --- a/src/exchange/taler-exchange-httpd_parsing.h +++ b/src/exchange/taler-exchange-httpd_parsing.h @@ -35,7 +35,7 @@ * (incrementally) process JSON data uploaded to the HTTP * server. It will store the required state in the * "connection_cls", which must be cleaned up using - * #TMH_PARSE_post_cleanup_callback(). + * #TEH_PARSE_post_cleanup_callback(). * * @param connection the MHD connection * @param con_cls the closure (points to a `struct Buffer *`) @@ -54,7 +54,7 @@ * close HTTP session with MHD_NO) */ int -TMH_PARSE_post_json (struct MHD_Connection *connection, +TEH_PARSE_post_json (struct MHD_Connection *connection, void **con_cls, const char *upload_data, size_t *upload_data_size, @@ -66,10 +66,10 @@ TMH_PARSE_post_json (struct MHD_Connection *connection, * to clean up our state. * * @param con_cls value as it was left by - * #TMH_PARSE_post_json(), to be cleaned up + * #TEH_PARSE_post_json(), to be cleaned up */ void -TMH_PARSE_post_cleanup_callback (void *con_cls); +TEH_PARSE_post_cleanup_callback (void *con_cls); /** @@ -87,7 +87,7 @@ TMH_PARSE_post_cleanup_callback (void *con_cls); * #GNUNET_SYSERR on internal error */ int -TMH_PARSE_json_data (struct MHD_Connection *connection, +TEH_PARSE_json_data (struct MHD_Connection *connection, const json_t *root, struct GNUNET_JSON_Specification *spec); @@ -108,7 +108,7 @@ TMH_PARSE_json_data (struct MHD_Connection *connection, * #GNUNET_SYSERR on internal error */ int -TMH_PARSE_json_array (struct MHD_Connection *connection, +TEH_PARSE_json_array (struct MHD_Connection *connection, const json_t *root, struct GNUNET_JSON_Specification *spec, ...); @@ -130,7 +130,7 @@ TMH_PARSE_json_array (struct MHD_Connection *connection, * #GNUNET_SYSERR on internal error (error response could not be sent) */ int -TMH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection, +TEH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection, const char *param_name, void *out_data, size_t out_size); diff --git a/src/exchange/taler-exchange-httpd_refresh.c b/src/exchange/taler-exchange-httpd_refresh.c index 2a14a55b2..8eb8ef234 100644 --- a/src/exchange/taler-exchange-httpd_refresh.c +++ b/src/exchange/taler-exchange-httpd_refresh.c @@ -52,13 +52,13 @@ static int handle_refresh_melt_binary (struct MHD_Connection *connection, unsigned int num_new_denoms, const struct TALER_DenominationPublicKey *denom_pubs, - const struct TMH_DB_MeltDetails *coin_melt_details, + const struct TEH_DB_MeltDetails *coin_melt_details, const struct GNUNET_HashCode *session_hash, struct TALER_EXCHANGEDB_RefreshCommitCoin *const* commit_coin, const struct TALER_TransferPublicKeyP *transfer_pubs) { unsigned int i; - struct TMH_KS_StateHandle *key_state; + struct TEH_KS_StateHandle *key_state; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dk; struct TALER_EXCHANGEDB_DenominationKeyInformationP *dki; struct TALER_Amount cost; @@ -69,19 +69,19 @@ handle_refresh_melt_binary (struct MHD_Connection *connection, struct TALER_Amount total_melt; GNUNET_assert (GNUNET_OK == - TALER_amount_get_zero (TMH_exchange_currency_string, + TALER_amount_get_zero (TEH_exchange_currency_string, &total_cost)); - key_state = TMH_KS_acquire (); + key_state = TEH_KS_acquire (); for (i=0;iissue; @@ -99,19 +99,19 @@ handle_refresh_melt_binary (struct MHD_Connection *connection, &total_cost)) ) { GNUNET_break_op (0); - TMH_KS_release (key_state); - return TMH_RESPONSE_reply_internal_error (connection, + TEH_KS_release (key_state); + return TEH_RESPONSE_reply_internal_error (connection, "cost calculation failure"); } } - dk = TMH_KS_denomination_key_lookup (key_state, + dk = TEH_KS_denomination_key_lookup (key_state, &coin_melt_details->coin_info.denom_pub, - TMH_KS_DKU_DEPOSIT); + TEH_KS_DKU_DEPOSIT); if (NULL == dk) { GNUNET_break (0); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "denom_pub"); } dki = &dk->issue; @@ -123,11 +123,11 @@ handle_refresh_melt_binary (struct MHD_Connection *connection, &fee_melt)) { GNUNET_break_op (0); - TMH_KS_release (key_state); - return TMH_RESPONSE_reply_external_error (connection, + TEH_KS_release (key_state); + return TEH_RESPONSE_reply_external_error (connection, "Melt contribution below melting fee"); } - TMH_KS_release (key_state); + TEH_KS_release (key_state); if (0 != TALER_amount_cmp (&total_cost, &total_melt)) @@ -135,12 +135,12 @@ handle_refresh_melt_binary (struct MHD_Connection *connection, GNUNET_break_op (0); /* We require total value of coins being melted and total value of coins being generated to match! */ - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, "{s:s}", "error", "value mismatch"); } - return TMH_DB_execute_refresh_melt (connection, + return TEH_DB_execute_refresh_melt (connection, session_hash, num_new_denoms, denom_pubs, @@ -163,7 +163,7 @@ handle_refresh_melt_binary (struct MHD_Connection *connection, static int get_coin_public_info (struct MHD_Connection *connection, const json_t *coin_info, - struct TMH_DB_MeltDetails *r_melt_detail) + struct TEH_DB_MeltDetails *r_melt_detail) { int ret; struct TALER_CoinSpendSignatureP melt_sig; @@ -179,7 +179,7 @@ get_coin_public_info (struct MHD_Connection *connection, GNUNET_JSON_spec_end () }; - ret = TMH_PARSE_json_data (connection, + ret = TEH_PARSE_json_data (connection, coin_info, spec); if (GNUNET_OK != ret) @@ -198,7 +198,7 @@ get_coin_public_info (struct MHD_Connection *connection, r_melt_detail->coin_info.denom_sig.rsa_signature = NULL; r_melt_detail->coin_info.denom_pub.rsa_public_key = NULL; return (MHD_YES == - TMH_RESPONSE_reply_signature_invalid (connection, + TEH_RESPONSE_reply_signature_invalid (connection, "denom_sig")) ? GNUNET_NO : GNUNET_SYSERR; } @@ -226,22 +226,22 @@ get_coin_public_info (struct MHD_Connection *connection, static int verify_coin_public_info (struct MHD_Connection *connection, const struct GNUNET_HashCode *session_hash, - struct TMH_DB_MeltDetails *melt_detail) + struct TEH_DB_MeltDetails *melt_detail) { struct TALER_RefreshMeltCoinAffirmationPS body; - struct TMH_KS_StateHandle *key_state; + struct TEH_KS_StateHandle *key_state; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; struct TALER_Amount fee_refresh; - key_state = TMH_KS_acquire (); - dki = TMH_KS_denomination_key_lookup (key_state, + key_state = TEH_KS_acquire (); + dki = TEH_KS_denomination_key_lookup (key_state, &melt_detail->coin_info.denom_pub, - TMH_KS_DKU_DEPOSIT); + TEH_KS_DKU_DEPOSIT); if (NULL == dki) { - TMH_KS_release (key_state); + TEH_KS_release (key_state); TALER_LOG_WARNING ("Unknown denomination key in /refresh/melt request\n"); - return TMH_RESPONSE_reply_arg_unknown (connection, + return TEH_RESPONSE_reply_arg_unknown (connection, "denom_pub"); } TALER_amount_ntoh (&fee_refresh, @@ -259,14 +259,14 @@ verify_coin_public_info (struct MHD_Connection *connection, &melt_detail->melt_amount_with_fee) > 0) { GNUNET_break_op (0); - TMH_KS_release (key_state); + TEH_KS_release (key_state); return (MHD_YES == - TMH_RESPONSE_reply_external_error (connection, + TEH_RESPONSE_reply_external_error (connection, "melt amount smaller than melting fee")) ? GNUNET_NO : GNUNET_SYSERR; } - TMH_KS_release (key_state); + TEH_KS_release (key_state); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_MELT, &body.purpose, @@ -275,7 +275,7 @@ verify_coin_public_info (struct MHD_Connection *connection, { GNUNET_break_op (0); if (MHD_YES != - TMH_RESPONSE_reply_signature_invalid (connection, + TEH_RESPONSE_reply_signature_invalid (connection, "confirm_sig")) return GNUNET_SYSERR; return GNUNET_NO; @@ -336,7 +336,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection, unsigned int j; struct TALER_DenominationPublicKey *denom_pubs; unsigned int num_newcoins; - struct TMH_DB_MeltDetails coin_melt_details; + struct TEH_DB_MeltDetails coin_melt_details; struct GNUNET_HashCode session_hash; struct GNUNET_HashContext *hash_context; struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coin[TALER_CNC_KAPPA]; @@ -353,7 +353,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_json_array (connection, + res = TEH_PARSE_json_array (connection, transfer_pubs, trans_spec, i, -1); @@ -382,7 +382,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_json_array (connection, + res = TEH_PARSE_json_array (connection, new_denoms, spec, i, -1); @@ -441,7 +441,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_json_array (connection, + res = TEH_PARSE_json_array (connection, coin_evs, coin_spec, i, j, -1); @@ -508,7 +508,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection, * Handle a "/refresh/melt" request. Parses the request into the JSON * components and then hands things of to #handle_refresh_melt_json() * to validate the melted coins, the signature and execute the melt - * using TMH_DB_execute_refresh_melt(). + * using TEH_DB_execute_refresh_melt(). * * @param rh context of the handler * @param connection the MHD connection to handle @@ -518,7 +518,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_REFRESH_handler_refresh_melt (struct TMH_RequestHandler *rh, +TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -538,7 +538,7 @@ TMH_REFRESH_handler_refresh_melt (struct TMH_RequestHandler *rh, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -548,7 +548,7 @@ TMH_REFRESH_handler_refresh_melt (struct TMH_RequestHandler *rh, if ( (GNUNET_NO == res) || (NULL == root) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, root, spec); json_decref (root); @@ -560,14 +560,14 @@ TMH_REFRESH_handler_refresh_melt (struct TMH_RequestHandler *rh, { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "coin_evs"); } if (TALER_CNC_KAPPA != json_array_size (transfer_pubs)) { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "transfer_pubs"); } res = handle_refresh_melt_json (connection, @@ -583,7 +583,7 @@ TMH_REFRESH_handler_refresh_melt (struct TMH_RequestHandler *rh, /** * Handle a "/refresh/reveal" request. Parses the given JSON * transfer private keys and if successful, passes everything to - * #TMH_DB_execute_refresh_reveal() which will verify that the + * #TEH_DB_execute_refresh_reveal() which will verify that the * revealed information is valid then returns the signed refreshed * coins. * @@ -611,7 +611,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection, if (GNUNET_OK != res) break; - res = TMH_PARSE_json_array (connection, + res = TEH_PARSE_json_array (connection, tp_json, tp_spec, i, -1); @@ -620,7 +620,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection, if (GNUNET_OK != res) res = (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; else - res = TMH_DB_execute_refresh_reveal (connection, + res = TEH_DB_execute_refresh_reveal (connection, session_hash, transfer_privs); return res; @@ -632,7 +632,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection, * the private transfer keys except for the cut-and-choose value * returned from "/refresh/melt". This function parses the revealed * keys and secrets and ultimately passes everything to - * #TMH_DB_execute_refresh_reveal() which will verify that the + * #TEH_DB_execute_refresh_reveal() which will verify that the * revealed information is valid then returns the signed refreshed * coins. * @@ -644,7 +644,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh, +TEH_REFRESH_handler_refresh_reveal (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -660,7 +660,7 @@ TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -670,7 +670,7 @@ TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh, if ( (GNUNET_NO == res) || (NULL == root) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, root, spec); json_decref (root); @@ -685,7 +685,7 @@ TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh, { GNUNET_JSON_parse_free (spec); GNUNET_break_op (0); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "transfer_privs"); } res = handle_refresh_reveal_json (connection, @@ -708,7 +708,7 @@ TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_REFRESH_handler_refresh_link (struct TMH_RequestHandler *rh, +TEH_REFRESH_handler_refresh_link (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -717,7 +717,7 @@ TMH_REFRESH_handler_refresh_link (struct TMH_RequestHandler *rh, struct TALER_CoinSpendPublicKeyP coin_pub; int res; - res = TMH_PARSE_mhd_request_arg_data (connection, + res = TEH_PARSE_mhd_request_arg_data (connection, "coin_pub", &coin_pub, sizeof (struct TALER_CoinSpendPublicKeyP)); @@ -725,7 +725,7 @@ TMH_REFRESH_handler_refresh_link (struct TMH_RequestHandler *rh, return MHD_NO; if (GNUNET_OK != res) return MHD_YES; - return TMH_DB_execute_refresh_link (connection, + return TEH_DB_execute_refresh_link (connection, &coin_pub); } diff --git a/src/exchange/taler-exchange-httpd_refresh.h b/src/exchange/taler-exchange-httpd_refresh.h index 5b624e0e9..61b3b4f91 100644 --- a/src/exchange/taler-exchange-httpd_refresh.h +++ b/src/exchange/taler-exchange-httpd_refresh.h @@ -32,7 +32,7 @@ * Handle a "/refresh/melt" request. Parses the request into the JSON * components and then hands things of to #handle_refresh_melt_json() * to validate the melted coins, the signature and execute the melt - * using TMH_DB_execute_refresh_melt(). + * using TEH_DB_execute_refresh_melt(). * * @param rh context of the handler * @param connection the MHD connection to handle @@ -42,7 +42,7 @@ * @return MHD result code */ int -TMH_REFRESH_handler_refresh_melt (struct TMH_RequestHandler *rh, +TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -54,7 +54,7 @@ TMH_REFRESH_handler_refresh_melt (struct TMH_RequestHandler *rh, * the private transfer keys except for the cut-and-choose value * returned from "/refresh/commit". This function parses the revealed * keys and secrets and ultimately passes everything to - * #TMH_DB_execute_refresh_reveal() which will verify that the + * #TEH_DB_execute_refresh_reveal() which will verify that the * revealed information is valid then returns the signed refreshed * coins. * @@ -66,7 +66,7 @@ TMH_REFRESH_handler_refresh_melt (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh, +TEH_REFRESH_handler_refresh_reveal (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -84,7 +84,7 @@ TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_REFRESH_handler_refresh_link (struct TMH_RequestHandler *rh, +TEH_REFRESH_handler_refresh_link (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c index 925645e41..fdb6f8b76 100644 --- a/src/exchange/taler-exchange-httpd_refund.c +++ b/src/exchange/taler-exchange-httpd_refund.c @@ -68,14 +68,14 @@ verify_and_execute_refund (struct MHD_Connection *connection, &refund->refund_fee) ) { GNUNET_break_op (0); - return TMH_RESPONSE_reply_arg_invalid (connection, + return TEH_RESPONSE_reply_arg_invalid (connection, "refund_fee"); } if (-1 == TALER_amount_cmp (&refund->refund_amount, &refund->refund_fee) ) { GNUNET_break_op (0); - return TMH_RESPONSE_reply_signature_invalid (connection, + return TEH_RESPONSE_reply_signature_invalid (connection, "refund_amount"); } if (GNUNET_OK != @@ -85,10 +85,10 @@ verify_and_execute_refund (struct MHD_Connection *connection, &refund->merchant_pub.eddsa_pub)) { TALER_LOG_WARNING ("Invalid signature on /refund request\n"); - return TMH_RESPONSE_reply_signature_invalid (connection, + return TEH_RESPONSE_reply_signature_invalid (connection, "merchant_sig"); } - return TMH_DB_execute_refund (connection, + return TEH_DB_execute_refund (connection, refund); } @@ -108,7 +108,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_REFUND_handler_refund (struct TMH_RequestHandler *rh, +TEH_REFUND_handler_refund (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -129,7 +129,7 @@ TMH_REFUND_handler_refund (struct TMH_RequestHandler *rh, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -138,7 +138,7 @@ TMH_REFUND_handler_refund (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, json, spec); json_decref (json); diff --git a/src/exchange/taler-exchange-httpd_refund.h b/src/exchange/taler-exchange-httpd_refund.h index 9e0455830..894d821d6 100644 --- a/src/exchange/taler-exchange-httpd_refund.h +++ b/src/exchange/taler-exchange-httpd_refund.h @@ -43,7 +43,7 @@ * @return MHD result code */ int -TMH_REFUND_handler_refund (struct TMH_RequestHandler *rh, +TEH_REFUND_handler_refund (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, diff --git a/src/exchange/taler-exchange-httpd_reserve.c b/src/exchange/taler-exchange-httpd_reserve.c index 6010e91cd..7098e99a2 100644 --- a/src/exchange/taler-exchange-httpd_reserve.c +++ b/src/exchange/taler-exchange-httpd_reserve.c @@ -43,7 +43,7 @@ * @return MHD result code */ int -TMH_RESERVE_handler_reserve_status (struct TMH_RequestHandler *rh, +TEH_RESERVE_handler_reserve_status (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -52,7 +52,7 @@ TMH_RESERVE_handler_reserve_status (struct TMH_RequestHandler *rh, struct TALER_ReservePublicKeyP reserve_pub; int res; - res = TMH_PARSE_mhd_request_arg_data (connection, + res = TEH_PARSE_mhd_request_arg_data (connection, "reserve_pub", &reserve_pub, sizeof (struct TALER_ReservePublicKeyP)); @@ -60,7 +60,7 @@ TMH_RESERVE_handler_reserve_status (struct TMH_RequestHandler *rh, return MHD_NO; /* internal error */ if (GNUNET_NO == res) return MHD_YES; /* parse error */ - return TMH_DB_execute_reserve_status (connection, + return TEH_DB_execute_reserve_status (connection, &reserve_pub); } @@ -82,7 +82,7 @@ TMH_RESERVE_handler_reserve_status (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh, +TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -99,7 +99,7 @@ TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh, struct TALER_Amount fee_withdraw; struct TALER_ReserveSignatureP signature; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; - struct TMH_KS_StateHandle *ks; + struct TEH_KS_StateHandle *ks; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_varsize ("coin_ev", @@ -114,7 +114,7 @@ TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -123,21 +123,21 @@ TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == root) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, root, spec); json_decref (root); if (GNUNET_OK != res) return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; - ks = TMH_KS_acquire (); - dki = TMH_KS_denomination_key_lookup (ks, + ks = TEH_KS_acquire (); + dki = TEH_KS_denomination_key_lookup (ks, &denomination_pub, - TMH_KS_DKU_WITHDRAW); + TEH_KS_DKU_WITHDRAW); if (NULL == dki) { GNUNET_JSON_parse_free (spec); - TMH_KS_release (ks); - return TMH_RESPONSE_reply_arg_unknown (connection, + TEH_KS_release (ks); + return TEH_RESPONSE_reply_arg_unknown (connection, "denom_pub"); } TALER_amount_ntoh (&amount, @@ -152,7 +152,7 @@ TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh, &amount_with_fee); TALER_amount_hton (&wsrd.withdraw_fee, &fee_withdraw); - TMH_KS_release (ks); + TEH_KS_release (ks); /* verify signature! */ wsrd.purpose.size = htonl (sizeof (struct TALER_WithdrawRequestPS)); wsrd.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW); @@ -170,10 +170,10 @@ TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh, { TALER_LOG_WARNING ("Client supplied invalid signature for /reserve/withdraw request\n"); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_signature_invalid (connection, + return TEH_RESPONSE_reply_signature_invalid (connection, "reserve_sig"); } - res = TMH_DB_execute_reserve_withdraw (connection, + res = TEH_DB_execute_reserve_withdraw (connection, &wsrd.reserve_pub, &denomination_pub, blinded_msg, diff --git a/src/exchange/taler-exchange-httpd_reserve.h b/src/exchange/taler-exchange-httpd_reserve.h index 1b32408ec..1db7ea7a4 100644 --- a/src/exchange/taler-exchange-httpd_reserve.h +++ b/src/exchange/taler-exchange-httpd_reserve.h @@ -40,7 +40,7 @@ * @return MHD result code */ int -TMH_RESERVE_handler_reserve_status (struct TMH_RequestHandler *rh, +TEH_RESERVE_handler_reserve_status (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -64,7 +64,7 @@ TMH_RESERVE_handler_reserve_status (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh, +TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 8ad934e07..cacd933f1 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -16,7 +16,7 @@ /** * @file taler-exchange-httpd_responses.c * @brief API for generating the various replies of the exchange; these - * functions are called TMH_RESPONSE_reply_ and they generate + * functions are called TEH_RESPONSE_reply_ and they generate * and queue MHD response objects for a given connection. * @author Florian Dold * @author Benedikt Mueller @@ -37,9 +37,9 @@ * @param response response to modify */ void -TMH_RESPONSE_add_global_headers (struct MHD_Response *response) +TEH_RESPONSE_add_global_headers (struct MHD_Response *response) { - if (TMH_exchange_connection_close) + if (TEH_exchange_connection_close) GNUNET_break (MHD_YES == MHD_add_response_header (response, MHD_HTTP_HEADER_CONNECTION, @@ -56,7 +56,7 @@ TMH_RESPONSE_add_global_headers (struct MHD_Response *response) * @return MHD result code */ int -TMH_RESPONSE_reply_json (struct MHD_Connection *connection, +TEH_RESPONSE_reply_json (struct MHD_Connection *connection, const json_t *json, unsigned int response_code) { @@ -75,7 +75,7 @@ TMH_RESPONSE_reply_json (struct MHD_Connection *connection, GNUNET_break (0); return MHD_NO; } - TMH_RESPONSE_add_global_headers (resp); + TEH_RESPONSE_add_global_headers (resp); (void) MHD_add_response_header (resp, MHD_HTTP_HEADER_CONTENT_TYPE, "application/json"); @@ -98,7 +98,7 @@ TMH_RESPONSE_reply_json (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection, +TEH_RESPONSE_reply_json_pack (struct MHD_Connection *connection, unsigned int response_code, const char *fmt, ...) @@ -120,7 +120,7 @@ TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection, GNUNET_break (0); return MHD_NO; } - ret = TMH_RESPONSE_reply_json (connection, + ret = TEH_RESPONSE_reply_json (connection, json, response_code); json_decref (json); @@ -136,10 +136,10 @@ TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection, +TEH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection, const char *param_name) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, "{s:s, s:s}", "error", "invalid parameter", @@ -157,10 +157,10 @@ TMH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection, +TEH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection, const char *param_name) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_NOT_FOUND, "{s:s, s:s}", "error", "unknown entity referenced", @@ -176,10 +176,10 @@ TMH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection, +TEH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection, const char *param_name) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_UNAUTHORIZED, "{s:s, s:s}", "error", "invalid signature", @@ -195,10 +195,10 @@ TMH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection, +TEH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection, const char *param_name) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, "{ s:s, s:s}", "error", "missing parameter", @@ -214,10 +214,10 @@ TMH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection, +TEH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection, const char *hint) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_FORBIDDEN, "{s:s, s:s}", "error", "permission denied", @@ -233,10 +233,10 @@ TMH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, +TEH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, const char *hint) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, "{s:s, s:s}", "error", "internal error", @@ -252,10 +252,10 @@ TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection, +TEH_RESPONSE_reply_external_error (struct MHD_Connection *connection, const char *hint) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, "{s:s, s:s}", "error", "client error", @@ -271,9 +271,9 @@ TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_commit_error (struct MHD_Connection *connection) +TEH_RESPONSE_reply_commit_error (struct MHD_Connection *connection) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, "{s:s}", "error", "commit failure"); @@ -288,9 +288,9 @@ TMH_RESPONSE_reply_commit_error (struct MHD_Connection *connection) * @return a MHD result code */ int -TMH_RESPONSE_reply_internal_db_error (struct MHD_Connection *connection) +TEH_RESPONSE_reply_internal_db_error (struct MHD_Connection *connection) { - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "Failed to connect to database"); } @@ -302,7 +302,7 @@ TMH_RESPONSE_reply_internal_db_error (struct MHD_Connection *connection) * @return a MHD result code */ int -TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection) +TEH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection) { struct MHD_Response *resp; int ret; @@ -312,7 +312,7 @@ TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection) MHD_RESPMEM_PERSISTENT); if (NULL == resp) return MHD_NO; - TMH_RESPONSE_add_global_headers (resp); + TEH_RESPONSE_add_global_headers (resp); ret = MHD_queue_response (connection, MHD_HTTP_REQUEST_ENTITY_TOO_LARGE, resp); @@ -328,9 +328,9 @@ TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection) * @return a MHD result code */ int -TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection) +TEH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, "{s:s}", "error", @@ -358,7 +358,7 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection) * @return MHD result code */ int -TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_contract, @@ -383,10 +383,10 @@ TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection, amount_without_fee); dc.coin_pub = *coin_pub; dc.merchant = *merchant; - TMH_KS_sign (&dc.purpose, + TEH_KS_sign (&dc.purpose, &pub, &sig); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:s, s:o, s:o}", "status", "DEPOSIT_OK", @@ -549,15 +549,15 @@ compile_transaction_history (const struct TALER_EXCHANGEDB_TransactionList *tl) * @return MHD result code */ int -TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection, +TEH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_TransactionList *tl) { json_t *history; history = compile_transaction_history (tl); if (NULL == history) - return TMH_RESPONSE_reply_internal_db_error (connection); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_FORBIDDEN, "{s:s, s:o}", "error", "insufficient funds", @@ -691,10 +691,10 @@ compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHistory *rh, * @return MHD result code */ int -TMH_RESPONSE_reply_refund_conflict (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refund_conflict (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_TransactionList *tl) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_CONFLICT, "{s:s, s:o}", "status", "conflicting refund", @@ -711,10 +711,10 @@ TMH_RESPONSE_reply_refund_conflict (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_refund_failure (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refund_failure (struct MHD_Connection *connection, unsigned int response_code) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, response_code, "{s:s}", "error", @@ -730,7 +730,7 @@ TMH_RESPONSE_reply_refund_failure (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_refund_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refund_success (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_Refund *refund) { struct TALER_RefundConfirmationPS rc; @@ -748,10 +748,10 @@ TMH_RESPONSE_reply_refund_success (struct MHD_Connection *connection, &refund->refund_amount); TALER_amount_hton (&rc.refund_fee, &refund->refund_fee); - TMH_KS_sign (&rc.purpose, + TEH_KS_sign (&rc.purpose, &pub, &sig); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:s, s:o, s:o}", "status", "REFUND_OK", @@ -768,7 +768,7 @@ TMH_RESPONSE_reply_refund_success (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_ReserveHistory *rh) { json_t *json_balance; @@ -778,10 +778,10 @@ TMH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection, json_history = compile_reserve_history (rh, &balance); if (NULL == json_history) - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "balance calculation failure"); json_balance = TALER_JSON_from_amount (&balance); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o, s:o}", "balance", json_balance, @@ -799,7 +799,7 @@ TMH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection, +TEH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_ReserveHistory *rh) { json_t *json_balance; @@ -809,10 +809,10 @@ TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *c json_history = compile_reserve_history (rh, &balance); if (NULL == json_history) - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "balance calculation failure"); json_balance = TALER_JSON_from_amount (&balance); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_PAYMENT_REQUIRED, "{s:s, s:o, s:o}", "error", "Insufficient funds", @@ -829,13 +829,13 @@ TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *c * @return MHD result code */ int -TMH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable) { json_t *sig_json; sig_json = GNUNET_JSON_from_rsa_signature (collectable->sig.rsa_signature); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o}", "ev_sig", sig_json); @@ -858,7 +858,7 @@ TMH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_Amount coin_value, struct TALER_EXCHANGEDB_TransactionList *tl, @@ -869,8 +869,8 @@ TMH_RESPONSE_reply_refresh_melt_insufficient_funds (struct MHD_Connection *conne history = compile_transaction_history (tl); if (NULL == history) - return TMH_RESPONSE_reply_internal_db_error (connection); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_internal_db_error (connection); + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_FORBIDDEN, "{s:s, s:o, s:o, s:o, s:o, s:o}", "error", @@ -897,7 +897,7 @@ TMH_RESPONSE_reply_refresh_melt_insufficient_funds (struct MHD_Connection *conne * @return a MHD status code */ int -TMH_RESPONSE_reply_refresh_melt_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refresh_melt_success (struct MHD_Connection *connection, const struct GNUNET_HashCode *session_hash, uint16_t noreveal_index) { @@ -911,12 +911,12 @@ TMH_RESPONSE_reply_refresh_melt_success (struct MHD_Connection *connection, body.session_hash = *session_hash; body.noreveal_index = htons (noreveal_index); body.reserved = htons (0); - TMH_KS_sign (&body.purpose, + TEH_KS_sign (&body.purpose, &pub, &sig); sig_json = GNUNET_JSON_from_data_auto (&sig); GNUNET_assert (NULL != sig_json); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:i, s:o, s:o}", "noreveal_index", (int) noreveal_index, @@ -934,7 +934,7 @@ TMH_RESPONSE_reply_refresh_melt_success (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_refresh_reveal_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refresh_reveal_success (struct MHD_Connection *connection, unsigned int num_newcoins, const struct TALER_DenominationSignature *sigs) { @@ -959,7 +959,7 @@ TMH_RESPONSE_reply_refresh_reveal_success (struct MHD_Connection *connection, json_object_set_new (root, "ev_sigs", list); - ret = TMH_RESPONSE_reply_json (connection, + ret = TEH_RESPONSE_reply_json (connection, root, MHD_HTTP_OK); json_decref (root); @@ -979,7 +979,7 @@ TMH_RESPONSE_reply_refresh_reveal_success (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_refresh_reveal_missmatch (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refresh_reveal_missmatch (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_RefreshSession *session, const struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins, const struct TALER_DenominationPublicKey *denom_pubs, @@ -1009,7 +1009,7 @@ TMH_RESPONSE_reply_refresh_reveal_missmatch (struct MHD_Connection *connection, json_array_append_new (info_commit_k, cc_json)); } - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_CONFLICT, "{s:s, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:i}", "error", "commitment violation", @@ -1034,9 +1034,9 @@ TMH_RESPONSE_reply_refresh_reveal_missmatch (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_refresh_link_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refresh_link_success (struct MHD_Connection *connection, unsigned int num_sessions, - const struct TMH_RESPONSE_LinkSessionInfo *sessions) + const struct TEH_RESPONSE_LinkSessionInfo *sessions) { json_t *root; json_t *mlist; @@ -1075,7 +1075,7 @@ TMH_RESPONSE_reply_refresh_link_success (struct MHD_Connection *connection, json_array_append_new (mlist, root)); } - res = TMH_RESPONSE_reply_json (connection, + res = TEH_RESPONSE_reply_json (connection, mlist, MHD_HTTP_OK); json_decref (mlist); @@ -1092,9 +1092,9 @@ TMH_RESPONSE_reply_refresh_link_success (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_transaction_unknown (struct MHD_Connection *connection) +TEH_RESPONSE_reply_transaction_unknown (struct MHD_Connection *connection) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_NOT_FOUND, "{s:s}", "error", "Deposit unknown"); @@ -1110,10 +1110,10 @@ TMH_RESPONSE_reply_transaction_unknown (struct MHD_Connection *connection) * @return MHD result code */ int -TMH_RESPONSE_reply_transfer_pending (struct MHD_Connection *connection, +TEH_RESPONSE_reply_transfer_pending (struct MHD_Connection *connection, struct GNUNET_TIME_Absolute planned_exec_time) { - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_ACCEPTED, "{s:o}", "execution_time", GNUNET_JSON_from_time_abs (planned_exec_time)); @@ -1136,7 +1136,7 @@ TMH_RESPONSE_reply_transfer_pending (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_track_transaction (struct MHD_Connection *connection, +TEH_RESPONSE_reply_track_transaction (struct MHD_Connection *connection, const struct GNUNET_HashCode *h_contract, const struct GNUNET_HashCode *h_wire, const struct TALER_CoinSpendPublicKeyP *coin_pub, @@ -1159,10 +1159,10 @@ TMH_RESPONSE_reply_track_transaction (struct MHD_Connection *connection, cw.execution_time = GNUNET_TIME_absolute_hton (exec_time); TALER_amount_hton (&cw.coin_contribution, coin_contribution); - TMH_KS_sign (&cw.purpose, + TEH_KS_sign (&cw.purpose, &pub, &sig); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o, s:o, s:o, s:o, s:o}", "wtid", GNUNET_JSON_from_data_auto (wtid), @@ -1186,14 +1186,14 @@ TMH_RESPONSE_reply_track_transaction (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection, +TEH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection, const struct TALER_Amount *total, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct GNUNET_HashCode *h_wire, struct GNUNET_TIME_Absolute exec_time, - const struct TMH_TrackTransferDetail *wdd_head) + const struct TEH_TrackTransferDetail *wdd_head) { - const struct TMH_TrackTransferDetail *wdd_pos; + const struct TEH_TrackTransferDetail *wdd_pos; json_t *deposits; struct TALER_WireDepositDetailP dd; struct GNUNET_HashContext *hash_context; @@ -1234,10 +1234,10 @@ TMH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection, wdp.h_wire = *h_wire; GNUNET_CRYPTO_hash_context_finish (hash_context, &wdp.h_details); - TMH_KS_sign (&wdp.purpose, + TEH_KS_sign (&wdp.purpose, &pub, &sig); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o, s:o, s:o, s:o, s:o, s:o, s:o}", "total", TALER_JSON_from_amount (total), diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h index 0f99b7491..742a95b91 100644 --- a/src/exchange/taler-exchange-httpd_responses.h +++ b/src/exchange/taler-exchange-httpd_responses.h @@ -17,7 +17,7 @@ /** * @file taler-exchange-httpd_responses.h * @brief API for generating the various replies of the exchange; these - * functions are called TMH_RESPONSE_reply_ and they generate + * functions are called TEH_RESPONSE_reply_ and they generate * and queue MHD response objects for a given connection. * @author Florian Dold * @author Benedikt Mueller @@ -40,7 +40,7 @@ * @param response response to modify */ void -TMH_RESPONSE_add_global_headers (struct MHD_Response *response); +TEH_RESPONSE_add_global_headers (struct MHD_Response *response); /** @@ -52,7 +52,7 @@ TMH_RESPONSE_add_global_headers (struct MHD_Response *response); * @return MHD result code */ int -TMH_RESPONSE_reply_json (struct MHD_Connection *connection, +TEH_RESPONSE_reply_json (struct MHD_Connection *connection, const json_t *json, unsigned int response_code); @@ -68,7 +68,7 @@ TMH_RESPONSE_reply_json (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection, +TEH_RESPONSE_reply_json_pack (struct MHD_Connection *connection, unsigned int response_code, const char *fmt, ...); @@ -82,7 +82,7 @@ TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection, +TEH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection, const char *param_name); @@ -94,7 +94,7 @@ TMH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection, +TEH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection, const char *param_name); @@ -108,7 +108,7 @@ TMH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection, +TEH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection, const char *param_name); @@ -120,7 +120,7 @@ TMH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection, +TEH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection, const char *param_name); @@ -132,7 +132,7 @@ TMH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection, +TEH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection, const char *hint); @@ -144,7 +144,7 @@ TMH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, +TEH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, const char *hint); @@ -156,7 +156,7 @@ TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection, +TEH_RESPONSE_reply_external_error (struct MHD_Connection *connection, const char *hint); @@ -168,7 +168,7 @@ TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_commit_error (struct MHD_Connection *connection); +TEH_RESPONSE_reply_commit_error (struct MHD_Connection *connection); /** @@ -179,7 +179,7 @@ TMH_RESPONSE_reply_commit_error (struct MHD_Connection *connection); * @return a MHD result code */ int -TMH_RESPONSE_reply_internal_db_error (struct MHD_Connection *connection); +TEH_RESPONSE_reply_internal_db_error (struct MHD_Connection *connection); /** @@ -189,7 +189,7 @@ TMH_RESPONSE_reply_internal_db_error (struct MHD_Connection *connection); * @return a MHD result code */ int -TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection); +TEH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection); /** @@ -199,7 +199,7 @@ TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection); * @return a MHD result code */ int -TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection); +TEH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection); /** @@ -222,7 +222,7 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection); * @return MHD result code */ int -TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_contract, @@ -243,7 +243,7 @@ TMH_RESPONSE_reply_deposit_success (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection, +TEH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_TransactionList *tl); @@ -256,7 +256,7 @@ TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection * @return MHD result code */ int -TMH_RESPONSE_reply_refund_conflict (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refund_conflict (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_TransactionList *tl); @@ -269,7 +269,7 @@ TMH_RESPONSE_reply_refund_conflict (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_refund_failure (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refund_failure (struct MHD_Connection *connection, unsigned int response_code); @@ -281,7 +281,7 @@ TMH_RESPONSE_reply_refund_failure (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_refund_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refund_success (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_Refund *refund); @@ -294,7 +294,7 @@ TMH_RESPONSE_reply_refund_success (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_transaction_unknown (struct MHD_Connection *connection); +TEH_RESPONSE_reply_transaction_unknown (struct MHD_Connection *connection); /** @@ -306,7 +306,7 @@ TMH_RESPONSE_reply_transaction_unknown (struct MHD_Connection *connection); * @return MHD result code */ int -TMH_RESPONSE_reply_transfer_pending (struct MHD_Connection *connection, +TEH_RESPONSE_reply_transfer_pending (struct MHD_Connection *connection, struct GNUNET_TIME_Absolute planned_exec_time); @@ -325,7 +325,7 @@ TMH_RESPONSE_reply_transfer_pending (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_track_transaction (struct MHD_Connection *connection, +TEH_RESPONSE_reply_track_transaction (struct MHD_Connection *connection, const struct GNUNET_HashCode *h_contract, const struct GNUNET_HashCode *h_wire, const struct TALER_CoinSpendPublicKeyP *coin_pub, @@ -338,18 +338,18 @@ TMH_RESPONSE_reply_track_transaction (struct MHD_Connection *connection, /** * Detail for /wire/deposit response. */ -struct TMH_TrackTransferDetail +struct TEH_TrackTransferDetail { /** * We keep deposit details in a DLL. */ - struct TMH_TrackTransferDetail *next; + struct TEH_TrackTransferDetail *next; /** * We keep deposit details in a DLL. */ - struct TMH_TrackTransferDetail *prev; + struct TEH_TrackTransferDetail *prev; /** * Hash of the contract @@ -391,12 +391,12 @@ struct TMH_TrackTransferDetail * @return MHD result code */ int -TMH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection, +TEH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection, const struct TALER_Amount *total, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct GNUNET_HashCode *h_wire, struct GNUNET_TIME_Absolute exec_time, - const struct TMH_TrackTransferDetail *wdd_head); + const struct TEH_TrackTransferDetail *wdd_head); /** @@ -407,7 +407,7 @@ TMH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_ReserveHistory *rh); @@ -421,7 +421,7 @@ TMH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection, +TEH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_ReserveHistory *rh); @@ -433,7 +433,7 @@ TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *c * @return MHD result code */ int -TMH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable); @@ -446,7 +446,7 @@ TMH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection, * @return a MHD status code */ int -TMH_RESPONSE_reply_refresh_melt_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refresh_melt_success (struct MHD_Connection *connection, const struct GNUNET_HashCode *session_hash, uint16_t noreveal_index); @@ -467,7 +467,7 @@ TMH_RESPONSE_reply_refresh_melt_success (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_Amount coin_value, struct TALER_EXCHANGEDB_TransactionList *tl, @@ -484,7 +484,7 @@ TMH_RESPONSE_reply_refresh_melt_insufficient_funds (struct MHD_Connection *conne * @return a MHD result code */ int -TMH_RESPONSE_reply_refresh_reveal_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refresh_reveal_success (struct MHD_Connection *connection, unsigned int num_newcoins, const struct TALER_DenominationSignature *sigs); @@ -501,7 +501,7 @@ TMH_RESPONSE_reply_refresh_reveal_success (struct MHD_Connection *connection, * @return a MHD result code */ int -TMH_RESPONSE_reply_refresh_reveal_missmatch (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refresh_reveal_missmatch (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_RefreshSession *session, const struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins, const struct TALER_DenominationPublicKey *denom_pubs, @@ -511,7 +511,7 @@ TMH_RESPONSE_reply_refresh_reveal_missmatch (struct MHD_Connection *connection, /** * @brief Information for each session a coin was melted into. */ -struct TMH_RESPONSE_LinkSessionInfo +struct TEH_RESPONSE_LinkSessionInfo { /** * Transfer public key of the coin. @@ -536,9 +536,9 @@ struct TMH_RESPONSE_LinkSessionInfo * @return a MHD result code */ int -TMH_RESPONSE_reply_refresh_link_success (struct MHD_Connection *connection, +TEH_RESPONSE_reply_refresh_link_success (struct MHD_Connection *connection, unsigned int num_sessions, - const struct TMH_RESPONSE_LinkSessionInfo *sessions); + const struct TEH_RESPONSE_LinkSessionInfo *sessions); #endif diff --git a/src/exchange/taler-exchange-httpd_test.c b/src/exchange/taler-exchange-httpd_test.c index b371bd215..7c3252b10 100644 --- a/src/exchange/taler-exchange-httpd_test.c +++ b/src/exchange/taler-exchange-httpd_test.c @@ -52,7 +52,7 @@ static struct GNUNET_CRYPTO_RsaPrivateKey *rsa_pk; * @return MHD result code */ int -TMH_TEST_handler_test_base32 (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_base32 (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -68,7 +68,7 @@ TMH_TEST_handler_test_base32 (struct TMH_RequestHandler *rh, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -77,7 +77,7 @@ TMH_TEST_handler_test_base32 (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, json, spec); if (GNUNET_YES != res) @@ -87,7 +87,7 @@ TMH_TEST_handler_test_base32 (struct TMH_RequestHandler *rh, &hc); GNUNET_JSON_parse_free (spec); json_decref (json); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o}", "output", @@ -113,7 +113,7 @@ TMH_TEST_handler_test_base32 (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_encrypt (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_encrypt (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -133,7 +133,7 @@ TMH_TEST_handler_test_encrypt (struct TMH_RequestHandler *rh, }; char *out; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -142,7 +142,7 @@ TMH_TEST_handler_test_encrypt (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, json, spec); json_decref (json); @@ -169,7 +169,7 @@ TMH_TEST_handler_test_encrypt (struct TMH_RequestHandler *rh, in_ptr_size); GNUNET_free (out); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o}", "output", @@ -195,7 +195,7 @@ TMH_TEST_handler_test_encrypt (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_hkdf (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_hkdf (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -211,7 +211,7 @@ TMH_TEST_handler_test_hkdf (struct TMH_RequestHandler *rh, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -220,7 +220,7 @@ TMH_TEST_handler_test_hkdf (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, json, spec); json_decref (json); @@ -233,7 +233,7 @@ TMH_TEST_handler_test_hkdf (struct TMH_RequestHandler *rh, NULL, 0); GNUNET_JSON_parse_free (spec); json = GNUNET_JSON_from_data_auto (&hc); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o}", "output", @@ -256,7 +256,7 @@ TMH_TEST_handler_test_hkdf (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_ecdhe (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_ecdhe (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -273,7 +273,7 @@ TMH_TEST_handler_test_ecdhe (struct TMH_RequestHandler *rh, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -282,7 +282,7 @@ TMH_TEST_handler_test_ecdhe (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, json, spec); json_decref (json); @@ -294,11 +294,11 @@ TMH_TEST_handler_test_ecdhe (struct TMH_RequestHandler *rh, &hc)) { GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "Failed to perform ECDH"); } GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o}", "ecdh_hash", @@ -322,7 +322,7 @@ TMH_TEST_handler_test_ecdhe (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_eddsa (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_eddsa (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -340,7 +340,7 @@ TMH_TEST_handler_test_eddsa (struct TMH_RequestHandler *rh, }; struct GNUNET_CRYPTO_EddsaPrivateKey *pk; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -349,7 +349,7 @@ TMH_TEST_handler_test_eddsa (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, json, spec); json_decref (json); @@ -364,7 +364,7 @@ TMH_TEST_handler_test_eddsa (struct TMH_RequestHandler *rh, &pub)) { GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_signature_invalid (connection, + return TEH_RESPONSE_reply_signature_invalid (connection, "eddsa_sig"); } GNUNET_JSON_parse_free (spec); @@ -376,13 +376,13 @@ TMH_TEST_handler_test_eddsa (struct TMH_RequestHandler *rh, &sig)) { GNUNET_free (pk); - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "Failed to EdDSA-sign"); } GNUNET_CRYPTO_eddsa_key_get_public (pk, &pub); GNUNET_free (pk); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o, s:o}", "eddsa_pub", @@ -404,7 +404,7 @@ TMH_TEST_handler_test_eddsa (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_rsa_get (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_rsa_get (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -418,17 +418,17 @@ TMH_TEST_handler_test_rsa_get (struct TMH_RequestHandler *rh, if (NULL == rsa_pk) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "Failed to create RSA key"); } pub = GNUNET_CRYPTO_rsa_private_key_get_public (rsa_pk); if (NULL == pub) { GNUNET_break (0); - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "Failed to get public RSA key"); } - res = TMH_RESPONSE_reply_json_pack (connection, + res = TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o}", "rsa_pub", @@ -451,7 +451,7 @@ TMH_TEST_handler_test_rsa_get (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_rsa_sign (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_rsa_sign (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -467,7 +467,7 @@ TMH_TEST_handler_test_rsa_sign (struct TMH_RequestHandler *rh, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -476,7 +476,7 @@ TMH_TEST_handler_test_rsa_sign (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, json, spec); json_decref (json); @@ -488,7 +488,7 @@ TMH_TEST_handler_test_rsa_sign (struct TMH_RequestHandler *rh, { GNUNET_break (0); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "Failed to create RSA key"); } sig = GNUNET_CRYPTO_rsa_sign_blinded (rsa_pk, @@ -498,11 +498,11 @@ TMH_TEST_handler_test_rsa_sign (struct TMH_RequestHandler *rh, { GNUNET_break (0); GNUNET_JSON_parse_free (spec); - return TMH_RESPONSE_reply_internal_error (connection, + return TEH_RESPONSE_reply_internal_error (connection, "Failed to RSA-sign"); } GNUNET_JSON_parse_free (spec); - res = TMH_RESPONSE_reply_json_pack (connection, + res = TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o}", "rsa_blind_sig", @@ -527,7 +527,7 @@ TMH_TEST_handler_test_rsa_sign (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_transfer (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_transfer (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -544,7 +544,7 @@ TMH_TEST_handler_test_transfer (struct TMH_RequestHandler *rh, }; struct TALER_TransferSecretP secret; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -553,7 +553,7 @@ TMH_TEST_handler_test_transfer (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, json, spec); json_decref (json); @@ -562,7 +562,7 @@ TMH_TEST_handler_test_transfer (struct TMH_RequestHandler *rh, TALER_link_reveal_transfer_secret (&trans_priv, &coin_pub, &secret); - return TMH_RESPONSE_reply_json_pack (connection, + return TEH_RESPONSE_reply_json_pack (connection, MHD_HTTP_OK, "{s:o}", "secret", @@ -581,7 +581,7 @@ TMH_TEST_handler_test_transfer (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -590,7 +590,7 @@ TMH_TEST_handler_test (struct TMH_RequestHandler *rh, json_t *json; int res; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, diff --git a/src/exchange/taler-exchange-httpd_test.h b/src/exchange/taler-exchange-httpd_test.h index a13613f9e..e68ae2f79 100644 --- a/src/exchange/taler-exchange-httpd_test.h +++ b/src/exchange/taler-exchange-httpd_test.h @@ -42,7 +42,7 @@ * @return MHD result code */ int -TMH_TEST_handler_test_base32 (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_base32 (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -67,7 +67,7 @@ TMH_TEST_handler_test_base32 (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_encrypt (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_encrypt (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -92,7 +92,7 @@ TMH_TEST_handler_test_encrypt (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_hkdf (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_hkdf (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -114,7 +114,7 @@ TMH_TEST_handler_test_hkdf (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_ecdhe (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_ecdhe (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -137,7 +137,7 @@ TMH_TEST_handler_test_ecdhe (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_eddsa (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_eddsa (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -156,7 +156,7 @@ TMH_TEST_handler_test_eddsa (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_rsa_get (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_rsa_get (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -176,7 +176,7 @@ TMH_TEST_handler_test_rsa_get (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_rsa_sign (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_rsa_sign (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -198,7 +198,7 @@ TMH_TEST_handler_test_rsa_sign (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test_transfer (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test_transfer (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -216,7 +216,7 @@ TMH_TEST_handler_test_transfer (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TEST_handler_test (struct TMH_RequestHandler *rh, +TEH_TEST_handler_test (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, diff --git a/src/exchange/taler-exchange-httpd_tracking.c b/src/exchange/taler-exchange-httpd_tracking.c index 6f162ff4e..f4d106628 100644 --- a/src/exchange/taler-exchange-httpd_tracking.c +++ b/src/exchange/taler-exchange-httpd_tracking.c @@ -40,7 +40,7 @@ * @return MHD result code */ int -TMH_TRACKING_handler_track_transfer (struct TMH_RequestHandler *rh, +TEH_TRACKING_handler_track_transfer (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -49,7 +49,7 @@ TMH_TRACKING_handler_track_transfer (struct TMH_RequestHandler *rh, struct TALER_WireTransferIdentifierRawP wtid; int res; - res = TMH_PARSE_mhd_request_arg_data (connection, + res = TEH_PARSE_mhd_request_arg_data (connection, "wtid", &wtid, sizeof (struct TALER_WireTransferIdentifierRawP)); @@ -57,7 +57,7 @@ TMH_TRACKING_handler_track_transfer (struct TMH_RequestHandler *rh, return MHD_NO; /* internal error */ if (GNUNET_NO == res) return MHD_YES; /* parse error */ - return TMH_DB_execute_track_transfer (connection, + return TEH_DB_execute_track_transfer (connection, &wtid); } @@ -87,10 +87,10 @@ check_and_handle_track_transaction_request (struct MHD_Connection *connection, &merchant_pub->eddsa_pub)) { GNUNET_break_op (0); - return TMH_RESPONSE_reply_signature_invalid (connection, + return TEH_RESPONSE_reply_signature_invalid (connection, "merchant_sig"); } - return TMH_DB_execute_track_transaction (connection, + return TEH_DB_execute_track_transaction (connection, &tps->h_contract, &tps->h_wire, &tps->coin_pub, @@ -110,7 +110,7 @@ check_and_handle_track_transaction_request (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_TRACKING_handler_track_transaction (struct TMH_RequestHandler *rh, +TEH_TRACKING_handler_track_transaction (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -131,7 +131,7 @@ TMH_TRACKING_handler_track_transaction (struct TMH_RequestHandler *rh, GNUNET_JSON_spec_end () }; - res = TMH_PARSE_post_json (connection, + res = TEH_PARSE_post_json (connection, connection_cls, upload_data, upload_data_size, @@ -140,7 +140,7 @@ TMH_TRACKING_handler_track_transaction (struct TMH_RequestHandler *rh, return MHD_NO; if ( (GNUNET_NO == res) || (NULL == json) ) return MHD_YES; - res = TMH_PARSE_json_data (connection, + res = TEH_PARSE_json_data (connection, json, spec); if (GNUNET_OK != res) diff --git a/src/exchange/taler-exchange-httpd_tracking.h b/src/exchange/taler-exchange-httpd_tracking.h index 28637fdfb..fe223043c 100644 --- a/src/exchange/taler-exchange-httpd_tracking.h +++ b/src/exchange/taler-exchange-httpd_tracking.h @@ -37,7 +37,7 @@ * @return MHD result code */ int -TMH_TRACKING_handler_track_transfer (struct TMH_RequestHandler *rh, +TEH_TRACKING_handler_track_transfer (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, @@ -55,7 +55,7 @@ TMH_TRACKING_handler_track_transfer (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_TRACKING_handler_track_transaction (struct TMH_RequestHandler *rh, +TEH_TRACKING_handler_track_transaction (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, diff --git a/src/exchange/taler-exchange-httpd_validation.c b/src/exchange/taler-exchange-httpd_validation.c index ac875f942..9d7b4ffcb 100644 --- a/src/exchange/taler-exchange-httpd_validation.c +++ b/src/exchange/taler-exchange-httpd_validation.c @@ -72,7 +72,7 @@ static struct Plugin *wire_tail; * @return #GNUNET_OK on success */ int -TMH_VALIDATION_init (const struct GNUNET_CONFIGURATION_Handle *cfg) +TEH_VALIDATION_init (const struct GNUNET_CONFIGURATION_Handle *cfg) { struct Plugin *p; char *wireformats; @@ -106,7 +106,7 @@ TMH_VALIDATION_init (const struct GNUNET_CONFIGURATION_Handle *cfg) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to load plugin %s\n", token); - TMH_VALIDATION_done (); + TEH_VALIDATION_done (); return GNUNET_SYSERR; } GNUNET_CONTAINER_DLL_insert (wire_head, @@ -122,7 +122,7 @@ TMH_VALIDATION_init (const struct GNUNET_CONFIGURATION_Handle *cfg) * Shutdown validation subsystem. */ void -TMH_VALIDATION_done () +TEH_VALIDATION_done () { struct Plugin *p; @@ -147,7 +147,7 @@ TMH_VALIDATION_done () * @return #GNUNET_YES if correctly formatted; #GNUNET_NO if not */ int -TMH_json_validate_wireformat (const json_t *wire, +TEH_json_validate_wireformat (const json_t *wire, int ours) { const char *stype; @@ -168,7 +168,7 @@ TMH_json_validate_wireformat (const json_t *wire, return p->plugin->wire_validate (p->plugin->cls, wire, (GNUNET_YES == ours) - ? &TMH_master_public_key + ? &TEH_master_public_key : NULL); return GNUNET_NO; } @@ -183,7 +183,7 @@ TMH_json_validate_wireformat (const json_t *wire, * @return JSON array with the supported validation methods */ json_t * -TMH_VALIDATION_get_wire_methods (const char *prefix) +TEH_VALIDATION_get_wire_methods (const char *prefix) { json_t *methods; json_t *method; @@ -203,7 +203,7 @@ TMH_VALIDATION_get_wire_methods (const char *prefix) cfg, account_name); if (GNUNET_YES != - TMH_json_validate_wireformat (method, + TEH_json_validate_wireformat (method, GNUNET_YES)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, diff --git a/src/exchange/taler-exchange-httpd_validation.h b/src/exchange/taler-exchange-httpd_validation.h index 3a2ea8757..7722460b7 100644 --- a/src/exchange/taler-exchange-httpd_validation.h +++ b/src/exchange/taler-exchange-httpd_validation.h @@ -32,14 +32,14 @@ * @return #GNUNET_OK on success */ int -TMH_VALIDATION_init (const struct GNUNET_CONFIGURATION_Handle *cfg); +TEH_VALIDATION_init (const struct GNUNET_CONFIGURATION_Handle *cfg); /** * Shutdown validation subsystem. */ void -TMH_VALIDATION_done (void); +TEH_VALIDATION_done (void); /** @@ -51,7 +51,7 @@ TMH_VALIDATION_done (void); * @return #GNUNET_YES if correctly formatted; #GNUNET_NO if not */ int -TMH_json_validate_wireformat (const json_t *wire, +TEH_json_validate_wireformat (const json_t *wire, int ours); @@ -64,7 +64,7 @@ TMH_json_validate_wireformat (const json_t *wire, * @return JSON array with the supported validation methods */ json_t * -TMH_VALIDATION_get_wire_methods (const char *prefix); +TEH_VALIDATION_get_wire_methods (const char *prefix); #endif diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c index fdd245aed..7857a5bc1 100644 --- a/src/exchange/taler-exchange-httpd_wire.c +++ b/src/exchange/taler-exchange-httpd_wire.c @@ -43,16 +43,16 @@ static json_t *wire_methods; * @return MHD result code */ int -TMH_WIRE_handler_wire (struct TMH_RequestHandler *rh, +TEH_WIRE_handler_wire (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data, size_t *upload_data_size) { if (NULL == wire_methods) - wire_methods = TMH_VALIDATION_get_wire_methods ("exchange-wire-incoming"); + wire_methods = TEH_VALIDATION_get_wire_methods ("exchange-wire-incoming"); - return TMH_RESPONSE_reply_json (connection, + return TEH_RESPONSE_reply_json (connection, wire_methods, MHD_HTTP_OK); } diff --git a/src/exchange/taler-exchange-httpd_wire.h b/src/exchange/taler-exchange-httpd_wire.h index 837c2cd46..d67c16a82 100644 --- a/src/exchange/taler-exchange-httpd_wire.h +++ b/src/exchange/taler-exchange-httpd_wire.h @@ -37,7 +37,7 @@ * @return MHD result code */ int -TMH_WIRE_handler_wire (struct TMH_RequestHandler *rh, +TEH_WIRE_handler_wire (struct TEH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, const char *upload_data,