diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-09-19 22:08:49 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-09-19 22:08:49 +0200 |
commit | 1eadd66ae0c4abe6867321bcac0ad2f9832a0baf (patch) | |
tree | 852f4e09401d0c6c39fab2c98be3663691f02aca /src/mint | |
parent | cc47c5c701340c9be0acc6b7394aa2afad0cd0d3 (diff) |
renaming /withdraw to /reserve (#3968)
Diffstat (limited to 'src/mint')
-rw-r--r-- | src/mint/Makefile.am | 2 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd.c | 14 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_db.c | 30 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_db.h | 20 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_keystate.h | 2 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_reserve.c (renamed from src/mint/taler-mint-httpd_withdraw.c) | 63 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_reserve.h (renamed from src/mint/taler-mint-httpd_withdraw.h) | 32 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_responses.c | 12 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_responses.h | 14 |
9 files changed, 97 insertions, 92 deletions
diff --git a/src/mint/Makefile.am b/src/mint/Makefile.am index 7d75f9b62..e5d0c656c 100644 --- a/src/mint/Makefile.am +++ b/src/mint/Makefile.am @@ -18,7 +18,7 @@ taler_mint_httpd_SOURCES = \ taler-mint-httpd_mhd.c taler-mint-httpd_mhd.h \ taler-mint-httpd_admin.c taler-mint-httpd_admin.h \ taler-mint-httpd_deposit.c taler-mint-httpd_deposit.h \ - taler-mint-httpd_withdraw.c taler-mint-httpd_withdraw.h \ + taler-mint-httpd_reserve.c taler-mint-httpd_reserve.h \ taler-mint-httpd_wire.c taler-mint-httpd_wire.h \ taler-mint-httpd_refresh.c taler-mint-httpd_refresh.h taler_mint_httpd_LDADD = \ diff --git a/src/mint/taler-mint-httpd.c b/src/mint/taler-mint-httpd.c index e68cd2425..cd2f62768 100644 --- a/src/mint/taler-mint-httpd.c +++ b/src/mint/taler-mint-httpd.c @@ -30,7 +30,7 @@ #include "taler-mint-httpd_mhd.h" #include "taler-mint-httpd_admin.h" #include "taler-mint-httpd_deposit.h" -#include "taler-mint-httpd_withdraw.h" +#include "taler-mint-httpd_reserve.h" #include "taler-mint-httpd_wire.h" #include "taler-mint-httpd_refresh.h" #include "taler-mint-httpd_keystate.h" @@ -190,17 +190,17 @@ handle_mhd_request (void *cls, &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, /* Withdrawing coins / interaction with reserves */ - { "/withdraw/status", MHD_HTTP_METHOD_GET, "application/json", + { "/reserve/status", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, - &TMH_WITHDRAW_handler_withdraw_status, MHD_HTTP_OK }, - { "/withdraw/status", NULL, "text/plain", + &TMH_RESERVE_handler_reserve_status, MHD_HTTP_OK }, + { "/reserve/status", NULL, "text/plain", "Only GET is allowed", 0, &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, - { "/withdraw/sign", MHD_HTTP_METHOD_POST, "application/json", + { "/reserve/withdraw", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, - &TMH_WITHDRAW_handler_withdraw_sign, MHD_HTTP_OK }, - { "/withdraw/sign", NULL, "text/plain", + &TMH_RESERVE_handler_reserve_withdraw, MHD_HTTP_OK }, + { "/reserve/withdraw", NULL, "text/plain", "Only POST is allowed", 0, &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c index 27031da21..021a3155d 100644 --- a/src/mint/taler-mint-httpd_db.c +++ b/src/mint/taler-mint-httpd_db.c @@ -203,7 +203,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, /** - * Execute a /withdraw/status. Given the public key of a reserve, + * Execute a /reserve/status. Given the public key of a reserve, * return the associated transaction history. * * @param connection the MHD connection to handle @@ -211,8 +211,8 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_withdraw_status (struct MHD_Connection *connection, - const struct TALER_ReservePublicKeyP *reserve_pub) +TMH_DB_execute_reserve_status (struct MHD_Connection *connection, + const struct TALER_ReservePublicKeyP *reserve_pub) { struct TALER_MINTDB_Session *session; struct TALER_MINTDB_ReserveHistory *rh; @@ -233,7 +233,7 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection, "{s:s, s:s}", "error", "Reserve not found", "parameter", "withdraw_pub"); - res = TMH_RESPONSE_reply_withdraw_status_success (connection, + res = TMH_RESPONSE_reply_reserve_status_success (connection, rh); TMH_plugin->free_reserve_history (TMH_plugin->cls, rh); @@ -242,7 +242,7 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection, /** - * Execute a "/withdraw/sign". Given a reserve and a properly signed + * Execute a "/reserve/withdraw". Given a reserve and a properly signed * request to withdraw a coin, check the balance of the reserve and * if it is sufficient, store the request and return the signed * blinded envelope. @@ -256,12 +256,12 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, - const struct TALER_ReservePublicKeyP *reserve, - const struct TALER_DenominationPublicKey *denomination_pub, - const char *blinded_msg, - size_t blinded_msg_len, - const struct TALER_ReserveSignatureP *signature) +TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, + const struct TALER_ReservePublicKeyP *reserve, + const struct TALER_DenominationPublicKey *denomination_pub, + const char *blinded_msg, + size_t blinded_msg_len, + const struct TALER_ReserveSignatureP *signature) { struct TALER_MINTDB_Session *session; struct TALER_MINTDB_ReserveHistory *rh; @@ -303,7 +303,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, /* Don't sign again if we have already signed the coin */ if (GNUNET_YES == res) { - res = TMH_RESPONSE_reply_withdraw_sign_success (connection, + res = TMH_RESPONSE_reply_reserve_withdraw_success (connection, &collectable); GNUNET_CRYPTO_rsa_signature_free (collectable.sig.rsa_signature); GNUNET_CRYPTO_rsa_public_key_free (collectable.denom_pub.rsa_public_key); @@ -431,7 +431,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, TMH_KS_release (key_state); TMH_plugin->rollback (TMH_plugin->cls, session); - res = TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (connection, + res = TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (connection, rh); TMH_plugin->free_reserve_history (TMH_plugin->cls, rh); @@ -475,10 +475,10 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, TMH_plugin->commit (TMH_plugin->cls, session)) { - TALER_LOG_WARNING ("/withdraw/sign transaction commit failed\n"); + TALER_LOG_WARNING ("/reserve/withdraw transaction commit failed\n"); return TMH_RESPONSE_reply_commit_error (connection); } - res = TMH_RESPONSE_reply_withdraw_sign_success (connection, + res = TMH_RESPONSE_reply_reserve_withdraw_success (connection, &collectable); GNUNET_CRYPTO_rsa_signature_free (sig); return res; diff --git a/src/mint/taler-mint-httpd_db.h b/src/mint/taler-mint-httpd_db.h index 599762179..f1d9fbfb8 100644 --- a/src/mint/taler-mint-httpd_db.h +++ b/src/mint/taler-mint-httpd_db.h @@ -41,7 +41,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, /** - * Execute a "/withdraw/status". Given the public key of a reserve, + * Execute a "/reserve/status". Given the public key of a reserve, * return the associated transaction history. * * @param connection the MHD connection to handle @@ -49,12 +49,12 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_withdraw_status (struct MHD_Connection *connection, - const struct TALER_ReservePublicKeyP *reserve_pub); +TMH_DB_execute_reserve_status (struct MHD_Connection *connection, + const struct TALER_ReservePublicKeyP *reserve_pub); /** - * Execute a "/withdraw/sign". Given a reserve and a properly signed + * Execute a "/reserve/withdraw". Given a reserve and a properly signed * request to withdraw a coin, check the balance of the reserve and * if it is sufficient, store the request and return the signed * blinded envelope. @@ -68,12 +68,12 @@ TMH_DB_execute_withdraw_status (struct MHD_Connection *connection, * @return MHD result code */ int -TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection, - const struct TALER_ReservePublicKeyP *reserve, - const struct TALER_DenominationPublicKey *denomination_pub, - const char *blinded_msg, - size_t blinded_msg_len, - const struct TALER_ReserveSignatureP *signature); +TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection, + const struct TALER_ReservePublicKeyP *reserve, + const struct TALER_DenominationPublicKey *denomination_pub, + const char *blinded_msg, + size_t blinded_msg_len, + const struct TALER_ReserveSignatureP *signature); /** diff --git a/src/mint/taler-mint-httpd_keystate.h b/src/mint/taler-mint-httpd_keystate.h index 62b041e92..9529de8f3 100644 --- a/src/mint/taler-mint-httpd_keystate.h +++ b/src/mint/taler-mint-httpd_keystate.h @@ -65,7 +65,7 @@ TMH_KS_release (struct TMH_KS_StateHandle *key_state); enum TMH_KS_DenominationKeyUse { /** - * The key is to be used for a /withdraw/sign or /refresh (mint) + * The key is to be used for a /reserve/withdraw or /refresh (mint) * operation. */ TMH_KS_DKU_WITHDRAW, diff --git a/src/mint/taler-mint-httpd_withdraw.c b/src/mint/taler-mint-httpd_reserve.c index 4f5581643..445278090 100644 --- a/src/mint/taler-mint-httpd_withdraw.c +++ b/src/mint/taler-mint-httpd_reserve.c @@ -14,8 +14,8 @@ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ /** - * @file taler-mint-httpd_withdraw.c - * @brief Handle /withdraw/ requests + * @file taler-mint-httpd_reserve.c + * @brief Handle /reserve/ requests * @author Florian Dold * @author Benedikt Mueller * @author Christian Grothoff @@ -23,14 +23,14 @@ #include "platform.h" #include <gnunet/gnunet_util_lib.h> #include <jansson.h> -#include "taler-mint-httpd_withdraw.h" +#include "taler-mint-httpd_reserve.h" #include "taler-mint-httpd_parsing.h" #include "taler-mint-httpd_responses.h" #include "taler-mint-httpd_keystate.h" /** - * Handle a "/withdraw/status" request. Parses the + * Handle a "/reserve/status" request. Parses the * given "reserve_pub" argument (which should contain the * EdDSA public key of a reserve) and then respond with the * status of the reserve. @@ -43,11 +43,11 @@ * @return MHD result code */ int -TMH_WITHDRAW_handler_withdraw_status (struct TMH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size) +TMH_RESERVE_handler_reserve_status (struct TMH_RequestHandler *rh, + struct MHD_Connection *connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size) { struct TALER_ReservePublicKeyP reserve_pub; int res; @@ -60,13 +60,13 @@ TMH_WITHDRAW_handler_withdraw_status (struct TMH_RequestHandler *rh, return MHD_NO; /* internal error */ if (GNUNET_NO == res) return MHD_YES; /* parse error */ - return TMH_DB_execute_withdraw_status (connection, - &reserve_pub); + return TMH_DB_execute_reserve_status (connection, + &reserve_pub); } /** - * Handle a "/withdraw/sign" request. Parses the "reserve_pub" + * Handle a "/reserve/withdraw" request. Parses the "reserve_pub" * EdDSA key of the reserve and the requested "denom_pub" which * specifies the key/value of the coin to be withdrawn, and checks * that the signature "reserve_sig" makes this a valid withdrawl @@ -82,11 +82,11 @@ TMH_WITHDRAW_handler_withdraw_status (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size) +TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh, + struct MHD_Connection *connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size) { json_t *root; struct TALER_WithdrawRequestPS wsrd; @@ -102,10 +102,15 @@ TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh, struct TMH_KS_StateHandle *ks; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_member_variable ("coin_ev", (void **) &blinded_msg, &blinded_msg_len), - TMH_PARSE_member_fixed ("reserve_pub", &wsrd.reserve_pub), - TMH_PARSE_member_fixed ("reserve_sig", &signature), - TMH_PARSE_member_denomination_public_key ("denom_pub", &denomination_pub), + TMH_PARSE_member_variable ("coin_ev", + (void **) &blinded_msg, + &blinded_msg_len), + TMH_PARSE_member_fixed ("reserve_pub", + &wsrd.reserve_pub), + TMH_PARSE_member_fixed ("reserve_sig", + &signature), + TMH_PARSE_member_denomination_public_key ("denom_pub", + &denomination_pub), TMH_PARSE_MEMBER_END }; @@ -162,19 +167,19 @@ TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh, &signature.eddsa_signature, &wsrd.reserve_pub.eddsa_pub)) { - TALER_LOG_WARNING ("Client supplied invalid signature for /withdraw/sign request\n"); + TALER_LOG_WARNING ("Client supplied invalid signature for /reserve/withdraw request\n"); TMH_PARSE_release_data (spec); return TMH_RESPONSE_reply_signature_invalid (connection, "reserve_sig"); } - res = TMH_DB_execute_withdraw_sign (connection, - &wsrd.reserve_pub, - &denomination_pub, - blinded_msg, - blinded_msg_len, - &signature); + res = TMH_DB_execute_reserve_withdraw (connection, + &wsrd.reserve_pub, + &denomination_pub, + blinded_msg, + blinded_msg_len, + &signature); TMH_PARSE_release_data (spec); return res; } -/* end of taler-mint-httpd_withdraw.c */ +/* end of taler-mint-httpd_reserve.c */ diff --git a/src/mint/taler-mint-httpd_withdraw.h b/src/mint/taler-mint-httpd_reserve.h index 668178b16..71a779fe3 100644 --- a/src/mint/taler-mint-httpd_withdraw.h +++ b/src/mint/taler-mint-httpd_reserve.h @@ -14,20 +14,20 @@ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ /** - * @file taler-mint-httpd_withdraw.h - * @brief Handle /withdraw/ requests + * @file taler-mint-httpd_reserve.h + * @brief Handle /reserve/ requests * @author Florian Dold * @author Benedikt Mueller * @author Christian Grothoff */ -#ifndef TALER_MINT_HTTPD_WITHDRAW_H -#define TALER_MINT_HTTPD_WITHDRAW_H +#ifndef TALER_MINT_HTTPD_RESERVE_H +#define TALER_MINT_HTTPD_RESERVE_H #include <microhttpd.h> #include "taler-mint-httpd.h" /** - * Handle a "/withdraw/status" request. Parses the + * Handle a "/reserve/status" request. Parses the * given "reserve_pub" argument (which should contain the * EdDSA public key of a reserve) and then respond with the * status of the reserve. @@ -40,15 +40,15 @@ * @return MHD result code */ int -TMH_WITHDRAW_handler_withdraw_status (struct TMH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size); +TMH_RESERVE_handler_reserve_status (struct TMH_RequestHandler *rh, + struct MHD_Connection *connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size); /** - * Handle a "/withdraw/sign" request. Parses the "reserve_pub" + * Handle a "/reserve/withdraw" request. Parses the "reserve_pub" * EdDSA key of the reserve and the requested "denom_pub" which * specifies the key/value of the coin to be withdrawn, and checks * that the signature "reserve_sig" makes this a valid withdrawl @@ -64,10 +64,10 @@ TMH_WITHDRAW_handler_withdraw_status (struct TMH_RequestHandler *rh, * @return MHD result code */ int -TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size); +TMH_RESERVE_handler_reserve_withdraw (struct TMH_RequestHandler *rh, + struct MHD_Connection *connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size); #endif diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c index ce04fa41a..367b1904e 100644 --- a/src/mint/taler-mint-httpd_responses.c +++ b/src/mint/taler-mint-httpd_responses.c @@ -630,8 +630,8 @@ compile_reserve_history (const struct TALER_MINTDB_ReserveHistory *rh, * @return MHD result code */ int -TMH_RESPONSE_reply_withdraw_status_success (struct MHD_Connection *connection, - const struct TALER_MINTDB_ReserveHistory *rh) +TMH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection, + const struct TALER_MINTDB_ReserveHistory *rh) { json_t *json_balance; json_t *json_history; @@ -654,15 +654,15 @@ TMH_RESPONSE_reply_withdraw_status_success (struct MHD_Connection *connection, /** * Send reserve status information to client with the * message that we have insufficient funds for the - * requested /withdraw/sign operation. + * requested /reserve/withdraw operation. * * @param connection connection to the client * @param rh reserve history to return * @return MHD result code */ int -TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *connection, - const struct TALER_MINTDB_ReserveHistory *rh) +TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection, + const struct TALER_MINTDB_ReserveHistory *rh) { json_t *json_balance; json_t *json_history; @@ -691,7 +691,7 @@ TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *conn * @return MHD result code */ int -TMH_RESPONSE_reply_withdraw_sign_success (struct MHD_Connection *connection, +TMH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection, const struct TALER_MINTDB_CollectableBlindcoin *collectable) { json_t *sig_json; diff --git a/src/mint/taler-mint-httpd_responses.h b/src/mint/taler-mint-httpd_responses.h index a35356389..deb7dd639 100644 --- a/src/mint/taler-mint-httpd_responses.h +++ b/src/mint/taler-mint-httpd_responses.h @@ -245,22 +245,22 @@ TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection * @return MHD result code */ int -TMH_RESPONSE_reply_withdraw_status_success (struct MHD_Connection *connection, - const struct TALER_MINTDB_ReserveHistory *rh); +TMH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection, + const struct TALER_MINTDB_ReserveHistory *rh); /** * Send reserve status information to client with the * message that we have insufficient funds for the - * requested /withdraw/sign operation. + * requested /reserve/withdraw operation. * * @param connection connection to the client * @param rh reserve history to return * @return MHD result code */ int -TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *connection, - const struct TALER_MINTDB_ReserveHistory *rh); +TMH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection, + const struct TALER_MINTDB_ReserveHistory *rh); /** @@ -271,8 +271,8 @@ TMH_RESPONSE_reply_withdraw_sign_insufficient_funds (struct MHD_Connection *conn * @return MHD result code */ int -TMH_RESPONSE_reply_withdraw_sign_success (struct MHD_Connection *connection, - const struct TALER_MINTDB_CollectableBlindcoin *collectable); +TMH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection, + const struct TALER_MINTDB_CollectableBlindcoin *collectable); /** |