diff options
47 files changed, 215 insertions, 203 deletions
diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c index 4f7e11f84..627950aed 100644 --- a/src/auditor/taler-auditor-httpd.c +++ b/src/auditor/taler-auditor-httpd.c @@ -302,7 +302,7 @@ handle_mhd_completion_callback (void *cls, * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ -static int +static MHD_RESULT handle_version (struct TAH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, @@ -347,7 +347,7 @@ handle_version (struct TAH_RequestHandler *rh, * @param con_cls closure for request (a `struct Buffer *`) * @return MHD result code */ -static int +static MHD_RESULT handle_mhd_request (void *cls, struct MHD_Connection *connection, const char *url, diff --git a/src/auditor/taler-auditor-httpd.h b/src/auditor/taler-auditor-httpd.h index 3e7e79a10..127c4dd8a 100644 --- a/src/auditor/taler-auditor-httpd.h +++ b/src/auditor/taler-auditor-httpd.h @@ -75,16 +75,16 @@ struct TAH_RequestHandler * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ - int (*handler)(struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size); + MHD_RESULT (*handler)(struct TAH_RequestHandler *rh, + struct MHD_Connection *connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size); /** * Default response code. */ - int response_code; + unsigned int response_code; }; diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.c b/src/auditor/taler-auditor-httpd_deposit-confirmation.c index fd48ff93b..5f84a7253 100644 --- a/src/auditor/taler-auditor-httpd_deposit-confirmation.c +++ b/src/auditor/taler-auditor-httpd_deposit-confirmation.c @@ -56,7 +56,7 @@ static pthread_mutex_t lock; * @param es information about the exchange's signing key * @return MHD result code */ -static int +static MHD_RESULT verify_and_execute_deposit_confirmation ( struct MHD_Connection *connection, const struct TALER_AUDITORDB_DepositConfirmation *dc, @@ -212,7 +212,7 @@ verify_and_execute_deposit_confirmation ( * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ -int +MHD_RESULT TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, @@ -245,7 +245,7 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh, (void) upload_data_size; { json_t *json; - int res; + enum GNUNET_GenericReturnValue res; res = TALER_MHD_parse_post_json (connection, connection_cls, @@ -270,7 +270,7 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh, es.exchange_pub = dc.exchange_pub; /* used twice! */ dc.master_public_key = es.master_public_key; { - int res; + MHD_RESULT res; res = verify_and_execute_deposit_confirmation (connection, &dc, diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.h b/src/auditor/taler-auditor-httpd_deposit-confirmation.h index 531f3c93c..a7c331916 100644 --- a/src/auditor/taler-auditor-httpd_deposit-confirmation.h +++ b/src/auditor/taler-auditor-httpd_deposit-confirmation.h @@ -49,7 +49,7 @@ TEAH_DEPOSIT_CONFIRMATION_done (void); * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ -int +MHD_RESULT TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, diff --git a/src/auditor/taler-auditor-httpd_exchanges.c b/src/auditor/taler-auditor-httpd_exchanges.c index 237b973f8..f117b6083 100644 --- a/src/auditor/taler-auditor-httpd_exchanges.c +++ b/src/auditor/taler-auditor-httpd_exchanges.c @@ -68,7 +68,7 @@ add_exchange (void *cls, * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ -int +MHD_RESULT TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, diff --git a/src/auditor/taler-auditor-httpd_exchanges.h b/src/auditor/taler-auditor-httpd_exchanges.h index c356d7e99..c7d8dd5fd 100644 --- a/src/auditor/taler-auditor-httpd_exchanges.h +++ b/src/auditor/taler-auditor-httpd_exchanges.h @@ -36,7 +36,7 @@ * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ -int +MHD_RESULT TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, diff --git a/src/auditor/taler-auditor-httpd_mhd.c b/src/auditor/taler-auditor-httpd_mhd.c index a8322a830..e5d2f71ee 100644 --- a/src/auditor/taler-auditor-httpd_mhd.c +++ b/src/auditor/taler-auditor-httpd_mhd.c @@ -43,7 +43,7 @@ * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ -int +MHD_RESULT TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, @@ -77,7 +77,7 @@ TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh, * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ -int +MHD_RESULT TAH_MHD_handler_agpl_redirect (struct TAH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, diff --git a/src/auditor/taler-auditor-httpd_mhd.h b/src/auditor/taler-auditor-httpd_mhd.h index 1096ee346..1804a1861 100644 --- a/src/auditor/taler-auditor-httpd_mhd.h +++ b/src/auditor/taler-auditor-httpd_mhd.h @@ -39,7 +39,7 @@ * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ -int +MHD_RESULT TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, @@ -58,7 +58,7 @@ TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh, * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ -int +MHD_RESULT TAH_MHD_handler_agpl_redirect (struct TAH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c index 9c4aeb6e9..6df6cdfad 100644 --- a/src/bank-lib/fakebank.c +++ b/src/bank-lib/fakebank.c @@ -25,6 +25,7 @@ #include "taler_fakebank_lib.h" #include "taler_bank_service.h" #include "taler_mhd_lib.h" +#include <gnunet/gnunet_mhd_compat.h> /** * Maximum POST request size (for /admin/add-incoming) @@ -585,7 +586,7 @@ handle_mhd_completion_callback (void *cls, * @param con_cls closure for request (a `struct Buffer *`) * @return MHD result code */ -static int +static MHD_RESULT handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h, struct MHD_Connection *connection, const char *account, @@ -680,7 +681,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h, * @param con_cls closure for request (a `struct Buffer *`) * @return MHD result code */ -static int +static MHD_RESULT handle_transfer (struct TALER_FAKEBANK_Handle *h, struct MHD_Connection *connection, const char *account, @@ -800,12 +801,12 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h, * @param con_cls place to store state, not used * @return MHD result code */ -static int +static MHD_RESULT handle_home_page (struct TALER_FAKEBANK_Handle *h, struct MHD_Connection *connection, void **con_cls) { - int ret; + MHD_RESULT ret; struct MHD_Response *resp; #define HELLOMSG "Hello, Fakebank!" @@ -936,7 +937,7 @@ parse_history_common_args (struct MHD_Connection *connection, * @param account which account the request is about * @return MHD result code */ -static int +static MHD_RESULT handle_debit_history (struct TALER_FAKEBANK_Handle *h, struct MHD_Connection *connection, const char *account) @@ -1051,7 +1052,7 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, * @param account which account the request is about * @return MHD result code */ -static int +static MHD_RESULT handle_credit_history (struct TALER_FAKEBANK_Handle *h, struct MHD_Connection *connection, const char *account) @@ -1198,7 +1199,7 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h, * @param con_cls closure for request (a `struct Buffer *`) * @return MHD result code */ -static int +static MHD_RESULT serve (struct TALER_FAKEBANK_Handle *h, struct MHD_Connection *connection, const char *account, @@ -1279,7 +1280,7 @@ serve (struct TALER_FAKEBANK_Handle *h, * @param con_cls closure for request (a `struct Buffer *`) * @return MHD result code */ -static int +static MHD_RESULT handle_mhd_request (void *cls, struct MHD_Connection *connection, const char *url, @@ -1292,7 +1293,7 @@ handle_mhd_request (void *cls, struct TALER_FAKEBANK_Handle *h = cls; char *account = NULL; char *end; - int ret; + MHD_RESULT ret; (void) version; GNUNET_log (GNUNET_ERROR_TYPE_INFO, diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index de251acbb..a8e29d300 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -42,7 +42,7 @@ #include "taler-exchange-httpd_keystate.h" #include "taler-exchange-httpd_wire.h" #include "taler_exchangedb_plugin.h" - +#include <gnunet/gnunet_mhd_compat.h> /** * Backlog for listen operation on unix domain sockets. @@ -158,7 +158,7 @@ static unsigned long long req_max; * @param root uploaded JSON data * @return MHD result code */ -typedef int +typedef MHD_RESULT (*CoinOpHandler)(struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const json_t *root); @@ -175,7 +175,7 @@ typedef int * reserve public key, the second one should be "withdraw") * @return MHD result code */ -static int +static MHD_RESULT handle_post_coins (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const json_t *root, @@ -297,7 +297,7 @@ handle_mhd_completion_callback (void *cls, * @param[in,out] upload_data_size number of bytes in @a upload_data * @return MHD result code */ -static int +static MHD_RESULT proceed_with_handler (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *url, @@ -308,7 +308,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh, const char *args[rh->nargs + 1]; size_t ulen = strlen (url) + 1; json_t *root = NULL; - int ret; + MHD_RESULT ret; /* We do check for "ulen" here, because we'll later stack-allocate a buffer of that size and don't want to enable malicious clients to cause us @@ -331,7 +331,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh, if (0 == strcasecmp (rh->method, MHD_HTTP_METHOD_POST)) { - int res; + enum GNUNET_GenericReturnValue res; res = TALER_MHD_parse_post_json (connection, inner_cls, @@ -433,7 +433,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh, * @param con_cls closure for request (a `struct Buffer *`) * @return MHD result code */ -static int +static MHD_RESULT handle_mhd_request (void *cls, struct MHD_Connection *connection, const char *url, @@ -606,7 +606,7 @@ handle_mhd_request (void *cls, /* on repeated requests, check our cache first */ if (NULL != ecls->rh) { - int ret; + MHD_RESULT ret; const char *start; if ('\0' == url[0]) @@ -669,7 +669,7 @@ handle_mhd_request (void *cls, if (0 == strcasecmp (method, rh->method)) { - int ret; + MHD_RESULT ret; /* cache to avoid the loop next time */ ecls->rh = rh; @@ -698,7 +698,7 @@ handle_mhd_request (void *cls, /* No handler matches, generate not found */ { - int ret; + MHD_RESULT ret; ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, @@ -716,7 +716,7 @@ handle_mhd_request (void *cls, * * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue exchange_serve_process_config (void) { if (GNUNET_OK != diff --git a/src/exchange/taler-exchange-httpd.h b/src/exchange/taler-exchange-httpd.h index 512fae8f0..b1e8079fe 100644 --- a/src/exchange/taler-exchange-httpd.h +++ b/src/exchange/taler-exchange-httpd.h @@ -26,6 +26,7 @@ #include <microhttpd.h> #include "taler_json_lib.h" #include "taler_crypto_lib.h" +#include <gnunet/gnunet_mhd_compat.h> /** @@ -100,9 +101,9 @@ struct TEH_RequestHandler * @param args array of arguments, needs to be of length @e args_expected * @return MHD result code */ - int (*get)(const struct TEH_RequestHandler *rh, - struct MHD_Connection *connection, - const char *const args[]); + MHD_RESULT (*get)(const struct TEH_RequestHandler *rh, + struct MHD_Connection *connection, + const char *const args[]); /** @@ -115,10 +116,10 @@ struct TEH_RequestHandler * @param args array of arguments, needs to be of length @e args_expected * @return MHD result code */ - int (*post)(const struct TEH_RequestHandler *rh, - struct MHD_Connection *connection, - const json_t *root, - const char *const args[]); + MHD_RESULT (*post)(const struct TEH_RequestHandler *rh, + struct MHD_Connection *connection, + const json_t *root, + const char *const args[]); } handler; diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c index f98116226..2e8f0a02e 100644 --- a/src/exchange/taler-exchange-httpd_db.c +++ b/src/exchange/taler-exchange-httpd_db.c @@ -58,7 +58,7 @@ enum GNUNET_DB_QueryStatus TEH_DB_know_coin_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct TEH_DB_KnowCoinContext *kcc = cls; enum GNUNET_DB_QueryStatus qs; @@ -96,10 +96,10 @@ TEH_DB_know_coin_transaction (void *cls, * @param cb_cls closure for @a cb, must be read-only! * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure */ -int +enum GNUNET_GenericReturnValue TEH_DB_run_transaction (struct MHD_Connection *connection, const char *name, - int *mhd_ret, + MHD_RESULT *mhd_ret, TEH_DB_TransactionCallback cb, void *cb_cls) { diff --git a/src/exchange/taler-exchange-httpd_db.h b/src/exchange/taler-exchange-httpd_db.h index 380f00d3e..f97f488de 100644 --- a/src/exchange/taler-exchange-httpd_db.h +++ b/src/exchange/taler-exchange-httpd_db.h @@ -23,6 +23,7 @@ #include <microhttpd.h> #include "taler_exchangedb_plugin.h" +#include <gnunet/gnunet_mhd_compat.h> /** @@ -60,7 +61,7 @@ enum GNUNET_DB_QueryStatus TEH_DB_know_coin_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret); + MHD_RESULT *mhd_ret); /** @@ -82,7 +83,7 @@ typedef enum GNUNET_DB_QueryStatus (*TEH_DB_TransactionCallback)(void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret); + MHD_RESULT *mhd_ret); /** @@ -101,10 +102,10 @@ typedef enum GNUNET_DB_QueryStatus * @param cb_cls closure for @a cb, must be read-only! * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure */ -int +enum GNUNET_GenericReturnValue TEH_DB_run_transaction (struct MHD_Connection *connection, const char *name, - int *mhd_ret, + MHD_RESULT *mhd_ret, TEH_DB_TransactionCallback cb, void *cb_cls); diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index d34391659..ad5b82866 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c @@ -53,7 +53,7 @@ * @param amount_without_fee fraction of coin value to deposit, without the fee * @return MHD result code */ -static int +static MHD_RESULT reply_deposit_success (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct GNUNET_HashCode *h_wire, @@ -133,7 +133,7 @@ static enum GNUNET_DB_QueryStatus deposit_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct DepositContext *dc = cls; const struct TALER_EXCHANGEDB_Deposit *deposit = dc->deposit; @@ -301,7 +301,7 @@ check_timestamp_current (struct GNUNET_TIME_Absolute ts) * @param root uploaded JSON data * @return MHD result code */ -int +MHD_RESULT TEH_handler_deposit (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const json_t *root) @@ -471,7 +471,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, /* make sure coin is 'known' in database */ { - int mhd_ret; + MHD_RESULT mhd_ret; struct TEH_DB_KnowCoinContext kcc = { .coin = &deposit.coin, .connection = connection @@ -524,7 +524,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, /* execute transaction */ dc.deposit = &deposit; { - int mhd_ret; + MHD_RESULT mhd_ret; if (GNUNET_OK != TEH_DB_run_transaction (connection, @@ -541,7 +541,7 @@ TEH_handler_deposit (struct MHD_Connection *connection, /* generate regular response */ { struct TALER_Amount amount_without_fee; - int res; + MHD_RESULT res; GNUNET_assert (0 <= TALER_amount_subtract (&amount_without_fee, diff --git a/src/exchange/taler-exchange-httpd_deposit.h b/src/exchange/taler-exchange-httpd_deposit.h index 642e29dd5..a4d598a69 100644 --- a/src/exchange/taler-exchange-httpd_deposit.h +++ b/src/exchange/taler-exchange-httpd_deposit.h @@ -40,7 +40,7 @@ * @param root uploaded JSON data * @return MHD result code */ -int +MHD_RESULT TEH_handler_deposit (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const json_t *root); diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c index 04d24f496..a2226b7e3 100644 --- a/src/exchange/taler-exchange-httpd_deposits_get.c +++ b/src/exchange/taler-exchange-httpd_deposits_get.c @@ -45,7 +45,7 @@ * @param exec_time execution time of the wire transfer * @return MHD result code */ -static int +static MHD_RESULT reply_deposit_details (struct MHD_Connection *connection, const struct GNUNET_HashCode *h_contract_terms, const struct GNUNET_HashCode *h_wire, @@ -213,7 +213,7 @@ static enum GNUNET_DB_QueryStatus deposits_get_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct DepositWtidContext *ctx = cls; enum GNUNET_DB_QueryStatus qs; @@ -258,13 +258,13 @@ deposits_get_transaction (void *cls, * @param merchant_pub public key from the merchant * @return MHD result code */ -static int +static MHD_RESULT handle_track_transaction_request ( struct MHD_Connection *connection, const struct TALER_DepositTrackPS *tps, const struct TALER_MerchantPublicKeyP *merchant_pub) { - int mhd_ret; + MHD_RESULT mhd_ret; struct DepositWtidContext ctx = { .pending = GNUNET_NO, .tps = tps, @@ -310,12 +310,12 @@ handle_track_transaction_request ( * h_wire, merchant_pub, h_contract_terms and coin_pub) * @return MHD result code */ -int +MHD_RESULT TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[4]) { - int res; + enum GNUNET_GenericReturnValue res; struct TALER_MerchantSignatureP merchant_sig; struct TALER_DepositTrackPS tps = { .purpose.size = htonl (sizeof (tps)), diff --git a/src/exchange/taler-exchange-httpd_deposits_get.h b/src/exchange/taler-exchange-httpd_deposits_get.h index 36d072aa8..a745c5de2 100644 --- a/src/exchange/taler-exchange-httpd_deposits_get.h +++ b/src/exchange/taler-exchange-httpd_deposits_get.h @@ -36,7 +36,7 @@ * h_wire, merchant_pub, h_contract_terms and coin_pub) * @return MHD result code */ -int +MHD_RESULT TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[4]); diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index acdec8d7f..152d2dad5 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -669,7 +669,7 @@ static enum GNUNET_DB_QueryStatus add_revocations_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct AddRevocationContext *arc = cls; enum GNUNET_DB_QueryStatus qs; @@ -709,7 +709,7 @@ static enum GNUNET_DB_QueryStatus add_denomination_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { const struct TALER_EXCHANGEDB_DenominationKey *dki = cls; enum GNUNET_DB_QueryStatus qs; @@ -2467,12 +2467,12 @@ krd_search_comparator (const void *key, * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_keys (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]) { - int ret; + MHD_RESULT ret; const char *have_cherrypick; const char *have_fakenow; struct GNUNET_TIME_Absolute last_issue_date; diff --git a/src/exchange/taler-exchange-httpd_keystate.h b/src/exchange/taler-exchange-httpd_keystate.h index 65a006bbe..86bdc59b1 100644 --- a/src/exchange/taler-exchange-httpd_keystate.h +++ b/src/exchange/taler-exchange-httpd_keystate.h @@ -220,7 +220,7 @@ TEH_KS_sign_ (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_keys (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]); diff --git a/src/exchange/taler-exchange-httpd_link.c b/src/exchange/taler-exchange-httpd_link.c index 4738a435f..948c8eb08 100644 --- a/src/exchange/taler-exchange-httpd_link.c +++ b/src/exchange/taler-exchange-httpd_link.c @@ -142,7 +142,7 @@ static enum GNUNET_DB_QueryStatus link_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct HTD_Context *ctx = cls; enum GNUNET_DB_QueryStatus qs; @@ -180,13 +180,13 @@ link_transaction (void *cls, * @param args array of additional options (length: 2, first is the coin_pub, second must be "link") * @return MHD result code */ -int +MHD_RESULT TEH_handler_link (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[2]) { struct HTD_Context ctx; - int mhd_ret; + MHD_RESULT mhd_ret; (void) rh; memset (&ctx, diff --git a/src/exchange/taler-exchange-httpd_link.h b/src/exchange/taler-exchange-httpd_link.h index 6fdcf1cff..4c9651a9e 100644 --- a/src/exchange/taler-exchange-httpd_link.h +++ b/src/exchange/taler-exchange-httpd_link.h @@ -36,7 +36,7 @@ * @param args array of additional options (length: 2, first is the coin_pub, second must be "link") * @return MHD result code */ -int +MHD_RESULT TEH_handler_link (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[2]); diff --git a/src/exchange/taler-exchange-httpd_melt.c b/src/exchange/taler-exchange-httpd_melt.c index c08c97732..3a0195cfd 100644 --- a/src/exchange/taler-exchange-httpd_melt.c +++ b/src/exchange/taler-exchange-httpd_melt.c @@ -47,7 +47,7 @@ * @param residual remaining value of the coin (after subtracting @a tl) * @return a MHD result code */ -static int +static MHD_RESULT reply_melt_insufficient_funds ( struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, @@ -94,7 +94,7 @@ reply_melt_insufficient_funds ( * @param noreveal_index which index will the client not have to reveal * @return a MHD status code */ -static int +static MHD_RESULT reply_melt_success (struct MHD_Connection *connection, const struct TALER_RefreshCommitmentP *rc, uint32_t noreveal_index) @@ -174,7 +174,7 @@ static enum GNUNET_DB_QueryStatus refresh_check_melt (struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, struct MeltContext *rmc, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_Amount spent; @@ -296,7 +296,7 @@ static enum GNUNET_DB_QueryStatus melt_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct MeltContext *rmc = cls; enum GNUNET_DB_QueryStatus qs; @@ -370,7 +370,7 @@ melt_transaction (void *cls, * @param[in,out] rmc details about the melt request * @return MHD result code */ -static int +static MHD_RESULT handle_melt (struct MHD_Connection *connection, struct MeltContext *rmc) { @@ -405,7 +405,7 @@ handle_melt (struct MHD_Connection *connection, /* run database transaction */ { - int mhd_ret; + MHD_RESULT mhd_ret; if (GNUNET_OK != TEH_DB_run_transaction (connection, @@ -431,7 +431,7 @@ handle_melt (struct MHD_Connection *connection, * @param rmc parsed request information * @return MHD status code */ -static int +static MHD_RESULT check_for_denomination_key (struct MHD_Connection *connection, struct MeltContext *rmc) { @@ -572,7 +572,7 @@ check_for_denomination_key (struct MHD_Connection *connection, if (GNUNET_NO == coin_is_dirty) { struct TEH_DB_KnowCoinContext kcc; - int mhd_ret; + MHD_RESULT mhd_ret; kcc.coin = &rmc->refresh_session.coin; kcc.connection = connection; @@ -612,13 +612,14 @@ check_for_denomination_key (struct MHD_Connection *connection, * @param root uploaded JSON data * @return MHD result code */ -int +MHD_RESULT TEH_handler_melt (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const json_t *root) { struct MeltContext rmc; - int res; + enum GNUNET_GenericReturnValue ret; + MHD_RESULT res; struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_denomination_signature ("denom_sig", &rmc.refresh_session.coin.denom_sig), @@ -637,11 +638,11 @@ TEH_handler_melt (struct MHD_Connection *connection, 0, sizeof (rmc)); rmc.refresh_session.coin.coin_pub = *coin_pub; - res = TALER_MHD_parse_json_data (connection, + ret = TALER_MHD_parse_json_data (connection, root, spec); - if (GNUNET_OK != res) - return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; + if (GNUNET_OK != ret) + return (GNUNET_SYSERR == ret) ? MHD_NO : MHD_YES; res = check_for_denomination_key (connection, &rmc); diff --git a/src/exchange/taler-exchange-httpd_melt.h b/src/exchange/taler-exchange-httpd_melt.h index ad25b4717..0edaf2475 100644 --- a/src/exchange/taler-exchange-httpd_melt.h +++ b/src/exchange/taler-exchange-httpd_melt.h @@ -39,7 +39,7 @@ * @param root uploaded JSON data * @return MHD result code */ -int +MHD_RESULT TEH_handler_melt (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const json_t *root); diff --git a/src/exchange/taler-exchange-httpd_mhd.c b/src/exchange/taler-exchange-httpd_mhd.c index 6d5df6ff3..c9c6303b8 100644 --- a/src/exchange/taler-exchange-httpd_mhd.c +++ b/src/exchange/taler-exchange-httpd_mhd.c @@ -43,7 +43,7 @@ * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_static_response (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]) @@ -71,7 +71,7 @@ TEH_handler_static_response (const struct TEH_RequestHandler *rh, * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_agpl_redirect (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]) diff --git a/src/exchange/taler-exchange-httpd_mhd.h b/src/exchange/taler-exchange-httpd_mhd.h index 1605032a1..7547780df 100644 --- a/src/exchange/taler-exchange-httpd_mhd.h +++ b/src/exchange/taler-exchange-httpd_mhd.h @@ -37,7 +37,7 @@ * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_static_response (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]); @@ -52,7 +52,7 @@ TEH_handler_static_response (const struct TEH_RequestHandler *rh, * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_agpl_redirect (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]); diff --git a/src/exchange/taler-exchange-httpd_recoup.c b/src/exchange/taler-exchange-httpd_recoup.c index a3014e786..c1f6ff330 100644 --- a/src/exchange/taler-exchange-httpd_recoup.c +++ b/src/exchange/taler-exchange-httpd_recoup.c @@ -123,7 +123,7 @@ static enum GNUNET_DB_QueryStatus recoup_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct RecoupContext *pc = cls; struct TALER_EXCHANGEDB_TransactionList *tl; @@ -260,7 +260,7 @@ recoup_transaction (void *cls, (0 == pc->amount.value) ) { /* Recoup has no effect: coin fully spent! */ - int ret; + enum GNUNET_DB_QueryStatus ret; TEH_plugin->rollback (TEH_plugin->cls, session); @@ -342,7 +342,7 @@ recoup_transaction (void *cls, * @param refreshed #GNUNET_YES if the coin was refreshed * @return MHD result code */ -static int +static MHD_RESULT verify_and_execute_recoup (struct MHD_Connection *connection, const struct TALER_CoinPublicInfo *coin, const struct @@ -453,7 +453,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, /* make sure coin is 'known' in database */ { struct TEH_DB_KnowCoinContext kcc; - int mhd_ret; + MHD_RESULT mhd_ret; kcc.coin = coin; kcc.connection = connection; @@ -472,7 +472,7 @@ verify_and_execute_recoup (struct MHD_Connection *connection, pc.coin = coin; pc.refreshed = refreshed; { - int mhd_ret; + MHD_RESULT mhd_ret; if (GNUNET_OK != TEH_DB_run_transaction (connection, @@ -512,12 +512,12 @@ verify_and_execute_recoup (struct MHD_Connection *connection, * @param root uploaded JSON data * @return MHD result code */ -int +MHD_RESULT TEH_handler_recoup (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const json_t *root) { - int res; + enum GNUNET_GenericReturnValue ret; struct TALER_CoinPublicInfo coin; struct TALER_DenominationBlindingKeyP coin_bks; struct TALER_CoinSpendSignatureP coin_sig; @@ -538,20 +538,24 @@ TEH_handler_recoup (struct MHD_Connection *connection, }; coin.coin_pub = *coin_pub; - res = TALER_MHD_parse_json_data (connection, + ret = TALER_MHD_parse_json_data (connection, root, spec); - if (GNUNET_SYSERR == res) + if (GNUNET_SYSERR == ret) return MHD_NO; /* hard failure */ - if (GNUNET_NO == res) + if (GNUNET_NO == ret) return MHD_YES; /* failure */ - res = verify_and_execute_recoup (connection, - &coin, - &coin_bks, - &coin_sig, - refreshed); - GNUNET_JSON_parse_free (spec); - return res; + { + MHD_RESULT res; + + res = verify_and_execute_recoup (connection, + &coin, + &coin_bks, + &coin_sig, + refreshed); + GNUNET_JSON_parse_free (spec); + return res; + } } diff --git a/src/exchange/taler-exchange-httpd_recoup.h b/src/exchange/taler-exchange-httpd_recoup.h index 85fdc1399..95e60773f 100644 --- a/src/exchange/taler-exchange-httpd_recoup.h +++ b/src/exchange/taler-exchange-httpd_recoup.h @@ -37,7 +37,7 @@ * @param root uploaded JSON data * @return MHD result code */ -int +MHD_RESULT TEH_handler_recoup (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const json_t *root); diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index da1b3eb94..916277b96 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -52,7 +52,7 @@ * @param sigs array of @a num_freshcoins signatures revealed * @return a MHD result code */ -static int +static MHD_RESULT reply_refreshes_reveal_success (struct MHD_Connection *connection, unsigned int num_freshcoins, const struct TALER_DenominationSignature *sigs) @@ -235,7 +235,7 @@ static enum GNUNET_DB_QueryStatus refreshes_reveal_preflight (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct RevealContext *rctx = cls; enum GNUNET_DB_QueryStatus qs; @@ -292,7 +292,7 @@ static enum GNUNET_DB_QueryStatus refreshes_reveal_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct RevealContext *rctx = cls; struct TALER_EXCHANGEDB_Melt melt; @@ -482,7 +482,7 @@ static enum GNUNET_DB_QueryStatus refreshes_reveal_persist (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct RevealContext *rctx = cls; enum GNUNET_DB_QueryStatus qs; @@ -532,7 +532,7 @@ refreshes_reveal_persist (void *cls, * @param coin_evs envelopes of gamma-selected coins to be signed * @return MHD result code */ -static int +static MHD_RESULT resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, struct MHD_Connection *connection, struct RevealContext *rctx, @@ -547,7 +547,8 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, struct TALER_RefreshCoinData rcds[num_fresh_coins]; struct TALER_CoinSpendSignatureP link_sigs[num_fresh_coins]; struct TALER_EXCHANGEDB_Melt melt; - int res; + enum GNUNET_GenericReturnValue res; + MHD_RESULT ret; /* Parse denomination key hashes */ for (unsigned int i = 0; i<num_fresh_coins; i++) @@ -624,13 +625,13 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, switch (qs) { case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - res = TALER_MHD_reply_with_error (connection, + ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_REVEAL_SESSION_UNKNOWN, "rc"); break; case GNUNET_DB_STATUS_HARD_ERROR: - res = TALER_MHD_reply_with_error (connection, + ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_REVEAL_DB_FETCH_SESSION_ERROR, "failed to fetch session data"); @@ -638,7 +639,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, case GNUNET_DB_STATUS_SOFT_ERROR: default: GNUNET_break (0); /* should be impossible */ - res = TALER_MHD_reply_with_error (connection, + ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_INTERNAL_INVARIANT_FAILURE, "assertion failed (unexpected database serialization error)"); @@ -683,7 +684,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, &melt.session.coin.coin_pub.eddsa_pub)) { GNUNET_break_op (0); - res = TALER_MHD_reply_with_error (connection, + ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_FORBIDDEN, TALER_EC_REVEAL_LINK_SIGNATURE_INVALID, "link_sig"); @@ -710,7 +711,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, if (NULL == rctx->ev_sigs[i].rsa_signature) { GNUNET_break (0); - res = TALER_MHD_reply_with_error (connection, + ret = TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_REVEAL_SIGNING_ERROR, "internal signing error"); @@ -729,17 +730,17 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, if ( (GNUNET_OK == TEH_DB_run_transaction (connection, "reveal pre-check", - &res, + &ret, &refreshes_reveal_preflight, rctx)) && (GNUNET_YES == rctx->preflight_ok) ) { /* Generate final (positive) response */ GNUNET_assert (NULL != rctx->ev_sigs); - res = reply_refreshes_reveal_success (connection, + ret = reply_refreshes_reveal_success (connection, num_fresh_coins, rctx->ev_sigs); - GNUNET_break (MHD_NO != res); + GNUNET_break (MHD_NO != ret); goto cleanup; /* aka 'break' */ } if (GNUNET_SYSERR == rctx->preflight_ok) @@ -750,7 +751,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, if (GNUNET_OK != TEH_DB_run_transaction (connection, "run reveal", - &res, + &ret, &refreshes_reveal_transaction, rctx)) { @@ -761,13 +762,13 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, if (GNUNET_OK == TEH_DB_run_transaction (connection, "persist reveal", - &res, + &ret, &refreshes_reveal_persist, rctx)) { /* Generate final (positive) response */ GNUNET_assert (NULL != rctx->ev_sigs); - res = reply_refreshes_reveal_success (connection, + ret = reply_refreshes_reveal_success (connection, num_fresh_coins, rctx->ev_sigs); break; @@ -778,7 +779,7 @@ resolve_refreshes_reveal_denominations (struct TEH_KS_StateHandle *key_state, } /* end for (retries...) */ cleanup: - GNUNET_break (MHD_NO != res); + GNUNET_break (MHD_NO != ret); /* free resources */ if (NULL != rctx->ev_sigs) { @@ -790,7 +791,7 @@ cleanup: } for (unsigned int i = 0; i<num_fresh_coins; i++) GNUNET_free_non_null (rcds[i].coin_ev); - return res; + return ret; } @@ -908,7 +909,7 @@ handle_refreshes_reveal_json (struct MHD_Connection *connection, * @param args array of additional options (length: 2, session hash and the string "reveal") * @return MHD result code */ -int +MHD_RESULT TEH_handler_reveal (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const json_t *root, diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.h b/src/exchange/taler-exchange-httpd_refreshes_reveal.h index 076ec52d2..b9806dbd3 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.h +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.h @@ -43,7 +43,7 @@ * @param args array of additional options (length: 2, session hash and the string "reveal") * @return MHD result code */ -int +MHD_RESULT TEH_handler_reveal (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const json_t *root, diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c index 036a04739..7c2b149f2 100644 --- a/src/exchange/taler-exchange-httpd_refund.c +++ b/src/exchange/taler-exchange-httpd_refund.c @@ -43,7 +43,7 @@ * @param refund details about the successful refund * @return MHD result code */ -static int +static MHD_RESULT reply_refund_success (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_EXCHANGEDB_RefundListEntry *refund) @@ -104,7 +104,7 @@ static enum GNUNET_DB_QueryStatus refund_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { const struct TALER_EXCHANGEDB_Refund *refund = cls; struct TALER_EXCHANGEDB_TransactionList *tl; @@ -342,7 +342,7 @@ refund_transaction (void *cls, * @param refund information about the refund * @return MHD result code */ -static int +static MHD_RESULT verify_and_execute_refund (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_Refund *refund) { @@ -468,7 +468,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, /* Finally run the actual transaction logic */ { - int mhd_ret; + MHD_RESULT mhd_ret; if (GNUNET_OK != TEH_DB_run_transaction (connection, @@ -497,7 +497,7 @@ verify_and_execute_refund (struct MHD_Connection *connection, * @param root uploaded JSON data * @return MHD result code */ -int +MHD_RESULT TEH_handler_refund (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const json_t *root) @@ -517,7 +517,7 @@ TEH_handler_refund (struct MHD_Connection *connection, refund.coin.coin_pub = *coin_pub; { - int res; + enum GNUNET_GenericReturnValue res; res = TALER_MHD_parse_json_data (connection, root, @@ -549,7 +549,7 @@ TEH_handler_refund (struct MHD_Connection *connection, "refund_amount"); } { - int res; + MHD_RESULT res; res = verify_and_execute_refund (connection, &refund); diff --git a/src/exchange/taler-exchange-httpd_refund.h b/src/exchange/taler-exchange-httpd_refund.h index ad6387d67..92480b775 100644 --- a/src/exchange/taler-exchange-httpd_refund.h +++ b/src/exchange/taler-exchange-httpd_refund.h @@ -38,8 +38,8 @@ * @param coin_pub public key of the coin * @param root uploaded JSON data * @return MHD result code - */ -int + */ +MHD_RESULT TEH_handler_refund (struct MHD_Connection *connection, const struct TALER_CoinSpendPublicKeyP *coin_pub, const json_t *root); diff --git a/src/exchange/taler-exchange-httpd_reserves_get.c b/src/exchange/taler-exchange-httpd_reserves_get.c index dbbb72708..cbc6b422b 100644 --- a/src/exchange/taler-exchange-httpd_reserves_get.c +++ b/src/exchange/taler-exchange-httpd_reserves_get.c @@ -37,7 +37,7 @@ * @param rh reserve history to return * @return MHD result code */ -static int +static MHD_RESULT reply_reserve_history_success (struct MHD_Connection *connection, const struct TALER_EXCHANGEDB_ReserveHistory *rh) { @@ -100,7 +100,7 @@ static enum GNUNET_DB_QueryStatus reserve_history_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct ReserveHistoryContext *rsc = cls; @@ -124,13 +124,13 @@ reserve_history_transaction (void *cls, * @param args array of additional options (length: 1, just the reserve_pub) * @return MHD result code */ -int +MHD_RESULT TEH_handler_reserves_get (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[1]) { struct ReserveHistoryContext rsc; - int mhd_ret; + MHD_RESULT mhd_ret; (void) rh; if (GNUNET_OK != diff --git a/src/exchange/taler-exchange-httpd_reserves_get.h b/src/exchange/taler-exchange-httpd_reserves_get.h index e59d3e031..b46a6a448 100644 --- a/src/exchange/taler-exchange-httpd_reserves_get.h +++ b/src/exchange/taler-exchange-httpd_reserves_get.h @@ -38,7 +38,7 @@ * @param args array of additional options (length: 1, just the reserve_pub) * @return MHD result code */ -int +MHD_RESULT TEH_handler_reserves_get (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[1]); diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 3870db14c..06673afc1 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -411,7 +411,7 @@ TEH_RESPONSE_compile_transaction_history ( * @param tl transaction list to use to build reply * @return MHD result code */ -int +MHD_RESULT TEH_RESPONSE_reply_coin_insufficient_funds ( struct MHD_Connection *connection, enum TALER_ErrorCode ec, diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h index 5dd98174f..6486b5d93 100644 --- a/src/exchange/taler-exchange-httpd_responses.h +++ b/src/exchange/taler-exchange-httpd_responses.h @@ -31,6 +31,7 @@ #include "taler_error_codes.h" #include "taler-exchange-httpd.h" #include "taler-exchange-httpd_db.h" +#include <gnunet/gnunet_mhd_compat.h> /** @@ -59,7 +60,7 @@ TEH_RESPONSE_compile_reserve_history ( * @param tl transaction list to use to build reply * @return MHD result code */ -int +MHD_RESULT TEH_RESPONSE_reply_coin_insufficient_funds ( struct MHD_Connection *connection, enum TALER_ErrorCode ec, diff --git a/src/exchange/taler-exchange-httpd_terms.c b/src/exchange/taler-exchange-httpd_terms.c index 121e1c780..1c703021f 100644 --- a/src/exchange/taler-exchange-httpd_terms.c +++ b/src/exchange/taler-exchange-httpd_terms.c @@ -46,7 +46,7 @@ static struct TALER_MHD_Legal *pp; * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_terms (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]) @@ -66,7 +66,7 @@ TEH_handler_terms (const struct TEH_RequestHandler *rh, * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_privacy (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]) diff --git a/src/exchange/taler-exchange-httpd_terms.h b/src/exchange/taler-exchange-httpd_terms.h index 7fe7774ad..3cbd36884 100644 --- a/src/exchange/taler-exchange-httpd_terms.h +++ b/src/exchange/taler-exchange-httpd_terms.h @@ -37,7 +37,7 @@ * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_terms (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]); @@ -51,7 +51,7 @@ TEH_handler_terms (const struct TEH_RequestHandler *rh, * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_privacy (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]); diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c index 2aa9a5c9c..a5b212446 100644 --- a/src/exchange/taler-exchange-httpd_transfers_get.c +++ b/src/exchange/taler-exchange-httpd_transfers_get.c @@ -83,7 +83,7 @@ struct AggregatedDepositDetail * @param wdd_head linked list with details about the combined deposits * @return MHD result code */ -static int +static MHD_RESULT reply_transfer_details (struct MHD_Connection *connection, const struct TALER_Amount *total, const struct TALER_MerchantPublicKeyP *merchant_pub, @@ -421,7 +421,7 @@ static enum GNUNET_DB_QueryStatus get_transfer_deposits (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct WtidTransactionContext *ctx = cls; enum GNUNET_DB_QueryStatus qs; @@ -513,13 +513,13 @@ get_transfer_deposits (void *cls, * @param args array of additional options (length: 1, just the wtid) * @return MHD result code */ -int +MHD_RESULT TEH_handler_transfers_get (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[1]) { struct WtidTransactionContext ctx; - int mhd_ret; + MHD_RESULT mhd_ret; (void) rh; memset (&ctx, diff --git a/src/exchange/taler-exchange-httpd_transfers_get.h b/src/exchange/taler-exchange-httpd_transfers_get.h index 37f7dfbd4..83c173347 100644 --- a/src/exchange/taler-exchange-httpd_transfers_get.h +++ b/src/exchange/taler-exchange-httpd_transfers_get.h @@ -34,7 +34,7 @@ * @param args array of additional options (length: 1, just the wtid) * @return MHD result code */ -int +MHD_RESULT TEH_handler_transfers_get (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[1]); diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c index cb63355b6..38bbad4ad 100644 --- a/src/exchange/taler-exchange-httpd_wire.c +++ b/src/exchange/taler-exchange-httpd_wire.c @@ -295,7 +295,7 @@ load_account (void *cls, * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_wire (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]) diff --git a/src/exchange/taler-exchange-httpd_wire.h b/src/exchange/taler-exchange-httpd_wire.h index 219f1711b..7df874320 100644 --- a/src/exchange/taler-exchange-httpd_wire.h +++ b/src/exchange/taler-exchange-httpd_wire.h @@ -52,7 +52,7 @@ TEH_WIRE_done (void); * @param args array of additional options (must be empty for this function) * @return MHD result code */ -int +MHD_RESULT TEH_handler_wire (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const char *const args[]); diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index 152ebfbb0..4d662e712 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -51,7 +51,7 @@ * @param rh reserve history to return * @return MHD result code */ -static int +static MHD_RESULT reply_withdraw_insufficient_funds ( struct MHD_Connection *connection, const struct TALER_Amount *ebalance, @@ -173,7 +173,7 @@ static enum GNUNET_DB_QueryStatus withdraw_transaction (void *cls, struct MHD_Connection *connection, struct TALER_EXCHANGEDB_Session *session, - int *mhd_ret) + MHD_RESULT *mhd_ret) { struct WithdrawContext *wc = cls; struct TALER_EXCHANGEDB_Reserve r; @@ -343,7 +343,7 @@ withdraw_transaction (void *cls, * reserve public key, the second one should be "withdraw") * @return MHD result code */ -int +MHD_RESULT TEH_handler_withdraw (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const json_t *root, @@ -376,7 +376,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, } { - int res; + enum GNUNET_GenericReturnValue res; res = TALER_MHD_parse_json_data (connection, root, @@ -486,7 +486,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, /* run transaction and sign (if not optimistically signed before) */ { - int mhd_ret; + MHD_RESULT mhd_ret; if (GNUNET_OK != TEH_DB_run_transaction (connection, @@ -510,7 +510,7 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh, GNUNET_JSON_parse_free (spec); { - int ret; + MHD_RESULT ret; ret = TALER_MHD_reply_json_pack ( connection, diff --git a/src/exchange/taler-exchange-httpd_withdraw.h b/src/exchange/taler-exchange-httpd_withdraw.h index 7fc2fa01f..8b248597b 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.h +++ b/src/exchange/taler-exchange-httpd_withdraw.h @@ -42,7 +42,7 @@ * reserve public key, the second one should be "withdraw") * @return MHD result code */ -int +MHD_RESULT TEH_handler_withdraw (const struct TEH_RequestHandler *rh, struct MHD_Connection *connection, const json_t *root, diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h index 7100ad95c..71006e8bc 100644 --- a/src/include/taler_mhd_lib.h +++ b/src/include/taler_mhd_lib.h @@ -27,6 +27,8 @@ #include <jansson.h> #include <microhttpd.h> #include "taler_error_codes.h" +#include <gnunet/gnunet_mhd_compat.h> + /** * Global options for response generation. @@ -79,7 +81,7 @@ TALER_MHD_add_global_headers (struct MHD_Response *response); * @param[in,out] buf_size pointer to initial size of @a buf * @return #MHD_YES if @a buf was compressed */ -int +MHD_RESULT TALER_MHD_body_compress (void **buf, size_t *buf_size); @@ -90,7 +92,7 @@ TALER_MHD_body_compress (void **buf, * @param connection connection to check * @return #MHD_YES if 'deflate' compression is allowed */ -int +MHD_RESULT TALER_MHD_can_compress (struct MHD_Connection *connection); @@ -102,7 +104,7 @@ TALER_MHD_can_compress (struct MHD_Connection *connection); * @param response_code the http response code * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_json (struct MHD_Connection *connection, const json_t *json, unsigned int response_code); @@ -118,7 +120,7 @@ TALER_MHD_reply_json (struct MHD_Connection *connection, * @param ... varargs * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_json_pack (struct MHD_Connection *connection, unsigned int response_code, const char *fmt, @@ -134,7 +136,7 @@ TALER_MHD_reply_json_pack (struct MHD_Connection *connection, * @param hint human readable hint about the error * @return a MHD result code */ -int +MHD_RESULT TALER_MHD_reply_with_error (struct MHD_Connection *connection, unsigned int http_status, enum TALER_ErrorCode ec, @@ -181,7 +183,7 @@ TALER_MHD_make_error (enum TALER_ErrorCode ec, * @param connection the MHD connection to use * @return a MHD result code */ -int +MHD_RESULT TALER_MHD_reply_request_too_large (struct MHD_Connection *connection); @@ -193,7 +195,7 @@ TALER_MHD_reply_request_too_large (struct MHD_Connection *connection); * @param url where to redirect for the sources * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_agpl (struct MHD_Connection *connection, const char *url); @@ -209,7 +211,7 @@ TALER_MHD_reply_agpl (struct MHD_Connection *connection, * @param body_size number of bytes in @a body * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_static (struct MHD_Connection *connection, unsigned int http_status, const char *mime_type, @@ -241,7 +243,7 @@ TALER_MHD_reply_static (struct MHD_Connection *connection, * (we could not even queue an error message, * close HTTP session with MHD_NO) */ -int +enum GNUNET_GenericReturnValue TALER_MHD_parse_post_json (struct MHD_Connection *connection, void **con_cls, const char *upload_data, @@ -274,7 +276,7 @@ TALER_MHD_parse_post_cleanup_callback (void *con_cls); * #GNUNET_NO if json is malformed, error response was generated * #GNUNET_SYSERR on internal error */ -int +enum GNUNET_GenericReturnValue TALER_MHD_parse_json_data (struct MHD_Connection *connection, const json_t *root, struct GNUNET_JSON_Specification *spec); @@ -295,7 +297,7 @@ TALER_MHD_parse_json_data (struct MHD_Connection *connection, * #GNUNET_NO if json is malformed, error response was generated * #GNUNET_SYSERR on internal error */ -int +enum GNUNET_GenericReturnValue TALER_MHD_parse_json_array (struct MHD_Connection *connection, const json_t *root, struct GNUNET_JSON_Specification *spec, @@ -317,7 +319,7 @@ TALER_MHD_parse_json_array (struct MHD_Connection *connection, * #GNUNET_NO if the argument is absent or malformed * #GNUNET_SYSERR on internal error (error response could not be sent) */ -int +enum GNUNET_GenericReturnValue TALER_MHD_parse_request_arg_data (struct MHD_Connection *connection, const char *param_name, void *out_data, @@ -335,7 +337,7 @@ TALER_MHD_parse_request_arg_data (struct MHD_Connection *connection, * @param[out] unix_mode set to the mode to be used for @a unix_path * @return #GNUNET_OK on success */ -int +enum GNUNET_GenericReturnValue TALER_MHD_parse_config (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, uint16_t *rport, @@ -431,7 +433,7 @@ TALER_MHD_legal_free (struct TALER_MHD_Legal *legal); * @param legal legal document to serve * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_legal (struct MHD_Connection *conn, struct TALER_MHD_Legal *legal); @@ -443,7 +445,7 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn, * @param connection the MHD connection * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection); #endif diff --git a/src/mhd/mhd_config.c b/src/mhd/mhd_config.c index d8ae1da75..e2471e9b5 100644 --- a/src/mhd/mhd_config.c +++ b/src/mhd/mhd_config.c @@ -42,7 +42,7 @@ * @param[out] unix_mode set to the mode to be used for @a unix_path * @return #GNUNET_OK on success */ -int +enum GNUNET_GenericReturnValue TALER_MHD_parse_config (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, uint16_t *rport, diff --git a/src/mhd/mhd_legal.c b/src/mhd/mhd_legal.c index 7b1ba1c11..b7859da1c 100644 --- a/src/mhd/mhd_legal.c +++ b/src/mhd/mhd_legal.c @@ -155,7 +155,7 @@ language_matches (const char *language_pattern, * @param legal legal document to serve * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_legal (struct MHD_Connection *conn, struct TALER_MHD_Legal *legal) { @@ -174,7 +174,7 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn, (0 == strcasecmp (etag, legal->terms_etag)) ) { - int ret; + MHD_RESULT ret; resp = MHD_create_response_from_buffer (0, NULL, @@ -292,7 +292,7 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn, MHD_HTTP_HEADER_CONTENT_TYPE, t->mime_type)); { - int ret; + MHD_RESULT ret; ret = MHD_queue_response (conn, MHD_HTTP_OK, diff --git a/src/mhd/mhd_responses.c b/src/mhd/mhd_responses.c index 67b9097b8..45a9932d3 100644 --- a/src/mhd/mhd_responses.c +++ b/src/mhd/mhd_responses.c @@ -80,7 +80,7 @@ TALER_MHD_add_global_headers (struct MHD_Response *response) * itself. This should eventually be fixed, see also * https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */ -int +MHD_RESULT TALER_MHD_can_compress (struct MHD_Connection *connection) { const char *ae; @@ -118,13 +118,13 @@ TALER_MHD_can_compress (struct MHD_Connection *connection) * @param[in,out] buf_size pointer to initial size of @a buf * @return #MHD_YES if @a buf was compressed */ -int +MHD_RESULT TALER_MHD_body_compress (void **buf, size_t *buf_size) { Bytef *cbuf; uLongf cbuf_size; - int ret; + MHD_RESULT ret; cbuf_size = compressBound (*buf_size); cbuf = malloc (cbuf_size); @@ -193,7 +193,7 @@ TALER_MHD_make_json (const json_t *json) * @param response_code the http response code * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_json (struct MHD_Connection *connection, const json_t *json, unsigned int response_code) @@ -201,7 +201,7 @@ TALER_MHD_reply_json (struct MHD_Connection *connection, struct MHD_Response *response; void *json_str; size_t json_len; - int is_compressed; + MHD_RESULT is_compressed; json_str = json_dumps (json, JSON_INDENT (2)); @@ -253,7 +253,7 @@ TALER_MHD_reply_json (struct MHD_Connection *connection, } { - int ret; + MHD_RESULT ret; ret = MHD_queue_response (connection, response_code, @@ -271,7 +271,7 @@ TALER_MHD_reply_json (struct MHD_Connection *connection, * @param connection the MHD connection * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection) { struct MHD_Response *response; @@ -291,7 +291,7 @@ TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection) "*")); { - int ret; + MHD_RESULT ret; ret = MHD_queue_response (connection, MHD_HTTP_NO_CONTENT, @@ -312,7 +312,7 @@ TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection) * @param ... varargs * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_json_pack (struct MHD_Connection *connection, unsigned int response_code, const char *fmt, @@ -344,7 +344,7 @@ TALER_MHD_reply_json_pack (struct MHD_Connection *connection, } { - int ret; + MHD_RESULT ret; ret = TALER_MHD_reply_json (connection, json, @@ -426,7 +426,7 @@ TALER_MHD_make_error (enum TALER_ErrorCode ec, * @param hint human readable hint about the error * @return a MHD result code */ -int +MHD_RESULT TALER_MHD_reply_with_error (struct MHD_Connection *connection, unsigned int http_status, enum TALER_ErrorCode ec, @@ -446,7 +446,7 @@ TALER_MHD_reply_with_error (struct MHD_Connection *connection, * @param connection the MHD connection to use * @return a MHD result code */ -int +MHD_RESULT TALER_MHD_reply_request_too_large (struct MHD_Connection *connection) { struct MHD_Response *response; @@ -459,7 +459,7 @@ TALER_MHD_reply_request_too_large (struct MHD_Connection *connection) TALER_MHD_add_global_headers (response); { - int ret; + MHD_RESULT ret; ret = MHD_queue_response (connection, MHD_HTTP_REQUEST_ENTITY_TOO_LARGE, @@ -478,7 +478,7 @@ TALER_MHD_reply_request_too_large (struct MHD_Connection *connection) * @param url where to redirect for the sources * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_agpl (struct MHD_Connection *connection, const char *url) { @@ -510,7 +510,7 @@ TALER_MHD_reply_agpl (struct MHD_Connection *connection, } { - int ret; + MHD_RESULT ret; ret = MHD_queue_response (connection, MHD_HTTP_FOUND, @@ -532,7 +532,7 @@ TALER_MHD_reply_agpl (struct MHD_Connection *connection, * @param body_size number of bytes in @a body * @return MHD result code */ -int +MHD_RESULT TALER_MHD_reply_static (struct MHD_Connection *connection, unsigned int http_status, const char *mime_type, @@ -556,7 +556,7 @@ TALER_MHD_reply_static (struct MHD_Connection *connection, MHD_HTTP_HEADER_CONTENT_TYPE, mime_type)); { - int ret; + MHD_RESULT ret; ret = MHD_queue_response (connection, http_status, |