diff options
Diffstat (limited to 'src/auditor')
-rw-r--r-- | src/auditor/Makefile.am | 1 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd.c | 4 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd_exchanges.c | 116 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd_exchanges.h | 46 |
4 files changed, 0 insertions, 167 deletions
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am index 2a51ed27a..c3deedba1 100644 --- a/src/auditor/Makefile.am +++ b/src/auditor/Makefile.am @@ -163,7 +163,6 @@ taler_helper_auditor_wire_LDADD = \ taler_auditor_httpd_SOURCES = \ taler-auditor-httpd.c taler-auditor-httpd.h \ taler-auditor-httpd_deposit-confirmation.c taler-auditor-httpd_deposit-confirmation.h \ - taler-auditor-httpd_exchanges.c taler-auditor-httpd_exchanges.h \ taler-auditor-httpd_mhd.c taler-auditor-httpd_mhd.h taler_auditor_httpd_LDADD = \ $(LIBGCRYPT_LIBS) \ diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c index c1853d84a..0bb9c77d9 100644 --- a/src/auditor/taler-auditor-httpd.c +++ b/src/auditor/taler-auditor-httpd.c @@ -31,7 +31,6 @@ #include "taler_auditordb_lib.h" #include "taler_exchangedb_lib.h" #include "taler-auditor-httpd_deposit-confirmation.h" -#include "taler-auditor-httpd_exchanges.h" #include "taler-auditor-httpd_mhd.h" #include "taler-auditor-httpd.h" @@ -212,9 +211,6 @@ handle_mhd_request (void *cls, // { "/deposit-confirmation", MHD_HTTP_METHOD_DELETE, "application/json", // NULL, 0, // &TAH_DEPOSIT_CONFIRMATION_delete, MHD_HTTP_OK }, - { "/exchanges", MHD_HTTP_METHOD_GET, "application/json", - NULL, 0, - &TAH_EXCHANGES_handler, MHD_HTTP_OK }, { "/config", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, &handle_config, MHD_HTTP_OK }, diff --git a/src/auditor/taler-auditor-httpd_exchanges.c b/src/auditor/taler-auditor-httpd_exchanges.c deleted file mode 100644 index f9a9e9e60..000000000 --- a/src/auditor/taler-auditor-httpd_exchanges.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2014-2021 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-auditor-httpd_exchanges.c - * @brief Handle /exchanges requests; returns list of exchanges we audit - * @author Christian Grothoff - */ -#include "platform.h" -#include <gnunet/gnunet_util_lib.h> -#include <gnunet/gnunet_json_lib.h> -#include <jansson.h> -#include <microhttpd.h> -#include <pthread.h> -#include "taler_json_lib.h" -#include "taler_mhd_lib.h" -#include "taler-auditor-httpd.h" -#include "taler-auditor-httpd_exchanges.h" - - -/** - * Add exchange information to the list. - * - * @param[in,out] cls a `json_t *` array to extend - * @param master_pub master public key of an exchange - * @param exchange_url base URL of an exchange - */ -static void -add_exchange (void *cls, - const struct TALER_MasterPublicKeyP *master_pub, - const char *exchange_url) -{ - json_t *list = cls; - json_t *obj; - - obj = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("master_pub", - master_pub), - GNUNET_JSON_pack_string ("exchange_url", - exchange_url)); - GNUNET_break (0 == - json_array_append_new (list, - obj)); - -} - - -/** - * Handle a "/exchanges" request. - * - * @param rh context of the handler - * @param connection the MHD connection to handle - * @param[in,out] connection_cls the connection's closure (can be updated) - * @param upload_data upload data - * @param[in,out] upload_data_size number of bytes (left) in @a upload_data - * @return MHD result code - */ -MHD_RESULT -TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size) -{ - json_t *ja; - enum GNUNET_DB_QueryStatus qs; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - if (GNUNET_SYSERR == - TAH_plugin->preflight (TAH_plugin->cls)) - { - GNUNET_break (0); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_SETUP_FAILED, - NULL); - } - ja = json_array (); - GNUNET_break (NULL != ja); - qs = TAH_plugin->list_exchanges (TAH_plugin->cls, - &add_exchange, - ja); - if (0 > qs) - { - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - json_decref (ja); - TALER_LOG_WARNING ("Failed to handle /exchanges in database\n"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "exchanges"); - } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("exchanges", - ja)); -} - - -/* end of taler-auditor-httpd_exchanges.c */ diff --git a/src/auditor/taler-auditor-httpd_exchanges.h b/src/auditor/taler-auditor-httpd_exchanges.h deleted file mode 100644 index c7d8dd5fd..000000000 --- a/src/auditor/taler-auditor-httpd_exchanges.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2018 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-auditor-httpd_exchanges.h - * @brief Handle /exchanges requests - * @author Christian Grothoff - */ -#ifndef TALER_AUDITOR_HTTPD_EXCHANGES_H -#define TALER_AUDITOR_HTTPD_EXCHANGES_H - -#include <gnunet/gnunet_util_lib.h> -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - - -/** - * Handle a "/exchanges" request. - * - * @param rh context of the handler - * @param connection the MHD connection to handle - * @param[in,out] connection_cls the connection's closure (can be updated) - * @param upload_data upload data - * @param[in,out] upload_data_size number of bytes (left) in @a upload_data - * @return MHD result code - */ -MHD_RESULT -TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size); - -#endif |