From 862054f6f2e9a08ccc051343d0dacde992ea1611 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 30 Nov 2020 23:43:16 +0100 Subject: expose new endpoint functions via headers --- src/exchange/Makefile.am | 3 +- src/exchange/taler-exchange-httpd_auditors.c | 10 +- src/exchange/taler-exchange-httpd_auditors.h | 46 +++++++ src/exchange/taler-exchange-httpd_management.h | 141 +++++++++++++++++++++ .../taler-exchange-httpd_management_auditors.c | 10 +- ...exchange-httpd_management_auditors_AP_disable.c | 10 +- ...nge-httpd_management_denominations_HDP_revoke.c | 10 +- .../taler-exchange-httpd_management_post_keys.c | 9 +- ...r-exchange-httpd_management_signkey_EP_revoke.c | 9 +- .../taler-exchange-httpd_management_wire.c | 8 +- .../taler-exchange-httpd_management_wire_disable.c | 9 +- .../taler-exchange-httpd_management_wire_fees.c | 8 +- 12 files changed, 198 insertions(+), 75 deletions(-) create mode 100644 src/exchange/taler-exchange-httpd_auditors.h create mode 100644 src/exchange/taler-exchange-httpd_management.h (limited to 'src/exchange') diff --git a/src/exchange/Makefile.am b/src/exchange/Makefile.am index a2a9840f4..bd7377a26 100644 --- 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 index 3833a2014..60c633cf5 100644 --- 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 new file mode 100644 index 000000000..de180587d --- /dev/null +++ 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 +*/ +/** + * @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 +#include +#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 new file mode 100644 index 000000000..cd5c5d8af --- /dev/null +++ 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 +*/ +/** + * @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 +#include +#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 index c794c9879..02e4d4fa2 100644 --- a/src/exchange/taler-exchange-httpd_management_auditors.c +++ b/src/exchange/taler-exchange-httpd_management_auditors.c @@ -26,7 +26,7 @@ #include #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 index 0a1d2c54d..8904b444d 100644 --- 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 #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 index bd4b5f342..eade5cd1a 100644 --- 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 #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 index c663a8b47..ab4399bd8 100644 --- 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 index bbe3ae10f..63a4f0c65 100644 --- 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 #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 index 812570fca..b684a107e 100644 --- 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 index 19a30fc23..d869d54d4 100644 --- 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 #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 index c126f056b..3ec262cf4 100644 --- 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, -- cgit v1.2.3