exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 862054f6f2e9a08ccc051343d0dacde992ea1611
parent 9ee7d665bdf39716b4a3b2b0a528d4bd68fdef1a
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon, 30 Nov 2020 23:43:16 +0100

expose new endpoint functions via headers

Diffstat:
Msrc/exchange/Makefile.am | 3++-
Msrc/exchange/taler-exchange-httpd_auditors.c | 10+---------
Asrc/exchange/taler-exchange-httpd_auditors.h | 46++++++++++++++++++++++++++++++++++++++++++++++
Asrc/exchange/taler-exchange-httpd_management.h | 141+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/exchange/taler-exchange-httpd_management_auditors.c | 10+---------
Msrc/exchange/taler-exchange-httpd_management_auditors_AP_disable.c | 10+---------
Msrc/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c | 10+---------
Msrc/exchange/taler-exchange-httpd_management_post_keys.c | 9+--------
Msrc/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c | 9+--------
Msrc/exchange/taler-exchange-httpd_management_wire.c | 8+-------
Msrc/exchange/taler-exchange-httpd_management_wire_disable.c | 9+--------
Msrc/exchange/taler-exchange-httpd_management_wire_fees.c | 8+-------
12 files changed, 198 insertions(+), 75 deletions(-)

diff --git a/src/exchange/Makefile.am b/src/exchange/Makefile.am @@ -78,12 +78,13 @@ taler_exchange_transfer_LDADD = \ taler_exchange_httpd_SOURCES = \ taler-exchange-httpd.c taler-exchange-httpd.h \ - taler-exchange-httpd_auditors.c \ + taler-exchange-httpd_auditors.c taler-exchange-httpd_auditors.h \ taler-exchange-httpd_db.c taler-exchange-httpd_db.h \ taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.h \ taler-exchange-httpd_deposits_get.c taler-exchange-httpd_deposits_get.h \ taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \ taler-exchange-httpd_link.c taler-exchange-httpd_link.h \ + taler-exchange-httpd_management.h \ taler-exchange-httpd_management_auditors.c \ taler-exchange-httpd_management_auditors_AP_disable.c \ taler-exchange-httpd_management_denominations_HDP_revoke.c \ diff --git a/src/exchange/taler-exchange-httpd_auditors.c b/src/exchange/taler-exchange-httpd_auditors.c @@ -27,6 +27,7 @@ #include "taler_json_lib.h" #include "taler_mhd_lib.h" #include "taler_signatures.h" +#include "taler-exchange-httpd_auditors.h" #include "taler-exchange-httpd_responses.h" @@ -207,15 +208,6 @@ add_auditor_denom_sig (void *cls, } -/** - * Handle a "/auditors/$AUDITOR_PUB/$H_DENOM_PUB" request. - * - * @param connection the MHD connection to handle - * @param root uploaded JSON data - * @param auditor_pub public key of the auditor - * @param h_denom_pub hash of the denomination public key - * @return MHD result code - */ MHD_RESULT TEH_handler_management_denominations_auditors ( struct MHD_Connection *connection, diff --git a/src/exchange/taler-exchange-httpd_auditors.h b/src/exchange/taler-exchange-httpd_auditors.h @@ -0,0 +1,46 @@ +/* + This file is part of TALER + Copyright (C) 2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU Affero 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +*/ +/** + * @file taler-exchange-httpd_auditors.h + * @brief Handlers for the /auditors/ endpoints + * @author Christian Grothoff + */ +#ifndef TALER_EXCHANGE_HTTPD_AUDITORS_H +#define TALER_EXCHANGE_HTTPD_AUDITORS_H + +#include <gnunet/gnunet_util_lib.h> +#include <microhttpd.h> +#include "taler-exchange-httpd.h" + + +/** + * Handle a "/auditors/$AUDITOR_PUB/$H_DENOM_PUB" request. + * + * @param connection the MHD connection to handle + * @param root uploaded JSON data + * @param auditor_pub public key of the auditor + * @param h_denom_pub hash of the denomination public key + * @return MHD result code + */ +MHD_RESULT +TEH_handler_management_denominations_auditors ( + struct MHD_Connection *connection, + const struct TALER_AuditorPublicKeyP *auditor_pub, + const struct GNUNET_HashCode *h_denom_pub, + const json_t *root); + + +#endif diff --git a/src/exchange/taler-exchange-httpd_management.h b/src/exchange/taler-exchange-httpd_management.h @@ -0,0 +1,141 @@ +/* + This file is part of TALER + Copyright (C) 2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU Affero 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +*/ +/** + * @file taler-exchange-httpd_management.h + * @brief Handlers for the /management/ endpoints + * @author Christian Grothoff + */ +#ifndef TALER_EXCHANGE_HTTPD_MANAGEMENT_H +#define TALER_EXCHANGE_HTTPD_MANAGEMENT_H + +#include <gnunet/gnunet_util_lib.h> +#include <microhttpd.h> +#include "taler-exchange-httpd.h" + +/** + * Handle a "/management/auditors" request. + * + * @param connection the MHD connection to handle + * @param h_denom_pub hash of the public key of the denomination to revoke + * @param root uploaded JSON data + * @return MHD result code + */ +MHD_RESULT +TEH_handler_management_auditors ( + struct MHD_Connection *connection, + const struct GNUNET_HashCode *h_denom_pub, + const json_t *root); + + +/** + * Handle a "/management/auditors/$AUDITOR_PUB/disable" request. + * + * @param connection the MHD connection to handle + * @param h_denom_pub hash of the public key of the denomination to revoke + * @param root uploaded JSON data + * @return MHD result code + */ +MHD_RESULT +TEH_handler_management_auditors_AP_disable ( + struct MHD_Connection *connection, + const struct GNUNET_HashCode *h_denom_pub, + const json_t *root); + + +/** + * Handle a "/management/denominations/$HDP/revoke" request. + * + * @param connection the MHD connection to handle + * @param h_denom_pub hash of the public key of the denomination to revoke + * @param root uploaded JSON data + * @return MHD result code + */ +MHD_RESULT +TEH_handler_management_denominations_HDP_revoke ( + struct MHD_Connection *connection, + const struct GNUNET_HashCode *h_denom_pub, + const json_t *root); + + +/** + * Handle a "/management/signkeys/$EP/revoke" request. + * + * @param connection the MHD connection to handle + * @param exchange_pub exchange online signing public key to revoke + * @param root uploaded JSON data + * @return MHD result code + */ +MHD_RESULT +TEH_handler_management_signkeys_EP_revoke ( + struct MHD_Connection *connection, + const struct TALER_ExchangePublicKeyP *exchange_pub, + const json_t *root); + + +/** + * Handle a POST "/management/keys" request. + * + * @param connection the MHD connection to handle + * @param h_denom_pub hash of the public key of the denomination to revoke + * @param root uploaded JSON data + * @return MHD result code + */ +MHD_RESULT +TEH_handler_management_post_keys ( + struct MHD_Connection *connection, + const struct GNUNET_HashCode *h_denom_pub, + const json_t *root); + +/** + * Handle a "/management/wire" request. + * + * @param connection the MHD connection to handle + * @param root uploaded JSON data + * @return MHD result code + */ +MHD_RESULT +TEH_handler_management_denominations_wire ( + struct MHD_Connection *connection, + const json_t *root); + + +/** + * Handle a "/management/wire" request. + * + * @param connection the MHD connection to handle + * @param root uploaded JSON data + * @return MHD result code + */ +MHD_RESULT +TEH_handler_management_denominations_wire_disable ( + struct MHD_Connection *connection, + const json_t *root); + + +/** + * Handle a POST "/management/wire-fees" request. + * + * @param connection the MHD connection to handle + * @param root uploaded JSON data + * @return MHD result code + */ +MHD_RESULT +TEH_handler_management_post_wire_fees ( + struct MHD_Connection *connection, + const json_t *root); + + +#endif diff --git a/src/exchange/taler-exchange-httpd_management_auditors.c b/src/exchange/taler-exchange-httpd_management_auditors.c @@ -26,7 +26,7 @@ #include <pthread.h> #include "taler_json_lib.h" #include "taler_mhd_lib.h" -#include "taler-exchange-httpd_refund.h" +#include "taler-exchange-httpd_management.h" #include "taler-exchange-httpd_responses.h" #include "taler-exchange-httpd_keystate.h" @@ -142,14 +142,6 @@ add_auditor (void *cls, } -/** - * Handle a "/management/auditors" request. - * - * @param connection the MHD connection to handle - * @param h_denom_pub hash of the public key of the denomination to revoke - * @param root uploaded JSON data - * @return MHD result code - */ MHD_RESULT TEH_handler_management_auditors ( struct MHD_Connection *connection, diff --git a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c @@ -26,7 +26,7 @@ #include <pthread.h> #include "taler_json_lib.h" #include "taler_mhd_lib.h" -#include "taler-exchange-httpd_refund.h" +#include "taler-exchange-httpd_management.h" #include "taler-exchange-httpd_responses.h" #include "taler-exchange-httpd_keystate.h" @@ -134,14 +134,6 @@ del_auditor (void *cls, } -/** - * Handle a "/management/auditors/$AUDITOR_PUB/disable" request. - * - * @param connection the MHD connection to handle - * @param h_denom_pub hash of the public key of the denomination to revoke - * @param root uploaded JSON data - * @return MHD result code - */ MHD_RESULT TEH_handler_management_auditors_AP_disable ( struct MHD_Connection *connection, diff --git a/src/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c b/src/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c @@ -26,19 +26,11 @@ #include <pthread.h> #include "taler_json_lib.h" #include "taler_mhd_lib.h" -#include "taler-exchange-httpd_refund.h" +#include "taler-exchange-httpd_management.h" #include "taler-exchange-httpd_responses.h" #include "taler-exchange-httpd_keystate.h" -/** - * Handle a "/management/denominations/$HDP/revoke" request. - * - * @param connection the MHD connection to handle - * @param h_denom_pub hash of the public key of the denomination to revoke - * @param root uploaded JSON data - * @return MHD result code - */ MHD_RESULT TEH_handler_management_denominations_HDP_revoke ( struct MHD_Connection *connection, diff --git a/src/exchange/taler-exchange-httpd_management_post_keys.c b/src/exchange/taler-exchange-httpd_management_post_keys.c @@ -27,6 +27,7 @@ #include "taler_json_lib.h" #include "taler_mhd_lib.h" #include "taler_signatures.h" +#include "taler-exchange-httpd_management.h" #include "taler-exchange-httpd_responses.h" @@ -319,14 +320,6 @@ add_keys (void *cls, } -/** - * Handle a POST "/management/keys" request. - * - * @param connection the MHD connection to handle - * @param h_denom_pub hash of the public key of the denomination to revoke - * @param root uploaded JSON data - * @return MHD result code - */ MHD_RESULT TEH_handler_management_post_keys ( struct MHD_Connection *connection, diff --git a/src/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c b/src/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c @@ -26,18 +26,11 @@ #include <pthread.h> #include "taler_json_lib.h" #include "taler_mhd_lib.h" +#include "taler-exchange-httpd_management.h" #include "taler-exchange-httpd_responses.h" #include "taler-exchange-httpd_keystate.h" -/** - * Handle a "/management/signkeys/$EP/revoke" request. - * - * @param connection the MHD connection to handle - * @param exchange_pub exchange online signing public key to revoke - * @param root uploaded JSON data - * @return MHD result code - */ MHD_RESULT TEH_handler_management_signkeys_EP_revoke ( struct MHD_Connection *connection, diff --git a/src/exchange/taler-exchange-httpd_management_wire.c b/src/exchange/taler-exchange-httpd_management_wire.c @@ -27,6 +27,7 @@ #include "taler_json_lib.h" #include "taler_mhd_lib.h" #include "taler_signatures.h" +#include "taler-exchange-httpd_management.h" #include "taler-exchange-httpd_responses.h" @@ -136,13 +137,6 @@ add_wire (void *cls, } -/** - * Handle a "/management/wire" request. - * - * @param connection the MHD connection to handle - * @param root uploaded JSON data - * @return MHD result code - */ MHD_RESULT TEH_handler_management_denominations_wire ( struct MHD_Connection *connection, diff --git a/src/exchange/taler-exchange-httpd_management_wire_disable.c b/src/exchange/taler-exchange-httpd_management_wire_disable.c @@ -26,7 +26,7 @@ #include <pthread.h> #include "taler_json_lib.h" #include "taler_mhd_lib.h" -#include "taler-exchange-httpd_refund.h" +#include "taler-exchange-httpd_management.h" #include "taler-exchange-httpd_responses.h" #include "taler-exchange-httpd_keystate.h" @@ -132,13 +132,6 @@ del_wire (void *cls, } -/** - * Handle a "/management/wire" request. - * - * @param connection the MHD connection to handle - * @param root uploaded JSON data - * @return MHD result code - */ MHD_RESULT TEH_handler_management_denominations_wire_disable ( struct MHD_Connection *connection, diff --git a/src/exchange/taler-exchange-httpd_management_wire_fees.c b/src/exchange/taler-exchange-httpd_management_wire_fees.c @@ -27,6 +27,7 @@ #include "taler_json_lib.h" #include "taler_mhd_lib.h" #include "taler_signatures.h" +#include "taler-exchange-httpd_management.h" #include "taler-exchange-httpd_responses.h" @@ -162,13 +163,6 @@ add_fee (void *cls, } -/** - * Handle a POST "/management/wire-fees" request. - * - * @param connection the MHD connection to handle - * @param root uploaded JSON data - * @return MHD result code - */ MHD_RESULT TEH_handler_management_post_wire_fees ( struct MHD_Connection *connection,