commit 6727955059f5a4ffe754f4af0e7825ad954a02fa
parent 722697c68af25d20486c90c1559cdc8a86189c5e
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 16 Apr 2023 16:48:05 +0200
-fix FTBFS
Diffstat:
8 files changed, 50 insertions(+), 264 deletions(-)
diff --git a/src/challenger/challenger-httpd.c b/src/challenger/challenger-httpd.c
@@ -21,6 +21,7 @@
#include "platform.h"
#include <microhttpd.h>
#include <gnunet/gnunet_util_lib.h>
+#include <gnunet/gnunet_curl_lib.h>
#include "challenger_util.h"
#include "challenger-httpd.h"
#include "challenger-httpd_mhd.h"
diff --git a/src/challenger/challenger-httpd.h b/src/challenger/challenger-httpd.h
@@ -117,9 +117,9 @@ struct TM_HandlerContext
TM_ContextCleanup cc;
/**
- * Achallengerhronous request context id.
+ * Asynchronous request context id.
*/
- struct GNUNET_AchallengerScopeId achallenger_scope_id;
+ struct GNUNET_AsyncScopeId async_scope_id;
};
diff --git a/src/challenger/challenger-httpd_mhd.c b/src/challenger/challenger-httpd_mhd.c
@@ -1,30 +1,28 @@
/*
- This file is part of TALER
- Copyright (C) 2014, 2015, 2016 GNUnet e.V. and INRIA
+ This file is part of Challenger
+ Copyright (C) 2023 Taler Systems SA
- TALER is free software; you can redistribute it and/or modify it under the
+ Challenger 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
+ Challenger 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/>
+ Challenger; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file sync-httpd_mhd.c
- * @brief helpers for MHD interaction; these are TALER_EXCHANGE_handler_ functions
- * that generate simple MHD replies that do not require any real operations
- * to be performed (error handling, static pages, etc.)
+ * @file challenger-httpd_mhd.c
+ * @brief helpers for MHD interaction
* @author Florian Dold
* @author Benedikt Mueller
* @author Christian Grothoff
*/
#include "platform.h"
#include <jansson.h>
-#include "sync-httpd_mhd.h"
+#include "challenger-httpd_mhd.h"
/**
@@ -81,8 +79,8 @@ CH_MHD_handler_agpl_redirect (struct CH_RequestHandler *rh,
(void) upload_data;
(void) upload_data_size;
return TALER_MHD_reply_agpl (connection,
- "http://www.git.taler.net/sync.git");
+ "https://git.taler.net/challenger.git");
}
-/* end of sync-httpd_mhd.c */
+/* end of challenger-httpd_mhd.c */
diff --git a/src/challenger/challenger-httpd_mhd.h b/src/challenger/challenger-httpd_mhd.h
@@ -15,17 +15,17 @@
*/
/**
- * @file sync-httpd_mhd.h
+ * @file challenger-httpd_mhd.h
* @brief helpers for MHD interaction, used to generate simple responses
* @author Florian Dold
* @author Benedikt Mueller
* @author Christian Grothoff
*/
-#ifndef sync_HTTPD_MHD_H
-#define sync_HTTPD_MHD_H
+#ifndef challenger_HTTPD_MHD_H
+#define challenger_HTTPD_MHD_H
#include <gnunet/gnunet_util_lib.h>
#include <microhttpd.h>
-#include "sync-httpd.h"
+#include "challenger-httpd.h"
/**
diff --git a/src/challengerdb/challenger-dbinit.c b/src/challengerdb/challenger-dbinit.c
@@ -82,17 +82,11 @@ run (void *cls,
if (gc_db)
{
struct GNUNET_TIME_Absolute now;
- struct GNUNET_TIME_Absolute ancient;
now = GNUNET_TIME_absolute_get ();
- ancient = GNUNET_TIME_absolute_subtract (now,
- GNUNET_TIME_relative_multiply (
- GNUNET_TIME_UNIT_YEARS,
- 6));
if (0 >
plugin->gc (plugin->cls,
- now,
- ancient))
+ now))
{
fprintf (stderr,
"Garbage collection failed!\n");
diff --git a/src/challengerdb/plugin_challengerdb_postgres.c b/src/challengerdb/plugin_challengerdb_postgres.c
@@ -336,29 +336,19 @@ commit_transaction (void *cls)
/**
* Function called to perform "garbage collection" on the
- * database, expiring records we no longer require. Deletes
- * all user records that are not paid up (and by cascade deletes
- * the associated recovery documents). Also deletes expired
- * truth and financial records older than @a fin_expire.
+ * database, expiring records we no longer require.
*
* @param cls closure
- * @param expire_backups backups older than the given time stamp should be garbage collected
- * @param expire_pending_payments payments still pending from since before
- * this value should be garbage collected
+ * @param expire older than the given time stamp should be garbage collected
* @return transaction status
*/
static enum GNUNET_DB_QueryStatus
postgres_gc (void *cls,
- struct GNUNET_TIME_Absolute expire_backups,
- struct GNUNET_TIME_Absolute expire_pending_payments)
+ struct GNUNET_TIME_Absolute expire)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_absolute_time (&expire_backups),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_QueryParam params2[] = {
- GNUNET_PQ_query_param_absolute_time (&expire_pending_payments),
+ GNUNET_PQ_query_param_absolute_time (&expire),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
@@ -372,7 +362,7 @@ postgres_gc (void *cls,
return qs;
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"gc_pending_payments",
- params2);
+ params);
}
@@ -435,7 +425,6 @@ libchallenger_plugin_db_postgres_init (void *cls)
internal_setup (pg,
true))
{
- GNUNET_free (pg->currency);
GNUNET_free (pg->sql_dir);
GNUNET_free (pg);
return NULL;
diff --git a/src/include/challenger_database_lib.h b/src/include/challenger_database_lib.h
@@ -1,26 +1,26 @@
/*
- This file is part of TALER
- Copyright (C) 2014-2017 Inria & GNUnet e.V.
+ This file is part of Challenger
+ Copyright (C) 2023 Taler Systems SA
- TALER is free software; you can redistribute it and/or modify it under the
+ Challenger 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
+ Challenger 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/>
+ Challenger; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
*
*/
-#ifndef SYNC_DB_LIB_H
-#define SYNC_DB_LIB_H
+#ifndef CHALLENGER_DB_LIB_H
+#define CHALLENGER_DB_LIB_H
#include <taler/taler_util.h>
-#include "sync_database_plugin.h"
+#include "challenger_database_plugin.h"
/**
* Initialize the plugin.
@@ -28,8 +28,8 @@
* @param cfg configuration to use
* @return NULL on failure
*/
-struct SYNC_DatabasePlugin *
-SYNC_DB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg);
+struct CHALLENGER_DatabasePlugin *
+CHALLENGER_DB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
@@ -38,9 +38,9 @@ SYNC_DB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg);
* @param plugin plugin to unload
*/
void
-SYNC_DB_plugin_unload (struct SYNC_DatabasePlugin *plugin);
+CHALLENGER_DB_plugin_unload (struct CHALLENGER_DatabasePlugin *plugin);
-#endif /* SYNC_DB_LIB_H */
+#endif /* CHALLENGER_DB_LIB_H */
-/* end of sync_database_lib.h */
+/* end of challenger_database_lib.h */
diff --git a/src/include/challenger_database_plugin.h b/src/include/challenger_database_plugin.h
@@ -1,93 +1,33 @@
/*
- This file is part of GNU Taler
- Copyright (C) 2019, 2021 Taler Systems SA
+ This file is part of Challenger
+ Copyright (C) 2023 Taler Systems SA
- Taler is free software; you can redistribute it and/or modify it under the
+ Challenger is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser 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
+ Challenger 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.GPL. If not, see <http://www.gnu.org/licenses/>
+ Challenger; see the file COPYING.GPL. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file include/sync_database_plugin.h
- * @brief database access for Sync
+ * @file include/challenger_database_plugin.h
+ * @brief database access for Challenger
* @author Christian Grothoff
*/
-#ifndef SYNC_DATABASE_PLUGIN_H
-#define SYNC_DATABASE_PLUGIN_H
+#ifndef CHALLENGER_DATABASE_PLUGIN_H
+#define CHALLENGER_DATABASE_PLUGIN_H
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_db_lib.h>
-#include "sync_service.h"
#include <jansson.h>
#include <taler/taler_util.h>
/**
- * Possible status codes returned from the SYNC database.
- */
-enum SYNC_DB_QueryStatus
-{
- /**
- * Client claimed to be updating an existing backup, but we have none.
- */
- SYNC_DB_OLD_BACKUP_MISSING = -5,
-
- /**
- * Update failed because the old backup hash does not match what we previously had in the DB.
- */
- SYNC_DB_OLD_BACKUP_MISMATCH = -4,
-
- /**
- * Account is unpaid / does not exist.
- */
- SYNC_DB_PAYMENT_REQUIRED = -3,
-
- /**
- * Hard database issue, retries futile.
- */
- SYNC_DB_HARD_ERROR = -2,
-
- /**
- * Soft database error, retrying may help.
- */
- SYNC_DB_SOFT_ERROR = -1,
-
- /**
- * Database succeeded, but no results.
- */
- SYNC_DB_NO_RESULTS = 0,
-
- /**
- * Database succeeded, one change or result.
- */
- SYNC_DB_ONE_RESULT = 1
-};
-
-
-/**
- * Function called on all pending payments for an account.
- *
- * @param cls closure
- * @param timestamp for how long have we been waiting
- * @param order_id order id in the backend
- * @param token claim token, or NULL for none
- * @param amount how much is the order for
- */
-typedef void
-(*SYNC_DB_PaymentPendingIterator)(void *cls,
- struct GNUNET_TIME_Timestamp timestamp,
- const char *order_id,
- const struct TALER_ClaimTokenP *token,
- const struct TALER_Amount *amount);
-
-
-/**
* Handle to interact with the database.
*
* Functions ending with "_TR" run their OWN transaction scope
@@ -96,7 +36,7 @@ typedef void
* setup a transaction scope. Functions without a suffix are
* simple, single SQL queries that MAY be used either way.
*/
-struct SYNC_DatabasePlugin
+struct CHALLENGER_DatabasePlugin
{
/**
@@ -111,7 +51,7 @@ struct SYNC_DatabasePlugin
char *library_name;
/**
- * Drop sync tables. Used for testcases.
+ * Drop challenger tables. Used for testcases.
*
* @param cls closure
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
@@ -146,152 +86,16 @@ struct SYNC_DatabasePlugin
/**
* Function called to perform "garbage collection" on the
- * database, expiring records we no longer require. Deletes
- * all user records that are not paid up (and by cascade deletes
- * the associated recovery documents). Also deletes expired
- * truth and financial records older than @a fin_expire.
+ * database, expiring records we no longer require.
*
* @param cls closure
- * @param expire_backups backups older than the given time stamp should be garbage collected
- * @param expire_pending_payments payments still pending from since before
- * this value should be garbage collected
+ * @param expire expiration time to use
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
(*gc)(void *cls,
- struct GNUNET_TIME_Absolute expire,
- struct GNUNET_TIME_Absolute expire_pending_payments);
-
-
- /**
- * Store backup. Only applicable for the FIRST backup under
- * an @a account_pub. Use @e update_backup_TR to update an
- * existing backup.
- *
- * @param cls closure
- * @param account_pub account to store @a backup under
- * @param account_sig signature affirming storage request
- * @param backup_hash hash of @a backup
- * @param backup_size number of bytes in @a backup
- * @param backup raw data to backup
- * @return transaction status
- */
- enum SYNC_DB_QueryStatus
- (*store_backup_TR)(void *cls,
- const struct SYNC_AccountPublicKeyP *account_pub,
- const struct SYNC_AccountSignatureP *account_sig,
- const struct GNUNET_HashCode *backup_hash,
- size_t backup_size,
- const void *backup);
-
+ struct GNUNET_TIME_Absolute expire);
- /**
- * Store payment. Used to begin a payment, not indicative
- * that the payment actually was made. (That is done
- * when we increment the account's lifetime.)
- *
- * @param cls closure
- * @param account_pub account to store @a backup under
- * @param order_id order we created
- * @param token claim token, or NULL for none
- * @param amount how much we asked for
- * @return transaction status
- */
- enum SYNC_DB_QueryStatus
- (*store_payment_TR)(void *cls,
- const struct SYNC_AccountPublicKeyP *account_pub,
- const char *order_id,
- const struct TALER_ClaimTokenP *token,
- const struct TALER_Amount *amount);
-
-
- /**
- * Lookup pending payments by account.
- *
- * @param cls closure
- * @param account_pub account to look for pending payments under
- * @param it iterator to call on all pending payments
- * @param it_cls closure for @a it
- * @return transaction status
- */
- enum GNUNET_DB_QueryStatus
- (*lookup_pending_payments_by_account_TR)(void *cls,
- const struct
- SYNC_AccountPublicKeyP *account_pub,
- SYNC_DB_PaymentPendingIterator it,
- void *it_cls);
-
- /**
- * Update backup.
- *
- * @param cls closure
- * @param account_pub account to store @a backup under
- * @param account_sig signature affirming storage request
- * @param old_backup_hash hash of the previous backup (must match)
- * @param backup_hash hash of @a backup
- * @param backup_size number of bytes in @a backup
- * @param backup raw data to backup
- * @return transaction status
- */
- enum SYNC_DB_QueryStatus
- (*update_backup_TR)(void *cls,
- const struct SYNC_AccountPublicKeyP *account_pub,
- const struct GNUNET_HashCode *old_backup_hash,
- const struct SYNC_AccountSignatureP *account_sig,
- const struct GNUNET_HashCode *backup_hash,
- size_t backup_size,
- const void *backup);
-
-
- /**
- * Lookup an account and associated backup meta data.
- *
- * @param cls closure
- * @param account_pub account to store @a backup under
- * @param backup_hash[OUT] set to hash of @a backup
- * @return transaction status
- */
- enum SYNC_DB_QueryStatus
- (*lookup_account_TR)(void *cls,
- const struct SYNC_AccountPublicKeyP *account_pub,
- struct GNUNET_HashCode *backup_hash);
-
-
- /**
- * Obtain backup.
- *
- * @param cls closure
- * @param account_pub account to store @a backup under
- * @param account_sig[OUT] set to signature affirming storage request
- * @param prev_hash[OUT] set to hash of the previous @a backup (all zeros if none)
- * @param backup_hash[OUT] set to hash of @a backup
- * @param backup_size[OUT] set to number of bytes in @a backup
- * @param backup[OUT] set to raw data to backup, caller MUST FREE
- */
- enum SYNC_DB_QueryStatus
- (*lookup_backup_TR)(void *cls,
- const struct SYNC_AccountPublicKeyP *account_pub,
- struct SYNC_AccountSignatureP *account_sig,
- struct GNUNET_HashCode *prev_hash,
- struct GNUNET_HashCode *backup_hash,
- size_t *backup_size,
- void **backup);
-
- /**
- * Increment account lifetime and mark the associated payment
- * as successful.
- *
- * @param cls closure
- * @param account_pub which account received a payment
- * @param order_id order which was paid, must be unique and match pending payment
- * @param lifetime for how long is the account now paid (increment)
- * @return transaction status
- */
- enum SYNC_DB_QueryStatus
- (*increment_lifetime_TR)(void *cls,
- const struct SYNC_AccountPublicKeyP *account_pub,
- const char *order_id,
- struct GNUNET_TIME_Relative lifetime);
};
#endif