diff options
Diffstat (limited to 'src/backend')
21 files changed, 368 insertions, 368 deletions
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am index 8686fdef..1d92deee 100644 --- a/src/backend/Makefile.am +++ b/src/backend/Makefile.am @@ -10,14 +10,14 @@ taler_merchant_httpd_SOURCES = \ taler-merchant-httpd_responses.c taler-merchant-httpd_responses.h \ taler-merchant-httpd_mhd.c taler-merchant-httpd_mhd.h \ taler-merchant-httpd_auditors.c taler-merchant-httpd_auditors.h \ - taler-merchant-httpd_mints.c taler-merchant-httpd_mints.h \ + taler-merchant-httpd_exchanges.c taler-merchant-httpd_exchanges.h \ taler-merchant-httpd_contract.c taler-merchant-httpd_contract.h \ taler-merchant-httpd_pay.c taler-merchant-httpd_pay.h \ taler-merchant-httpd_util.c taler-merchant-httpd_util.h taler_merchant_httpd_LDADD = \ $(top_srcdir)/src/backenddb/libtalermerchantdb.la \ - -ltalermint \ + -ltalerexchange \ -ltalerutil \ -ltalerpq \ -lmicrohttpd \ diff --git a/src/backend/merchant.conf b/src/backend/merchant.conf index 657cb02f..0861593e 100644 --- a/src/backend/merchant.conf +++ b/src/backend/merchant.conf @@ -14,9 +14,9 @@ KEYFILE = merchant.priv CURRENCY = EUR # FIXME: to be revised -TRUSTED_MINTS = taler +TRUSTED_EXCHANGES = taler -# How quickly do we want the mint to send us our money? +# How quickly do we want the exchange to send us our money? # Used only if the frontend does not specify a value. # FIXME: EDATE is a bit short, 'execution_delay'? EDATE = 3 week @@ -24,8 +24,8 @@ EDATE = 3 week # Which plugin (backend) do we use for the DB. DB = postgres -[mint-taler] -URI = http://mint.test.taler.net/ +[exchange-taler] +URI = http://exchange.test.taler.net/ MASTER_KEY = Q1WVGRGC1F4W7RYC6M23AEGFEXQEHQ730K3GG0B67VPHQSRR75H0 # Auditors must be in sections "auditor-", the rest of the section diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index 737e8f94..72e3cdd4 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -16,7 +16,7 @@ /** * @file merchant/backend/taler-merchant-httpd.c * @brief HTTP serving layer intended to perform crypto-work and - * communication with the mint + * communication with the exchange * @author Marcello Stanisci * @author Christian Grothoff */ @@ -25,14 +25,14 @@ #include <jansson.h> #include <gnunet/gnunet_util_lib.h> #include <taler/taler_util.h> -#include <taler/taler_mint_service.h> +#include <taler/taler_exchange_service.h> #include "taler-merchant-httpd_parsing.h" #include "taler-merchant-httpd_responses.h" #include "taler_merchantdb_lib.h" #include "taler-merchant-httpd.h" #include "taler-merchant-httpd_mhd.h" #include "taler-merchant-httpd_auditors.h" -#include "taler-merchant-httpd_mints.h" +#include "taler-merchant-httpd_exchanges.h" #include "taler-merchant-httpd_contract.h" #include "taler-merchant-httpd_pay.h" #include "taler-merchant-httpd_util.h" @@ -75,7 +75,7 @@ static long long unsigned port; static char *keyfile; /** - * This value tells the mint by which date this merchant would like + * This value tells the exchange by which date this merchant would like * to receive the funds for a deposited payment */ struct GNUNET_TIME_Relative edate_delay; @@ -252,7 +252,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) TALER_MERCHANTDB_plugin_unload (db); db = NULL; } - TMH_MINTS_done (); + TMH_EXCHANGES_done (); TMH_AUDITORS_done (); if (NULL != keyfile) GNUNET_free (privkey); @@ -522,7 +522,7 @@ run (void *cls, &do_shutdown, NULL); EXITIF (GNUNET_SYSERR == - TMH_MINTS_init (config)); + TMH_EXCHANGES_init (config)); EXITIF (GNUNET_SYSERR == TMH_AUDITORS_init (config)); /* FIXME: for now, we just support SEPA here: */ diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h index ac5a4f89..f64bb099 100644 --- a/src/backend/taler-merchant-httpd.h +++ b/src/backend/taler-merchant-httpd.h @@ -173,9 +173,9 @@ extern struct TALER_MERCHANTDB_Plugin *db; /** * If the frontend does NOT specify an execution date, how long should - * we tell the mint to wait to aggregate transactions before + * we tell the exchange to wait to aggregate transactions before * executing? This delay is added to the current time when we - * generate the advisory execution time for the mint. + * generate the advisory execution time for the exchange. */ extern struct GNUNET_TIME_Relative edate_delay; diff --git a/src/backend/taler-merchant-httpd_auditors.c b/src/backend/taler-merchant-httpd_auditors.c index 7caa40ea..e479f8b6 100644 --- a/src/backend/taler-merchant-httpd_auditors.c +++ b/src/backend/taler-merchant-httpd_auditors.c @@ -15,7 +15,7 @@ */ /** * @file backend/taler-merchant-httpd_auditors.c - * @brief logic this HTTPD keeps for each mint we interact with + * @brief logic this HTTPD keeps for each exchange we interact with * @author Marcello Stanisci * @author Christian Grothoff */ @@ -56,28 +56,28 @@ static struct Auditor *auditors; static unsigned int nauditors; /** - * JSON representation of the auditors accepted by this mint. + * JSON representation of the auditors accepted by this exchange. */ json_t *j_auditors; /** - * Check if the given @a dk issued by mint @a mh is audited by + * Check if the given @a dk issued by exchange @a mh is audited by * an auditor that is acceptable for this merchant. (And if the * denomination is not yet expired or something silly like that.) * - * @param mh mint issuing @a dk + * @param mh exchange issuing @a dk * @param dk a denomination issued by @a mh - * @param mint_trusted #GNUNET_YES if the mint of @a dk is trusted by config + * @param exchange_trusted #GNUNET_YES if the exchange of @a dk is trusted by config * @return #GNUNET_OK if we accept this denomination */ int -TMH_AUDITORS_check_dk (struct TALER_MINT_Handle *mh, - const struct TALER_MINT_DenomPublicKey *dk, - int mint_trusted) +TMH_AUDITORS_check_dk (struct TALER_EXCHANGE_Handle *mh, + const struct TALER_EXCHANGE_DenomPublicKey *dk, + int exchange_trusted) { - const struct TALER_MINT_Keys *keys; - const struct TALER_MINT_AuditorInformation *ai; + const struct TALER_EXCHANGE_Keys *keys; + const struct TALER_EXCHANGE_AuditorInformation *ai; unsigned int i; unsigned int j; @@ -87,9 +87,9 @@ TMH_AUDITORS_check_dk (struct TALER_MINT_Handle *mh, "Denomination key offered by client has expired for deposits\n"); return GNUNET_SYSERR; /* expired */ } - if (GNUNET_YES == mint_trusted) + if (GNUNET_YES == exchange_trusted) return GNUNET_OK; - keys = TALER_MINT_get_keys (mh); + keys = TALER_EXCHANGE_get_keys (mh); if (NULL == keys) { /* this should never happen, keys should have been successfully @@ -203,7 +203,7 @@ TMH_AUDITORS_init (const struct GNUNET_CONFIGURATION_Handle *cfg) &parse_auditors, (void *) cfg); - /* Generate preferred mint(s) array. */ + /* Generate preferred exchange(s) array. */ j_auditors = json_array (); for (cnt = 0; cnt < nauditors; cnt++) json_array_append_new (j_auditors, diff --git a/src/backend/taler-merchant-httpd_auditors.h b/src/backend/taler-merchant-httpd_auditors.h index 14c3bd6f..e71b4964 100644 --- a/src/backend/taler-merchant-httpd_auditors.h +++ b/src/backend/taler-merchant-httpd_auditors.h @@ -15,7 +15,7 @@ */ /** * @file backend/taler-merchant-httpd_auditors.h - * @brief logic this HTTPD keeps for each mint we interact with + * @brief logic this HTTPD keeps for each exchange we interact with * @author Marcello Stanisci * @author Christian Grothoff */ @@ -25,12 +25,12 @@ #include <jansson.h> #include <gnunet/gnunet_util_lib.h> #include <taler/taler_util.h> -#include <taler/taler_mint_service.h> +#include <taler/taler_exchange_service.h> #include "taler-merchant-httpd.h" /** - * JSON representation of the auditors accepted by this mint. + * JSON representation of the auditors accepted by this exchange. */ extern json_t *j_auditors; @@ -47,19 +47,19 @@ TMH_AUDITORS_init (const struct GNUNET_CONFIGURATION_Handle *cfg); /** - * Check if the given @a dk issued by mint @a mh is audited by + * Check if the given @a dk issued by exchange @a mh is audited by * an auditor that is acceptable for this merchant. (And if the * denomination is not yet expired or something silly like that.) * - * @param mh mint issuing @a dk + * @param mh exchange issuing @a dk * @param dk a denomination issued by @a mh - * @param mint_trusted #GNUNET_YES if the mint of @a dk is trusted by config + * @param exchange_trusted #GNUNET_YES if the exchange of @a dk is trusted by config * @return #GNUNET_OK if we accept this denomination */ int -TMH_AUDITORS_check_dk (struct TALER_MINT_Handle *mh, - const struct TALER_MINT_DenomPublicKey *dk, - int mint_trusted); +TMH_AUDITORS_check_dk (struct TALER_EXCHANGE_Handle *mh, + const struct TALER_EXCHANGE_DenomPublicKey *dk, + int exchange_trusted); /** diff --git a/src/backend/taler-merchant-httpd_contract.c b/src/backend/taler-merchant-httpd_contract.c index 064e10c5..28431df7 100644 --- a/src/backend/taler-merchant-httpd_contract.c +++ b/src/backend/taler-merchant-httpd_contract.c @@ -24,13 +24,13 @@ #include "taler-merchant-httpd.h" #include "taler-merchant-httpd_parsing.h" #include "taler-merchant-httpd_auditors.h" -#include "taler-merchant-httpd_mints.h" +#include "taler-merchant-httpd_exchanges.h" #include "taler-merchant-httpd_responses.h" /** * Manage a contract request. In practical terms, it adds the fields - * 'mints', 'merchant_pub', and 'H_wire' to the contract 'proposition' + * 'exchanges', 'merchant_pub', and 'H_wire' to the contract 'proposition' * gotten from the frontend. Finally, it adds (outside of the * contract) a signature of the (hashed stringification) of the * contract (and the hashed stringification of this contract as well @@ -108,8 +108,8 @@ MH_handler_contract (struct TMH_RequestHandler *rh, /* add fields to the contract that the backend should provide */ json_object_set (jcontract, - "mints", - trusted_mints); + "exchanges", + trusted_exchanges); json_object_set (jcontract, "auditors", j_auditors); diff --git a/src/backend/taler-merchant-httpd_contract.h b/src/backend/taler-merchant-httpd_contract.h index 6a6b3a41..88c12805 100644 --- a/src/backend/taler-merchant-httpd_contract.h +++ b/src/backend/taler-merchant-httpd_contract.h @@ -18,8 +18,8 @@ * @brief headers for /contract handler * @author Marcello Stanisci */ -#ifndef TALER_MINT_HTTPD_CONTRACT_H -#define TALER_MINT_HTTPD_CONTRACT_H +#ifndef TALER_EXCHANGE_HTTPD_CONTRACT_H +#define TALER_EXCHANGE_HTTPD_CONTRACT_H #include <microhttpd.h> #include "taler-merchant-httpd.h" diff --git a/src/backend/taler-merchant-httpd_mints.c b/src/backend/taler-merchant-httpd_exchanges.c index 56aee9a9..59e97495 100644 --- a/src/backend/taler-merchant-httpd_mints.c +++ b/src/backend/taler-merchant-httpd_exchanges.c @@ -14,13 +14,13 @@ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ /** - * @file backend/taler-merchant-httpd_mints.c - * @brief logic this HTTPD keeps for each mint we interact with + * @file backend/taler-merchant-httpd_exchanges.c + * @brief logic this HTTPD keeps for each exchange we interact with * @author Marcello Stanisci * @author Christian Grothoff */ #include "platform.h" -#include "taler-merchant-httpd_mints.h" +#include "taler-merchant-httpd_exchanges.h" /** @@ -30,31 +30,31 @@ /** - * Mint + * Exchange */ -struct Mint; +struct Exchange; /** - * Information we keep for a pending #MMH_MINTS_find_mint() operation. + * Information we keep for a pending #MMH_EXCHANGES_find_exchange() operation. */ -struct TMH_MINTS_FindOperation +struct TMH_EXCHANGES_FindOperation { /** * Kept in a DLL. */ - struct TMH_MINTS_FindOperation *next; + struct TMH_EXCHANGES_FindOperation *next; /** * Kept in a DLL. */ - struct TMH_MINTS_FindOperation *prev; + struct TMH_EXCHANGES_FindOperation *prev; /** * Function to call with the result. */ - TMH_MINTS_FindContinuation fc; + TMH_EXCHANGES_FindContinuation fc; /** * Closure for @e fc. @@ -62,9 +62,9 @@ struct TMH_MINTS_FindOperation void *fc_cls; /** - * Mint we wait for the /keys for. + * Exchange we wait for the /keys for. */ - struct Mint *my_mint; + struct Exchange *my_exchange; /** * Task scheduled to asynchrnously return the result. @@ -75,44 +75,44 @@ struct TMH_MINTS_FindOperation /** - * Mint + * Exchange */ -struct Mint +struct Exchange { /** * Kept in a DLL. */ - struct Mint *next; + struct Exchange *next; /** * Kept in a DLL. */ - struct Mint *prev; + struct Exchange *prev; /** - * Head of FOs pending for this mint. + * Head of FOs pending for this exchange. */ - struct TMH_MINTS_FindOperation *fo_head; + struct TMH_EXCHANGES_FindOperation *fo_head; /** - * Tail of FOs pending for this mint. + * Tail of FOs pending for this exchange. */ - struct TMH_MINTS_FindOperation *fo_tail; + struct TMH_EXCHANGES_FindOperation *fo_tail; /** - * (base) URI of the mint. + * (base) URI of the exchange. */ char *uri; /** - * A connection to this mint + * A connection to this exchange */ - struct TALER_MINT_Handle *conn; + struct TALER_EXCHANGE_Handle *conn; /** * Master public key, guaranteed to be set ONLY for - * trusted mints. + * trusted exchanges. */ struct TALER_MasterPublicKeyP master_pub; @@ -123,12 +123,12 @@ struct Mint /** * Flag which indicates whether some HTTP transfer between - * this merchant and the mint is still ongoing + * this merchant and the exchange is still ongoing */ int pending; /** - * #GNUNET_YES if this mint is from our configuration and + * #GNUNET_YES if this exchange is from our configuration and * explicitly trusted, #GNUNET_NO if we need to check each * key to be sure it is trusted. */ @@ -138,83 +138,83 @@ struct Mint /** - * Context for all mint operations (useful to the event loop) + * Context for all exchange operations (useful to the event loop) */ -static struct TALER_MINT_Context *ctx; +static struct TALER_EXCHANGE_Context *ctx; /** - * Task we use to drive the interaction with this mint. + * Task we use to drive the interaction with this exchange. */ static struct GNUNET_SCHEDULER_Task *poller_task; /** - * Head of mints we know about. + * Head of exchanges we know about. */ -static struct Mint *mint_head; +static struct Exchange *exchange_head; /** - * Tail of mints we know about. + * Tail of exchanges we know about. */ -static struct Mint *mint_tail; +static struct Exchange *exchange_tail; /** - * List of our trusted mints for inclusion in contracts. + * List of our trusted exchanges for inclusion in contracts. */ -json_t *trusted_mints; +json_t *trusted_exchanges; /** * Function called with information about who is auditing - * a particular mint and what key the mint is using. + * a particular exchange and what key the exchange is using. * - * @param cls closure, will be `struct Mint` so that + * @param cls closure, will be `struct Exchange` so that * when this function gets called, it will change the flag 'pending' - * to 'false'. Note: 'keys' is automatically saved inside the mint's - * handle, which is contained inside 'struct Mint', when + * to 'false'. Note: 'keys' is automatically saved inside the exchange's + * handle, which is contained inside 'struct Exchange', when * this callback is called. Thus, once 'pending' turns 'false', - * it is safe to call 'TALER_MINT_get_keys()' on the mint's handle, + * it is safe to call 'TALER_EXCHANGE_get_keys()' on the exchange's handle, * in order to get the "good" keys. * @param keys information about the various keys used - * by the mint + * by the exchange */ static void keys_mgmt_cb (void *cls, - const struct TALER_MINT_Keys *keys) + const struct TALER_EXCHANGE_Keys *keys) { - struct Mint *mint = cls; - struct TMH_MINTS_FindOperation *fo; + struct Exchange *exchange = cls; + struct TMH_EXCHANGES_FindOperation *fo; if (NULL != keys) { - mint->pending = GNUNET_NO; + exchange->pending = GNUNET_NO; } else { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to fetch /keys from `%s'\n", - mint->uri); - TALER_MINT_disconnect (mint->conn); - mint->conn = NULL; - mint->pending = GNUNET_SYSERR; /* failed hard */ - mint->retry_time = GNUNET_TIME_relative_to_absolute (KEYS_RETRY_FREQ); + exchange->uri); + TALER_EXCHANGE_disconnect (exchange->conn); + exchange->conn = NULL; + exchange->pending = GNUNET_SYSERR; /* failed hard */ + exchange->retry_time = GNUNET_TIME_relative_to_absolute (KEYS_RETRY_FREQ); } - while (NULL != (fo = mint->fo_head)) + while (NULL != (fo = exchange->fo_head)) { - GNUNET_CONTAINER_DLL_remove (mint->fo_head, - mint->fo_tail, + GNUNET_CONTAINER_DLL_remove (exchange->fo_head, + exchange->fo_tail, fo); fo->fc (fo->fc_cls, - (NULL != keys) ? mint->conn : NULL, - mint->trusted); + (NULL != keys) ? exchange->conn : NULL, + exchange->trusted); GNUNET_free (fo); } } /** - * Task that runs the mint's event loop using the GNUnet scheduler. + * Task that runs the exchange's event loop using the GNUnet scheduler. * - * @param cls a `struct Mint *` + * @param cls a `struct Exchange *` * @param tc scheduler context (unused) */ static void @@ -230,23 +230,23 @@ context_task (void *cls, struct GNUNET_NETWORK_FDSet *ws; struct GNUNET_TIME_Relative delay; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "In mint context polling task\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "In exchange context polling task\n"); poller_task = NULL; - TALER_MINT_perform (ctx); + TALER_EXCHANGE_perform (ctx); max_fd = -1; timeout = -1; FD_ZERO (&read_fd_set); FD_ZERO (&write_fd_set); FD_ZERO (&except_fd_set); - TALER_MINT_get_select_info (ctx, + TALER_EXCHANGE_get_select_info (ctx, &read_fd_set, &write_fd_set, &except_fd_set, &max_fd, &timeout); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "In mint context polling task, max_fd=%d, timeout=%ld\n", + "In exchange context polling task, max_fd=%d, timeout=%ld\n", max_fd, timeout); if (timeout >= 0) delay = @@ -277,23 +277,23 @@ context_task (void *cls, /** * Task to return find operation result asynchronously to caller. * - * @param cls a `struct TMH_MINTS_FindOperation` + * @param cls a `struct TMH_EXCHANGES_FindOperation` * @param tc unused */ static void return_result (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - struct TMH_MINTS_FindOperation *fo = cls; - struct Mint *mint = fo->my_mint; + struct TMH_EXCHANGES_FindOperation *fo = cls; + struct Exchange *exchange = fo->my_exchange; fo->at = NULL; - GNUNET_CONTAINER_DLL_remove (mint->fo_head, - mint->fo_tail, + GNUNET_CONTAINER_DLL_remove (exchange->fo_head, + exchange->fo_tail, fo); fo->fc (fo->fc_cls, - (GNUNET_SYSERR == mint->pending) ? NULL : mint->conn, - mint->trusted); + (GNUNET_SYSERR == exchange->pending) ? NULL : exchange->conn, + exchange->trusted); GNUNET_free (fo); GNUNET_SCHEDULER_cancel (poller_task); GNUNET_SCHEDULER_add_now (&context_task, @@ -302,22 +302,22 @@ return_result (void *cls, /** - * Find a mint that matches @a chosen_mint. If we cannot connect - * to the mint, or if it is not acceptable, @a fc is called with - * NULL for the mint. + * Find a exchange that matches @a chosen_exchange. If we cannot connect + * to the exchange, or if it is not acceptable, @a fc is called with + * NULL for the exchange. * - * @param chosen_mint URI of the mint we would like to talk to - * @param fc function to call with the handles for the mint + * @param chosen_exchange URI of the exchange we would like to talk to + * @param fc function to call with the handles for the exchange * @param fc_cls closure for @a fc * @return NULL on error */ -struct TMH_MINTS_FindOperation * -TMH_MINTS_find_mint (const char *chosen_mint, - TMH_MINTS_FindContinuation fc, +struct TMH_EXCHANGES_FindOperation * +TMH_EXCHANGES_find_exchange (const char *chosen_exchange, + TMH_EXCHANGES_FindContinuation fc, void *fc_cls) { - struct Mint *mint; - struct TMH_MINTS_FindOperation *fo; + struct Exchange *exchange; + struct TMH_EXCHANGES_FindOperation *fo; if (NULL == ctx) { @@ -326,42 +326,42 @@ TMH_MINTS_find_mint (const char *chosen_mint, } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Trying to find chosen mint `%s'\n", - chosen_mint); + "Trying to find chosen exchange `%s'\n", + chosen_exchange); - /* Check if the mint is known */ - for (mint = mint_head; NULL != mint; mint = mint->next) + /* Check if the exchange is known */ + for (exchange = exchange_head; NULL != exchange; exchange = exchange->next) /* test it by checking public key --- FIXME: hostname or public key!? Should probably be URI, not hostname anyway! */ - if (0 == strcmp (mint->uri, - chosen_mint)) + if (0 == strcmp (exchange->uri, + chosen_exchange)) break; - if (NULL == mint) + if (NULL == exchange) { - /* This is a new mint */ - mint = GNUNET_new (struct Mint); - mint->uri = GNUNET_strdup (chosen_mint); - mint->pending = GNUNET_YES; - GNUNET_CONTAINER_DLL_insert (mint_head, - mint_tail, - mint); + /* This is a new exchange */ + exchange = GNUNET_new (struct Exchange); + exchange->uri = GNUNET_strdup (chosen_exchange); + exchange->pending = GNUNET_YES; + GNUNET_CONTAINER_DLL_insert (exchange_head, + exchange_tail, + exchange); } - /* check if we should resume this mint */ - if ( (GNUNET_SYSERR == mint->pending) && - (0 == GNUNET_TIME_absolute_get_remaining (mint->retry_time).rel_value_us) ) - mint->pending = GNUNET_YES; + /* check if we should resume this exchange */ + if ( (GNUNET_SYSERR == exchange->pending) && + (0 == GNUNET_TIME_absolute_get_remaining (exchange->retry_time).rel_value_us) ) + exchange->pending = GNUNET_YES; - fo = GNUNET_new (struct TMH_MINTS_FindOperation); + fo = GNUNET_new (struct TMH_EXCHANGES_FindOperation); fo->fc = fc; fo->fc_cls = fc_cls; - fo->my_mint = mint; - GNUNET_CONTAINER_DLL_insert (mint->fo_head, - mint->fo_tail, + fo->my_exchange = exchange; + GNUNET_CONTAINER_DLL_insert (exchange->fo_head, + exchange->fo_tail, fo); - if (GNUNET_NO == mint->pending) + if (GNUNET_NO == exchange->pending) { /* We are not currently waiting for a reply, immediately return result */ @@ -371,15 +371,15 @@ TMH_MINTS_find_mint (const char *chosen_mint, } /* If new or resumed, retry fetching /keys */ - if ( (NULL == mint->conn) && - (GNUNET_YES == mint->pending) ) + if ( (NULL == exchange->conn) && + (GNUNET_YES == exchange->pending) ) { - mint->conn = TALER_MINT_connect (ctx, - mint->uri, + exchange->conn = TALER_EXCHANGE_connect (ctx, + exchange->uri, &keys_mgmt_cb, - mint, - TALER_MINT_OPTION_END); - GNUNET_break (NULL != mint->conn); + exchange, + TALER_EXCHANGE_OPTION_END); + GNUNET_break (NULL != exchange->conn); } return fo; } @@ -391,17 +391,17 @@ TMH_MINTS_find_mint (const char *chosen_mint, * @param fo handle to operation to abort */ void -TMH_MINTS_find_mint_cancel (struct TMH_MINTS_FindOperation *fo) +TMH_EXCHANGES_find_exchange_cancel (struct TMH_EXCHANGES_FindOperation *fo) { - struct Mint *mint = fo->my_mint; + struct Exchange *exchange = fo->my_exchange; if (NULL != fo->at) { GNUNET_SCHEDULER_cancel (fo->at); fo->at = NULL; } - GNUNET_CONTAINER_DLL_remove (mint->fo_head, - mint->fo_tail, + GNUNET_CONTAINER_DLL_remove (exchange->fo_head, + exchange->fo_tail, fo); GNUNET_free (fo); } @@ -409,23 +409,23 @@ TMH_MINTS_find_mint_cancel (struct TMH_MINTS_FindOperation *fo) /** * Function called on each configuration section. Finds sections - * about mints and parses the entries. + * about exchanges and parses the entries. * * @param cls closure, with a `const struct GNUNET_CONFIGURATION_Handle *` * @param section name of the section */ static void -parse_mints (void *cls, +parse_exchanges (void *cls, const char *section) { const struct GNUNET_CONFIGURATION_Handle *cfg = cls; char *uri; char *mks; - struct Mint *mint; + struct Exchange *exchange; if (0 != strncasecmp (section, - "mint-", - strlen ("mint-"))) + "exchange-", + strlen ("exchange-"))) return; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, @@ -438,8 +438,8 @@ parse_mints (void *cls, "URI"); return; } - mint = GNUNET_new (struct Mint); - mint->uri = uri; + exchange = GNUNET_new (struct Exchange); + exchange->uri = uri; if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, section, @@ -449,9 +449,9 @@ parse_mints (void *cls, if (GNUNET_OK == GNUNET_CRYPTO_eddsa_public_key_from_string (mks, strlen (mks), - &mint->master_pub.eddsa_pub)) + &exchange->master_pub.eddsa_pub)) { - mint->trusted = GNUNET_YES; + exchange->trusted = GNUNET_YES; } else { @@ -462,50 +462,50 @@ parse_mints (void *cls, } GNUNET_free (mks); } - GNUNET_CONTAINER_DLL_insert (mint_head, - mint_tail, - mint); - mint->pending = GNUNET_YES; - mint->conn = TALER_MINT_connect (ctx, - mint->uri, + GNUNET_CONTAINER_DLL_insert (exchange_head, + exchange_tail, + exchange); + exchange->pending = GNUNET_YES; + exchange->conn = TALER_EXCHANGE_connect (ctx, + exchange->uri, &keys_mgmt_cb, - mint, - TALER_MINT_OPTION_END); - GNUNET_break (NULL != mint->conn); + exchange, + TALER_EXCHANGE_OPTION_END); + GNUNET_break (NULL != exchange->conn); } /** - * Parses "trusted" mints listed in the configuration. + * Parses "trusted" exchanges listed in the configuration. * * @param cfg the configuration * @return #GNUNET_OK on success; #GNUNET_SYSERR upon error in * parsing. */ int -TMH_MINTS_init (const struct GNUNET_CONFIGURATION_Handle *cfg) +TMH_EXCHANGES_init (const struct GNUNET_CONFIGURATION_Handle *cfg) { - struct Mint *mint; - json_t *j_mint; + struct Exchange *exchange; + json_t *j_exchange; - ctx = TALER_MINT_init (); + ctx = TALER_EXCHANGE_init (); if (NULL == ctx) return GNUNET_SYSERR; GNUNET_CONFIGURATION_iterate_sections (cfg, - &parse_mints, + &parse_exchanges, (void *) cfg); - /* build JSON with list of trusted mints */ - trusted_mints = json_array (); - for (mint = mint_head; NULL != mint; mint = mint->next) + /* build JSON with list of trusted exchanges */ + trusted_exchanges = json_array (); + for (exchange = exchange_head; NULL != exchange; exchange = exchange->next) { - if (GNUNET_YES != mint->trusted) + if (GNUNET_YES != exchange->trusted) continue; - j_mint = json_pack ("{s:s, s:o}", - "url", mint->uri, - "master_pub", TALER_json_from_data (&mint->master_pub, + j_exchange = json_pack ("{s:s, s:o}", + "url", exchange->uri, + "master_pub", TALER_json_from_data (&exchange->master_pub, sizeof (struct TALER_MasterPublicKeyP))); - json_array_append_new (trusted_mints, - j_mint); + json_array_append_new (trusted_exchanges, + j_exchange); } poller_task = GNUNET_SCHEDULER_add_now (&context_task, NULL); @@ -514,27 +514,27 @@ TMH_MINTS_init (const struct GNUNET_CONFIGURATION_Handle *cfg) /** - * Function called to shutdown the mints subsystem. + * Function called to shutdown the exchanges subsystem. */ void -TMH_MINTS_done () +TMH_EXCHANGES_done () { - struct Mint *mint; + struct Exchange *exchange; - while (NULL != (mint = mint_head)) + while (NULL != (exchange = exchange_head)) { - GNUNET_CONTAINER_DLL_remove (mint_head, - mint_tail, - mint); - if (NULL != mint->conn) - TALER_MINT_disconnect (mint->conn); - GNUNET_free (mint->uri); - GNUNET_free (mint); + GNUNET_CONTAINER_DLL_remove (exchange_head, + exchange_tail, + exchange); + if (NULL != exchange->conn) + TALER_EXCHANGE_disconnect (exchange->conn); + GNUNET_free (exchange->uri); + GNUNET_free (exchange); } if (NULL != poller_task) { GNUNET_SCHEDULER_cancel (poller_task); poller_task = NULL; } - TALER_MINT_fini (ctx); + TALER_EXCHANGE_fini (ctx); } diff --git a/src/backend/taler-merchant-httpd_exchanges.h b/src/backend/taler-merchant-httpd_exchanges.h new file mode 100644 index 00000000..6612f4f4 --- /dev/null +++ b/src/backend/taler-merchant-httpd_exchanges.h @@ -0,0 +1,105 @@ +/* + This file is part of TALER + (C) 2014, 2015 GNUnet e.V. + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> +*/ +/** + * @file backend/taler-merchant-httpd_exchanges.h + * @brief logic this HTTPD keeps for each exchange we interact with + * @author Marcello Stanisci + * @author Christian Grothoff + */ +#ifndef TALER_MERCHANT_HTTPD_EXCHANGES_H +#define TALER_MERCHANT_HTTPD_EXCHANGES_H + +#include <jansson.h> +#include <gnunet/gnunet_util_lib.h> +#include <curl/curl.h> +#include <taler/taler_util.h> +#include <taler/taler_exchange_service.h> +#include "taler-merchant-httpd.h" + + +/** + * List of our trusted exchanges in JSON format for inclusion in contracts. + */ +extern json_t *trusted_exchanges; + + +/** + * Parses "trusted" exchanges listed in the configuration. + * + * @param cfg the configuration + * @return #GNUNET_OK on success; #GNUNET_SYSERR upon error in + * parsing or initialization. + */ +int +TMH_EXCHANGES_init (const struct GNUNET_CONFIGURATION_Handle *cfg); + + +/** + * Function called to shutdown the exchanges subsystem. + */ +void +TMH_EXCHANGES_done (void); + + +/** + * Function called with the result of a #TMH_EXCHANGES_find_exchange() + * operation. + * + * @param cls closure + * @param mh handle to the exchange context + * @param exchange_trusted #GNUNET_YES if this exchange is trusted by config + */ +typedef void +(*TMH_EXCHANGES_FindContinuation)(void *cls, + struct TALER_EXCHANGE_Handle *mh, + int exchange_trusted); + + +/** + * Information we keep for a pending #MMH_EXCHANGES_find_exchange() operation. + */ +struct TMH_EXCHANGES_FindOperation; + + +/** + * Find a exchange that matches @a chosen_exchange. If we cannot connect + * to the exchange, or if it is not acceptable, @a fc is called with + * NULL for the exchange. + * + * @param chosen_exchange URI of the exchange we would like to talk to + * @param fc function to call with the handles for the exchange + * @param fc_cls closure for @a fc + * + * FIXME: should probably return a value to *cancel* the + * operation in case MHD connection goes down and needs to + * free fc_cls. + */ +struct TMH_EXCHANGES_FindOperation * +TMH_EXCHANGES_find_exchange (const char *chosen_exchange, + TMH_EXCHANGES_FindContinuation fc, + void *fc_cls); + + +/** + * Abort pending find operation. + * + * @param fo handle to operation to abort + */ +void +TMH_EXCHANGES_find_exchange_cancel (struct TMH_EXCHANGES_FindOperation *fo); + + +#endif diff --git a/src/backend/taler-merchant-httpd_mhd.c b/src/backend/taler-merchant-httpd_mhd.c index 6fd18d9c..9ffabe4d 100644 --- a/src/backend/taler-merchant-httpd_mhd.c +++ b/src/backend/taler-merchant-httpd_mhd.c @@ -15,7 +15,7 @@ */ /** * @file taler-merchant-httpd_mhd.c - * @brief helpers for MHD interaction; these are TALER_MINT_handler_ functions + * @brief helpers for MHD interaction; these are TALER_EXCHANGE_handler_ functions * that generate simple MHD replies that do not require any real operations * to be performed (error handling, static pages, etc.) * @author Florian Dold @@ -110,7 +110,7 @@ TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh, rh->mime_type); MHD_add_response_header (response, MHD_HTTP_HEADER_LOCATION, - "http://www.git.taler.net/?p=mint.git"); + "http://www.git.taler.net/?p=exchange.git"); ret = MHD_queue_response (connection, rh->response_code, response); @@ -145,4 +145,4 @@ TMH_MHD_handler_send_json_pack_error (struct TMH_RequestHandler *rh, } -/* end of taler-mint-httpd_mhd.c */ +/* end of taler-exchange-httpd_mhd.c */ diff --git a/src/backend/taler-merchant-httpd_mhd.h b/src/backend/taler-merchant-httpd_mhd.h index 3fe137db..48d210a1 100644 --- a/src/backend/taler-merchant-httpd_mhd.h +++ b/src/backend/taler-merchant-httpd_mhd.h @@ -21,8 +21,8 @@ * @author Benedikt Mueller * @author Christian Grothoff */ -#ifndef TALER_MINT_HTTPD_MHD_H -#define TALER_MINT_HTTPD_MHD_H +#ifndef TALER_EXCHANGE_HTTPD_MHD_H +#define TALER_EXCHANGE_HTTPD_MHD_H #include <gnunet/gnunet_util_lib.h> #include <microhttpd.h> #include "taler-merchant-httpd.h" diff --git a/src/backend/taler-merchant-httpd_mints.h b/src/backend/taler-merchant-httpd_mints.h deleted file mode 100644 index 809d495a..00000000 --- a/src/backend/taler-merchant-httpd_mints.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - This file is part of TALER - (C) 2014, 2015 GNUnet e.V. - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> -*/ -/** - * @file backend/taler-merchant-httpd_mints.h - * @brief logic this HTTPD keeps for each mint we interact with - * @author Marcello Stanisci - * @author Christian Grothoff - */ -#ifndef TALER_MERCHANT_HTTPD_MINTS_H -#define TALER_MERCHANT_HTTPD_MINTS_H - -#include <jansson.h> -#include <gnunet/gnunet_util_lib.h> -#include <curl/curl.h> -#include <taler/taler_util.h> -#include <taler/taler_mint_service.h> -#include "taler-merchant-httpd.h" - - -/** - * List of our trusted mints in JSON format for inclusion in contracts. - */ -extern json_t *trusted_mints; - - -/** - * Parses "trusted" mints listed in the configuration. - * - * @param cfg the configuration - * @return #GNUNET_OK on success; #GNUNET_SYSERR upon error in - * parsing or initialization. - */ -int -TMH_MINTS_init (const struct GNUNET_CONFIGURATION_Handle *cfg); - - -/** - * Function called to shutdown the mints subsystem. - */ -void -TMH_MINTS_done (void); - - -/** - * Function called with the result of a #TMH_MINTS_find_mint() - * operation. - * - * @param cls closure - * @param mh handle to the mint context - * @param mint_trusted #GNUNET_YES if this mint is trusted by config - */ -typedef void -(*TMH_MINTS_FindContinuation)(void *cls, - struct TALER_MINT_Handle *mh, - int mint_trusted); - - -/** - * Information we keep for a pending #MMH_MINTS_find_mint() operation. - */ -struct TMH_MINTS_FindOperation; - - -/** - * Find a mint that matches @a chosen_mint. If we cannot connect - * to the mint, or if it is not acceptable, @a fc is called with - * NULL for the mint. - * - * @param chosen_mint URI of the mint we would like to talk to - * @param fc function to call with the handles for the mint - * @param fc_cls closure for @a fc - * - * FIXME: should probably return a value to *cancel* the - * operation in case MHD connection goes down and needs to - * free fc_cls. - */ -struct TMH_MINTS_FindOperation * -TMH_MINTS_find_mint (const char *chosen_mint, - TMH_MINTS_FindContinuation fc, - void *fc_cls); - - -/** - * Abort pending find operation. - * - * @param fo handle to operation to abort - */ -void -TMH_MINTS_find_mint_cancel (struct TMH_MINTS_FindOperation *fo); - - -#endif diff --git a/src/backend/taler-merchant-httpd_parsing.c b/src/backend/taler-merchant-httpd_parsing.c index 14a87ff4..44f3a476 100644 --- a/src/backend/taler-merchant-httpd_parsing.c +++ b/src/backend/taler-merchant-httpd_parsing.c @@ -15,7 +15,7 @@ */ /** - * @file taler-mint-httpd_parsing.c + * @file taler-exchange-httpd_parsing.c * @brief functions to parse incoming requests (MHD arguments and JSON snippets) * @author Florian Dold * @author Benedikt Mueller @@ -1061,4 +1061,4 @@ TMH_PARSE_json_data (struct MHD_Connection *connection, } -/* end of taler-mint-httpd_parsing.c */ +/* end of taler-exchange-httpd_parsing.c */ diff --git a/src/backend/taler-merchant-httpd_parsing.h b/src/backend/taler-merchant-httpd_parsing.h index dd2c75e4..9e78768e 100644 --- a/src/backend/taler-merchant-httpd_parsing.h +++ b/src/backend/taler-merchant-httpd_parsing.h @@ -14,14 +14,14 @@ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ /** - * @file taler-mint-httpd_parsing.h + * @file taler-exchange-httpd_parsing.h * @brief functions to parse incoming requests * @author Florian Dold * @author Benedikt Mueller * @author Christian Grothoff */ -#ifndef TALER_MINT_HTTPD_PARSING_H -#define TALER_MINT_HTTPD_PARSING_H +#ifndef TALER_EXCHANGE_HTTPD_PARSING_H +#define TALER_EXCHANGE_HTTPD_PARSING_H #include <microhttpd.h> #include <jansson.h> @@ -423,4 +423,4 @@ TMH_PARSE_mhd_request_var_arg_data (struct MHD_Connection *connection, -#endif /* TALER_MINT_HTTPD_PARSING_H */ +#endif /* TALER_EXCHANGE_HTTPD_PARSING_H */ diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c index edace55b..e38de0c6 100644 --- a/src/backend/taler-merchant-httpd_pay.c +++ b/src/backend/taler-merchant-httpd_pay.c @@ -24,12 +24,12 @@ #include <gnunet/gnunet_util_lib.h> #include <taler/taler_signatures.h> #include <taler/taler_json_lib.h> -#include <taler/taler_mint_service.h> +#include <taler/taler_exchange_service.h> #include "taler-merchant-httpd.h" #include "taler-merchant-httpd_parsing.h" #include "taler-merchant-httpd_responses.h" #include "taler-merchant-httpd_auditors.h" -#include "taler-merchant-httpd_mints.h" +#include "taler-merchant-httpd_exchanges.h" #include "taler_merchantdb_lib.h" @@ -54,7 +54,7 @@ struct MERCHANT_DepositConfirmation * Handle to the deposit operation we are performing for * this coin, NULL after the operation is done. */ - struct TALER_MINT_DepositHandle *dh; + struct TALER_EXCHANGE_DepositHandle *dh; /** * Denomination of this coin. @@ -119,17 +119,17 @@ struct PayContext struct MHD_Connection *connection; /** - * Handle to the mint that we are doing the payment with. - * (initially NULL while @e fo is trying to find a mint). + * Handle to the exchange that we are doing the payment with. + * (initially NULL while @e fo is trying to find a exchange). */ - struct TALER_MINT_Handle *mh; + struct TALER_EXCHANGE_Handle *mh; /** * Handle for operation to lookup /keys (and auditors) from - * the mint used for this transaction; NULL if no operation is + * the exchange used for this transaction; NULL if no operation is * pending. */ - struct TMH_MINTS_FindOperation *fo; + struct TMH_EXCHANGES_FindOperation *fo; /** * Placeholder for #TMH_PARSE_post_json() to keep its internal state. @@ -137,9 +137,9 @@ struct PayContext void *json_parse_context; /** - * Mint URI given in @e root. + * Exchange URI given in @e root. */ - char *chosen_mint; + char *chosen_exchange; /** * Transaction ID given in @e root. @@ -148,7 +148,7 @@ struct PayContext /** * Maximum fee the merchant is willing to pay, from @e root. - * Note that IF the total fee of the mint is higher, that is + * Note that IF the total fee of the exchange is higher, that is * acceptable to the merchant if the customer is willing to * pay the difference (i.e. amount - max_fee <= actual-amount - actual-fee). */ @@ -247,7 +247,7 @@ abort_deposit (struct PayContext *pc) if (NULL != dci->dh) { - TALER_MINT_deposit_cancel (dci->dh); + TALER_EXCHANGE_deposit_cancel (dci->dh); dci->dh = NULL; } } @@ -263,7 +263,7 @@ abort_deposit (struct PayContext *pc) * that no other confirmations are on the way, and can pack a response * for the wallet * @param http_status HTTP response code, #MHD_HTTP_OK - * (200) for successful deposit; 0 if the mint's reply is bogus (fails + * (200) for successful deposit; 0 if the exchange's reply is bogus (fails * to follow the protocol) * @param proof the received JSON reply, * should be kept as proof (and, in case of errors, be forwarded to @@ -341,7 +341,7 @@ pay_context_cleanup (struct TM_HandlerContext *hc) if (NULL != dc->dh) { - TALER_MINT_deposit_cancel (dc->dh); + TALER_EXCHANGE_deposit_cancel (dc->dh); dc->dh = NULL; } if (NULL != dc->denom.rsa_public_key) @@ -358,7 +358,7 @@ pay_context_cleanup (struct TM_HandlerContext *hc) GNUNET_free_non_null (pc->dc); if (NULL != pc->fo) { - TMH_MINTS_find_mint_cancel (pc->fo); + TMH_EXCHANGES_find_exchange_cancel (pc->fo); pc->fo = NULL; } if (NULL != pc->response) @@ -371,37 +371,37 @@ pay_context_cleanup (struct TM_HandlerContext *hc) /** - * Function called with the result of our mint lookup. + * Function called with the result of our exchange lookup. * * @param cls the `struct PayContext` - * @param mh NULL if mint was not found to be acceptable - * @param mint_trusted #GNUNET_YES if this mint is trusted by config + * @param mh NULL if exchange was not found to be acceptable + * @param exchange_trusted #GNUNET_YES if this exchange is trusted by config */ static void -process_pay_with_mint (void *cls, - struct TALER_MINT_Handle *mh, - int mint_trusted) +process_pay_with_exchange (void *cls, + struct TALER_EXCHANGE_Handle *mh, + int exchange_trusted) { struct PayContext *pc = cls; struct TALER_Amount acc_fee; struct TALER_Amount acc_amount; - const struct TALER_MINT_Keys *keys; + const struct TALER_EXCHANGE_Keys *keys; unsigned int i; pc->fo = NULL; if (NULL == mh) { - /* The mint on offer is not in the set of our (trusted) - mints. Reject the payment. */ + /* The exchange on offer is not in the set of our (trusted) + exchanges. Reject the payment. */ GNUNET_break_op (0); resume_pay_with_response (pc, MHD_HTTP_PRECONDITION_FAILED, - TMH_RESPONSE_make_external_error ("mint not supported")); + TMH_RESPONSE_make_external_error ("exchange not supported")); return; } pc->mh = mh; - keys = TALER_MINT_get_keys (mh); + keys = TALER_EXCHANGE_get_keys (mh); if (NULL == keys) { GNUNET_break (0); @@ -415,9 +415,9 @@ process_pay_with_mint (void *cls, for (i=0;i<pc->coins_cnt;i++) { struct MERCHANT_DepositConfirmation *dc = &pc->dc[i]; - const struct TALER_MINT_DenomPublicKey *denom_details; + const struct TALER_EXCHANGE_DenomPublicKey *denom_details; - denom_details = TALER_MINT_get_denomination_key (keys, + denom_details = TALER_EXCHANGE_get_denomination_key (keys, &dc->denom); if (NULL == denom_details) { @@ -425,14 +425,14 @@ process_pay_with_mint (void *cls, resume_pay_with_response (pc, MHD_HTTP_BAD_REQUEST, TMH_RESPONSE_make_json_pack ("{s:s, s:o}", - "hint", "unknown denom to mint", + "hint", "unknown denom to exchange", "denom_pub", TALER_json_from_rsa_public_key (dc->denom.rsa_public_key))); return; } if (GNUNET_OK != TMH_AUDITORS_check_dk (mh, denom_details, - mint_trusted)) + exchange_trusted)) { GNUNET_break_op (0); resume_pay_with_response (pc, @@ -515,7 +515,7 @@ process_pay_with_mint (void *cls, GNUNET_break_op (0); resume_pay_with_response (pc, MHD_HTTP_NOT_ACCEPTABLE, - TMH_RESPONSE_make_external_error ("insufficient funds (including excessive mint fees to be covered by customer)")); + TMH_RESPONSE_make_external_error ("insufficient funds (including excessive exchange fees to be covered by customer)")); return; } } @@ -538,7 +538,7 @@ process_pay_with_mint (void *cls, { struct MERCHANT_DepositConfirmation *dc = &pc->dc[i]; - dc->dh = TALER_MINT_deposit (mh, + dc->dh = TALER_EXCHANGE_deposit (mh, &dc->percoin_amount, pc->edate, j_wire, @@ -555,7 +555,7 @@ process_pay_with_mint (void *cls, dc); if (NULL == dc->dh) { - /* Signature was invalid. If the mint was unavailable, + /* Signature was invalid. If the exchange was unavailable, * we'd get that information in the callback. */ GNUNET_break_op (0); resume_pay_with_response (pc, @@ -647,7 +647,7 @@ MH_handler_pay (struct TMH_RequestHandler *rh, TMH_PARSE_member_fixed ("H_contract", &pc->h_contract), TMH_PARSE_member_amount ("max_fee", &pc->max_fee), TMH_PARSE_member_fixed ("merchant_sig", &merchant_sig), - TMH_PARSE_member_string ("mint", &pc->chosen_mint), + TMH_PARSE_member_string ("exchange", &pc->chosen_exchange), TMH_PARSE_member_time_abs ("refund_deadline", &pc->refund_deadline), TMH_PARSE_member_time_abs ("timestamp", &pc->timestamp), TMH_PARSE_member_uint64 ("transaction_id", &pc->transaction_id), @@ -788,13 +788,13 @@ MH_handler_pay (struct TMH_RequestHandler *rh, } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Looking up chosen mint '%s'\n", - pc->chosen_mint); + "Looking up chosen exchange '%s'\n", + pc->chosen_exchange); - /* Find the responsible mint, this may take a while... */ + /* Find the responsible exchange, this may take a while... */ pc->pending = pc->coins_cnt; - pc->fo = TMH_MINTS_find_mint (pc->chosen_mint, - &process_pay_with_mint, + pc->fo = TMH_EXCHANGES_find_exchange (pc->chosen_exchange, + &process_pay_with_exchange, pc); /* ... so we suspend connection until the last coin has been ack'd diff --git a/src/backend/taler-merchant-httpd_pay.h b/src/backend/taler-merchant-httpd_pay.h index 6c2efc11..92767520 100644 --- a/src/backend/taler-merchant-httpd_pay.h +++ b/src/backend/taler-merchant-httpd_pay.h @@ -18,8 +18,8 @@ * @brief headers for /pay handler * @author Marcello Stanisci */ -#ifndef TALER_MINT_HTTPD_PAY_H -#define TALER_MINT_HTTPD_PAY_H +#ifndef TALER_EXCHANGE_HTTPD_PAY_H +#define TALER_EXCHANGE_HTTPD_PAY_H #include <microhttpd.h> #include "taler-merchant-httpd.h" diff --git a/src/backend/taler-merchant-httpd_responses.c b/src/backend/taler-merchant-httpd_responses.c index d8ba1170..dfb4fccc 100644 --- a/src/backend/taler-merchant-httpd_responses.c +++ b/src/backend/taler-merchant-httpd_responses.c @@ -15,7 +15,7 @@ */ /** * @file taler-merchant-httpd_responses.c - * @brief API for generating the various replies of the mint; these + * @brief API for generating the various replies of the exchange; these * functions are called TMH_RESPONSE_reply_ and they generate * and queue MHD response objects for a given connection. * @author Florian Dold @@ -244,12 +244,12 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection) void TMH_RESPONSE_add_global_headers (struct MHD_Response *response) { - int TMH_mint_connection_close; - TMH_mint_connection_close = 0; + int TMH_exchange_connection_close; + TMH_exchange_connection_close = 0; - /* this test is taken verbatim from the mint's code, + /* this test is taken verbatim from the exchange's code, so there is no particular need to do that for a merchant */ - if (TMH_mint_connection_close) + if (TMH_exchange_connection_close) (void) MHD_add_response_header (response, MHD_HTTP_HEADER_CONNECTION, "close"); @@ -290,4 +290,4 @@ TMH_RESPONSE_make_external_error (const char *hint) } -/* end of taler-mint-httpd_responses.c */ +/* end of taler-exchange-httpd_responses.c */ diff --git a/src/backend/taler-merchant-httpd_responses.h b/src/backend/taler-merchant-httpd_responses.h index 7240d601..abf90949 100644 --- a/src/backend/taler-merchant-httpd_responses.h +++ b/src/backend/taler-merchant-httpd_responses.h @@ -16,15 +16,15 @@ /** * @file taler-merchant-httpd_responses.h - * @brief API for generating the various replies of the mint; these + * @brief API for generating the various replies of the exchange; these * functions are called TMH_RESPONSE_reply_ and they generate * and queue MHD response objects for a given connection. * @author Florian Dold * @author Benedikt Mueller * @author Christian Grothoff */ -#ifndef TALER_MINT_HTTPD_RESPONSES_H -#define TALER_MINT_HTTPD_RESPONSES_H +#ifndef TALER_EXCHANGE_HTTPD_RESPONSES_H +#define TALER_EXCHANGE_HTTPD_RESPONSES_H #include <gnunet/gnunet_util_lib.h> #include <jansson.h> #include <microhttpd.h> diff --git a/src/backend/taler-merchant-httpd_util.c b/src/backend/taler-merchant-httpd_util.c index 4c28290e..4fa6ab82 100644 --- a/src/backend/taler-merchant-httpd_util.c +++ b/src/backend/taler-merchant-httpd_util.c @@ -24,7 +24,7 @@ #include "taler-merchant-httpd.h" #include "taler-merchant-httpd_parsing.h" #include "taler-merchant-httpd_auditors.h" -#include "taler-merchant-httpd_mints.h" +#include "taler-merchant-httpd_exchanges.h" #include "taler-merchant-httpd_responses.h" diff --git a/src/backend/taler-merchant-httpd_util.h b/src/backend/taler-merchant-httpd_util.h index ea6d3f09..cbf4693a 100644 --- a/src/backend/taler-merchant-httpd_util.h +++ b/src/backend/taler-merchant-httpd_util.h @@ -18,8 +18,8 @@ * @brief headers for /contract handler * @author Marcello Stanisci */ -#ifndef TALER_MINT_HTTPD_UTIL_H -#define TALER_MINT_HTTPD_UTIL_H +#ifndef TALER_EXCHANGE_HTTPD_UTIL_H +#define TALER_EXCHANGE_HTTPD_UTIL_H #include <microhttpd.h> #include "taler-merchant-httpd.h" |