summaryrefslogtreecommitdiff
path: root/src/auditor/report-lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/auditor/report-lib.h')
-rw-r--r--src/auditor/report-lib.h114
1 files changed, 78 insertions, 36 deletions
diff --git a/src/auditor/report-lib.h b/src/auditor/report-lib.h
index eeb36f0a3..db29abc3a 100644
--- a/src/auditor/report-lib.h
+++ b/src/auditor/report-lib.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2016-2020 Taler Systems SA
+ Copyright (C) 2016-2024 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero Public License as published by the Free Software
@@ -28,6 +28,52 @@
#include "taler_bank_service.h"
#include "taler_signatures.h"
+/**
+ * Macro to use to access progress point value @a name.
+ */
+#define TALER_ARL_USE_PP(name) TAC_ ## name
+
+/**
+ * Macro to use to declare progress point value @a name.
+ */
+#define TALER_ARL_DEF_PP(name) \
+ uint64_t TALER_ARL_USE_PP (name) = 0
+
+/**
+ * Macro to use to GET progress point value @a name from DB.
+ */
+#define TALER_ARL_GET_PP(name) \
+ TALER_S (name), &TALER_ARL_USE_PP (name)
+
+/**
+ * Macro to use to SET progress point value @a name in DB.
+ */
+#define TALER_ARL_SET_PP(name) \
+ TALER_S (name), TALER_ARL_USE_PP (name)
+
+/**
+ * Macro to use to access amount balance @a name.
+ */
+#define TALER_ARL_USE_AB(name) TAC_ ## name
+
+/**
+ * Macro to use to declare amount balance @a name.
+ */
+#define TALER_ARL_DEF_AB(name) \
+ struct TALER_Amount TALER_ARL_USE_AB (name)
+
+/**
+ * Macro to use to GET amount balance @a name from DB.
+ */
+#define TALER_ARL_GET_AB(name) \
+ TALER_S (name), &TALER_ARL_USE_AB (name)
+
+/**
+ * Macro to use to SET amount balance @a name in DB.
+ */
+#define TALER_ARL_SET_AB(name) \
+ TALER_S (name), &TALER_ARL_USE_AB (name)
+
/**
* Command-line option "-r": restart audit from scratch
@@ -55,49 +101,34 @@ extern struct TALER_Amount TALER_ARL_currency_round_unit;
extern const struct GNUNET_CONFIGURATION_Handle *TALER_ARL_cfg;
/**
- * Our session with the #TALER_ARL_edb.
- */
-extern struct TALER_EXCHANGEDB_Session *TALER_ARL_esession;
-
-/**
* Handle to access the auditor's database.
*/
extern struct TALER_AUDITORDB_Plugin *TALER_ARL_adb;
/**
- * Our session with the #TALER_ARL_adb.
- */
-extern struct TALER_AUDITORDB_Session *TALER_ARL_asession;
-
-/**
* Master public key of the exchange to audit.
*/
extern struct TALER_MasterPublicKeyP TALER_ARL_master_pub;
/**
- * At what time did the auditor process start?
+ * Public key of the auditor.
*/
-extern struct GNUNET_TIME_Absolute start_time;
-
+extern struct TALER_AuditorPublicKeyP TALER_ARL_auditor_pub;
/**
- * Convert absolute time to human-readable JSON string.
- *
- * @param at time to convert
- * @return human-readable string representing the time
+ * REST API endpoint of the auditor.
*/
-json_t *
-TALER_ARL_json_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO at);
+extern char *TALER_ARL_auditor_url;
+/**
+ * REST API endpoint of the exchange.
+ */
+extern char *TALER_ARL_exchange_url;
/**
- * Convert absolute time to human-readable JSON string.
- *
- * @param at time to convert
- * @return human-readable string representing the time
+ * At what time did the auditor process start?
*/
-json_t *
-TALER_ARL_json_from_time_abs (struct GNUNET_TIME_Absolute at);
+extern struct GNUNET_TIME_Absolute start_time;
/**
@@ -121,8 +152,8 @@ TALER_ARL_report (json_t *array,
*/
enum GNUNET_DB_QueryStatus
TALER_ARL_get_denomination_info_by_hash (
- const struct GNUNET_HashCode *dh,
- const struct TALER_DenominationKeyValidityPS **issue);
+ const struct TALER_DenominationHashP *dh,
+ const struct TALER_EXCHANGEDB_DenominationKeyInformation **issue);
/**
@@ -137,8 +168,8 @@ TALER_ARL_get_denomination_info_by_hash (
enum GNUNET_DB_QueryStatus
TALER_ARL_get_denomination_info (
const struct TALER_DenominationPublicKey *denom_pub,
- const struct TALER_DenominationKeyValidityPS **issue,
- struct GNUNET_HashCode *dh);
+ const struct TALER_EXCHANGEDB_DenominationKeyInformation **issue,
+ struct TALER_DenominationHashP *dh);
/**
@@ -247,7 +278,7 @@ enum TALER_ARL_SubtractionResult
/**
* Perform subtraction of amounts. Negative results should be signalled by the
* return value (leaving @a diff set to 'invalid'). If the subtraction fails
- * for other reasons (currency missmatch, normalization failure), logs a
+ * for other reasons (currency mismatch, normalization failure), logs a
* detailed error and calls exit() to terminate the process (!).
*
* Do not call this function directly, use #TALER_ARL_amount_subtract_neg().
@@ -258,7 +289,7 @@ enum TALER_ARL_SubtractionResult
* @param filename where is the addition called
* @param functionname name of the function where the addition is called
* @param line line number of the addition
- * @return #TALER_ARL_SR_NEGATIVE if the result was negative (and @a diff is now invalid),
+ * @return #TALER_ARL_SR_INVALID_NEGATIVE if the result was negative (and @a diff is now invalid),
* #TALER_ARL_SR_ZERO if the result was zero,
* #TALER_ARL_SR_POSITIVE if the result is positive
*/
@@ -274,13 +305,13 @@ TALER_ARL_amount_subtract_neg_ (struct TALER_Amount *diff,
/**
* Perform subtraction of amounts. Negative results should be signalled by
* the return value (leaving @a diff set to 'invalid'). If the subtraction
- * fails for other reasons (currency missmatch, normalization failure), logs a
+ * fails for other reasons (currency mismatch, normalization failure), logs a
* detailed error and calls exit() to terminate the process (!).
*
* @param[out] diff where to store (@a a1 - @a a2)
* @param a1 amount to subtract from
* @param a2 amount to subtract
- * @return #TALER_ARL_SR_NEGATIVE if the result was negative (and @a diff is now invalid),
+ * @return #TALER_ARL_SR_INVALID_NEGATIVE if the result was negative (and @a diff is now invalid),
* #TALER_ARL_SR_ZERO if the result was zero,
* #TALER_ARL_SR_POSITIVE if the result is positive
*/
@@ -296,18 +327,29 @@ TALER_ARL_amount_subtract_neg_ (struct TALER_Amount *diff,
* @param ana_cls closure for @a ana
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_ARL_setup_sessions_and_run (TALER_ARL_Analysis ana,
void *ana_cls);
/**
+ * Test if the audit should be aborted because the user
+ * pressed CTRL-C.
+ *
+ * @return false to continue the audit, true to terminate
+ * cleanly as soon as possible
+ */
+bool
+TALER_ARL_do_abort (void);
+
+
+/**
* Setup global variables based on configuration.
*
* @param c configuration to use
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c);