commit 157aff2a8774959259896065074a336cf2c7d34e
parent 6d1e26a1331cddee93efcb6215b44bcb42712807
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 7 Apr 2026 16:46:06 +0200
auditor rename fest for consistency
Diffstat:
130 files changed, 6534 insertions(+), 6522 deletions(-)
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am
@@ -184,38 +184,38 @@ taler_helper_auditor_wire_debit_LDADD = \
taler_auditor_httpd_SOURCES = \
taler-auditor-httpd.c taler-auditor-httpd.h \
taler-auditor-httpd_spa.c taler-auditor-httpd_spa.h \
- taler-auditor-httpd_deposit-confirmation.c taler-auditor-httpd_deposit-confirmation.h \
- taler-auditor-httpd_deposit-confirmation-get.c taler-auditor-httpd_deposit-confirmation-get.h \
- taler-auditor-httpd_amount-arithmetic-inconsistency-get.c taler-auditor-httpd_amount-arithmetic-inconsistency-get.h \
- taler-auditor-httpd_coin-inconsistency-get.c taler-auditor-httpd_coin-inconsistency-get.h \
- taler-auditor-httpd_row-inconsistency-get.c taler-auditor-httpd_row-inconsistency-get.h \
- taler-auditor-httpd_emergency-get.c taler-auditor-httpd_emergency-get.h \
- taler-auditor-httpd_emergency-by-count-get.c taler-auditor-httpd_emergency-by-count-get.h \
- taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.h \
- taler-auditor-httpd_purse-not-closed-inconsistencies-get.c taler-auditor-httpd_purse-not-closed-inconsistencies-get.h \
- taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.h \
- taler-auditor-httpd_patch_generic_suppressed.c taler-auditor-httpd_patch_generic_suppressed.h \
- taler-auditor-httpd_delete_generic.c taler-auditor-httpd_delete_generic.h \
- taler-auditor-httpd_bad-sig-losses-get.c taler-auditor-httpd_bad-sig-losses-get.h \
- taler-auditor-httpd_closure-lags-get.c taler-auditor-httpd_closure-lags-get.h \
- taler-auditor-httpd_progress-get.c taler-auditor-httpd_progress-get.h \
- taler-auditor-httpd_early-aggregation-get.c taler-auditor-httpd_early-aggregation-get.h \
- taler-auditor-httpd_pending-deposits-get.c taler-auditor-httpd_pending-deposits-get.h \
- taler-auditor-httpd_reserve-in-inconsistency-get.c taler-auditor-httpd_reserve-in-inconsistency-get.h \
- taler-auditor-httpd_reserve-not-closed-inconsistency-get.c taler-auditor-httpd_reserve-not-closed-inconsistency-get.h \
- taler-auditor-httpd_denominations-without-sigs-get.c taler-auditor-httpd_denominations-without-sigs-get.h \
- taler-auditor-httpd_misattribution-in-inconsistency-get.c taler-auditor-httpd_misattribution-in-inconsistency-get.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-get.c taler-auditor-httpd_denomination-pending-get.h \
- taler-auditor-httpd_historic-reserve-summary-get.c taler-auditor-httpd_historic-reserve-summary-get.h \
- taler-auditor-httpd_wire-format-inconsistency-get.c taler-auditor-httpd_wire-format-inconsistency-get.h \
- taler-auditor-httpd_wire-out-inconsistency-get.c taler-auditor-httpd_wire-out-inconsistency-get.h \
- taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.h \
- taler-auditor-httpd_row-minor-inconsistencies-get.c taler-auditor-httpd_row-minor-inconsistencies-get.h \
- taler-auditor-httpd_fee-time-inconsistency-get.c taler-auditor-httpd_fee-time-inconsistency-get.h \
- taler-auditor-httpd_balances-get.c taler-auditor-httpd_balances-get.h \
+ taler-auditor-httpd_put-deposit-confirmation.c taler-auditor-httpd_put-deposit-confirmation.h \
+ taler-auditor-httpd_get-monitoring-deposit-confirmations.c taler-auditor-httpd_get-monitoring-deposit-confirmations.h \
+ taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.c taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-coin-inconsistency.c taler-auditor-httpd_get-monitoring-coin-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-row-inconsistency.c taler-auditor-httpd_get-monitoring-row-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-emergency.c taler-auditor-httpd_get-monitoring-emergency.h \
+ taler-auditor-httpd_get-monitoring-emergency-by-count.c taler-auditor-httpd_get-monitoring-emergency-by-count.h \
+ taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.c taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.c taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.h \
+ taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.c taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.h \
+ taler-auditor-httpd_patch-generic-suppressed.c taler-auditor-httpd_patch-generic-suppressed.h \
+ taler-auditor-httpd_delete-generic.c taler-auditor-httpd_delete-generic.h \
+ taler-auditor-httpd_get-monitoring-bad-sig-losses.c taler-auditor-httpd_get-monitoring-bad-sig-losses.h \
+ taler-auditor-httpd_get-monitoring-closure-lags.c taler-auditor-httpd_get-monitoring-closure-lags.h \
+ taler-auditor-httpd_get-monitoring-progress.c taler-auditor-httpd_get-monitoring-progress.h \
+ taler-auditor-httpd_get-monitoring-early-aggregation.c taler-auditor-httpd_get-monitoring-early-aggregation.h \
+ taler-auditor-httpd_get-monitoring-pending-deposits.c taler-auditor-httpd_get-monitoring-pending-deposits.h \
+ taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.c taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.c taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-denominations-without-sigs.c taler-auditor-httpd_get-monitoring-denominations-without-sigs.h \
+ taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.c taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-reserves.c taler-auditor-httpd_get-monitoring-reserves.h \
+ taler-auditor-httpd_get-monitoring-purses.c taler-auditor-httpd_get-monitoring-purses.h \
+ taler-auditor-httpd_get-monitoring-historic-denomination-revenue.c taler-auditor-httpd_get-monitoring-historic-denomination-revenue.h \
+ taler-auditor-httpd_get-monitoring-denomination-pending.c taler-auditor-httpd_get-monitoring-denomination-pending.h \
+ taler-auditor-httpd_get-monitoring-historic-reserve-summary.c taler-auditor-httpd_get-monitoring-historic-reserve-summary.h \
+ taler-auditor-httpd_get-monitoring-wire-format-inconsistency.c taler-auditor-httpd_get-monitoring-wire-format-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-wire-out-inconsistency.c taler-auditor-httpd_get-monitoring-wire-out-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.c taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.c taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.h \
+ taler-auditor-httpd_get-monitoring-fee-time-inconsistency.c taler-auditor-httpd_get-monitoring-fee-time-inconsistency.h \
+ taler-auditor-httpd_get-monitoring-balances.c taler-auditor-httpd_get-monitoring-balances.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
@@ -32,41 +32,43 @@
#include "taler/taler_auditordb_lib.h"
#include "taler/taler_exchangedb_lib.h"
#include "taler-auditor-httpd_spa.h"
-#include "taler-auditor-httpd_deposit-confirmation.h"
-#include "taler-auditor-httpd_deposit-confirmation-get.h"
-#include "taler-auditor-httpd_amount-arithmetic-inconsistency-get.h"
-#include "taler-auditor-httpd_coin-inconsistency-get.h"
-#include "taler-auditor-httpd_row-inconsistency-get.h"
-#include "taler-auditor-httpd_emergency-get.h"
-#include "taler-auditor-httpd_emergency-by-count-get.h"
-#include "taler-auditor-httpd_early-aggregation-get.h"
+#include "taler-auditor-httpd_put-deposit-confirmation.h"
+#include "taler-auditor-httpd_get-monitoring-deposit-confirmations.h"
+#include "taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-coin-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-row-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-emergency.h"
+#include "taler-auditor-httpd_get-monitoring-emergency-by-count.h"
+#include "taler-auditor-httpd_get-monitoring-early-aggregation.h"
#include \
- "taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.h"
-#include "taler-auditor-httpd_purse-not-closed-inconsistencies-get.h"
-#include "taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.h"
-#include "taler-auditor-httpd_bad-sig-losses-get.h"
-#include "taler-auditor-httpd_closure-lags-get.h"
+ "taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.h"
+#include \
+ "taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-bad-sig-losses.h"
+#include "taler-auditor-httpd_get-monitoring-closure-lags.h"
#include "taler-auditor-httpd_mhd.h"
#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_delete_generic.h"
-#include "taler-auditor-httpd_patch_generic_suppressed.h"
-#include "taler-auditor-httpd_reserve-in-inconsistency-get.h"
-#include "taler-auditor-httpd_reserve-not-closed-inconsistency-get.h"
-#include "taler-auditor-httpd_denominations-without-sigs-get.h"
-#include "taler-auditor-httpd_misattribution-in-inconsistency-get.h"
-#include "taler-auditor-httpd_reserves-get.h"
-#include "taler-auditor-httpd_pending-deposits-get.h"
-#include "taler-auditor-httpd_purses-get.h"
-#include "taler-auditor-httpd_historic-denomination-revenue-get.h"
-#include "taler-auditor-httpd_historic-reserve-summary-get.h"
-#include "taler-auditor-httpd_denomination-pending-get.h"
-#include "taler-auditor-httpd_wire-format-inconsistency-get.h"
-#include "taler-auditor-httpd_wire-out-inconsistency-get.h"
-#include "taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.h"
-#include "taler-auditor-httpd_row-minor-inconsistencies-get.h"
-#include "taler-auditor-httpd_fee-time-inconsistency-get.h"
-#include "taler-auditor-httpd_balances-get.h"
-#include "taler-auditor-httpd_progress-get.h"
+#include "taler-auditor-httpd_delete-generic.h"
+#include "taler-auditor-httpd_patch-generic-suppressed.h"
+#include "taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-denominations-without-sigs.h"
+#include "taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-reserves.h"
+#include "taler-auditor-httpd_get-monitoring-pending-deposits.h"
+#include "taler-auditor-httpd_get-monitoring-purses.h"
+#include "taler-auditor-httpd_get-monitoring-historic-denomination-revenue.h"
+#include "taler-auditor-httpd_get-monitoring-historic-reserve-summary.h"
+#include "taler-auditor-httpd_get-monitoring-denomination-pending.h"
+#include "taler-auditor-httpd_get-monitoring-wire-format-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-wire-out-inconsistency.h"
+#include \
+ "taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.h"
+#include "taler-auditor-httpd_get-monitoring-fee-time-inconsistency.h"
+#include "taler-auditor-httpd_get-monitoring-balances.h"
+#include "taler-auditor-httpd_get-monitoring-progress.h"
/**
@@ -332,7 +334,7 @@ handle_mhd_request (void *cls,
{ .url = "/deposit-confirmation",
.method = MHD_HTTP_METHOD_PUT,
.mime_type = "application/json",
- .handler = &TAH_DEPOSIT_CONFIRMATION_handler,
+ .handler = &TAH_put_deposit_confirmation,
.response_code = MHD_HTTP_OK},
{ .url = "/spa",
.method = MHD_HTTP_METHOD_GET,
@@ -342,7 +344,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_DEPOSIT_CONFIRMATION_handler_get,
+ .handler = &TAH_get_monitoring_deposit_confirmations,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/pending-deposits",
@@ -350,7 +352,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_pending_deposits_handler_get,
+ .handler = &TAH_get_monitoring_pending_deposits,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/early-aggregation",
@@ -358,7 +360,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_early_aggregation_handler_get,
+ .handler = &TAH_get_monitoring_early_aggregation,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/deposit-confirmation",
@@ -366,7 +368,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_DEPOSIT_CONFIRMATION },
@@ -375,7 +377,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_AMOUNT_ARITHMETIC_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_amount_arithmetic_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/amount-arithmetic-inconsistency",
@@ -383,7 +385,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_AMOUNT_ARITHMETIC_INCONSISTENCY },
@@ -392,7 +394,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_AMOUNT_ARITHMETIC_INCONSISTENCY },
@@ -401,7 +403,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_COIN_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_coin_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/coin-inconsistency",
@@ -409,7 +411,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_COIN_INCONSISTENCY },
@@ -418,7 +420,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_COIN_INCONSISTENCY },
@@ -427,7 +429,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_ROW_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_row_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/row-inconsistency",
@@ -435,7 +437,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_ROW_INCONSISTENCY},
@@ -444,7 +446,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_ROW_INCONSISTENCY },
@@ -453,7 +455,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_BAD_SIG_LOSSES_handler_get,
+ .handler = &TAH_get_monitoring_bad_sig_losses,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/bad-sig-losses",
@@ -461,7 +463,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_BAD_SIG_LOSSES},
@@ -470,7 +472,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_BAD_SIG_LOSSES },
@@ -479,7 +481,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_CLOSURE_LAGS_handler_get,
+ .handler = &TAH_get_monitoring_closure_lags,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/closure-lags",
@@ -487,7 +489,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_CLOSURE_LAGS },
@@ -496,7 +498,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_CLOSURE_LAGS },
@@ -505,7 +507,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_EMERGENCY_handler_get,
+ .handler = &TAH_get_monitoring_emergency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/emergency",
@@ -513,7 +515,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_EMERGENCY },
@@ -522,7 +524,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_EMERGENCY },
@@ -532,7 +534,7 @@ handle_mhd_request (void *cls,
.data = NULL,
.data_size = 0,
.handler =
- &TAH_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_handler_get,
+ &TAH_get_monitoring_denomination_key_validity_withdraw_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/denomination-key-validity-withdraw-inconsistency",
@@ -540,7 +542,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY}
@@ -550,7 +552,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY}
@@ -560,7 +562,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_reserve_balance_insufficient_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/reserve-balance-insufficient-inconsistency",
@@ -568,7 +570,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY },
@@ -577,7 +579,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY },
@@ -586,7 +588,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_PURSE_NOT_CLOSED_INCONSISTENCIES_handler_get,
+ .handler = &TAH_get_monitoring_purse_not_closed_inconsistencies,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/purse-not-closed-inconsistencies",
@@ -594,7 +596,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_PURSE_NOT_CLOSED_INCONSISTENCY },
@@ -603,7 +605,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_PURSE_NOT_CLOSED_INCONSISTENCY },
@@ -612,7 +614,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_EMERGENCY_BY_COUNT_handler_get,
+ .handler = &TAH_get_monitoring_emergency_by_count,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/emergency-by-count",
@@ -620,7 +622,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_EMERGENCY_BY_COUNT },
@@ -629,7 +631,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_EMERGENCY_BY_COUNT },
@@ -638,7 +640,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_RESERVE_IN_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_reserve_in_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/reserve-in-inconsistency",
@@ -646,7 +648,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_RESERVE_IN_INCONSISTENCY },
@@ -655,7 +657,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_RESERVE_IN_INCONSISTENCY },
@@ -664,7 +666,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_RESERVE_NOT_CLOSED_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_reserve_not_closed_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/reserve-not-closed-inconsistency",
@@ -672,7 +674,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_RESERVE_NOT_CLOSED_INCONSISTENCY },
@@ -681,7 +683,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_RESERVE_NOT_CLOSED_INCONSISTENCY },
@@ -690,7 +692,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_DENOMINATIONS_WITHOUT_SIGS_handler_get,
+ .handler = &TAH_get_monitoring_denominations_without_sigs,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/denominations-without-sigs",
@@ -698,7 +700,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_DENOMINATIONS_WITHOUT_SIG },
@@ -707,7 +709,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_DENOMINATIONS_WITHOUT_SIG },
@@ -716,7 +718,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_MISATTRIBUTION_IN_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_misattribution_in_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/misattribution-in-inconsistency",
@@ -724,7 +726,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_MISATTRIBUTION_IN_INCONSISTENCY },
@@ -733,7 +735,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_MISATTRIBUTION_IN_INCONSISTENCY },
@@ -742,7 +744,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_RESERVES_handler_get,
+ .handler = &TAH_get_monitoring_reserves,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/purses",
@@ -750,7 +752,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_PURSES_handler_get,
+ .handler = &TAH_get_monitoring_purses,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/historic-denomination-revenue",
@@ -758,7 +760,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_HISTORIC_DENOMINATION_REVENUE_handler_get,
+ .handler = &TAH_get_monitoring_historic_denomination_revenue,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/denomination-pending",
@@ -766,7 +768,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_DENOMINATION_PENDING_handler_get,
+ .handler = &TAH_get_monitoring_denomination_pending,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/denomination-pending",
@@ -774,7 +776,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_DENOMINATION_PENDING },
@@ -783,7 +785,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_HISTORIC_RESERVE_SUMMARY_handler_get,
+ .handler = &TAH_get_monitoring_historic_reserve_summary,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/wire-format-inconsistency",
@@ -791,7 +793,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_WIRE_FORMAT_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_wire_format_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/wire-format-inconsistency",
@@ -799,7 +801,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_WIRE_FORMAT_INCONSISTENCY },
@@ -808,7 +810,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_WIRE_FORMAT_INCONSISTENCY },
@@ -817,7 +819,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_WIRE_OUT_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_wire_out_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/wire-out-inconsistency",
@@ -825,7 +827,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_WIRE_OUT_INCONSISTENCY },
@@ -834,7 +836,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_WIRE_OUT_INCONSISTENCY },
@@ -843,7 +845,8 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_reserve_balance_summary_wrong_inconsistency
+ ,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/reserve-balance-summary-wrong-inconsistency",
@@ -851,7 +854,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY },
@@ -860,7 +863,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY },
@@ -869,7 +872,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_ROW_MINOR_INCONSISTENCIES_handler_get,
+ .handler = &TAH_get_monitoring_row_minor_inconsistencies,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/row-minor-inconsistencies",
@@ -877,7 +880,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_ROW_MINOR_INCONSISTENCY },
@@ -886,7 +889,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_ROW_MINOR_INCONSISTENCY },
@@ -895,7 +898,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_FEE_TIME_INCONSISTENCY_handler_get,
+ .handler = &TAH_get_monitoring_fee_time_inconsistency,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/fee-time-inconsistency",
@@ -903,7 +906,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_delete_handler_generic,
+ .handler = &TAH_delete_generic,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_FEE_TIME_INCONSISTENCY },
@@ -912,7 +915,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_patch_handler_generic_suppressed,
+ .handler = &TAH_patch_generic_suppressed,
.response_code = MHD_HTTP_OK,
.requires_auth = true,
.table = TALER_AUDITORDB_FEE_TIME_INCONSISTENCY },
@@ -921,7 +924,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_BALANCES_handler_get,
+ .handler = &TAH_get_monitoring_balances,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/monitoring/progress",
@@ -929,7 +932,7 @@ handle_mhd_request (void *cls,
.mime_type = "application/json",
.data = NULL,
.data_size = 0,
- .handler = &TAH_PROGRESS_handler_get,
+ .handler = &TAH_get_monitoring_progress,
.response_code = MHD_HTTP_OK,
.requires_auth = true },
{ .url = "/config",
@@ -1267,7 +1270,7 @@ do_shutdown (void *cls)
{
(void) cls;
TALER_MHD_daemons_halt ();
- TEAH_DEPOSIT_CONFIRMATION_done ();
+ TEAH_put_deposit_confirmation_done ();
TALER_MHD_daemons_destroy ();
if (NULL != TAH_plugin)
{
@@ -1394,7 +1397,7 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
- TEAH_DEPOSIT_CONFIRMATION_init ();
+ TEAH_put_deposit_confirmation_init ();
ret = TALER_MHD_listen_bind (cfg,
"auditor",
&start_daemon,
diff --git a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.c b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.c
@@ -1,144 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_amount-arithmetic-inconsistency-get.h"
-
-
-/**
- * Add deposit confirmation to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-add_amount_arithmetic_inconsistency (
- void *cls,
- const struct TALER_AUDITORDB_AmountArithmeticInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_uint64 ("problem_row_id",
- dc->problem_row_id),
- GNUNET_JSON_pack_string ("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_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-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[])
-{
- json_t *ja;
- enum GNUNET_DB_QueryStatus qs;
- int64_t limit = -20;
- uint64_t offset;
- bool return_suppressed = false;
-
- (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);
- 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);
- {
- 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,
- offset,
- return_suppressed,
- &add_amount_arithmetic_inconsistency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- 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_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("amount_arithmetic_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.h b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.h
@@ -1,56 +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 TALER_AUDITOR_HTTPD_AMOUNT_ARITHMETIC_INCONSISTENCY_GET_H
-#define TALER_AUDITOR_HTTPD_AMOUNT_ARITHMETIC_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
- * Initialize subsystem.
- */
-void
-TEAH_AMOUNT_ARITHMETIC_INCONSISTENCY_GET_init (void);
-
-/**
- * Shut down subsystem.
- */
-void
-TEAH_AMOUNT_ARITHMETIC_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/deposit-confirmation" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @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[]);
-
-
-#endif // TALER_AUDITOR_HTTPD_AMOUNT_ARITHMETIC_INCONSISTENCY_GET_H
diff --git a/src/auditor/taler-auditor-httpd_bad-sig-losses-get.c b/src/auditor/taler-auditor-httpd_bad-sig-losses-get.c
@@ -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 "taler/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_bad-sig-losses-get.h"
-
-
-/**
- * Add bad-sig-losses to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-add_bad_sig_losses (
- void *cls,
- const struct TALER_AUDITORDB_BadSigLosses *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_uint64 ("problem_row_id",
- dc->problem_row_id),
- GNUNET_JSON_pack_string ("operation",
- dc->operation),
- TALER_JSON_pack_amount ("loss",
- &dc->loss),
- GNUNET_JSON_pack_data_auto ("operation_specific_pub",
- &dc->operation_specific_pub),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_BAD_SIG_LOSSES_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;
- struct GNUNET_CRYPTO_EddsaPublicKey op_spec_pub;
- bool filter_spec_pub = false;
- const char *op;
-
- (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);
- }
- 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);
- {
- 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;
- }
- }
-
- op = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "op");
- TALER_MHD_parse_request_arg_auto (connection,
- "op_spec_pub",
- &op_spec_pub,
- filter_spec_pub);
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_bad_sig_losses (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- filter_spec_pub ? &op_spec_pub : NULL,
- op,
- &add_bad_sig_losses,
- ja);
- if (0 > qs)
- {
- GNUNET_break (0);
- json_decref (ja);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "bad-sig-losses");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("bad_sig_losses",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_bad-sig-losses-get.h b/src/auditor/taler-auditor-httpd_bad-sig-losses-get.h
@@ -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 TALER_AUDITOR_HTTPD_BAD_SIG_LOSSES_GET_H
-#define TALER_AUDITOR_HTTPD_BAD_SIG_LOSSES_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_BAD_SIG_LOSSES_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_SIG_LOSSES_GET_done (void);
-
-/**
- * Handle a "/bad-sig-losses" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_BAD_SIG_LOSSES_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
diff --git a/src/auditor/taler-auditor-httpd_balances-get.c b/src/auditor/taler-auditor-httpd_balances-get.c
@@ -1,108 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_balances-get.h"
-
-/**
- * Add balance to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of with balance data
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_balances (
- void *cls,
- const struct TALER_AUDITORDB_Balances *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("balance_key",
- dc->balance_key),
- TALER_JSON_pack_amount ("balance_value",
- &dc->balance_value)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_BALANCES_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;
- const char *balance_key;
-
- (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);
- }
- balance_key
- = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "balance_key");
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_balances (
- TAH_plugin->cls,
- balance_key,
- &process_balances,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /balances");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "balances");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("balances",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_balances-get.h b/src/auditor/taler-auditor-httpd_balances-get.h
@@ -1,45 +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 TALER_AUDITOR_HTTPD_BALANCES_GET_H
-#define TALER_AUDITOR_HTTPD_BALANCES_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-
-/**
- * Handle a "/balances" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_BALANCES_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
diff --git a/src/auditor/taler-auditor-httpd_closure-lags-get.c b/src/auditor/taler-auditor-httpd_closure-lags-get.c
@@ -1,137 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_closure-lags-get.h"
-
-
-/**
- * Add closure-lags to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_closure_lags (
- void *cls,
- const struct TALER_AUDITORDB_ClosureLags *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_uint64 ("problem_row_id",
- dc->problem_row_id),
- TALER_JSON_pack_amount ("amount",
- &dc->amount),
- TALER_JSON_pack_time_abs_human ("deadline",
- dc->deadline),
- GNUNET_JSON_pack_data_auto ("wtid",
- &dc->wtid),
- TALER_JSON_pack_full_payto ("account",
- dc->account),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
-
-
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_CLOSURE_LAGS_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;
-
- 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);
- }
- 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);
- {
- 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;
- }
- }
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_auditor_closure_lags (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_closure_lags,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /closure-lags\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "get_auditor_closure_lags");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("closure_lags",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_closure-lags-get.h b/src/auditor/taler-auditor-httpd_closure-lags-get.h
@@ -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_CLOSURE_LAGS_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_CLOSURE_LAGS_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_CLOSURE_LAGS_GET_init (void);
-
-/**
- * Shut down subsystem.
- */
-void
-TEAH_CLOSURE_LAGS_GET_done (void);
-
-/**
- * Handle a "/closure-lags" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_CLOSURE_LAGS_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
diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c b/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c
@@ -1,127 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_coin-inconsistency-get.h"
-
-
-/**
- * Add deposit confirmation 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
-add_coin_inconsistency (
- void *cls,
- uint64_t serial_id,
- const struct TALER_AUDITORDB_CoinInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("operation", dc->operation),
- TALER_JSON_pack_amount ("exchange_amount", &dc->exchange_amount),
- TALER_JSON_pack_amount ("auditor_amount", &dc->auditor_amount),
- GNUNET_JSON_pack_data_auto ("coin_pub",&dc->coin_pub),
- GNUNET_JSON_pack_bool ("profitable", dc->profitable)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_COIN_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;
-
- 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);
- }
- 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);
- {
- 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;
- }
- }
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_coin_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &add_coin_inconsistency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /coin-inconsistency in database\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "coin-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("coin_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-get.h b/src/auditor/taler-auditor-httpd_coin-inconsistency-get.h
@@ -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_COIN_INCONSISTENCY_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_COIN_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
- * Initialize subsystem.
- */
-void
-TEAH_COIN_INCONSISTENCY_GET_init (void);
-
-/**
- * Shut down subsystem.
- */
-void
-TEAH_COIN_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/deposit-confirmation" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_COIN_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_delete-generic.c b/src/auditor/taler-auditor-httpd_delete-generic.c
@@ -0,0 +1,97 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_delete-generic.h"
+
+
+MHD_RESULT
+TAH_delete_generic (
+ 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;
+ unsigned long long row_id;
+ char dummy;
+
+ (void) connection_cls;
+ 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);
+ }
+
+ if ((NULL == args[1]) ||
+ (1 != sscanf (args[1],
+ "%llu%c",
+ &row_id,
+ &dummy)))
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
+ "no row id specified");
+ }
+
+ /* execute transaction */
+ qs = TAH_plugin->delete_generic (TAH_plugin->cls,
+ rh->table,
+ row_id);
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "db store failed");
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
+ "unexpected serialization problem");
+ 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 delete executed");
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return TALER_MHD_reply_static (connection,
+ MHD_HTTP_NO_CONTENT,
+ NULL,
+ NULL,
+ 0);
+ }
+ GNUNET_break (0);
+ return MHD_NO;
+}
diff --git a/src/auditor/taler-auditor-httpd_delete-generic.h b/src/auditor/taler-auditor-httpd_delete-generic.h
@@ -0,0 +1,37 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_DELETE_GENERIC_H
+#define TALER_AUDITOR_HTTPD_DELETE_GENERIC_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/*
+ * FIXME: add comment
+ */
+MHD_RESULT
+TAH_delete_generic (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_delete_generic.c b/src/auditor/taler-auditor-httpd_delete_generic.c
@@ -1,97 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_delete_generic.h"
-
-
-MHD_RESULT
-TAH_delete_handler_generic (
- 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;
- unsigned long long row_id;
- char dummy;
-
- (void) connection_cls;
- 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);
- }
-
- if ((NULL == args[1]) ||
- (1 != sscanf (args[1],
- "%llu%c",
- &row_id,
- &dummy)))
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
- "no row id specified");
- }
-
- /* execute transaction */
- qs = TAH_plugin->delete_generic (TAH_plugin->cls,
- rh->table,
- row_id);
- switch (qs)
- {
- case GNUNET_DB_STATUS_HARD_ERROR:
- GNUNET_break (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_STORE_FAILED,
- "db store failed");
- case GNUNET_DB_STATUS_SOFT_ERROR:
- GNUNET_break (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
- "unexpected serialization problem");
- 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 delete executed");
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- return TALER_MHD_reply_static (connection,
- MHD_HTTP_NO_CONTENT,
- NULL,
- NULL,
- 0);
- }
- GNUNET_break (0);
- return MHD_NO;
-}
diff --git a/src/auditor/taler-auditor-httpd_delete_generic.h b/src/auditor/taler-auditor-httpd_delete_generic.h
@@ -1,37 +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 TALER_AUDITOR_HTTPD_DELETE_GENERIC_H
-#define TALER_AUDITOR_HTTPD_DELETE_GENERIC_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/*
- * FIXME: add comment
- */
-MHD_RESULT
-TAH_delete_handler_generic(
- 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
diff --git a/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.c b/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.c
@@ -1,140 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include \
- "taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.h"
-
-/**
- * Add denomination-key-validity-withdraw-inconsistency to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate
- */
-static enum GNUNET_GenericReturnValue
-process_denomination_key_validity_withdraw_inconsistency (
- void *cls,
- const struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_uint64 ("problem_row_id",
- dc->problem_row_id),
- TALER_JSON_pack_time_abs_human ("execution_date",
- dc->execution_date),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &dc->reserve_pub),
- GNUNET_JSON_pack_data_auto ("denompub_h",
- &dc->denompub_h),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
-
-
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_DENOMINATION_KEY_VALIDITY_WITHDRAW_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;
- (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);
- }
- 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);
- {
- 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;
- }
- }
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_denomination_key_validity_withdraw_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_denomination_key_validity_withdraw_inconsistency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /denomination-key-validity-withdraw-inconsistency\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "denomination-key-validity-withdraw-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal (
- "denomination_key_validity_withdraw_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.h b/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.h
@@ -1,60 +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 \
- TALER_AUDITOR_HTTPD_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_GET_H
-#define \
- TALER_AUDITOR_HTTPD_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/denomination-key-validity-withdraw-inconsistency" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_DENOMINATION_KEY_VALIDITY_WITHDRAW_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_denomination-pending-get.c b/src/auditor/taler-auditor-httpd_denomination-pending-get.c
@@ -1,128 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_denomination-pending-get.h"
-
-/**
- * Add denomination-pending 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_denomination_pending (
- void *cls,
- uint64_t serial_id,
- const struct TALER_AUDITORDB_DenominationPending *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_data_auto ("denom_pub_hash",
- &dc->denom_pub_hash),
- TALER_JSON_pack_amount ("denom_balance",
- &dc->denom_balance),
- TALER_JSON_pack_amount ("denom_loss",
- &dc->denom_loss),
- GNUNET_JSON_pack_int64 ("num_issued",
- dc->num_issued),
- TALER_JSON_pack_amount ("denom_risk",
- &dc->denom_risk),
- TALER_JSON_pack_amount ("recoup_loss",
- &dc->recoup_loss)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_DENOMINATION_PENDING_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;
-
- (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);
- }
- 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);
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_denomination_pending (
- TAH_plugin->cls,
- limit,
- offset,
- &process_denomination_pending,
- ja);
-
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /denomination-pending");
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "get_denomination_pending");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("denomination_pending",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_denomination-pending-get.h b/src/auditor/taler-auditor-httpd_denomination-pending-get.h
@@ -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_DENOMINATION_PENDING_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_DENOMINATION_PENDING_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_DENOMINATION_PENDING_GET_init (void);
-
-/**
- * Shut down subsystem.
- */
-void
-TEAH_BAD_DENOMINATION_PENDING_GET_done (void);
-
-/**
- * Handle a "/denomination-pending" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_DENOMINATION_PENDING_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
diff --git a/src/auditor/taler-auditor-httpd_denominations-without-sigs-get.c b/src/auditor/taler-auditor-httpd_denominations-without-sigs-get.c
@@ -1,138 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_denominations-without-sigs-get.h"
-
-
-/**
- * Add denominations-without-sigs to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_denominations_without_sigs (
- void *cls,
- const struct TALER_AUDITORDB_DenominationsWithoutSigs *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_int64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_data_auto ("denompub_h",
- &dc->denompub_h),
- TALER_JSON_pack_amount ("value",
- &dc->value),
- TALER_JSON_pack_time_abs_human ("start_time",
- dc->start_time),
- TALER_JSON_pack_time_abs_human ("end_time",
- dc->end_time),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_DENOMINATIONS_WITHOUT_SIGS_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;
- (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);
- }
- 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);
- {
- 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;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_denominations_without_sigs (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_denominations_without_sigs,
- ja);
-
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /denominations-without-sigs");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "denominations-without-sigs");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("denominations_without_sigs",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_denominations-without-sigs-get.h b/src/auditor/taler-auditor-httpd_denominations-without-sigs-get.h
@@ -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_DENOMINATIONS_WITHOUT_SIGS_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_DENOMINATIONS_WITHOUT_SIGS_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_DENOMINATIONS_WITHOUT_SIGS_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_DENOMINATIONS_WITHOUT_SIGS_GET_done (void);
-
-/**
- * Handle a "/denominations-without-sigs" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_DENOMINATIONS_WITHOUT_SIGS_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
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation-get.c b/src/auditor/taler-auditor-httpd_deposit-confirmation-get.c
@@ -1,184 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014-2024 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file taler-auditor-httpd_deposit-confirmation-get.c
- * @brief Handle /deposit-confirmation requests; return list of deposit confirmations from merchant
- * that were not received from the exchange, by auditor.
- * @author Nic Eigel
- */
-#include "taler/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_deposit-confirmation-get.h"
-
-
-/**
- * Add deposit confirmation to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of deposit confirmation
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-add_deposit_confirmation (
- void *cls,
- const struct TALER_AUDITORDB_DepositConfirmation *dc)
-{
- json_t *list = cls;
- json_t *obj;
- json_t *coin_pubs_json = json_array ();
- json_t *coin_sigs_json = json_array ();
-
- GNUNET_assert (NULL != coin_pubs_json);
- GNUNET_assert (NULL != coin_sigs_json);
- for (unsigned int i = 0; i < dc->num_coins; i++)
- {
- json_t *pub;
- json_t *sig;
-
- pub = GNUNET_JSON_from_data_auto (&dc->coin_pubs[i]);
- GNUNET_assert (0 ==
- json_array_append_new (coin_pubs_json,
- pub));
- sig = GNUNET_JSON_from_data_auto (&dc->coin_sigs[i]);
- GNUNET_assert (0 ==
- json_array_append_new (coin_sigs_json,
- sig));
- }
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_int64 ("deposit_confirmation_serial_id",
- dc->row_id),
- GNUNET_JSON_pack_data_auto ("h_contract_terms",
- &dc->h_contract_terms),
- GNUNET_JSON_pack_data_auto ("h_policy",
- &dc->h_policy),
- GNUNET_JSON_pack_data_auto ("h_wire",
- &dc->h_wire),
- GNUNET_JSON_pack_timestamp ("exchange_timestamp",
- dc->exchange_timestamp),
- GNUNET_JSON_pack_timestamp ("refund_deadline",
- dc->refund_deadline),
- GNUNET_JSON_pack_timestamp ("wire_deadline",
- dc->wire_deadline),
- TALER_JSON_pack_amount ("total_without_fee",
- &dc->total_without_fee),
- GNUNET_JSON_pack_array_steal ("coin_pubs",
- coin_pubs_json),
- GNUNET_JSON_pack_array_steal ("coin_sigs",
- coin_sigs_json),
- GNUNET_JSON_pack_data_auto ("merchant_pub",
- &dc->merchant),
- GNUNET_JSON_pack_data_auto ("exchange_sig",
- &dc->exchange_sig),
- GNUNET_JSON_pack_data_auto ("exchange_pub",
- &dc->exchange_pub),
- GNUNET_JSON_pack_data_auto ("master_sig",
- &dc->master_sig),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_DEPOSIT_CONFIRMATION_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;
- bool return_suppressed = false;
- int64_t limit = -20;
- uint64_t offset;
-
- (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);
- }
- 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);
- {
- const char *ret_s = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
- if ( (NULL != ret_s) &&
- (0 == strcmp (ret_s, "true")) )
- {
- return_suppressed = true;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_deposit_confirmations (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &add_deposit_confirmation,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /deposit-confirmation in database\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "deposit-confirmation");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("deposit_confirmation",
- ja));
-}
-
-
-/* end of taler-auditor-httpd_deposit-confirmation-get.c */
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation-get.h b/src/auditor/taler-auditor-httpd_deposit-confirmation-get.h
@@ -1,61 +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 Affero General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file taler-auditor-httpd_deposit-confirmation-get.h
- * @brief Handle GET /deposit-confirmation requests
- * @author Nic Eigel
- */
-#ifndef TALER_AUDITOR_HTTPD_DEPOSIT_CONFIRMATION_GET_H
-#define TALER_AUDITOR_HTTPD_DEPOSIT_CONFIRMATION_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
- * Initialize subsystem.
- */
-void
-TEAH_DEPOSIT_CONFIRMATION_GET_init (void);
-
-/**
- * Shut down subsystem.
- */
-void
-TEAH_DEPOSIT_CONFIRMATION_GET_done (void);
-
-/**
- * Handle a "/deposit-confirmation" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_DEPOSIT_CONFIRMATION_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
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.c b/src/auditor/taler-auditor-httpd_deposit-confirmation.c
@@ -1,454 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014-2023 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file taler-auditor-httpd_deposit-confirmation.c
- * @brief Handle /deposit-confirmation requests; parses the POST and JSON and
- * verifies the coin signature before handing things off
- * to the database.
- * @author Christian Grothoff
- */
-#include "taler/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_deposit-confirmation.h"
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * @brief Information about a signing key of the exchange. Signing keys are used
- * to sign exchange messages other than coins, i.e. to confirm that a
- * deposit was successful or that a refresh was accepted.
- */
-struct ExchangeSigningKeyDataP
-{
-
- /**
- * When does this signing key begin to be valid?
- */
- struct GNUNET_TIME_TimestampNBO start;
-
- /**
- * When does this signing key expire? Note: This is currently when
- * the Exchange will definitively stop using it. Signatures made with
- * the key remain valid until @e end. When checking validity periods,
- * clients should allow for some overlap between keys and tolerate
- * the use of either key during the overlap time (due to the
- * possibility of clock skew).
- */
- struct GNUNET_TIME_TimestampNBO expire;
-
- /**
- * When do signatures with this signing key become invalid? After
- * this point, these signatures cannot be used in (legal) disputes
- * anymore, as the Exchange is then allowed to destroy its side of the
- * evidence. @e end is expected to be significantly larger than @e
- * expire (by a year or more).
- */
- struct GNUNET_TIME_TimestampNBO end;
-
- /**
- * The public online signing key that the exchange will use
- * between @e start and @e expire.
- */
- struct TALER_ExchangePublicKeyP signkey_pub;
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-
-/**
- * Cache of already verified exchange signing keys. Maps the hash of the
- * `struct TALER_ExchangeSigningKeyValidityPS` to the (static) string
- * "verified" or "revoked". Access to this map is guarded by the #lock.
- */
-static struct GNUNET_CONTAINER_MultiHashMap *cache;
-
-/**
- * Lock for operations on #cache.
- */
-static pthread_mutex_t lock;
-
-
-/**
- * We have parsed the JSON information about the deposit, do some
- * basic sanity checks (especially that the signature on the coin is
- * valid, and that this type of coin exists) and then execute the
- * deposit.
- *
- * @param connection the MHD connection to handle
- * @param dc information about the deposit confirmation
- * @param es information about the exchange's signing key
- * @return MHD result code
- */
-static MHD_RESULT
-verify_and_execute_deposit_confirmation (
- struct MHD_Connection *connection,
- const struct TALER_AUDITORDB_DepositConfirmation *dc,
- const struct TALER_AUDITORDB_ExchangeSigningKey *es)
-{
- enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_HashCode h;
- const char *cached;
- struct ExchangeSigningKeyDataP skv = {
- .start = GNUNET_TIME_timestamp_hton (es->ep_start),
- .expire = GNUNET_TIME_timestamp_hton (es->ep_expire),
- .end = GNUNET_TIME_timestamp_hton (es->ep_end),
- .signkey_pub = es->exchange_pub
- };
- const struct TALER_CoinSpendSignatureP *coin_sigps[
- GNUNET_NZL (dc->num_coins)];
-
- for (unsigned int i = 0; i < dc->num_coins; i++)
- coin_sigps[i] = &dc->coin_sigs[i];
-
- if (GNUNET_TIME_absolute_is_future (es->ep_start.abs_time) ||
- GNUNET_TIME_absolute_is_past (es->ep_expire.abs_time))
- {
- /* Signing key expired */
- TALER_LOG_WARNING ("Expired exchange signing key\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_FORBIDDEN,
- TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID,
- "master signature expired");
- }
-
- /* check our cache */
- GNUNET_CRYPTO_hash (&skv,
- sizeof(skv),
- &h);
- GNUNET_assert (0 == pthread_mutex_lock (&lock));
- cached = GNUNET_CONTAINER_multihashmap_get (cache,
- &h);
- GNUNET_assert (0 == pthread_mutex_unlock (&lock));
- 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);
- }
- if (NULL == cached)
- {
- /* Not in cache, need to verify the signature, persist it, and possibly cache it */
- if (GNUNET_OK !=
- TALER_exchange_offline_signkey_validity_verify (
- &es->exchange_pub,
- es->ep_start,
- es->ep_expire,
- es->ep_end,
- &TAH_master_public_key,
- &es->master_sig))
- {
- TALER_LOG_WARNING ("Invalid signature on exchange signing key\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_FORBIDDEN,
- TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID,
- "master signature invalid");
- }
-
- /* execute transaction */
- qs = TAH_plugin->insert_exchange_signkey (TAH_plugin->cls,
- es);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- TALER_LOG_WARNING ("Failed to store exchange signing key in database\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_STORE_FAILED,
- "exchange signing key");
- }
- cached = "verified";
- }
-
- if (0 == strcmp (cached,
- "verified"))
- {
- struct TALER_MasterSignatureP master_sig;
-
- /* check for revocation */
- qs = TAH_eplugin->lookup_signkey_revocation (TAH_eplugin->cls,
- &es->exchange_pub,
- &master_sig);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- TALER_LOG_WARNING (
- "Failed to check for signing key revocation in database\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "exchange signing key revocation");
- }
- if (0 < qs)
- cached = "revoked";
- }
-
- /* Cache it, due to concurreny it might already be in the cache,
- so we do not cache it twice but also don't insist on the 'put' to
- succeed. */
- GNUNET_assert (0 == pthread_mutex_lock (&lock));
- (void) GNUNET_CONTAINER_multihashmap_put (cache,
- &h,
- (void *) cached,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
- GNUNET_assert (0 == pthread_mutex_unlock (&lock));
-
- if (0 == strcmp (cached,
- "revoked"))
- {
- TALER_LOG_WARNING (
- "Invalid signature on /deposit-confirmation request: key was revoked\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_GONE,
- TALER_EC_AUDITOR_EXCHANGE_SIGNING_KEY_REVOKED,
- "exchange signing key was revoked");
- }
-
- /* check deposit confirmation signature */
- if (GNUNET_OK !=
- TALER_exchange_online_deposit_confirmation_verify (
- &dc->h_contract_terms,
- &dc->h_wire,
- &dc->h_policy,
- dc->exchange_timestamp,
- dc->wire_deadline,
- dc->refund_deadline,
- &dc->total_without_fee,
- dc->num_coins,
- coin_sigps,
- &dc->merchant,
- &dc->exchange_pub,
- &dc->exchange_sig))
- {
- TALER_LOG_WARNING (
- "Invalid signature on /deposit-confirmation request\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_FORBIDDEN,
- TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID,
- "exchange signature invalid");
- }
-
- /* execute transaction */
- qs = TAH_plugin->insert_deposit_confirmation (TAH_plugin->cls,
- dc);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- TALER_LOG_WARNING ("Failed to store /deposit-confirmation in database\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_STORE_FAILED,
- "deposit confirmation");
- }
- return TALER_MHD_REPLY_JSON_PACK (connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_string ("status",
- "DEPOSIT_CONFIRMATION_OK"));
-}
-
-
-MHD_RESULT
-TAH_DEPOSIT_CONFIRMATION_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[])
-{
- struct TALER_AUDITORDB_DepositConfirmation dc = {
- .refund_deadline = GNUNET_TIME_UNIT_ZERO_TS
- };
- struct TALER_AUDITORDB_ExchangeSigningKey es;
- const json_t *jcoin_sigs;
- const json_t *jcoin_pubs;
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
- &dc.h_contract_terms),
- GNUNET_JSON_spec_fixed_auto ("h_policy",
- &dc.h_policy),
- GNUNET_JSON_spec_fixed_auto ("h_wire",
- &dc.h_wire),
- GNUNET_JSON_spec_timestamp ("exchange_timestamp",
- &dc.exchange_timestamp),
- GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_timestamp ("refund_deadline",
- &dc.refund_deadline),
- NULL),
- GNUNET_JSON_spec_timestamp ("wire_deadline",
- &dc.wire_deadline),
- TALER_JSON_spec_amount ("total_without_fee",
- TAH_currency,
- &dc.total_without_fee),
- GNUNET_JSON_spec_array_const ("coin_pubs",
- &jcoin_pubs),
- GNUNET_JSON_spec_array_const ("coin_sigs",
- &jcoin_sigs),
- GNUNET_JSON_spec_fixed_auto ("merchant_pub",
- &dc.merchant),
- GNUNET_JSON_spec_fixed_auto ("exchange_sig",
- &dc.exchange_sig),
- GNUNET_JSON_spec_fixed_auto ("exchange_pub",
- &dc.exchange_pub),
- GNUNET_JSON_spec_timestamp ("ep_start",
- &es.ep_start),
- GNUNET_JSON_spec_timestamp ("ep_expire",
- &es.ep_expire),
- GNUNET_JSON_spec_timestamp ("ep_end",
- &es.ep_end),
- GNUNET_JSON_spec_fixed_auto ("master_sig",
- &es.master_sig),
- GNUNET_JSON_spec_end ()
- };
- unsigned int num_coins;
- 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.master_sig = es.master_sig;
- }
- num_coins = json_array_size (jcoin_sigs);
- if (num_coins != json_array_size (jcoin_pubs))
- {
- GNUNET_break_op (0);
- json_decref (json);
- return TALER_MHD_reply_with_ec (
- connection,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "coin_pubs.length != coin_sigs.length");
- }
- if (0 == num_coins)
- {
- GNUNET_break_op (0);
- json_decref (json);
- return TALER_MHD_reply_with_ec (
- connection,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "coin_pubs array is empty");
- }
- {
- struct TALER_CoinSpendPublicKeyP coin_pubs[num_coins];
- struct TALER_CoinSpendSignatureP coin_sigs[num_coins];
- MHD_RESULT res;
-
- for (unsigned int i = 0; i < num_coins; i++)
- {
- json_t *jpub = json_array_get (jcoin_pubs,
- i);
- json_t *jsig = json_array_get (jcoin_sigs,
- i);
- const char *ps = json_string_value (jpub);
- const char *ss = json_string_value (jsig);
-
- if ((NULL == ps) ||
- (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (ps,
- strlen (ps),
- &coin_pubs[i],
- sizeof(coin_pubs[i]))))
- {
- GNUNET_break_op (0);
- json_decref (json);
- return TALER_MHD_reply_with_ec (
- connection,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "coin_pub[] malformed");
- }
- if ((NULL == ss) ||
- (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (ss,
- strlen (ss),
- &coin_sigs[i],
- sizeof(coin_sigs[i]))))
- {
- GNUNET_break_op (0);
- json_decref (json);
- return TALER_MHD_reply_with_ec (
- connection,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "coin_sig[] malformed");
- }
- }
- dc.num_coins = num_coins;
- dc.coin_pubs = coin_pubs;
- dc.coin_sigs = coin_sigs;
- es.exchange_pub = dc.exchange_pub; /* used twice! */
- res = verify_and_execute_deposit_confirmation (connection,
- &dc,
- &es);
- GNUNET_JSON_parse_free (spec);
- json_decref (json);
- return res;
- }
-}
-
-
-void
-TEAH_DEPOSIT_CONFIRMATION_init (void)
-{
- cache = GNUNET_CONTAINER_multihashmap_create (32,
- GNUNET_NO);
- GNUNET_assert (0 == pthread_mutex_init (&lock, NULL));
-}
-
-
-void
-TEAH_DEPOSIT_CONFIRMATION_done (void)
-{
- if (NULL != cache)
- {
- GNUNET_CONTAINER_multihashmap_destroy (cache);
- cache = NULL;
- GNUNET_assert (0 == pthread_mutex_destroy (&lock));
- }
-}
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.h b/src/auditor/taler-auditor-httpd_deposit-confirmation.h
@@ -1,63 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2018 Taler Systems SA
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file taler-auditor-httpd_deposit-confirmation.h
- * @brief Handle /deposit-confirmation requests
- * @author Christian Grothoff
- */
-#ifndef TALER_AUDITOR_HTTPD_DEPOSIT_CONFIRMATION_H
-#define TALER_AUDITOR_HTTPD_DEPOSIT_CONFIRMATION_H
-
-
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
- * Initialize subsystem.
- */
-void
-TEAH_DEPOSIT_CONFIRMATION_init (void);
-
-/**
- * Shut down subsystem.
- */
-void
-TEAH_DEPOSIT_CONFIRMATION_done (void);
-
-
-/**
- * Handle a "/deposit-confirmation" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_DEPOSIT_CONFIRMATION_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_early-aggregation-get.c b/src/auditor/taler-auditor-httpd_early-aggregation-get.c
@@ -1,132 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2025 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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_early-aggregation-get.h"
-
-
-/**
- * Add early aggregation record to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param ea early aggregation record
- * @return #GNUNET_OK
- */
-static enum GNUNET_GenericReturnValue
-add_early_aggregation (
- void *cls,
- const struct TALER_AUDITORDB_EarlyAggregation *ea)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- ea->row_id),
- GNUNET_JSON_pack_uint64 ("batch_deposit_serial_id",
- ea->batch_deposit_serial_id),
- GNUNET_JSON_pack_uint64 ("tracking_serial_id",
- ea->tracking_serial_id),
- TALER_JSON_pack_amount ("balance",
- &ea->total),
- GNUNET_JSON_pack_bool ("suppressed",
- ea->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_early_aggregation_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;
-
- 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);
- }
- 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);
- {
- const char *ret_s = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
- if ( (NULL != ret_s) &&
- (0 == strcmp (ret_s,
- "true")) )
- {
- return_suppressed = true;
- }
- }
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->select_early_aggregations (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &add_early_aggregation,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /early-aggregation in database\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "select_early_aggregations");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("early_aggregations",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_early-aggregation-get.h b/src/auditor/taler-auditor-httpd_early-aggregation-get.h
@@ -1,45 +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 TALER_AUDITOR_HTTPD_EARLY_AGGREGATION_GET_H
-#define TALER_AUDITOR_HTTPD_EARLY_AGGREGATION_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-
-/**
- * Handle a "/monitoring/early-aggregation" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_early_aggregation_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
diff --git a/src/auditor/taler-auditor-httpd_emergency-by-count-get.c b/src/auditor/taler-auditor-httpd_emergency-by-count-get.c
@@ -1,143 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_emergency-by-count-get.h"
-
-/**
- * Add emergency-by-count to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_emergency_by_count (
- void *cls,
- const struct TALER_AUDITORDB_EmergenciesByCount *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_data_auto ("denompub_h",
- &dc->denompub_h),
- GNUNET_JSON_pack_int64 ("num_issued",
- dc->num_issued),
- GNUNET_JSON_pack_int64 ("num_known",
- dc->num_known),
- TALER_JSON_pack_amount ("risk",
- &dc->risk),
- TALER_JSON_pack_time_abs_human ("start",
- dc->start),
- TALER_JSON_pack_time_abs_human ("deposit_end",
- dc->deposit_end),
- TALER_JSON_pack_amount ("value",
- &dc->value),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_EMERGENCY_BY_COUNT_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;
- (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);
- }
- 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);
- {
- 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;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_emergency_by_count (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_emergency_by_count,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /emergency-by-count\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "emergency-by-count");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("emergency_by_count",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_emergency-by-count-get.h b/src/auditor/taler-auditor-httpd_emergency-by-count-get.h
@@ -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_EMERGENCY_BY_COUNT_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_EMERGENCY_BY_COUNT_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_EMERGENCY_BY_COUNT_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_EMERGENCY_BY_COUNT_GET_done (void);
-
-/**
- * Handle a "/emergency-by-count" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_EMERGENCY_BY_COUNT_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
diff --git a/src/auditor/taler-auditor-httpd_emergency-get.c b/src/auditor/taler-auditor-httpd_emergency-get.c
@@ -1,142 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_emergency-get.h"
-
-
-/**
- * Add emergency to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_emergency (
- void *cls,
- const struct TALER_AUDITORDB_Emergency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_data_auto ("denompub_h",
- &dc->denompub_h),
- TALER_JSON_pack_amount ("denom_risk",
- &dc->denom_risk),
- TALER_JSON_pack_amount ("denom_loss",
- &dc->denom_loss),
- TALER_JSON_pack_time_abs_human ("deposit_start",
- dc->deposit_start),
- TALER_JSON_pack_time_abs_human ("deposit_end",
- dc->deposit_end),
- TALER_JSON_pack_amount ("value",
- &dc->value),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_EMERGENCY_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;
- (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);
- }
- 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);
- {
- 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;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_emergency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_emergency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /emergency\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "emergency error");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("emergency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_emergency-get.h b/src/auditor/taler-auditor-httpd_emergency-get.h
@@ -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_EMERGENCY_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_EMERGENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_EMERGENCY_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_EMERGENCY_GET_done (void);
-
-/**
- * Handle a "/emergency" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_EMERGENCY_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
diff --git a/src/auditor/taler-auditor-httpd_fee-time-inconsistency-get.c b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-get.c
@@ -1,136 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_fee-time-inconsistency-get.h"
-
-
-/**
- * Add fee-time-inconsistency to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_fee_time_inconsistency (
- void *cls,
- const struct TALER_AUDITORDB_FeeTimeInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_uint64 ("problem_row_id",
- dc->problem_row_id),
- GNUNET_JSON_pack_string ("type",
- dc->type),
- TALER_JSON_pack_time_abs_human ("time",
- dc->time),
- GNUNET_JSON_pack_string ("diagnostic",
- dc->diagnostic)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_FEE_TIME_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;
- (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);
- }
- 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);
- {
- 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;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_fee_time_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_fee_time_inconsistency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /fee-time-inconsistency\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "fee-time-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("fee_time_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_fee-time-inconsistency-get.h b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-get.h
@@ -1,56 +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_FEE_TIME_INCONSISTENCY_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_FEE_TIME_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_FEE_TIME_INCONSISTENCY_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_FEE_TIME_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/fee-time-inconsistency" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_FEE_TIME_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.c
@@ -0,0 +1,144 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.h"
+
+
+/**
+ * Add deposit confirmation to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+add_amount_arithmetic_inconsistency (
+ void *cls,
+ const struct TALER_AUDITORDB_AmountArithmeticInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_uint64 ("problem_row_id",
+ dc->problem_row_id),
+ GNUNET_JSON_pack_string ("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_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_amount_arithmetic_inconsistency (
+ 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;
+ (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);
+ 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);
+ {
+ 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,
+ offset,
+ return_suppressed,
+ &add_amount_arithmetic_inconsistency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ 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_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("amount_arithmetic_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-amount-arithmetic-inconsistency.h
@@ -0,0 +1,57 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_AMOUNT_ARITHMETIC_INCONSISTENCY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_AMOUNT_ARITHMETIC_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+ * Initialize subsystem.
+ */
+void
+TEAH_get_monitoring_amount_arithmetic_inconsistency_init (void);
+
+/**
+ * Shut down subsystem.
+ */
+void
+TEAH_get_monitoring_amount_arithmetic_inconsistency_done (void);
+
+/**
+ * Handle a "/deposit-confirmation" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_amount_arithmetic_inconsistency (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 // TALER_AUDITOR_HTTPD_GET_MONITORING_AMOUNT_ARITHMETIC_INCONSISTENCY_H
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-bad-sig-losses.c b/src/auditor/taler-auditor-httpd_get-monitoring-bad-sig-losses.c
@@ -0,0 +1,147 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-bad-sig-losses.h"
+
+
+/**
+ * Add bad-sig-losses to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+add_bad_sig_losses (
+ void *cls,
+ const struct TALER_AUDITORDB_BadSigLosses *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_uint64 ("problem_row_id",
+ dc->problem_row_id),
+ GNUNET_JSON_pack_string ("operation",
+ dc->operation),
+ TALER_JSON_pack_amount ("loss",
+ &dc->loss),
+ GNUNET_JSON_pack_data_auto ("operation_specific_pub",
+ &dc->operation_specific_pub),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_bad_sig_losses (
+ 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;
+ struct GNUNET_CRYPTO_EddsaPublicKey op_spec_pub;
+ bool filter_spec_pub = false;
+ const char *op;
+
+ (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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+
+ op = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "op");
+ TALER_MHD_parse_request_arg_auto (connection,
+ "op_spec_pub",
+ &op_spec_pub,
+ filter_spec_pub);
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_bad_sig_losses (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ filter_spec_pub ? &op_spec_pub : NULL,
+ op,
+ &add_bad_sig_losses,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (0);
+ json_decref (ja);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "bad-sig-losses");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("bad_sig_losses",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-bad-sig-losses.h b/src/auditor/taler-auditor-httpd_get-monitoring-bad-sig-losses.h
@@ -0,0 +1,58 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_BAD_SIG_LOSSES_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_BAD_SIG_LOSSES_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_bad_sig_losses_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_bad_sig_losses_done (void);
+
+/**
+ * Handle a "/bad-sig-losses" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_bad_sig_losses (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-balances.c b/src/auditor/taler-auditor-httpd_get-monitoring-balances.c
@@ -0,0 +1,108 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-balances.h"
+
+/**
+ * Add balance to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of with balance data
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_balances (
+ void *cls,
+ const struct TALER_AUDITORDB_Balances *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("balance_key",
+ dc->balance_key),
+ TALER_JSON_pack_amount ("balance_value",
+ &dc->balance_value)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_balances (
+ 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;
+ const char *balance_key;
+
+ (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);
+ }
+ balance_key
+ = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "balance_key");
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_balances (
+ TAH_plugin->cls,
+ balance_key,
+ &process_balances,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /balances");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "balances");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("balances",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-balances.h b/src/auditor/taler-auditor-httpd_get-monitoring-balances.h
@@ -0,0 +1,45 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_BALANCES_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_BALANCES_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+
+/**
+ * Handle a "/balances" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_balances (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-closure-lags.c b/src/auditor/taler-auditor-httpd_get-monitoring-closure-lags.c
@@ -0,0 +1,137 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-closure-lags.h"
+
+
+/**
+ * Add closure-lags to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_closure_lags (
+ void *cls,
+ const struct TALER_AUDITORDB_ClosureLags *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_uint64 ("problem_row_id",
+ dc->problem_row_id),
+ TALER_JSON_pack_amount ("amount",
+ &dc->amount),
+ TALER_JSON_pack_time_abs_human ("deadline",
+ dc->deadline),
+ GNUNET_JSON_pack_data_auto ("wtid",
+ &dc->wtid),
+ TALER_JSON_pack_full_payto ("account",
+ dc->account),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+
+
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_closure_lags (
+ 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;
+
+ 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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_auditor_closure_lags (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_closure_lags,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /closure-lags\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "get_auditor_closure_lags");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("closure_lags",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-closure-lags.h b/src/auditor/taler-auditor-httpd_get-monitoring-closure-lags.h
@@ -0,0 +1,58 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_CLOSURE_LAGS_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_CLOSURE_LAGS_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_closure_lags_init (void);
+
+/**
+ * Shut down subsystem.
+ */
+void
+TEAH_get_monitoring_closure_lags_done (void);
+
+/**
+ * Handle a "/closure-lags" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_closure_lags (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-coin-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-coin-inconsistency.c
@@ -0,0 +1,127 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-coin-inconsistency.h"
+
+
+/**
+ * Add deposit confirmation 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
+add_coin_inconsistency (
+ void *cls,
+ uint64_t serial_id,
+ const struct TALER_AUDITORDB_CoinInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("operation", dc->operation),
+ TALER_JSON_pack_amount ("exchange_amount", &dc->exchange_amount),
+ TALER_JSON_pack_amount ("auditor_amount", &dc->auditor_amount),
+ GNUNET_JSON_pack_data_auto ("coin_pub",&dc->coin_pub),
+ GNUNET_JSON_pack_bool ("profitable", dc->profitable)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_coin_inconsistency (
+ 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;
+
+ 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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_coin_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &add_coin_inconsistency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /coin-inconsistency in database\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "coin-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("coin_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-coin-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-coin-inconsistency.h
@@ -0,0 +1,57 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_COIN_INCONSISTENCY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_COIN_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+ * Initialize subsystem.
+ */
+void
+TEAH_get_monitoring_coin_inconsistency_init (void);
+
+/**
+ * Shut down subsystem.
+ */
+void
+TEAH_get_monitoring_coin_inconsistency_done (void);
+
+/**
+ * Handle a "/deposit-confirmation" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_coin_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.c
@@ -0,0 +1,140 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include \
+ "taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.h"
+
+/**
+ * Add denomination-key-validity-withdraw-inconsistency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate
+ */
+static enum GNUNET_GenericReturnValue
+process_denomination_key_validity_withdraw_inconsistency (
+ void *cls,
+ const struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_uint64 ("problem_row_id",
+ dc->problem_row_id),
+ TALER_JSON_pack_time_abs_human ("execution_date",
+ dc->execution_date),
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &dc->reserve_pub),
+ GNUNET_JSON_pack_data_auto ("denompub_h",
+ &dc->denompub_h),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+
+
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_denomination_key_validity_withdraw_inconsistency (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_denomination_key_validity_withdraw_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_denomination_key_validity_withdraw_inconsistency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /denomination-key-validity-withdraw-inconsistency\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "denomination-key-validity-withdraw-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal (
+ "denomination_key_validity_withdraw_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-denomination-key-validity-withdraw-inconsistency.h
@@ -0,0 +1,62 @@
+/*
+ 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 \
+ TALER_AUDITOR_HTTPD_GET_MONITORING_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H
+#define \
+ TALER_AUDITOR_HTTPD_GET_MONITORING_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_denomination_key_validity_withdraw_inconsistency_init (void)
+;
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_denomination_key_validity_withdraw_inconsistency_done (void)
+;
+
+/**
+ * Handle a "/denomination-key-validity-withdraw-inconsistency" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_denomination_key_validity_withdraw_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-denomination-pending.c b/src/auditor/taler-auditor-httpd_get-monitoring-denomination-pending.c
@@ -0,0 +1,128 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-denomination-pending.h"
+
+/**
+ * Add denomination-pending 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_denomination_pending (
+ void *cls,
+ uint64_t serial_id,
+ const struct TALER_AUDITORDB_DenominationPending *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_data_auto ("denom_pub_hash",
+ &dc->denom_pub_hash),
+ TALER_JSON_pack_amount ("denom_balance",
+ &dc->denom_balance),
+ TALER_JSON_pack_amount ("denom_loss",
+ &dc->denom_loss),
+ GNUNET_JSON_pack_int64 ("num_issued",
+ dc->num_issued),
+ TALER_JSON_pack_amount ("denom_risk",
+ &dc->denom_risk),
+ TALER_JSON_pack_amount ("recoup_loss",
+ &dc->recoup_loss)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_denomination_pending (
+ 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;
+
+ (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);
+ }
+ 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);
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_denomination_pending (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ &process_denomination_pending,
+ ja);
+
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /denomination-pending");
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "get_denomination_pending");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("denomination_pending",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-denomination-pending.h b/src/auditor/taler-auditor-httpd_get-monitoring-denomination-pending.h
@@ -0,0 +1,58 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_DENOMINATION_PENDING_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_DENOMINATION_PENDING_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_denomination_pending_init (void);
+
+/**
+ * Shut down subsystem.
+ */
+void
+TEAH_get_monitoring_denomination_pending_done (void);
+
+/**
+ * Handle a "/denomination-pending" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_denomination_pending (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-denominations-without-sigs.c b/src/auditor/taler-auditor-httpd_get-monitoring-denominations-without-sigs.c
@@ -0,0 +1,138 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-denominations-without-sigs.h"
+
+
+/**
+ * Add denominations-without-sigs to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_denominations_without_sigs (
+ void *cls,
+ const struct TALER_AUDITORDB_DenominationsWithoutSigs *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_int64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_data_auto ("denompub_h",
+ &dc->denompub_h),
+ TALER_JSON_pack_amount ("value",
+ &dc->value),
+ TALER_JSON_pack_time_abs_human ("start_time",
+ dc->start_time),
+ TALER_JSON_pack_time_abs_human ("end_time",
+ dc->end_time),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_denominations_without_sigs (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_denominations_without_sigs (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_denominations_without_sigs,
+ ja);
+
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /denominations-without-sigs");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "denominations-without-sigs");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("denominations_without_sigs",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-denominations-without-sigs.h b/src/auditor/taler-auditor-httpd_get-monitoring-denominations-without-sigs.h
@@ -0,0 +1,58 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_DENOMINATIONS_WITHOUT_SIGS_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_DENOMINATIONS_WITHOUT_SIGS_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_denominations_without_sigs_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_denominations_without_sigs_done (void);
+
+/**
+ * Handle a "/denominations-without-sigs" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_denominations_without_sigs (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-deposit-confirmations.c b/src/auditor/taler-auditor-httpd_get-monitoring-deposit-confirmations.c
@@ -0,0 +1,184 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2014-2024 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file taler-auditor-httpd_get-monitoring-deposit-confirmations.c
+ * @brief Handle /deposit-confirmation requests; return list of deposit confirmations from merchant
+ * that were not received from the exchange, by auditor.
+ * @author Nic Eigel
+ */
+#include "taler/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-deposit-confirmations.h"
+
+
+/**
+ * Add deposit confirmation to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of deposit confirmation
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+add_deposit_confirmation (
+ void *cls,
+ const struct TALER_AUDITORDB_DepositConfirmation *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+ json_t *coin_pubs_json = json_array ();
+ json_t *coin_sigs_json = json_array ();
+
+ GNUNET_assert (NULL != coin_pubs_json);
+ GNUNET_assert (NULL != coin_sigs_json);
+ for (unsigned int i = 0; i < dc->num_coins; i++)
+ {
+ json_t *pub;
+ json_t *sig;
+
+ pub = GNUNET_JSON_from_data_auto (&dc->coin_pubs[i]);
+ GNUNET_assert (0 ==
+ json_array_append_new (coin_pubs_json,
+ pub));
+ sig = GNUNET_JSON_from_data_auto (&dc->coin_sigs[i]);
+ GNUNET_assert (0 ==
+ json_array_append_new (coin_sigs_json,
+ sig));
+ }
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_int64 ("deposit_confirmation_serial_id",
+ dc->row_id),
+ GNUNET_JSON_pack_data_auto ("h_contract_terms",
+ &dc->h_contract_terms),
+ GNUNET_JSON_pack_data_auto ("h_policy",
+ &dc->h_policy),
+ GNUNET_JSON_pack_data_auto ("h_wire",
+ &dc->h_wire),
+ GNUNET_JSON_pack_timestamp ("exchange_timestamp",
+ dc->exchange_timestamp),
+ GNUNET_JSON_pack_timestamp ("refund_deadline",
+ dc->refund_deadline),
+ GNUNET_JSON_pack_timestamp ("wire_deadline",
+ dc->wire_deadline),
+ TALER_JSON_pack_amount ("total_without_fee",
+ &dc->total_without_fee),
+ GNUNET_JSON_pack_array_steal ("coin_pubs",
+ coin_pubs_json),
+ GNUNET_JSON_pack_array_steal ("coin_sigs",
+ coin_sigs_json),
+ GNUNET_JSON_pack_data_auto ("merchant_pub",
+ &dc->merchant),
+ GNUNET_JSON_pack_data_auto ("exchange_sig",
+ &dc->exchange_sig),
+ GNUNET_JSON_pack_data_auto ("exchange_pub",
+ &dc->exchange_pub),
+ GNUNET_JSON_pack_data_auto ("master_sig",
+ &dc->master_sig),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_deposit_confirmations (
+ 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;
+ bool return_suppressed = false;
+ int64_t limit = -20;
+ uint64_t offset;
+
+ (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);
+ }
+ 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);
+ {
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if ( (NULL != ret_s) &&
+ (0 == strcmp (ret_s, "true")) )
+ {
+ return_suppressed = true;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_deposit_confirmations (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &add_deposit_confirmation,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /deposit-confirmation in database\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "deposit-confirmation");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("deposit_confirmation",
+ ja));
+}
+
+
+/* end of taler-auditor-httpd_deposit-confirmation-get.c */
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-deposit-confirmations.h b/src/auditor/taler-auditor-httpd_get-monitoring-deposit-confirmations.h
@@ -0,0 +1,61 @@
+/*
+ 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 Affero General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file taler-auditor-httpd_get-monitoring-deposit-confirmations.h
+ * @brief Handle GET /deposit-confirmation requests
+ * @author Nic Eigel
+ */
+#ifndef TALER_AUDITOR_HTTPD_GET_MONITORING_DEPOSIT_CONFIRMATIONS_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_DEPOSIT_CONFIRMATIONS_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+ * Initialize subsystem.
+ */
+void
+TEAH_get_monitoring_deposit_confirmations_init (void);
+
+/**
+ * Shut down subsystem.
+ */
+void
+TEAH_get_monitoring_deposit_confirmations_done (void);
+
+/**
+ * Handle a "/deposit-confirmation" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_deposit_confirmations (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-early-aggregation.c b/src/auditor/taler-auditor-httpd_get-monitoring-early-aggregation.c
@@ -0,0 +1,132 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2025 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-early-aggregation.h"
+
+
+/**
+ * Add early aggregation record to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param ea early aggregation record
+ * @return #GNUNET_OK
+ */
+static enum GNUNET_GenericReturnValue
+add_early_aggregation (
+ void *cls,
+ const struct TALER_AUDITORDB_EarlyAggregation *ea)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ ea->row_id),
+ GNUNET_JSON_pack_uint64 ("batch_deposit_serial_id",
+ ea->batch_deposit_serial_id),
+ GNUNET_JSON_pack_uint64 ("tracking_serial_id",
+ ea->tracking_serial_id),
+ TALER_JSON_pack_amount ("balance",
+ &ea->total),
+ GNUNET_JSON_pack_bool ("suppressed",
+ ea->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_early_aggregation (
+ 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;
+
+ 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);
+ }
+ 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);
+ {
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if ( (NULL != ret_s) &&
+ (0 == strcmp (ret_s,
+ "true")) )
+ {
+ return_suppressed = true;
+ }
+ }
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->select_early_aggregations (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &add_early_aggregation,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /early-aggregation in database\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "select_early_aggregations");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("early_aggregations",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-early-aggregation.h b/src/auditor/taler-auditor-httpd_get-monitoring-early-aggregation.h
@@ -0,0 +1,45 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_EARLY_AGGREGATION_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_EARLY_AGGREGATION_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+
+/**
+ * Handle a "/monitoring/early-aggregation" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_early_aggregation (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-emergency-by-count.c b/src/auditor/taler-auditor-httpd_get-monitoring-emergency-by-count.c
@@ -0,0 +1,143 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-emergency-by-count.h"
+
+/**
+ * Add emergency-by-count to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_emergency_by_count (
+ void *cls,
+ const struct TALER_AUDITORDB_EmergenciesByCount *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_data_auto ("denompub_h",
+ &dc->denompub_h),
+ GNUNET_JSON_pack_int64 ("num_issued",
+ dc->num_issued),
+ GNUNET_JSON_pack_int64 ("num_known",
+ dc->num_known),
+ TALER_JSON_pack_amount ("risk",
+ &dc->risk),
+ TALER_JSON_pack_time_abs_human ("start",
+ dc->start),
+ TALER_JSON_pack_time_abs_human ("deposit_end",
+ dc->deposit_end),
+ TALER_JSON_pack_amount ("value",
+ &dc->value),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_emergency_by_count (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_emergency_by_count (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_emergency_by_count,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /emergency-by-count\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "emergency-by-count");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("emergency_by_count",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-emergency-by-count.h b/src/auditor/taler-auditor-httpd_get-monitoring-emergency-by-count.h
@@ -0,0 +1,58 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_EMERGENCY_BY_COUNT_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_EMERGENCY_BY_COUNT_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_emergency_by_count_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_emergency_by_count_done (void);
+
+/**
+ * Handle a "/emergency-by-count" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_emergency_by_count (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-emergency.c b/src/auditor/taler-auditor-httpd_get-monitoring-emergency.c
@@ -0,0 +1,142 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-emergency.h"
+
+
+/**
+ * Add emergency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_emergency (
+ void *cls,
+ const struct TALER_AUDITORDB_Emergency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_data_auto ("denompub_h",
+ &dc->denompub_h),
+ TALER_JSON_pack_amount ("denom_risk",
+ &dc->denom_risk),
+ TALER_JSON_pack_amount ("denom_loss",
+ &dc->denom_loss),
+ TALER_JSON_pack_time_abs_human ("deposit_start",
+ dc->deposit_start),
+ TALER_JSON_pack_time_abs_human ("deposit_end",
+ dc->deposit_end),
+ TALER_JSON_pack_amount ("value",
+ &dc->value),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_emergency (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_emergency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_emergency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /emergency\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "emergency error");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("emergency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-emergency.h b/src/auditor/taler-auditor-httpd_get-monitoring-emergency.h
@@ -0,0 +1,58 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_EMERGENCY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_EMERGENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_emergency_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_emergency_done (void);
+
+/**
+ * Handle a "/emergency" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_emergency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-fee-time-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-fee-time-inconsistency.c
@@ -0,0 +1,136 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-fee-time-inconsistency.h"
+
+
+/**
+ * Add fee-time-inconsistency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_fee_time_inconsistency (
+ void *cls,
+ const struct TALER_AUDITORDB_FeeTimeInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_uint64 ("problem_row_id",
+ dc->problem_row_id),
+ GNUNET_JSON_pack_string ("type",
+ dc->type),
+ TALER_JSON_pack_time_abs_human ("time",
+ dc->time),
+ GNUNET_JSON_pack_string ("diagnostic",
+ dc->diagnostic)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_fee_time_inconsistency (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_fee_time_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_fee_time_inconsistency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /fee-time-inconsistency\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "fee-time-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("fee_time_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-fee-time-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-fee-time-inconsistency.h
@@ -0,0 +1,56 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_FEE_TIME_INCONSISTENCY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_FEE_TIME_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_fee_time_inconsistency_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_fee_time_inconsistency_done (void);
+
+/**
+ * Handle a "/fee-time-inconsistency" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_fee_time_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-historic-denomination-revenue.c b/src/auditor/taler-auditor-httpd_get-monitoring-historic-denomination-revenue.c
@@ -0,0 +1,138 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-historic-denomination-revenue.h"
+
+
+/**
+ * Add historic-denomination-revenue 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 denom_pub_hash public key hash of the denomination
+ * @param revenue_timestamp when was the revenue effective
+ * @param revenue_balance how much in profit did we make from this denomination
+ * @param loss_balance how much loss did we make from this denomination
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_historic_denomination_revenue (
+ void *cls,
+ uint64_t serial_id,
+ const struct TALER_DenominationHashP *denom_pub_hash,
+ struct GNUNET_TIME_Timestamp revenue_timestamp,
+ const struct TALER_Amount *revenue_balance,
+ const struct TALER_Amount *loss_balance)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("serial_id",
+ serial_id),
+ GNUNET_JSON_pack_data_auto ("denom_pub_hash",
+ denom_pub_hash),
+ TALER_JSON_pack_time_abs_human ("revenue_timestamp",
+ revenue_timestamp.abs_time),
+ TALER_JSON_pack_amount ("revenue_balance",
+ revenue_balance),
+ TALER_JSON_pack_amount ("loss_balance",
+ loss_balance)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+
+
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_historic_denomination_revenue (
+ 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;
+ int64_t limit = -20;
+ uint64_t offset;
+ 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);
+ }
+ 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);
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->select_historic_denom_revenue (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ &process_historic_denomination_revenue,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /historic-denomination-revenue");
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "select_historic_denom_revenue");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal (
+ "historic-denomination-revenue",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-historic-denomination-revenue.h b/src/auditor/taler-auditor-httpd_get-monitoring-historic-denomination-revenue.h
@@ -0,0 +1,56 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_HISTORIC_DENOMINATION_REVENUE_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_HISTORIC_DENOMINATION_REVENUE_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_historic_denomination_revenue_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_historic_denomination_revenue_done (void);
+
+/**
+ * Handle a "/historic-denomination-revenue" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_historic_denomination_revenue (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-historic-reserve-summary.c b/src/auditor/taler-auditor-httpd_get-monitoring-historic-reserve-summary.c
@@ -0,0 +1,133 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-historic-reserve-summary.h"
+
+/**
+ * Add historic-reserve-summary 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 start_time beginning of aggregated time interval
+ * @param end_time end of aggregated time interval
+ * @param reserve_profits total profits made
+ *
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+*/
+static enum GNUNET_GenericReturnValue
+process_historic_reserve_summary (
+ void *cls,
+ uint64_t serial_id,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
+ const struct TALER_Amount *reserve_profits)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_int64 ("row_id",
+ serial_id),
+ TALER_JSON_pack_time_abs_human ("start_date",
+ start_time.abs_time),
+ TALER_JSON_pack_time_abs_human ("end_date",
+ end_time.abs_time),
+ TALER_JSON_pack_amount ("reserve_profits",
+ reserve_profits)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_historic_reserve_summary (
+ 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;
+
+ (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);
+ }
+ 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);
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->select_historic_reserve_revenue (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ &process_historic_reserve_summary,
+ ja);
+
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /historic-reserve-summary");
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "select_historic_reserve_revenue");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal (
+ "historic-reserve-summary",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-historic-reserve-summary.h b/src/auditor/taler-auditor-httpd_get-monitoring-historic-reserve-summary.h
@@ -0,0 +1,56 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_HISTORIC_RESERVE_SUMMARY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_HISTORIC_RESERVE_SUMMARY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_historic_reserve_summary_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_historic_reserve_summary_done (void);
+
+/**
+ * Handle a "/historic-reserve-summary" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_historic_reserve_summary (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.c
@@ -0,0 +1,136 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.h"
+
+
+/**
+ * Add misattribution-in-inconsistency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_misattribution_in_inconsistency (
+ void *cls,
+ const struct TALER_AUDITORDB_MisattributionInInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ TALER_JSON_pack_amount ("amount",
+ &dc->amount),
+ GNUNET_JSON_pack_uint64 ("bank_row",
+ dc->bank_row),
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &dc->reserve_pub),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_misattribution_in_inconsistency (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_misattribution_in_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_misattribution_in_inconsistency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /misattribution-in-inconsistency");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "misattribution-in-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("misattribution_in_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-misattribution-in-inconsistency.h
@@ -0,0 +1,56 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_MISATTRIBUTION_IN_INCONSISTENCY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_MISATTRIBUTION_IN_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_misattribution_in_inconsistency_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_misattribution_in_inconsistency_done (void);
+
+/**
+ * Handle a "/misattribution-in-inconsistency" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_misattribution_in_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-pending-deposits.c b/src/auditor/taler-auditor-httpd_get-monitoring-pending-deposits.c
@@ -0,0 +1,143 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2025 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-pending-deposits.h"
+
+
+/**
+ * Add pending deposit to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param row_id row ID of the alert in the auditor database
+ * @param batch_deposit_serial_id where in the exchange table are we
+ * @param total_amount value of all missing deposits, including fees
+ * @param wire_target_h_payto hash of the recipient account's payto URI
+ * @param deadline what was the earliest requested wire transfer deadline
+ * @param suppressed true if this report was suppressed
+ */
+static void
+add_pending_deposit (
+ void *cls,
+ uint64_t row_id,
+ uint64_t batch_deposit_serial_id,
+ const struct TALER_Amount *total_amount,
+ const struct TALER_FullPaytoHashP *wire_target_h_payto,
+ struct GNUNET_TIME_Timestamp deadline,
+ bool suppressed)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ row_id),
+ GNUNET_JSON_pack_uint64 ("batch_deposit_serial_id",
+ batch_deposit_serial_id),
+ TALER_JSON_pack_amount ("total_amount",
+ total_amount),
+ GNUNET_JSON_pack_data_auto ("h_wire",
+ wire_target_h_payto),
+ GNUNET_JSON_pack_timestamp ("deadline",
+ deadline),
+ GNUNET_JSON_pack_bool ("suppressed",
+ suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_pending_deposits (
+ 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;
+
+ 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);
+ }
+ 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);
+ {
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if ( (NULL != ret_s) &&
+ (0 == strcmp (ret_s,
+ "true")) )
+ {
+ return_suppressed = true;
+ }
+ }
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->select_pending_deposits (
+ TAH_plugin->cls,
+ GNUNET_TIME_absolute_get (),
+ limit,
+ offset,
+ return_suppressed,
+ &add_pending_deposit,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /pending-deposits in database\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "select_pending_deposits");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("pending_deposits",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-pending-deposits.h b/src/auditor/taler-auditor-httpd_get-monitoring-pending-deposits.h
@@ -0,0 +1,44 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2025 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 TALER_AUDITOR_HTTPD_GET_MONITORING_PENDING_DEPOSITS_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_PENDING_DEPOSITS_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+ * Handle a GET "/pending-deposits" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_pending_deposits (
+ 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 // TALER_AUDITOR_HTTPD_GET_MONITORING_PENDING_DEPOSITS_H
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-progress.c b/src/auditor/taler-auditor-httpd_get-monitoring-progress.c
@@ -0,0 +1,107 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-progress.h"
+
+
+/**
+ * Add progress to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct with progress data
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_progress (
+ void *cls,
+ const struct TALER_AUDITORDB_Progress *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("progress_key",
+ dc->progress_key),
+ GNUNET_JSON_pack_int64 ("progress_offset",
+ dc->progress_offset)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_progress (
+ 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;
+ const char *progress_key;
+
+ (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);
+ }
+ progress_key
+ = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "progress_key");
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_progress_points (
+ TAH_plugin->cls,
+ progress_key,
+ &process_progress,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (0);
+ json_decref (ja);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "progress");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("progress",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-progress.h b/src/auditor/taler-auditor-httpd_get-monitoring-progress.h
@@ -0,0 +1,33 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_PROGRESS_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_PROGRESS_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+
+MHD_RESULT
+TAH_get_monitoring_progress (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.c b/src/auditor/taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.c
@@ -0,0 +1,140 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.h"
+
+/**
+ * Add purse-not-closed-inconsistencies to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_purse_not_closed_inconsistencies (
+ void *cls,
+ const struct TALER_AUDITORDB_PurseNotClosedInconsistencies *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_data_auto ("purse_pub",
+ &dc->purse_pub),
+ TALER_JSON_pack_amount ("amount",
+ &dc->amount),
+ TALER_JSON_pack_time_abs_human ("expiration_date",
+ dc->expiration_date),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_purse_not_closed_inconsistencies (
+ 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;
+ (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);
+ }
+ 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);
+
+ {
+ const char *ret_s
+ = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+
+ if ( (NULL != ret_s) &&
+ (0 == strcmp (ret_s,
+ "true")) )
+ {
+ return_suppressed = true;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_purse_not_closed_inconsistencies (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_purse_not_closed_inconsistencies,
+ ja);
+
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /purse-not-closed-inconsistencies\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "purse-not-closed-inconsistencies");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("purse_not_closed_inconsistencies",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.h b/src/auditor/taler-auditor-httpd_get-monitoring-purse-not-closed-inconsistencies.h
@@ -0,0 +1,58 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_PURSE_NOT_CLOSED_INCONSISTENCIES_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_PURSE_NOT_CLOSED_INCONSISTENCIES_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_purse_not_closed_inconsistencies_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_purse_not_closed_inconsistencies_done (void);
+
+/**
+ * Handle a "/purse-not-closed-inconsistencies" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_purse_not_closed_inconsistencies (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-purses.c b/src/auditor/taler-auditor-httpd_get-monitoring-purses.c
@@ -0,0 +1,127 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-purses.h"
+
+/**
+ * Add purses 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_purses (
+ void *cls,
+ uint64_t serial_id,
+ const struct TALER_AUDITORDB_Purses *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+
+ GNUNET_JSON_pack_int64 ("auditor_purses_rowid", dc->auditor_purses_rowid),
+ GNUNET_JSON_pack_data_auto ("purse_pub", &dc->purse_pub),
+ TALER_JSON_pack_amount ("balance", &dc->balance),
+ TALER_JSON_pack_amount ("target", &dc->target),
+ TALER_JSON_pack_time_abs_human ("expiration_date", dc->expiration_date)
+
+
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+
+
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_purses (
+ 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;
+
+ (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);
+ }
+ 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);
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_purses (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ &process_purses,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /purses");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "purses");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("purses",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-purses.h b/src/auditor/taler-auditor-httpd_get-monitoring-purses.h
@@ -0,0 +1,56 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_PURSES_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_PURSES_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_purses_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_purses_done (void);
+
+/**
+ * Handle a "/purses" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_purses (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.c
@@ -0,0 +1,137 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include \
+ "taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.h"
+
+
+/**
+ * Add reserve-balance-insufficient-inconsistency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_reserve_balance_insufficient_inconsistency (
+ void *cls,
+ const struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &dc->reserve_pub),
+ GNUNET_JSON_pack_bool ("inconsistency_gain",
+ dc->inconsistency_gain),
+ TALER_JSON_pack_amount ("inconsistency_amount",
+ &dc->inconsistency_amount),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_reserve_balance_insufficient_inconsistency (
+ 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;
+ (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);
+ }
+ 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);
+
+ {
+ 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;
+ }
+ }
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_reserve_balance_insufficient_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_reserve_balance_insufficient_inconsistency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /reserve-balance-insufficient-inconsistency\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "reserve-balance-insufficient-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("reserve_balance_insufficient_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-insufficient-inconsistency.h
@@ -0,0 +1,58 @@
+/*
+ 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 \
+ TALER_AUDITOR_HTTPD_GET_MONITORING_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H
+#define \
+ TALER_AUDITOR_HTTPD_GET_MONITORING_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_reserve_balance_insufficient_inconsistency_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_reserve_balance_insufficient_inconsistency_done (void);
+
+/**
+ * Handle a "/reserve-balance-insufficient-inconsistency" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_reserve_balance_insufficient_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.c
@@ -0,0 +1,133 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include \
+ "taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.h"
+
+
+/**
+ * Add reserve-balance-summary-wrong-inconsistency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_reserve_balance_summary_wrong_inconsistency (
+ void *cls,
+ const struct TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_int64 ("row_id", dc->row_id),
+ GNUNET_JSON_pack_data_auto ("reserve_pub", &dc->reserve_pub),
+ TALER_JSON_pack_amount ("exchange_amount", &dc->exchange_amount),
+ TALER_JSON_pack_amount ("auditor_amount", &dc->auditor_amount),
+ GNUNET_JSON_pack_bool ("suppressed", dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_reserve_balance_summary_wrong_inconsistency (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_reserve_balance_summary_wrong_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_reserve_balance_summary_wrong_inconsistency,
+ ja);
+
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /reserve-balance-summary-wrong-inconsistency");
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "reserve-balance-summary-wrong-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("reserve_balance_summary_wrong_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-balance-summary-wrong-inconsistency.h
@@ -0,0 +1,58 @@
+/*
+ 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 \
+ TALER_AUDITOR_HTTPD_GET_MONITORING_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_H
+#define \
+ TALER_AUDITOR_HTTPD_GET_MONITORING_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+ * Initialize subsystem.
+ */
+void
+TEAH_get_monitoring_reserve_balance_summary_wrong_inconsistency_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_reserve_balance_summary_wrong_inconsistency_done (void);
+
+/**
+ * Handle a "/reserve-balance-summary-wrong-inconsistency" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_reserve_balance_summary_wrong_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.c
@@ -0,0 +1,145 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.h"
+
+
+/**
+ * Add reserve-in-inconsistency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_reserve_in_inconsistency (
+ void *cls,
+ const struct TALER_AUDITORDB_ReserveInInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->serial_id),
+ GNUNET_JSON_pack_uint64 ("bank_row_id",
+ dc->bank_row_id),
+ TALER_JSON_pack_amount ("amount_exchange_expected",
+ &dc->amount_exchange_expected),
+ TALER_JSON_pack_amount ("amount_wired",
+ &dc->amount_wired),
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &dc->reserve_pub),
+ TALER_JSON_pack_time_abs_human ("timestamp",
+ dc->timestamp),
+ TALER_JSON_pack_full_payto ("account",
+ dc->account),
+ GNUNET_JSON_pack_string ("diagnostic",
+ dc->diagnostic),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+
+
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_reserve_in_inconsistency (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ const char *ret_s
+ = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if ( (NULL != ret_s) &&
+ (0 == strcmp (ret_s,
+ "true")) )
+ {
+ return_suppressed = true;
+ }
+ }
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_reserve_in_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_reserve_in_inconsistency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (0);
+ json_decref (ja);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "reserve-in-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("reserve_in_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-in-inconsistency.h
@@ -0,0 +1,56 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_RESERVE_IN_INCONSISTENCY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_RESERVE_IN_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_reserve_in_inconsistency_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_reserve_in_inconsistency_done (void);
+
+/**
+ * Handle a "/reserve-in-inconsistency" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_reserve_in_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.c
@@ -0,0 +1,140 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.h"
+
+
+/**
+ * Add reserve-not-closed-inconsistency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_reserve_not_closed_inconsistency (
+ void *cls,
+ const struct TALER_AUDITORDB_ReserveNotClosedInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &dc->reserve_pub),
+ TALER_JSON_pack_amount ("balance",
+ &dc->balance),
+ TALER_JSON_pack_time_abs_human ("expiration_time",
+ dc->expiration_time),
+ GNUNET_JSON_pack_string ("diagnostic",
+ dc->diagnostic),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_reserve_not_closed_inconsistency (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ const char *ret_s
+ = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if ( (NULL != ret_s) &&
+ (0 == strcmp (ret_s,
+ "true")) )
+ {
+ return_suppressed = true;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_reserve_not_closed_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_reserve_not_closed_inconsistency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /reserve-not-closed-inconsistency");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "reserve-not-closed-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("reserve_not_closed_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-reserve-not-closed-inconsistency.h
@@ -0,0 +1,56 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_RESERVE_NOT_CLOSED_INCONSISTENCY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_RESERVE_NOT_CLOSED_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_reserve_not_closed_inconsistency_init (void);
+
+/**
+ * Shut down subsystem.
+ */
+void
+TEAH_get_monitoring_reserve_not_closed_inconsistency_done (void);
+
+/**
+ * Handle a "/reserve-not-closed-inconsistency" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_reserve_not_closed_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserves.c b/src/auditor/taler-auditor-httpd_get-monitoring-reserves.c
@@ -0,0 +1,138 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-reserves.h"
+
+
+/**
+ * Add reserves 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_reserves (
+ void *cls,
+ uint64_t serial_id,
+ const struct TALER_AUDITORDB_Reserves *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_int64 ("auditor_reserves_rowid",
+ dc->auditor_reserves_rowid),
+ GNUNET_JSON_pack_data_auto ("reserve_pub",
+ &dc->reserve_pub),
+ TALER_JSON_pack_amount ("reserve_balance",
+ &dc->reserve_balance),
+ TALER_JSON_pack_amount ("reserve_loss",
+ &dc->reserve_loss),
+ TALER_JSON_pack_amount ("withdraw_fee_balance",
+ &dc->withdraw_fee_balance),
+ TALER_JSON_pack_amount ("close_fee_balance",
+ &dc->close_fee_balance),
+ TALER_JSON_pack_amount ("purse_fee_balance",
+ &dc->purse_fee_balance),
+ TALER_JSON_pack_amount ("open_fee_balance",
+ &dc->open_fee_balance),
+ TALER_JSON_pack_amount ("history_fee_balance",
+ &dc->history_fee_balance),
+ TALER_JSON_pack_time_abs_human ("expiration_date",
+ dc->expiration_date),
+ TALER_JSON_pack_full_payto ("origin_account",
+ dc->origin_account)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_reserves (
+ 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;
+
+ (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);
+ }
+ 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);
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_reserves (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ &process_reserves,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /reserves");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "reserves");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("reserves",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-reserves.h b/src/auditor/taler-auditor-httpd_get-monitoring-reserves.h
@@ -0,0 +1,56 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_RESERVES_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_RESERVES_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_reserves_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_reserves_done (void);
+
+/**
+ * Handle a "/reserves" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_reserves (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-row-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-row-inconsistency.c
@@ -0,0 +1,135 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-row-inconsistency.h"
+
+
+/**
+ * Add deposit confirmation 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
+add_row_inconsistency (
+ void *cls,
+ uint64_t serial_id,
+ const struct TALER_AUDITORDB_RowInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+
+ GNUNET_JSON_pack_int64 ("row_id", serial_id),
+
+ GNUNET_JSON_pack_string ("row_table",
+ dc->row_table),
+ GNUNET_JSON_pack_string ("diagnostic",
+ dc->diagnostic),
+ GNUNET_JSON_pack_bool ("suppressed", dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_row_inconsistency (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ 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;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_row_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &add_row_inconsistency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /row-inconsistency in database\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "row-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("row_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-row-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-row-inconsistency.h
@@ -0,0 +1,57 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_ROW_INCONSISTENCY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_ROW_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+ * Initialize subsystem.
+ */
+void
+TEAH_get_monitoring_row_inconsistency_init (void);
+
+/**
+ * Shut down subsystem.
+ */
+void
+TEAH_get_monitoring_row_inconsistency_done (void);
+
+/**
+ * Handle a "/deposit-confirmation" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_row_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.c b/src/auditor/taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.c
@@ -0,0 +1,140 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.h"
+
+
+/**
+ * Add row-minor-inconsistencies to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+*/
+static enum GNUNET_GenericReturnValue
+process_row_minor_inconsistencies (
+ void *cls,
+ const struct TALER_AUDITORDB_RowMinorInconsistencies *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_int64 ("row_id",
+ dc->row_id),
+ GNUNET_JSON_pack_string ("row_table",
+ dc->row_table),
+ GNUNET_JSON_pack_int64 ("problem_row",
+ dc->problem_row),
+ GNUNET_JSON_pack_string ("diagnostic",
+ dc->diagnostic),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_row_minor_inconsistencies (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ const char *ret_s
+ = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+
+ if ( (NULL != ret_s) &&
+ (0 == strcmp (ret_s,
+ "true")) )
+ {
+ return_suppressed = true;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_row_minor_inconsistencies (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_row_minor_inconsistencies,
+ ja);
+
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /row-minor-inconsistencies");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "row-minor-inconsistencies");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("row_minor_inconsistencies",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.h b/src/auditor/taler-auditor-httpd_get-monitoring-row-minor-inconsistencies.h
@@ -0,0 +1,56 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_ROW_MINOR_INCONSISTENCIES_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_ROW_MINOR_INCONSISTENCIES_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_row_minor_inconsistencies_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_row_minor_inconsistencies_done (void);
+
+/**
+ * Handle a "/row-minor-inconsistencies" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_row_minor_inconsistencies (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-wire-format-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-wire-format-inconsistency.c
@@ -0,0 +1,138 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-wire-format-inconsistency.h"
+
+
+/**
+ * Add wire-format-inconsistency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_wire_format_inconsistency (
+ void *cls,
+ const struct TALER_AUDITORDB_WireFormatInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_uint64 ("row_id",
+ dc->row_id),
+ TALER_JSON_pack_amount ("amount",
+ &dc->amount),
+ GNUNET_JSON_pack_uint64 ("wire_offset",
+ dc->wire_offset),
+ GNUNET_JSON_pack_string ("diagnostic",
+ dc->diagnostic),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+
+
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_wire_format_inconsistency (
+ 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;
+ (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);
+ }
+ 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);
+ {
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if ( (NULL != ret_s) &&
+ (0 == strcmp (ret_s, "true")) )
+ {
+ return_suppressed = true;
+ }
+ }
+
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_wire_format_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ return_suppressed,
+ &process_wire_format_inconsistency,
+ ja);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /wire-format-inconsistency");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "wire-format-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("wire_format_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-wire-format-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-wire-format-inconsistency.h
@@ -0,0 +1,58 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_WIRE_FORMAT_INCONSISTENCY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_WIRE_FORMAT_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_wire_format_inconsistency_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_wire_format_inconsistency_done (void);
+
+/**
+ * Handle a "/wire-format-inconsistency" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_wire_format_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-wire-out-inconsistency.c b/src/auditor/taler-auditor-httpd_get-monitoring-wire-out-inconsistency.c
@@ -0,0 +1,135 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_get-monitoring-wire-out-inconsistency.h"
+
+
+/**
+ * Add wire-out-inconsistency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
+static enum GNUNET_GenericReturnValue
+process_wire_out_inconsistency (
+ void *cls,
+ const struct TALER_AUDITORDB_WireOutInconsistency *dc)
+{
+ json_t *list = cls;
+ json_t *obj;
+
+ obj = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_int64 ("row_id",
+ dc->row_id),
+ TALER_JSON_pack_full_payto ("destination_account",
+ dc->destination_account),
+ GNUNET_JSON_pack_int64 ("wire_out_row_id",
+ dc->wire_out_row_id),
+ GNUNET_JSON_pack_string ("diagnostic",
+ dc->diagnostic),
+ TALER_JSON_pack_amount ("expected",
+ &dc->expected),
+ TALER_JSON_pack_amount ("claimed",
+ &dc->claimed),
+ GNUNET_JSON_pack_bool ("suppressed",
+ dc->suppressed)
+ );
+ GNUNET_break (0 ==
+ json_array_append_new (list,
+ obj));
+ return GNUNET_OK;
+}
+
+
+MHD_RESULT
+TAH_get_monitoring_wire_out_inconsistency (
+ 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;
+ enum TALER_EXCHANGE_YesNoAll return_suppressed;
+
+ (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);
+ }
+ 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);
+
+ TALER_MHD_parse_request_yna (connection,
+ "return_suppressed",
+ false,
+ &return_suppressed);
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
+ qs = TAH_plugin->get_wire_out_inconsistency (
+ TAH_plugin->cls,
+ limit,
+ offset,
+ (TALER_EXCHANGE_YNA_NO != return_suppressed),
+ &process_wire_out_inconsistency,
+ ja);
+
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ json_decref (ja);
+ TALER_LOG_WARNING (
+ "Failed to handle GET /wire-out-inconsistency");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "wire-out-inconsistency");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("wire_out_inconsistency",
+ ja));
+}
diff --git a/src/auditor/taler-auditor-httpd_get-monitoring-wire-out-inconsistency.h b/src/auditor/taler-auditor-httpd_get-monitoring-wire-out-inconsistency.h
@@ -0,0 +1,58 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_GET_MONITORING_WIRE_OUT_INCONSISTENCY_H
+#define TALER_AUDITOR_HTTPD_GET_MONITORING_WIRE_OUT_INCONSISTENCY_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+* Initialize subsystem.
+*/
+void
+TEAH_get_monitoring_wire_out_inconsistency_init (void);
+
+/**
+* Shut down subsystem.
+*/
+void
+TEAH_get_monitoring_wire_out_inconsistency_done (void);
+
+/**
+ * Handle a "/wire-out-inconsistency" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_get_monitoring_wire_out_inconsistency (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-get.c b/src/auditor/taler-auditor-httpd_historic-denomination-revenue-get.c
@@ -1,138 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_historic-denomination-revenue-get.h"
-
-
-/**
- * Add historic-denomination-revenue 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 denom_pub_hash public key hash of the denomination
- * @param revenue_timestamp when was the revenue effective
- * @param revenue_balance how much in profit did we make from this denomination
- * @param loss_balance how much loss did we make from this denomination
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_historic_denomination_revenue (
- void *cls,
- uint64_t serial_id,
- const struct TALER_DenominationHashP *denom_pub_hash,
- struct GNUNET_TIME_Timestamp revenue_timestamp,
- const struct TALER_Amount *revenue_balance,
- const struct TALER_Amount *loss_balance)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("serial_id",
- serial_id),
- GNUNET_JSON_pack_data_auto ("denom_pub_hash",
- denom_pub_hash),
- TALER_JSON_pack_time_abs_human ("revenue_timestamp",
- revenue_timestamp.abs_time),
- TALER_JSON_pack_amount ("revenue_balance",
- revenue_balance),
- TALER_JSON_pack_amount ("loss_balance",
- loss_balance)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
-
-
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_HISTORIC_DENOMINATION_REVENUE_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;
- int64_t limit = -20;
- uint64_t offset;
- 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);
- }
- 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);
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->select_historic_denom_revenue (
- TAH_plugin->cls,
- limit,
- offset,
- &process_historic_denomination_revenue,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /historic-denomination-revenue");
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "select_historic_denom_revenue");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal (
- "historic-denomination-revenue",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-get.h b/src/auditor/taler-auditor-httpd_historic-denomination-revenue-get.h
@@ -1,56 +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_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_HISTORIC_DENOMINATION_REVENUE_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_HISTORIC_DENOMINATION_REVENUE_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_HISTORIC_DENOMINATION_REVENUE_GET_done (void);
-
-/**
- * Handle a "/historic-denomination-revenue" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_HISTORIC_DENOMINATION_REVENUE_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
diff --git a/src/auditor/taler-auditor-httpd_historic-reserve-summary-get.c b/src/auditor/taler-auditor-httpd_historic-reserve-summary-get.c
@@ -1,133 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_historic-reserve-summary-get.h"
-
-/**
- * Add historic-reserve-summary 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 start_time beginning of aggregated time interval
- * @param end_time end of aggregated time interval
- * @param reserve_profits total profits made
- *
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
-*/
-static enum GNUNET_GenericReturnValue
-process_historic_reserve_summary (
- void *cls,
- uint64_t serial_id,
- struct GNUNET_TIME_Timestamp start_time,
- struct GNUNET_TIME_Timestamp end_time,
- const struct TALER_Amount *reserve_profits)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_int64 ("row_id",
- serial_id),
- TALER_JSON_pack_time_abs_human ("start_date",
- start_time.abs_time),
- TALER_JSON_pack_time_abs_human ("end_date",
- end_time.abs_time),
- TALER_JSON_pack_amount ("reserve_profits",
- reserve_profits)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_HISTORIC_RESERVE_SUMMARY_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;
-
- (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);
- }
- 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);
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->select_historic_reserve_revenue (
- TAH_plugin->cls,
- limit,
- offset,
- &process_historic_reserve_summary,
- ja);
-
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /historic-reserve-summary");
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "select_historic_reserve_revenue");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal (
- "historic-reserve-summary",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_historic-reserve-summary-get.h b/src/auditor/taler-auditor-httpd_historic-reserve-summary-get.h
@@ -1,56 +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_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_HISTORIC_RESERVE_SUMMARY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_HISTORIC_RESERVE_SUMMARY_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_HISTORIC_RESERVE_SUMMARY_GET_done (void);
-
-/**
- * Handle a "/historic-reserve-summary" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_HISTORIC_RESERVE_SUMMARY_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
diff --git a/src/auditor/taler-auditor-httpd_misattribution-in-inconsistency-get.c b/src/auditor/taler-auditor-httpd_misattribution-in-inconsistency-get.c
@@ -1,136 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_misattribution-in-inconsistency-get.h"
-
-
-/**
- * Add misattribution-in-inconsistency to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_misattribution_in_inconsistency (
- void *cls,
- const struct TALER_AUDITORDB_MisattributionInInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- TALER_JSON_pack_amount ("amount",
- &dc->amount),
- GNUNET_JSON_pack_uint64 ("bank_row",
- dc->bank_row),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &dc->reserve_pub),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_MISATTRIBUTION_IN_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;
- (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);
- }
- 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);
- {
- 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;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_misattribution_in_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_misattribution_in_inconsistency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /misattribution-in-inconsistency");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "misattribution-in-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("misattribution_in_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_misattribution-in-inconsistency-get.h b/src/auditor/taler-auditor-httpd_misattribution-in-inconsistency-get.h
@@ -1,56 +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_MISATTRIBUTION_IN_INCONSISTENCY_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_MISATTRIBUTION_IN_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_MISATTRIBUTION_IN_INCONSISTENCY_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_MISATTRIBUTION_IN_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/misattribution-in-inconsistency" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_MISATTRIBUTION_IN_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_patch-generic-suppressed.c b/src/auditor/taler-auditor-httpd_patch-generic-suppressed.c
@@ -0,0 +1,136 @@
+/*
+ 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/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_patch-generic-suppressed.h"
+
+
+MHD_RESULT
+TAH_patch_generic_suppressed (
+ 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;
+ unsigned long long row_id;
+ char dummy;
+ bool suppressed;
+
+ (void) connection_cls;
+ 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);
+ }
+
+ if ( (NULL == args[1]) ||
+ (1 != sscanf (args[1],
+ "%llu%c",
+ &row_id,
+ &dummy)) )
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
+ "no row id specified");
+ }
+
+ {
+ enum GNUNET_GenericReturnValue res;
+ json_t *json;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_bool ("suppressed", &suppressed),
+ GNUNET_JSON_spec_end ()
+ };
+
+ 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)
+ {
+ GNUNET_break (0);
+ json_decref (json);
+ return MHD_NO; /* hard failure */
+ }
+ if (GNUNET_NO == res)
+ {
+ GNUNET_break_op (0);
+ json_decref (json);
+ return MHD_YES; /* failure */
+ }
+ json_decref (json);
+ }
+
+ /* execute transaction */
+ qs = TAH_plugin->update_generic_suppressed (TAH_plugin->cls,
+ rh->table,
+ row_id,
+ suppressed);
+
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "update_account");
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
+ "unexpected serialization problem");
+ 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");
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return TALER_MHD_reply_static (connection,
+ MHD_HTTP_NO_CONTENT,
+ NULL,
+ NULL,
+ 0);
+ }
+ GNUNET_break (0);
+ return MHD_NO;
+}
diff --git a/src/auditor/taler-auditor-httpd_patch-generic-suppressed.h b/src/auditor/taler-auditor-httpd_patch-generic-suppressed.h
@@ -0,0 +1,34 @@
+/*
+ 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 TALER_AUDITOR_HTTPD_PATCH_GENERIC_SUPPRESSED_H
+#define TALER_AUDITOR_HTTPD_PATCH_GENERIC_SUPPRESSED_H
+
+
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+MHD_RESULT
+TAH_patch_generic_suppressed (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_patch_generic_suppressed.c b/src/auditor/taler-auditor-httpd_patch_generic_suppressed.c
@@ -1,136 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_patch_generic_suppressed.h"
-
-
-MHD_RESULT
-TAH_patch_handler_generic_suppressed (
- 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;
- unsigned long long row_id;
- char dummy;
- bool suppressed;
-
- (void) connection_cls;
- 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);
- }
-
- if ( (NULL == args[1]) ||
- (1 != sscanf (args[1],
- "%llu%c",
- &row_id,
- &dummy)) )
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
- "no row id specified");
- }
-
- {
- enum GNUNET_GenericReturnValue res;
- json_t *json;
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_bool ("suppressed", &suppressed),
- GNUNET_JSON_spec_end ()
- };
-
- 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)
- {
- GNUNET_break (0);
- json_decref (json);
- return MHD_NO; /* hard failure */
- }
- if (GNUNET_NO == res)
- {
- GNUNET_break_op (0);
- json_decref (json);
- return MHD_YES; /* failure */
- }
- json_decref (json);
- }
-
- /* execute transaction */
- qs = TAH_plugin->update_generic_suppressed (TAH_plugin->cls,
- rh->table,
- row_id,
- suppressed);
-
- switch (qs)
- {
- case GNUNET_DB_STATUS_HARD_ERROR:
- GNUNET_break (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_STORE_FAILED,
- "update_account");
- case GNUNET_DB_STATUS_SOFT_ERROR:
- GNUNET_break (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
- "unexpected serialization problem");
- 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");
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- return TALER_MHD_reply_static (connection,
- MHD_HTTP_NO_CONTENT,
- NULL,
- NULL,
- 0);
- }
- GNUNET_break (0);
- return MHD_NO;
-}
diff --git a/src/auditor/taler-auditor-httpd_patch_generic_suppressed.h b/src/auditor/taler-auditor-httpd_patch_generic_suppressed.h
@@ -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_PATCH_GENERIC_SUPPRESSED_H
-#define SRC_TALER_AUDITOR_HTTPD_PATCH_GENERIC_SUPPRESSED_H
-
-
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-MHD_RESULT
-TAH_patch_handler_generic_suppressed (
- 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
diff --git a/src/auditor/taler-auditor-httpd_pending-deposits-get.c b/src/auditor/taler-auditor-httpd_pending-deposits-get.c
@@ -1,143 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2025 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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_pending-deposits-get.h"
-
-
-/**
- * Add pending deposit to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param row_id row ID of the alert in the auditor database
- * @param batch_deposit_serial_id where in the exchange table are we
- * @param total_amount value of all missing deposits, including fees
- * @param wire_target_h_payto hash of the recipient account's payto URI
- * @param deadline what was the earliest requested wire transfer deadline
- * @param suppressed true if this report was suppressed
- */
-static void
-add_pending_deposit (
- void *cls,
- uint64_t row_id,
- uint64_t batch_deposit_serial_id,
- const struct TALER_Amount *total_amount,
- const struct TALER_FullPaytoHashP *wire_target_h_payto,
- struct GNUNET_TIME_Timestamp deadline,
- bool suppressed)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- row_id),
- GNUNET_JSON_pack_uint64 ("batch_deposit_serial_id",
- batch_deposit_serial_id),
- TALER_JSON_pack_amount ("total_amount",
- total_amount),
- GNUNET_JSON_pack_data_auto ("h_wire",
- wire_target_h_payto),
- GNUNET_JSON_pack_timestamp ("deadline",
- deadline),
- GNUNET_JSON_pack_bool ("suppressed",
- suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
-}
-
-
-MHD_RESULT
-TAH_pending_deposits_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;
-
- 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);
- }
- 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);
- {
- const char *ret_s = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
- if ( (NULL != ret_s) &&
- (0 == strcmp (ret_s,
- "true")) )
- {
- return_suppressed = true;
- }
- }
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->select_pending_deposits (
- TAH_plugin->cls,
- GNUNET_TIME_absolute_get (),
- limit,
- offset,
- return_suppressed,
- &add_pending_deposit,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /pending-deposits in database\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "select_pending_deposits");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("pending_deposits",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_pending-deposits-get.h b/src/auditor/taler-auditor-httpd_pending-deposits-get.h
@@ -1,44 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2025 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 TALER_AUDITOR_HTTPD_PENDING_DEPOSITS_GET_H
-#define TALER_AUDITOR_HTTPD_PENDING_DEPOSITS_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
- * Handle a GET "/pending-deposits" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_pending_deposits_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 // TALER_AUDITOR_HTTPD_PENDING_DEPOSITS_GET_H
diff --git a/src/auditor/taler-auditor-httpd_progress-get.c b/src/auditor/taler-auditor-httpd_progress-get.c
@@ -1,107 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_progress-get.h"
-
-
-/**
- * Add progress to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct with progress data
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_progress (
- void *cls,
- const struct TALER_AUDITORDB_Progress *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("progress_key",
- dc->progress_key),
- GNUNET_JSON_pack_int64 ("progress_offset",
- dc->progress_offset)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_PROGRESS_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;
- const char *progress_key;
-
- (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);
- }
- progress_key
- = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "progress_key");
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_progress_points (
- TAH_plugin->cls,
- progress_key,
- &process_progress,
- ja);
- if (0 > qs)
- {
- GNUNET_break (0);
- json_decref (ja);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "progress");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("progress",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_progress-get.h b/src/auditor/taler-auditor-httpd_progress-get.h
@@ -1,33 +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 TALER_AUDITOR_HTTPD_PROGRESS_GET_H
-#define TALER_AUDITOR_HTTPD_PROGRESS_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-
-MHD_RESULT
-TAH_PROGRESS_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
diff --git a/src/auditor/taler-auditor-httpd_purse-not-closed-inconsistencies-get.c b/src/auditor/taler-auditor-httpd_purse-not-closed-inconsistencies-get.c
@@ -1,140 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_purse-not-closed-inconsistencies-get.h"
-
-/**
- * Add purse-not-closed-inconsistencies to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_purse_not_closed_inconsistencies (
- void *cls,
- const struct TALER_AUDITORDB_PurseNotClosedInconsistencies *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_data_auto ("purse_pub",
- &dc->purse_pub),
- TALER_JSON_pack_amount ("amount",
- &dc->amount),
- TALER_JSON_pack_time_abs_human ("expiration_date",
- dc->expiration_date),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_PURSE_NOT_CLOSED_INCONSISTENCIES_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;
- (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);
- }
- 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);
-
- {
- const char *ret_s
- = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
-
- if ( (NULL != ret_s) &&
- (0 == strcmp (ret_s,
- "true")) )
- {
- return_suppressed = true;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_purse_not_closed_inconsistencies (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_purse_not_closed_inconsistencies,
- ja);
-
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /purse-not-closed-inconsistencies\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "purse-not-closed-inconsistencies");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("purse_not_closed_inconsistencies",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_purse-not-closed-inconsistencies-get.h b/src/auditor/taler-auditor-httpd_purse-not-closed-inconsistencies-get.h
@@ -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_PURSE_NOT_CLOSED_INCONSISTENCIES_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_PURSE_NOT_CLOSED_INCONSISTENCIES_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_PURSE_NOT_CLOSED_INCONSISTENCIES_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_PURSE_NOT_CLOSED_INCONSISTENCIES_GET_done (void);
-
-/**
- * Handle a "/purse-not-closed-inconsistencies" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_PURSE_NOT_CLOSED_INCONSISTENCIES_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
diff --git a/src/auditor/taler-auditor-httpd_purses-get.c b/src/auditor/taler-auditor-httpd_purses-get.c
@@ -1,127 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_purses-get.h"
-
-/**
- * Add purses 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_purses (
- void *cls,
- uint64_t serial_id,
- const struct TALER_AUDITORDB_Purses *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
-
- GNUNET_JSON_pack_int64 ("auditor_purses_rowid", dc->auditor_purses_rowid),
- GNUNET_JSON_pack_data_auto ("purse_pub", &dc->purse_pub),
- TALER_JSON_pack_amount ("balance", &dc->balance),
- TALER_JSON_pack_amount ("target", &dc->target),
- TALER_JSON_pack_time_abs_human ("expiration_date", dc->expiration_date)
-
-
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
-
-
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_PURSES_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;
-
- (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);
- }
- 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);
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_purses (
- TAH_plugin->cls,
- limit,
- offset,
- &process_purses,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /purses");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "purses");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("purses",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_purses-get.h b/src/auditor/taler-auditor-httpd_purses-get.h
@@ -1,56 +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_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_PURSES_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_PURSES_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_PURSES_GET_done (void);
-
-/**
- * Handle a "/purses" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_PURSES_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
diff --git a/src/auditor/taler-auditor-httpd_put-deposit-confirmation.c b/src/auditor/taler-auditor-httpd_put-deposit-confirmation.c
@@ -0,0 +1,454 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2014-2023 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file taler-auditor-httpd_put-deposit-confirmation.c
+ * @brief Handle /deposit-confirmation requests; parses the POST and JSON and
+ * verifies the coin signature before handing things off
+ * to the database.
+ * @author Christian Grothoff
+ */
+#include "taler/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/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_put-deposit-confirmation.h"
+
+GNUNET_NETWORK_STRUCT_BEGIN
+
+/**
+ * @brief Information about a signing key of the exchange. Signing keys are used
+ * to sign exchange messages other than coins, i.e. to confirm that a
+ * deposit was successful or that a refresh was accepted.
+ */
+struct ExchangeSigningKeyDataP
+{
+
+ /**
+ * When does this signing key begin to be valid?
+ */
+ struct GNUNET_TIME_TimestampNBO start;
+
+ /**
+ * When does this signing key expire? Note: This is currently when
+ * the Exchange will definitively stop using it. Signatures made with
+ * the key remain valid until @e end. When checking validity periods,
+ * clients should allow for some overlap between keys and tolerate
+ * the use of either key during the overlap time (due to the
+ * possibility of clock skew).
+ */
+ struct GNUNET_TIME_TimestampNBO expire;
+
+ /**
+ * When do signatures with this signing key become invalid? After
+ * this point, these signatures cannot be used in (legal) disputes
+ * anymore, as the Exchange is then allowed to destroy its side of the
+ * evidence. @e end is expected to be significantly larger than @e
+ * expire (by a year or more).
+ */
+ struct GNUNET_TIME_TimestampNBO end;
+
+ /**
+ * The public online signing key that the exchange will use
+ * between @e start and @e expire.
+ */
+ struct TALER_ExchangePublicKeyP signkey_pub;
+};
+
+GNUNET_NETWORK_STRUCT_END
+
+
+/**
+ * Cache of already verified exchange signing keys. Maps the hash of the
+ * `struct TALER_ExchangeSigningKeyValidityPS` to the (static) string
+ * "verified" or "revoked". Access to this map is guarded by the #lock.
+ */
+static struct GNUNET_CONTAINER_MultiHashMap *cache;
+
+/**
+ * Lock for operations on #cache.
+ */
+static pthread_mutex_t lock;
+
+
+/**
+ * We have parsed the JSON information about the deposit, do some
+ * basic sanity checks (especially that the signature on the coin is
+ * valid, and that this type of coin exists) and then execute the
+ * deposit.
+ *
+ * @param connection the MHD connection to handle
+ * @param dc information about the deposit confirmation
+ * @param es information about the exchange's signing key
+ * @return MHD result code
+ */
+static MHD_RESULT
+verify_and_execute_deposit_confirmation (
+ struct MHD_Connection *connection,
+ const struct TALER_AUDITORDB_DepositConfirmation *dc,
+ const struct TALER_AUDITORDB_ExchangeSigningKey *es)
+{
+ enum GNUNET_DB_QueryStatus qs;
+ struct GNUNET_HashCode h;
+ const char *cached;
+ struct ExchangeSigningKeyDataP skv = {
+ .start = GNUNET_TIME_timestamp_hton (es->ep_start),
+ .expire = GNUNET_TIME_timestamp_hton (es->ep_expire),
+ .end = GNUNET_TIME_timestamp_hton (es->ep_end),
+ .signkey_pub = es->exchange_pub
+ };
+ const struct TALER_CoinSpendSignatureP *coin_sigps[
+ GNUNET_NZL (dc->num_coins)];
+
+ for (unsigned int i = 0; i < dc->num_coins; i++)
+ coin_sigps[i] = &dc->coin_sigs[i];
+
+ if (GNUNET_TIME_absolute_is_future (es->ep_start.abs_time) ||
+ GNUNET_TIME_absolute_is_past (es->ep_expire.abs_time))
+ {
+ /* Signing key expired */
+ TALER_LOG_WARNING ("Expired exchange signing key\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_FORBIDDEN,
+ TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID,
+ "master signature expired");
+ }
+
+ /* check our cache */
+ GNUNET_CRYPTO_hash (&skv,
+ sizeof(skv),
+ &h);
+ GNUNET_assert (0 == pthread_mutex_lock (&lock));
+ cached = GNUNET_CONTAINER_multihashmap_get (cache,
+ &h);
+ GNUNET_assert (0 == pthread_mutex_unlock (&lock));
+ 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);
+ }
+ if (NULL == cached)
+ {
+ /* Not in cache, need to verify the signature, persist it, and possibly cache it */
+ if (GNUNET_OK !=
+ TALER_exchange_offline_signkey_validity_verify (
+ &es->exchange_pub,
+ es->ep_start,
+ es->ep_expire,
+ es->ep_end,
+ &TAH_master_public_key,
+ &es->master_sig))
+ {
+ TALER_LOG_WARNING ("Invalid signature on exchange signing key\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_FORBIDDEN,
+ TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID,
+ "master signature invalid");
+ }
+
+ /* execute transaction */
+ qs = TAH_plugin->insert_exchange_signkey (TAH_plugin->cls,
+ es);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ TALER_LOG_WARNING ("Failed to store exchange signing key in database\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "exchange signing key");
+ }
+ cached = "verified";
+ }
+
+ if (0 == strcmp (cached,
+ "verified"))
+ {
+ struct TALER_MasterSignatureP master_sig;
+
+ /* check for revocation */
+ qs = TAH_eplugin->lookup_signkey_revocation (TAH_eplugin->cls,
+ &es->exchange_pub,
+ &master_sig);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ TALER_LOG_WARNING (
+ "Failed to check for signing key revocation in database\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "exchange signing key revocation");
+ }
+ if (0 < qs)
+ cached = "revoked";
+ }
+
+ /* Cache it, due to concurreny it might already be in the cache,
+ so we do not cache it twice but also don't insist on the 'put' to
+ succeed. */
+ GNUNET_assert (0 == pthread_mutex_lock (&lock));
+ (void) GNUNET_CONTAINER_multihashmap_put (cache,
+ &h,
+ (void *) cached,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ GNUNET_assert (0 == pthread_mutex_unlock (&lock));
+
+ if (0 == strcmp (cached,
+ "revoked"))
+ {
+ TALER_LOG_WARNING (
+ "Invalid signature on /deposit-confirmation request: key was revoked\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_GONE,
+ TALER_EC_AUDITOR_EXCHANGE_SIGNING_KEY_REVOKED,
+ "exchange signing key was revoked");
+ }
+
+ /* check deposit confirmation signature */
+ if (GNUNET_OK !=
+ TALER_exchange_online_deposit_confirmation_verify (
+ &dc->h_contract_terms,
+ &dc->h_wire,
+ &dc->h_policy,
+ dc->exchange_timestamp,
+ dc->wire_deadline,
+ dc->refund_deadline,
+ &dc->total_without_fee,
+ dc->num_coins,
+ coin_sigps,
+ &dc->merchant,
+ &dc->exchange_pub,
+ &dc->exchange_sig))
+ {
+ TALER_LOG_WARNING (
+ "Invalid signature on /deposit-confirmation request\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_FORBIDDEN,
+ TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID,
+ "exchange signature invalid");
+ }
+
+ /* execute transaction */
+ qs = TAH_plugin->insert_deposit_confirmation (TAH_plugin->cls,
+ dc);
+ if (0 > qs)
+ {
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ TALER_LOG_WARNING ("Failed to store /deposit-confirmation in database\n");
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "deposit confirmation");
+ }
+ return TALER_MHD_REPLY_JSON_PACK (connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_string ("status",
+ "DEPOSIT_CONFIRMATION_OK"));
+}
+
+
+MHD_RESULT
+TAH_put_deposit_confirmation (
+ 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_DepositConfirmation dc = {
+ .refund_deadline = GNUNET_TIME_UNIT_ZERO_TS
+ };
+ struct TALER_AUDITORDB_ExchangeSigningKey es;
+ const json_t *jcoin_sigs;
+ const json_t *jcoin_pubs;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
+ &dc.h_contract_terms),
+ GNUNET_JSON_spec_fixed_auto ("h_policy",
+ &dc.h_policy),
+ GNUNET_JSON_spec_fixed_auto ("h_wire",
+ &dc.h_wire),
+ GNUNET_JSON_spec_timestamp ("exchange_timestamp",
+ &dc.exchange_timestamp),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_timestamp ("refund_deadline",
+ &dc.refund_deadline),
+ NULL),
+ GNUNET_JSON_spec_timestamp ("wire_deadline",
+ &dc.wire_deadline),
+ TALER_JSON_spec_amount ("total_without_fee",
+ TAH_currency,
+ &dc.total_without_fee),
+ GNUNET_JSON_spec_array_const ("coin_pubs",
+ &jcoin_pubs),
+ GNUNET_JSON_spec_array_const ("coin_sigs",
+ &jcoin_sigs),
+ GNUNET_JSON_spec_fixed_auto ("merchant_pub",
+ &dc.merchant),
+ GNUNET_JSON_spec_fixed_auto ("exchange_sig",
+ &dc.exchange_sig),
+ GNUNET_JSON_spec_fixed_auto ("exchange_pub",
+ &dc.exchange_pub),
+ GNUNET_JSON_spec_timestamp ("ep_start",
+ &es.ep_start),
+ GNUNET_JSON_spec_timestamp ("ep_expire",
+ &es.ep_expire),
+ GNUNET_JSON_spec_timestamp ("ep_end",
+ &es.ep_end),
+ GNUNET_JSON_spec_fixed_auto ("master_sig",
+ &es.master_sig),
+ GNUNET_JSON_spec_end ()
+ };
+ unsigned int num_coins;
+ 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.master_sig = es.master_sig;
+ }
+ num_coins = json_array_size (jcoin_sigs);
+ if (num_coins != json_array_size (jcoin_pubs))
+ {
+ GNUNET_break_op (0);
+ json_decref (json);
+ return TALER_MHD_reply_with_ec (
+ connection,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "coin_pubs.length != coin_sigs.length");
+ }
+ if (0 == num_coins)
+ {
+ GNUNET_break_op (0);
+ json_decref (json);
+ return TALER_MHD_reply_with_ec (
+ connection,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "coin_pubs array is empty");
+ }
+ {
+ struct TALER_CoinSpendPublicKeyP coin_pubs[num_coins];
+ struct TALER_CoinSpendSignatureP coin_sigs[num_coins];
+ MHD_RESULT res;
+
+ for (unsigned int i = 0; i < num_coins; i++)
+ {
+ json_t *jpub = json_array_get (jcoin_pubs,
+ i);
+ json_t *jsig = json_array_get (jcoin_sigs,
+ i);
+ const char *ps = json_string_value (jpub);
+ const char *ss = json_string_value (jsig);
+
+ if ((NULL == ps) ||
+ (GNUNET_OK !=
+ GNUNET_STRINGS_string_to_data (ps,
+ strlen (ps),
+ &coin_pubs[i],
+ sizeof(coin_pubs[i]))))
+ {
+ GNUNET_break_op (0);
+ json_decref (json);
+ return TALER_MHD_reply_with_ec (
+ connection,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "coin_pub[] malformed");
+ }
+ if ((NULL == ss) ||
+ (GNUNET_OK !=
+ GNUNET_STRINGS_string_to_data (ss,
+ strlen (ss),
+ &coin_sigs[i],
+ sizeof(coin_sigs[i]))))
+ {
+ GNUNET_break_op (0);
+ json_decref (json);
+ return TALER_MHD_reply_with_ec (
+ connection,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "coin_sig[] malformed");
+ }
+ }
+ dc.num_coins = num_coins;
+ dc.coin_pubs = coin_pubs;
+ dc.coin_sigs = coin_sigs;
+ es.exchange_pub = dc.exchange_pub; /* used twice! */
+ res = verify_and_execute_deposit_confirmation (connection,
+ &dc,
+ &es);
+ GNUNET_JSON_parse_free (spec);
+ json_decref (json);
+ return res;
+ }
+}
+
+
+void
+TEAH_put_deposit_confirmation_init (void)
+{
+ cache = GNUNET_CONTAINER_multihashmap_create (32,
+ GNUNET_NO);
+ GNUNET_assert (0 == pthread_mutex_init (&lock, NULL));
+}
+
+
+void
+TEAH_put_deposit_confirmation_done (void)
+{
+ if (NULL != cache)
+ {
+ GNUNET_CONTAINER_multihashmap_destroy (cache);
+ cache = NULL;
+ GNUNET_assert (0 == pthread_mutex_destroy (&lock));
+ }
+}
diff --git a/src/auditor/taler-auditor-httpd_put-deposit-confirmation.h b/src/auditor/taler-auditor-httpd_put-deposit-confirmation.h
@@ -0,0 +1,63 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2018 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file taler-auditor-httpd_put-deposit-confirmation.h
+ * @brief Handle /deposit-confirmation requests
+ * @author Christian Grothoff
+ */
+#ifndef TALER_AUDITOR_HTTPD_PUT_DEPOSIT_CONFIRMATION_H
+#define TALER_AUDITOR_HTTPD_PUT_DEPOSIT_CONFIRMATION_H
+
+
+#include <microhttpd.h>
+#include "taler-auditor-httpd.h"
+
+/**
+ * Initialize subsystem.
+ */
+void
+TEAH_put_deposit_confirmation_init (void);
+
+/**
+ * Shut down subsystem.
+ */
+void
+TEAH_put_deposit_confirmation_done (void);
+
+
+/**
+ * Handle a "/deposit-confirmation" 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
+ * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
+ * @return MHD result code
+ */
+MHD_RESULT
+TAH_put_deposit_confirmation (
+ 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
diff --git a/src/auditor/taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.c b/src/auditor/taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.c
@@ -1,136 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.h"
-
-
-/**
- * Add reserve-balance-insufficient-inconsistency to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_reserve_balance_insufficient_inconsistency (
- void *cls,
- const struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &dc->reserve_pub),
- GNUNET_JSON_pack_bool ("inconsistency_gain",
- dc->inconsistency_gain),
- TALER_JSON_pack_amount ("inconsistency_amount",
- &dc->inconsistency_amount),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_RESERVE_BALANCE_INSUFFICIENT_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;
- (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);
- }
- 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);
-
- {
- 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;
- }
- }
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_reserve_balance_insufficient_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_reserve_balance_insufficient_inconsistency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /reserve-balance-insufficient-inconsistency\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "reserve-balance-insufficient-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("reserve_balance_insufficient_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.h b/src/auditor/taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.h
@@ -1,56 +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 TALER_AUDITOR_HTTPD_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_GET_H
-#define TALER_AUDITOR_HTTPD_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/reserve-balance-insufficient-inconsistency" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_RESERVE_BALANCE_INSUFFICIENT_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c b/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c
@@ -1,132 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.h"
-
-
-/**
- * Add reserve-balance-summary-wrong-inconsistency to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_reserve_balance_summary_wrong_inconsistency (
- void *cls,
- const struct TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_int64 ("row_id", dc->row_id),
- GNUNET_JSON_pack_data_auto ("reserve_pub", &dc->reserve_pub),
- TALER_JSON_pack_amount ("exchange_amount", &dc->exchange_amount),
- TALER_JSON_pack_amount ("auditor_amount", &dc->auditor_amount),
- GNUNET_JSON_pack_bool ("suppressed", dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_RESERVE_BALANCE_SUMMARY_WRONG_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;
- (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);
- }
- 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);
- {
- 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;
- }
- }
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_reserve_balance_summary_wrong_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_reserve_balance_summary_wrong_inconsistency,
- ja);
-
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /reserve-balance-summary-wrong-inconsistency");
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "reserve-balance-summary-wrong-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("reserve_balance_summary_wrong_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.h b/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.h
@@ -1,56 +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 TALER_AUDITOR_HTTPD_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_GET_H
-#define TALER_AUDITOR_HTTPD_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
- * Initialize subsystem.
- */
-void
-TEAH_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/reserve-balance-summary-wrong-inconsistency" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_RESERVE_BALANCE_SUMMARY_WRONG_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-get.c b/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-get.c
@@ -1,145 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_reserve-in-inconsistency-get.h"
-
-
-/**
- * Add reserve-in-inconsistency to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_reserve_in_inconsistency (
- void *cls,
- const struct TALER_AUDITORDB_ReserveInInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->serial_id),
- GNUNET_JSON_pack_uint64 ("bank_row_id",
- dc->bank_row_id),
- TALER_JSON_pack_amount ("amount_exchange_expected",
- &dc->amount_exchange_expected),
- TALER_JSON_pack_amount ("amount_wired",
- &dc->amount_wired),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &dc->reserve_pub),
- TALER_JSON_pack_time_abs_human ("timestamp",
- dc->timestamp),
- TALER_JSON_pack_full_payto ("account",
- dc->account),
- GNUNET_JSON_pack_string ("diagnostic",
- dc->diagnostic),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
-
-
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_RESERVE_IN_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;
- (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);
- }
- 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);
- {
- const char *ret_s
- = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
- if ( (NULL != ret_s) &&
- (0 == strcmp (ret_s,
- "true")) )
- {
- return_suppressed = true;
- }
- }
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_reserve_in_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_reserve_in_inconsistency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (0);
- json_decref (ja);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "reserve-in-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("reserve_in_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-get.h b/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-get.h
@@ -1,56 +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_RESERVE_IN_INCONSISTENCY_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_RESERVE_IN_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_RESERVE_IN_INCONSISTENCY_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_RESERVE_IN_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/reserve-in-inconsistency" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_RESERVE_IN_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.c b/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.c
@@ -1,140 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_reserve-not-closed-inconsistency-get.h"
-
-
-/**
- * Add reserve-not-closed-inconsistency to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_reserve_not_closed_inconsistency (
- void *cls,
- const struct TALER_AUDITORDB_ReserveNotClosedInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &dc->reserve_pub),
- TALER_JSON_pack_amount ("balance",
- &dc->balance),
- TALER_JSON_pack_time_abs_human ("expiration_time",
- dc->expiration_time),
- GNUNET_JSON_pack_string ("diagnostic",
- dc->diagnostic),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_RESERVE_NOT_CLOSED_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;
- (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);
- }
- 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);
- {
- const char *ret_s
- = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
- if ( (NULL != ret_s) &&
- (0 == strcmp (ret_s,
- "true")) )
- {
- return_suppressed = true;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_reserve_not_closed_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_reserve_not_closed_inconsistency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /reserve-not-closed-inconsistency");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "reserve-not-closed-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("reserve_not_closed_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.h b/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.h
@@ -1,56 +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_RESERVE_NOT_CLOSED_INCONSISTENCY_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_RESERVE_NOT_CLOSED_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_RESERVE_NOT_CLOSED_INCONSISTENCY_GET_init (void);
-
-/**
- * Shut down subsystem.
- */
-void
-TEAH_BAD_RESERVE_NOT_CLOSED_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/reserve-not-closed-inconsistency" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_RESERVE_NOT_CLOSED_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_reserves-get.c b/src/auditor/taler-auditor-httpd_reserves-get.c
@@ -1,138 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_reserves-get.h"
-
-
-/**
- * Add reserves 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_reserves (
- void *cls,
- uint64_t serial_id,
- const struct TALER_AUDITORDB_Reserves *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_int64 ("auditor_reserves_rowid",
- dc->auditor_reserves_rowid),
- GNUNET_JSON_pack_data_auto ("reserve_pub",
- &dc->reserve_pub),
- TALER_JSON_pack_amount ("reserve_balance",
- &dc->reserve_balance),
- TALER_JSON_pack_amount ("reserve_loss",
- &dc->reserve_loss),
- TALER_JSON_pack_amount ("withdraw_fee_balance",
- &dc->withdraw_fee_balance),
- TALER_JSON_pack_amount ("close_fee_balance",
- &dc->close_fee_balance),
- TALER_JSON_pack_amount ("purse_fee_balance",
- &dc->purse_fee_balance),
- TALER_JSON_pack_amount ("open_fee_balance",
- &dc->open_fee_balance),
- TALER_JSON_pack_amount ("history_fee_balance",
- &dc->history_fee_balance),
- TALER_JSON_pack_time_abs_human ("expiration_date",
- dc->expiration_date),
- TALER_JSON_pack_full_payto ("origin_account",
- dc->origin_account)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_RESERVES_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;
-
- (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);
- }
- 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);
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_reserves (
- TAH_plugin->cls,
- limit,
- offset,
- &process_reserves,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /reserves");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "reserves");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("reserves",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_reserves-get.h b/src/auditor/taler-auditor-httpd_reserves-get.h
@@ -1,56 +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_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_RESERVES_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_RESERVES_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_RESERVES_GET_done (void);
-
-/**
- * Handle a "/reserves" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_RESERVES_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
diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-get.c b/src/auditor/taler-auditor-httpd_row-inconsistency-get.c
@@ -1,135 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_row-inconsistency-get.h"
-
-
-/**
- * Add deposit confirmation 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
-add_row_inconsistency (
- void *cls,
- uint64_t serial_id,
- const struct TALER_AUDITORDB_RowInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
-
- GNUNET_JSON_pack_int64 ("row_id", serial_id),
-
- GNUNET_JSON_pack_string ("row_table",
- dc->row_table),
- GNUNET_JSON_pack_string ("diagnostic",
- dc->diagnostic),
- GNUNET_JSON_pack_bool ("suppressed", dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_ROW_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;
- (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);
- }
- 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);
- {
- 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;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_row_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &add_row_inconsistency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /row-inconsistency in database\n");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "row-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("row_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-get.h b/src/auditor/taler-auditor-httpd_row-inconsistency-get.h
@@ -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_ROW_INCONSISTENCY_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_ROW_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
- * Initialize subsystem.
- */
-void
-TEAH_ROW_INCONSISTENCY_GET_init (void);
-
-/**
- * Shut down subsystem.
- */
-void
-TEAH_ROW_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/deposit-confirmation" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_ROW_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_row-minor-inconsistencies-get.c b/src/auditor/taler-auditor-httpd_row-minor-inconsistencies-get.c
@@ -1,140 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_row-minor-inconsistencies-get.h"
-
-
-/**
- * Add row-minor-inconsistencies to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
-*/
-static enum GNUNET_GenericReturnValue
-process_row_minor_inconsistencies (
- void *cls,
- const struct TALER_AUDITORDB_RowMinorInconsistencies *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_int64 ("row_id",
- dc->row_id),
- GNUNET_JSON_pack_string ("row_table",
- dc->row_table),
- GNUNET_JSON_pack_int64 ("problem_row",
- dc->problem_row),
- GNUNET_JSON_pack_string ("diagnostic",
- dc->diagnostic),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_ROW_MINOR_INCONSISTENCIES_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;
- (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);
- }
- 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);
- {
- const char *ret_s
- = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
-
- if ( (NULL != ret_s) &&
- (0 == strcmp (ret_s,
- "true")) )
- {
- return_suppressed = true;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_row_minor_inconsistencies (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_row_minor_inconsistencies,
- ja);
-
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /row-minor-inconsistencies");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "row-minor-inconsistencies");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("row_minor_inconsistencies",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_row-minor-inconsistencies-get.h b/src/auditor/taler-auditor-httpd_row-minor-inconsistencies-get.h
@@ -1,56 +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_ROW_MINOR_INCONSISTENCIES_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_ROW_MINOR_INCONSISTENCIES_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_ROW_MINOR_INCONSISTENCIES_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_ROW_MINOR_INCONSISTENCIES_GET_done (void);
-
-/**
- * Handle a "/row-minor-inconsistencies" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_ROW_MINOR_INCONSISTENCIES_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
diff --git a/src/auditor/taler-auditor-httpd_wire-format-inconsistency-get.c b/src/auditor/taler-auditor-httpd_wire-format-inconsistency-get.c
@@ -1,138 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_wire-format-inconsistency-get.h"
-
-
-/**
- * Add wire-format-inconsistency to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_wire_format_inconsistency (
- void *cls,
- const struct TALER_AUDITORDB_WireFormatInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_uint64 ("row_id",
- dc->row_id),
- TALER_JSON_pack_amount ("amount",
- &dc->amount),
- GNUNET_JSON_pack_uint64 ("wire_offset",
- dc->wire_offset),
- GNUNET_JSON_pack_string ("diagnostic",
- dc->diagnostic),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
-
-
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_WIRE_FORMAT_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;
- (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);
- }
- 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);
- {
- const char *ret_s = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
- if ( (NULL != ret_s) &&
- (0 == strcmp (ret_s, "true")) )
- {
- return_suppressed = true;
- }
- }
-
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_wire_format_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- return_suppressed,
- &process_wire_format_inconsistency,
- ja);
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /wire-format-inconsistency");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "wire-format-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("wire_format_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_wire-format-inconsistency-get.h b/src/auditor/taler-auditor-httpd_wire-format-inconsistency-get.h
@@ -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_WIRE_FORMAT_INCONSISTENCY_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_WIRE_FORMAT_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_WIRE_FORMAT_INCONSISTENCY_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_WIRE_FORMAT_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/wire-format-inconsistency" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_WIRE_FORMAT_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[]);
-
-
-#endif
diff --git a/src/auditor/taler-auditor-httpd_wire-out-inconsistency-get.c b/src/auditor/taler-auditor-httpd_wire-out-inconsistency-get.c
@@ -1,135 +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/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/taler_json_lib.h"
-#include "taler/taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_wire-out-inconsistency-get.h"
-
-
-/**
- * Add wire-out-inconsistency to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param dc struct of inconsistencies
- * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
- */
-static enum GNUNET_GenericReturnValue
-process_wire_out_inconsistency (
- void *cls,
- const struct TALER_AUDITORDB_WireOutInconsistency *dc)
-{
- json_t *list = cls;
- json_t *obj;
-
- obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_int64 ("row_id",
- dc->row_id),
- TALER_JSON_pack_full_payto ("destination_account",
- dc->destination_account),
- GNUNET_JSON_pack_int64 ("wire_out_row_id",
- dc->wire_out_row_id),
- GNUNET_JSON_pack_string ("diagnostic",
- dc->diagnostic),
- TALER_JSON_pack_amount ("expected",
- &dc->expected),
- TALER_JSON_pack_amount ("claimed",
- &dc->claimed),
- GNUNET_JSON_pack_bool ("suppressed",
- dc->suppressed)
- );
- GNUNET_break (0 ==
- json_array_append_new (list,
- obj));
- return GNUNET_OK;
-}
-
-
-MHD_RESULT
-TAH_WIRE_OUT_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;
- enum TALER_EXCHANGE_YesNoAll return_suppressed;
-
- (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);
- }
- 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);
-
- TALER_MHD_parse_request_yna (connection,
- "return_suppressed",
- false,
- &return_suppressed);
- ja = json_array ();
- GNUNET_break (NULL != ja);
- qs = TAH_plugin->get_wire_out_inconsistency (
- TAH_plugin->cls,
- limit,
- offset,
- (TALER_EXCHANGE_YNA_NO != return_suppressed),
- &process_wire_out_inconsistency,
- ja);
-
- if (0 > qs)
- {
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- json_decref (ja);
- TALER_LOG_WARNING (
- "Failed to handle GET /wire-out-inconsistency");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "wire-out-inconsistency");
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_array_steal ("wire_out_inconsistency",
- ja));
-}
diff --git a/src/auditor/taler-auditor-httpd_wire-out-inconsistency-get.h b/src/auditor/taler-auditor-httpd_wire-out-inconsistency-get.h
@@ -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_WIRE_OUT_INCONSISTENCY_GET_H
-#define SRC_TALER_AUDITOR_HTTPD_WIRE_OUT_INCONSISTENCY_GET_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-/**
-* Initialize subsystem.
-*/
-void
-TEAH_WIRE_OUT_INCONSISTENCY_GET_init (void);
-
-/**
-* Shut down subsystem.
-*/
-void
-TEAH_BAD_WIRE_OUT_INCONSISTENCY_GET_done (void);
-
-/**
- * Handle a "/wire-out-inconsistency" 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
- * @param args NULL-terminated array of remaining parts of the URI broken up at '/'
- * @return MHD result code
- */
-MHD_RESULT
-TAH_WIRE_OUT_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[]);
-
-
-#endif