diff options
40 files changed, 500 insertions, 500 deletions
diff --git a/bootstrap b/bootstrap index 4e7cc053..4e7cc053 100755..100644 --- a/bootstrap +++ b/bootstrap diff --git a/configure.ac b/configure.ac index d7ef722d..d1345029 100644 --- a/configure.ac +++ b/configure.ac @@ -60,16 +60,16 @@ AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue) # Check for Taler's libtalerpq libtalerpq=0 AC_MSG_CHECKING([for libtalerpq]) -AC_ARG_WITH(mint, - [AS_HELP_STRING([--with-mint=PFX], [base of Taler MINT installation])], - [AC_MSG_RESULT([given as $with_mint])], +AC_ARG_WITH(exchange, + [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], + [AC_MSG_RESULT([given as $with_exchange])], [AC_MSG_RESULT(not given) - with_mint=yes]) -AS_CASE([$with_mint], + with_exchange=yes]) +AS_CASE([$with_exchange], [yes], [], - [no], [AC_MSG_ERROR([--with-mint is required])], - [LDFLAGS="-L$with_mint/lib $LDFLAGS" - CPPFLAGS="-I$with_mint/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) + [no], [AC_MSG_ERROR([--with-exchange is required])], + [LDFLAGS="-L$with_exchange/lib $LDFLAGS" + CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" LDFLAGS="$LDFLAGS -L/usr/local/lib" diff --git a/examples/shop/README b/examples/shop/README index 8cfb490f..be7d75fa 100644 --- a/examples/shop/README +++ b/examples/shop/README @@ -9,7 +9,7 @@ o index.html | The homepage. Here it is possible to decide how much donate to whom you would like. o fake_wire_transfer.php | PHP script that takes the wire transfer request and passes it on - | to the /admin/add/incoming API of the demo-mint. + | to the /admin/add/incoming API of the demo-exchange. o checkout.php | The "payment selection" that is the form that allows the user to choose the payment method he wishes to use. diff --git a/examples/shop/index.php b/examples/shop/index.php index 9bce9e5d..032681e0 100644 --- a/examples/shop/index.php +++ b/examples/shop/index.php @@ -64,8 +64,8 @@ echo "\tvar shop_currency = '$MERCHANT_CURRENCY';\n"; <br> This page, <tt>shop.demo.taler.net</tt> models the behavior of a typical Web shop supporting Taler. The other pages of the demo, - <tt>mint.demo.taler.net</tt> and - <tt>bank.demo.taler.net</tt>, correspond to a Taler mint + <tt>exchange.demo.taler.net</tt> and + <tt>bank.demo.taler.net</tt>, correspond to a Taler exchange and bank with tight Taler integration respectively. You may also enjoy visiting the <tt>blog.demo.taler.net</tt>. </p> 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" diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index b5bb985f..c9e504fa 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -77,7 +77,7 @@ postgres_initialize (void *cls, "amount_without_fee_frac INT4 NOT NULL," "amount_without_fee_curr VARCHAR(" TALER_CURRENCY_LEN_STR ") NOT NULL," "coin_pub BYTEA NOT NULL," - "mint_proof BYTEA NOT NULL);", + "exchange_proof BYTEA NOT NULL);", tmp_str); ret = GNUNET_POSTGRES_exec (pg->conn, sql); @@ -96,7 +96,7 @@ postgres_initialize (void *cls, ",amount_without_fee_frac" ",amount_without_fee_curr" ",coin_pub" - ",mint_proof) VALUES " + ",exchange_proof) VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", 10, NULL))) || (PGRES_COMMAND_OK != (status = PQresultStatus(res))) ) @@ -130,7 +130,7 @@ postgres_initialize (void *cls, /** - * Insert payment confirmation from the mint into the database. + * Insert payment confirmation from the exchange into the database. * * @param cls our plugin handle * @param h_contract hash of the contract @@ -138,9 +138,9 @@ postgres_initialize (void *cls, * @param transaction_id of the contract * @param timestamp time of the confirmation * @param refund refund deadline - * @param amount_without_fee amount the mint will deposit + * @param amount_without_fee amount the exchange will deposit * @param coin_pub public key of the coin - * @param mint_proof proof from the mint that coin was accepted + * @param exchange_proof proof from the exchange that coin was accepted * @return #GNUNET_OK on success, #GNUNET_SYSERR upon error */ static int @@ -152,7 +152,7 @@ postgres_store_payment (void *cls, struct GNUNET_TIME_Absolute refund, const struct TALER_Amount *amount_without_fee, const struct TALER_CoinSpendPublicKeyP *coin_pub, - json_t *mint_proof) + json_t *exchange_proof) { struct PostgresClosure *pg = cls; PGresult *res; @@ -166,7 +166,7 @@ postgres_store_payment (void *cls, GNUNET_PQ_query_param_absolute_time (&refund), TALER_PQ_query_param_amount (amount_without_fee), GNUNET_PQ_query_param_auto_from_type (coin_pub), - TALER_PQ_query_param_json (mint_proof), + TALER_PQ_query_param_json (exchange_proof), GNUNET_PQ_query_param_end }; diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index a10c2518..e3b26ee8 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -146,7 +146,7 @@ struct TALER_MERCHANT_PayCoin struct TALER_DenominationPublicKey denom_pub; /** - * Mint’s unblinded signature of the coin + * Exchange’s unblinded signature of the coin */ struct TALER_DenominationSignature denom_sig; @@ -181,7 +181,7 @@ struct TALER_MERCHANT_PayCoin * @param merchant_sig signature from the merchant over the original contract * @param timestamp timestamp when the contract was finalized, must match approximately the current time of the merchant * @param refund_deadline date until which the merchant can issue a refund to the customer via the merchant (can be zero if refunds are not allowed) - * @param mint_uri URI of the mint that the coins belong to + * @param exchange_uri URI of the exchange that the coins belong to * @param num_coins number of coins used to pay * @param coins array of coins we use to pay * @param coin_sig the signature made with purpose #TALER_SIGNATURE_WALLET_COIN_DEPOSIT made by the customer with the coin’s private key. @@ -201,7 +201,7 @@ TALER_MERCHANT_pay_wallet (struct TALER_MERCHANT_Context *merchant, struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute refund_deadline, const struct GNUNET_HashCode *h_wire, - const char *mint_uri, + const char *exchange_uri, unsigned int num_coins, const struct TALER_MERCHANT_PayCoin *coins, TALER_MERCHANT_PayCallback pay_cb, @@ -220,7 +220,7 @@ struct TALER_MERCHANT_PaidCoin struct TALER_DenominationPublicKey denom_pub; /** - * Mint’s unblinded signature of the coin + * Exchange’s unblinded signature of the coin */ struct TALER_DenominationSignature denom_sig; @@ -263,9 +263,9 @@ struct TALER_MERCHANT_PaidCoin * @param merchant_sig the signature of the merchant over the original contract * @param refund_deadline date until which the merchant can issue a refund to the customer via the merchant (can be zero if refunds are not allowed) * @param timestamp timestamp when the contract was finalized, must match approximately the current time of the merchant - * @param execution_deadline date by which the merchant would like the mint to execute the transaction (can be zero if there is no specific date desired by the frontend) + * @param execution_deadline date by which the merchant would like the exchange to execute the transaction (can be zero if there is no specific date desired by the frontend) * @param h_wire hash of the merchant’s account details - * @param mint_uri URI of the mint that the coins belong to + * @param exchange_uri URI of the exchange that the coins belong to * @param num_coins number of coins used to pay * @param coins array of coins we use to pay * @param coin_sig the signature made with purpose #TALER_SIGNATURE_WALLET_COIN_DEPOSIT made by the customer with the coin’s private key. @@ -286,7 +286,7 @@ TALER_MERCHANT_pay_frontend (struct TALER_MERCHANT_Context *merchant, struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute execution_deadline, const struct GNUNET_HashCode *h_wire, - const char *mint_uri, + const char *exchange_uri, unsigned int num_coins, const struct TALER_MERCHANT_PaidCoin *coins, TALER_MERCHANT_PayCallback pay_cb, diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index e7f965bb..959b2a2c 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -59,7 +59,7 @@ struct TALER_MERCHANTDB_Plugin int tmp); /** - * Insert payment confirmation from the mint into the database. + * Insert payment confirmation from the exchange into the database. * * @param cls closure * @param h_contract hash of the contract @@ -67,9 +67,9 @@ struct TALER_MERCHANTDB_Plugin * @param transaction_id of the contract * @param timestamp time of the confirmation * @param refund refund deadline - * @param amount_without_fee amount the mint will deposit + * @param amount_without_fee amount the exchange will deposit * @param coin_pub public key of the coin - * @param mint_proof proof from mint that coin was accepted + * @param exchange_proof proof from exchange that coin was accepted * @return #GNUNET_OK on success, #GNUNET_SYSERR upon error */ int @@ -81,7 +81,7 @@ struct TALER_MERCHANTDB_Plugin struct GNUNET_TIME_Absolute refund, const struct TALER_Amount *amount_without_fee, const struct TALER_CoinSpendPublicKeyP *coin_pub, - json_t *mint_proof); + json_t *exchange_proof); /** * Check whether a payment has already been stored diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index e43630de..81ad63fe 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -42,7 +42,7 @@ test_merchant_api_SOURCES = \ test_merchant_api_LDADD = \ libtalermerchant.la \ $(LIBGCRYPT_LIBS) \ - -ltalermint \ + -ltalerexchange \ -ltalerutil \ -lgnunetutil \ -ljansson diff --git a/src/lib/merchant_api_pay.c b/src/lib/merchant_api_pay.c index 8ee4686b..5b57cbe1 100644 --- a/src/lib/merchant_api_pay.c +++ b/src/lib/merchant_api_pay.c @@ -141,7 +141,7 @@ handle_pay_finished (void *cls, * Pay a merchant. API for wallets that have the coin's private keys. * * @param merchant the merchant context - * @param mint_uri URI of the mint that the coins belong to + * @param exchange_uri URI of the exchange that the coins belong to * @param h_wire hash of the merchant’s account details * @param h_contract hash of the contact of the merchant with the customer * @param timestamp timestamp when the contract was finalized, must match approximately the current time of the merchant @@ -160,7 +160,7 @@ handle_pay_finished (void *cls, struct TALER_MERCHANT_Pay * TALER_MERCHANT_pay_wallet (struct TALER_MERCHANT_Context *merchant, const char *merchant_uri, - const char *mint_uri, + const char *exchange_uri, const struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_contract, struct GNUNET_TIME_Absolute timestamp, @@ -220,7 +220,7 @@ TALER_MERCHANT_pay_wallet (struct TALER_MERCHANT_Context *merchant, } return TALER_MERCHANT_pay_frontend (merchant, merchant_uri, - mint_uri, + exchange_uri, h_wire, h_contract, timestamp, @@ -244,14 +244,14 @@ TALER_MERCHANT_pay_wallet (struct TALER_MERCHANT_Context *merchant, * in the type of @a coins compared to #TALER_MERCHANT_pay(). * * @param merchant the merchant context - * @param mint_uri URI of the mint that the coins belong to + * @param exchange_uri URI of the exchange that the coins belong to * @param h_wire hash of the merchant’s account details * @param h_contract hash of the contact of the merchant with the customer * @param timestamp timestamp when the contract was finalized, must match approximately the current time of the merchant * @param transaction_id transaction id for the transaction between merchant and customer * @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests) * @param refund_deadline date until which the merchant can issue a refund to the customer via the merchant (can be zero if refunds are not allowed) - * @param execution_deadline date by which the merchant would like the mint to execute the transaction (can be zero if there is no specific date desired by the frontend) + * @param execution_deadline date by which the merchant would like the exchange to execute the transaction (can be zero if there is no specific date desired by the frontend) * @param num_coins number of coins used to pay * @param coins array of coins we use to pay * @param coin_sig the signature made with purpose #TALER_SIGNATURE_WALLET_COIN_DEPOSIT made by the customer with the coin’s private key. @@ -264,7 +264,7 @@ TALER_MERCHANT_pay_wallet (struct TALER_MERCHANT_Context *merchant, struct TALER_MERCHANT_Pay * TALER_MERCHANT_pay_frontend (struct TALER_MERCHANT_Context *merchant, const char *merchant_uri, - const char *mint_uri, + const char *exchange_uri, const struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_contract, struct GNUNET_TIME_Absolute timestamp, @@ -402,7 +402,7 @@ TALER_MERCHANT_pay_frontend (struct TALER_MERCHANT_Context *merchant, } /* end of sanity check */ pay_obj = json_pack ("{s:o, s:o," /* H_wire/H_contract */ " s:I, s:o," /* transaction id, timestamp */ - " s:o, s:s," /* refund_deadline, mint */ + " s:o, s:s," /* refund_deadline, exchange */ " s:o, s:o," /* coins, max_fee */ " s:o}", /* amount */ "H_wire", TALER_json_from_data (&h_wire, @@ -412,7 +412,7 @@ TALER_MERCHANT_pay_frontend (struct TALER_MERCHANT_Context *merchant, "transaction_id", (json_int_t) transaction_id, "timestamp", TALER_json_from_abs (timestamp), "refund_deadline", TALER_json_from_abs (refund_deadline), - "mint", mint_uri, + "exchange", exchange_uri, "coins", j_coins, "max_fee", TALER_json_from_amount (max_fee), "amount", TALER_json_from_amount (amount) diff --git a/src/lib/test-mint-home/config/mint-common.conf b/src/lib/test-mint-home/config/mint-common.conf index b2b94826..01dd6c89 100644 --- a/src/lib/test-mint-home/config/mint-common.conf +++ b/src/lib/test-mint-home/config/mint-common.conf @@ -1,16 +1,16 @@ -[mint] -# Currency supported by the mint (can only be one) +[exchange] +# Currency supported by the exchange (can only be one) CURRENCY = EUR -# Wire format supported by the mint +# Wire format supported by the exchange # We use 'test' for testing of the actual # coin operations, and 'sepa' to test SEPA-specific routines. WIREFORMAT = test sepa -# HTTP port the mint listens to +# HTTP port the exchange listens to PORT = 8081 -# Master public key used to sign the mint's various keys +# Master public key used to sign the exchange's various keys MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG # How to access our database @@ -19,12 +19,12 @@ DB = postgres # Is this is a testcase, use transient DB actions? TESTRUN = YES -[mintdb-postgres] +[exchangedb-postgres] DB_CONN_STR = "postgres:///talercheck" -[mint-wire-sepa] -SEPA_RESPONSE_FILE = "test-mint-home/sepa.json" +[exchange-wire-sepa] +SEPA_RESPONSE_FILE = "test-exchange-home/sepa.json" -[mint-wire-test] +[exchange-wire-test] REDIRECT_URL = "http://www.taler.net/" diff --git a/src/lib/test-mint-home/config/mint-keyup.conf b/src/lib/test-mint-home/config/mint-keyup.conf index 8ad1f3bb..4a80da7e 100644 --- a/src/lib/test-mint-home/config/mint-keyup.conf +++ b/src/lib/test-mint-home/config/mint-keyup.conf @@ -1,4 +1,4 @@ -[mint_keys] +[exchange_keys] # how long is one signkey valid? signkey_duration = 4 weeks diff --git a/src/lib/test_merchant.conf b/src/lib/test_merchant.conf index 32744885..bf2335d8 100644 --- a/src/lib/test_merchant.conf +++ b/src/lib/test_merchant.conf @@ -14,9 +14,9 @@ KEYFILE = test_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,7 +24,7 @@ EDATE = 3 week # Which plugin (backend) do we use for the DB. DB = postgres -[mint-taler] +[exchange-taler] URI = http://localhost:8081/ MASTER_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c index dc19e3f7..ef1746d6 100644 --- a/src/lib/test_merchant_api.c +++ b/src/lib/test_merchant_api.c @@ -21,7 +21,7 @@ #include "platform.h" #include <taler/taler_util.h> #include <taler/taler_signatures.h> -#include <taler/taler_mint_service.h> +#include <taler/taler_exchange_service.h> #include "taler_merchant_service.h" #include <gnunet/gnunet_util_lib.h> #include <microhttpd.h> @@ -32,22 +32,22 @@ #define MERCHANT_URI "http://localhost:8082/" /** - * URI under which the mint is reachable during the testcase. + * URI under which the exchange is reachable during the testcase. */ -#define MINT_URI "http://localhost:8081/" +#define EXCHANGE_URI "http://localhost:8081/" /** - * Main execution context for the main loop of the mint. + * Main execution context for the main loop of the exchange. */ -static struct TALER_MINT_Context *ctx; +static struct TALER_EXCHANGE_Context *ctx; /** - * Handle to access the mint. + * Handle to access the exchange. */ -static struct TALER_MINT_Handle *mint; +static struct TALER_EXCHANGE_Handle *exchange; /** - * Main execution context for the main loop of the mint. + * Main execution context for the main loop of the exchange. */ static struct TALER_MERCHANT_Context *merchant; @@ -139,10 +139,10 @@ struct FreshCoin * use. Otherwise, this will be set (by the interpreter) to the * denomination PK matching @e amount. */ - const struct TALER_MINT_DenomPublicKey *pk; + const struct TALER_EXCHANGE_DenomPublicKey *pk; /** - * Set (by the interpreter) to the mint's signature over the + * Set (by the interpreter) to the exchange's signature over the * coin's public key. */ struct TALER_DenominationSignature sig; @@ -156,7 +156,7 @@ struct FreshCoin /** - * Details for a mint operation to execute. + * Details for a exchange operation to execute. */ struct Command { @@ -213,7 +213,7 @@ struct Command /** * Set to the API's handle during the operation. */ - struct TALER_MINT_AdminAddIncomingHandle *aih; + struct TALER_EXCHANGE_AdminAddIncomingHandle *aih; } admin_add_incoming; @@ -232,7 +232,7 @@ struct Command /** * Set to the API's handle during the operation. */ - struct TALER_MINT_ReserveStatusHandle *wsh; + struct TALER_EXCHANGE_ReserveStatusHandle *wsh; /** * Expected reserve balance. @@ -254,7 +254,7 @@ struct Command /** * String describing the denomination value we should withdraw. - * A corresponding denomination key must exist in the mint's + * A corresponding denomination key must exist in the exchange's * offerings. Can be NULL if @e pk is set instead. */ const char *amount; @@ -264,10 +264,10 @@ struct Command * use. Otherwise, this will be set (by the interpreter) to the * denomination PK matching @e amount. */ - const struct TALER_MINT_DenomPublicKey *pk; + const struct TALER_EXCHANGE_DenomPublicKey *pk; /** - * Set (by the interpreter) to the mint's signature over the + * Set (by the interpreter) to the exchange's signature over the * coin's public key. */ struct TALER_DenominationSignature sig; @@ -285,7 +285,7 @@ struct Command /** * Withdraw handle (while operation is running). */ - struct TALER_MINT_ReserveWithdrawHandle *wsh; + struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh; } reserve_withdraw; @@ -371,9 +371,9 @@ struct Command struct InterpreterState { /** - * Keys from the mint. + * Keys from the exchange. */ - const struct TALER_MINT_Keys *keys; + const struct TALER_EXCHANGE_Keys *keys; /** * Commands the interpreter will run. @@ -463,7 +463,7 @@ find_command (const struct InterpreterState *is, /** - * Run the main interpreter loop that performs mint operations. + * Run the main interpreter loop that performs exchange operations. * * @param cls contains the `struct InterpreterState` * @param tc scheduler context @@ -478,8 +478,8 @@ interpreter_run (void *cls, * * @param cls closure with the interpreter state * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request - * 0 if the mint's reply is bogus (fails to follow the protocol) - * @param full_response full response from the mint (for logging, in case of errors) + * 0 if the exchange's reply is bogus (fails to follow the protocol) + * @param full_response full response from the exchange (for logging, in case of errors) */ static void add_incoming_cb (void *cls, @@ -511,12 +511,12 @@ add_incoming_cb (void *cls, * @return #GNUNET_OK if they match, #GNUNET_SYSERR if not */ static int -compare_admin_add_incoming_history (const struct TALER_MINT_ReserveHistory *h, +compare_admin_add_incoming_history (const struct TALER_EXCHANGE_ReserveHistory *h, const struct Command *cmd) { struct TALER_Amount amount; - if (TALER_MINT_RTT_DEPOSIT != h->type) + if (TALER_EXCHANGE_RTT_DEPOSIT != h->type) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -543,13 +543,13 @@ compare_admin_add_incoming_history (const struct TALER_MINT_ReserveHistory *h, * @return #GNUNET_OK if they match, #GNUNET_SYSERR if not */ static int -compare_reserve_withdraw_history (const struct TALER_MINT_ReserveHistory *h, +compare_reserve_withdraw_history (const struct TALER_EXCHANGE_ReserveHistory *h, const struct Command *cmd) { struct TALER_Amount amount; struct TALER_Amount amount_with_fee; - if (TALER_MINT_RTT_WITHDRAWAL != h->type) + if (TALER_EXCHANGE_RTT_WITHDRAWAL != h->type) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -576,7 +576,7 @@ compare_reserve_withdraw_history (const struct TALER_MINT_ReserveHistory *h, * * @param cls closure with the interpreter state * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request - * 0 if the mint's reply is bogus (fails to follow the protocol) + * 0 if the exchange's reply is bogus (fails to follow the protocol) * @param[in] json original response in JSON format (useful only for diagnostics) * @param balance current balance in the reserve, NULL on error * @param history_length number of entries in the transaction history, 0 on error @@ -588,7 +588,7 @@ reserve_status_cb (void *cls, json_t *json, const struct TALER_Amount *balance, unsigned int history_length, - const struct TALER_MINT_ReserveHistory *history) + const struct TALER_EXCHANGE_ReserveHistory *history) { struct InterpreterState *is = cls; struct Command *cmd = &is->commands[is->ip]; @@ -692,9 +692,9 @@ reserve_status_cb (void *cls, * * @param cls closure with the interpreter state * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request - * 0 if the mint's reply is bogus (fails to follow the protocol) + * 0 if the exchange's reply is bogus (fails to follow the protocol) * @param sig signature over the coin, NULL on error - * @param full_response full response from the mint (for logging, in case of errors) + * @param full_response full response from the exchange (for logging, in case of errors) */ static void reserve_withdraw_cb (void *cls, @@ -748,7 +748,7 @@ reserve_withdraw_cb (void *cls, * * @param cls closure with the interpreter state * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit; - * 0 if the mint's reply is bogus (fails to follow the protocol) + * 0 if the exchange's reply is bogus (fails to follow the protocol) * @param obj the received JSON reply, should be kept as proof (and, in case of errors, * be forwarded to the customer) */ @@ -785,13 +785,13 @@ pay_cb (void *cls, * @param amount coin value to look for * @return NULL if no matching key was found */ -static const struct TALER_MINT_DenomPublicKey * -find_pk (const struct TALER_MINT_Keys *keys, +static const struct TALER_EXCHANGE_DenomPublicKey * +find_pk (const struct TALER_EXCHANGE_Keys *keys, const struct TALER_Amount *amount) { unsigned int i; struct GNUNET_TIME_Absolute now; - struct TALER_MINT_DenomPublicKey *pk; + struct TALER_EXCHANGE_DenomPublicKey *pk; char *str; now = GNUNET_TIME_absolute_get (); @@ -833,7 +833,7 @@ find_pk (const struct TALER_MINT_Keys *keys, /** - * Run the main interpreter loop that performs mint operations. + * Run the main interpreter loop that performs exchange operations. * * @param cls contains the `struct InterpreterState` * @param tc scheduler context @@ -917,7 +917,7 @@ interpreter_run (void *cls, execution_date = GNUNET_TIME_absolute_get (); TALER_round_abs_time (&execution_date); cmd->details.admin_add_incoming.aih - = TALER_MINT_admin_add_incoming (mint, + = TALER_EXCHANGE_admin_add_incoming (exchange, &reserve_pub, &amount, execution_date, @@ -942,7 +942,7 @@ interpreter_run (void *cls, GNUNET_CRYPTO_eddsa_key_get_public (&ref->details.admin_add_incoming.reserve_priv.eddsa_priv, &reserve_pub.eddsa_pub); cmd->details.reserve_status.wsh - = TALER_MINT_reserve_status (mint, + = TALER_EXCHANGE_reserve_status (exchange, &reserve_pub, &reserve_status_cb, is); @@ -993,7 +993,7 @@ interpreter_run (void *cls, cmd->details.reserve_withdraw.blinding_key.rsa_blinding_key = GNUNET_CRYPTO_rsa_blinding_key_create (GNUNET_CRYPTO_rsa_public_key_len (cmd->details.reserve_withdraw.pk->key.rsa_public_key)); cmd->details.reserve_withdraw.wsh - = TALER_MINT_reserve_withdraw (mint, + = TALER_EXCHANGE_reserve_withdraw (exchange, cmd->details.reserve_withdraw.pk, &ref->details.admin_add_incoming.reserve_priv, &cmd->details.reserve_withdraw.coin_priv, @@ -1134,7 +1134,7 @@ interpreter_run (void *cls, cmd->details.pay.ph = TALER_MERCHANT_pay_wallet (merchant, MERCHANT_URI "pay", - MINT_URI, + EXCHANGE_URI, &h_wire, &h_contract, timestamp, @@ -1202,7 +1202,7 @@ do_shutdown (void *cls, "Command %u (%s) did not complete\n", i, cmd->label); - TALER_MINT_admin_add_incoming_cancel (cmd->details.admin_add_incoming.aih); + TALER_EXCHANGE_admin_add_incoming_cancel (cmd->details.admin_add_incoming.aih); cmd->details.admin_add_incoming.aih = NULL; } break; @@ -1213,7 +1213,7 @@ do_shutdown (void *cls, "Command %u (%s) did not complete\n", i, cmd->label); - TALER_MINT_reserve_status_cancel (cmd->details.reserve_status.wsh); + TALER_EXCHANGE_reserve_status_cancel (cmd->details.reserve_status.wsh); cmd->details.reserve_status.wsh = NULL; } break; @@ -1224,7 +1224,7 @@ do_shutdown (void *cls, "Command %u (%s) did not complete\n", i, cmd->label); - TALER_MINT_reserve_withdraw_cancel (cmd->details.reserve_withdraw.wsh); + TALER_EXCHANGE_reserve_withdraw_cancel (cmd->details.reserve_withdraw.wsh); cmd->details.reserve_withdraw.wsh = NULL; } if (NULL != cmd->details.reserve_withdraw.sig.rsa_signature) @@ -1269,10 +1269,10 @@ do_shutdown (void *cls, GNUNET_SCHEDULER_cancel (ctx_task); ctx_task = NULL; } - if (NULL != mint) + if (NULL != exchange) { - TALER_MINT_disconnect (mint); - mint = NULL; + TALER_EXCHANGE_disconnect (exchange); + exchange = NULL; } if (NULL != merchant) { @@ -1281,7 +1281,7 @@ do_shutdown (void *cls, } if (NULL != ctx) { - TALER_MINT_fini (ctx); + TALER_EXCHANGE_fini (ctx); ctx = NULL; } } @@ -1289,15 +1289,15 @@ do_shutdown (void *cls, /** * Functions of this type are called to provide the retrieved signing and - * denomination keys of the mint. No TALER_MINT_*() functions should be called + * denomination keys of the exchange. No TALER_EXCHANGE_*() functions should be called * in this callback. * * @param cls closure - * @param keys information about keys of the mint + * @param keys information about keys of the exchange */ static void cert_cb (void *cls, - const struct TALER_MINT_Keys *keys) + const struct TALER_EXCHANGE_Keys *keys) { struct InterpreterState *is = cls; @@ -1345,14 +1345,14 @@ context_task (void *cls, ctx_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Event loop running\n"); - TALER_MINT_perform (ctx); + TALER_EXCHANGE_perform (ctx); TALER_MERCHANT_perform (merchant); 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, @@ -1482,17 +1482,17 @@ run (void *cls, is = GNUNET_new (struct InterpreterState); is->commands = commands; - ctx = TALER_MINT_init (); + ctx = TALER_EXCHANGE_init (); GNUNET_assert (NULL != ctx); merchant = TALER_MERCHANT_init (); GNUNET_assert (NULL != merchant); ctx_task = GNUNET_SCHEDULER_add_now (&context_task, ctx); - mint = TALER_MINT_connect (ctx, - MINT_URI, + exchange = TALER_EXCHANGE_connect (ctx, + EXCHANGE_URI, &cert_cb, is, - TALER_MINT_OPTION_END); - GNUNET_assert (NULL != mint); + TALER_EXCHANGE_OPTION_END); + GNUNET_assert (NULL != exchange); shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 150), @@ -1501,7 +1501,7 @@ run (void *cls, /** - * Main function for the testcase for the mint API. + * Main function for the testcase for the exchange API. * * @param argc expected to be 1 * @param argv expected to only contain the program name @@ -1514,7 +1514,7 @@ main (int argc, const char *merchant_pub_str = "5TRNSWAWHKBJ7G4T3PKRCQA6MCB3MX82F4M2XXS1653KE1V8RFPG"; struct GNUNET_OS_Process *proc; - struct GNUNET_OS_Process *mintd; + struct GNUNET_OS_Process *exchanged; struct GNUNET_OS_Process *merchantd; GNUNET_log_setup ("test-merchant-api", @@ -1528,28 +1528,28 @@ main (int argc, proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, NULL, NULL, - "taler-mint-keyup", - "taler-mint-keyup", - "-d", "test-mint-home", - "-m", "test-mint-home/master.priv", + "taler-exchange-keyup", + "taler-exchange-keyup", + "-d", "test-exchange-home", + "-m", "test-exchange-home/master.priv", NULL); GNUNET_OS_process_wait (proc); GNUNET_OS_process_destroy (proc); - mintd = GNUNET_OS_start_process (GNUNET_NO, + exchanged = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, NULL, NULL, - "taler-mint-httpd", - "taler-mint-httpd", - "-d", "test-mint-home", + "taler-exchange-httpd", + "taler-exchange-httpd", + "-d", "test-exchange-home", NULL); /* give child time to start and bind against the socket */ - fprintf (stderr, "Waiting for taler-mint-httpd to be ready"); + fprintf (stderr, "Waiting for taler-exchange-httpd to be ready"); do { fprintf (stderr, "."); sleep (1); } - while (0 != system ("wget -q -t 1 -T 1 " MINT_URI "keys -o /dev/null -O /dev/null")); + while (0 != system ("wget -q -t 1 -T 1 " EXCHANGE_URI "keys -o /dev/null -O /dev/null")); fprintf (stderr, "\n"); merchantd = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, @@ -1573,10 +1573,10 @@ main (int argc, SIGTERM); GNUNET_OS_process_wait (merchantd); GNUNET_OS_process_destroy (merchantd); - GNUNET_OS_process_kill (mintd, + GNUNET_OS_process_kill (exchanged, SIGTERM); - GNUNET_OS_process_wait (mintd); - GNUNET_OS_process_destroy (mintd); + GNUNET_OS_process_wait (exchanged); + GNUNET_OS_process_destroy (exchanged); return (GNUNET_OK == result) ? 0 : 1; } diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 30b1e04b..14285898 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -17,7 +17,7 @@ test_contract_LDADD = \ -ltalerutil \ -ljansson \ -lgnunetutil \ - -ltalermint \ + -ltalerexchange \ -ltalerpq \ -lgnunetpostgres \ -lpq \ diff --git a/src/tests/deposit_permission.sample b/src/tests/deposit_permission.sample index c1f2d704..668d0047 100644 --- a/src/tests/deposit_permission.sample +++ b/src/tests/deposit_permission.sample @@ -3,7 +3,7 @@ "timestamp": "\/Date(1447334003)\/", "H_wire": "V1F0F5AWSNX60E6TXZEYDZRE84J8HMBGXEM09AEVV3N97MM75P6JQRSWR5KQVC1RBBF2SRXY7P10H0ZM0VETWPFAJJRBVJSXNMDWTYR", "merchant_pub": "BQ0TMTBV2XEJ8G2PXA9KRDD5WDT5EV29KPVS6J9RBQJCS8BCPQ70", - "mint": "localmint", + "exchange": "localexchange", "coins": [ { "f": { diff --git a/src/tests/deposit_permission_backend.sample b/src/tests/deposit_permission_backend.sample index 3cd920ed..a2e60589 100644 --- a/src/tests/deposit_permission_backend.sample +++ b/src/tests/deposit_permission_backend.sample @@ -3,7 +3,7 @@ "timestamp": "\/Date(1447334003)\/", "H_wire": "V1F0F5AWSNX60E6TXZEYDZRE84J8HMBGXEM09AEVV3N97MM75P6JQRSWR5KQVC1RBBF2SRXY7P10H0ZM0VETWPFAJJRBVJSXNMDWTYR", "merchant_pub": "BQ0TMTBV2XEJ8G2PXA9KRDD5WDT5EV29KPVS6J9RBQJCS8BCPQ70", - "mint": "demo.taler.net", + "exchange": "demo.taler.net", "coins": [ { "f": { diff --git a/src/tests/deposit_permission_edate_backend.sample b/src/tests/deposit_permission_edate_backend.sample index 259a62bc..1b185b41 100644 --- a/src/tests/deposit_permission_edate_backend.sample +++ b/src/tests/deposit_permission_edate_backend.sample @@ -4,7 +4,7 @@ "edate": "\/Date(1447334003)\/", "H_wire": "V1F0F5AWSNX60E6TXZEYDZRE84J8HMBGXEM09AEVV3N97MM75P6JQRSWR5KQVC1RBBF2SRXY7P10H0ZM0VETWPFAJJRBVJSXNMDWTYR", "merchant_pub": "BQ0TMTBV2XEJ8G2PXA9KRDD5WDT5EV29KPVS6J9RBQJCS8BCPQ70", - "mint": "demo.taler.net", + "exchange": "demo.taler.net", "coins": [ { "f": { diff --git a/src/tests/merchant.conf b/src/tests/merchant.conf index 3b637448..c390b0ea 100644 --- a/src/tests/merchant.conf +++ b/src/tests/merchant.conf @@ -1,10 +1,10 @@ [merchant] PORT = 9966 HOSTNAME = localhost -TRUSTED_MINTS = taler +TRUSTED_EXCHANGES = taler KEYFILE = merchant.priv -[mint-taler] +[exchange-taler] HOSTNAME = demo.taler.net PORT = 80 PUBKEY = Q1WVGRGC1F4W7RYC6M23AEGFEXQEHQ730K3GG0B67VPHQSRR75H0 diff --git a/src/tests/test_contract.c b/src/tests/test_contract.c index 71a8968a..f48ed613 100644 --- a/src/tests/test_contract.c +++ b/src/tests/test_contract.c @@ -81,7 +81,7 @@ run (void *cls, char *const *args, const char *cfgfile, { json_t *j_fake_contract; json_t *j_details; - json_t *j_mints; + json_t *j_exchanges; json_t *j_item; json_t *j_amount; json_t *j_tax_amount; @@ -253,8 +253,8 @@ run (void *cls, char *const *args, const char *cfgfile, "merchant", j_merchant, "L-names", j_lnames); - /* Faking out the mints' list */ - j_mints = json_pack ("[{s:s}]", + /* Faking out the exchanges' list */ + j_exchanges = json_pack ("[{s:s}]", "demo.taler.net", "Q1WVGRGC1F4W7RYC6M23AEGFEXQEHQ730K3GG0B67VPHQSRR75H0"); @@ -262,7 +262,7 @@ run (void *cls, char *const *args, const char *cfgfile, "amount", j_amount, "max fee", j_max_fee, "trans_id", json_integer_value (j_id), - "mints", j_mints, + "exchanges", j_exchanges, "details", j_details); #if 0 str = json_dumps (j_fake_contract, JSON_INDENT(2) | JSON_PRESERVE_ORDER); |