expose new endpoint functions via headers

This commit is contained in:
Christian Grothoff 2020-11-30 23:43:16 +01:00
parent 9ee7d665bd
commit 862054f6f2
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
12 changed files with 198 additions and 75 deletions

View File

@ -78,12 +78,13 @@ taler_exchange_transfer_LDADD = \
taler_exchange_httpd_SOURCES = \ taler_exchange_httpd_SOURCES = \
taler-exchange-httpd.c taler-exchange-httpd.h \ 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_db.c taler-exchange-httpd_db.h \
taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.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_deposits_get.c taler-exchange-httpd_deposits_get.h \
taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \ taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \
taler-exchange-httpd_link.c taler-exchange-httpd_link.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.c \
taler-exchange-httpd_management_auditors_AP_disable.c \ taler-exchange-httpd_management_auditors_AP_disable.c \
taler-exchange-httpd_management_denominations_HDP_revoke.c \ taler-exchange-httpd_management_denominations_HDP_revoke.c \

View File

@ -27,6 +27,7 @@
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_lib.h" #include "taler_mhd_lib.h"
#include "taler_signatures.h" #include "taler_signatures.h"
#include "taler-exchange-httpd_auditors.h"
#include "taler-exchange-httpd_responses.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 MHD_RESULT
TEH_handler_management_denominations_auditors ( TEH_handler_management_denominations_auditors (
struct MHD_Connection *connection, struct MHD_Connection *connection,

View File

@ -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

View File

@ -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

View File

@ -26,7 +26,7 @@
#include <pthread.h> #include <pthread.h>
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_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_responses.h"
#include "taler-exchange-httpd_keystate.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 MHD_RESULT
TEH_handler_management_auditors ( TEH_handler_management_auditors (
struct MHD_Connection *connection, struct MHD_Connection *connection,

View File

@ -26,7 +26,7 @@
#include <pthread.h> #include <pthread.h>
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_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_responses.h"
#include "taler-exchange-httpd_keystate.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 MHD_RESULT
TEH_handler_management_auditors_AP_disable ( TEH_handler_management_auditors_AP_disable (
struct MHD_Connection *connection, struct MHD_Connection *connection,

View File

@ -26,19 +26,11 @@
#include <pthread.h> #include <pthread.h>
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_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_responses.h"
#include "taler-exchange-httpd_keystate.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 MHD_RESULT
TEH_handler_management_denominations_HDP_revoke ( TEH_handler_management_denominations_HDP_revoke (
struct MHD_Connection *connection, struct MHD_Connection *connection,

View File

@ -27,6 +27,7 @@
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_lib.h" #include "taler_mhd_lib.h"
#include "taler_signatures.h" #include "taler_signatures.h"
#include "taler-exchange-httpd_management.h"
#include "taler-exchange-httpd_responses.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 MHD_RESULT
TEH_handler_management_post_keys ( TEH_handler_management_post_keys (
struct MHD_Connection *connection, struct MHD_Connection *connection,

View File

@ -26,18 +26,11 @@
#include <pthread.h> #include <pthread.h>
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_lib.h" #include "taler_mhd_lib.h"
#include "taler-exchange-httpd_management.h"
#include "taler-exchange-httpd_responses.h" #include "taler-exchange-httpd_responses.h"
#include "taler-exchange-httpd_keystate.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 MHD_RESULT
TEH_handler_management_signkeys_EP_revoke ( TEH_handler_management_signkeys_EP_revoke (
struct MHD_Connection *connection, struct MHD_Connection *connection,

View File

@ -27,6 +27,7 @@
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_lib.h" #include "taler_mhd_lib.h"
#include "taler_signatures.h" #include "taler_signatures.h"
#include "taler-exchange-httpd_management.h"
#include "taler-exchange-httpd_responses.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 MHD_RESULT
TEH_handler_management_denominations_wire ( TEH_handler_management_denominations_wire (
struct MHD_Connection *connection, struct MHD_Connection *connection,

View File

@ -26,7 +26,7 @@
#include <pthread.h> #include <pthread.h>
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_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_responses.h"
#include "taler-exchange-httpd_keystate.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 MHD_RESULT
TEH_handler_management_denominations_wire_disable ( TEH_handler_management_denominations_wire_disable (
struct MHD_Connection *connection, struct MHD_Connection *connection,

View File

@ -27,6 +27,7 @@
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_lib.h" #include "taler_mhd_lib.h"
#include "taler_signatures.h" #include "taler_signatures.h"
#include "taler-exchange-httpd_management.h"
#include "taler-exchange-httpd_responses.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 MHD_RESULT
TEH_handler_management_post_wire_fees ( TEH_handler_management_post_wire_fees (
struct MHD_Connection *connection, struct MHD_Connection *connection,