[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-anastasis] 02/02: fix indentation
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-anastasis] 02/02: fix indentation |
Date: |
Thu, 24 Oct 2019 09:53:00 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
commit f22189fe8953045a5801915a605000a5a3aaa707
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Oct 24 09:52:53 2019 +0200
fix indentation
---
Makefile.am | 2 +
bootstrap | 19 ++
src/backup-db/plugin_anastasis_postgres.c | 534 ++++++++++++++++--------------
src/backup/anastasis-httpd.c | 85 ++---
src/backup/anastasis-httpd_mhd.c | 16 +-
src/backup/anastasis-httpd_parsing.c | 28 +-
src/backup/anastasis-httpd_responses.c | 11 +-
src/include/anastasis_database_plugin.h | 30 +-
src/include/anastasis_service.h | 30 +-
9 files changed, 401 insertions(+), 354 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 221dcd7..3227908 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,4 +21,6 @@ EXTRA_DIST = \
AUTHORS \
COPYING.AGPL \
contrib/gnunet.tag \
+ contrib/uncrustify.cfg \
+ contrib/uncrustify_precommit \
Doxyfile
diff --git a/bootstrap b/bootstrap
index 373e5f5..65d653e 100755
--- a/bootstrap
+++ b/bootstrap
@@ -8,5 +8,24 @@ fi
echo "$0: Updating submodules"
echo | git submodule update --init
+# This is more portable than `which' but comes with
+# the caveat of not(?) properly working on busybox's ash:
+existence()
+{
+ command -v "$1" >/dev/null 2>&1
+}
+
+
+if existence uncrustify; then
+ echo "Installing uncrustify hook and configuration"
+ # Install uncrustify format symlink (if possible)
+ ln -s contrib/uncrustify.cfg uncrustify.cfg 2> /dev/null
+ # Install pre-commit hook (if possible)
+ ln -s ../../contrib/uncrustify_precommit .git/hooks/pre-commit 2> /dev/null
+else
+ echo "Uncrustify not detected, hook not installed. Please install
uncrustify if you plan on doing development"
+fi
+
+
echo "$0: Running autoreconf"
autoreconf -if
diff --git a/src/backup-db/plugin_anastasis_postgres.c
b/src/backup-db/plugin_anastasis_postgres.c
index c93448f..59f7207 100644
--- a/src/backup-db/plugin_anastasis_postgres.c
+++ b/src/backup-db/plugin_anastasis_postgres.c
@@ -71,7 +71,8 @@ postgres_drop_tables (void *cls)
GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS anastasis_truth;"),
GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS anastasis_user
CASCADE;"),
GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS anastasis_payment;"),
- GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS
anastasis_recoverydocument;"),
+ GNUNET_PQ_make_try_execute (
+ "DROP TABLE IF EXISTS anastasis_recoverydocument;"),
GNUNET_PQ_EXECUTE_STATEMENT_END
};
@@ -132,51 +133,51 @@ postgres_preflight (void *cls)
static int
begin_transaction (struct PostgresClosure *pg)
{
- struct GNUNET_PQ_ExecuteStatement es[] = {
- GNUNET_PQ_make_execute ("START TRANSACTION ISOLATION LEVEL
SERIALIZABLE"),
- GNUNET_PQ_EXECUTE_STATEMENT_END
- };
+ struct GNUNET_PQ_ExecuteStatement es[] = {
+ GNUNET_PQ_make_execute ("START TRANSACTION ISOLATION LEVEL SERIALIZABLE"),
+ GNUNET_PQ_EXECUTE_STATEMENT_END
+ };
- if (GNUNET_OK !=
- GNUNET_PQ_exec_statements (pg->conn,
- es))
- {
- TALER_LOG_ERROR ("Failed to start transaction\n");
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
+ if (GNUNET_OK !=
+ GNUNET_PQ_exec_statements (pg->conn,
+ es))
+ {
+ TALER_LOG_ERROR ("Failed to start transaction\n");
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+ return GNUNET_OK;
}
static void
rollback (struct PostgresClosure *pg)
{
- struct GNUNET_PQ_ExecuteStatement es[] = {
- GNUNET_PQ_make_execute ("ROLLBACK"),
- GNUNET_PQ_EXECUTE_STATEMENT_END
- };
+ struct GNUNET_PQ_ExecuteStatement es[] = {
+ GNUNET_PQ_make_execute ("ROLLBACK"),
+ GNUNET_PQ_EXECUTE_STATEMENT_END
+ };
- if (GNUNET_OK !=
- GNUNET_PQ_exec_statements (pg->conn,
- es))
- {
- TALER_LOG_ERROR ("Failed to rollback transaction\n");
- GNUNET_break (0);
- }
+ if (GNUNET_OK !=
+ GNUNET_PQ_exec_statements (pg->conn,
+ es))
+ {
+ TALER_LOG_ERROR ("Failed to rollback transaction\n");
+ GNUNET_break (0);
+ }
}
static enum GNUNET_DB_QueryStatus
commit_transaction (struct PostgresClosure *pg)
{
- struct GNUNET_PQ_QueryParam no_params[] = {
- GNUNET_PQ_query_param_end
- };
+ struct GNUNET_PQ_QueryParam no_params[] = {
+ GNUNET_PQ_query_param_end
+ };
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "do_commit",
- no_params);
+ return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "do_commit",
+ no_params);
}
/**
@@ -193,7 +194,8 @@ commit_transaction (struct PostgresClosure *pg)
*/
static enum GNUNET_DB_QueryStatus
postgres_store_recovery_document (void *cls,
- const struct ANASTASIS_AccountPubP
*anastasis_pub,
+ const struct
+ ANASTASIS_AccountPubP *anastasis_pub,
const void *data,
size_t data_size,
const struct
@@ -207,8 +209,8 @@ postgres_store_recovery_document (void *cls,
check_connection (pg);
if (GNUNET_OK != begin_transaction (pg))
{
- GNUNET_break (0);
- return GNUNET_DB_STATUS_HARD_ERROR;
+ GNUNET_break (0);
+ return GNUNET_DB_STATUS_HARD_ERROR;
}
// Check if user has paid
@@ -218,15 +220,15 @@ postgres_store_recovery_document (void *cls,
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_result_spec_absolute_time ("paid_until",
- &paid_until),
- GNUNET_PQ_result_spec_end
- };
-
+ TALER_PQ_result_spec_absolute_time ("paid_until",
+ &paid_until),
+ GNUNET_PQ_result_spec_end
+ };
+
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "user_select",
- params,
- rs);
+ "user_select",
+ params,
+ rs);
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
@@ -234,23 +236,25 @@ postgres_store_recovery_document (void *cls,
return qs;
case GNUNET_DB_STATUS_SOFT_ERROR:
// FIXME: or: retry internally?
- rollback (pg);
+ rollback (pg);
return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- return GNUNET_DB_STATUS_UNKNOWN_USER; //FIXME: This status has to be
defined!
+ return GNUNET_DB_STATUS_UNKNOWN_USER; // FIXME: This status has to be
defined!
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
paid_until = GNUNET_TIME_absolute_max (GNUNET_TIME_absolute_get (),
- paid_until);
+ paid_until);
break;
- }
+ }
- //rollback if user hasn't paid
- if (GNUNET_TIME_absolute_get_difference(GNUNET_TIME_absolute_get, paid_until
== 0)) {
- rollback(pg);
- return GNUNET_DB_STATUS_SOFT_ERROR; //FIXME maybe differnet errorcode?
+ // rollback if user hasn't paid
+ if (GNUNET_TIME_absolute_get_difference (GNUNET_TIME_absolute_get,
+ (paid_until == 0) ))
+ {
+ rollback (pg);
+ return GNUNET_DB_STATUS_SOFT_ERROR; // FIXME maybe differnet errorcode?
}
- //lookup if the user has enough uploads left and decrement
+ // lookup if the user has enough uploads left and decrement
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
@@ -264,85 +268,91 @@ postgres_store_recovery_document (void *cls,
};
- qs = GNUNET_PQ_eval_prepared_singleton_select
(pg->conn,"postcounter_select", params, rs);
+ qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,"postcounter_select",
+ params, rs);
switch (qs)
- {
- case GNUNET_DB_STATUS_HARD_ERROR:
- rollback (pg);
- return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
- // FIXME: or: retry internally?
- rollback (pg);
- return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- break;
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ rollback (pg);
+ return qs;
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ // FIXME: or: retry internally?
+ rollback (pg);
+ return qs;
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ rollback (pg);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ break;
}
- if (postcounter == 0 ) {
- rollback(pg);
- return GNUNET_DB_STATUS_SOFT_ERROR; //FIXME maybe differnet errorcode?
+ if (postcounter == 0 )
+ {
+ rollback (pg);
+ return GNUNET_DB_STATUS_SOFT_ERROR; // FIXME maybe differnet errorcode?
}
- //decrement the postcounter
+ // decrement the postcounter
postcounter--;
- //update the postcounter
+ // update the postcounter
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (&postcounter),
- GNUNET_PQ_query_param_absolute_time (anastasis_pub),
- GNUNET_PQ_query_param_auto_from_type (payment_secret),
- GNUNET_PQ_query_param_end
+ GNUNET_PQ_query_param_auto_from_type (&postcounter),
+ GNUNET_PQ_query_param_absolute_time (anastasis_pub),
+ GNUNET_PQ_query_param_auto_from_type (payment_secret),
+ GNUNET_PQ_query_param_end
};
- qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,"postcounter_update",
params);
+ qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,"postcounter_update",
+ params);
- switch (qs) {
- case GNUNET_DB_STATUS_HARD_ERROR:
- rollback (pg);
- return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
- rollback (pg);
- return qs;
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ rollback (pg);
+ return qs;
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ rollback (pg);
+ return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- GNUNET_break (0);
- rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- break;
- }
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ GNUNET_break (0);
+ rollback (pg);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ break;
+ }
- //get the version for the recoverydocument
+ // get the version for the recoverydocument
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
- GNUNET_PQ_query_param_end
+ GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
+ GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_uint32 ("version", version),
- GNUNET_PQ_result_spec_end
+ GNUNET_PQ_result_spec_uint32 ("version", version),
+ GNUNET_PQ_result_spec_end
};
- qs = GNUNET_PQ_eval_prepared_singleton_select
(pg->conn,"latest_recovery_version_select", params, rs);
+ qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+
"latest_recovery_version_select",
+ params, rs);
switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
- rollback (pg);
- return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
- // FIXME: or: retry internally?
- rollback (pg);
- return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- version = 1;
- break;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- version++;
- break;
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ rollback (pg);
+ return qs;
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ // FIXME: or: retry internally?
+ rollback (pg);
+ return qs;
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ version = 1;
+ break;
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ version++;
+ break;
}
struct GNUNET_PQ_QueryParam params[] = {
@@ -352,7 +362,8 @@ postgres_store_recovery_document (void *cls,
GNUNET_PQ_query_param_end
};
- qs = GNUNET_PQ_eval_prepared_non_select
(pg->conn,"recovery_document_insert", params);
+ qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,"recovery_document_insert",
+ params);
switch (qs)
@@ -362,13 +373,13 @@ postgres_store_recovery_document (void *cls,
return qs;
case GNUNET_DB_STATUS_SOFT_ERROR:
// FIXME: or: retry internally?
- rollback (pg);
+ rollback (pg);
return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0);
- rollback (pg);
+ rollback (pg);
return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
@@ -403,7 +414,7 @@ postgres_record_payment (void *cls,
struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Absolute paid_until;
-
+
check_connection (pg);
if (GNUNET_OK !=
begin_transaction (pg))
@@ -411,7 +422,7 @@ postgres_record_payment (void *cls,
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
}
-
+
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
@@ -419,10 +430,10 @@ postgres_record_payment (void *cls,
};
struct GNUNET_PQ_ResultSpec rs[] = {
TALER_PQ_result_spec_absolute_time ("paid_until",
- &paid_until),
+ &paid_until),
GNUNET_PQ_result_spec_end
};
-
+
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"user_select",
params,
@@ -434,61 +445,61 @@ postgres_record_payment (void *cls,
return qs;
case GNUNET_DB_STATUS_SOFT_ERROR:
// FIXME: or: retry internally?
- rollback (pg);
+ rollback (pg);
return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
paid_until = GNUNET_TIME_absolute_get ();
break;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
paid_until = GNUNET_TIME_absolute_max (GNUNET_TIME_absolute_get (),
- paid_until);
+ paid_until);
break;
}
}
paid_until = GNUNET_TIME_absolute_add (paid_until,
- lifetime_inc);
+ lifetime_inc);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
- {
- /* user did not yet exist, create */
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
- GNUNET_PQ_query_param_absolute_time (&paid_until),
- GNUNET_PQ_query_param_end
- };
-
- qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "user_insert",
- params);
- }
+ {
+ /* user did not yet exist, create */
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
+ GNUNET_PQ_query_param_absolute_time (&paid_until),
+ GNUNET_PQ_query_param_end
+ };
+
+ qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "user_insert",
+ params);
+ }
else
- {
- /* user exists, update */
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_absolute_time (&paid_until),
- GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
- GNUNET_PQ_query_param_end
- };
-
- qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "user_update",
- params);
- }
+ {
+ /* user exists, update */
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_absolute_time (&paid_until),
+ GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
+ GNUNET_PQ_query_param_end
+ };
+
+ qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "user_update",
+ params);
+ }
switch (qs)
- {
- case GNUNET_DB_STATUS_HARD_ERROR:
- rollback (pg);
- return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
- // FIXME: or: retry internally?
- rollback (pg);
- return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- GNUNET_break (0);
- rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- break;
- }
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ rollback (pg);
+ return qs;
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ // FIXME: or: retry internally?
+ rollback (pg);
+ return qs;
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ GNUNET_break (0);
+ rollback (pg);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ break;
+ }
{
struct GNUNET_PQ_QueryParam params[] = {
@@ -499,22 +510,22 @@ postgres_record_payment (void *cls,
};
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "payment_insert",
- params);
-
+ "payment_insert",
+ params);
+
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
rollback (pg);
return qs;
case GNUNET_DB_STATUS_SOFT_ERROR:
- rollback (pg);
+ rollback (pg);
return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0);
- rollback (pg);
+ rollback (pg);
return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
}
@@ -544,49 +555,50 @@ postgres_store_truth (void *cls,
size_t truth_data_size,
struct GNUNET_TIME_Relative truth_expiration)
{
- struct PostgresClosure *pg = cls;
- enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute expiration = GNUNET_TIME_absolute_get ();
- expiration = GNUNET_TIME_absolute_add (expiration, truth_expiration);
+ struct PostgresClosure *pg = cls;
+ enum GNUNET_DB_QueryStatus qs;
+ struct GNUNET_TIME_Absolute expiration = GNUNET_TIME_absolute_get ();
+ expiration = GNUNET_TIME_absolute_add (expiration, truth_expiration);
- check_connection (pg);
- if (GNUNET_OK != begin_transaction (pg))
- {
+ check_connection (pg);
+ if (GNUNET_OK != begin_transaction (pg))
+ {
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
- }
+ }
-struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (uuid),
- GNUNET_PQ_query_param_fixed_size (truth_data, truth_data_size),
- GNUNET_PQ_query_param_auto_from_type (expiration),
- GNUNET_PQ_query_param_end
-};
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (uuid),
+ GNUNET_PQ_query_param_fixed_size (truth_data, truth_data_size),
+ GNUNET_PQ_query_param_auto_from_type (expiration),
+ GNUNET_PQ_query_param_end
+ };
- qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,"truth_insert", params);
- switch (qs)
- {
- case GNUNET_DB_STATUS_HARD_ERROR:
- rollback (pg);
- return qs;
- case GNUNET_DB_STATUS_SOFT_ERROR:
- rollback (pg);
- return qs;
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- GNUNET_break (0);
- rollback (pg);
- return GNUNET_DB_STATUS_HARD_ERROR;
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- break;
-}
+ qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,"truth_insert", params);
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ rollback (pg);
+ return qs;
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ rollback (pg);
+ return qs;
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ GNUNET_break (0);
+ rollback (pg);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ break;
+ }
- qs = commit_transaction (pg);
- if (qs < 0) {
- return qs;
- }
+ qs = commit_transaction (pg);
+ if (qs < 0)
+ {
+ return qs;
+ }
- return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
+ return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
}
@@ -614,23 +626,24 @@ enum GNUNET_DB_QueryStatus
{
- struct PostgresClosure *pg = cls;
- check_connection (pg);
+ struct PostgresClosure *pg = cls;
+ check_connection (pg);
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (uuid),
- GNUNET_PQ_query_param_end
- };
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (uuid),
+ GNUNET_PQ_query_param_end
+ };
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_variable_size ("truth", data, data_size),
- GNUNET_PQ_result_spec_end
- };
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_variable_size ("truth", data, data_size),
+ GNUNET_PQ_result_spec_end
+ };
- GNUNET_PQ_eval_prepared_singleton_select (pg->conn,"truth_select", params,
rs);
+ GNUNET_PQ_eval_prepared_singleton_select (pg->conn,"truth_select", params,
+ rs);
- //FIXME Pattern match ?
- //return nur von recovery teil
+ // FIXME Pattern match ?
+ // return nur von recovery teil
}
@@ -652,21 +665,22 @@ enum GNUNET_DB_QueryStatus
char **truth_mime,
size_t *truth_mime_size)
{
- struct PostgresClosure *pg = cls;
- check_connection (pg);
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (uuid),
- GNUNET_PQ_query_param_end
- };
+ struct PostgresClosure *pg = cls;
+ check_connection (pg);
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (uuid),
+ GNUNET_PQ_query_param_end
+ };
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_variable_size ("truth", data, data_size),
- GNUNET_PQ_result_spec_end
- };
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_variable_size ("truth", data, data_size),
+ GNUNET_PQ_result_spec_end
+ };
- GNUNET_PQ_eval_prepared_singleton_select (pg->conn,"truth_select", params,
rs);
+ GNUNET_PQ_eval_prepared_singleton_select (pg->conn,"truth_select", params,
+ rs);
- //FIXME return nur von challange teil
+ // FIXME return nur von challange teil
}
@@ -689,20 +703,22 @@ enum GNUNET_DB_QueryStatus
void **data,
uint32_t *version)
{
- check_connection(pq);
- struct PostgresClosure *pg = cls;
+ check_connection (pq);
+ struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
- GNUNET_PQ_query_param_end
- };
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
+ GNUNET_PQ_query_param_end
+ };
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_variable_size ("recovery_data", data, data_size),
- GNUNET_PQ_result_spec_end
- };
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_variable_size ("recovery_data", data, data_size),
+ GNUNET_PQ_result_spec_end
+ };
- return GNUNET_PQ_eval_prepared_singleton_select
(pg->conn,"latest_recoverydocument_select", params, rs);
+ return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+
"latest_recoverydocument_select",
+ params, rs);
}
/**
@@ -723,20 +739,22 @@ enum GNUNET_DB_QueryStatus
void **data)
{
- check_connection(pq);
- struct PostgresClosure *pg = cls;
+ check_connection (pq);
+ struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
- GNUNET_PQ_query_param_uint32(version),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_variable_size ("recovery_data", data, data_size),
- GNUNET_PQ_result_spec_end
- };
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
+ GNUNET_PQ_query_param_uint32 (version),
+ GNUNET_PQ_query_param_end
+ };
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_variable_size ("recovery_data", data, data_size),
+ GNUNET_PQ_result_spec_end
+ };
- return GNUNET_PQ_eval_prepared_singleton_select
(pg->conn,"recoverydocument_select", params, rs);
+ return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "recoverydocument_select",
+ params, rs);
}
/**
@@ -756,23 +774,27 @@ libtaler_plugin_anastasis_db_postgres_init (void *cls)
/* Orders created by the frontend, not signed or given a nonce yet.
The contract terms will change (nonce will be added) when moved to the
contract terms table */
- GNUNET_PQ_make_execute ("CREATE TABLE anastasis_truth
+ GNUNET_PQ_make_execute (
+ "CREATE TABLE anastasis_truth
( truth_id UUID PRIMARY KEY NOT NULL,
truth BYTEA NOT NULL,
expiration TIMESTAMP NOT NULL
- );"),
- GNUNET_PQ_make_execute ("CREATE TABLE anastasis_user
+ );"),
+ GNUNET_PQ_make_execute (
+ "CREATE TABLE anastasis_user
( user_id BYTEA PRIMARY KEY
CHECK(LENGTH(user_id)=32),
paid_until TIMESTAMP NOT NULL
- );"),
- GNUNET_PQ_make_execute ("CREATE TABLE anastasis_payments
+ );"),
+ GNUNET_PQ_make_execute (
+ "CREATE TABLE anastasis_payments
( payment_id BIGSERIAL PRIMARY KEY,
user_id BYTEA NOT NULL REFERENCES
anastasis_user(user_id),
post_counter INTEGER,
payment_identifier BYTEA NOT NULL
CHECK(LENGTH(payment_identifier)=32),
transaction_time TIMESTAMP NOT NULL DEFAULT NOW()
);"),
- GNUNET_PQ_make_execute ("CREATE TABLE anastasis_recoverydocument
+ GNUNET_PQ_make_execute (
+ "CREATE TABLE anastasis_recoverydocument
( user_id BYTEA NOT NULL REFERENCES
anastasis_user(user_id),
version INTEGER,
recovery_data BYTEA,
@@ -782,7 +804,7 @@ libtaler_plugin_anastasis_db_postgres_init (void *cls)
};
- struct GNUNET_PQ_PreparedStatement ps[] = {
+ struct GNUNET_PQ_PreparedStatement ps[] = {
GNUNET_PQ_make_prepare ("user_insert",
"INSERT INTO anastasis_user "
"(user_id"
@@ -795,14 +817,14 @@ libtaler_plugin_anastasis_db_postgres_init (void *cls)
0),
GNUNET_PQ_make_prepare ("user_select",
"SELECT"
- " paid_until "
+ " paid_until "
"FROM anastasis_user"
" WHERE user_id=$1"
" FOR UPDATE;",
1),
GNUNET_PQ_make_prepare ("user_update",
"UPDATE anastasis_user"
- " SET "
+ " SET "
" paid_until=$1"
" WHERE user_id=$2;",
2),
diff --git a/src/backup/anastasis-httpd.c b/src/backup/anastasis-httpd.c
index 6481f3f..7c14f7f 100644
--- a/src/backup/anastasis-httpd.c
+++ b/src/backup/anastasis-httpd.c
@@ -80,7 +80,7 @@ is_valid_correlation_id (const char *correlation_id)
if (strlen (correlation_id) >= 64)
return GNUNET_NO;
for (int i = 0; i < strlen (correlation_id); i++)
- if (!(isalnum (correlation_id[i]) || correlation_id[i] == '-'))
+ if (! (isalnum (correlation_id[i]) ||(correlation_id[i] == '-')))
return GNUNET_NO;
return GNUNET_YES;
}
@@ -135,23 +135,21 @@ url_handler (void *cls,
size_t *upload_data_size,
void **con_cls)
{
- static struct TMH_RequestHandler handlers[] =
- {
- /* Landing page, tell humans to go away. */
- { "/", MHD_HTTP_METHOD_GET, "text/plain",
- "Hello, I'm Anastasis. This HTTP server is not for humans.\n", 0,
- &TMH_MHD_handler_static_response, MHD_HTTP_OK },
- { "/agpl", MHD_HTTP_METHOD_GET, "text/plain",
- NULL, 0,
- &TMH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND },
- {NULL, NULL, NULL, NULL, 0, 0 }
- };
- static struct TMH_RequestHandler h404 =
- {
- "", NULL, "text/html",
- "<html><title>404: not found</title></html>", 0,
- &TMH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
- };
+ static struct TMH_RequestHandler handlers[] = {
+ /* Landing page, tell humans to go away. */
+ { "/", MHD_HTTP_METHOD_GET, "text/plain",
+ "Hello, I'm Anastasis. This HTTP server is not for humans.\n", 0,
+ &TMH_MHD_handler_static_response, MHD_HTTP_OK },
+ { "/agpl", MHD_HTTP_METHOD_GET, "text/plain",
+ NULL, 0,
+ &TMH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND },
+ {NULL, NULL, NULL, NULL, 0, 0 }
+ };
+ static struct TMH_RequestHandler h404 = {
+ "", NULL, "text/html",
+ "<html><title>404: not found</title></html>", 0,
+ &TMH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
+ };
struct TM_HandlerContext *hc;
struct GNUNET_AsyncScopeId aid;
@@ -169,8 +167,9 @@ url_handler (void *cls,
if ((NULL != correlation_id) &&
(GNUNET_YES != is_valid_correlation_id (correlation_id)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "illegal incoming correlation
ID\n");
- correlation_id = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "illegal incoming correlation ID\n");
+ correlation_id = NULL;
}
}
else
@@ -192,28 +191,28 @@ url_handler (void *cls,
method,
url);
if (0 == strncmp (url,
- "/policy/",
- strlen ("/policy/")))
- {
- // return handle_policy (...);
- }
- for (unsigned int i=0;NULL != handlers[i].url;i++)
+ "/policy/",
+ strlen ("/policy/")))
+ {
+ // return handle_policy (...);
+ }
+ for (unsigned int i = 0; NULL != handlers[i].url; i++)
{
struct TMH_RequestHandler *rh = &handlers[i];
if ( (0 == strcmp (url,
- rh->url)) &&
+ rh->url)) &&
( (NULL == rh->method) ||
(0 == strcmp (method,
- rh->method)) ) )
+ rh->method)) ) )
{
int ret;
ret = rh->handler (rh,
- connection,
- con_cls,
- upload_data,
- upload_data_size);
+ connection,
+ con_cls,
+ upload_data,
+ upload_data_size);
hc = *con_cls;
if (NULL != hc)
{
@@ -351,7 +350,7 @@ TMH_trigger_daemon ()
static struct GNUNET_SCHEDULER_Task *
prepare_daemon ()
{
- struct GNUNET_SCHEDULER_Task * ret;
+ struct GNUNET_SCHEDULER_Task *ret;
fd_set rs;
fd_set ws;
fd_set es;
@@ -384,11 +383,11 @@ prepare_daemon ()
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding run_daemon select task\n");
ret = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
- tv,
- wrs,
- wws,
- &run_daemon,
- NULL);
+ tv,
+ wrs,
+ wws,
+ &run_daemon,
+ NULL);
GNUNET_NETWORK_fdset_destroy (wrs);
GNUNET_NETWORK_fdset_destroy (wws);
return ret;
@@ -596,9 +595,9 @@ run (void *cls,
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = AI_PASSIVE
#ifdef AI_IDN
- | AI_IDN
+ | AI_IDN
#endif
- ;
+ ;
if (0 !=
(ec = getaddrinfo (bind_to,
port_str,
@@ -665,8 +664,10 @@ run (void *cls,
NULL, NULL,
&url_handler, NULL,
MHD_OPTION_LISTEN_SOCKET, fh,
- MHD_OPTION_NOTIFY_COMPLETED,
&handle_mhd_completion_callback, NULL,
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 10 /*
10s */,
+ MHD_OPTION_NOTIFY_COMPLETED,
+ &handle_mhd_completion_callback, NULL,
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned
+ int) 10 /* 10s */,
MHD_OPTION_END);
if (NULL == mhd)
{
diff --git a/src/backup/anastasis-httpd_mhd.c b/src/backup/anastasis-httpd_mhd.c
index 3ee093e..af0023b 100644
--- a/src/backup/anastasis-httpd_mhd.c
+++ b/src/backup/anastasis-httpd_mhd.c
@@ -85,10 +85,10 @@ TMH_MHD_handler_static_response (struct TMH_RequestHandler
*rh,
*/
int
TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size)
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size)
{
const char *agpl =
"This server is licensed under the Affero GPL. You will now be redirected
to the source code.";
@@ -140,10 +140,10 @@ TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler
*rh,
*/
int
TMH_MHD_handler_send_json_pack_error (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size)
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size)
{
return TMH_RESPONSE_reply_json_pack (connection,
rh->response_code,
diff --git a/src/backup/anastasis-httpd_parsing.c
b/src/backup/anastasis-httpd_parsing.c
index eca0099..242278f 100644
--- a/src/backup/anastasis-httpd_parsing.c
+++ b/src/backup/anastasis-httpd_parsing.c
@@ -37,12 +37,12 @@
/**
* Initial size for POST request buffer.
*/
-#define REQUEST_BUFFER_INITIAL (2*1024)
+#define REQUEST_BUFFER_INITIAL (2 * 1024)
/**
* Maximum POST request size.
*/
-#define REQUEST_BUFFER_MAX (1024*1024)
+#define REQUEST_BUFFER_MAX (1024 * 1024)
/**
@@ -147,21 +147,21 @@ TMH_PARSE_post_json (struct MHD_Connection *connection,
case GNUNET_JSON_PR_OUT_OF_MEMORY:
return (MHD_NO == TMH_RESPONSE_reply_internal_error
- (connection,
- TALER_EC_PARSER_OUT_OF_MEMORY,
- "out of memory")) ? GNUNET_SYSERR : GNUNET_NO;
+ (connection,
+ TALER_EC_PARSER_OUT_OF_MEMORY,
+ "out of memory")) ? GNUNET_SYSERR : GNUNET_NO;
case GNUNET_JSON_PR_CONTINUE:
return GNUNET_YES;
case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
return (MHD_NO == TMH_RESPONSE_reply_request_too_large
- (connection)) ? GNUNET_SYSERR : GNUNET_NO;
+ (connection)) ? GNUNET_SYSERR : GNUNET_NO;
case GNUNET_JSON_PR_JSON_INVALID:
return (MHD_YES ==
TMH_RESPONSE_reply_invalid_json (connection))
- ? GNUNET_NO : GNUNET_SYSERR;
+ ? GNUNET_NO : GNUNET_SYSERR;
case GNUNET_JSON_PR_SUCCESS:
GNUNET_break (NULL != *json);
return GNUNET_YES;
@@ -213,7 +213,7 @@ TMH_PARSE_json_data (struct MHD_Connection *connection,
"error", "parse error",
"field", error_json_name,
"line", (json_int_t) error_line))
- ? GNUNET_NO : GNUNET_SYSERR;
+ ? GNUNET_NO : GNUNET_SYSERR;
return ret;
}
return GNUNET_YES;
@@ -251,9 +251,9 @@ TMH_PARSE_mhd_request_arg_data (struct MHD_Connection
*connection,
{
return (MHD_NO ==
TMH_RESPONSE_reply_arg_missing (connection,
- TALER_EC_PARAMETER_MISSING,
- param_name))
- ? GNUNET_SYSERR : GNUNET_NO;
+ TALER_EC_PARAMETER_MISSING,
+ param_name))
+ ? GNUNET_SYSERR : GNUNET_NO;
}
if (GNUNET_OK !=
GNUNET_STRINGS_string_to_data (str,
@@ -262,9 +262,9 @@ TMH_PARSE_mhd_request_arg_data (struct MHD_Connection
*connection,
out_size))
return (MHD_NO ==
TMH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_PARAMETER_MALFORMED,
- param_name))
- ? GNUNET_SYSERR : GNUNET_NO;
+ TALER_EC_PARAMETER_MALFORMED,
+ param_name))
+ ? GNUNET_SYSERR : GNUNET_NO;
return GNUNET_OK;
}
diff --git a/src/backup/anastasis-httpd_responses.c
b/src/backup/anastasis-httpd_responses.c
index ca214ec..bdd5884 100644
--- a/src/backup/anastasis-httpd_responses.c
+++ b/src/backup/anastasis-httpd_responses.c
@@ -43,7 +43,7 @@ TMH_RESPONSE_make_json (const json_t *json)
char *json_str;
json_str = json_dumps (json,
- JSON_INDENT(2));
+ JSON_INDENT (2));
if (NULL == json_str)
{
GNUNET_break (0);
@@ -111,9 +111,9 @@ TMH_RESPONSE_make_json_pack (const char *fmt,
va_start (argp, fmt);
json = json_vpack_ex (&jerror,
- 0,
- fmt,
- argp);
+ 0,
+ fmt,
+ argp);
va_end (argp);
if (NULL == json)
{
@@ -273,7 +273,8 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection
*connection)
return TMH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_BAD_REQUEST,
"{s:I, s:s}",
- "code", (json_int_t)
TALER_EC_JSON_INVALID,
+ "code",
+ (json_int_t) TALER_EC_JSON_INVALID,
"error", "invalid json");
}
diff --git a/src/include/anastasis_database_plugin.h
b/src/include/anastasis_database_plugin.h
index 187dce0..8e673e9 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -106,25 +106,25 @@ struct AnastasisDatabasePlugin
(*gc)(void *cls,
struct GNUNET_TIME_Absolute fin_expire);
- /**
- * Do a pre-flight check that we are not in an uncommitted transaction.
- * If we are, try to commit the previous transaction and output a warning.
- * Does not return anything, as we will continue regardless of the outcome.
- *
- * @param cls the `struct PostgresClosure` with the plugin-specific state
- */
+ /**
+ * Do a pre-flight check that we are not in an uncommitted transaction.
+ * If we are, try to commit the previous transaction and output a warning.
+ * Does not return anything, as we will continue regardless of the outcome.
+ *
+ * @param cls the `struct PostgresClosure` with the plugin-specific state
+ */
void
(*preflight) (void *cls);
- /**
- * Roll back the current transaction of a database connection.
- *
- * @param cls the `struct PostgresClosure` with the plugin-specific state
- * @return #GNUNET_OK on success
- */
+ /**
+ * Roll back the current transaction of a database connection.
+ *
+ * @param cls the `struct PostgresClosure` with the plugin-specific state
+ * @return #GNUNET_OK on success
+ */
void
(*rollback) (void *cls);
-
+
/**
* Start a transaction.
*
@@ -133,7 +133,7 @@ struct AnastasisDatabasePlugin
*/
int
(*start) (void *cls);
-
+
/**
* Commit the current transaction of a database connection.
*
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index 7a366ca..2a9e25a 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -25,21 +25,23 @@
#include <gnunet/gnunet_curl_lib.h>
#include <jansson.h>
- */
-struct Anastasis_MERCHANT_Pay *
+*
+/ struct Anastasis_MERCHANT_Pay *
Anastasis_MERCHANT_pay_abort (struct GNUNET_CURL_Context *ctx,
- const char *merchant_url,
- const char *instance,
- const struct GNUNET_HashCode *h_contract,
- const struct Anastasis_Amount *amount,
- const struct Anastasis_Amount *max_fee,
- const struct Anastasis_MerchantPublicKeyP
*merchant_pub,
- const struct Anastasis_MerchantSignatureP
*merchant_sig,
- struct GNUNET_TIME_Absolute timestamp,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
- const struct GNUNET_HashCode *h_wire,
- const char *order_id,
+ const char *merchant_url,
+ const char *instance,
+ const struct GNUNET_HashCode *h_contract,
+ const struct Anastasis_Amount *amount,
+ const struct Anastasis_Amount *max_fee,
+ const struct
+ Anastasis_MerchantPublicKeyP *merchant_pub,
+ const struct
+ Anastasis_MerchantSignatureP *merchant_sig,
+ struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Absolute refund_deadline,
+ struct GNUNET_TIME_Absolute pay_deadline,
+ const struct GNUNET_HashCode *h_wire,
+ const char *order_id,
#endif /* _ANASTASIS_MERCHANT_SERVICE_H */
--
To stop receiving notification emails like this one, please contact
address@hidden.