diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-07-17 23:41:13 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-07-29 12:18:46 +0200 |
commit | 4716fe3926d3ac32a6d304b992d092075dc1af7b (patch) | |
tree | 9fdc0679210ae9ab59f943e5633529345ab11f10 | |
parent | 9f1f96bd724224dee565551ca2efd9e60bd6f8ec (diff) |
-fix auditor insanity
47 files changed, 401 insertions, 4357 deletions
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am index 2d03d48d8..884b68117 100644 --- a/src/auditor/Makefile.am +++ b/src/auditor/Makefile.am @@ -179,105 +179,83 @@ taler_auditor_httpd_SOURCES = \ taler-auditor-httpd_emergency-put.c taler-auditor-httpd_emergency-put.h \ taler-auditor-httpd_emergency-get.c taler-auditor-httpd_emergency-get.h \ taler-auditor-httpd_emergency-del.c taler-auditor-httpd_emergency-del.h \ - taler-auditor-httpd_emergency-by-count-put.c taler-auditor-httpd_emergency-by-count-put.h \ - taler-auditor-httpd_emergency-by-count-get.c taler-auditor-httpd_emergency-by-count-get.h \ - taler-auditor-httpd_emergency-by-count-del.c taler-auditor-httpd_emergency-by-count-del.h \ - taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.h \ - taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.h \ - taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-del.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-del.h \ - taler-auditor-httpd_purse-not-closed-inconsistencies-put.c taler-auditor-httpd_purse-not-closed-inconsistencies-put.h \ - taler-auditor-httpd_purse-not-closed-inconsistencies-get.c taler-auditor-httpd_purse-not-closed-inconsistencies-get.h \ - taler-auditor-httpd_purse-not-closed-inconsistencies-del.c taler-auditor-httpd_purse-not-closed-inconsistencies-del.h \ - taler-auditor-httpd_reserve-balance-insufficient-inconsistency-put.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-put.h \ - taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.h \ - taler-auditor-httpd_reserve-balance-insufficient-inconsistency-del.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-del.h \ - taler-auditor-httpd_bad-sig-losses-put.c taler-auditor-httpd_bad-sig-losses-put.h \ - taler-auditor-httpd_bad-sig-losses-get.c taler-auditor-httpd_bad-sig-losses-get.h \ - taler-auditor-httpd_bad-sig-losses-del.c taler-auditor-httpd_bad-sig-losses-del.h \ - taler-auditor-httpd_bad-sig-losses-upd.c taler-auditor-httpd_bad-sig-losses-upd.h \ - taler-auditor-httpd_closure-lags-put.c taler-auditor-httpd_closure-lags-put.h \ - taler-auditor-httpd_closure-lags-get.c taler-auditor-httpd_closure-lags-get.h \ - taler-auditor-httpd_closure-lags-del.c taler-auditor-httpd_closure-lags-del.h \ - taler-auditor-httpd_progress-put.c taler-auditor-httpd_progress-put.h \ - taler-auditor-httpd_progress-get.c taler-auditor-httpd_progress-get.h \ - taler-auditor-httpd_progress-del.c taler-auditor-httpd_progress-del.h \ - taler-auditor-httpd_refreshes-hanging-put.c taler-auditor-httpd_refreshes-hanging-put.h \ - taler-auditor-httpd_refreshes-hanging-get.c taler-auditor-httpd_refreshes-hanging-get.h \ - taler-auditor-httpd_refreshes-hanging-del.c taler-auditor-httpd_refreshes-hanging-del.h \ - taler-auditor-httpd_emergency-by-count-upd.c taler-auditor-httpd_emergency-by-count-upd.h \ - taler-auditor-httpd_row-inconsistency-upd.c taler-auditor-httpd_row-inconsistency-upd.h \ - taler-auditor-httpd_purse-not-closed-inconsistencies-upd.c taler-auditor-httpd_purse-not-closed-inconsistencies-upd.h \ - taler-auditor-httpd_reserve-balance-insufficient-inconsistency-upd.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-upd.h \ - taler-auditor-httpd_coin-inconsistency-upd.c taler-auditor-httpd_coin-inconsistency-upd.h \ - taler-auditor-httpd_progress-upd.c taler-auditor-httpd_progress-upd.h \ - taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-upd.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-upd.h \ - taler-auditor-httpd_refreshes-hanging-upd.c taler-auditor-httpd_refreshes-hanging-upd.h \ - taler-auditor-httpd_emergency-upd.c taler-auditor-httpd_emergency-upd.h \ - taler-auditor-httpd_closure-lags-upd.c taler-auditor-httpd_closure-lags-upd.h \ -taler-auditor-httpd_reserve-in-inconsistency-del.c taler-auditor-httpd_reserve-in-inconsistency-del.h \ -taler-auditor-httpd_reserve-in-inconsistency-put.c taler-auditor-httpd_reserve-in-inconsistency-put.h \ -taler-auditor-httpd_reserve-in-inconsistency-get.c taler-auditor-httpd_reserve-in-inconsistency-get.h \ -taler-auditor-httpd_reserve-in-inconsistency-upd.c taler-auditor-httpd_reserve-in-inconsistency-upd.h \ -taler-auditor-httpd_reserve-not-closed-inconsistency-del.c taler-auditor-httpd_reserve-not-closed-inconsistency-del.h \ -taler-auditor-httpd_reserve-not-closed-inconsistency-put.c taler-auditor-httpd_reserve-not-closed-inconsistency-put.h \ -taler-auditor-httpd_reserve-not-closed-inconsistency-get.c taler-auditor-httpd_reserve-not-closed-inconsistency-get.h \ -taler-auditor-httpd_reserve-not-closed-inconsistency-upd.c taler-auditor-httpd_reserve-not-closed-inconsistency-upd.h \ -taler-auditor-httpd_denominations-without-sigs-del.c taler-auditor-httpd_denominations-without-sigs-del.h \ -taler-auditor-httpd_denominations-without-sigs-put.c taler-auditor-httpd_denominations-without-sigs-put.h \ -taler-auditor-httpd_denominations-without-sigs-get.c taler-auditor-httpd_denominations-without-sigs-get.h \ -taler-auditor-httpd_denominations-without-sigs-upd.c taler-auditor-httpd_denominations-without-sigs-upd.h \ -taler-auditor-httpd_misattribution-in-inconsistency-del.c taler-auditor-httpd_misattribution-in-inconsistency-del.h \ -taler-auditor-httpd_misattribution-in-inconsistency-put.c taler-auditor-httpd_misattribution-in-inconsistency-put.h \ -taler-auditor-httpd_misattribution-in-inconsistency-get.c taler-auditor-httpd_misattribution-in-inconsistency-get.h \ -taler-auditor-httpd_misattribution-in-inconsistency-upd.c taler-auditor-httpd_misattribution-in-inconsistency-upd.h \ -taler-auditor-httpd_reserves-del.c taler-auditor-httpd_reserves-del.h \ -taler-auditor-httpd_reserves-put.c taler-auditor-httpd_reserves-put.h \ -taler-auditor-httpd_reserves-get.c taler-auditor-httpd_reserves-get.h \ -taler-auditor-httpd_reserves-upd.c taler-auditor-httpd_reserves-upd.h \ -taler-auditor-httpd_purses-del.c taler-auditor-httpd_purses-del.h \ -taler-auditor-httpd_purses-put.c taler-auditor-httpd_purses-put.h \ -taler-auditor-httpd_purses-get.c taler-auditor-httpd_purses-get.h \ -taler-auditor-httpd_purses-upd.c taler-auditor-httpd_purses-upd.h \ -taler-auditor-httpd_historic-denomination-revenue-del.c taler-auditor-httpd_historic-denomination-revenue-del.h \ -taler-auditor-httpd_historic-denomination-revenue-put.c taler-auditor-httpd_historic-denomination-revenue-put.h \ -taler-auditor-httpd_historic-denomination-revenue-get.c taler-auditor-httpd_historic-denomination-revenue-get.h \ -taler-auditor-httpd_historic-denomination-revenue-upd.c taler-auditor-httpd_historic-denomination-revenue-upd.h \ -taler-auditor-httpd_denomination-pending-del.c taler-auditor-httpd_denomination-pending-del.h \ -taler-auditor-httpd_denomination-pending-put.c taler-auditor-httpd_denomination-pending-put.h \ -taler-auditor-httpd_denomination-pending-get.c taler-auditor-httpd_denomination-pending-get.h \ -taler-auditor-httpd_denomination-pending-upd.c taler-auditor-httpd_denomination-pending-upd.h \ -taler-auditor-httpd_historic-reserve-summary-del.c taler-auditor-httpd_historic-reserve-summary-del.h \ -taler-auditor-httpd_historic-reserve-summary-put.c taler-auditor-httpd_historic-reserve-summary-put.h \ -taler-auditor-httpd_historic-reserve-summary-get.c taler-auditor-httpd_historic-reserve-summary-get.h \ -taler-auditor-httpd_historic-reserve-summary-upd.c taler-auditor-httpd_historic-reserve-summary-upd.h \ -taler-auditor-httpd_exchange-signkeys-del.c taler-auditor-httpd_exchange-signkeys-del.h \ -taler-auditor-httpd_exchange-signkeys-put.c taler-auditor-httpd_exchange-signkeys-put.h \ -taler-auditor-httpd_exchange-signkeys-get.c taler-auditor-httpd_exchange-signkeys-get.h \ -taler-auditor-httpd_exchange-signkeys-upd.c taler-auditor-httpd_exchange-signkeys-upd.h \ -taler-auditor-httpd_wire-format-inconsistency-del.c taler-auditor-httpd_wire-format-inconsistency-del.h \ -taler-auditor-httpd_wire-format-inconsistency-put.c taler-auditor-httpd_wire-format-inconsistency-put.h \ -taler-auditor-httpd_wire-format-inconsistency-get.c taler-auditor-httpd_wire-format-inconsistency-get.h \ -taler-auditor-httpd_wire-format-inconsistency-upd.c taler-auditor-httpd_wire-format-inconsistency-upd.h \ -taler-auditor-httpd_wire-out-inconsistency-del.c taler-auditor-httpd_wire-out-inconsistency-del.h \ -taler-auditor-httpd_wire-out-inconsistency-put.c taler-auditor-httpd_wire-out-inconsistency-put.h \ -taler-auditor-httpd_wire-out-inconsistency-get.c taler-auditor-httpd_wire-out-inconsistency-get.h \ -taler-auditor-httpd_wire-out-inconsistency-upd.c taler-auditor-httpd_wire-out-inconsistency-upd.h \ -taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-del.c taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-del.h \ -taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-put.c taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-put.h \ -taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.h \ -taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-upd.c taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-upd.h \ -taler-auditor-httpd_row-minor-inconsistencies-del.c taler-auditor-httpd_row-minor-inconsistencies-del.h \ -taler-auditor-httpd_row-minor-inconsistencies-put.c taler-auditor-httpd_row-minor-inconsistencies-put.h \ -taler-auditor-httpd_row-minor-inconsistencies-get.c taler-auditor-httpd_row-minor-inconsistencies-get.h \ -taler-auditor-httpd_row-minor-inconsistencies-upd.c taler-auditor-httpd_row-minor-inconsistencies-upd.h \ -taler-auditor-httpd_fee-time-inconsistency-del.c taler-auditor-httpd_fee-time-inconsistency-del.h \ -taler-auditor-httpd_fee-time-inconsistency-put.c taler-auditor-httpd_fee-time-inconsistency-put.h \ -taler-auditor-httpd_fee-time-inconsistency-get.c taler-auditor-httpd_fee-time-inconsistency-get.h \ -taler-auditor-httpd_fee-time-inconsistency-upd.c taler-auditor-httpd_fee-time-inconsistency-upd.h \ -taler-auditor-httpd_balances-del.c taler-auditor-httpd_balances-del.h \ -taler-auditor-httpd_balances-put.c taler-auditor-httpd_balances-put.h \ -taler-auditor-httpd_balances-get.c taler-auditor-httpd_balances-get.h \ -taler-auditor-httpd_balances-upd.c taler-auditor-httpd_balances-upd.h \ + taler-auditor-httpd_emergency-by-count-put.c taler-auditor-httpd_emergency-by-count-put.h \ + taler-auditor-httpd_emergency-by-count-get.c taler-auditor-httpd_emergency-by-count-get.h \ + taler-auditor-httpd_emergency-by-count-del.c taler-auditor-httpd_emergency-by-count-del.h \ + taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.h \ + taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.h \ + taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-del.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-del.h \ + taler-auditor-httpd_purse-not-closed-inconsistencies-put.c taler-auditor-httpd_purse-not-closed-inconsistencies-put.h \ + taler-auditor-httpd_purse-not-closed-inconsistencies-get.c taler-auditor-httpd_purse-not-closed-inconsistencies-get.h \ + taler-auditor-httpd_purse-not-closed-inconsistencies-del.c taler-auditor-httpd_purse-not-closed-inconsistencies-del.h \ + taler-auditor-httpd_reserve-balance-insufficient-inconsistency-put.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-put.h \ + taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.h \ + taler-auditor-httpd_reserve-balance-insufficient-inconsistency-del.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-del.h \ + taler-auditor-httpd_bad-sig-losses-put.c taler-auditor-httpd_bad-sig-losses-put.h \ + taler-auditor-httpd_bad-sig-losses-get.c taler-auditor-httpd_bad-sig-losses-get.h \ + taler-auditor-httpd_bad-sig-losses-del.c taler-auditor-httpd_bad-sig-losses-del.h \ + taler-auditor-httpd_bad-sig-losses-upd.c taler-auditor-httpd_bad-sig-losses-upd.h \ + taler-auditor-httpd_closure-lags-put.c taler-auditor-httpd_closure-lags-put.h \ + taler-auditor-httpd_closure-lags-get.c taler-auditor-httpd_closure-lags-get.h \ + taler-auditor-httpd_closure-lags-del.c taler-auditor-httpd_closure-lags-del.h \ + taler-auditor-httpd_progress-get.c taler-auditor-httpd_progress-get.h \ + taler-auditor-httpd_refreshes-hanging-put.c taler-auditor-httpd_refreshes-hanging-put.h \ + taler-auditor-httpd_refreshes-hanging-get.c taler-auditor-httpd_refreshes-hanging-get.h \ + taler-auditor-httpd_refreshes-hanging-del.c taler-auditor-httpd_refreshes-hanging-del.h \ + taler-auditor-httpd_emergency-by-count-upd.c taler-auditor-httpd_emergency-by-count-upd.h \ + taler-auditor-httpd_row-inconsistency-upd.c taler-auditor-httpd_row-inconsistency-upd.h \ + taler-auditor-httpd_purse-not-closed-inconsistencies-upd.c taler-auditor-httpd_purse-not-closed-inconsistencies-upd.h \ + taler-auditor-httpd_reserve-balance-insufficient-inconsistency-upd.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-upd.h \ + taler-auditor-httpd_coin-inconsistency-upd.c taler-auditor-httpd_coin-inconsistency-upd.h \ + taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-upd.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-upd.h \ + taler-auditor-httpd_refreshes-hanging-upd.c taler-auditor-httpd_refreshes-hanging-upd.h \ + taler-auditor-httpd_emergency-upd.c taler-auditor-httpd_emergency-upd.h \ + taler-auditor-httpd_closure-lags-upd.c taler-auditor-httpd_closure-lags-upd.h \ + taler-auditor-httpd_reserve-in-inconsistency-del.c taler-auditor-httpd_reserve-in-inconsistency-del.h \ + taler-auditor-httpd_reserve-in-inconsistency-put.c taler-auditor-httpd_reserve-in-inconsistency-put.h \ + taler-auditor-httpd_reserve-in-inconsistency-get.c taler-auditor-httpd_reserve-in-inconsistency-get.h \ + taler-auditor-httpd_reserve-in-inconsistency-upd.c taler-auditor-httpd_reserve-in-inconsistency-upd.h \ + taler-auditor-httpd_reserve-not-closed-inconsistency-del.c taler-auditor-httpd_reserve-not-closed-inconsistency-del.h \ + taler-auditor-httpd_reserve-not-closed-inconsistency-put.c taler-auditor-httpd_reserve-not-closed-inconsistency-put.h \ + taler-auditor-httpd_reserve-not-closed-inconsistency-get.c taler-auditor-httpd_reserve-not-closed-inconsistency-get.h \ + taler-auditor-httpd_reserve-not-closed-inconsistency-upd.c taler-auditor-httpd_reserve-not-closed-inconsistency-upd.h \ + taler-auditor-httpd_denominations-without-sigs-del.c taler-auditor-httpd_denominations-without-sigs-del.h \ + taler-auditor-httpd_denominations-without-sigs-put.c taler-auditor-httpd_denominations-without-sigs-put.h \ + taler-auditor-httpd_denominations-without-sigs-get.c taler-auditor-httpd_denominations-without-sigs-get.h \ + taler-auditor-httpd_denominations-without-sigs-upd.c taler-auditor-httpd_denominations-without-sigs-upd.h \ + taler-auditor-httpd_misattribution-in-inconsistency-del.c taler-auditor-httpd_misattribution-in-inconsistency-del.h \ + taler-auditor-httpd_misattribution-in-inconsistency-put.c taler-auditor-httpd_misattribution-in-inconsistency-put.h \ + taler-auditor-httpd_misattribution-in-inconsistency-get.c taler-auditor-httpd_misattribution-in-inconsistency-get.h \ + taler-auditor-httpd_misattribution-in-inconsistency-upd.c taler-auditor-httpd_misattribution-in-inconsistency-upd.h \ + taler-auditor-httpd_reserves-get.c taler-auditor-httpd_reserves-get.h \ + taler-auditor-httpd_purses-get.c taler-auditor-httpd_purses-get.h \ + taler-auditor-httpd_historic-denomination-revenue-get.c taler-auditor-httpd_historic-denomination-revenue-get.h \ + taler-auditor-httpd_denomination-pending-del.c taler-auditor-httpd_denomination-pending-del.h \ + taler-auditor-httpd_denomination-pending-put.c taler-auditor-httpd_denomination-pending-put.h \ + taler-auditor-httpd_denomination-pending-get.c taler-auditor-httpd_denomination-pending-get.h \ + taler-auditor-httpd_denomination-pending-upd.c taler-auditor-httpd_denomination-pending-upd.h \ + taler-auditor-httpd_historic-reserve-summary-get.c taler-auditor-httpd_historic-reserve-summary-get.h \ + taler-auditor-httpd_wire-format-inconsistency-del.c taler-auditor-httpd_wire-format-inconsistency-del.h \ + taler-auditor-httpd_wire-format-inconsistency-put.c taler-auditor-httpd_wire-format-inconsistency-put.h \ + taler-auditor-httpd_wire-format-inconsistency-get.c taler-auditor-httpd_wire-format-inconsistency-get.h \ + taler-auditor-httpd_wire-format-inconsistency-upd.c taler-auditor-httpd_wire-format-inconsistency-upd.h \ + taler-auditor-httpd_wire-out-inconsistency-del.c taler-auditor-httpd_wire-out-inconsistency-del.h \ + taler-auditor-httpd_wire-out-inconsistency-put.c taler-auditor-httpd_wire-out-inconsistency-put.h \ + taler-auditor-httpd_wire-out-inconsistency-get.c taler-auditor-httpd_wire-out-inconsistency-get.h \ + taler-auditor-httpd_wire-out-inconsistency-upd.c taler-auditor-httpd_wire-out-inconsistency-upd.h \ + taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-del.c taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-del.h \ + taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-put.c taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-put.h \ + taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.h \ + taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-upd.c taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-upd.h \ + taler-auditor-httpd_row-minor-inconsistencies-del.c taler-auditor-httpd_row-minor-inconsistencies-del.h \ + taler-auditor-httpd_row-minor-inconsistencies-put.c taler-auditor-httpd_row-minor-inconsistencies-put.h \ + taler-auditor-httpd_row-minor-inconsistencies-get.c taler-auditor-httpd_row-minor-inconsistencies-get.h \ + taler-auditor-httpd_row-minor-inconsistencies-upd.c taler-auditor-httpd_row-minor-inconsistencies-upd.h \ + taler-auditor-httpd_fee-time-inconsistency-del.c taler-auditor-httpd_fee-time-inconsistency-del.h \ + taler-auditor-httpd_fee-time-inconsistency-put.c taler-auditor-httpd_fee-time-inconsistency-put.h \ + taler-auditor-httpd_fee-time-inconsistency-get.c taler-auditor-httpd_fee-time-inconsistency-get.h \ + taler-auditor-httpd_fee-time-inconsistency-upd.c taler-auditor-httpd_fee-time-inconsistency-upd.h \ + taler-auditor-httpd_balances-get.c taler-auditor-httpd_balances-get.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 6cf4f0375..f1fa431ad 100644 --- a/src/auditor/taler-auditor-httpd.c +++ b/src/auditor/taler-auditor-httpd.c @@ -77,8 +77,6 @@ #include "taler-auditor-httpd_closure-lags-del.h" #include "taler-auditor-httpd_progress-get.h" -#include "taler-auditor-httpd_progress-put.h" -#include "taler-auditor-httpd_progress-del.h" #include "taler-auditor-httpd_refreshes-hanging-get.h" #include "taler-auditor-httpd_refreshes-hanging-put.h" @@ -92,7 +90,6 @@ #include "taler-auditor-httpd_purse-not-closed-inconsistencies-upd.h" #include "taler-auditor-httpd_reserve-balance-insufficient-inconsistency-upd.h" #include "taler-auditor-httpd_coin-inconsistency-upd.h" -#include "taler-auditor-httpd_progress-upd.h" #include \ "taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-upd.h" #include "taler-auditor-httpd_refreshes-hanging-upd.h" @@ -105,79 +102,47 @@ #include "taler-auditor-httpd_reserve-in-inconsistency-get.h" #include "taler-auditor-httpd_reserve-in-inconsistency-upd.h" - #include "taler-auditor-httpd_reserve-not-closed-inconsistency-del.h" #include "taler-auditor-httpd_reserve-not-closed-inconsistency-put.h" #include "taler-auditor-httpd_reserve-not-closed-inconsistency-get.h" #include "taler-auditor-httpd_reserve-not-closed-inconsistency-upd.h" - #include "taler-auditor-httpd_denominations-without-sigs-del.h" #include "taler-auditor-httpd_denominations-without-sigs-put.h" #include "taler-auditor-httpd_denominations-without-sigs-get.h" #include "taler-auditor-httpd_denominations-without-sigs-upd.h" - #include "taler-auditor-httpd_misattribution-in-inconsistency-del.h" #include "taler-auditor-httpd_misattribution-in-inconsistency-put.h" #include "taler-auditor-httpd_misattribution-in-inconsistency-get.h" #include "taler-auditor-httpd_misattribution-in-inconsistency-upd.h" - -#include "taler-auditor-httpd_reserves-del.h" -#include "taler-auditor-httpd_reserves-put.h" #include "taler-auditor-httpd_reserves-get.h" -#include "taler-auditor-httpd_reserves-upd.h" - - -#include "taler-auditor-httpd_purses-del.h" -#include "taler-auditor-httpd_purses-put.h" #include "taler-auditor-httpd_purses-get.h" -#include "taler-auditor-httpd_purses-upd.h" - -#include "taler-auditor-httpd_historic-denomination-revenue-del.h" -#include "taler-auditor-httpd_historic-denomination-revenue-put.h" #include "taler-auditor-httpd_historic-denomination-revenue-get.h" -#include "taler-auditor-httpd_historic-denomination-revenue-upd.h" - +#include "taler-auditor-httpd_historic-reserve-summary-get.h" #include "taler-auditor-httpd_denomination-pending-del.h" #include "taler-auditor-httpd_denomination-pending-put.h" #include "taler-auditor-httpd_denomination-pending-get.h" #include "taler-auditor-httpd_denomination-pending-upd.h" - -#include "taler-auditor-httpd_historic-reserve-summary-del.h" -#include "taler-auditor-httpd_historic-reserve-summary-put.h" -#include "taler-auditor-httpd_historic-reserve-summary-get.h" -#include "taler-auditor-httpd_historic-reserve-summary-upd.h" - - -#include "taler-auditor-httpd_exchange-signkeys-del.h" -#include "taler-auditor-httpd_exchange-signkeys-put.h" -#include "taler-auditor-httpd_exchange-signkeys-get.h" -#include "taler-auditor-httpd_exchange-signkeys-upd.h" - - #include "taler-auditor-httpd_wire-format-inconsistency-del.h" #include "taler-auditor-httpd_wire-format-inconsistency-put.h" #include "taler-auditor-httpd_wire-format-inconsistency-get.h" #include "taler-auditor-httpd_wire-format-inconsistency-upd.h" - #include "taler-auditor-httpd_wire-out-inconsistency-del.h" #include "taler-auditor-httpd_wire-out-inconsistency-put.h" #include "taler-auditor-httpd_wire-out-inconsistency-get.h" #include "taler-auditor-httpd_wire-out-inconsistency-upd.h" - #include "taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-del.h" #include "taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-put.h" #include "taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.h" #include "taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-upd.h" - #include "taler-auditor-httpd_row-minor-inconsistencies-del.h" #include "taler-auditor-httpd_row-minor-inconsistencies-put.h" #include "taler-auditor-httpd_row-minor-inconsistencies-get.h" @@ -188,10 +153,7 @@ #include "taler-auditor-httpd_fee-time-inconsistency-get.h" #include "taler-auditor-httpd_fee-time-inconsistency-upd.h" -#include "taler-auditor-httpd_balances-del.h" -#include "taler-auditor-httpd_balances-put.h" #include "taler-auditor-httpd_balances-get.h" -#include "taler-auditor-httpd_balances-upd.h" /** * Auditor protocol version string. @@ -460,13 +422,12 @@ handle_mhd_request (void *cls, /* Our most popular handler (thus first!), used by merchants to probabilistically report us their deposit confirmations. */ { - "/deposit-confirmation", - MHD_HTTP_METHOD_PUT, - "application/json", - NULL, 0, - &TAH_DEPOSIT_CONFIRMATION_handler, - MHD_HTTP_OK, - true + .url = "/deposit-confirmation", + .method = MHD_HTTP_METHOD_PUT, + .mime_type = "application/json", + .handler = &TAH_DEPOSIT_CONFIRMATION_handler, + .response_code = MHD_HTTP_OK, + .requires_auth = true }, { "/monitoring/deposit-confirmation", @@ -481,7 +442,6 @@ handle_mhd_request (void *cls, "application/json", NULL, 0, &TAH_DEPOSIT_CONFIRMATION_handler_delete, MHD_HTTP_OK, true }, - { "/monitoring/amount-arithmetic-inconsistency", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -498,7 +458,6 @@ handle_mhd_request (void *cls, "application/json", NULL, 0, &TAH_AMOUNT_ARITHMETIC_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/coin-inconsistency", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -515,7 +474,6 @@ handle_mhd_request (void *cls, "application/json", NULL, 0, &TAH_COIN_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/row-inconsistency", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -532,8 +490,6 @@ handle_mhd_request (void *cls, "application/json", NULL, 0, &TAH_ROW_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - - { "/monitoring/bad-sig-losses", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -554,7 +510,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_BAD_SIG_LOSSES_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/closure-lags", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -575,7 +530,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_CLOSURE_LAGS_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/emergency", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -596,7 +550,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_EMERGENCY_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/refreshes-hanging", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -617,7 +570,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_REFRESHES_HANGING_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/denomination-key-validity-withdraw-inconsistency", MHD_HTTP_METHOD_GET, "application/json", @@ -642,28 +594,11 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/progress", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, &TAH_PROGRESS_handler_get, MHD_HTTP_OK, true }, - { "/monitoring/progress", MHD_HTTP_METHOD_PUT, - "application/json", - NULL, 0, - &TAH_PROGRESS_PUT_handler, - MHD_HTTP_OK, true }, - { "/monitoring/progress", MHD_HTTP_METHOD_DELETE, - "application/json", - NULL, 0, - &TAH_PROGRESS_handler_delete, - MHD_HTTP_OK, true }, - /*{ "/monitoring/progress", MHD_HTTP_METHOD_PATCH, - "application/json", - NULL, 0, - &TAH_PROGRESS_handler_update, - MHD_HTTP_OK, true },*/ - { "/monitoring/reserve-balance-insufficient-inconsistency", MHD_HTTP_METHOD_GET, "application/json", @@ -688,7 +623,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/purse-not-closed-inconsistencies", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -709,7 +643,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_PURSE_NOT_CLOSED_INCONSISTENCIES_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/emergency-by-count", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -730,7 +663,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_EMERGENCY_BY_COUNT_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/reserve-in-inconsistency", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -751,8 +683,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_RESERVE_IN_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - - { "/monitoring/reserve-not-closed-inconsistency", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -773,8 +703,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_RESERVE_NOT_CLOSED_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - - { "/monitoring/denominations-without-sigs", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -795,8 +723,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_DENOMINATIONS_WITHOUT_SIGS_handler_update, MHD_HTTP_OK, true }, - - { "/monitoring/misattribution-in-inconsistency", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -817,76 +743,21 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_MISATTRIBUTION_IN_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - - { "/monitoring/reserves", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, &TAH_RESERVES_handler_get, MHD_HTTP_OK, true }, - { "/monitoring/reserves", MHD_HTTP_METHOD_PUT, - "application/json", - NULL, 0, - &TAH_RESERVES_handler_put, - MHD_HTTP_OK, true }, - { "/monitoring/reserves", MHD_HTTP_METHOD_DELETE, - "application/json", - NULL, 0, - &TAH_RESERVES_handler_delete, - MHD_HTTP_OK, true }, - /*{ "/monitoring/reserves", MHD_HTTP_METHOD_PATCH, - "application/json", - NULL, 0, - &TAH_RESERVES_handler_update, - MHD_HTTP_OK, true },*/ - - { "/monitoring/purses", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, &TAH_PURSES_handler_get, MHD_HTTP_OK, true }, - { "/monitoring/purses", MHD_HTTP_METHOD_PUT, - "application/json", - NULL, 0, - &TAH_PURSES_handler_put, - MHD_HTTP_OK, true }, - { "/monitoring/purses", MHD_HTTP_METHOD_DELETE, - "application/json", - NULL, 0, - &TAH_PURSES_handler_delete, - MHD_HTTP_OK, true }, - /* - { "/monitoring/purses", MHD_HTTP_METHOD_PATCH, - "application/json", - NULL, 0, - &TAH_PURSES_handler_update, - MHD_HTTP_OK, true }, -*/ - { "/monitoring/historic-denomination-revenue", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, &TAH_HISTORIC_DENOMINATION_REVENUE_handler_get, MHD_HTTP_OK, true }, - { "/monitoring/historic-denomination-revenue", MHD_HTTP_METHOD_PUT, - "application/json", - NULL, 0, - &TAH_HISTORIC_DENOMINATION_REVENUE_handler_put, - MHD_HTTP_OK, true }, - { "/monitoring/historic-denomination-revenue", MHD_HTTP_METHOD_DELETE, - "application/json", - NULL, 0, - &TAH_HISTORIC_DENOMINATION_REVENUE_handler_delete, - MHD_HTTP_OK, true }, - /* - { "/monitoring/historic-denomination-revenue", MHD_HTTP_METHOD_PATCH, - "application/json", - NULL, 0, - &TAH_HISTORIC_DENOMINATION_REVENUE_handler_update, - MHD_HTTP_OK, true }, -*/ - { "/monitoring/denomination-pending", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -902,59 +773,11 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_DENOMINATION_PENDING_handler_delete, MHD_HTTP_OK, true }, - /* - { "/monitoring/denomination-pending", MHD_HTTP_METHOD_PATCH, - "application/json", - NULL, 0, - &TAH_DENOMINATION_PENDING_handler_update, - MHD_HTTP_OK, true }, -*/ - { "/monitoring/historic-reserve-summary", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, &TAH_HISTORIC_RESERVE_SUMMARY_handler_get, MHD_HTTP_OK, true }, - { "/monitoring/historic-reserve-summary", MHD_HTTP_METHOD_PUT, - "application/json", - NULL, 0, - &TAH_HISTORIC_RESERVE_SUMMARY_handler_put, - MHD_HTTP_OK, true }, - { "/monitoring/historic-reserve-summary", MHD_HTTP_METHOD_DELETE, - "application/json", - NULL, 0, - &TAH_HISTORIC_RESERVE_SUMMARY_handler_delete, - MHD_HTTP_OK, true }, - /* - { "/monitoring/historic-reserve-summary", MHD_HTTP_METHOD_PATCH, - "application/json", - NULL, 0, - &TAH_HISTORIC_RESERVE_SUMMARY_handler_update, - MHD_HTTP_OK, true }, -*/ -/* - { "/monitoring/exchange-signkeys", MHD_HTTP_METHOD_GET, - "application/json", - NULL, 0, - &TAH_EXCHANGE_SIGNKEYS_handler_get, - MHD_HTTP_OK, true }, - { "/monitoring/exchange-signkeys", MHD_HTTP_METHOD_PUT, - "application/json", - NULL, 0, - &TAH_EXCHANGE_SIGNKEYS_handler_put, - MHD_HTTP_OK, true }, - { "/monitoring/exchange-signkeys", MHD_HTTP_METHOD_DELETE, - "application/json", - NULL, 0, - &TAH_EXCHANGE_SIGNKEYS_handler_delete, - MHD_HTTP_OK, true }, - { "/monitoring/exchange-signkeys", MHD_HTTP_METHOD_PATCH, - "application/json", - NULL, 0, - &TAH_EXCHANGE_SIGNKEYS_handler_update, - MHD_HTTP_OK, true }, -*/ - { "/monitoring/wire-format-inconsistency", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -975,8 +798,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_WIRE_FORMAT_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - - { "/monitoring/wire-out-inconsistency", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -997,8 +818,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_WIRE_OUT_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - - { "/monitoring/reserve-balance-summary-wrong-inconsistency", MHD_HTTP_METHOD_GET, "application/json", @@ -1023,8 +842,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - - { "/monitoring/row-minor-inconsistencies", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -1045,7 +862,6 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_ROW_MINOR_INCONSISTENCIES_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/fee-time-inconsistency", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, @@ -1066,36 +882,14 @@ handle_mhd_request (void *cls, NULL, 0, &TAH_FEE_TIME_INCONSISTENCY_handler_update, MHD_HTTP_OK, true }, - { "/monitoring/balances", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, &TAH_BALANCES_handler_get, MHD_HTTP_OK, true }, - { "/monitoring/balances", MHD_HTTP_METHOD_PUT, - "application/json", - NULL, 0, - &TAH_BALANCES_handler_put, - MHD_HTTP_OK, true }, - { "/monitoring/balances", MHD_HTTP_METHOD_DELETE, - "application/json", - NULL, 0, - &TAH_BALANCES_handler_delete, - MHD_HTTP_OK, true }, - /*{ "/monitoring/balances", MHD_HTTP_METHOD_PATCH, - "application/json", - NULL, 0, - &TAH_BALANCES_handler_update, - MHD_HTTP_OK, true },*/ - { "/config", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, &handle_config, MHD_HTTP_OK, false }, - /* Landing page, for now tells humans to go away - * (NOTE: ideally, the reverse proxy will respond with a nicer page) */ - { "/", MHD_HTTP_METHOD_GET, "text/plain", - "Hello, I'm the Taler auditor. This HTTP server is not for humans.\n", 0, - &TAH_MHD_handler_static_response, MHD_HTTP_OK, false }, /* /robots.txt: disallow everything */ { "/robots.txt", MHD_HTTP_METHOD_GET, "text/plain", "User-agent: *\nDisallow: /\n", 0, @@ -1107,8 +901,19 @@ handle_mhd_request (void *cls, { "/agpl", MHD_HTTP_METHOD_GET, "text/plain", NULL, 0, &TAH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND, false }, + /* Landing page, for now tells humans to go away + * (NOTE: ideally, the reverse proxy will respond with a nicer page) */ + { "/", MHD_HTTP_METHOD_GET, "text/plain", + "Hello, I'm the Taler auditor. This HTTP server is not for humans.\n", 0, + &TAH_MHD_handler_static_response, MHD_HTTP_OK, false }, { NULL, NULL, NULL, NULL, 0, NULL, 0, 0 } }; + unsigned int args_max = 3; + const char *args[args_max + 1]; + size_t ulen = strlen (url) + 1; + char d[ulen]; + /* const */ struct TAH_RequestHandler *match = NULL; + bool url_match; (void) cls; (void) version; @@ -1121,131 +926,112 @@ handle_mhd_request (void *cls, if (0 == strcasecmp (method, MHD_HTTP_METHOD_OPTIONS) ) return TALER_MHD_reply_cors_preflight (connection); - for (unsigned int i = 0; NULL != handlers[i].url; i++) + + memset (&args, + 0, + sizeof (args)); + GNUNET_memcpy (d, + url, + ulen); { - struct TAH_RequestHandler *rh = &handlers[i]; - unsigned int argsnr = 3; - - // arguments, and the url itself, and a terminator that is always null - const char *args[argsnr + 1]; - size_t ulen = strlen (url) + 1; - char d[ulen]; - char argurl[ulen + 1 + strlen ("/monitoring")]; unsigned int i = 0; - char *sp; - - bool found = false; - bool requiresAuth = true; - - memset (&args, - 0, - sizeof (args)); - GNUNET_memcpy (d, - url, - ulen); - args[i++] = strtok_r (d, "/", &sp); - while ( (NULL != args[i - 1]) && (i < argsnr) ) - { - args[i++] = strtok_r (NULL, - "/", - &sp); - } - memset (argurl, - 0, - sizeof (argurl)); - strcpy (argurl, - "/"); - if (args[0] != NULL) + for (args[i] = strtok (d, + "/"); + NULL != args[i]; + args[i] = strtok (NULL, + "/")) { - strcat (argurl, - args[0]); - - if ( (0 == strcasecmp (argurl, - rh->url)) && - ( (NULL == rh->method) || - (0 == strcasecmp (method, - rh->method)) ) ) + i++; + if (i >= args_max) { - found = true; - requiresAuth = rh->requiresAuth; + GNUNET_break_op (0); + goto not_found; } } + } - if (i >= 2 && args[1] != NULL) + for (unsigned int i = 0; NULL != handlers[i].url; i++) + { + /* const */ struct TAH_RequestHandler *rh = &handlers[i]; + + if ( (0 == strcasecmp (url, + rh->url)) || + ( (0 == strncasecmp (url, + rh->url, + strlen (rh->url))) && + ('/' == url[strlen (rh->url)]) ) ) { - strcat (argurl, - "/"); - strcat (argurl, - args[1]); - if ( (0 == strcasecmp (argurl, - rh->url)) && - ( (NULL == rh->method) || - (0 == strcasecmp (method, - rh->method)) ) ) + url_match = true; + if ( (NULL == rh->method) || + (0 == strcasecmp (method, + rh->method)) ) { - if ((0 == strcasecmp (method, - MHD_HTTP_METHOD_DELETE)) || - (0 == strcasecmp (method, - MHD_HTTP_METHOD_PUT)) ) - { - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_METHOD_NOT_ALLOWED, - TALER_EC_AUDITOR_GENERIC_METHOD_NOT_ALLOWED, - "This method is currently disabled."); - - } - found = true; - requiresAuth = true; + match = rh; + break; } } + } + if (NULL == match) + { + GNUNET_break_op (0); + goto not_found; + } + if (match->requires_auth) + { + const char *auth; - if (! found) - continue; - if (requiresAuth) + auth = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_AUTHORIZATION); + if (NULL == auth) { - const char *auth; - - auth = MHD_lookup_connection_value (connection, - MHD_HEADER_KIND, - MHD_HTTP_HEADER_AUTHORIZATION); - if (NULL == auth) - { - GNUNET_break_op (0); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_UNAUTHORIZED, - TALER_EC_AUDITOR_GENERIC_UNAUTHORIZED, - "Check 'Authorization' header"); - } - extract_token (&auth); - if (NULL == auth) - return TALER_MHD_reply_with_error ( - connection, - MHD_HTTP_UNAUTHORIZED, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "'" RFC_8959_PREFIX - "' prefix or 'Bearer' missing in 'Authorization' header"); - - if (TMH_check_auth (auth) != 1) - { - GNUNET_break_op (0); - return TALER_MHD_reply_with_error ( - connection, - MHD_HTTP_UNAUTHORIZED, - TALER_EC_AUDITOR_GENERIC_UNAUTHORIZED, - "Check 'Authorization' header"); - } + GNUNET_break_op (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_UNAUTHORIZED, + TALER_EC_AUDITOR_GENERIC_UNAUTHORIZED, + "Check 'Authorization' header"); } + extract_token (&auth); + if (NULL == auth) + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_UNAUTHORIZED, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "'" RFC_8959_PREFIX + "' prefix or 'Bearer' missing in 'Authorization' header"); - return rh->handler (rh, - connection, - con_cls, - upload_data, - upload_data_size, - args); + if (GNUNET_OK != + TMH_check_auth (auth)) + { + GNUNET_break_op (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_UNAUTHORIZED, + TALER_EC_AUDITOR_GENERIC_UNAUTHORIZED, + "Check 'Authorization' header"); + } + } + return match->handler (match, + connection, + con_cls, + upload_data, + upload_data_size, + args); +not_found: + if (url_match) + { + /* TODO: return list of allowed methods... */ + GNUNET_break (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_METHOD_NOT_ALLOWED, + TALER_EC_AUDITOR_GENERIC_METHOD_NOT_ALLOWED, + "This method is currently disabled."); } - GNUNET_break_op (0); + #define NOT_FOUND \ "<html><title>404: not found</title><body>auditor endpoints have been moved to /monitoring/...</body></html>" return TALER_MHD_reply_static (connection, diff --git a/src/auditor/taler-auditor-httpd.h b/src/auditor/taler-auditor-httpd.h index 5edf25513..9da0601ba 100644 --- a/src/auditor/taler-auditor-httpd.h +++ b/src/auditor/taler-auditor-httpd.h @@ -91,19 +91,23 @@ struct TAH_RequestHandler * @param[in,out] upload_data_size number of bytes (left) in @a upload_data * @return MHD result code */ - MHD_RESULT (*handler)(struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); + MHD_RESULT (*handler)( + /* const */ struct TAH_RequestHandler *rh, + struct MHD_Connection *connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size, + const char *const args[]); /** * Default response code. */ unsigned int response_code; - bool requiresAuth; + /** + * Is client authentication required for this endpoint? + */ + bool requires_auth; }; diff --git a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.c b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.c index 8621cf219..b14cd849f 100644 --- a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.c +++ b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.c @@ -25,6 +25,7 @@ #include "taler-auditor-httpd.h" #include "taler-auditor-httpd_amount-arithmetic-inconsistency-get.h" + /** * Add deposit confirmation to the list. * @@ -34,30 +35,29 @@ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating */ static enum GNUNET_GenericReturnValue -add_amount_arithmetic_inconsistency (void *cls, - uint64_t serial_id, - const struct - TALER_AUDITORDB_AmountArithmeticInconsistency - *dc) +add_amount_arithmetic_inconsistency ( + void *cls, + uint64_t serial_id, + const struct TALER_AUDITORDB_AmountArithmeticInconsistency *dc) { json_t *list = cls; json_t *obj; - obj = GNUNET_JSON_PACK ( - - GNUNET_JSON_pack_int64 ("row_id", serial_id), - GNUNET_JSON_pack_data_auto ("operation", &dc->operation), - TALER_JSON_pack_amount ("exchange_amount", &dc->exchange_amount), - TALER_JSON_pack_amount ("auditor_amount", &dc->auditor_amount), - GNUNET_JSON_pack_bool ("profitable", dc->profitable) - + GNUNET_JSON_pack_int64 ("row_id", + serial_id), + GNUNET_JSON_pack_data_auto ("operation", + &dc->operation), + TALER_JSON_pack_amount ("exchange_amount", + &dc->exchange_amount), + TALER_JSON_pack_amount ("auditor_amount", + &dc->auditor_amount), + GNUNET_JSON_pack_bool ("profitable", + dc->profitable) ); GNUNET_break (0 == json_array_append_new (list, obj)); - - return GNUNET_OK; } @@ -72,16 +72,20 @@ add_amount_arithmetic_inconsistency (void *cls, * @return MHD result code */ MHD_RESULT -TAH_AMOUNT_ARITHMETIC_INCONSISTENCY_handler_get (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) +TAH_AMOUNT_ARITHMETIC_INCONSISTENCY_handler_get ( + struct TAH_RequestHandler *rh, + struct MHD_Connection * + connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size, + const char *const args[]) { json_t *ja; enum GNUNET_DB_QueryStatus qs; + int64_t limit = -20; + uint64_t offset; + bool return_suppressed = false; (void) rh; (void) connection_cls; @@ -98,33 +102,30 @@ TAH_AMOUNT_ARITHMETIC_INCONSISTENCY_handler_get (struct TAH_RequestHandler *rh, } ja = json_array (); GNUNET_break (NULL != ja); - - int64_t limit = -20; - uint64_t offset; - TALER_MHD_parse_request_snumber (connection, "limit", &limit); - if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, "offset", &offset); - - bool return_suppressed = false; - const char *ret_s = MHD_lookup_connection_value (connection, - MHD_GET_ARGUMENT_KIND, - "return_suppressed"); - if (ret_s != NULL && strcmp (ret_s, "true") == 0) { - return_suppressed = true; + const char *ret_s; + + ret_s = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, + "return_suppressed"); + if ( (ret_s != NULL) && + (0 == strcmp (ret_s, + "true")) ) + { + return_suppressed = true; + } } - qs = TAH_plugin->get_amount_arithmetic_inconsistency ( TAH_plugin->cls, limit, @@ -139,10 +140,11 @@ TAH_AMOUNT_ARITHMETIC_INCONSISTENCY_handler_get (struct TAH_RequestHandler *rh, json_decref (ja); TALER_LOG_WARNING ( "Failed to handle GET /amount-arithmetic-inconsistency in database\n"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "amount-arithmetic-inconsistency"); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + "amount-arithmetic-inconsistency"); } return TALER_MHD_REPLY_JSON_PACK ( connection, diff --git a/src/auditor/taler-auditor-httpd_balances-del.c b/src/auditor/taler-auditor-httpd_balances-del.c deleted file mode 100644 index 4bbff0563..000000000 --- a/src/auditor/taler-auditor-httpd_balances-del.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#include "taler-auditor-httpd_balances-del.h" - - -MHD_RESULT -TAH_BALANCES_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - enum GNUNET_DB_QueryStatus qs; - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - 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); - } - - - // execute the transaction - qs = TAH_plugin->delete_balances (TAH_plugin->cls, - row_id); - - if (0 == qs) - { - // goes in here if there was an error with the transaction - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to handle DELETE /balances/ %s", - args[1]); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - } - - // on success? - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_NO_CONTENT, - GNUNET_JSON_pack_string ("status", - "BALANCES_OK")); - -} diff --git a/src/auditor/taler-auditor-httpd_balances-del.h b/src/auditor/taler-auditor-httpd_balances-del.h deleted file mode 100644 index 3c0460300..000000000 --- a/src/auditor/taler-auditor-httpd_balances-del.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_BALANCES_DEL_H -#define SRC_TALER_AUDITOR_HTTPD_BALANCES_DEL_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** - * Initialize subsystem. - */ -void -TEAH_BALANCES_DELETE_init (void); - -/** - * Shut down subsystem. - */ -void -TEAH_BALANCES_DELETE_done (void); - -/** - * Handle a "/balances" request. Parses the JSON, and, if - * successful, checks the signatures and stores the result in the DB. - * - * @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_BALANCES_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_BALANCES_DEL_H diff --git a/src/auditor/taler-auditor-httpd_balances-put.c b/src/auditor/taler-auditor-httpd_balances-put.c deleted file mode 100644 index 5667639df..000000000 --- a/src/auditor/taler-auditor-httpd_balances-put.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_balances-put.h" - -/** -* We have parsed the JSON information about the balances, do some -* basic sanity checks and then execute the -* transaction. -* -* @param connection the MHD connection to handle -* @param dc information about the balances -* @return MHD result code -*/ -static MHD_RESULT -process_inconsistency ( - struct MHD_Connection *connection, - const struct TALER_AUDITORDB_Balances *dc) -{ - - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - /* execute transaction */ - qs = TAH_plugin->insert_balances (TAH_plugin->cls, - dc); - if (0 > qs) - { - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to store /balances in database"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "balances"); - } - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_string ("status", - "BALANCES_OK")); -} - - -MHD_RESULT -TAH_BALANCES_handler_put ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - struct TALER_AUDITORDB_Balances dc; - - - struct GNUNET_JSON_Specification spec[] = { - - GNUNET_JSON_spec_string ("balance_key", (const char **) &dc.balance_key), - TALER_JSON_spec_amount ("balance_value", TAH_currency, &dc.balance_value), - - - GNUNET_JSON_spec_end () - }; - - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - MHD_RESULT res; - - res = process_inconsistency (connection, &dc); - GNUNET_JSON_parse_free (spec); - - json_decref (json); - return res; - -} - - -void -TEAH_BALANCES_PUT_init (void) -{ - -} - - -void -TEAH_BALANCES_PUT_done (void) -{ - -} diff --git a/src/auditor/taler-auditor-httpd_balances-put.h b/src/auditor/taler-auditor-httpd_balances-put.h deleted file mode 100644 index 8443924c7..000000000 --- a/src/auditor/taler-auditor-httpd_balances-put.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_BALANCES_PUT_H -#define SRC_TALER_AUDITOR_HTTPD_BALANCES_PUT_H - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** -* Initialize subsystem. -*/ -void -TEAH_BAD_BALANCES_init (void); - -/** -* Shut down subsystem. -*/ -void -TEAH_BAD_BALANCES_done (void); - - -/** -* Handle a "/balances" request. Parses the JSON, and, if -* successful, checks the signatures and stores the result in the DB. -* -* @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_BALANCES_handler_put (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_BALANCES_PUT_H diff --git a/src/auditor/taler-auditor-httpd_balances-upd.c b/src/auditor/taler-auditor-httpd_balances-upd.c deleted file mode 100644 index cf702ba3e..000000000 --- a/src/auditor/taler-auditor-httpd_balances-upd.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_balances-upd.h" - -MHD_RESULT -TAH_BALANCES_handler_update ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no row id specified"); - - - struct TALER_AUDITORDB_Generic_Update gu; - - gu.row_id = row_id; - - struct GNUNET_JSON_Specification spec[] = { - - // GNUNET_JSON_spec_uint64 ("row_id", &gu.row_id), - GNUNET_JSON_spec_bool ("suppressed", &gu.suppressed), - - GNUNET_JSON_spec_end () - }; - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - /* execute transaction */ - qs = TAH_plugin->update_balances (TAH_plugin->cls, &gu); - - GNUNET_JSON_parse_free (spec); - json_decref (json); - - MHD_RESULT ret = MHD_NO; - - switch (qs) - { - case GNUNET_DB_STATUS_HARD_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "update_account"); - break; - case GNUNET_DB_STATUS_SOFT_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, - "unexpected serialization problem"); - break; - case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, - "no updates executed"); - break; - case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: - ret = TALER_MHD_reply_static (connection, - MHD_HTTP_NO_CONTENT, - NULL, - NULL, - 0); - break; - } - - return ret; -} diff --git a/src/auditor/taler-auditor-httpd_balances-upd.h b/src/auditor/taler-auditor-httpd_balances-upd.h deleted file mode 100644 index 202258ab1..000000000 --- a/src/auditor/taler-auditor-httpd_balances-upd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_BALANCES_UPD_H -#define SRC_TALER_AUDITOR_HTTPD_BALANCES_UPD_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -MHD_RESULT -TAH_BALANCES_handler_update (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - -#endif // SRC_TALER_AUDITOR_HTTPD_BALANCES_UPD_H diff --git a/src/auditor/taler-auditor-httpd_exchange-signkeys-del.c b/src/auditor/taler-auditor-httpd_exchange-signkeys-del.c deleted file mode 100644 index 6fd52cc25..000000000 --- a/src/auditor/taler-auditor-httpd_exchange-signkeys-del.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#include "taler-auditor-httpd_exchange-signkeys-del.h" - - -MHD_RESULT -TAH_EXCHANGE_SIGNKEYS_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - enum GNUNET_DB_QueryStatus qs; - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - 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); - } - - - // execute the transaction - qs = TAH_plugin->delete_exchange_signkeys (TAH_plugin->cls, - row_id); - - if (0 == qs) - { - // goes in here if there was an error with the transaction - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to handle DELETE /exchange-signkeys/ %s", - args[1]); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - } - - // on success? - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_NO_CONTENT, - GNUNET_JSON_pack_string ("status", - "EXCHANGE_SIGNKEYS_OK")); - -} diff --git a/src/auditor/taler-auditor-httpd_exchange-signkeys-del.h b/src/auditor/taler-auditor-httpd_exchange-signkeys-del.h deleted file mode 100644 index ccb038666..000000000 --- a/src/auditor/taler-auditor-httpd_exchange-signkeys-del.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_DEL_H -#define SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_DEL_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** - * Initialize subsystem. - */ -void -TEAH_EXCHANGE_SIGNKEYS_DELETE_init (void); - -/** - * Shut down subsystem. - */ -void -TEAH_EXCHANGE_SIGNKEYS_DELETE_done (void); - -/** - * Handle a "/exchange-signkeys" request. Parses the JSON, and, if - * successful, checks the signatures and stores the result in the DB. - * - * @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_EXCHANGE_SIGNKEYS_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_DEL_H diff --git a/src/auditor/taler-auditor-httpd_exchange-signkeys-get.c b/src/auditor/taler-auditor-httpd_exchange-signkeys-get.c deleted file mode 100644 index 6d12ace6c..000000000 --- a/src/auditor/taler-auditor-httpd_exchange-signkeys-get.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_exchange-signkeys-get.h" - -/** -* Add exchange-signkeys to the list. -* -* @param[in,out] cls a `json_t *` array to extend -* @param serial_id location of the @a dc in the database -* @param dc struct of inconsistencies -* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating -*/ -static enum GNUNET_GenericReturnValue -process_exchange_signkeys (void *cls, - uint64_t serial_id, - const struct - TALER_AUDITORDB_ExchangeSignkeys - *dc) -{ - json_t *list = cls; - json_t *obj; - - obj = GNUNET_JSON_PACK ( - - GNUNET_JSON_pack_data_auto ("exchange_pub", &dc->exchange_pub), - GNUNET_JSON_pack_data_auto ("master_sig", &dc->master_sig), - TALER_JSON_pack_time_abs_human ("ep_valid_from", dc->ep_valid_from), - TALER_JSON_pack_time_abs_human ("ep_expire_sign", dc->ep_expire_sign), - TALER_JSON_pack_time_abs_human ("ep_expire_legal", dc->ep_expire_legal), - GNUNET_JSON_pack_bool ("suppressed", dc->suppressed) - - - ); - GNUNET_break (0 == - json_array_append_new (list, - obj)); - - - return GNUNET_OK; -} - - -/** -* -* @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_EXCHANGE_SIGNKEYS_handler_get (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - 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); - - int64_t limit = -20; - uint64_t offset; - - TALER_MHD_parse_request_snumber (connection, - "limit", - &limit); - - if (limit < 0) - offset = INT64_MAX; - else - offset = 0; - - TALER_MHD_parse_request_number (connection, - "offset", - &offset); - - bool return_suppressed = false; - const char *ret_s = MHD_lookup_connection_value (connection, - MHD_GET_ARGUMENT_KIND, - "return_suppressed"); - if (ret_s != NULL && strcmp (ret_s, "true") == 0) - { - return_suppressed = true; - } - - qs = TAH_plugin->get_exchange_signkeys ( - TAH_plugin->cls, - limit, - offset, - return_suppressed, - &process_exchange_signkeys, - ja); - - if (0 > qs) - { - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - json_decref (ja); - TALER_LOG_WARNING ( - "Failed to handle GET /exchange-signkeys"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "exchange-signkeys"); - } - return TALER_MHD_REPLY_JSON_PACK ( - connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("exchange-signkeys", - ja)); -} diff --git a/src/auditor/taler-auditor-httpd_exchange-signkeys-get.h b/src/auditor/taler-auditor-httpd_exchange-signkeys-get.h deleted file mode 100644 index 04592c05b..000000000 --- a/src/auditor/taler-auditor-httpd_exchange-signkeys-get.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - - #ifndef SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_GET_H -#define SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_GET_H - -#include <gnunet/gnunet_util_lib.h> -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** -* Initialize subsystem. -*/ -void -TEAH_EXCHANGE_SIGNKEYS_GET_init (void); - -/** -* Shut down subsystem. -*/ -void -TEAH_BAD_EXCHANGE_SIGNKEYS_GET_done (void); - -/** -* Handle a "/exchange-signkeys" 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_EXCHANGE_SIGNKEYS_handler_get (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_GET_H diff --git a/src/auditor/taler-auditor-httpd_exchange-signkeys-put.c b/src/auditor/taler-auditor-httpd_exchange-signkeys-put.c deleted file mode 100644 index bda5059c3..000000000 --- a/src/auditor/taler-auditor-httpd_exchange-signkeys-put.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_exchange-signkeys-put.h" - -/** -* We have parsed the JSON information about the exchange-signkeys, do some -* basic sanity checks and then execute the -* transaction. -* -* @param connection the MHD connection to handle -* @param dc information about the exchange-signkeys -* @return MHD result code -*/ -static MHD_RESULT -process_inconsistency ( - struct MHD_Connection *connection, - const struct TALER_AUDITORDB_ExchangeSignkeys *dc) -{ - - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - /* execute transaction */ - qs = TAH_plugin->insert_exchange_signkeys (TAH_plugin->cls, - dc); - if (0 > qs) - { - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to store /exchange-signkeys in database"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "exchange-signkeys"); - } - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_string ("status", - "EXCHANGE_SIGNKEYS_OK")); -} - - -MHD_RESULT -TAH_EXCHANGE_SIGNKEYS_handler_put ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - struct TALER_AUDITORDB_ExchangeSignkeys dc; - - struct GNUNET_TIME_Timestamp evf = { 0 }; - struct GNUNET_TIME_Timestamp ees = { 0 }; - struct GNUNET_TIME_Timestamp eel = { 0 }; - - struct GNUNET_JSON_Specification spec[] = { - - GNUNET_JSON_spec_fixed_auto ("exchange_pub", &dc.exchange_pub), - GNUNET_JSON_spec_fixed_auto ("master_sig", &dc.master_sig), - GNUNET_JSON_spec_timestamp ("ep_valid_from", &evf), - GNUNET_JSON_spec_timestamp ("ep_expire_sign", &ees), - GNUNET_JSON_spec_timestamp ("ep_expire_legal", &eel), - - GNUNET_JSON_spec_end () - }; - - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - dc.ep_expire_legal = eel.abs_time; - dc.ep_expire_sign = ees.abs_time; - dc.ep_valid_from = evf.abs_time; - - - MHD_RESULT res; - res = process_inconsistency (connection, &dc); - GNUNET_JSON_parse_free (spec); - - json_decref (json); - return res; - -} - - -void -TEAH_EXCHANGE_SIGNKEYS_PUT_init (void) -{ - -} - - -void -TEAH_EXCHANGE_SIGNKEYS_PUT_done (void) -{ - -} diff --git a/src/auditor/taler-auditor-httpd_exchange-signkeys-put.h b/src/auditor/taler-auditor-httpd_exchange-signkeys-put.h deleted file mode 100644 index ed19c2e3b..000000000 --- a/src/auditor/taler-auditor-httpd_exchange-signkeys-put.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_PUT_H -#define SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_PUT_H - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** -* Initialize subsystem. -*/ -void -TEAH_BAD_EXCHANGE_SIGNKEYS_init (void); - -/** -* Shut down subsystem. -*/ -void -TEAH_BAD_EXCHANGE_SIGNKEYS_done (void); - - -/** -* Handle a "/exchange-signkeys" request. Parses the JSON, and, if -* successful, checks the signatures and stores the result in the DB. -* -* @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_EXCHANGE_SIGNKEYS_handler_put (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_PUT_H diff --git a/src/auditor/taler-auditor-httpd_exchange-signkeys-upd.c b/src/auditor/taler-auditor-httpd_exchange-signkeys-upd.c deleted file mode 100644 index 3f8744a89..000000000 --- a/src/auditor/taler-auditor-httpd_exchange-signkeys-upd.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_exchange-signkeys-upd.h" - -MHD_RESULT -TAH_EXCHANGE_SIGNKEYS_handler_update ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no row id specified"); - - - struct TALER_AUDITORDB_Generic_Update gu; - - gu.row_id = row_id; - - struct GNUNET_JSON_Specification spec[] = { - - // GNUNET_JSON_spec_uint64 ("row_id", &gu.row_id), - GNUNET_JSON_spec_bool ("suppressed", &gu.suppressed), - - GNUNET_JSON_spec_end () - }; - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - /* execute transaction */ - qs = TAH_plugin->update_exchange_signkeys (TAH_plugin->cls, &gu); - - GNUNET_JSON_parse_free (spec); - json_decref (json); - - MHD_RESULT ret = MHD_NO; - - switch (qs) - { - case GNUNET_DB_STATUS_HARD_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "update_account"); - break; - case GNUNET_DB_STATUS_SOFT_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, - "unexpected serialization problem"); - break; - case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no updates executed"); - break; - case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: - ret = TALER_MHD_reply_static (connection, - MHD_HTTP_NO_CONTENT, - NULL, - NULL, - 0); - break; - } - - return ret; -} diff --git a/src/auditor/taler-auditor-httpd_exchange-signkeys-upd.h b/src/auditor/taler-auditor-httpd_exchange-signkeys-upd.h deleted file mode 100644 index 3dd8232f5..000000000 --- a/src/auditor/taler-auditor-httpd_exchange-signkeys-upd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_UPD_H -#define SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_UPD_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -MHD_RESULT -TAH_EXCHANGE_SIGNKEYS_handler_update (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - -#endif // SRC_TALER_AUDITOR_HTTPD_EXCHANGE_SIGNKEYS_UPD_H diff --git a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-del.c b/src/auditor/taler-auditor-httpd_historic-denomination-revenue-del.c deleted file mode 100644 index c7c6efb6c..000000000 --- a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-del.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#include "taler-auditor-httpd_historic-denomination-revenue-del.h" - - -MHD_RESULT -TAH_HISTORIC_DENOMINATION_REVENUE_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - enum GNUNET_DB_QueryStatus qs; - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - 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); - } - - - // execute the transaction - qs = TAH_plugin->delete_historic_denomination_revenue (TAH_plugin->cls, - row_id); - - if (0 == qs) - { - // goes in here if there was an error with the transaction - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to handle DELETE /historic-denomination-revenue/ %s", - args[1]); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - } - - // on success? - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_NO_CONTENT, - GNUNET_JSON_pack_string ("status", - "HISTORIC_DENOMINATION_REVENUE_OK")); - -} diff --git a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-del.h b/src/auditor/taler-auditor-httpd_historic-denomination-revenue-del.h deleted file mode 100644 index 60c4334bf..000000000 --- a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-del.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_HISTORIC_DENOMINATION_REVENUE_DEL_H -#define SRC_TALER_AUDITOR_HTTPD_HISTORIC_DENOMINATION_REVENUE_DEL_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** - * Initialize subsystem. - */ -void -TEAH_HISTORIC_DENOMINATION_REVENUE_DELETE_init (void); - -/** - * Shut down subsystem. - */ -void -TEAH_HISTORIC_DENOMINATION_REVENUE_DELETE_done (void); - -/** - * Handle a "/historic-denomination-revenue" request. Parses the JSON, and, if - * successful, checks the signatures and stores the result in the DB. - * - * @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_HISTORIC_DENOMINATION_REVENUE_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_HISTORIC_DENOMINATION_REVENUE_DEL_H diff --git a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-put.c b/src/auditor/taler-auditor-httpd_historic-denomination-revenue-put.c deleted file mode 100644 index 123e326e5..000000000 --- a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-put.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_historic-denomination-revenue-put.h" - -/** -* We have parsed the JSON information about the historic-denomination-revenue, do some -* basic sanity checks and then execute the -* transaction. -* -* @param connection the MHD connection to handle -* @param dc information about the historic-denomination-revenue -* @return MHD result code -*/ -static MHD_RESULT -process_inconsistency ( - struct MHD_Connection *connection, - const struct TALER_AUDITORDB_HistoricDenominationRevenue *dc) -{ - - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - /* execute transaction */ - qs = TAH_plugin->insert_historic_denomination_revenue (TAH_plugin->cls, - dc); - if (0 > qs) - { - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to store /historic-denomination-revenue in database"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "historic-denomination-revenue"); - } - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_string ("status", - "HISTORIC_DENOMINATION_REVENUE_OK")); -} - - -MHD_RESULT -TAH_HISTORIC_DENOMINATION_REVENUE_handler_put ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - struct TALER_AUDITORDB_HistoricDenominationRevenue dc; - - struct GNUNET_TIME_Timestamp rt = { 0 }; - - struct GNUNET_JSON_Specification spec[] = { - - GNUNET_JSON_spec_fixed_auto ("denom_pub_hash", &dc.denom_pub_hash), - GNUNET_JSON_spec_timestamp ("revenue_timestamp", &rt), - TALER_JSON_spec_amount ("revenue_balance", TAH_currency, - &dc.revenue_balance), - TALER_JSON_spec_amount ("loss_balance", TAH_currency, &dc.loss_balance), - - - GNUNET_JSON_spec_end () - }; - - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - dc.revenue_timestamp = rt.abs_time; - - MHD_RESULT res; - res = process_inconsistency (connection, &dc); - GNUNET_JSON_parse_free (spec); - - json_decref (json); - return res; - -} - - -void -TEAH_HISTORIC_DENOMINATION_REVENUE_PUT_init (void) -{ - -} - - -void -TEAH_HISTORIC_DENOMINATION_REVENUE_PUT_done (void) -{ - -} diff --git a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-put.h b/src/auditor/taler-auditor-httpd_historic-denomination-revenue-put.h deleted file mode 100644 index 0a0932ff0..000000000 --- a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-put.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_HISTORIC_DENOMINATION_REVENUE_PUT_H -#define SRC_TALER_AUDITOR_HTTPD_HISTORIC_DENOMINATION_REVENUE_PUT_H - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** -* Initialize subsystem. -*/ -void -TEAH_BAD_HISTORIC_DENOMINATION_REVENUE_init (void); - -/** -* Shut down subsystem. -*/ -void -TEAH_BAD_HISTORIC_DENOMINATION_REVENUE_done (void); - - -/** -* Handle a "/historic-denomination-revenue" request. Parses the JSON, and, if -* successful, checks the signatures and stores the result in the DB. -* -* @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_HISTORIC_DENOMINATION_REVENUE_handler_put (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_HISTORIC_DENOMINATION_REVENUE_PUT_H diff --git a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-upd.c b/src/auditor/taler-auditor-httpd_historic-denomination-revenue-upd.c deleted file mode 100644 index 0fd1daec0..000000000 --- a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-upd.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_historic-denomination-revenue-upd.h" - -MHD_RESULT -TAH_HISTORIC_DENOMINATION_REVENUE_handler_update ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no row id specified"); - - - struct TALER_AUDITORDB_Generic_Update gu; - - gu.row_id = row_id; - - struct GNUNET_JSON_Specification spec[] = { - - // GNUNET_JSON_spec_uint64 ("row_id", &gu.row_id), - GNUNET_JSON_spec_bool ("suppressed", &gu.suppressed), - - GNUNET_JSON_spec_end () - }; - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - /* execute transaction */ - qs = TAH_plugin->update_historic_denomination_revenue (TAH_plugin->cls, &gu); - - GNUNET_JSON_parse_free (spec); - json_decref (json); - - MHD_RESULT ret = MHD_NO; - - switch (qs) - { - case GNUNET_DB_STATUS_HARD_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "update_account"); - break; - case GNUNET_DB_STATUS_SOFT_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, - "unexpected serialization problem"); - break; - case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no updates executed"); - break; - case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: - ret = TALER_MHD_reply_static (connection, - MHD_HTTP_NO_CONTENT, - NULL, - NULL, - 0); - break; - } - - return ret; -} diff --git a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-upd.h b/src/auditor/taler-auditor-httpd_historic-denomination-revenue-upd.h deleted file mode 100644 index 2703da4d5..000000000 --- a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-upd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_HISTORIC_DENOMINATION_REVENUE_UPD_H -#define SRC_TALER_AUDITOR_HTTPD_HISTORIC_DENOMINATION_REVENUE_UPD_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -MHD_RESULT -TAH_HISTORIC_DENOMINATION_REVENUE_handler_update (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - -#endif // SRC_TALER_AUDITOR_HTTPD_HISTORIC_DENOMINATION_REVENUE_UPD_H diff --git a/src/auditor/taler-auditor-httpd_historic-reserve-summary-del.c b/src/auditor/taler-auditor-httpd_historic-reserve-summary-del.c deleted file mode 100644 index 244056f08..000000000 --- a/src/auditor/taler-auditor-httpd_historic-reserve-summary-del.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#include "taler-auditor-httpd_historic-reserve-summary-del.h" - - -MHD_RESULT -TAH_HISTORIC_RESERVE_SUMMARY_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - enum GNUNET_DB_QueryStatus qs; - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - 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); - } - - - // execute the transaction - qs = TAH_plugin->delete_historic_reserve_summary (TAH_plugin->cls, - row_id); - - if (0 == qs) - { - // goes in here if there was an error with the transaction - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to handle DELETE /historic-reserve-summary/ %s", - args[1]); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - } - - // on success? - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_NO_CONTENT, - GNUNET_JSON_pack_string ("status", - "HISTORIC_RESERVE_SUMMARY_OK")); - -} diff --git a/src/auditor/taler-auditor-httpd_historic-reserve-summary-del.h b/src/auditor/taler-auditor-httpd_historic-reserve-summary-del.h deleted file mode 100644 index ac0265ec5..000000000 --- a/src/auditor/taler-auditor-httpd_historic-reserve-summary-del.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_HISTORIC_RESERVE_SUMMARY_DEL_H -#define SRC_TALER_AUDITOR_HTTPD_HISTORIC_RESERVE_SUMMARY_DEL_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** - * Initialize subsystem. - */ -void -TEAH_HISTORIC_RESERVE_SUMMARY_DELETE_init (void); - -/** - * Shut down subsystem. - */ -void -TEAH_HISTORIC_RESERVE_SUMMARY_DELETE_done (void); - -/** - * Handle a "/historic-reserve-summary" request. Parses the JSON, and, if - * successful, checks the signatures and stores the result in the DB. - * - * @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_HISTORIC_RESERVE_SUMMARY_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_HISTORIC_RESERVE_SUMMARY_DEL_H diff --git a/src/auditor/taler-auditor-httpd_historic-reserve-summary-put.c b/src/auditor/taler-auditor-httpd_historic-reserve-summary-put.c deleted file mode 100644 index cb2d11586..000000000 --- a/src/auditor/taler-auditor-httpd_historic-reserve-summary-put.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_historic-reserve-summary-put.h" - -/** -* We have parsed the JSON information about the historic-reserve-summary, do some -* basic sanity checks and then execute the -* transaction. -* -* @param connection the MHD connection to handle -* @param dc information about the historic-reserve-summary -* @return MHD result code -*/ -static MHD_RESULT -process_inconsistency ( - struct MHD_Connection *connection, - const struct TALER_AUDITORDB_HistoricReserveSummary *dc) -{ - - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - /* execute transaction */ - qs = TAH_plugin->insert_historic_reserve_summary (TAH_plugin->cls, - dc); - if (0 > qs) - { - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to store /historic-reserve-summary in database"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "historic-reserve-summary"); - } - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_string ("status", - "HISTORIC_RESERVE_SUMMARY_OK")); -} - - -MHD_RESULT -TAH_HISTORIC_RESERVE_SUMMARY_handler_put ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - struct TALER_AUDITORDB_HistoricReserveSummary dc; - - struct GNUNET_TIME_Timestamp sd = { 0 }; - struct GNUNET_TIME_Timestamp ed = { 0 }; - - struct GNUNET_JSON_Specification spec[] = { - - GNUNET_JSON_spec_timestamp ("start_date", &sd), - GNUNET_JSON_spec_timestamp ("end_date", &ed), - TALER_JSON_spec_amount ("reserve_profits", TAH_currency, - &dc.reserve_profits), - - - GNUNET_JSON_spec_end () - }; - - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - dc.start_date = sd.abs_time; - dc.end_date = ed.abs_time; - - MHD_RESULT res; - res = process_inconsistency (connection, &dc); - GNUNET_JSON_parse_free (spec); - - json_decref (json); - return res; - -} - - -void -TEAH_HISTORIC_RESERVE_SUMMARY_PUT_init (void) -{ - -} - - -void -TEAH_HISTORIC_RESERVE_SUMMARY_PUT_done (void) -{ - -} diff --git a/src/auditor/taler-auditor-httpd_historic-reserve-summary-put.h b/src/auditor/taler-auditor-httpd_historic-reserve-summary-put.h deleted file mode 100644 index c554b5e03..000000000 --- a/src/auditor/taler-auditor-httpd_historic-reserve-summary-put.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_HISTORIC_RESERVE_SUMMARY_PUT_H -#define SRC_TALER_AUDITOR_HTTPD_HISTORIC_RESERVE_SUMMARY_PUT_H - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** -* Initialize subsystem. -*/ -void -TEAH_BAD_HISTORIC_RESERVE_SUMMARY_init (void); - -/** -* Shut down subsystem. -*/ -void -TEAH_BAD_HISTORIC_RESERVE_SUMMARY_done (void); - - -/** -* Handle a "/historic-reserve-summary" request. Parses the JSON, and, if -* successful, checks the signatures and stores the result in the DB. -* -* @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_HISTORIC_RESERVE_SUMMARY_handler_put (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_HISTORIC_RESERVE_SUMMARY_PUT_H diff --git a/src/auditor/taler-auditor-httpd_historic-reserve-summary-upd.c b/src/auditor/taler-auditor-httpd_historic-reserve-summary-upd.c deleted file mode 100644 index 39debc46d..000000000 --- a/src/auditor/taler-auditor-httpd_historic-reserve-summary-upd.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_historic-reserve-summary-upd.h" - -MHD_RESULT -TAH_HISTORIC_RESERVE_SUMMARY_handler_update ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no row id specified"); - - - struct TALER_AUDITORDB_Generic_Update gu; - - gu.row_id = row_id; - - struct GNUNET_JSON_Specification spec[] = { - - // GNUNET_JSON_spec_uint64 ("row_id", &gu.row_id), - GNUNET_JSON_spec_bool ("suppressed", &gu.suppressed), - - GNUNET_JSON_spec_end () - }; - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - /* execute transaction */ - qs = TAH_plugin->update_historic_reserve_summary (TAH_plugin->cls, &gu); - - GNUNET_JSON_parse_free (spec); - json_decref (json); - - MHD_RESULT ret = MHD_NO; - - switch (qs) - { - case GNUNET_DB_STATUS_HARD_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "update_account"); - break; - case GNUNET_DB_STATUS_SOFT_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, - "unexpected serialization problem"); - break; - case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no updates executed"); - break; - case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: - ret = TALER_MHD_reply_static (connection, - MHD_HTTP_NO_CONTENT, - NULL, - NULL, - 0); - break; - } - - return ret; -} diff --git a/src/auditor/taler-auditor-httpd_historic-reserve-summary-upd.h b/src/auditor/taler-auditor-httpd_historic-reserve-summary-upd.h deleted file mode 100644 index 7138285af..000000000 --- a/src/auditor/taler-auditor-httpd_historic-reserve-summary-upd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_HISTORIC_RESERVE_SUMMARY_UPD_H -#define SRC_TALER_AUDITOR_HTTPD_HISTORIC_RESERVE_SUMMARY_UPD_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -MHD_RESULT -TAH_HISTORIC_RESERVE_SUMMARY_handler_update (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - -#endif // SRC_TALER_AUDITOR_HTTPD_HISTORIC_RESERVE_SUMMARY_UPD_H diff --git a/src/auditor/taler-auditor-httpd_progress-del.c b/src/auditor/taler-auditor-httpd_progress-del.c deleted file mode 100644 index 53a904b50..000000000 --- a/src/auditor/taler-auditor-httpd_progress-del.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#include "taler-auditor-httpd_progress-del.h" - - -MHD_RESULT -TAH_PROGRESS_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - enum GNUNET_DB_QueryStatus qs; - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - 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); - } - - - // execute the transaction - qs = TAH_plugin->delete_progress (TAH_plugin->cls, - row_id); - - if (0 > qs) - { - // goes in here if there was an error with the transaction - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to handle DELETE /progress/ %s\n", - args[1]); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - } - - // on success? - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_NO_CONTENT, - GNUNET_JSON_pack_string ("status", - "PROGRESS_OK")); - -} diff --git a/src/auditor/taler-auditor-httpd_progress-del.h b/src/auditor/taler-auditor-httpd_progress-del.h deleted file mode 100644 index 603a0d727..000000000 --- a/src/auditor/taler-auditor-httpd_progress-del.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_PROGRESS_DEL_H -#define SRC_TALER_AUDITOR_HTTPD_PROGRESS_DEL_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** -* Initialize subsystem. -*/ -void -TEAH_PROGRESS_DELETE_init (void); - -/** -* Shut down subsystem. -*/ -void -TEAH_PROGRESS_DELETE_done (void); - -/** -* Handle a "/progress" request. Parses the JSON, and, if -* successful, checks the signatures and stores the result in the DB. -* -* @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_PROGRESS_handler_delete (struct - TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - -#endif // SRC_TALER_AUDITOR_HTTPD_PROGRESS_DEL_H diff --git a/src/auditor/taler-auditor-httpd_progress-upd.c b/src/auditor/taler-auditor-httpd_progress-upd.c deleted file mode 100644 index 9e3091788..000000000 --- a/src/auditor/taler-auditor-httpd_progress-upd.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_progress-upd.h" - -MHD_RESULT -TAH_PROGRESS_handler_update ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no row id specified"); - - - struct TALER_AUDITORDB_Generic_Update gu; - - gu.row_id = row_id; - - struct GNUNET_JSON_Specification spec[] = { - - // GNUNET_JSON_spec_uint64 ("row_id", &gu.row_id), - GNUNET_JSON_spec_bool ("suppressed", &gu.suppressed), - - GNUNET_JSON_spec_end () - }; - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - /* execute transaction */ - qs = TAH_plugin->update_progress (TAH_plugin->cls, &gu); - - GNUNET_JSON_parse_free (spec); - json_decref (json); - - MHD_RESULT ret = MHD_NO; - - switch (qs) - { - case GNUNET_DB_STATUS_HARD_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "update_account"); - break; - case GNUNET_DB_STATUS_SOFT_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, - "unexpected serialization problem"); - break; - case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no updates executed"); - break; - case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: - ret = TALER_MHD_reply_static (connection, - MHD_HTTP_NO_CONTENT, - NULL, - NULL, - 0); - break; - } - - return ret; -} diff --git a/src/auditor/taler-auditor-httpd_progress-upd.h b/src/auditor/taler-auditor-httpd_progress-upd.h deleted file mode 100644 index 59d85bf2e..000000000 --- a/src/auditor/taler-auditor-httpd_progress-upd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_PROGRESS_UPD_H -#define SRC_TALER_AUDITOR_HTTPD_PROGRESS_UPD_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -MHD_RESULT -TAH_PROGRESS_handler_update (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - -#endif // SRC_TALER_AUDITOR_HTTPD_PROGRESS_UPD_H diff --git a/src/auditor/taler-auditor-httpd_purses-del.c b/src/auditor/taler-auditor-httpd_purses-del.c deleted file mode 100644 index b7ad17a75..000000000 --- a/src/auditor/taler-auditor-httpd_purses-del.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#include "taler-auditor-httpd_purses-del.h" - - -MHD_RESULT -TAH_PURSES_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - enum GNUNET_DB_QueryStatus qs; - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - 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); - } - - - // execute the transaction - qs = TAH_plugin->delete_purses (TAH_plugin->cls, - row_id); - - if (0 == qs) - { - // goes in here if there was an error with the transaction - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to handle DELETE /purses/ %s", - args[1]); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - } - - // on success? - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_NO_CONTENT, - GNUNET_JSON_pack_string ("status", - "PURSES_OK")); - -} diff --git a/src/auditor/taler-auditor-httpd_purses-del.h b/src/auditor/taler-auditor-httpd_purses-del.h deleted file mode 100644 index b2c1bf98f..000000000 --- a/src/auditor/taler-auditor-httpd_purses-del.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_PURSES_DEL_H -#define SRC_TALER_AUDITOR_HTTPD_PURSES_DEL_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** - * Initialize subsystem. - */ -void -TEAH_PURSES_DELETE_init (void); - -/** - * Shut down subsystem. - */ -void -TEAH_PURSES_DELETE_done (void); - -/** - * Handle a "/purses" request. Parses the JSON, and, if - * successful, checks the signatures and stores the result in the DB. - * - * @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_PURSES_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_PURSES_DEL_H diff --git a/src/auditor/taler-auditor-httpd_purses-put.c b/src/auditor/taler-auditor-httpd_purses-put.c deleted file mode 100644 index 07b1f7f11..000000000 --- a/src/auditor/taler-auditor-httpd_purses-put.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_purses-put.h" - -/** -* We have parsed the JSON information about the purses, do some -* basic sanity checks and then execute the -* transaction. -* -* @param connection the MHD connection to handle -* @param dc information about the purses -* @return MHD result code -*/ -static MHD_RESULT -process_inconsistency ( - struct MHD_Connection *connection, - const struct TALER_AUDITORDB_Purses *dc) -{ - - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - /* execute transaction */ - qs = TAH_plugin->insert_purses (TAH_plugin->cls, - dc); - if (0 > qs) - { - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to store /purses in database"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "purses"); - } - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_string ("status", - "PURSES_OK")); -} - - -MHD_RESULT -TAH_PURSES_handler_put ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - struct TALER_AUDITORDB_Purses dc; - - struct GNUNET_TIME_Timestamp ed = { 0 }; - - struct GNUNET_JSON_Specification spec[] = { - - GNUNET_JSON_spec_int64 ("auditor_purses_rowid", &dc.auditor_purses_rowid), - GNUNET_JSON_spec_fixed_auto ("purse_pub", &dc.purse_pub), - TALER_JSON_spec_amount ("balance", TAH_currency, &dc.balance), - TALER_JSON_spec_amount ("target", TAH_currency, &dc.target), - GNUNET_JSON_spec_timestamp ("expiration_date", &ed), - - - GNUNET_JSON_spec_end () - }; - - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - dc.expiration_date = ed.abs_time; - - MHD_RESULT res; - res = process_inconsistency (connection, &dc); - GNUNET_JSON_parse_free (spec); - - json_decref (json); - return res; - -} - - -void -TEAH_PURSES_PUT_init (void) -{ - -} - - -void -TEAH_PURSES_PUT_done (void) -{ - -} diff --git a/src/auditor/taler-auditor-httpd_purses-put.h b/src/auditor/taler-auditor-httpd_purses-put.h deleted file mode 100644 index 6a44d9a49..000000000 --- a/src/auditor/taler-auditor-httpd_purses-put.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_PURSES_PUT_H -#define SRC_TALER_AUDITOR_HTTPD_PURSES_PUT_H - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** -* Initialize subsystem. -*/ -void -TEAH_BAD_PURSES_init (void); - -/** -* Shut down subsystem. -*/ -void -TEAH_BAD_PURSES_done (void); - - -/** -* Handle a "/purses" request. Parses the JSON, and, if -* successful, checks the signatures and stores the result in the DB. -* -* @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_PURSES_handler_put (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_PURSES_PUT_H diff --git a/src/auditor/taler-auditor-httpd_purses-upd.c b/src/auditor/taler-auditor-httpd_purses-upd.c deleted file mode 100644 index 56e561b63..000000000 --- a/src/auditor/taler-auditor-httpd_purses-upd.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_purses-upd.h" - -MHD_RESULT -TAH_PURSES_handler_update ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - struct TALER_AUDITORDB_Generic_Update gu; - - struct GNUNET_JSON_Specification spec[] = { - - GNUNET_JSON_spec_uint64 ("auditor_purses_rowid", &gu.row_id), - GNUNET_JSON_spec_bool ("suppressed", &gu.suppressed), - - GNUNET_JSON_spec_end () - }; - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - /* execute transaction */ - qs = TAH_plugin->update_purses (TAH_plugin->cls, &gu); - - GNUNET_JSON_parse_free (spec); - json_decref (json); - - MHD_RESULT ret = MHD_NO; - - switch (qs) - { - case GNUNET_DB_STATUS_HARD_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "update_account"); - break; - case GNUNET_DB_STATUS_SOFT_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, - "unexpected serialization problem"); - break; - case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no updates executed"); - break; - case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: - ret = TALER_MHD_reply_static (connection, - MHD_HTTP_NO_CONTENT, - NULL, - NULL, - 0); - break; - } - - return ret; -} diff --git a/src/auditor/taler-auditor-httpd_purses-upd.h b/src/auditor/taler-auditor-httpd_purses-upd.h deleted file mode 100644 index 317047f16..000000000 --- a/src/auditor/taler-auditor-httpd_purses-upd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_PURSES_UPD_H -#define SRC_TALER_AUDITOR_HTTPD_PURSES_UPD_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -MHD_RESULT -TAH_PURSES_handler_update (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - -#endif // SRC_TALER_AUDITOR_HTTPD_PURSES_UPD_H diff --git a/src/auditor/taler-auditor-httpd_reserves-del.c b/src/auditor/taler-auditor-httpd_reserves-del.c deleted file mode 100644 index ffe84417e..000000000 --- a/src/auditor/taler-auditor-httpd_reserves-del.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#include "taler-auditor-httpd_reserves-del.h" - - -MHD_RESULT -TAH_RESERVES_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - - enum GNUNET_DB_QueryStatus qs; - - uint64_t row_id; - - if (args[2] != NULL) - row_id = atoi (args[2]); - else - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - 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); - } - - - // execute the transaction - qs = TAH_plugin->delete_reserves (TAH_plugin->cls, - row_id); - - if (0 == qs) - { - // goes in here if there was an error with the transaction - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to handle DELETE /reserves/ %s", - args[1]); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "row could not be found"); - - } - - // on success? - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_NO_CONTENT, - GNUNET_JSON_pack_string ("status", - "RESERVES_OK")); - -} diff --git a/src/auditor/taler-auditor-httpd_reserves-del.h b/src/auditor/taler-auditor-httpd_reserves-del.h deleted file mode 100644 index bd5336f3a..000000000 --- a/src/auditor/taler-auditor-httpd_reserves-del.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_RESERVES_DEL_H -#define SRC_TALER_AUDITOR_HTTPD_RESERVES_DEL_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** - * Initialize subsystem. - */ -void -TEAH_RESERVES_DELETE_init (void); - -/** - * Shut down subsystem. - */ -void -TEAH_RESERVES_DELETE_done (void); - -/** - * Handle a "/reserves" request. Parses the JSON, and, if - * successful, checks the signatures and stores the result in the DB. - * - * @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_RESERVES_handler_delete (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_RESERVES_DEL_H diff --git a/src/auditor/taler-auditor-httpd_reserves-put.c b/src/auditor/taler-auditor-httpd_reserves-put.c deleted file mode 100644 index e36e80732..000000000 --- a/src/auditor/taler-auditor-httpd_reserves-put.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_reserves-put.h" - -/** -* We have parsed the JSON information about the reserves, do some -* basic sanity checks and then execute the -* transaction. -* -* @param connection the MHD connection to handle -* @param dc information about the reserves -* @return MHD result code -*/ -static MHD_RESULT -process_inconsistency ( - struct MHD_Connection *connection, - const struct TALER_AUDITORDB_Reserves *dc) -{ - - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - /* execute transaction */ - qs = TAH_plugin->insert_reserves (TAH_plugin->cls, - dc); - if (0 > qs) - { - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); - TALER_LOG_WARNING ( - "Failed to store /reserves in database"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "reserves"); - } - return TALER_MHD_REPLY_JSON_PACK (connection, - MHD_HTTP_OK, - GNUNET_JSON_pack_string ("status", - "RESERVES_OK")); -} - - -MHD_RESULT -TAH_RESERVES_handler_put ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - - struct TALER_AUDITORDB_Reserves dc; - - struct GNUNET_TIME_Timestamp ed = { 0 }; - - struct GNUNET_JSON_Specification spec[] = { - - GNUNET_JSON_spec_fixed_auto ("reserve_pub", &dc.reserve_pub), - TALER_JSON_spec_amount ("reserve_balance", TAH_currency, - &dc.reserve_balance), - TALER_JSON_spec_amount ("reserve_loss", TAH_currency, &dc.reserve_loss), - TALER_JSON_spec_amount ("withdraw_fee_balance", TAH_currency, - &dc.withdraw_fee_balance), - TALER_JSON_spec_amount ("close_fee_balance", TAH_currency, - &dc.close_fee_balance), - TALER_JSON_spec_amount ("purse_fee_balance", TAH_currency, - &dc.purse_fee_balance), - TALER_JSON_spec_amount ("open_fee_balance", TAH_currency, - &dc.open_fee_balance), - TALER_JSON_spec_amount ("history_fee_balance", TAH_currency, - &dc.history_fee_balance), - GNUNET_JSON_spec_timestamp ("expiration_date", &ed), - GNUNET_JSON_spec_string ("origin_account", (const - char **) &dc.origin_account), - - - GNUNET_JSON_spec_end () - }; - - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - dc.expiration_date = ed.abs_time; - - MHD_RESULT res; - res = process_inconsistency (connection, &dc); - GNUNET_JSON_parse_free (spec); - - json_decref (json); - return res; - -} - - -void -TEAH_RESERVES_PUT_init (void) -{ - -} - - -void -TEAH_RESERVES_PUT_done (void) -{ - -} diff --git a/src/auditor/taler-auditor-httpd_reserves-put.h b/src/auditor/taler-auditor-httpd_reserves-put.h deleted file mode 100644 index 5e8c89bf7..000000000 --- a/src/auditor/taler-auditor-httpd_reserves-put.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_RESERVES_PUT_H -#define SRC_TALER_AUDITOR_HTTPD_RESERVES_PUT_H - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -/** -* Initialize subsystem. -*/ -void -TEAH_BAD_RESERVES_init (void); - -/** -* Shut down subsystem. -*/ -void -TEAH_BAD_RESERVES_done (void); - - -/** -* Handle a "/reserves" request. Parses the JSON, and, if -* successful, checks the signatures and stores the result in the DB. -* -* @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_RESERVES_handler_put (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - - -#endif // SRC_TALER_AUDITOR_HTTPD_RESERVES_PUT_H diff --git a/src/auditor/taler-auditor-httpd_reserves-upd.c b/src/auditor/taler-auditor-httpd_reserves-upd.c deleted file mode 100644 index 6d6a74d18..000000000 --- a/src/auditor/taler-auditor-httpd_reserves-upd.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#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_reserves-upd.h" - -MHD_RESULT -TAH_RESERVES_handler_update ( - struct TAH_RequestHandler *rh, - struct MHD_Connection *connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]) -{ - enum GNUNET_DB_QueryStatus qs; - - 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); - } - - struct TALER_AUDITORDB_Generic_Update gu; - - struct GNUNET_JSON_Specification spec[] = { - - GNUNET_JSON_spec_uint64 ("auditor_reserves_rowid", &gu.row_id), - GNUNET_JSON_spec_bool ("suppressed", &gu.suppressed), - - GNUNET_JSON_spec_end () - }; - - json_t *json; - - (void) rh; - (void) connection_cls; - (void) upload_data; - (void) upload_data_size; - { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json); - return MHD_YES; /* failure */ - } - } - - /* execute transaction */ - qs = TAH_plugin->update_reserves (TAH_plugin->cls, &gu); - - GNUNET_JSON_parse_free (spec); - json_decref (json); - - MHD_RESULT ret = MHD_NO; - - switch (qs) - { - case GNUNET_DB_STATUS_HARD_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_STORE_FAILED, - "update_account"); - break; - case GNUNET_DB_STATUS_SOFT_ERROR: - GNUNET_break (0); - ret = TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, - "unexpected serialization problem"); - break; - case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, - "no updates executed"); - break; - case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: - ret = TALER_MHD_reply_static (connection, - MHD_HTTP_NO_CONTENT, - NULL, - NULL, - 0); - break; - } - - return ret; -} diff --git a/src/auditor/taler-auditor-httpd_reserves-upd.h b/src/auditor/taler-auditor-httpd_reserves-upd.h deleted file mode 100644 index 650cd51f3..000000000 --- a/src/auditor/taler-auditor-httpd_reserves-upd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2024 Taler Systems SA - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - - -#ifndef SRC_TALER_AUDITOR_HTTPD_RESERVES_UPD_H -#define SRC_TALER_AUDITOR_HTTPD_RESERVES_UPD_H - - -#include <microhttpd.h> -#include "taler-auditor-httpd.h" - -MHD_RESULT -TAH_RESERVES_handler_update (struct TAH_RequestHandler *rh, - struct MHD_Connection * - connection, - void **connection_cls, - const char *upload_data, - size_t *upload_data_size, - const char *const args[]); - -#endif // SRC_TALER_AUDITOR_HTTPD_RESERVES_UPD_H diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h index c038024d1..c4186e50f 100644 --- a/src/include/taler_auditordb_plugin.h +++ b/src/include/taler_auditordb_plugin.h @@ -999,7 +999,7 @@ struct TALER_AUDITORDB_Plugin * #GNUNET_SYSERR if we have no DB connection */ enum GNUNET_GenericReturnValue - (*preflight)(void *cls); + (*preflight)(void *cls); /** @@ -1056,8 +1056,8 @@ struct TALER_AUDITORDB_Plugin * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure */ enum GNUNET_GenericReturnValue - (*drop_tables)(void *cls, - bool drop_exchangelist); + (*drop_tables)(void *cls, + bool drop_exchangelist); /** @@ -1069,9 +1069,9 @@ struct TALER_AUDITORDB_Plugin * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure */ enum GNUNET_GenericReturnValue - (*create_tables)(void *cls, - bool support_partitions, - uint32_t num_partitions); + (*create_tables)(void *cls, + bool support_partitions, + uint32_t num_partitions); /** @@ -1081,7 +1081,7 @@ struct TALER_AUDITORDB_Plugin * @return #GNUNET_OK on success */ enum GNUNET_GenericReturnValue - (*start)(void *cls); + (*start)(void *cls); /** @@ -1091,7 +1091,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*commit)(void *cls); + (*commit)(void *cls); /** @@ -1112,7 +1112,7 @@ struct TALER_AUDITORDB_Plugin * #GNUNET_SYSERR on DB errors */ enum GNUNET_GenericReturnValue - (*gc)(void *cls); + (*gc)(void *cls); /** @@ -1126,13 +1126,12 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_auditor_progress)( + (*insert_auditor_progress)( void *cls, const char *progress_key, uint64_t progress_offset, ...); - /** * Update information about the progress of the auditor. There * must be an existing record for the exchange. @@ -1144,13 +1143,12 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*update_auditor_progress)( + (*update_auditor_progress)( void *cls, const char *progress_key, uint64_t progress_offset, ...); - /** * Get information about the progress of the auditor. * @@ -1161,10 +1159,10 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*get_auditor_progress)(void *cls, - const char *progress_key, - uint64_t *progress_offset, - ...); + (*get_auditor_progress)(void *cls, + const char *progress_key, + uint64_t *progress_offset, + ...); /** @@ -1178,10 +1176,10 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_balance)(void *cls, - const char *balance_key, - const struct TALER_Amount *balance_value, - ...); + (*insert_balance)(void *cls, + const char *balance_key, + const struct TALER_Amount *balance_value, + ...); /** @@ -1195,10 +1193,10 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*update_balance)(void *cls, - const char *balance_key, - const struct TALER_Amount *balance_amount, - ...); + (*update_balance)(void *cls, + const char *balance_key, + const struct TALER_Amount *balance_amount, + ...); /** @@ -1211,10 +1209,10 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*get_balance)(void *cls, - const char *balance_key, - struct TALER_Amount *balance_value, - ...); + (*get_balance)(void *cls, + const char *balance_key, + struct TALER_Amount *balance_value, + ...); /** @@ -1225,7 +1223,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*insert_exchange_signkey)( + (*insert_exchange_signkey)( void *cls, const struct TALER_AUDITORDB_ExchangeSigningKey *sk); @@ -1238,7 +1236,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*insert_deposit_confirmation)( + (*insert_deposit_confirmation)( void *cls, const struct TALER_AUDITORDB_DepositConfirmation *dc); @@ -1255,7 +1253,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*get_deposit_confirmations)( + (*get_deposit_confirmations)( void *cls, int64_t limit, uint64_t offset, @@ -1272,7 +1270,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*delete_deposit_confirmation)( + (*delete_deposit_confirmation)( void *cls, uint64_t row_id); @@ -1290,7 +1288,7 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*get_amount_arithmetic_inconsistency)( + (*get_amount_arithmetic_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1299,7 +1297,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_coin_inconsistency)( + (*get_coin_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1308,7 +1306,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_row_inconsistency)( + (*get_row_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1317,7 +1315,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_emergency)( + (*get_emergency)( void *cls, int64_t limit, uint64_t offset, @@ -1326,7 +1324,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_emergency_by_count)( + (*get_emergency_by_count)( void *cls, int64_t limit, uint64_t offset, @@ -1335,7 +1333,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_denomination_key_validity_withdraw_inconsistency)( + (*get_denomination_key_validity_withdraw_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1344,7 +1342,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_purse_not_closed_inconsistencies)( + (*get_purse_not_closed_inconsistencies)( void *cls, int64_t limit, uint64_t offset, @@ -1353,7 +1351,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_reserve_balance_insufficient_inconsistency)( + (*get_reserve_balance_insufficient_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1362,7 +1360,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_bad_sig_losses)( + (*get_bad_sig_losses)( void *cls, int64_t limit, uint64_t offset, @@ -1374,7 +1372,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_auditor_closure_lags)( + (*get_auditor_closure_lags)( void *cls, int64_t limit, uint64_t offset, @@ -1383,7 +1381,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_progress)( + (*get_progress)( void *cls, int64_t limit, uint64_t offset, @@ -1392,7 +1390,7 @@ struct TALER_AUDITORDB_Plugin void *cb_cls); enum GNUNET_DB_QueryStatus - (*get_refreshes_hanging)( + (*get_refreshes_hanging)( void *cls, int64_t limit, uint64_t offset, @@ -1408,62 +1406,62 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*delete_amount_arithmetic_inconsistency)( + (*delete_amount_arithmetic_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_coin_inconsistency)( + (*delete_coin_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_row_inconsistency)( + (*delete_row_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_emergency)( + (*delete_emergency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_emergency_by_count)( + (*delete_emergency_by_count)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_denomination_key_validity_withdraw_inconsistency)( + (*delete_denomination_key_validity_withdraw_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_purse_not_closed_inconsistencies)( + (*delete_purse_not_closed_inconsistencies)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_reserve_balance_insufficient_inconsistency)( + (*delete_reserve_balance_insufficient_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_bad_sig_losses)( + (*delete_bad_sig_losses)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_auditor_closure_lags)( + (*delete_auditor_closure_lags)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_progress)( + (*delete_progress)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*delete_refreshes_hanging)( + (*delete_refreshes_hanging)( void *cls, uint64_t row_id); @@ -1476,145 +1474,145 @@ struct TALER_AUDITORDB_Plugin * @return query result status */ enum GNUNET_DB_QueryStatus - (*insert_amount_arithmetic_inconsistency)( + (*insert_amount_arithmetic_inconsistency)( void *cls, const struct TALER_AUDITORDB_AmountArithmeticInconsistency *dc); enum GNUNET_DB_QueryStatus - (*insert_coin_inconsistency)( + (*insert_coin_inconsistency)( void *cls, const struct TALER_AUDITORDB_CoinInconsistency *dc); enum GNUNET_DB_QueryStatus - (*insert_row_inconsistency)( + (*insert_row_inconsistency)( void *cls, const struct TALER_AUDITORDB_RowInconsistency *dc); enum GNUNET_DB_QueryStatus - (*insert_emergency)( + (*insert_emergency)( void *cls, const struct TALER_AUDITORDB_Emergency *dc); enum GNUNET_DB_QueryStatus - (*insert_emergency_by_count)( + (*insert_emergency_by_count)( void *cls, const struct TALER_AUDITORDB_EmergenciesByCount *dc); enum GNUNET_DB_QueryStatus - (*insert_denomination_key_validity_withdraw_inconsistency)( + (*insert_denomination_key_validity_withdraw_inconsistency)( void *cls, const struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency *dc); enum GNUNET_DB_QueryStatus - (*insert_purse_not_closed_inconsistencies)( + (*insert_purse_not_closed_inconsistencies)( void *cls, const struct TALER_AUDITORDB_PurseNotClosedInconsistencies *dc); enum GNUNET_DB_QueryStatus - (*insert_reserve_balance_insufficient_inconsistency)( + (*insert_reserve_balance_insufficient_inconsistency)( void *cls, const struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency *dc); enum GNUNET_DB_QueryStatus - (*insert_bad_sig_losses)( + (*insert_bad_sig_losses)( void *cls, const struct TALER_AUDITORDB_BadSigLosses *dc); enum GNUNET_DB_QueryStatus - (*insert_auditor_closure_lags)( + (*insert_auditor_closure_lags)( void *cls, const struct TALER_AUDITORDB_ClosureLags *dc); enum GNUNET_DB_QueryStatus - (*insert_progress)( + (*insert_progress)( void *cls, const struct TALER_AUDITORDB_Progress *dc); enum GNUNET_DB_QueryStatus - (*insert_refreshes_hanging)( + (*insert_refreshes_hanging)( void *cls, const struct TALER_AUDITORDB_RefreshesHanging *dc); enum GNUNET_DB_QueryStatus - (*update_bad_sig_losses)( + (*update_bad_sig_losses)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_emergency_by_count)( + (*update_emergency_by_count)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_row_inconsistency)( + (*update_row_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_purse_not_closed_inconsistencies)( + (*update_purse_not_closed_inconsistencies)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_reserve_balance_insufficient_inconsistency)( + (*update_reserve_balance_insufficient_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_coin_inconsistency)( + (*update_coin_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_progress)( + (*update_progress)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_denomination_key_validity_withdraw_inconsistency)( + (*update_denomination_key_validity_withdraw_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_refreshes_hanging)( + (*update_refreshes_hanging)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_emergency)( + (*update_emergency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_closure_lags)( + (*update_closure_lags)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_amount_arithmetic_inconsistency)( + (*update_amount_arithmetic_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*update_deposit_confirmations)( + (*update_deposit_confirmations)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_reserve_in_inconsistency)( + (*get_reserve_in_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1624,25 +1622,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_reserve_in_inconsistency)( + (*delete_reserve_in_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_reserve_in_inconsistency)( + (*insert_reserve_in_inconsistency)( void *cls, const struct TALER_AUDITORDB_ReserveInInconsistency *dc); enum GNUNET_DB_QueryStatus - (*update_reserve_in_inconsistency)( + (*update_reserve_in_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_reserve_not_closed_inconsistency)( + (*get_reserve_not_closed_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1652,25 +1650,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_reserve_not_closed_inconsistency)( + (*delete_reserve_not_closed_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_reserve_not_closed_inconsistency)( + (*insert_reserve_not_closed_inconsistency)( void *cls, const struct TALER_AUDITORDB_ReserveNotClosedInconsistency *dc); enum GNUNET_DB_QueryStatus - (*update_reserve_not_closed_inconsistency)( + (*update_reserve_not_closed_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_denominations_without_sigs)( + (*get_denominations_without_sigs)( void *cls, int64_t limit, uint64_t offset, @@ -1680,25 +1678,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_denominations_without_sigs)( + (*delete_denominations_without_sigs)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_denominations_without_sigs)( + (*insert_denominations_without_sigs)( void *cls, const struct TALER_AUDITORDB_DenominationsWithoutSigs *dc); enum GNUNET_DB_QueryStatus - (*update_denominations_without_sigs)( + (*update_denominations_without_sigs)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_misattribution_in_inconsistency)( + (*get_misattribution_in_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1708,25 +1706,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_misattribution_in_inconsistency)( + (*delete_misattribution_in_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_misattribution_in_inconsistency)( + (*insert_misattribution_in_inconsistency)( void *cls, const struct TALER_AUDITORDB_MisattributionInInconsistency *dc); enum GNUNET_DB_QueryStatus - (*update_misattribution_in_inconsistency)( + (*update_misattribution_in_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_reserves)( + (*get_reserves)( void *cls, int64_t limit, uint64_t offset, @@ -1736,25 +1734,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_reserves)( + (*delete_reserves)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_reserves)( + (*insert_reserves)( void *cls, const struct TALER_AUDITORDB_Reserves *dc); enum GNUNET_DB_QueryStatus - (*update_reserves)( + (*update_reserves)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_purses)( + (*get_purses)( void *cls, int64_t limit, uint64_t offset, @@ -1764,25 +1762,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_purses)( + (*delete_purses)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_purses)( + (*insert_purses)( void *cls, const struct TALER_AUDITORDB_Purses *dc); enum GNUNET_DB_QueryStatus - (*update_purses)( + (*update_purses)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_historic_denomination_revenue)( + (*get_historic_denomination_revenue)( void *cls, int64_t limit, uint64_t offset, @@ -1792,25 +1790,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_historic_denomination_revenue)( + (*delete_historic_denomination_revenue)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_historic_denomination_revenue)( + (*insert_historic_denomination_revenue)( void *cls, const struct TALER_AUDITORDB_HistoricDenominationRevenue *dc); enum GNUNET_DB_QueryStatus - (*update_historic_denomination_revenue)( + (*update_historic_denomination_revenue)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_denomination_pending)( + (*get_denomination_pending)( void *cls, int64_t limit, uint64_t offset, @@ -1820,25 +1818,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_denomination_pending)( + (*delete_denomination_pending)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_denomination_pending)( + (*insert_denomination_pending)( void *cls, const struct TALER_AUDITORDB_DenominationPending *dc); enum GNUNET_DB_QueryStatus - (*update_denomination_pending)( + (*update_denomination_pending)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_historic_reserve_summary)( + (*get_historic_reserve_summary)( void *cls, int64_t limit, uint64_t offset, @@ -1848,25 +1846,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_historic_reserve_summary)( + (*delete_historic_reserve_summary)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_historic_reserve_summary)( + (*insert_historic_reserve_summary)( void *cls, const struct TALER_AUDITORDB_HistoricReserveSummary *dc); enum GNUNET_DB_QueryStatus - (*update_historic_reserve_summary)( + (*update_historic_reserve_summary)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_exchange_signkeys)( + (*get_exchange_signkeys)( void *cls, int64_t limit, uint64_t offset, @@ -1876,25 +1874,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_exchange_signkeys)( + (*delete_exchange_signkeys)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_exchange_signkeys)( + (*insert_exchange_signkeys)( void *cls, const struct TALER_AUDITORDB_ExchangeSignkeys *dc); enum GNUNET_DB_QueryStatus - (*update_exchange_signkeys)( + (*update_exchange_signkeys)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_wire_format_inconsistency)( + (*get_wire_format_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1904,25 +1902,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_wire_format_inconsistency)( + (*delete_wire_format_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_wire_format_inconsistency)( + (*insert_wire_format_inconsistency)( void *cls, const struct TALER_AUDITORDB_WireFormatInconsistency *dc); enum GNUNET_DB_QueryStatus - (*update_wire_format_inconsistency)( + (*update_wire_format_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_wire_out_inconsistency)( + (*get_wire_out_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1932,25 +1930,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_wire_out_inconsistency)( + (*delete_wire_out_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_wire_out_inconsistency)( + (*insert_wire_out_inconsistency)( void *cls, const struct TALER_AUDITORDB_WireOutInconsistency *dc); enum GNUNET_DB_QueryStatus - (*update_wire_out_inconsistency)( + (*update_wire_out_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_reserve_balance_summary_wrong_inconsistency)( + (*get_reserve_balance_summary_wrong_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -1960,25 +1958,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_reserve_balance_summary_wrong_inconsistency)( + (*delete_reserve_balance_summary_wrong_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_reserve_balance_summary_wrong_inconsistency)( + (*insert_reserve_balance_summary_wrong_inconsistency)( void *cls, const struct TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistency *dc); enum GNUNET_DB_QueryStatus - (*update_reserve_balance_summary_wrong_inconsistency)( + (*update_reserve_balance_summary_wrong_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_row_minor_inconsistencies)( + (*get_row_minor_inconsistencies)( void *cls, int64_t limit, uint64_t offset, @@ -1988,25 +1986,25 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_row_minor_inconsistencies)( + (*delete_row_minor_inconsistencies)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_row_minor_inconsistencies)( + (*insert_row_minor_inconsistencies)( void *cls, const struct TALER_AUDITORDB_RowMinorInconsistencies *dc); enum GNUNET_DB_QueryStatus - (*update_row_minor_inconsistencies)( + (*update_row_minor_inconsistencies)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_fee_time_inconsistency)( + (*get_fee_time_inconsistency)( void *cls, int64_t limit, uint64_t offset, @@ -2016,24 +2014,24 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_fee_time_inconsistency)( + (*delete_fee_time_inconsistency)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_fee_time_inconsistency)( + (*insert_fee_time_inconsistency)( void *cls, const struct TALER_AUDITORDB_FeeTimeInconsistency *dc); enum GNUNET_DB_QueryStatus - (*update_fee_time_inconsistency)( + (*update_fee_time_inconsistency)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); enum GNUNET_DB_QueryStatus - (*get_balances)( + (*get_balances)( void *cls, int64_t limit, uint64_t offset, @@ -2044,19 +2042,19 @@ struct TALER_AUDITORDB_Plugin enum GNUNET_DB_QueryStatus - (*delete_balances)( + (*delete_balances)( void *cls, uint64_t row_id); enum GNUNET_DB_QueryStatus - (*insert_balances)( + (*insert_balances)( void *cls, const struct TALER_AUDITORDB_Balances *dc); enum GNUNET_DB_QueryStatus - (*update_balances)( + (*update_balances)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); @@ -2073,7 +2071,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_reserve_info)( + (*insert_reserve_info)( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_AUDITORDB_ReserveFeeBalance *rfb, @@ -2092,7 +2090,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*update_reserve_info)( + (*update_reserve_info)( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_AUDITORDB_ReserveFeeBalance *rfb, @@ -2111,7 +2109,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*get_reserve_info)( + (*get_reserve_info)( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, uint64_t *rowid, @@ -2128,8 +2126,8 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*del_reserve_info)(void *cls, - const struct TALER_ReservePublicKeyP *reserve_pub); + (*del_reserve_info)(void *cls, + const struct TALER_ReservePublicKeyP *reserve_pub); /** @@ -2143,7 +2141,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_pending_deposit)( + (*insert_pending_deposit)( void *cls, uint64_t batch_deposit_serial_id, const struct TALER_PaytoHashP *wire_target_h_payto, @@ -2161,7 +2159,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*delete_pending_deposit)( + (*delete_pending_deposit)( void *cls, uint64_t batch_deposit_serial_id); @@ -2176,7 +2174,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*select_pending_deposits)( + (*select_pending_deposits)( void *cls, struct GNUNET_TIME_Absolute deadline, TALER_AUDITORDB_WireMissingCallback cb, @@ -2194,7 +2192,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_purse_info)( + (*insert_purse_info)( void *cls, const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_Amount *balance, @@ -2211,7 +2209,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*update_purse_info)( + (*update_purse_info)( void *cls, const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_Amount *balance); @@ -2228,7 +2226,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*get_purse_info)( + (*get_purse_info)( void *cls, const struct TALER_PurseContractPublicKeyP *purse_pub, uint64_t *rowid, @@ -2244,7 +2242,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*delete_purse_info)( + (*delete_purse_info)( void *cls, const struct TALER_PurseContractPublicKeyP *purse_pub); @@ -2258,7 +2256,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*select_purse_expired)( + (*select_purse_expired)( void *cls, TALER_AUDITORDB_ExpiredPurseCallback cb, void *cb_cls); @@ -2274,7 +2272,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_denomination_balance)( + (*insert_denomination_balance)( void *cls, const struct TALER_DenominationHashP *denom_pub_hash, const struct TALER_AUDITORDB_DenominationCirculationData *dcd); @@ -2290,7 +2288,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*update_denomination_balance)( + (*update_denomination_balance)( void *cls, const struct TALER_DenominationHashP *denom_pub_hash, const struct TALER_AUDITORDB_DenominationCirculationData *dcd); @@ -2303,7 +2301,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*del_denomination_balance)( + (*del_denomination_balance)( void *cls, const struct TALER_DenominationHashP *denom_pub_hash); @@ -2317,7 +2315,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*get_denomination_balance)( + (*get_denomination_balance)( void *cls, const struct TALER_DenominationHashP *denom_pub_hash, struct TALER_AUDITORDB_DenominationCirculationData *dcd); @@ -2337,7 +2335,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_historic_denom_revenue)( + (*insert_historic_denom_revenue)( void *cls, const struct TALER_DenominationHashP *denom_pub_hash, struct GNUNET_TIME_Timestamp revenue_timestamp, @@ -2354,7 +2352,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*select_historic_denom_revenue)( + (*select_historic_denom_revenue)( void *cls, TALER_AUDITORDB_HistoricDenominationRevenueDataCallback cb, void *cb_cls); @@ -2370,7 +2368,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*insert_historic_reserve_revenue)( + (*insert_historic_reserve_revenue)( void *cls, struct GNUNET_TIME_Timestamp start_time, struct GNUNET_TIME_Timestamp end_time, @@ -2386,7 +2384,7 @@ struct TALER_AUDITORDB_Plugin * @return transaction status code */ enum GNUNET_DB_QueryStatus - (*select_historic_reserve_revenue)( + (*select_historic_reserve_revenue)( void *cls, TALER_AUDITORDB_HistoricReserveRevenueDataCallback cb, void *cb_cls); |