[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] 02/02: [build] Clear out unnecessary things in donau-httpd
From: |
gnunet |
Subject: |
[taler-donau] 02/02: [build] Clear out unnecessary things in donau-httpd.c |
Date: |
Mon, 27 Nov 2023 23:34:03 +0100 |
This is an automated email from the git hooks/post-receive script.
pius-loosli pushed a commit to branch master
in repository donau.
commit 7101c75d8a8cdb690eb37cec21287c4d37ee4182
Author: Pius Loosli <loosp2@bfh.ch>
AuthorDate: Mon Nov 27 23:33:07 2023 +0100
[build] Clear out unnecessary things in donau-httpd.c
---
src/donau/donau-httpd.c | 1073 +----------------------------------------------
1 file changed, 8 insertions(+), 1065 deletions(-)
diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c
index ad98d55..18b018d 100644
--- a/src/donau/donau-httpd.c
+++ b/src/donau/donau-httpd.c
@@ -20,59 +20,19 @@
* @author Benedikt Mueller
* @author Christian Grothoff
*/
-#include "platform.h"
+#include "taler/platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <jansson.h>
#include <microhttpd.h>
#include <sched.h>
#include <sys/resource.h>
#include <limits.h>
-#include "taler_kyclogic_lib.h"
-#include "taler_templating_lib.h"
-#include "taler_mhd_lib.h"
-#include "taler-donau-httpd_age-withdraw.h"
-#include "taler-donau-httpd_age-withdraw_reveal.h"
-#include "taler-donau-httpd_aml-decision.h"
-#include "taler-donau-httpd_auditors.h"
-#include "taler-donau-httpd_batch-deposit.h"
-#include "taler-donau-httpd_batch-withdraw.h"
-#include "taler-donau-httpd_config.h"
-#include "taler-donau-httpd_contract.h"
-#include "taler-donau-httpd_csr.h"
-#include "taler-donau-httpd_deposits_get.h"
-#include "taler-donau-httpd_extensions.h"
-#include "taler-donau-httpd_keys.h"
-#include "taler-donau-httpd_kyc-check.h"
-#include "taler-donau-httpd_kyc-proof.h"
-#include "taler-donau-httpd_kyc-wallet.h"
-#include "taler-donau-httpd_link.h"
-#include "taler-donau-httpd_management.h"
-#include "taler-donau-httpd_melt.h"
-#include "taler-donau-httpd_metrics.h"
-#include "taler-donau-httpd_mhd.h"
-#include "taler-donau-httpd_purses_create.h"
-#include "taler-donau-httpd_purses_deposit.h"
-#include "taler-donau-httpd_purses_get.h"
-#include "taler-donau-httpd_purses_delete.h"
-#include "taler-donau-httpd_purses_merge.h"
-#include "taler-donau-httpd_recoup.h"
-#include "taler-donau-httpd_recoup-refresh.h"
-#include "taler-donau-httpd_refreshes_reveal.h"
-#include "taler-donau-httpd_refund.h"
-#include "taler-donau-httpd_reserves_attest.h"
-#include "taler-donau-httpd_reserves_close.h"
-#include "taler-donau-httpd_reserves_get.h"
-#include "taler-donau-httpd_reserves_get_attest.h"
-#include "taler-donau-httpd_reserves_history.h"
-#include "taler-donau-httpd_reserves_open.h"
-#include "taler-donau-httpd_reserves_purse.h"
-#include "taler-donau-httpd_reserves_status.h"
-#include "taler-donau-httpd_terms.h"
-#include "taler-donau-httpd_transfers_get.h"
-#include "taler-donau-httpd_withdraw.h"
-#include "taler_donaudb_lib.h"
-#include "taler_donaudb_plugin.h"
-#include "taler_extensions.h"
+#include "taler/taler_templating_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "donau-httpd_terms.h"
+#include "donaudb_lib.h"
+#include "donaudb_plugin.h"
+#include "taler/taler_extensions.h"
#include <gnunet/gnunet_mhd_compat.h>
/**
@@ -290,569 +250,11 @@ r404 (struct MHD_Connection *connection,
{
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
- TALER_EC_DONAU_GENERIC_OPERATION_UNKNOWN,
+
TALER_EC_EXCHANGE_GENERIC_OPERATION_UNKNOWN,
details);
}
-/**
- * Handle a "/coins/$COIN_PUB/$OP" POST request. Parses the "coin_pub"
- * EdDSA key of the coin and demultiplexes based on $OP.
- *
- * @param rc request context
- * @param root uploaded JSON data
- * @param args array of additional options
- * @return MHD result code
- */
-static MHD_RESULT
-handle_post_coins (struct TEH_RequestContext *rc,
- const json_t *root,
- const char *const args[2])
-{
- struct TALER_CoinSpendPublicKeyP coin_pub;
- static const struct
- {
- /**
- * Name of the operation (args[1])
- */
- const char *op;
-
- /**
- * Function to call to perform the operation.
- */
- CoinOpHandler handler;
-
- } h[] = {
- {
- .op = "melt",
- .handler = &TEH_handler_melt
- },
- {
- .op = "recoup",
- .handler = &TEH_handler_recoup
- },
- {
- .op = "recoup-refresh",
- .handler = &TEH_handler_recoup_refresh
- },
- {
- .op = "refund",
- .handler = &TEH_handler_refund
- },
- {
- .op = NULL,
- .handler = NULL
- },
- };
-
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[0],
- strlen (args[0]),
- &coin_pub,
- sizeof (coin_pub)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
-
TALER_EC_DONAU_GENERIC_COINS_INVALID_COIN_PUB,
- args[0]);
- }
- for (unsigned int i = 0; NULL != h[i].op; i++)
- if (0 == strcmp (h[i].op,
- args[1]))
- return h[i].handler (rc->connection,
- &coin_pub,
- root);
- return r404 (rc->connection,
- args[1]);
-}
-
-
-/**
- * Signature of functions that handle operations
- * authorized by AML officers.
- *
- * @param rc request context
- * @param officer_pub the public key of the AML officer
- * @param root uploaded JSON data
- * @return MHD result code
- */
-typedef MHD_RESULT
-(*AmlOpPostHandler)(struct TEH_RequestContext *rc,
- const struct TALER_AmlOfficerPublicKeyP *officer_pub,
- const json_t *root);
-
-
-/**
- * Handle a "/aml/$OFFICER_PUB/$OP" POST request. Parses the "officer_pub"
- * EdDSA key of the officer and demultiplexes based on $OP.
- *
- * @param rc request context
- * @param root uploaded JSON data
- * @param args array of additional options
- * @return MHD result code
- */
-static MHD_RESULT
-handle_post_aml (struct TEH_RequestContext *rc,
- const json_t *root,
- const char *const args[2])
-{
- struct TALER_AmlOfficerPublicKeyP officer_pub;
- static const struct
- {
- /**
- * Name of the operation (args[1])
- */
- const char *op;
-
- /**
- * Function to call to perform the operation.
- */
- AmlOpPostHandler handler;
-
- } h[] = {
- {
- .op = "decision",
- .handler = &TEH_handler_post_aml_decision
- },
- {
- .op = NULL,
- .handler = NULL
- },
- };
-
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[0],
- strlen (args[0]),
- &officer_pub,
- sizeof (officer_pub)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
-
TALER_EC_DONAU_GENERIC_AML_OFFICER_PUB_MALFORMED,
- args[0]);
- }
- for (unsigned int i = 0; NULL != h[i].op; i++)
- if (0 == strcmp (h[i].op,
- args[1]))
- return h[i].handler (rc,
- &officer_pub,
- root);
- return r404 (rc->connection,
- args[1]);
-}
-
-
-/**
- * Signature of functions that handle operations
- * authorized by AML officers.
- *
- * @param rc request context
- * @param officer_pub the public key of the AML officer
- * @param args remaining arguments
- * @return MHD result code
- */
-typedef MHD_RESULT
-(*AmlOpGetHandler)(struct TEH_RequestContext *rc,
- const struct TALER_AmlOfficerPublicKeyP *officer_pub,
- const char *const args[]);
-
-
-/**
- * Handle a "/aml/$OFFICER_PUB/$OP" GET request. Parses the "officer_pub"
- * EdDSA key of the officer, checks the authentication signature, and
- * demultiplexes based on $OP.
- *
- * @param rc request context
- * @param args array of additional options
- * @return MHD result code
- */
-static MHD_RESULT
-handle_get_aml (struct TEH_RequestContext *rc,
- const char *const args[])
-{
- struct TALER_AmlOfficerPublicKeyP officer_pub;
- static const struct
- {
- /**
- * Name of the operation (args[1])
- */
- const char *op;
-
- /**
- * Function to call to perform the operation.
- */
- AmlOpGetHandler handler;
-
- } h[] = {
- {
- .op = "decisions",
- .handler = &TEH_handler_aml_decisions_get
- },
- {
- .op = "decision",
- .handler = &TEH_handler_aml_decision_get
- },
- {
- .op = NULL,
- .handler = NULL
- },
- };
-
- if (NULL == args[0])
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
-
TALER_EC_DONAU_GENERIC_AML_OFFICER_PUB_MALFORMED,
- "argument missing");
- }
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[0],
- strlen (args[0]),
- &officer_pub,
- sizeof (officer_pub)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
-
TALER_EC_DONAU_GENERIC_AML_OFFICER_PUB_MALFORMED,
- args[0]);
- }
- if (NULL == args[1])
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_NOT_FOUND,
-
TALER_EC_DONAU_GENERIC_WRONG_NUMBER_OF_SEGMENTS,
- "AML GET operations must specify an
operation identifier");
- }
- {
- const char *sig_hdr;
- struct TALER_AmlOfficerSignatureP officer_sig;
-
- sig_hdr = MHD_lookup_connection_value (rc->connection,
- MHD_HEADER_KIND,
- TALER_AML_OFFICER_SIGNATURE_HEADER);
- if ( (NULL == sig_hdr) ||
- (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (sig_hdr,
- strlen (sig_hdr),
- &officer_sig,
- sizeof (officer_sig))) ||
- (GNUNET_OK !=
- TALER_officer_aml_query_verify (&officer_pub,
- &officer_sig)) )
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
-
TALER_EC_DONAU_GENERIC_AML_OFFICER_GET_SIGNATURE_INVALID,
- sig_hdr);
- }
- TEH_METRICS_num_verifications[TEH_MT_SIGNATURE_EDDSA]++;
- }
-
- {
- enum GNUNET_DB_QueryStatus qs;
-
- qs = TEH_plugin->test_aml_officer (TEH_plugin->cls,
- &officer_pub);
- switch (qs)
- {
- case GNUNET_DB_STATUS_HARD_ERROR:
- case GNUNET_DB_STATUS_SOFT_ERROR:
- GNUNET_break (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- NULL);
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_FORBIDDEN,
-
TALER_EC_DONAU_GENERIC_AML_OFFICER_ACCESS_DENIED,
- NULL);
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- break;
- }
- }
- for (unsigned int i = 0; NULL != h[i].op; i++)
- if (0 == strcmp (h[i].op,
- args[1]))
- return h[i].handler (rc,
- &officer_pub,
- &args[2]);
- return r404 (rc->connection,
- args[1]);
-}
-
-
-/**
- * Handle a "/age-withdraw/$ACH/reveal" POST request. Parses the "ACH"
- * hash of the commitment from a previous call to
- * /reserves/$reserve_pub/age-withdraw
- *
- * @param rc request context
- * @param root uploaded JSON data
- * @param args array of additional options
- * @return MHD result code
- */
-static MHD_RESULT
-handle_post_age_withdraw (struct TEH_RequestContext *rc,
- const json_t *root,
- const char *const args[2])
-{
- struct TALER_AgeWithdrawCommitmentHashP ach;
-
- if (0 != strcmp ("reveal", args[1]))
- return r404 (rc->connection,
- args[1]);
-
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[0],
- strlen (args[0]),
- &ach,
- sizeof (ach)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_RESERVE_PUB_MALFORMED,
- args[0]);
- }
-
- return TEH_handler_age_withdraw_reveal (rc,
- &ach,
- root);
-}
-
-
-/**
- * Signature of functions that handle operations on reserves.
- *
- * @param rc request context
- * @param reserve_pub the public key of the reserve
- * @param root uploaded JSON data
- * @return MHD result code
- */
-typedef MHD_RESULT
-(*ReserveOpHandler)(struct TEH_RequestContext *rc,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- const json_t *root);
-
-
-/**
- * Handle a "/reserves/$RESERVE_PUB/$OP" POST request. Parses the
"reserve_pub"
- * EdDSA key of the reserve and demultiplexes based on $OP.
- *
- * @param rc request context
- * @param root uploaded JSON data
- * @param args array of additional options
- * @return MHD result code
- */
-static MHD_RESULT
-handle_post_reserves (struct TEH_RequestContext *rc,
- const json_t *root,
- const char *const args[2])
-{
- struct TALER_ReservePublicKeyP reserve_pub;
- static const struct
- {
- /**
- * Name of the operation (args[1])
- */
- const char *op;
-
- /**
- * Function to call to perform the operation.
- */
- ReserveOpHandler handler;
-
- } h[] = {
- {
- .op = "batch-withdraw",
- .handler = &TEH_handler_batch_withdraw
- },
- {
- .op = "age-withdraw",
- .handler = &TEH_handler_age_withdraw
- },
- {
- .op = "withdraw",
- .handler = &TEH_handler_withdraw
- },
- {
- .op = "status",
- .handler = &TEH_handler_reserves_status
- },
- {
- .op = "history",
- .handler = &TEH_handler_reserves_history
- },
- {
- .op = "purse",
- .handler = &TEH_handler_reserves_purse
- },
- {
- .op = "open",
- .handler = &TEH_handler_reserves_open
- },
- {
- .op = "close",
- .handler = &TEH_handler_reserves_close
- },
- {
- .op = NULL,
- .handler = NULL
- },
- };
-
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[0],
- strlen (args[0]),
- &reserve_pub,
- sizeof (reserve_pub)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_RESERVE_PUB_MALFORMED,
- args[0]);
- }
- for (unsigned int i = 0; NULL != h[i].op; i++)
- if (0 == strcmp (h[i].op,
- args[1]))
- return h[i].handler (rc,
- &reserve_pub,
- root);
- return r404 (rc->connection,
- args[1]);
-}
-
-
-/**
- * Signature of functions that handle operations on purses.
- *
- * @param connection HTTP request handle
- * @param purse_pub the public key of the purse
- * @param root uploaded JSON data
- * @return MHD result code
- */
-typedef MHD_RESULT
-(*PurseOpHandler)(struct MHD_Connection *connection,
- const struct TALER_PurseContractPublicKeyP *purse_pub,
- const json_t *root);
-
-
-/**
- * Handle a "/purses/$RESERVE_PUB/$OP" POST request. Parses the "purse_pub"
- * EdDSA key of the purse and demultiplexes based on $OP.
- *
- * @param rc request context
- * @param root uploaded JSON data
- * @param args array of additional options
- * @return MHD result code
- */
-static MHD_RESULT
-handle_post_purses (struct TEH_RequestContext *rc,
- const json_t *root,
- const char *const args[2])
-{
- struct TALER_PurseContractPublicKeyP purse_pub;
- static const struct
- {
- /**
- * Name of the operation (args[1])
- */
- const char *op;
-
- /**
- * Function to call to perform the operation.
- */
- PurseOpHandler handler;
-
- } h[] = {
- {
- .op = "create",
- .handler = &TEH_handler_purses_create
- },
- {
- .op = "deposit",
- .handler = &TEH_handler_purses_deposit
- },
- {
- .op = "merge",
- .handler = &TEH_handler_purses_merge
- },
- {
- .op = NULL,
- .handler = NULL
- },
- };
-
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[0],
- strlen (args[0]),
- &purse_pub,
- sizeof (purse_pub)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
-
TALER_EC_DONAU_GENERIC_PURSE_PUB_MALFORMED,
- args[0]);
- }
- for (unsigned int i = 0; NULL != h[i].op; i++)
- if (0 == strcmp (h[i].op,
- args[1]))
- return h[i].handler (rc->connection,
- &purse_pub,
- root);
- return r404 (rc->connection,
- args[1]);
-}
-
-
-/**
- * Increments our request counter and checks if this
- * process should commit suicide.
- */
-static void
-check_suicide (void)
-{
- int fd;
- pid_t chld;
- unsigned long long cnt;
-
- cnt = req_count++;
- if (req_max != cnt)
- return;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Restarting donau service after %llu requests\n",
- cnt);
- /* Stop accepting new connections */
- fd = MHD_quiesce_daemon (mhd);
- GNUNET_break (0 == close (fd));
- /* Continue handling existing connections in child,
- so that this process can die and be replaced by
- systemd with a fresh one */
- chld = fork ();
- if (-1 == chld)
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
- "fork");
- _exit (1);
- }
- if (0 != chld)
- {
- /* We are the parent, instant-suicide! */
- _exit (0);
- }
- TEH_suicide = true;
-}
-
-
/**
* Function called whenever MHD is done with a request. If the
* request was a POST, we may have stored a `struct Buffer *` in the
@@ -1092,304 +494,6 @@ handler_seed (struct TEH_RequestContext *rc,
}
-/**
- * Handle POST "/management/..." requests.
- *
- * @param rc request context
- * @param root uploaded JSON data
- * @param args array of additional options
- * @return MHD result code
- */
-static MHD_RESULT
-handle_post_management (struct TEH_RequestContext *rc,
- const json_t *root,
- const char *const args[])
-{
- if (NULL == args[0])
- {
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management");
- }
- if (0 == strcmp (args[0],
- "auditors"))
- {
- struct TALER_AuditorPublicKeyP auditor_pub;
-
- if (NULL == args[1])
- return TEH_handler_management_auditors (rc->connection,
- root);
- if ( (NULL == args[1]) ||
- (NULL == args[2]) ||
- (0 != strcmp (args[2],
- "disable")) ||
- (NULL != args[3]) )
- return r404 (rc->connection,
- "/management/auditors/$AUDITOR_PUB/disable");
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[1],
- strlen (args[1]),
- &auditor_pub,
- sizeof (auditor_pub)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- args[1]);
- }
- return TEH_handler_management_auditors_AP_disable (rc->connection,
- &auditor_pub,
- root);
- }
- if (0 == strcmp (args[0],
- "denominations"))
- {
- struct TALER_DenominationHashP h_denom_pub;
-
- if ( (NULL == args[0]) ||
- (NULL == args[1]) ||
- (NULL == args[2]) ||
- (0 != strcmp (args[2],
- "revoke")) ||
- (NULL != args[3]) )
- return r404 (rc->connection,
- "/management/denominations/$HDP/revoke");
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[1],
- strlen (args[1]),
- &h_denom_pub,
- sizeof (h_denom_pub)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- args[1]);
- }
- return TEH_handler_management_denominations_HDP_revoke (rc->connection,
- &h_denom_pub,
- root);
- }
- if (0 == strcmp (args[0],
- "signkeys"))
- {
- struct DONAU_DonauPublicKeyP donau_pub;
-
- if ( (NULL == args[0]) ||
- (NULL == args[1]) ||
- (NULL == args[2]) ||
- (0 != strcmp (args[2],
- "revoke")) ||
- (NULL != args[3]) )
- return r404 (rc->connection,
- "/management/signkeys/$HDP/revoke");
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[1],
- strlen (args[1]),
- &donau_pub,
- sizeof (donau_pub)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- args[1]);
- }
- return TEH_handler_management_signkeys_EP_revoke (rc->connection,
- &donau_pub,
- root);
- }
- /* FIXME-STYLE: all of the following can likely be nicely combined
- into an array-based dispatcher to deduplicate the logic... */
- if (0 == strcmp (args[0],
- "keys"))
- {
- if (NULL != args[1])
- {
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management/keys/*");
- }
- return TEH_handler_management_post_keys (rc->connection,
- root);
- }
- if (0 == strcmp (args[0],
- "wire"))
- {
- if (NULL == args[1])
- return TEH_handler_management_post_wire (rc->connection,
- root);
- if ( (0 != strcmp (args[1],
- "disable")) ||
- (NULL != args[2]) )
- {
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management/wire/disable");
- }
- return TEH_handler_management_post_wire_disable (rc->connection,
- root);
- }
- if (0 == strcmp (args[0],
- "wire-fee"))
- {
- if (NULL != args[1])
- {
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management/wire-fee/*");
- }
- return TEH_handler_management_post_wire_fees (rc->connection,
- root);
- }
- if (0 == strcmp (args[0],
- "global-fee"))
- {
- if (NULL != args[1])
- {
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management/global-fee/*");
- }
- return TEH_handler_management_post_global_fees (rc->connection,
- root);
- }
- if (0 == strcmp (args[0],
- "extensions"))
- {
- if (NULL != args[1])
- {
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management/extensions/*");
- }
- return TEH_handler_management_post_extensions (rc->connection,
- root);
- }
- if (0 == strcmp (args[0],
- "drain"))
- {
- if (NULL != args[1])
- {
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management/drain/*");
- }
- return TEH_handler_management_post_drain (rc->connection,
- root);
- }
- if (0 == strcmp (args[0],
- "aml-officers"))
- {
- if (NULL != args[1])
- {
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management/aml-officers/*");
- }
- return TEH_handler_management_aml_officers (rc->connection,
- root);
- }
- if (0 == strcmp (args[0],
- "partners"))
- {
- if (NULL != args[1])
- {
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management/partners/*");
- }
- return TEH_handler_management_partners (rc->connection,
- root);
- }
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management/*");
-}
-
-
-/**
- * Handle a GET "/management" request.
- *
- * @param rc request context
- * @param args array of additional options (must be [0] == "keys")
- * @return MHD result code
- */
-static MHD_RESULT
-handle_get_management (struct TEH_RequestContext *rc,
- const char *const args[2])
-{
- if ( (NULL != args[0]) &&
- (0 == strcmp (args[0],
- "keys")) &&
- (NULL == args[1]) )
- {
- return TEH_keys_management_get_keys_handler (rc->rh,
- rc->connection);
- }
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/management/*");
-}
-
-
-/**
- * Handle POST "/auditors/..." requests.
- *
- * @param rc request context
- * @param root uploaded JSON data
- * @param args array of additional options
- * @return MHD result code
- */
-static MHD_RESULT
-handle_post_auditors (struct TEH_RequestContext *rc,
- const json_t *root,
- const char *const args[])
-{
- struct TALER_AuditorPublicKeyP auditor_pub;
- struct TALER_DenominationHashP h_denom_pub;
-
- if ( (NULL == args[0]) ||
- (NULL == args[1]) ||
- (NULL != args[2]) )
- {
- GNUNET_break_op (0);
- return r404 (rc->connection,
- "/auditors/$AUDITOR_PUB/$H_DENOM_PUB");
- }
-
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[0],
- strlen (args[0]),
- &auditor_pub,
- sizeof (auditor_pub)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- args[0]);
- }
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (args[1],
- strlen (args[1]),
- &h_denom_pub,
- sizeof (h_denom_pub)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- args[1]);
- }
- return TEH_handler_auditors (rc->connection,
- &auditor_pub,
- &h_denom_pub,
- root);
-}
-
-
/**
* Handle incoming HTTP request.
*
@@ -1477,12 +581,6 @@ handle_mhd_request (void *cls,
.method = MHD_HTTP_METHOD_GET,
.handler.get = &TEH_keys_get_handler,
},
- {
- .url = "batch-deposit",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &TEH_handler_batch_deposit,
- .nargs = 0
- },
/* request R, used in clause schnorr withdraw and refresh */
{
.url = "csr-melt",
@@ -1490,161 +588,6 @@ handle_mhd_request (void *cls,
.handler.post = &TEH_handler_csr_melt,
.nargs = 0
},
- {
- .url = "csr-withdraw",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &TEH_handler_csr_withdraw,
- .nargs = 0
- },
- /* Withdrawing coins / interaction with reserves */
- {
- .url = "reserves",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &TEH_handler_reserves_get,
- .nargs = 1
- },
- {
- .url = "reserves",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &handle_post_reserves,
- .nargs = 2
- },
- {
- .url = "age-withdraw",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &handle_post_age_withdraw,
- .nargs = 2
- },
- {
- .url = "reserves-attest",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &TEH_handler_reserves_get_attest,
- .nargs = 1
- },
- {
- .url = "reserves-attest",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &TEH_handler_reserves_attest,
- .nargs = 1
- },
- /* coins */
- {
- .url = "coins",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &handle_post_coins,
- .nargs = 2
- },
- {
- .url = "coins",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = TEH_handler_link,
- .nargs = 2,
- },
- /* refreshes/$RCH/reveal */
- {
- .url = "refreshes",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &TEH_handler_reveal,
- .nargs = 2
- },
- /* tracking transfers */
- {
- .url = "transfers",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &TEH_handler_transfers_get,
- .nargs = 1
- },
- /* tracking deposits */
- {
- .url = "deposits",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &TEH_handler_deposits_get,
- .nargs = 4
- },
- /* Operating on purses */
- {
- .url = "purses",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &handle_post_purses,
- .nargs = 2
- },
- /* Getting purse status */
- {
- .url = "purses",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &TEH_handler_purses_get,
- .nargs = 2
- },
- /* Deleting purse */
- {
- .url = "purses",
- .method = MHD_HTTP_METHOD_DELETE,
- .handler.delete = &TEH_handler_purses_delete,
- .nargs = 1
- },
- /* Getting contracts */
- {
- .url = "contracts",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &TEH_handler_contracts_get,
- .nargs = 1
- },
- /* KYC endpoints */
- {
- .url = "kyc-check",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &TEH_handler_kyc_check,
- .nargs = 3
- },
- {
- .url = "kyc-proof",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &TEH_handler_kyc_proof,
- .nargs = 1
- },
- {
- .url = "kyc-wallet",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &TEH_handler_kyc_wallet,
- .nargs = 0
- },
- /* POST management endpoints */
- {
- .url = "management",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &handle_post_management,
- .nargs = 4,
- .nargs_is_upper_bound = true
- },
- /* GET management endpoints (we only really have "/management/keys") */
- {
- .url = "management",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &handle_get_management,
- .nargs = 1
- },
- /* auditor endpoints */
- {
- .url = "auditors",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &handle_post_auditors,
- .nargs = 4,
- .nargs_is_upper_bound = true
- },
- /* AML endpoints */
- {
- .url = "aml",
- .method = MHD_HTTP_METHOD_GET,
- .handler.get = &handle_get_aml,
- .nargs = 4,
- .nargs_is_upper_bound = true
- },
- {
- .url = "aml",
- .method = MHD_HTTP_METHOD_POST,
- .handler.post = &handle_post_aml,
- .nargs = 2
- },
/* mark end of list */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.