summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-08-25 16:18:24 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-08-25 16:18:24 +0200
commiteb559970846f0fa27f1f25c482cd07210a56f4b1 (patch)
tree8526637825e520e1420b17515934ced794a33c01 /src/exchange
parent3742239c13001433eeade439a0e0490f07351c43 (diff)
downloadexchange-eb559970846f0fa27f1f25c482cd07210a56f4b1.tar.gz
exchange-eb559970846f0fa27f1f25c482cd07210a56f4b1.tar.bz2
exchange-eb559970846f0fa27f1f25c482cd07210a56f4b1.zip
re-format code
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-aggregator.c327
-rw-r--r--src/exchange/taler-exchange-httpd.c448
-rw-r--r--src/exchange/taler-exchange-httpd_db.c13
-rw-r--r--src/exchange/taler-exchange-httpd_db.h19
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c71
-rw-r--r--src/exchange/taler-exchange-httpd_keystate.c286
-rw-r--r--src/exchange/taler-exchange-httpd_keystate.h13
-rw-r--r--src/exchange/taler-exchange-httpd_mhd.c24
-rw-r--r--src/exchange/taler-exchange-httpd_parsing.c34
-rw-r--r--src/exchange/taler-exchange-httpd_payback.c64
-rw-r--r--src/exchange/taler-exchange-httpd_refresh_link.c25
-rw-r--r--src/exchange/taler-exchange-httpd_refresh_melt.c53
-rw-r--r--src/exchange/taler-exchange-httpd_refresh_reveal.c97
-rw-r--r--src/exchange/taler-exchange-httpd_refund.c102
-rw-r--r--src/exchange/taler-exchange-httpd_refund.h8
-rw-r--r--src/exchange/taler-exchange-httpd_reserve_status.c33
-rw-r--r--src/exchange/taler-exchange-httpd_reserve_withdraw.c48
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c327
-rw-r--r--src/exchange/taler-exchange-httpd_responses.h21
-rw-r--r--src/exchange/taler-exchange-httpd_test.c232
-rw-r--r--src/exchange/taler-exchange-httpd_test.h56
-rw-r--r--src/exchange/taler-exchange-httpd_track_transaction.c113
-rw-r--r--src/exchange/taler-exchange-httpd_track_transfer.c118
-rw-r--r--src/exchange/taler-exchange-httpd_validation.c2
-rw-r--r--src/exchange/taler-exchange-httpd_wire.c20
-rw-r--r--src/exchange/taler-exchange-wirewatch.c58
-rw-r--r--src/exchange/test_taler_exchange_aggregator.c112
-rw-r--r--src/exchange/test_taler_exchange_wirewatch.c63
28 files changed, 1552 insertions, 1235 deletions
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index 9b1c7e3ee..b84c837e5 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -287,7 +287,8 @@ static int reserves_idle;
* Note: do not change here, Postgres requires us to hard-code the
* LIMIT in the prepared statement.
*/
-static unsigned int aggregation_limit = TALER_EXCHANGEDB_MATCHING_DEPOSITS_LIMIT;
+static unsigned int aggregation_limit =
+ TALER_EXCHANGEDB_MATCHING_DEPOSITS_LIMIT;
@@ -347,13 +348,13 @@ update_fees (struct WireAccount *wa,
p = p->next)
{
qs = db_plugin->insert_wire_fee (db_plugin->cls,
- session,
- wa->wire_plugin->method,
- p->start_date,
- p->end_date,
- &p->wire_fee,
- &p->closing_fee,
- &p->master_sig);
+ session,
+ wa->wire_plugin->method,
+ p->start_date,
+ p->end_date,
+ &p->wire_fee,
+ &p->closing_fee,
+ &p->master_sig);
if (qs < 0)
{
TALER_EXCHANGEDB_fees_free (wa->af);
@@ -486,8 +487,9 @@ shutdown_task (void *cls)
{
if (NULL != wpd->eh)
{
- wpd->wa->wire_plugin->execute_wire_transfer_cancel (wpd->wa->wire_plugin->cls,
- wpd->eh);
+ wpd->wa->wire_plugin->execute_wire_transfer_cancel (
+ wpd->wa->wire_plugin->cls,
+ wpd->eh);
wpd->eh = NULL;
}
db_plugin->rollback (db_plugin->cls,
@@ -499,8 +501,9 @@ shutdown_task (void *cls)
{
if (NULL != au->ph)
{
- au->wa->wire_plugin->prepare_wire_transfer_cancel (au->wa->wire_plugin->cls,
- au->ph);
+ au->wa->wire_plugin->prepare_wire_transfer_cancel (
+ au->wa->wire_plugin->cls,
+ au->ph);
au->ph = NULL;
}
db_plugin->rollback (db_plugin->cls,
@@ -509,8 +512,9 @@ shutdown_task (void *cls)
}
if (NULL != ctc)
{
- ctc->wa->wire_plugin->prepare_wire_transfer_cancel (ctc->wa->wire_plugin->cls,
- ctc->ph);
+ ctc->wa->wire_plugin->prepare_wire_transfer_cancel (
+ ctc->wa->wire_plugin->cls,
+ ctc->ph);
ctc->ph = NULL;
db_plugin->rollback (db_plugin->cls,
ctc->session);
@@ -613,12 +617,12 @@ exchange_serve_process_config ()
*/
static int
refund_by_coin_cb (void *cls,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct TALER_MerchantSignatureP *merchant_sig,
- const struct GNUNET_HashCode *h_contract,
- uint64_t rtransaction_id,
- const struct TALER_Amount *amount_with_fee,
- const struct TALER_Amount *refund_fee)
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct TALER_MerchantSignatureP *merchant_sig,
+ const struct GNUNET_HashCode *h_contract,
+ uint64_t rtransaction_id,
+ const struct TALER_Amount *amount_with_fee,
+ const struct TALER_Amount *refund_fee)
{
struct AggregationUnit *aux = cls;
@@ -632,8 +636,8 @@ refund_by_coin_cb (void *cls,
return GNUNET_OK; /* different contract */
if (GNUNET_OK !=
TALER_amount_subtract (&aux->total_amount,
- &aux->total_amount,
- amount_with_fee))
+ &aux->total_amount,
+ amount_with_fee))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -680,17 +684,17 @@ deposit_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatally malformed record at row %llu over %s\n",
(unsigned long long) row_id,
- TALER_amount2s (amount_with_fee));
+ TALER_amount2s (amount_with_fee));
return GNUNET_DB_STATUS_HARD_ERROR;
}
au->row_id = row_id;
au->h_contract = h_contract_terms;
qs = db_plugin->select_refunds_by_coin (db_plugin->cls,
- au->session,
- coin_pub,
- &refund_by_coin_cb,
- au);
+ au->session,
+ coin_pub,
+ &refund_by_coin_cb,
+ au);
au->h_contract = NULL;
if (0 > qs)
{
@@ -738,8 +742,8 @@ deposit_cb (void *cls,
au->execution_time = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&au->execution_time);
qs = update_fees (au->wa,
- au->execution_time,
- au->session);
+ au->execution_time,
+ au->session);
if (qs <= 0)
{
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
@@ -750,17 +754,17 @@ deposit_cb (void *cls,
au->wire_fee = au->wa->af->wire_fee;
qs = db_plugin->insert_aggregation_tracking (db_plugin->cls,
- au->session,
- &au->wtid,
- row_id);
+ au->session,
+ &au->wtid,
+ row_id);
if (qs <= 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
qs = db_plugin->mark_deposit_done (db_plugin->cls,
- au->session,
- row_id);
+ au->session,
+ row_id);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -811,13 +815,13 @@ aggregate_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Fatally malformed record at %llu over amount %s\n",
(unsigned long long) row_id,
- TALER_amount2s (amount_with_fee));
+ TALER_amount2s (amount_with_fee));
return GNUNET_DB_STATUS_HARD_ERROR;
}
/* add to total */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding transaction amount %s to aggregation\n",
- TALER_amount2s (&delta));
+ "Adding transaction amount %s to aggregation\n",
+ TALER_amount2s (&delta));
if (GNUNET_OK !=
TALER_amount_add (&au->total_amount,
&au->total_amount,
@@ -832,10 +836,10 @@ aggregate_cb (void *cls,
au->h_contract = h_contract_terms;
qs = db_plugin->select_refunds_by_coin (db_plugin->cls,
- au->session,
- coin_pub,
- &refund_by_coin_cb,
- au);
+ au->session,
+ coin_pub,
+ &refund_by_coin_cb,
+ au);
au->h_contract = NULL;
if (0 > qs)
{
@@ -857,25 +861,25 @@ aggregate_cb (void *cls,
au->additional_rows[au->rows_offset++] = row_id;
/* insert into aggregation tracking table */
qs = db_plugin->insert_aggregation_tracking (db_plugin->cls,
- au->session,
- &au->wtid,
- row_id);
+ au->session,
+ &au->wtid,
+ row_id);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
qs = db_plugin->mark_deposit_done (db_plugin->cls,
- au->session,
- row_id);
+ au->session,
+ row_id);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
return qs;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Added row %llu with %s to aggregation\n",
- (unsigned long long) row_id,
+ "Added row %llu with %s to aggregation\n",
+ (unsigned long long) row_id,
TALER_amount2s (&delta));
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
}
@@ -958,8 +962,8 @@ commit_or_warn (struct TALER_EXCHANGEDB_Session *session)
*/
static void
prepare_close_cb (void *cls,
- const char *buf,
- size_t buf_size)
+ const char *buf,
+ size_t buf_size)
{
enum GNUNET_DB_QueryStatus qs;
@@ -984,10 +988,10 @@ prepare_close_cb (void *cls,
/* Commit our intention to execute the wire transfer! */
qs = db_plugin->wire_prepare_data_insert (db_plugin->cls,
- ctc->session,
- ctc->method,
- buf,
- buf_size);
+ ctc->session,
+ ctc->method,
+ buf,
+ buf_size);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
GNUNET_break (0);
@@ -1021,7 +1025,7 @@ prepare_close_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Reserve closure committed, running transfer\n");
task = GNUNET_SCHEDULER_add_now (&run_transfers,
- NULL);
+ NULL);
}
@@ -1059,10 +1063,10 @@ struct ExpiredReserveContext
*/
static enum GNUNET_DB_QueryStatus
expired_reserve_cb (void *cls,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- const struct TALER_Amount *left,
- const char *account_details,
- struct GNUNET_TIME_Absolute expiration_date)
+ const struct TALER_ReservePublicKeyP *reserve_pub,
+ const struct TALER_Amount *left,
+ const char *account_details,
+ struct GNUNET_TIME_Absolute expiration_date)
{
struct ExpiredReserveContext *erc = cls;
struct TALER_EXCHANGEDB_Session *session = erc->session;
@@ -1090,8 +1094,8 @@ expired_reserve_cb (void *cls,
/* lookup `closing_fee` */
qs = update_fees (wa,
- now,
- session);
+ now,
+ session);
if (qs <= 0)
{
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
@@ -1106,8 +1110,8 @@ expired_reserve_cb (void *cls,
/* calculate transfer amount */
ret = TALER_amount_subtract (&amount_without_fee,
- left,
- closing_fee);
+ left,
+ closing_fee);
if ( (GNUNET_SYSERR == ret) ||
(GNUNET_NO == ret) )
{
@@ -1122,21 +1126,21 @@ expired_reserve_cb (void *cls,
/* NOTE: sizeof (*reserve_pub) == sizeof (wtid) right now, but to
be future-compatible, we use the memset + min construction */
memset (&wtid,
- 0,
- sizeof (wtid));
+ 0,
+ sizeof (wtid));
memcpy (&wtid,
- reserve_pub,
- GNUNET_MIN (sizeof (wtid),
- sizeof (*reserve_pub)));
+ reserve_pub,
+ GNUNET_MIN (sizeof (wtid),
+ sizeof (*reserve_pub)));
qs = db_plugin->insert_reserve_closed (db_plugin->cls,
- session,
- reserve_pub,
- now,
- account_details,
- &wtid,
- left,
- closing_fee);
+ session,
+ reserve_pub,
+ now,
+ account_details,
+ &wtid,
+ left,
+ closing_fee);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Closing reserve %s over %s (%d, %d)\n",
@@ -1149,8 +1153,8 @@ expired_reserve_cb (void *cls,
{
/* success, perform wire transfer */
if (GNUNET_SYSERR ==
- wa->wire_plugin->amount_round (wa->wire_plugin->cls,
- &amount_without_fee))
+ wa->wire_plugin->amount_round (wa->wire_plugin->cls,
+ &amount_without_fee))
{
GNUNET_break (0);
global_ret = GNUNET_SYSERR;
@@ -1164,12 +1168,12 @@ expired_reserve_cb (void *cls,
ctc->ph
= wa->wire_plugin->prepare_wire_transfer (wa->wire_plugin->cls,
wa->section_name,
- account_details,
- &amount_without_fee,
- exchange_base_url,
- &wtid,
- &prepare_close_cb,
- ctc);
+ account_details,
+ &amount_without_fee,
+ exchange_base_url,
+ &wtid,
+ &prepare_close_cb,
+ ctc);
if (NULL == ctc->ph)
{
GNUNET_break (0);
@@ -1233,7 +1237,7 @@ run_reserve_closures (void *cls)
session);
if (GNUNET_OK !=
db_plugin->start (db_plugin->cls,
- session,
+ session,
"aggregator reserve closures"))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1247,10 +1251,10 @@ run_reserve_closures (void *cls)
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
qs = db_plugin->get_expired_reserves (db_plugin->cls,
- session,
- now,
- &expired_reserve_cb,
- &erc);
+ session,
+ now,
+ &expired_reserve_cb,
+ &erc);
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
@@ -1264,7 +1268,7 @@ run_reserve_closures (void *cls)
db_plugin->rollback (db_plugin->cls,
session);
task = GNUNET_SCHEDULER_add_now (&run_reserve_closures,
- NULL);
+ NULL);
return;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -1273,14 +1277,14 @@ run_reserve_closures (void *cls)
db_plugin->rollback (db_plugin->cls,
session);
task = GNUNET_SCHEDULER_add_now (&run_aggregation,
- NULL);
+ NULL);
return;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
if (GNUNET_YES == erc.async_cont)
break;
(void) commit_or_warn (session);
task = GNUNET_SCHEDULER_add_now (&run_reserve_closures,
- NULL);
+ NULL);
return;
}
}
@@ -1307,7 +1311,7 @@ run_aggregation (void *cls)
if (0 == (++swap % 2))
{
task = GNUNET_SCHEDULER_add_now (&run_reserve_closures,
- NULL);
+ NULL);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -1333,9 +1337,9 @@ run_aggregation (void *cls)
au = GNUNET_new (struct AggregationUnit);
au->session = session;
qs = db_plugin->get_ready_deposit (db_plugin->cls,
- session,
- &deposit_cb,
- au);
+ session,
+ &deposit_cb,
+ au);
if (0 >= qs)
{
cleanup_au ();
@@ -1354,7 +1358,7 @@ run_aggregation (void *cls)
/* should re-try immediately */
swap--; /* do not count failed attempts */
task = GNUNET_SCHEDULER_add_now (&run_aggregation,
- NULL);
+ NULL);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -1368,15 +1372,15 @@ run_aggregation (void *cls)
else
{
if ( (GNUNET_NO == reserves_idle) ||
- (GNUNET_YES == test_mode) )
- /* Possibly more to on reserves, go for it immediately */
- task = GNUNET_SCHEDULER_add_now (&run_reserve_closures,
- NULL);
+ (GNUNET_YES == test_mode) )
+ /* Possibly more to on reserves, go for it immediately */
+ task = GNUNET_SCHEDULER_add_now (&run_reserve_closures,
+ NULL);
else
- /* nothing to do, sleep for a minute and try again */
- task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
- &run_aggregation,
- NULL);
+ /* nothing to do, sleep for a minute and try again */
+ task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
+ &run_aggregation,
+ NULL);
}
return;
}
@@ -1386,12 +1390,12 @@ run_aggregation (void *cls)
"Found ready deposit for %s, aggregating\n",
TALER_B2S (&au->merchant_pub));
qs = db_plugin->iterate_matching_deposits (db_plugin->cls,
- session,
- &au->h_wire,
- &au->merchant_pub,
- &aggregate_cb,
- au,
- aggregation_limit);
+ session,
+ &au->h_wire,
+ &au->merchant_pub,
+ &aggregate_cb,
+ au,
+ aggregation_limit);
if ( (GNUNET_DB_STATUS_HARD_ERROR == qs) ||
(GNUNET_YES == au->failed) )
{
@@ -1412,7 +1416,7 @@ run_aggregation (void *cls)
db_plugin->rollback (db_plugin->cls,
session);
task = GNUNET_SCHEDULER_add_now (&run_aggregation,
- NULL);
+ NULL);
return;
}
@@ -1431,8 +1435,8 @@ run_aggregation (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Aggregate value too low for transfer (%d/%s)\n",
- qs,
- TALER_amount2s (&au->final_amount));
+ qs,
+ TALER_amount2s (&au->final_amount));
/* Rollback ongoing transaction, as we will not use the respective
WTID and thus need to remove the tracking data */
db_plugin->rollback (db_plugin->cls,
@@ -1454,35 +1458,35 @@ run_aggregation (void *cls)
}
/* Mark transactions by row_id as minor */
qs = db_plugin->mark_deposit_tiny (db_plugin->cls,
- session,
- au->row_id);
+ session,
+ au->row_id);
if (0 <= qs)
{
- for (unsigned int i=0;i<au->rows_offset;i++)
+ for (unsigned int i = 0; i<au->rows_offset; i++)
{
qs = db_plugin->mark_deposit_tiny (db_plugin->cls,
- session,
- au->additional_rows[i]);
- if (0 > qs)
- break;
+ session,
+ au->additional_rows[i]);
+ if (0 > qs)
+ break;
}
}
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Serialization issue, trying again later!\n");
+ "Serialization issue, trying again later!\n");
db_plugin->rollback (db_plugin->cls,
- session);
+ session);
cleanup_au ();
/* start again */
task = GNUNET_SCHEDULER_add_now (&run_aggregation,
- NULL);
+ NULL);
return;
}
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
db_plugin->rollback (db_plugin->cls,
- session);
+ session);
cleanup_au ();
GNUNET_SCHEDULER_shutdown ();
return;
@@ -1509,14 +1513,15 @@ run_aggregation (void *cls)
char *url;
url = TALER_JSON_wire_to_payto (au->wire);
- au->ph = au->wa->wire_plugin->prepare_wire_transfer (au->wa->wire_plugin->cls,
- au->wa->section_name,
- url,
- &au->final_amount,
- exchange_base_url,
- &au->wtid,
- &prepare_cb,
- au);
+ au->ph = au->wa->wire_plugin->prepare_wire_transfer (
+ au->wa->wire_plugin->cls,
+ au->wa->section_name,
+ url,
+ &au->final_amount,
+ exchange_base_url,
+ &au->wtid,
+ &prepare_cb,
+ au);
GNUNET_free (url);
}
if (NULL == au->ph)
@@ -1563,24 +1568,24 @@ prepare_cb (void *cls,
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Storing %u bytes of wire prepare data\n",
- (unsigned int) buf_size);
+ "Storing %u bytes of wire prepare data\n",
+ (unsigned int) buf_size);
/* Commit our intention to execute the wire transfer! */
qs = db_plugin->wire_prepare_data_insert (db_plugin->cls,
- session,
- au->wa->wire_plugin->method,
- buf,
- buf_size);
+ session,
+ au->wa->wire_plugin->method,
+ buf,
+ buf_size);
/* Commit the WTID data to 'wire_out' to finally satisfy aggregation
table constraints */
if (qs >= 0)
qs = db_plugin->store_wire_transfer_out (db_plugin->cls,
- session,
- au->execution_time,
- &au->wtid,
- au->wire,
+ session,
+ au->execution_time,
+ &au->wtid,
+ au->wire,
au->wa->section_name,
- &au->final_amount);
+ &au->final_amount);
cleanup_au ();
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
{
@@ -1672,8 +1677,8 @@ wire_confirm_cb (void *cls,
return;
}
qs = db_plugin->wire_prepare_data_mark_finished (db_plugin->cls,
- session,
- wpd->row_id);
+ session,
+ wpd->row_id);
if (0 >= qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@@ -1683,7 +1688,7 @@ wire_confirm_cb (void *cls,
{
/* try again */
task = GNUNET_SCHEDULER_add_now (&run_aggregation,
- NULL);
+ NULL);
}
else
{
@@ -1759,11 +1764,12 @@ wire_prepare_cb (void *cls,
wpd = NULL;
return;
}
- wpd->eh = wpd->wa->wire_plugin->execute_wire_transfer (wpd->wa->wire_plugin->cls,
- buf,
- buf_size,
- &wire_confirm_cb,
- NULL);
+ wpd->eh = wpd->wa->wire_plugin->execute_wire_transfer (
+ wpd->wa->wire_plugin->cls,
+ buf,
+ buf_size,
+ &wire_confirm_cb,
+ NULL);
if (NULL == wpd->eh)
{
GNUNET_break (0); /* why? how to best recover? */
@@ -1821,13 +1827,13 @@ run_transfers (void *cls)
wpd = GNUNET_new (struct WirePrepareData);
wpd->session = session;
qs = db_plugin->wire_prepare_data_get (db_plugin->cls,
- session,
- &wire_prepare_cb,
- NULL);
+ session,
+ &wire_prepare_cb,
+ NULL);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
return; /* continues in #wire_prepare_cb() */
db_plugin->rollback (db_plugin->cls,
- session);
+ session);
GNUNET_free (wpd);
wpd = NULL;
switch (qs)
@@ -1840,7 +1846,7 @@ run_transfers (void *cls)
case GNUNET_DB_STATUS_SOFT_ERROR:
/* try again */
task = GNUNET_SCHEDULER_add_now (&run_transfers,
- NULL);
+ NULL);
return;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
/* no more prepared wire transfers, go back to aggregation! */
@@ -1910,9 +1916,9 @@ main (int argc,
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_flag ('t',
- "test",
- "run in test mode and exit when idle",
- &test_mode),
+ "test",
+ "run in test mode and exit when idle",
+ &test_mode),
GNUNET_GETOPT_option_version (VERSION "-" VCS_VERSION),
GNUNET_GETOPT_OPTION_END
};
@@ -1923,7 +1929,8 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_PROGRAM_run (argc, argv,
"taler-exchange-aggregator",
- gettext_noop ("background process that aggregates and executes wire transfers to merchants"),
+ gettext_noop (
+ "background process that aggregates and executes wire transfers to merchants"),
options,
&run, NULL))
{
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index b30b19c3f..cfeaf0ee8 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -194,7 +194,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;
}
@@ -223,193 +223,191 @@ handle_mhd_request (void *cls,
size_t *upload_data_size,
void **con_cls)
{
- static struct TEH_RequestHandler handlers[] =
- {
- /* Landing page, tell humans to go away. */
- { "/", MHD_HTTP_METHOD_GET, "text/plain",
- "Hello, I'm the Taler exchange. This HTTP server is not for humans.\n", 0,
- &TEH_MHD_handler_static_response, MHD_HTTP_OK },
- /* /robots.txt: disallow everything */
- { "/robots.txt", MHD_HTTP_METHOD_GET, "text/plain",
- "User-agent: *\nDisallow: /\n", 0,
- &TEH_MHD_handler_static_response, MHD_HTTP_OK },
- /* AGPL licensing page, redirect to source. As per the AGPL-license,
- every deployment is required to offer the user a download of the
- source. We make this easy by including a redirect to the source
- here. */
- { "/agpl", MHD_HTTP_METHOD_GET, "text/plain",
- NULL, 0,
- &TEH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND },
-
- /* Return key material and fundamental properties for this exchange */
- { "/keys", MHD_HTTP_METHOD_GET, "application/json",
- NULL, 0,
- &TEH_KS_handler_keys, MHD_HTTP_OK },
- { "/keys", NULL, "text/plain",
- "Only GET is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- /* Requests for wiring information */
- { "/wire", MHD_HTTP_METHOD_GET, "application/json",
- NULL, 0,
- &TEH_WIRE_handler_wire, MHD_HTTP_OK },
- { "/wire", NULL, "text/plain",
- "Only GET is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- /* Withdrawing coins / interaction with reserves */
- { "/reserve/status", MHD_HTTP_METHOD_GET, "application/json",
- NULL, 0,
- &TEH_RESERVE_handler_reserve_status, MHD_HTTP_OK },
- { "/reserve/status", NULL, "text/plain",
- "Only GET is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/reserve/withdraw", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_RESERVE_handler_reserve_withdraw, MHD_HTTP_OK },
- { "/reserve/withdraw", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- /* Depositing coins */
- { "/deposit", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_DEPOSIT_handler_deposit, MHD_HTTP_OK },
- { "/deposit", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- /* Refunding coins */
- { "/refund", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_REFUND_handler_refund, MHD_HTTP_OK },
- { "/refund", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- /* Dealing with change */
- { "/refresh/melt", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_REFRESH_handler_refresh_melt, MHD_HTTP_OK },
- { "/refresh/melt", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/refresh/reveal", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_REFRESH_handler_refresh_reveal, MHD_HTTP_OK },
- { "/refresh/reveal", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/refresh/reveal", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_REFRESH_handler_refresh_reveal, MHD_HTTP_OK },
- { "/refresh/reveal", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/refresh/link", MHD_HTTP_METHOD_GET, "application/json",
- NULL, 0,
- &TEH_REFRESH_handler_refresh_link, MHD_HTTP_OK },
- { "/refresh/link", NULL, "text/plain",
- "Only GET is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/track/transfer", MHD_HTTP_METHOD_GET, "application/json",
- NULL, 0,
- &TEH_TRACKING_handler_track_transfer, MHD_HTTP_OK },
- { "/track/transfer", NULL, "text/plain",
- "Only GET is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
- { "/track/transaction", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_TRACKING_handler_track_transaction, MHD_HTTP_OK },
- { "/track/transaction", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/payback", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_PAYBACK_handler_payback, MHD_HTTP_OK },
- { "/refresh/link", NULL, "text/plain",
- "Only GET is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+ static struct TEH_RequestHandler handlers[] = {
+ /* Landing page, tell humans to go away. */
+ { "/", MHD_HTTP_METHOD_GET, "text/plain",
+ "Hello, I'm the Taler exchange. This HTTP server is not for humans.\n", 0,
+ &TEH_MHD_handler_static_response, MHD_HTTP_OK },
+ /* /robots.txt: disallow everything */
+ { "/robots.txt", MHD_HTTP_METHOD_GET, "text/plain",
+ "User-agent: *\nDisallow: /\n", 0,
+ &TEH_MHD_handler_static_response, MHD_HTTP_OK },
+ /* AGPL licensing page, redirect to source. As per the AGPL-license,
+ every deployment is required to offer the user a download of the
+ source. We make this easy by including a redirect to the source
+ here. */
+ { "/agpl", MHD_HTTP_METHOD_GET, "text/plain",
+ NULL, 0,
+ &TEH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND },
+
+ /* Return key material and fundamental properties for this exchange */
+ { "/keys", MHD_HTTP_METHOD_GET, "application/json",
+ NULL, 0,
+ &TEH_KS_handler_keys, MHD_HTTP_OK },
+ { "/keys", NULL, "text/plain",
+ "Only GET is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ /* Requests for wiring information */
+ { "/wire", MHD_HTTP_METHOD_GET, "application/json",
+ NULL, 0,
+ &TEH_WIRE_handler_wire, MHD_HTTP_OK },
+ { "/wire", NULL, "text/plain",
+ "Only GET is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ /* Withdrawing coins / interaction with reserves */
+ { "/reserve/status", MHD_HTTP_METHOD_GET, "application/json",
+ NULL, 0,
+ &TEH_RESERVE_handler_reserve_status, MHD_HTTP_OK },
+ { "/reserve/status", NULL, "text/plain",
+ "Only GET is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/reserve/withdraw", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_RESERVE_handler_reserve_withdraw, MHD_HTTP_OK },
+ { "/reserve/withdraw", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ /* Depositing coins */
+ { "/deposit", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_DEPOSIT_handler_deposit, MHD_HTTP_OK },
+ { "/deposit", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ /* Refunding coins */
+ { "/refund", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_REFUND_handler_refund, MHD_HTTP_OK },
+ { "/refund", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ /* Dealing with change */
+ { "/refresh/melt", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_REFRESH_handler_refresh_melt, MHD_HTTP_OK },
+ { "/refresh/melt", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/refresh/reveal", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_REFRESH_handler_refresh_reveal, MHD_HTTP_OK },
+ { "/refresh/reveal", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/refresh/reveal", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_REFRESH_handler_refresh_reveal, MHD_HTTP_OK },
+ { "/refresh/reveal", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/refresh/link", MHD_HTTP_METHOD_GET, "application/json",
+ NULL, 0,
+ &TEH_REFRESH_handler_refresh_link, MHD_HTTP_OK },
+ { "/refresh/link", NULL, "text/plain",
+ "Only GET is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/track/transfer", MHD_HTTP_METHOD_GET, "application/json",
+ NULL, 0,
+ &TEH_TRACKING_handler_track_transfer, MHD_HTTP_OK },
+ { "/track/transfer", NULL, "text/plain",
+ "Only GET is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+ { "/track/transaction", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_TRACKING_handler_track_transaction, MHD_HTTP_OK },
+ { "/track/transaction", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/payback", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_PAYBACK_handler_payback, MHD_HTTP_OK },
+ { "/refresh/link", NULL, "text/plain",
+ "Only GET is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
#if HAVE_DEVELOPER
- /* Client crypto-interoperability test functions */
- { "/test", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_TEST_handler_test, MHD_HTTP_OK },
- { "/test", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/test/base32", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_TEST_handler_test_base32, MHD_HTTP_OK },
- { "/test/base32", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/test/encrypt", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_TEST_handler_test_encrypt, MHD_HTTP_OK },
- { "/test/encrypt", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/test/hkdf", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_TEST_handler_test_hkdf, MHD_HTTP_OK },
- { "/test/hkdf", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/test/ecdhe", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_TEST_handler_test_ecdhe, MHD_HTTP_OK },
- { "/test/ecdhe", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/test/eddsa", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_TEST_handler_test_eddsa, MHD_HTTP_OK },
- { "/test/eddsa", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/test/rsa/get", MHD_HTTP_METHOD_GET, "application/json",
- NULL, 0,
- &TEH_TEST_handler_test_rsa_get, MHD_HTTP_OK },
- { "/test/rsa/get", NULL, "text/plain",
- "Only GET is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/test/rsa/sign", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_TEST_handler_test_rsa_sign, MHD_HTTP_OK },
- { "/test/rsa/sign", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
-
- { "/test/transfer", MHD_HTTP_METHOD_POST, "application/json",
- NULL, 0,
- &TEH_TEST_handler_test_transfer, MHD_HTTP_OK },
- { "/test/transfer", NULL, "text/plain",
- "Only POST is allowed", 0,
- &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+ /* Client crypto-interoperability test functions */
+ { "/test", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_TEST_handler_test, MHD_HTTP_OK },
+ { "/test", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/test/base32", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_TEST_handler_test_base32, MHD_HTTP_OK },
+ { "/test/base32", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/test/encrypt", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_TEST_handler_test_encrypt, MHD_HTTP_OK },
+ { "/test/encrypt", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/test/hkdf", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_TEST_handler_test_hkdf, MHD_HTTP_OK },
+ { "/test/hkdf", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/test/ecdhe", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_TEST_handler_test_ecdhe, MHD_HTTP_OK },
+ { "/test/ecdhe", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/test/eddsa", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_TEST_handler_test_eddsa, MHD_HTTP_OK },
+ { "/test/eddsa", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/test/rsa/get", MHD_HTTP_METHOD_GET, "application/json",
+ NULL, 0,
+ &TEH_TEST_handler_test_rsa_get, MHD_HTTP_OK },
+ { "/test/rsa/get", NULL, "text/plain",
+ "Only GET is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/test/rsa/sign", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_TEST_handler_test_rsa_sign, MHD_HTTP_OK },
+ { "/test/rsa/sign", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
+
+ { "/test/transfer", MHD_HTTP_METHOD_POST, "application/json",
+ NULL, 0,
+ &TEH_TEST_handler_test_transfer, MHD_HTTP_OK },
+ { "/test/transfer", NULL, "text/plain",
+ "Only POST is allowed", 0,
+ &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
#endif
- { NULL, NULL, NULL, NULL, 0, 0 }
- };
- static struct TEH_RequestHandler h404 =
- {
- "", NULL, "text/html",
- "<html><title>404: not found</title></html>", 0,
- &TEH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
- };
+ { NULL, NULL, NULL, NULL, 0, 0 }
+ };
+ static struct TEH_RequestHandler h404 = {
+ "", NULL, "text/html",
+ "<html><title>404: not found</title></html>", 0,
+ &TEH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
+ };
struct TEH_RequestHandler *rh;
struct ExchangeHttpRequestClosure *ecls = *con_cls;
int ret;
@@ -430,8 +428,9 @@ handle_mhd_request (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;
}
}
@@ -452,7 +451,7 @@ handle_mhd_request (void *cls,
if (0 == strcasecmp (method,
MHD_HTTP_METHOD_HEAD))
method = MHD_HTTP_METHOD_GET; /* treat HEAD as GET here, MHD will do the rest */
- for (unsigned int i=0;NULL != handlers[i].url;i++)
+ for (unsigned int i = 0; NULL != handlers[i].url; i++)
{
rh = &handlers[i];
if ( (0 == strcasecmp (url,
@@ -675,8 +674,10 @@ exchange_serve_process_config ()
}
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_public_key_from_string (TEH_master_public_key_str,
- strlen (TEH_master_public_key_str),
- &TEH_master_public_key.eddsa_pub))
+ strlen (
+ TEH_master_public_key_str),
+ &TEH_master_public_key.
+ eddsa_pub))
{
fprintf (stderr,
"Invalid master public key given in exchange configuration.");
@@ -764,7 +765,7 @@ run_fake_client ()
sizeof (ports),
"%u",
serve_port);
- if (0 == (cld = fork()))
+ if (0 == (cld = fork ()))
{
GNUNET_break (0 == close (0));
GNUNET_break (0 == dup2 (fd, 0));
@@ -824,7 +825,7 @@ connection_done (void *cls,
if (NULL == input_filename)
return;
/* We signal ourselves to terminate. */
- if (0 != kill (getpid(),
+ if (0 != kill (getpid (),
SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
"kill");
@@ -992,21 +993,24 @@ write_stats ()
(unsigned long long) pid);
fh = GNUNET_DISK_file_open (s,
- (GNUNET_DISK_OPEN_WRITE |
- GNUNET_DISK_OPEN_TRUNCATE |
- GNUNET_DISK_OPEN_CREATE),
- (GNUNET_DISK_PERM_USER_READ |
- GNUNET_DISK_PERM_USER_WRITE));
+ (GNUNET_DISK_OPEN_WRITE
+ | GNUNET_DISK_OPEN_TRUNCATE
+ | GNUNET_DISK_OPEN_CREATE),
+ (GNUNET_DISK_PERM_USER_READ
+ | GNUNET_DISK_PERM_USER_WRITE));
GNUNET_assert (NULL != fh);
GNUNET_free (s);
/* Collect stats, summed up for all threads */
- GNUNET_assert (0 == getrusage(RUSAGE_SELF, &usage));
+ GNUNET_assert (0 == getrusage (RUSAGE_SELF, &usage));
GNUNET_asprintf (&s, "time_exchange sys %llu user %llu\n", \
- (unsigned long long) (usage.ru_stime.tv_sec * 1000 * 1000 + usage.ru_stime.tv_usec),
- (unsigned long long) (usage.ru_utime.tv_sec * 1000 * 1000 + usage.ru_utime.tv_usec));
- GNUNET_assert (GNUNET_SYSERR != GNUNET_DISK_file_write_blocking (fh, s, strlen (s)));
+ (unsigned long long) (usage.ru_stime.tv_sec * 1000 * 1000
+ + usage.ru_stime.tv_usec),
+ (unsigned long long) (usage.ru_utime.tv_sec * 1000 * 1000
+ + usage.ru_utime.tv_usec));
+ GNUNET_assert (GNUNET_SYSERR != GNUNET_DISK_file_write_blocking (fh, s,
+ strlen (s)));
GNUNET_free (s);
GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
@@ -1038,19 +1042,20 @@ main (int argc,
"init-db",
"create database tables and indicies if necessary",
&init_db),
- GNUNET_GETOPT_option_uint ('t',
- "timeout",
- "SECONDS",
- "after how long do connections timeout by default (in seconds)",
- &connection_timeout),
+ GNUNET_GETOPT_option_uint ('t',
+ "timeout",
+ "SECONDS",
+ "after how long do connections timeout by default (in seconds)",
+ &connection_timeout),
#if HAVE_DEVELOPER
- GNUNET_GETOPT_option_filename ('f',
- "file-input",
- "FILENAME",
- "run in test-mode using FILENAME as the HTTP request to process",
- &input_filename),
+ GNUNET_GETOPT_option_filename ('f',
+ "file-input",
+ "FILENAME",
+ "run in test-mode using FILENAME as the HTTP request to process",
+ &input_filename),
#endif
- GNUNET_GETOPT_option_help ("HTTP server providing a RESTful API to access a Taler exchange"),
+ GNUNET_GETOPT_option_help (
+ "HTTP server providing a RESTful API to access a Taler exchange"),
GNUNET_GETOPT_option_loglevel (&loglev),
GNUNET_GETOPT_option_logfile (&logfile),
GNUNET_GETOPT_option_version (VERSION "-" VCS_VERSION),
@@ -1077,7 +1082,7 @@ main (int argc,
GNUNET_CONFIGURATION_load (cfg, cfgfile))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Malformed configuration file `%s', exit ...\n"),
+ _ ("Malformed configuration file `%s', exit ...\n"),
cfgfile);
GNUNET_free_non_null (cfgfile);
return 1;
@@ -1092,9 +1097,9 @@ main (int argc,
listen_fds = getenv ("LISTEN_FDS");
if ( (NULL != listen_pid) &&
(NULL != listen_fds) &&
- (getpid() == strtol (listen_pid,
- NULL,
- 10)) &&
+ (getpid () == strtol (listen_pid,
+ NULL,
+ 10)) &&
(1 == strtoul (listen_fds,
NULL,
10)) )
@@ -1131,7 +1136,10 @@ main (int argc,
}
mhd
- = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_PIPE_FOR_SHUTDOWN | MHD_USE_DEBUG | MHD_USE_DUAL_STACK | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TCP_FASTOPEN,
+ = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_PIPE_FOR_SHUTDOWN
+ | MHD_USE_DEBUG | MHD_USE_DUAL_STACK
+ | MHD_USE_INTERNAL_POLLING_THREAD
+ | MHD_USE_TCP_FASTOPEN,
(-1 == fh) ? serve_port : 0,
NULL, NULL,
&handle_mhd_request, NULL,
@@ -1139,7 +1147,8 @@ main (int argc,
MHD_OPTION_LISTEN_BACKLOG_SIZE, (unsigned int) 1024,
MHD_OPTION_LISTEN_SOCKET, fh,
MHD_OPTION_EXTERNAL_LOGGER, &handle_mhd_logs, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, &handle_mhd_completion_callback, NULL,
+ MHD_OPTION_NOTIFY_COMPLETED,
+ &handle_mhd_completion_callback, NULL,
MHD_OPTION_CONNECTION_TIMEOUT, connection_timeout,
#if HAVE_DEVELOPER
MHD_OPTION_NOTIFY_CONNECTION, &connection_done, NULL,
@@ -1225,7 +1234,8 @@ main (int argc,
close it here */
GNUNET_break (0 == close (sock));
while (0 != MHD_get_daemon_info (mhd,
- MHD_DAEMON_INFO_CURRENT_CONNECTIONS)->num_connections)
+ MHD_DAEMON_INFO_CURRENT_CONNECTIONS)->
+ num_connections)
sleep (1);
/* Now we're really done, practice clean shutdown */
MHD_stop_daemon (mhd);
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c
index 3b9dc36b5..37bd23792 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -105,7 +105,8 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
}
TEH_plugin->preflight (TEH_plugin->cls,
session);
- for (unsigned int retries = 0;retries < MAX_TRANSACTION_COMMIT_RETRIES; retries++)
+ for (unsigned int retries = 0; retries < MAX_TRANSACTION_COMMIT_RETRIES;
+ retries++)
{
enum GNUNET_DB_QueryStatus qs;
@@ -131,7 +132,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
return GNUNET_SYSERR;
if (0 <= qs)
qs = TEH_plugin->commit (TEH_plugin->cls,
- session);
+ session);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
if (NULL != mhd_ret)
@@ -150,7 +151,7 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
MAX_TRANSACTION_COMMIT_RETRIES);
if (NULL != mhd_ret)
*mhd_ret = TEH_RESPONSE_reply_commit_error (connection,
- TALER_EC_DB_COMMIT_FAILED_ON_RETRY);
+ TALER_EC_DB_COMMIT_FAILED_ON_RETRY);
return GNUNET_SYSERR;
}
@@ -167,7 +168,8 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
*/
// FIXME: maybe move to another module, i.e. exchangedb???
int
-TEH_DB_calculate_transaction_list_totals (struct TALER_EXCHANGEDB_TransactionList *tl,
+TEH_DB_calculate_transaction_list_totals (struct
+ TALER_EXCHANGEDB_TransactionList *tl,
const struct TALER_Amount *off,
struct TALER_Amount *ret)
{
@@ -177,7 +179,8 @@ TEH_DB_calculate_transaction_list_totals (struct TALER_EXCHANGEDB_TransactionLis
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (spent.currency,
&refunded));
- for (struct TALER_EXCHANGEDB_TransactionList *pos = tl; NULL != pos; pos = pos->next)
+ for (struct TALER_EXCHANGEDB_TransactionList *pos = tl; NULL != pos; pos =
+ pos->next)
{
switch (pos->type)
{
diff --git a/src/exchange/taler-exchange-httpd_db.h b/src/exchange/taler-exchange-httpd_db.h
index 091421bb4..c63b3668b 100644
--- a/src/exchange/taler-exchange-httpd_db.h
+++ b/src/exchange/taler-exchange-httpd_db.h
@@ -80,9 +80,9 @@ TEH_DB_know_coin_transaction (void *cls,
*/
typedef enum GNUNET_DB_QueryStatus
(*TEH_DB_TransactionCallback)(void *cls,
- struct MHD_Connection *connection,
- struct TALER_EXCHANGEDB_Session *session,
- int *mhd_ret);
+ struct MHD_Connection *connection,
+ struct TALER_EXCHANGEDB_Session *session,
+ int *mhd_ret);
/**
@@ -102,9 +102,9 @@ typedef enum GNUNET_DB_QueryStatus
int
TEH_DB_run_transaction (struct MHD_Connection *connection,
const char *name,
- int *mhd_ret,
- TEH_DB_TransactionCallback cb,
- void *cb_cls);
+ int *mhd_ret,
+ TEH_DB_TransactionCallback cb,
+ void *cb_cls);
/**
@@ -119,9 +119,10 @@ TEH_DB_run_transaction (struct MHD_Connection *connection,
*/
// FIXME: maybe move to another module, i.e. exchangedb???
int
-TEH_DB_calculate_transaction_list_totals (struct TALER_EXCHANGEDB_TransactionList *tl,
- const struct TALER_Amount *off,
- struct TALER_Amount *ret);
+TEH_DB_calculate_transaction_list_totals (struct
+ TALER_EXCHANGEDB_TransactionList *tl,
+ const struct TALER_Amount *off,
+ struct TALER_Amount *ret);
#endif
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index c19ad4b1e..9e96dfd81 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -56,13 +56,13 @@
*/
static int
reply_deposit_success (struct MHD_Connection *connection,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct GNUNET_HashCode *h_wire,
- const struct GNUNET_HashCode *h_contract_terms,
- struct GNUNET_TIME_Absolute timestamp,
- struct GNUNET_TIME_Absolute refund_deadline,
- const struct TALER_MerchantPublicKeyP *merchant,
- const struct TALER_Amount *amount_without_fee)
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct GNUNET_HashCode *h_wire,
+ const struct GNUNET_HashCode *h_contract_terms,
+ struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Absolute refund_deadline,
+ const struct TALER_MerchantPublicKeyP *merchant,
+ const struct TALER_Amount *amount_without_fee)
{
struct TALER_DepositConfirmationPS dc;
struct TALER_ExchangePublicKeyP pub;
@@ -92,7 +92,8 @@ reply_deposit_success (struct MHD_Connection *connection,
"{s:s, s:o, s:o}",
"status", "DEPOSIT_OK",
"sig", GNUNET_JSON_from_data_auto (&sig),
- "pub", GNUNET_JSON_from_data_auto (&pub));
+ "pub", GNUNET_JSON_from_data_auto (
+ &pub));
}
@@ -197,7 +198,7 @@ deposit_transaction (void *cls,
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_DEPOSIT_HISTORY_DB_ERROR);
+ TALER_EC_DEPOSIT_HISTORY_DB_ERROR);
return GNUNET_DB_STATUS_HARD_ERROR;
}
/* Check that cost of all transactions is smaller than
@@ -206,10 +207,10 @@ deposit_transaction (void *cls,
&dc->value))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Deposited coin has insufficient funds left!\n");
+ "Deposited coin has insufficient funds left!\n");
*mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (connection,
- TALER_EC_DEPOSIT_INSUFFICIENT_FUNDS,
- tl);
+ TALER_EC_DEPOSIT_INSUFFICIENT_FUNDS,
+ tl);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
return GNUNET_DB_STATUS_HARD_ERROR;
@@ -223,7 +224,7 @@ deposit_transaction (void *cls,
{
TALER_LOG_WARNING ("Failed to store /deposit information in database\n");
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_DEPOSIT_STORE_DB_ERROR);
+ TALER_EC_DEPOSIT_STORE_DB_ERROR);
}
return qs;
}
@@ -291,7 +292,7 @@ verify_and_execute_deposit (struct MHD_Connection *connection,
{
TEH_KS_release (mks);
return TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_DEPOSIT_DB_DENOMINATION_KEY_UNKNOWN);
+ TALER_EC_DEPOSIT_DB_DENOMINATION_KEY_UNKNOWN);
}
TALER_amount_ntoh (&dc.value,
&dki->issue.properties.value);
@@ -341,20 +342,20 @@ check_timestamp_current (struct GNUNET_TIME_Absolute ts)
if (r.rel_value_us > tolerance.rel_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Deposit timestamp too old: %llu vs %llu > %llu\n",
- (unsigned long long) ts.abs_value_us,
- (unsigned long long) GNUNET_TIME_absolute_get().abs_value_us,
- (unsigned long long) tolerance.rel_value_us);
+ "Deposit timestamp too old: %llu vs %llu > %llu\n",
+ (unsigned long long) ts.abs_value_us,
+ (unsigned long long) GNUNET_TIME_absolute_get ().abs_value_us,
+ (unsigned long long) tolerance.rel_value_us);
return GNUNET_SYSERR;
}
r = GNUNET_TIME_absolute_get_remaining (ts);
if (r.rel_value_us > tolerance.rel_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Deposit timestamp too new: %llu vs %llu < - %llu\n",
- (unsigned long long) ts.abs_value_us,
- (unsigned long long) GNUNET_TIME_absolute_get().abs_value_us,
- (unsigned long long) tolerance.rel_value_us);
+ "Deposit timestamp too new: %llu vs %llu < - %llu\n",
+ (unsigned long long) ts.abs_value_us,
+ (unsigned long long) GNUNET_TIME_absolute_get ().abs_value_us,
+ (unsigned long long) tolerance.rel_value_us);
return GNUNET_SYSERR;
}
return GNUNET_OK;
@@ -394,7 +395,8 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_json ("wire", &wire),
TALER_JSON_spec_amount ("contribution", &deposit.amount_with_fee),
- GNUNET_JSON_spec_fixed_auto ("denom_pub_hash", &deposit.coin.denom_pub_hash),
+ GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
+ &deposit.coin.denom_pub_hash),
TALER_JSON_spec_denomination_signature ("ub_sig", &deposit.coin.denom_sig),
GNUNET_JSON_spec_fixed_auto ("coin_pub", &deposit.coin.coin_pub),
GNUNET_JSON_spec_fixed_auto ("merchant_pub", &deposit.merchant_pub),
@@ -402,8 +404,10 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
GNUNET_JSON_spec_fixed_auto ("H_wire", &deposit.h_wire),
GNUNET_JSON_spec_fixed_auto ("coin_sig", &deposit.csig),
GNUNET_JSON_spec_absolute_time ("timestamp", &deposit.timestamp),
- GNUNET_JSON_spec_absolute_time ("refund_deadline", &deposit.refund_deadline),
- GNUNET_JSON_spec_absolute_time ("wire_transfer_deadline", &deposit.wire_deadline),
+ GNUNET_JSON_spec_absolute_time ("refund_deadline",
+ &deposit.refund_deadline),
+ GNUNET_JSON_spec_absolute_time ("wire_transfer_deadline",
+ &deposit.wire_deadline),
GNUNET_JSON_spec_end ()
};
@@ -435,7 +439,7 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE,
+ TALER_EC_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE,
"refund_deadline");
}
@@ -456,17 +460,18 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_DEPOSIT_INVALID_TIMESTAMP,
+ TALER_EC_DEPOSIT_INVALID_TIMESTAMP,
"timestamp");
}
if (GNUNET_OK !=
TALER_JSON_merchant_wire_signature_hash (wire,
&my_h_wire))
{
- TALER_LOG_WARNING ("Failed to parse JSON wire format specification for /deposit request\n");
+ TALER_LOG_WARNING (
+ "Failed to parse JSON wire format specification for /deposit request\n");
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_JSON,
+ TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_JSON,
"wire");
}
if (0 != GNUNET_memcmp (&deposit.h_wire,
@@ -475,7 +480,7 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
/* Client hashed contract differently than we did, reject */
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT,
+ TALER_EC_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT,
"H_wire");
}
@@ -499,7 +504,7 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
TALER_LOG_WARNING ("Unknown denomination key in /deposit request\n");
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_arg_unknown (connection,
- TALER_EC_DEPOSIT_DENOMINATION_KEY_UNKNOWN,
+ TALER_EC_DEPOSIT_DENOMINATION_KEY_UNKNOWN,
"denom_pub");
}
TALER_amount_ntoh (&deposit.deposit_fee,
@@ -513,7 +518,7 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
TEH_KS_release (key_state);
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_signature_invalid (connection,
- TALER_EC_DEPOSIT_DENOMINATION_SIGNATURE_INVALID,
+ TALER_EC_DEPOSIT_DENOMINATION_SIGNATURE_INVALID,
"ub_sig");
}
TALER_amount_ntoh (&deposit.deposit_fee,
@@ -526,7 +531,7 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_external_error (connection,
- TALER_EC_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE,
+ TALER_EC_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE,
"deposited amount smaller than depositing fee");
}
diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c
index 2252622d7..3c4e0e2a3 100644
--- a/src/exchange/taler-exchange-httpd_keystate.c
+++ b/src/exchange/taler-exchange-httpd_keystate.c
@@ -364,7 +364,7 @@ destroy_response_factory (struct ResponseFactoryContext *rfc)
json_decref (rfc->sign_keys_array);
rfc->sign_keys_array = NULL;
}
- for (unsigned int i=0;i<rfc->denomkey_array_length;i++)
+ for (unsigned int i = 0; i<rfc->denomkey_array_length; i++)
{
struct DenominationKeyEntry *dke = &rfc->denomkey_array[i];
struct AuditorSignature *as;
@@ -438,9 +438,9 @@ ks_release (struct TEH_KS_StateHandle *key_state)
{
GNUNET_assert (0 < key_state->refcnt);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "KS release called (%p/%d)\n",
- key_state,
- key_state->refcnt);
+ "KS release called (%p/%d)\n",
+ key_state,
+ key_state->refcnt);
key_state->refcnt--;
if (0 == key_state->refcnt)
{
@@ -460,7 +460,7 @@ ks_release (struct TEH_KS_StateHandle *key_state)
GNUNET_CONTAINER_multihashmap_destroy (key_state->revoked_map);
key_state->revoked_map = NULL;
}
- for (unsigned int i=0;i<key_state->krd_array_length;i++)
+ for (unsigned int i = 0; i<key_state->krd_array_length; i++)
{
struct KeysResponseData *krd = &key_state->krd_array[i];
@@ -527,7 +527,8 @@ handle_signal (int signal_number)
*/
static json_t *
denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk,
- const struct TALER_EXCHANGEDB_DenominationKeyInformationP *dki)
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP *dki)
{
struct TALER_Amount value;
struct TALER_Amount fee_withdraw;
@@ -550,13 +551,17 @@ denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk,
"master_sig",
GNUNET_JSON_from_data_auto (&dki->signature),
"stamp_start",
- GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (dki->properties.start)),
+ GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (
+ dki->properties.start)),
"stamp_expire_withdraw",
- GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (dki->properties.expire_withdraw)),
+ GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (
+ dki->properties.expire_withdraw)),
"stamp_expire_deposit",
- GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (dki->properties.expire_deposit)),
+ GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (
+ dki->properties.expire_deposit)),
"stamp_expire_legal",
- GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (dki->properties.expire_legal)),
+ GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (
+ dki->properties.expire_legal)),
"denom_pub",
GNUNET_JSON_from_rsa_public_key (pk->rsa_public_key),
"value",
@@ -582,7 +587,8 @@ denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk,
*/
static int
store_in_map (struct GNUNET_CONTAINER_MultiHashMap *map,
- const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
{
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *d2;
int res;
@@ -599,10 +605,11 @@ store_in_map (struct GNUNET_CONTAINER_MultiHashMap *map,
= htonl (sizeof (struct TALER_DenominationKeyValidityPS));
denom_key_issue.master = TEH_master_public_key;
if (GNUNET_SYSERR ==
- GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY,
- &denom_key_issue.purpose,
- &dkip->signature.eddsa_signature,
- &TEH_master_public_key.eddsa_pub))
+ GNUNET_CRYPTO_eddsa_verify (
+ TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY,
+ &denom_key_issue.purpose,
+ &dkip->signature.eddsa_signature,
+ &TEH_master_public_key.eddsa_pub))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid signature on denomination key `%s'\n",
@@ -610,7 +617,7 @@ store_in_map (struct GNUNET_CONTAINER_MultiHashMap *map,
return GNUNET_SYSERR;
}
}
-
+
d2 = GNUNET_new (struct TALER_EXCHANGEDB_DenominationKeyIssueInformation);
d2->issue = dki->issue;
if (NULL != dki->denom_priv.rsa_private_key)
@@ -692,9 +699,9 @@ TALER_EXCHANGE_conf_duration_provide ()
*/
static enum GNUNET_DB_QueryStatus
add_revocations_transaction (void *cls,
- struct MHD_Connection *connection,
- struct TALER_EXCHANGEDB_Session *session,
- int *mhd_ret)
+ struct MHD_Connection *connection,
+ struct TALER_EXCHANGEDB_Session *session,
+ int *mhd_ret)
{
struct AddRevocationContext *arc = cls;
enum GNUNET_DB_QueryStatus qs;
@@ -703,7 +710,8 @@ add_revocations_transaction (void *cls,
qs = TEH_plugin->get_denomination_revocation (TEH_plugin->cls,
session,
- &arc->dki->issue.properties.denom_hash,
+ &arc->dki->issue.properties.
+ denom_hash,
&master_sig,
&rowid);
if (0 > qs)
@@ -712,7 +720,8 @@ add_revocations_transaction (void *cls,
return qs; /* already exists == success */
return TEH_plugin->insert_denomination_revocation (TEH_plugin->cls,
session,
- &arc->dki->issue.properties.denom_hash,
+ &arc->dki->issue.properties
+ .denom_hash,
arc->revocation_master_sig);
}
@@ -764,7 +773,8 @@ add_denomination_transaction (void *cls,
static int
reload_keys_denom_iter (void *cls,
const char *alias,
- const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
{
struct ResponseFactoryContext *rfc = cls;
struct TEH_KS_StateHandle *key_state = rfc->key_state;
@@ -776,7 +786,8 @@ reload_keys_denom_iter (void *cls,
"Loading denomination key `%s' (%s)\n",
alias,
GNUNET_h2s (&dki->issue.properties.denom_hash));
- expire_deposit = GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_deposit);
+ expire_deposit = GNUNET_TIME_absolute_ntoh (
+ dki->issue.properties.expire_deposit);
if (expire_deposit.abs_value_us < rfc->now.abs_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -846,8 +857,8 @@ reload_keys_denom_iter (void *cls,
*/
static int
revocations_iter (void *cls,
- const struct GNUNET_HashCode *denom_hash,
- const struct TALER_MasterSignatureP *revocation_master_sig)
+ const struct GNUNET_HashCode *denom_hash,
+ const struct TALER_MasterSignatureP *revocation_master_sig)
{
struct ResponseFactoryContext *rfc = cls;
struct TEH_KS_StateHandle *key_state = rfc->key_state;
@@ -855,7 +866,7 @@ revocations_iter (void *cls,
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
dki = GNUNET_CONTAINER_multihashmap_get (key_state->denomkey_map,
- denom_hash);
+ denom_hash);
if (NULL == dki)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -865,15 +876,16 @@ revocations_iter (void *cls,
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Adding denomination key `%s' to revocation set\n",
- GNUNET_h2s (denom_hash));
+ "Adding denomination key `%s' to revocation set\n",
+ GNUNET_h2s (denom_hash));
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (key_state->denomkey_map,
denom_hash,
dki));
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_put (key_state->revoked_map,
- &dki->issue.properties.denom_hash,
+ &dki->issue.properties.
+ denom_hash,
dki,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
/* Try to insert revocation into DB */
@@ -881,19 +893,20 @@ revocations_iter (void *cls,
arc.revocation_master_sig = revocation_master_sig;
if (GNUNET_OK !=
TEH_DB_run_transaction (NULL,
- "add denomination key revocation",
- NULL,
- &add_revocations_transaction,
- &arc))
+ "add denomination key revocation",
+ NULL,
+ &add_revocations_transaction,
+ &arc))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to add revocation to database. This is fatal. Committing suicide via SIGTERM.\n");
+ "Failed to add revocation to database. This is fatal. Committing suicide via SIGTERM.\n");
handle_signal (SIGTERM);
return GNUNET_SYSERR;
}
GNUNET_assert (0 ==
- json_array_append_new (rfc->payback_array,
- GNUNET_JSON_from_data_auto (denom_hash)));
+ json_array_append_new (rfc->payback_array,
+ GNUNET_JSON_from_data_auto (
+ denom_hash)));
return GNUNET_OK;
}
@@ -912,9 +925,11 @@ sign_key_issue_to_json (const struct TALER_ExchangeSigningKeyValidityPS *ski,
return
json_pack ("{s:o, s:o, s:o, s:o, s:o}",
"stamp_start",
- GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (ski->start)),
+ GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (
+ ski->start)),
"stamp_expire",
- GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (ski->expire)),
+ GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (
+ ski->expire)),
"stamp_end",
GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (ski->end)),
"master_sig",
@@ -940,14 +955,16 @@ sign_key_issue_to_json (const struct TALER_ExchangeSigningKeyValidityPS *ski,
static int
reload_keys_sign_iter (void *cls,
const char *filename,
- const struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP *ski)
+ const struct
+ TALER_EXCHANGEDB_PrivateSigningKeyInformationP *ski)
{
struct ResponseFactoryContext *rfc = cls;
struct TEH_KS_StateHandle *key_state = rfc->key_state;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute horizon;
- horizon = GNUNET_TIME_relative_to_absolute (TALER_EXCHANGE_conf_duration_provide ());
+ horizon = GNUNET_TIME_relative_to_absolute (
+ TALER_EXCHANGE_conf_duration_provide ());
if (GNUNET_TIME_absolute_ntoh (ski->issue.start).abs_value_us >
horizon.abs_value_us)
{
@@ -977,7 +994,8 @@ reload_keys_sign_iter (void *cls,
/* The signkey is valid at this time, check if it's more recent than
what we have so far! */
- if ( (GNUNET_TIME_absolute_ntoh (key_state->current_sign_key_issue.issue.start).abs_value_us <
+ if ( (GNUNET_TIME_absolute_ntoh (
+ key_state->current_sign_key_issue.issue.start).abs_value_us <
GNUNET_TIME_absolute_ntoh (ski->issue.start).abs_value_us) &&
(GNUNET_TIME_absolute_ntoh (ski->issue.start).abs_value_us <
now.abs_value_us) )
@@ -1034,7 +1052,7 @@ reload_auditor_iter (void *cls,
}
/* Filter the auditor information for those for which the
keys actually match the denomination keys that are active right now */
- for (unsigned int i=0;i<dki_len;i++)
+ for (unsigned int i = 0; i<dki_len; i++)
{
int matched;
@@ -1043,26 +1061,26 @@ reload_auditor_iter (void *cls,
&dki[i].denom_hash))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Found auditor signature for DK `%s', but key is not in active map\n",
- GNUNET_h2s (&dki[i].denom_hash));
+ "Found auditor signature for DK `%s', but key is not in active map\n",
+ GNUNET_h2s (&dki[i].denom_hash));
continue;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Found auditor signature for DK `%s'\n",
- GNUNET_h2s (&dki[i].denom_hash));
+ "Found auditor signature for DK `%s'\n",
+ GNUNET_h2s (&dki[i].denom_hash));
/* Note: the array is sorted, we could theoretically
speed this up using a binary search. */
matched = GNUNET_NO;
- for (unsigned int j=0;j<rfc->denomkey_array_length;j++)
+ for (unsigned int j = 0; j<rfc->denomkey_array_length; j++)
{
struct DenominationKeyEntry *dke = &rfc->denomkey_array[j];
struct AuditorSignature *as;
if (0 !=
- memcmp (&dki[i].denom_hash,
- &dke->dki->issue.properties.denom_hash,
- sizeof (struct GNUNET_HashCode)))
- continue;
+ memcmp (&dki[i].denom_hash,
+ &dke->dki->issue.properties.denom_hash,
+ sizeof (struct GNUNET_HashCode)))
+ continue;
if (0 !=
memcmp (&dki[i],
&dke->dki->issue.properties,
@@ -1072,8 +1090,8 @@ reload_auditor_iter (void *cls,
GNUNET_break (0);
continue;
}
- as = GNUNET_malloc (sizeof (struct AuditorSignature) +
- strlen (auditor_url) + 1);
+ as = GNUNET_malloc (sizeof (struct AuditorSignature)
+ + strlen (auditor_url) + 1);
as->asig = asigs[i];
as->apub = *apub;
as->auditor_url = (const char *) &as[1];
@@ -1090,8 +1108,8 @@ reload_auditor_iter (void *cls,
{
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "DK `%s' is in active map, but not in array!?\n",
- GNUNET_h2s (&dki[i].denom_hash));
+ "DK `%s' is in active map, but not in array!?\n",
+ GNUNET_h2s (&dki[i].denom_hash));
}
}
return GNUNET_OK;
@@ -1147,7 +1165,7 @@ denomkey_array_sort_comparator (const void *k1,
if (d1.abs_value_us < d2.abs_value_us)
return -1;
if (d1.abs_value_us > d2.abs_value_us)
- return 1;
+ return 1;
return 0;
}
@@ -1164,15 +1182,15 @@ get_date_string (struct GNUNET_TIME_Absolute at,
char *date)
{
static const char *const days[] =
- { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+ { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
static const char *const mons[] =
- { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
- "Nov", "Dec"
- };
+ { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
+ "Nov", "Dec"};
struct tm now;
time_t t;
-#if !defined(HAVE_C11_GMTIME_S) && !defined(HAVE_W32_GMTIME_S) && !defined(HAVE_GMTIME_R)
- struct tm* pNow;
+#if ! defined(HAVE_C11_GMTIME_S) && ! defined(HAVE_W32_GMTIME_S) && \
+ ! defined(HAVE_GMTIME_R)
+ struct tm*pNow;
#endif
date[0] = 0;
@@ -1184,10 +1202,10 @@ get_date_string (struct GNUNET_TIME_Absolute at,
if (0 != gmtime_s (&now, &t))
return;
#elif defined(HAVE_GMTIME_R)
- if (NULL == gmtime_r(&t, &now))
+ if (NULL == gmtime_r (&t, &now))
return;
#else
- pNow = gmtime(&t);
+ pNow = gmtime (&t);
if (NULL == pNow)
return;
now = *pNow;
@@ -1364,7 +1382,7 @@ build_keys_response (const struct ResponseFactoryContext *rfc,
auditors = GNUNET_CONTAINER_multihashmap_create (4,
GNUNET_NO);
- for (unsigned int i=denom_off;i<rfc->denomkey_array_length;i++)
+ for (unsigned int i = denom_off; i<rfc->denomkey_array_length; i++)
{
/* Add denomination key to the response */
const struct DenominationKeyEntry *dke
@@ -1414,9 +1432,11 @@ build_keys_response (const struct ResponseFactoryContext *rfc,
json_array_append_new (ae->ar,
json_pack ("{s:o, s:o}",
"denom_pub_h",
- GNUNET_JSON_from_data_auto (denom_key_hash),
+ GNUNET_JSON_from_data_auto (
+ denom_key_hash),
"auditor_sig",
- GNUNET_JSON_from_data_auto (&as->asig))));
+ GNUNET_JSON_from_data_auto (
+ &as->asig))));
}
}
@@ -1434,9 +1454,11 @@ build_keys_response (const struct ResponseFactoryContext *rfc,
&ks.hc);
rbc.hash_context = NULL;
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_eddsa_sign (&rfc->key_state->current_sign_key_issue.signkey_priv.eddsa_priv,
- &ks.purpose,
- &sig.eddsa_signature));
+ GNUNET_CRYPTO_eddsa_sign (
+ &rfc->key_state->current_sign_key_issue.signkey_priv.
+ eddsa_priv,
+ &ks.purpose,
+ &sig.eddsa_signature));
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
"exchangedb",
@@ -1447,23 +1469,28 @@ build_keys_response (const struct ResponseFactoryContext *rfc,
"exchangedb",
"IDLE_RESERVE_EXPIRATION_TIME");
/* use default */
- reserve_closing_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_WEEKS,
- 4);
+ reserve_closing_delay = GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_WEEKS,
+ 4);
}
/* Build /keys response */
keys = json_pack ("{s:s, s:o, s:o, s:O, s:O,"
" s:o, s:o, s:o, s:o, s:o}",
/* 1-5 */
"version", TALER_PROTOCOL_VERSION,
- "master_public_key", GNUNET_JSON_from_data_auto (&TEH_master_public_key),
- "reserve_closing_delay", GNUNET_JSON_from_time_rel (reserve_closing_delay),
+ "master_public_key", GNUNET_JSON_from_data_auto (
+ &TEH_master_public_key),
+ "reserve_closing_delay", GNUNET_JSON_from_time_rel (
+ reserve_closing_delay),
"signkeys", rfc->sign_keys_array,
"payback", rfc->payback_array,
/* 6-10 */
"denoms", rbc.denom_keys_array,
"auditors", rbc.auditors_array,
- "list_issue_date", GNUNET_JSON_from_time_abs (rfc->key_state->reload_time),
- "eddsa_pub", GNUNET_JSON_from_data_auto (&rfc->key_state->current_sign_key_issue.issue.signkey_pub),
+ "list_issue_date", GNUNET_JSON_from_time_abs (
+ rfc->key_state->reload_time),
+ "eddsa_pub", GNUNET_JSON_from_data_auto (
+ &rfc->key_state->current_sign_key_issue.issue.signkey_pub),
"eddsa_sig", GNUNET_JSON_from_data_auto (&sig));
if (NULL == keys)
{
@@ -1560,13 +1587,14 @@ build_keys_response (const struct ResponseFactoryContext *rfc,
static void
reload_public_denoms_cb (void *cls,
const struct TALER_DenominationPublicKey *denom_pub,
- const struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
{
struct ResponseFactoryContext *rfc = cls;
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation dki;
if (rfc->now.abs_value_us > GNUNET_TIME_absolute_ntoh
- (issue->properties.expire_legal).abs_value_us)
+ (issue->properties.expire_legal).abs_value_us)
{
/* Expired key, discard. */
return;
@@ -1672,9 +1700,9 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
/* process revocations */
if (-1 ==
TALER_EXCHANGEDB_revocations_iterate (TEH_revocation_directory,
- &TEH_master_public_key,
- &revocations_iter,
- &rfc))
+ &TEH_master_public_key,
+ &revocations_iter,
+ &rfc))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to load denomination keys from `%s'.\n",
@@ -1716,7 +1744,8 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
/* Initialize and sort the `denomkey_array` */
rfc.denomkey_array
- = GNUNET_new_array (GNUNET_CONTAINER_multihashmap_size (key_state->denomkey_map),
+ = GNUNET_new_array (GNUNET_CONTAINER_multihashmap_size (
+ key_state->denomkey_map),
struct DenominationKeyEntry);
GNUNET_CONTAINER_multihashmap_iterate (key_state->denomkey_map,
&initialize_denomkey_array,
@@ -1733,16 +1762,16 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
&reload_auditor_iter,
&rfc);
/* Sanity check: do we have auditors for all denomination keys? */
- for (unsigned int i=0;i<rfc.denomkey_array_length;i++)
+ for (unsigned int i = 0; i<rfc.denomkey_array_length; i++)
{
const struct DenominationKeyEntry *dke
= &rfc.denomkey_array[i];
if (NULL == dke->as_head)
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Denomination key `%s' at %p not signed by any auditor!\n",
- GNUNET_h2s (&dke->denom_key_hash),
- dke);
+ "Denomination key `%s' at %p not signed by any auditor!\n",
+ GNUNET_h2s (&dke->denom_key_hash),
+ dke);
}
/* Determine size of `krd_array` by counting number of discrete
@@ -1750,7 +1779,7 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
last = GNUNET_TIME_UNIT_ZERO_ABS;
key_state->krd_array_length = 0;
off = 1; /* reserve one slot for the "no keys" response */
- for (unsigned int i=0;i<rfc.denomkey_array_length;i++)
+ for (unsigned int i = 0; i<rfc.denomkey_array_length; i++)
{
const struct DenominationKeyEntry *dke
= &rfc.denomkey_array[i];
@@ -1765,7 +1794,8 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
/* Compute next automatic reload time */
key_state->next_reload =
- GNUNET_TIME_absolute_min (GNUNET_TIME_absolute_ntoh (key_state->current_sign_key_issue.issue.expire),
+ GNUNET_TIME_absolute_min (GNUNET_TIME_absolute_ntoh (
+ key_state->current_sign_key_issue.issue.expire),
key_state->min_dk_expire);
GNUNET_assert (0 != key_state->next_reload.abs_value_us);
@@ -1777,7 +1807,7 @@ make_fresh_key_state (struct GNUNET_TIME_Absolute now)
struct KeysResponseData);
off = 0;
last = GNUNET_TIME_UNIT_ZERO_ABS;
- for (unsigned int i=0;i<rfc.denomkey_array_length;i++)
+ for (unsigned int i = 0; i<rfc.denomkey_array_length; i++)
{
const struct DenominationKeyEntry *dke
= &rfc.denomkey_array[i];
@@ -1839,8 +1869,8 @@ TEH_KS_release_ (const char *location,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"KS released at %s (%p/%d)\n",
location,
- key_state,
- key_state->refcnt);
+ key_state,
+ key_state->refcnt);
ks_release (key_state);
GNUNET_assert (0 == pthread_mutex_unlock (&internal_key_state_mutex));
}
@@ -1870,7 +1900,7 @@ TEH_KS_acquire_ (struct GNUNET_TIME_Absolute now,
internal_key_state = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "KS released in acquire due to expiration\n");
+ "KS released in acquire due to expiration\n");
ks_release (ks);
rcd = 1; /* remember that we released 'internal_key_state' */
}
@@ -1882,7 +1912,7 @@ TEH_KS_acquire_ (struct GNUNET_TIME_Absolute now,
{
GNUNET_assert (0 == pthread_mutex_unlock (&internal_key_state_mutex));
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to initialize key state\n");
+ "Failed to initialize key state\n");
return NULL;
}
internal_key_state->refcnt += rcd;
@@ -1892,16 +1922,16 @@ TEH_KS_acquire_ (struct GNUNET_TIME_Absolute now,
{
key_state->refcnt++;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "KS acquired at %s (%p/%d)\n",
- location,
- key_state,
- key_state->refcnt);
+ "KS acquired at %s (%p/%d)\n",
+ location,
+ key_state,
+ key_state->refcnt);
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "KS acquire failed at %s\n",
- location);
+ "KS acquire failed at %s\n",
+ location);
}
GNUNET_assert (0 == pthread_mutex_unlock (&internal_key_state_mutex));
@@ -1920,17 +1950,20 @@ TEH_KS_acquire_ (struct GNUNET_TIME_Absolute now,
* or NULL if denom_pub could not be found (or is not valid at this time for the given @a use)
*/
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *
-TEH_KS_denomination_key_lookup_by_hash (const struct TEH_KS_StateHandle *key_state,
- const struct GNUNET_HashCode *denom_pub_hash,
+TEH_KS_denomination_key_lookup_by_hash (const struct
+ TEH_KS_StateHandle *key_state,
+ const struct
+ GNUNET_HashCode *denom_pub_hash,
enum TEH_KS_DenominationKeyUse use)
{
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
struct GNUNET_TIME_Absolute now;
const struct GNUNET_CONTAINER_MultiHashMap *map;
- map = (TEH_KS_DKU_PAYBACK == use) ? key_state->revoked_map : key_state->denomkey_map;
+ map = (TEH_KS_DKU_PAYBACK == use) ? key_state->revoked_map :
+ key_state->denomkey_map;
dki = GNUNET_CONTAINER_multihashmap_get (map,
- denom_pub_hash);
+ denom_pub_hash);
if ( (NULL == dki) && (TEH_KS_DKU_ZOMBIE == use))
dki = GNUNET_CONTAINER_multihashmap_get (key_state->revoked_map,
denom_pub_hash);
@@ -1941,8 +1974,8 @@ TEH_KS_denomination_key_lookup_by_hash (const struct TEH_KS_StateHandle *key_sta
GNUNET_TIME_absolute_ntoh (dki->issue.properties.start).abs_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Not returning DKI for %s, as start time is in the future\n",
- GNUNET_h2s (denom_pub_hash));
+ "Not returning DKI for %s, as start time is in the future\n",
+ GNUNET_h2s (denom_pub_hash));
return NULL;
}
now = GNUNET_TIME_absolute_get ();
@@ -1950,48 +1983,52 @@ TEH_KS_denomination_key_lookup_by_hash (const struct TEH_KS_StateHandle *key_sta
{
case TEH_KS_DKU_WITHDRAW:
if (now.abs_value_us >
- GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_withdraw).abs_value_us)
+ GNUNET_TIME_absolute_ntoh (
+ dki->issue.properties.expire_withdraw).abs_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Not returning DKI for %s, as time to create coins has passed\n",
- GNUNET_h2s (denom_pub_hash));
+ "Not returning DKI for %s, as time to create coins has passed\n",
+ GNUNET_h2s (denom_pub_hash));
return NULL;
}
if (NULL == dki->denom_priv.rsa_private_key)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Not returning DKI of %s for WITHDRAW operation as we lack the private key, even though the withdraw period did not yet expire!\n",
- GNUNET_h2s (denom_pub_hash));
+ "Not returning DKI of %s for WITHDRAW operation as we lack the private key, even though the withdraw period did not yet expire!\n",
+ GNUNET_h2s (denom_pub_hash));
return NULL;
}
break;
case TEH_KS_DKU_DEPOSIT:
if (now.abs_value_us >
- GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_deposit).abs_value_us)
+ GNUNET_TIME_absolute_ntoh (
+ dki->issue.properties.expire_deposit).abs_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Not returning DKI for %s, as time to spend coin has passed\n",
- GNUNET_h2s (denom_pub_hash));
+ "Not returning DKI for %s, as time to spend coin has passed\n",
+ GNUNET_h2s (denom_pub_hash));
return NULL;
}
break;
case TEH_KS_DKU_PAYBACK:
if (now.abs_value_us >
- GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_deposit).abs_value_us)
+ GNUNET_TIME_absolute_ntoh (
+ dki->issue.properties.expire_deposit).abs_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Not returning DKI for %s, as time to payback coin has passed\n",
- GNUNET_h2s (denom_pub_hash));
+ "Not returning DKI for %s, as time to payback coin has passed\n",
+ GNUNET_h2s (denom_pub_hash));
return NULL;
}
break;
case TEH_KS_DKU_ZOMBIE:
if (now.abs_value_us >
- GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_legal).abs_value_us)
+ GNUNET_TIME_absolute_ntoh (
+ dki->issue.properties.expire_legal).abs_value_us)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Not returning DKI for %s, as legal expiration of coin has passed\n",
- GNUNET_h2s (denom_pub_hash));
+ "Not returning DKI for %s, as legal expiration of coin has passed\n",
+ GNUNET_h2s (denom_pub_hash));
return NULL;
}
break;
@@ -2113,7 +2150,7 @@ TEH_KS_loop (void)
ret = GNUNET_SYSERR;
break;
}
-read_again:
+ read_again:
errno = 0;
res = read (reload_pipe[0],
&c,
@@ -2206,14 +2243,15 @@ TEH_KS_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
/* This *can* happen if the exchange's keys are
not properly maintained. */
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Cannot sign request, no valid keys available\n"));
+ _ ("Cannot sign request, no valid keys available\n"));
return GNUNET_SYSERR;
}
*pub = key_state->current_sign_key_issue.issue.signkey_pub;
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_eddsa_sign (&key_state->current_sign_key_issue.signkey_priv.eddsa_priv,
- purpose,
- &sig->eddsa_signature));
+ GNUNET_CRYPTO_eddsa_sign (
+ &key_state->current_sign_key_issue.signkey_priv.eddsa_priv,
+ purpose,
+ &sig->eddsa_signature));
TEH_KS_release (key_state);
return GNUNET_OK;
}
diff --git a/src/exchange/taler-exchange-httpd_keystate.h b/src/exchange/taler-exchange-httpd_keystate.h
index 6f5d338cb..7e2a659ef 100644
--- a/src/exchange/taler-exchange-httpd_keystate.h
+++ b/src/exchange/taler-exchange-httpd_keystate.h
@@ -69,7 +69,7 @@ TEH_KS_release_ (const char *location,
* client via the "now" URL parameter of "/keys".
* @return the key state
*/
-#define TEH_KS_acquire(now) TEH_KS_acquire_(now, __FUNCTION__)
+#define TEH_KS_acquire(now) TEH_KS_acquire_ (now, __FUNCTION__)
/**
@@ -93,7 +93,8 @@ TEH_KS_free (void);
* periods for a key differ, the caller must specify which
* use is relevant for the current operation.
*/
-enum TEH_KS_DenominationKeyUse {
+enum TEH_KS_DenominationKeyUse
+{
/**
* The key is to be used for a /reserve/withdraw or /refresh (exchange)
@@ -113,7 +114,7 @@ enum TEH_KS_DenominationKeyUse {
/**
* The key is to be used for a /refresh/payback operation,
- * i.e. it is an old coin that regained value from a
+ * i.e. it is an old coin that regained value from a
* payback on a new coin derived from the old coin.
*/
TEH_KS_DKU_ZOMBIE
@@ -132,8 +133,10 @@ enum TEH_KS_DenominationKeyUse {
* or NULL if denom_pub could not be found (or is not valid at this time for the given @a use)
*/
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *
-TEH_KS_denomination_key_lookup_by_hash (const struct TEH_KS_StateHandle *key_state,
- const struct GNUNET_HashCode *denom_pub_hash,
+TEH_KS_denomination_key_lookup_by_hash (const struct
+ TEH_KS_StateHandle *key_state,
+ const struct
+ GNUNET_HashCode *denom_pub_hash,
enum TEH_KS_DenominationKeyUse use);
diff --git a/src/exchange/taler-exchange-httpd_mhd.c b/src/exchange/taler-exchange-httpd_mhd.c
index e76ada2cd..dfea44adb 100644
--- a/src/exchange/taler-exchange-httpd_mhd.c
+++ b/src/exchange/taler-exchange-httpd_mhd.c
@@ -45,10 +45,10 @@
*/
int
TEH_MHD_handler_static_response (struct TEH_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)
{
struct MHD_Response *response;
int ret;
@@ -142,16 +142,16 @@ TEH_MHD_handler_agpl_redirect (struct TEH_RequestHandler *rh,
*/
int
TEH_MHD_handler_send_json_pack_error (struct TEH_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 TEH_RESPONSE_reply_json_pack (connection,
- rh->response_code,
- "{s:s}",
- "error",
- rh->data);
+ rh->response_code,
+ "{s:s}",
+ "error",
+ rh->data);
}
diff --git a/src/exchange/taler-exchange-httpd_parsing.c b/src/exchange/taler-exchange-httpd_parsing.c
index d1a1e9df5..dc77d1822 100644
--- a/src/exchange/taler-exchange-httpd_parsing.c
+++ b/src/exchange/taler-exchange-httpd_parsing.c
@@ -33,7 +33,7 @@
/**
* Maximum POST request size.
*/
-#define REQUEST_BUFFER_MAX (1024*1024)
+#define REQUEST_BUFFER_MAX (1024 * 1024)
@@ -80,21 +80,21 @@ TEH_PARSE_post_json (struct MHD_Connection *connection,
case GNUNET_JSON_PR_OUT_OF_MEMORY:
return (MHD_NO == TEH_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 == TEH_RESPONSE_reply_request_too_large
- (connection)) ? GNUNET_SYSERR : GNUNET_NO;
+ (connection)) ? GNUNET_SYSERR : GNUNET_NO;
case GNUNET_JSON_PR_JSON_INVALID:
return (MHD_YES ==
TEH_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;
@@ -149,9 +149,9 @@ TEH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
{
return (MHD_NO ==
TEH_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,
@@ -160,9 +160,9 @@ TEH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
out_size))
return (MHD_NO ==
TEH_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;
}
@@ -203,10 +203,12 @@ TEH_PARSE_json_data (struct MHD_Connection *connection,
MHD_HTTP_BAD_REQUEST,
"{s:s, s:I, s:s, s:I}",
"error", "parse error",
- "code", (json_int_t) TALER_EC_JSON_INVALID_WITH_DETAILS,
+ "code",
+ (json_int_t)
+ TALER_EC_JSON_INVALID_WITH_DETAILS,
"field", error_json_name,
"line", (json_int_t) error_line))
- ? GNUNET_NO : GNUNET_SYSERR;
+ ? GNUNET_NO : GNUNET_SYSERR;
return ret;
}
return GNUNET_YES;
@@ -257,7 +259,7 @@ TEH_PARSE_json_array (struct MHD_Connection *connection,
"{s:s, s:I}",
"error", "parse error",
"dimension", dim))
- ? GNUNET_NO : GNUNET_SYSERR;
+ ? GNUNET_NO : GNUNET_SYSERR;
return ret;
}
ret = GNUNET_JSON_parse (root,
@@ -275,7 +277,7 @@ TEH_PARSE_json_array (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;
diff --git a/src/exchange/taler-exchange-httpd_payback.c b/src/exchange/taler-exchange-httpd_payback.c
index 50c0ffdbc..468d69b3f 100644
--- a/src/exchange/taler-exchange-httpd_payback.c
+++ b/src/exchange/taler-exchange-httpd_payback.c
@@ -67,7 +67,8 @@ reply_payback_unknown (struct MHD_Connection *connection,
static int
reply_payback_refresh_success (struct MHD_Connection *connection,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
+ const struct
+ TALER_CoinSpendPublicKeyP *old_coin_pub,
const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute timestamp)
{
@@ -94,11 +95,17 @@ reply_payback_refresh_success (struct MHD_Connection *connection,
return TEH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_OK,
"{s:o, s:o, s:o, s:o, s:o}",
- "old_coin_pub", GNUNET_JSON_from_data_auto (old_coin_pub),
- "timestamp", GNUNET_JSON_from_time_abs (timestamp),
- "amount", TALER_JSON_from_amount (amount),
- "exchange_sig", GNUNET_JSON_from_data_auto (&sig),
- "exchange_pub", GNUNET_JSON_from_data_auto (&pub));
+ "old_coin_pub",
+ GNUNET_JSON_from_data_auto (
+ old_coin_pub),
+ "timestamp", GNUNET_JSON_from_time_abs (
+ timestamp),
+ "amount", TALER_JSON_from_amount (
+ amount),
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (&sig),
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (&pub));
}
@@ -142,11 +149,16 @@ reply_payback_success (struct MHD_Connection *connection,
return TEH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_OK,
"{s:o, s:o, s:o, s:o, s:o}",
- "reserve_pub", GNUNET_JSON_from_data_auto (reserve_pub),
- "timestamp", GNUNET_JSON_from_time_abs (timestamp),
- "amount", TALER_JSON_from_amount (amount),
- "exchange_sig", GNUNET_JSON_from_data_auto (&sig),
- "exchange_pub", GNUNET_JSON_from_data_auto (&pub));
+ "reserve_pub",
+ GNUNET_JSON_from_data_auto (reserve_pub),
+ "timestamp", GNUNET_JSON_from_time_abs (
+ timestamp),
+ "amount", TALER_JSON_from_amount (
+ amount),
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (&sig),
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (&pub));
}
@@ -405,7 +417,8 @@ payback_transaction (void *cls,
static int
verify_and_execute_payback (struct MHD_Connection *connection,
const struct TALER_CoinPublicInfo *coin,
- const struct TALER_DenominationBlindingKeyP *coin_bks,
+ const struct
+ TALER_DenominationBlindingKeyP *coin_bks,
const struct TALER_CoinSpendSignatureP *coin_sig,
int refreshed)
{
@@ -432,7 +445,8 @@ verify_and_execute_payback (struct MHD_Connection *connection,
if (NULL == dki)
{
TEH_KS_release (key_state);
- TALER_LOG_WARNING ("Denomination key in /payback request not in payback mode\n");
+ TALER_LOG_WARNING (
+ "Denomination key in /payback request not in payback mode\n");
return TEH_RESPONSE_reply_arg_unknown (connection,
TALER_EC_PAYBACK_DENOMINATION_KEY_UNKNOWN,
"denom_pub");
@@ -527,16 +541,16 @@ verify_and_execute_payback (struct MHD_Connection *connection,
return mhd_ret;
}
return (refreshed)
- ? reply_payback_refresh_success (connection,
- &coin->coin_pub,
- &pc.target.old_coin_pub,
- &pc.amount,
- pc.now)
- : reply_payback_success (connection,
- &coin->coin_pub,
- &pc.target.reserve_pub,
- &pc.amount,
- pc.now);
+ ? reply_payback_refresh_success (connection,
+ &coin->coin_pub,
+ &pc.target.old_coin_pub,
+ &pc.amount,
+ pc.now)
+ : reply_payback_success (connection,
+ &coin->coin_pub,
+ &pc.target.reserve_pub,
+ &pc.amount,
+ pc.now);
}
@@ -579,8 +593,8 @@ TEH_PAYBACK_handler_payback (struct TEH_RequestHandler *rh,
GNUNET_JSON_spec_fixed_auto ("coin_sig",
&coin_sig),
GNUNET_JSON_spec_mark_optional
- (GNUNET_JSON_spec_boolean ("refreshed",
- &refreshed)),
+ (GNUNET_JSON_spec_boolean ("refreshed",
+ &refreshed)),
GNUNET_JSON_spec_end ()
};
diff --git a/src/exchange/taler-exchange-httpd_refresh_link.c b/src/exchange/taler-exchange-httpd_refresh_link.c
index b6712f75c..e5a332308 100644
--- a/src/exchange/taler-exchange-httpd_refresh_link.c
+++ b/src/exchange/taler-exchange-httpd_refresh_link.c
@@ -88,10 +88,12 @@ handle_link_data (void *cls,
goto fail;
json_object_set_new (obj,
"denom_pub",
- GNUNET_JSON_from_rsa_public_key (pos->denom_pub.rsa_public_key));
+ GNUNET_JSON_from_rsa_public_key (
+ pos->denom_pub.rsa_public_key));
json_object_set_new (obj,
"ev_sig",
- GNUNET_JSON_from_rsa_signature (pos->ev_sig.rsa_signature));
+ GNUNET_JSON_from_rsa_signature (
+ pos->ev_sig.rsa_signature));
json_object_set_new (obj,
"link_sig",
GNUNET_JSON_from_data_auto (&pos->orig_coin_link_sig));
@@ -113,7 +115,7 @@ handle_link_data (void *cls,
root))
goto fail;
return;
- fail:
+ fail:
ctx->ec = TALER_EC_JSON_ALLOCATION_FAILURE;
json_decref (ctx->mlist);
ctx->mlist = NULL;
@@ -140,9 +142,9 @@ handle_link_data (void *cls,
*/
static enum GNUNET_DB_QueryStatus
refresh_link_transaction (void *cls,
- struct MHD_Connection *connection,
- struct TALER_EXCHANGEDB_Session *session,
- int *mhd_ret)
+ struct MHD_Connection *connection,
+ struct TALER_EXCHANGEDB_Session *session,
+ int *mhd_ret)
{
struct HTD_Context *ctx = cls;
enum GNUNET_DB_QueryStatus qs;
@@ -162,8 +164,8 @@ refresh_link_transaction (void *cls,
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
*mhd_ret = TEH_RESPONSE_reply_arg_unknown (connection,
- TALER_EC_REFRESH_LINK_COIN_UNKNOWN,
- "coin_pub");
+ TALER_EC_REFRESH_LINK_COIN_UNKNOWN,
+ "coin_pub");
return GNUNET_DB_STATUS_HARD_ERROR;
}
return qs;
@@ -193,12 +195,13 @@ TEH_REFRESH_handler_refresh_link (struct TEH_RequestHandler *rh,
struct HTD_Context ctx;
memset (&ctx,
- 0,
- sizeof (ctx));
+ 0,
+ sizeof (ctx));
res = TEH_PARSE_mhd_request_arg_data (connection,
"coin_pub",
&ctx.coin_pub,
- sizeof (struct TALER_CoinSpendPublicKeyP));
+ sizeof (struct
+ TALER_CoinSpendPublicKeyP));
if (GNUNET_SYSERR == res)
return MHD_NO;
if (GNUNET_OK != res)
diff --git a/src/exchange/taler-exchange-httpd_refresh_melt.c b/src/exchange/taler-exchange-httpd_refresh_melt.c
index 8677d6270..702857b8c 100644
--- a/src/exchange/taler-exchange-httpd_refresh_melt.c
+++ b/src/exchange/taler-exchange-httpd_refresh_melt.c
@@ -48,9 +48,11 @@
*/
static int
reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct
+ TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_Amount coin_value,
- struct TALER_EXCHANGEDB_TransactionList *tl,
+ struct TALER_EXCHANGEDB_TransactionList *
+ tl,
const struct TALER_Amount *requested,
const struct TALER_Amount *residual)
{
@@ -59,14 +61,15 @@ reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection,
history = TEH_RESPONSE_compile_transaction_history (tl);
if (NULL == history)
return TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_REFRESH_MELT_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS);
+ TALER_EC_REFRESH_MELT_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS);
return TEH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_FORBIDDEN,
"{s:s, s:I, s:o, s:o, s:o, s:o, s:o}",
"error",
"insufficient funds",
"code",
- (json_int_t) TALER_EC_REFRESH_MELT_INSUFFICIENT_FUNDS,
+ (json_int_t)
+ TALER_EC_REFRESH_MELT_INSUFFICIENT_FUNDS,
"coin_pub",
GNUNET_JSON_from_data_auto (coin_pub),
"original_value",
@@ -104,8 +107,8 @@ reply_refresh_melt_success (struct MHD_Connection *connection,
body.noreveal_index = htonl (noreveal_index);
if (GNUNET_OK !=
TEH_KS_sign (&body.purpose,
- &pub,
- &sig))
+ &pub,
+ &sig))
{
return TEH_RESPONSE_reply_internal_error (connection,
TALER_EC_EXCHANGE_BAD_CONFIGURATION,
@@ -118,7 +121,8 @@ reply_refresh_melt_success (struct MHD_Connection *connection,
"{s:i, s:o, s:o}",
"noreveal_index", (int) noreveal_index,
"exchange_sig", sig_json,
- "exchange_pub", GNUNET_JSON_from_data_auto (&pub));
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (&pub));
}
@@ -238,10 +242,12 @@ refresh_check_melt (struct MHD_Connection *connection,
&spent,
&rmc->refresh_session.amount_with_fee));
*mhd_ret = reply_refresh_melt_insufficient_funds (connection,
- &rmc->refresh_session.coin.coin_pub,
+ &rmc->refresh_session.coin
+ .coin_pub,
coin_value,
tl,
- &rmc->refresh_session.amount_with_fee,
+ &rmc->refresh_session.
+ amount_with_fee,
&coin_residual);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
@@ -365,8 +371,8 @@ handle_refresh_melt (struct MHD_Connection *connection,
{
GNUNET_break_op (0);
return TEH_RESPONSE_reply_external_error (connection,
- TALER_EC_REFRESH_MELT_FEES_EXCEED_CONTRIBUTION,
- "melt amount smaller than melting fee");
+ TALER_EC_REFRESH_MELT_FEES_EXCEED_CONTRIBUTION,
+ "melt amount smaller than melting fee");
}
}
@@ -374,19 +380,22 @@ handle_refresh_melt (struct MHD_Connection *connection,
{
struct TALER_RefreshMeltCoinAffirmationPS body;
- body.purpose.size = htonl (sizeof (struct TALER_RefreshMeltCoinAffirmationPS));
+ body.purpose.size = htonl (sizeof (struct
+ TALER_RefreshMeltCoinAffirmationPS));
body.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
body.rc = rmc->refresh_session.rc;
TALER_amount_hton (&body.amount_with_fee,
- &rmc->refresh_session.amount_with_fee);
+ &rmc->refresh_session.amount_with_fee);
body.melt_fee = rmc->dki->issue.properties.fee_refresh;
body.coin_pub = rmc->refresh_session.coin.coin_pub;
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_MELT,
&body.purpose,
- &rmc->refresh_session.coin_sig.eddsa_signature,
- &rmc->refresh_session.coin.coin_pub.eddsa_pub))
+ &rmc->refresh_session.coin_sig.
+ eddsa_signature,
+ &rmc->refresh_session.coin.coin_pub.
+ eddsa_pub))
{
GNUNET_break_op (0);
return TEH_RESPONSE_reply_signature_invalid (connection,
@@ -489,7 +498,8 @@ TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh,
/* Baseline: check if deposits/refreshs are generally
simply still allowed for this denomination */
rmc.dki = TEH_KS_denomination_key_lookup_by_hash (key_state,
- &rmc.refresh_session.coin.denom_pub_hash,
+ &rmc.refresh_session.coin.
+ denom_pub_hash,
TEH_KS_DKU_DEPOSIT);
/* Consider case that denomination was revoked but
this coin was already seen and thus refresh is OK. */
@@ -498,7 +508,8 @@ TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh,
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
dki = TEH_KS_denomination_key_lookup_by_hash (key_state,
- &rmc.refresh_session.coin.denom_pub_hash,
+ &rmc.refresh_session.coin.
+ denom_pub_hash,
TEH_KS_DKU_PAYBACK);
if (NULL != dki)
{
@@ -533,7 +544,8 @@ TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh,
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
dki = TEH_KS_denomination_key_lookup_by_hash (key_state,
- &rmc.refresh_session.coin.denom_pub_hash,
+ &rmc.refresh_session.coin.
+ denom_pub_hash,
TEH_KS_DKU_ZOMBIE);
if (NULL != dki)
{
@@ -585,7 +597,7 @@ TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh,
&rmc);
- cleanup:
+ cleanup:
if (NULL != key_state)
{
TEH_KS_release (key_state);
@@ -593,7 +605,8 @@ TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh,
}
if (NULL != rmc.refresh_session.coin.denom_sig.rsa_signature)
{
- GNUNET_CRYPTO_rsa_signature_free (rmc.refresh_session.coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ rmc.refresh_session.coin.denom_sig.rsa_signature);
rmc.refresh_session.coin.denom_sig.rsa_signature = NULL;
}
GNUNET_JSON_parse_free (spec);
diff --git a/src/exchange/taler-exchange-httpd_refresh_reveal.c b/src/exchange/taler-exchange-httpd_refresh_reveal.c
index 47287b155..a84e5dea7 100644
--- a/src/exchange/taler-exchange-httpd_refresh_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refresh_reveal.c
@@ -54,8 +54,8 @@
*/
static int
reply_refresh_reveal_success (struct MHD_Connection *connection,
- unsigned int num_newcoins,
- const struct TALER_DenominationSignature *sigs)
+ unsigned int num_newcoins,
+ const struct TALER_DenominationSignature *sigs)
{
json_t *list;
int ret;
@@ -69,8 +69,9 @@ reply_refresh_reveal_success (struct MHD_Connection *connection,
obj = json_object ();
json_object_set_new (obj,
- "ev_sig",
- GNUNET_JSON_from_rsa_signature (sigs[newcoin_index].rsa_signature));
+ "ev_sig",
+ GNUNET_JSON_from_rsa_signature (
+ sigs[newcoin_index].rsa_signature));
GNUNET_assert (0 ==
json_array_append_new (list,
obj));
@@ -102,14 +103,17 @@ reply_refresh_reveal_success (struct MHD_Connection *connection,
*/
static int
reply_refresh_reveal_missmatch (struct MHD_Connection *connection,
- const struct TALER_RefreshCommitmentP *rc)
+ const struct TALER_RefreshCommitmentP *rc)
{
return TEH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_CONFLICT,
"{s:s, s:I, s:o}",
"error", "commitment violation",
- "code", (json_int_t) TALER_EC_REFRESH_REVEAL_COMMITMENT_VIOLATION,
- "rc_expected", GNUNET_JSON_from_data_auto (rc));
+ "code",
+ (json_int_t)
+ TALER_EC_REFRESH_REVEAL_COMMITMENT_VIOLATION,
+ "rc_expected",
+ GNUNET_JSON_from_data_auto (rc));
}
@@ -205,14 +209,15 @@ check_exists_cb (void *cls,
sizeof (struct TALER_TransferPublicKeyP)));
GNUNET_break_op (0 == memcmp (tprivs,
&rctx->transfer_privs,
- sizeof (struct TALER_TransferPrivateKeyP) * num_tprivs));
+ sizeof (struct TALER_TransferPrivateKeyP)
+ * num_tprivs));
/* We usually sign early (optimistic!), but in case we change that *and*
we do find the operation in the database, we could use this: */
if (NULL == rctx->ev_sigs)
{
rctx->ev_sigs = GNUNET_new_array (num_newcoins,
struct TALER_DenominationSignature);
- for (unsigned int i=0;i<num_newcoins;i++)
+ for (unsigned int i = 0; i<num_newcoins; i++)
rctx->ev_sigs[i].rsa_signature
= GNUNET_CRYPTO_rsa_signature_dup (rrcs[i].coin_sig.rsa_signature);
}
@@ -245,7 +250,8 @@ refresh_reveal_preflight (void *cls,
&rctx->rc,
&check_exists_cb,
rctx);
- switch (qs) {
+ switch (qs)
+ {
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
return qs; /* continue normal execution */
case GNUNET_DB_STATUS_SOFT_ERROR:
@@ -253,7 +259,7 @@ refresh_reveal_preflight (void *cls,
case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (qs);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_REFRESH_REVEAL_DB_FETCH_REVEAL_ERROR);
+ TALER_EC_REFRESH_REVEAL_DB_FETCH_REVEAL_ERROR);
rctx->preflight_ok = GNUNET_SYSERR;
return GNUNET_DB_STATUS_HARD_ERROR;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
@@ -275,7 +281,8 @@ refresh_reveal_preflight (void *cls,
static void
free_refresh_melt (struct TALER_EXCHANGEDB_RefreshMelt *refresh_melt)
{
- GNUNET_CRYPTO_rsa_signature_free (refresh_melt->session.coin.denom_sig.rsa_signature);
+ GNUNET_CRYPTO_rsa_signature_free (
+ refresh_melt->session.coin.denom_sig.rsa_signature);
}
@@ -299,9 +306,9 @@ free_refresh_melt (struct TALER_EXCHANGEDB_RefreshMelt *refresh_melt)
*/
static enum GNUNET_DB_QueryStatus
refresh_reveal_transaction (void *cls,
- struct MHD_Connection *connection,
- struct TALER_EXCHANGEDB_Session *session,
- int *mhd_ret)
+ struct MHD_Connection *connection,
+ struct TALER_EXCHANGEDB_Session *session,
+ int *mhd_ret)
{
struct RevealContext *rctx = cls;
struct TALER_EXCHANGEDB_RefreshMelt refresh_melt;
@@ -316,8 +323,8 @@ refresh_reveal_transaction (void *cls,
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
*mhd_ret = TEH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_REFRESH_REVEAL_SESSION_UNKNOWN,
- "rc");
+ TALER_EC_REFRESH_REVEAL_SESSION_UNKNOWN,
+ "rc");
return GNUNET_DB_STATUS_HARD_ERROR;
}
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
@@ -327,7 +334,7 @@ refresh_reveal_transaction (void *cls,
{
GNUNET_break (0);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_REFRESH_REVEAL_DB_FETCH_SESSION_ERROR);
+ TALER_EC_REFRESH_REVEAL_DB_FETCH_SESSION_ERROR);
if (refresh_melt.session.noreveal_index >= TALER_CNC_KAPPA)
free_refresh_melt (&refresh_melt);
return GNUNET_DB_STATUS_HARD_ERROR;
@@ -343,7 +350,7 @@ refresh_reveal_transaction (void *cls,
unsigned int off;
off = 0; /* did we pass session.noreveal_index yet? */
- for (unsigned int i=0;i<TALER_CNC_KAPPA;i++)
+ for (unsigned int i = 0; i<TALER_CNC_KAPPA; i++)
{
struct TALER_RefreshCommitmentEntry *rce = &rcs[i];
@@ -357,7 +364,8 @@ refresh_reveal_transaction (void *cls,
else
{
/* Reconstruct coin envelopes from transfer private key */
- struct TALER_TransferPrivateKeyP *tpriv = &rctx->transfer_privs[i - off];
+ struct TALER_TransferPrivateKeyP *tpriv = &rctx->transfer_privs[i
+ - off];
struct TALER_TransferSecretP ts;
GNUNET_CRYPTO_ecdhe_key_get_public (&tpriv->ecdhe_priv,
@@ -367,7 +375,7 @@ refresh_reveal_transaction (void *cls,
&ts);
rce->new_coins = GNUNET_new_array (rctx->num_fresh_coins,
struct TALER_RefreshCoinData);
- for (unsigned int j=0;j<rctx->num_fresh_coins;j++)
+ for (unsigned int j = 0; j<rctx->num_fresh_coins; j++)
{
struct TALER_RefreshCoinData *rcd = &rce->new_coins[j];
struct TALER_PlanchetSecretsP ps;
@@ -394,13 +402,13 @@ refresh_reveal_transaction (void *cls,
&refresh_melt.session.amount_with_fee);
/* Free resources allocated above */
- for (unsigned int i=0;i<TALER_CNC_KAPPA;i++)
+ for (unsigned int i = 0; i<TALER_CNC_KAPPA; i++)
{
struct TALER_RefreshCommitmentEntry *rce = &rcs[i];
if (i == refresh_melt.session.noreveal_index)
continue; /* This offset is special... */
- for (unsigned int j=0;j<rctx->num_fresh_coins;j++)
+ for (unsigned int j = 0; j<rctx->num_fresh_coins; j++)
{
struct TALER_RefreshCoinData *rcd = &rce->new_coins[j];
@@ -426,7 +434,7 @@ refresh_reveal_transaction (void *cls,
struct TALER_Amount refresh_cost;
refresh_cost = refresh_melt.melt_fee;
- for (unsigned int i=0;i<rctx->num_fresh_coins;i++)
+ for (unsigned int i = 0; i<rctx->num_fresh_coins; i++)
{
struct TALER_Amount fee_withdraw;
struct TALER_Amount value;
@@ -492,7 +500,7 @@ refresh_reveal_persist (void *cls,
{
struct TALER_EXCHANGEDB_RefreshRevealedCoin rrcs[rctx->num_fresh_coins];
- for (unsigned int i=0;i<rctx->num_fresh_coins;i++)
+ for (unsigned int i = 0; i<rctx->num_fresh_coins; i++)
{
struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrc = &rrcs[i];
@@ -564,7 +572,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
{
GNUNET_break_op (0);
return TEH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_REFRESH_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISSMATCH,
+ TALER_EC_REFRESH_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISSMATCH,
"new_denoms/coin_evs");
}
if (json_array_size (new_denoms_h_json) !=
@@ -577,7 +585,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
}
/* Parse transfer private keys array */
- for (unsigned int i=0;i<num_tprivs;i++)
+ for (unsigned int i = 0; i<num_tprivs; i++)
{
struct GNUNET_JSON_Specification trans_spec[] = {
GNUNET_JSON_spec_fixed_auto (NULL, &rctx->transfer_privs[i]),
@@ -596,7 +604,8 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
/* Resolve denomination hashes */
{
- const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dkis[num_fresh_coins];
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation *dkis[num_fresh_coins];
struct GNUNET_HashCode dki_h[num_fresh_coins];
struct TALER_RefreshCoinData rcds[num_fresh_coins];
struct TALER_CoinSpendSignatureP link_sigs[num_fresh_coins];
@@ -614,7 +623,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
}
/* Parse denomination key hashes */
- for (unsigned int i=0;i<num_fresh_coins;i++)
+ for (unsigned int i = 0; i<num_fresh_coins; i++)
{
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto (NULL,
@@ -646,7 +655,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
}
/* Parse coin envelopes */
- for (unsigned int i=0;i<num_fresh_coins;i++)
+ for (unsigned int i = 0; i<num_fresh_coins; i++)
{
struct TALER_RefreshCoinData *rcd = &rcds[i];
struct GNUNET_JSON_Specification spec[] = {
@@ -663,7 +672,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
-1);
if (GNUNET_OK != res)
{
- for (unsigned int j=0;j<i;j++)
+ for (unsigned int j = 0; j<i; j++)
GNUNET_free_non_null (rcds[j].coin_ev);
TEH_KS_release (key_state);
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
@@ -703,11 +712,11 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
}
}
/* Parse link signatures array */
- for (unsigned int i=0;i<num_fresh_coins;i++)
+ for (unsigned int i = 0; i<num_fresh_coins; i++)
{
struct GNUNET_JSON_Specification link_spec[] = {
- GNUNET_JSON_spec_fixed_auto (NULL, &link_sigs[i]),
- GNUNET_JSON_spec_end ()
+ GNUNET_JSON_spec_fixed_auto (NULL, &link_sigs[i]),
+ GNUNET_JSON_spec_end ()
};
int res;
@@ -734,7 +743,8 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_LINK,
&ldp.purpose,
&link_sigs[i].eddsa_signature,
- &refresh_melt.session.coin.coin_pub.eddsa_pub))
+ &refresh_melt.session.coin.coin_pub.
+ eddsa_pub))
{
GNUNET_break_op (0);
res = TEH_RESPONSE_reply_signature_invalid (connection,
@@ -753,12 +763,13 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
/* sign _early_ (optimistic!) to keep out of transaction scope! */
rctx->ev_sigs = GNUNET_new_array (rctx->num_fresh_coins,
struct TALER_DenominationSignature);
- for (unsigned int i=0;i<rctx->num_fresh_coins;i++)
+ for (unsigned int i = 0; i<rctx->num_fresh_coins; i++)
{
rctx->ev_sigs[i].rsa_signature
- = GNUNET_CRYPTO_rsa_sign_blinded (rctx->dkis[i]->denom_priv.rsa_private_key,
- rctx->rcds[i].coin_ev,
- rctx->rcds[i].coin_ev_size);
+ = GNUNET_CRYPTO_rsa_sign_blinded (
+ rctx->dkis[i]->denom_priv.rsa_private_key,
+ rctx->rcds[i].coin_ev,
+ rctx->rcds[i].coin_ev_size);
if (NULL == rctx->ev_sigs[i].rsa_signature)
{
GNUNET_break (0);
@@ -772,7 +783,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
the pre-check might be satisfied by a concurrent transaction
voiding our final commit due to uniqueness violation; naturally,
on hard errors we exit immediately */
- for (unsigned int retries=0;retries < MAX_REVEAL_RETRIES;retries++)
+ for (unsigned int retries = 0; retries < MAX_REVEAL_RETRIES; retries++)
{
/* do transactional work */
rctx->preflight_ok = GNUNET_NO;
@@ -825,17 +836,17 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
} /* end for (retries...) */
GNUNET_break (MHD_NO != res);
- cleanup:
+ cleanup:
GNUNET_break (MHD_NO != res);
/* free resources */
if (NULL != rctx->ev_sigs)
{
- for (unsigned int i=0;i<num_fresh_coins;i++)
+ for (unsigned int i = 0; i<num_fresh_coins; i++)
if (NULL != rctx->ev_sigs[i].rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (rctx->ev_sigs[i].rsa_signature);
GNUNET_free (rctx->ev_sigs);
}
- for (unsigned int i=0;i<num_fresh_coins;i++)
+ for (unsigned int i = 0; i<num_fresh_coins; i++)
GNUNET_free_non_null (rcds[i].coin_ev);
TEH_KS_release (key_state);
return res;
diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c
index 5fea37da0..ce66d6578 100644
--- a/src/exchange/taler-exchange-httpd_refund.c
+++ b/src/exchange/taler-exchange-httpd_refund.c
@@ -45,7 +45,7 @@
*/
static int
reply_refund_success (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_Refund *refund)
+ const struct TALER_EXCHANGEDB_Refund *refund)
{
struct TALER_RefundConfirmationPS rc;
struct TALER_ExchangePublicKeyP pub;
@@ -63,8 +63,8 @@ reply_refund_success (struct MHD_Connection *connection,
&refund->refund_fee);
if (GNUNET_OK !=
TEH_KS_sign (&rc.purpose,
- &pub,
- &sig))
+ &pub,
+ &sig))
{
return TEH_RESPONSE_reply_internal_error (connection,
TALER_EC_EXCHANGE_BAD_CONFIGURATION,
@@ -75,7 +75,8 @@ reply_refund_success (struct MHD_Connection *connection,
"{s:s, s:o, s:o}",
"status", "REFUND_OK",
"sig", GNUNET_JSON_from_data_auto (&sig),
- "pub", GNUNET_JSON_from_data_auto (&pub));
+ "pub", GNUNET_JSON_from_data_auto (
+ &pub));
}
@@ -90,14 +91,14 @@ reply_refund_success (struct MHD_Connection *connection,
*/
static int
reply_refund_failure (struct MHD_Connection *connection,
- unsigned int response_code,
- enum TALER_ErrorCode ec)
+ unsigned int response_code,
+ enum TALER_ErrorCode ec)
{
return TEH_RESPONSE_reply_json_pack (connection,
response_code,
"{s:s, s:I}",
"status", "refund failure",
- "code", (json_int_t) ec);
+ "code", (json_int_t) ec);
}
@@ -111,14 +112,17 @@ reply_refund_failure (struct MHD_Connection *connection,
*/
static int
reply_refund_conflict (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_TransactionList *tl)
+ const struct TALER_EXCHANGEDB_TransactionList *tl)
{
return TEH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_CONFLICT,
"{s:s, s:I, s:o}",
"status", "conflicting refund",
- "code", (json_int_t) TALER_EC_REFUND_CONFLICT,
- "history", TEH_RESPONSE_compile_transaction_history (tl));
+ "code",
+ (json_int_t) TALER_EC_REFUND_CONFLICT,
+ "history",
+ TEH_RESPONSE_compile_transaction_history (
+ tl));
}
@@ -142,9 +146,9 @@ reply_refund_conflict (struct MHD_Connection *connection,
*/
static enum GNUNET_DB_QueryStatus
refund_transaction (void *cls,
- struct MHD_Connection *connection,
- struct TALER_EXCHANGEDB_Session *session,
- int *mhd_ret)
+ struct MHD_Connection *connection,
+ struct TALER_EXCHANGEDB_Session *session,
+ int *mhd_ret)
{
const struct TALER_EXCHANGEDB_Refund *refund = cls;
struct TALER_EXCHANGEDB_TransactionList *tl;
@@ -170,8 +174,8 @@ refund_transaction (void *cls,
{
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
*mhd_ret = reply_refund_failure (connection,
- MHD_HTTP_NOT_FOUND,
- TALER_EC_REFUND_COIN_NOT_FOUND);
+ MHD_HTTP_NOT_FOUND,
+ TALER_EC_REFUND_COIN_NOT_FOUND);
return qs;
}
deposit_found = GNUNET_NO;
@@ -254,14 +258,14 @@ refund_transaction (void *cls,
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
*mhd_ret = TEH_RESPONSE_reply_transaction_unknown (connection,
- TALER_EC_REFUND_DEPOSIT_NOT_FOUND);
+ TALER_EC_REFUND_DEPOSIT_NOT_FOUND);
return GNUNET_DB_STATUS_HARD_ERROR;
}
/* handle if conflicting refund found */
if (GNUNET_SYSERR == refund_found)
{
*mhd_ret = reply_refund_conflict (connection,
- tl);
+ tl);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
return GNUNET_DB_STATUS_HARD_ERROR;
@@ -271,7 +275,7 @@ refund_transaction (void *cls,
{
/* /refund already done, simply re-transmit confirmation */
*mhd_ret = reply_refund_success (connection,
- ref);
+ ref);
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
return GNUNET_DB_STATUS_HARD_ERROR;
@@ -287,15 +291,15 @@ refund_transaction (void *cls,
{
GNUNET_break_op (0); /* currency missmatch */
*mhd_ret = reply_refund_failure (connection,
- MHD_HTTP_PRECONDITION_FAILED,
- TALER_EC_REFUND_CURRENCY_MISSMATCH);
+ MHD_HTTP_PRECONDITION_FAILED,
+ TALER_EC_REFUND_CURRENCY_MISSMATCH);
return GNUNET_DB_STATUS_HARD_ERROR;
}
/* check if we already send the money for the /deposit */
qs = TEH_plugin->test_deposit_done (TEH_plugin->cls,
- session,
- dep);
+ session,
+ dep);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
/* Internal error, we first had the deposit in the history,
@@ -304,8 +308,8 @@ refund_transaction (void *cls,
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
*mhd_ret = TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_REFUND_DB_INCONSISTENT,
- "database inconsistent");
+ TALER_EC_REFUND_DB_INCONSISTENT,
+ "database inconsistent");
return qs;
}
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
@@ -317,8 +321,8 @@ refund_transaction (void *cls,
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
*mhd_ret = reply_refund_failure (connection,
- MHD_HTTP_GONE,
- TALER_EC_REFUND_MERCHANT_ALREADY_PAID);
+ MHD_HTTP_GONE,
+ TALER_EC_REFUND_MERCHANT_ALREADY_PAID);
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -330,8 +334,8 @@ refund_transaction (void *cls,
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
*mhd_ret = reply_refund_failure (connection,
- MHD_HTTP_PRECONDITION_FAILED,
- TALER_EC_REFUND_INSUFFICIENT_FUNDS);
+ MHD_HTTP_PRECONDITION_FAILED,
+ TALER_EC_REFUND_INSUFFICIENT_FUNDS);
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -360,8 +364,8 @@ refund_transaction (void *cls,
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
*mhd_ret = TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_REFUND_DENOMINATION_KEY_NOT_FOUND,
- "denomination key not found");
+ TALER_EC_REFUND_DENOMINATION_KEY_NOT_FOUND,
+ "denomination key not found");
return GNUNET_DB_STATUS_HARD_ERROR;
}
TALER_amount_ntoh (&expect_fee,
@@ -375,8 +379,8 @@ refund_transaction (void *cls,
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
*mhd_ret = TEH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_REFUND_FEE_TOO_LOW,
- "refund_fee");
+ TALER_EC_REFUND_FEE_TOO_LOW,
+ "refund_fee");
return GNUNET_DB_STATUS_HARD_ERROR;
}
if (1 == fee_cmp)
@@ -389,13 +393,13 @@ refund_transaction (void *cls,
/* Finally, store new refund data */
qs = TEH_plugin->insert_refund (TEH_plugin->cls,
- session,
- refund);
+ session,
+ refund);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
TALER_LOG_WARNING ("Failed to store /refund information in database\n");
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_REFUND_STORE_DB_ERROR);
+ TALER_EC_REFUND_STORE_DB_ERROR);
return qs;
}
/* Success or soft failure */
@@ -415,7 +419,7 @@ refund_transaction (void *cls,
*/
static int
verify_and_execute_refund (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_Refund *refund)
+ const struct TALER_EXCHANGEDB_Refund *refund)
{
struct TALER_RefundRequestPS rr;
int mhd_ret;
@@ -436,7 +440,7 @@ verify_and_execute_refund (struct MHD_Connection *connection,
{
GNUNET_break_op (0);
return TEH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_REFUND_FEE_CURRENCY_MISSMATCH,
+ TALER_EC_REFUND_FEE_CURRENCY_MISSMATCH,
"refund_fee");
}
if (-1 == TALER_amount_cmp (&refund->refund_amount,
@@ -444,8 +448,8 @@ verify_and_execute_refund (struct MHD_Connection *connection,
{
GNUNET_break_op (0);
return TEH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_REFUND_FEE_ABOVE_AMOUNT,
- "refund_amount");
+ TALER_EC_REFUND_FEE_ABOVE_AMOUNT,
+ "refund_amount");
}
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND,
@@ -455,18 +459,18 @@ verify_and_execute_refund (struct MHD_Connection *connection,
{
TALER_LOG_WARNING ("Invalid signature on /refund request\n");
return TEH_RESPONSE_reply_signature_invalid (connection,
- TALER_EC_REFUND_MERCHANT_SIGNATURE_INVALID,
+ TALER_EC_REFUND_MERCHANT_SIGNATURE_INVALID,
"merchant_sig");
}
if (GNUNET_OK !=
TEH_DB_run_transaction (connection,
"run refund",
- &mhd_ret,
- &refund_transaction,
- (void *) refund))
+ &mhd_ret,
+ &refund_transaction,
+ (void *) refund))
return mhd_ret;
return reply_refund_success (connection,
- refund);
+ refund);
}
@@ -486,10 +490,10 @@ verify_and_execute_refund (struct MHD_Connection *connection,
*/
int
TEH_REFUND_handler_refund (struct TEH_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)
{
json_t *json;
int res;
@@ -523,7 +527,7 @@ TEH_REFUND_handler_refund (struct TEH_RequestHandler *rh,
if (GNUNET_NO == res)
return MHD_YES; /* failure */
res = verify_and_execute_refund (connection,
- &refund);
+ &refund);
GNUNET_JSON_parse_free (spec);
return res;
}
diff --git a/src/exchange/taler-exchange-httpd_refund.h b/src/exchange/taler-exchange-httpd_refund.h
index 1fa52b148..ce5aa351b 100644
--- a/src/exchange/taler-exchange-httpd_refund.h
+++ b/src/exchange/taler-exchange-httpd_refund.h
@@ -44,9 +44,9 @@
*/
int
TEH_REFUND_handler_refund (struct TEH_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);
#endif
diff --git a/src/exchange/taler-exchange-httpd_reserve_status.c b/src/exchange/taler-exchange-httpd_reserve_status.c
index 6ff73de75..a3f4dac9d 100644
--- a/src/exchange/taler-exchange-httpd_reserve_status.c
+++ b/src/exchange/taler-exchange-httpd_reserve_status.c
@@ -38,17 +38,17 @@
*/
static int
reply_reserve_status_success (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_ReserveHistory *rh)
+ const struct TALER_EXCHANGEDB_ReserveHistory *rh)
{
json_t *json_balance;
json_t *json_history;
struct TALER_Amount balance;
json_history = TEH_RESPONSE_compile_reserve_history (rh,
- &balance);
+ &balance);
if (NULL == json_history)
return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_RESERVE_STATUS_DB_ERROR,
+ TALER_EC_RESERVE_STATUS_DB_ERROR,
"balance calculation failure");
json_balance = TALER_JSON_from_amount (&balance);
return TEH_RESPONSE_reply_json_pack (connection,
@@ -96,16 +96,16 @@ struct ReserveStatusContext
*/
static enum GNUNET_DB_QueryStatus
reserve_status_transaction (void *cls,
- struct MHD_Connection *connection,
- struct TALER_EXCHANGEDB_Session *session,
- int *mhd_ret)
+ struct MHD_Connection *connection,
+ struct TALER_EXCHANGEDB_Session *session,
+ int *mhd_ret)
{
struct ReserveStatusContext *rsc = cls;
return TEH_plugin->get_reserve_history (TEH_plugin->cls,
- session,
- &rsc->reserve_pub,
- &rsc->rh);
+ session,
+ &rsc->reserve_pub,
+ &rsc->rh);
}
@@ -136,7 +136,8 @@ TEH_RESERVE_handler_reserve_status (struct TEH_RequestHandler *rh,
res = TEH_PARSE_mhd_request_arg_data (connection,
"reserve_pub",
&rsc.reserve_pub,
- sizeof (struct TALER_ReservePublicKeyP));
+ sizeof (struct
+ TALER_ReservePublicKeyP));
if (GNUNET_SYSERR == res)
return MHD_NO; /* internal error */
if (GNUNET_NO == res)
@@ -145,9 +146,9 @@ TEH_RESERVE_handler_reserve_status (struct TEH_RequestHandler *rh,
if (GNUNET_OK !=
TEH_DB_run_transaction (connection,
"get reserve status",
- &mhd_ret,
- &reserve_status_transaction,
- &rsc))
+ &mhd_ret,
+ &reserve_status_transaction,
+ &rsc))
return mhd_ret;
/* generate proper response */
@@ -157,9 +158,11 @@ TEH_RESERVE_handler_reserve_status (struct TEH_RequestHandler *rh,
"{s:s, s:s, s:I}",
"error", "Reserve not found",
"parameter", "withdraw_pub",
- "code", (json_int_t) TALER_EC_RESERVE_STATUS_UNKNOWN);
+ "code",
+ (json_int_t)
+ TALER_EC_RESERVE_STATUS_UNKNOWN);
mhd_ret = reply_reserve_status_success (connection,
- rsc.rh);
+ rsc.rh);
TEH_plugin->free_reserve_history (TEH_plugin->cls,
rsc.rh);
return mhd_ret;
diff --git a/src/exchange/taler-exchange-httpd_reserve_withdraw.c b/src/exchange/taler-exchange-httpd_reserve_withdraw.c
index 65bca25e5..e5829d9dc 100644
--- a/src/exchange/taler-exchange-httpd_reserve_withdraw.c
+++ b/src/exchange/taler-exchange-httpd_reserve_withdraw.c
@@ -52,7 +52,8 @@
*/
static int
reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_ReserveHistory *rh)
+ const struct
+ TALER_EXCHANGEDB_ReserveHistory *rh)
{
json_t *json_balance;
json_t *json_history;
@@ -65,7 +66,7 @@ reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection,
* it fails "internally" to dump as string (= corrupted). */
|| (0 == json_dumpb (json_history, NULL, 0, 0)))
return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_WITHDRAW_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS,
+ TALER_EC_WITHDRAW_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS,
"balance calculation failure");
json_balance = TALER_JSON_from_amount (&balance);
@@ -73,7 +74,9 @@ reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection,
MHD_HTTP_FORBIDDEN,
"{s:s, s:I, s:o, s:o}",
"error", "Insufficient funds",
- "code", (json_int_t) TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS,
+ "code",
+ (json_int_t)
+ TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS,
"balance", json_balance,
"history", json_history);
}
@@ -88,7 +91,9 @@ reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection,
*/
static int
reply_reserve_withdraw_success (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable)
+ const struct
+ TALER_EXCHANGEDB_CollectableBlindcoin *
+ collectable)
{
json_t *sig_json;
@@ -205,7 +210,7 @@ withdraw_transaction (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_WITHDRAW_DB_FETCH_ERROR);
+ TALER_EC_WITHDRAW_DB_FETCH_ERROR);
wc->collectable.sig = denom_sig;
return qs;
}
@@ -248,14 +253,14 @@ withdraw_transaction (void *cls,
{
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_WITHDRAW_DB_FETCH_ERROR);
+ TALER_EC_WITHDRAW_DB_FETCH_ERROR);
return qs;
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
*mhd_ret = TEH_RESPONSE_reply_arg_unknown (connection,
- TALER_EC_WITHDRAW_RESERVE_UNKNOWN,
- "reserve_pub");
+ TALER_EC_WITHDRAW_RESERVE_UNKNOWN,
+ "reserve_pub");
return GNUNET_DB_STATUS_HARD_ERROR;
}
if (0 < TALER_amount_cmp (&wc->amount_required,
@@ -293,7 +298,7 @@ withdraw_transaction (void *cls,
}
/* Balance is good, sign the coin! */
-#if !OPTIMISTIC_SIGN
+#if ! OPTIMISTIC_SIGN
if (NULL == wc->collectable.sig.rsa_signature)
{
wc->collectable.sig.rsa_signature
@@ -326,7 +331,7 @@ withdraw_transaction (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_WITHDRAW_DB_STORE_ERROR);
+ TALER_EC_WITHDRAW_DB_STORE_ERROR);
return qs;
}
return qs;
@@ -407,7 +412,7 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh,
GNUNET_JSON_parse_free (spec);
TEH_KS_release (wc.key_state);
return TEH_RESPONSE_reply_arg_unknown (connection,
- TALER_EC_WITHDRAW_DENOMINATION_KEY_NOT_FOUND,
+ TALER_EC_WITHDRAW_DENOMINATION_KEY_NOT_FOUND,
"denom_pub");
}
GNUNET_assert (NULL != wc.dki->denom_priv.rsa_private_key);
@@ -417,14 +422,14 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh,
&wc.dki->issue.properties.fee_withdraw);
if (GNUNET_OK !=
TALER_amount_add (&wc.amount_required,
- &amount,
- &fee_withdraw))
+ &amount,
+ &fee_withdraw))
{
GNUNET_JSON_parse_free (spec);
TEH_KS_release (wc.key_state);
return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_WITHDRAW_AMOUNT_FEE_OVERFLOW,
- "amount overflow for value plus withdraw fee");
+ TALER_EC_WITHDRAW_AMOUNT_FEE_OVERFLOW,
+ "amount overflow for value plus withdraw fee");
}
TALER_amount_hton (&wc.wsrd.amount_with_fee,
&wc.amount_required);
@@ -446,11 +451,12 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh,
&wc.signature.eddsa_signature,
&wc.wsrd.reserve_pub.eddsa_pub))
{
- TALER_LOG_WARNING ("Client supplied invalid signature for /reserve/withdraw request\n");
+ TALER_LOG_WARNING (
+ "Client supplied invalid signature for /reserve/withdraw request\n");
GNUNET_JSON_parse_free (spec);
TEH_KS_release (wc.key_state);
return TEH_RESPONSE_reply_signature_invalid (connection,
- TALER_EC_WITHDRAW_RESERVE_SIGNATURE_INVALID,
+ TALER_EC_WITHDRAW_RESERVE_SIGNATURE_INVALID,
"reserve_sig");
}
@@ -474,9 +480,9 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh,
if (GNUNET_OK !=
TEH_DB_run_transaction (connection,
"run reserve withdraw",
- &mhd_ret,
- &withdraw_transaction,
- &wc))
+ &mhd_ret,
+ &withdraw_transaction,
+ &wc))
{
TEH_KS_release (wc.key_state);
/* Even if #withdraw_transaction() failed, it may have created a signature
@@ -490,7 +496,7 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh,
GNUNET_JSON_parse_free (spec);
mhd_ret = reply_reserve_withdraw_success (connection,
- &wc.collectable);
+ &wc.collectable);
GNUNET_CRYPTO_rsa_signature_free (wc.collectable.sig.rsa_signature);
return mhd_ret;
}
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index f05e42604..1c2f92f0e 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -74,22 +74,22 @@ TEH_RESPONSE_can_compress (struct MHD_Connection *connection)
const char *de;
ae = MHD_lookup_connection_value (connection,
- MHD_HEADER_KIND,
- MHD_HTTP_HEADER_ACCEPT_ENCODING);
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_ACCEPT_ENCODING);
if (NULL == ae)
return MHD_NO;
if (0 == strcmp (ae,
"*"))
return MHD_YES;
de = strstr (ae,
- "deflate");
+ "deflate");
if (NULL == de)
return MHD_NO;
if ( ( (de == ae) ||
- (de[-1] == ',') ||
- (de[-1] == ' ') ) &&
+ (de[-1] == ',') ||
+ (de[-1] == ' ') ) &&
( (de[strlen ("deflate")] == '\0') ||
- (de[strlen ("deflate")] == ',') ||
+ (de[strlen ("deflate")] == ',') ||
(de[strlen ("deflate")] == ';') ) )
return MHD_YES;
return MHD_NO;
@@ -116,9 +116,9 @@ TEH_RESPONSE_body_compress (void **buf,
if (NULL == cbuf)
return MHD_NO;
ret = compress (cbuf,
- &cbuf_size,
- (const Bytef *) *buf,
- *buf_size);
+ &cbuf_size,
+ (const Bytef *) *buf,
+ *buf_size);
if ( (Z_OK != ret) ||
(cbuf_size >= *buf_size) )
{
@@ -153,7 +153,7 @@ TEH_RESPONSE_reply_json (struct MHD_Connection *connection,
int comp;
json_str = json_dumps (json,
- JSON_INDENT(2));
+ JSON_INDENT (2));
if (NULL == json_str)
{
/**
@@ -172,7 +172,7 @@ TEH_RESPONSE_reply_json (struct MHD_Connection *connection,
if (MHD_YES ==
TEH_RESPONSE_can_compress (connection))
comp = TEH_RESPONSE_body_compress (&json_str,
- &json_len);
+ &json_len);
resp = MHD_create_response_from_buffer (json_len,
json_str,
MHD_RESPMEM_MUST_FREE);
@@ -460,7 +460,8 @@ TEH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection)
MHD_HTTP_BAD_REQUEST,
"{s:s, s:I}",
"error", "invalid json",
- "code", (json_int_t) TALER_EC_JSON_INVALID);
+ "code",
+ (json_int_t) TALER_EC_JSON_INVALID);
}
@@ -471,7 +472,8 @@ TEH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection)
* @return json representation of the @a rh, NULL on error
*/
json_t *
-TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_TransactionList *tl)
+TEH_RESPONSE_compile_transaction_history (const struct
+ TALER_EXCHANGEDB_TransactionList *tl)
{
json_t *history;
@@ -497,7 +499,8 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
dr.h_contract_terms = deposit->h_contract_terms;
dr.h_wire = deposit->h_wire;
dr.timestamp = GNUNET_TIME_absolute_hton (deposit->timestamp);
- dr.refund_deadline = GNUNET_TIME_absolute_hton (deposit->refund_deadline);
+ dr.refund_deadline = GNUNET_TIME_absolute_hton (
+ deposit->refund_deadline);
TALER_amount_hton (&dr.amount_with_fee,
&deposit->amount_with_fee);
TALER_amount_hton (&dr.deposit_fee,
@@ -519,16 +522,32 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
#endif
if (0 !=
json_array_append_new (history,
- json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
- "type", "DEPOSIT",
- "amount", TALER_JSON_from_amount (&deposit->amount_with_fee),
- "deposit_fee", TALER_JSON_from_amount (&deposit->deposit_fee),
- "timestamp", GNUNET_JSON_from_time_abs (deposit->timestamp),
- "refund_deadline", GNUNET_JSON_from_time_abs (deposit->refund_deadline),
- "merchant_pub", GNUNET_JSON_from_data_auto (&deposit->merchant_pub),
- "h_contract_terms", GNUNET_JSON_from_data_auto (&deposit->h_contract_terms),
- "h_wire", GNUNET_JSON_from_data_auto (&deposit->h_wire),
- "coin_sig", GNUNET_JSON_from_data_auto (&deposit->csig))))
+ json_pack (
+ "{s:s, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
+ "type", "DEPOSIT",
+ "amount", TALER_JSON_from_amount (
+ &deposit->amount_with_fee),
+ "deposit_fee",
+ TALER_JSON_from_amount (
+ &deposit->deposit_fee),
+ "timestamp",
+ GNUNET_JSON_from_time_abs (
+ deposit->timestamp),
+ "refund_deadline",
+ GNUNET_JSON_from_time_abs (
+ deposit->refund_deadline),
+ "merchant_pub",
+ GNUNET_JSON_from_data_auto (
+ &deposit->merchant_pub),
+ "h_contract_terms",
+ GNUNET_JSON_from_data_auto (
+ &deposit->h_contract_terms),
+ "h_wire",
+ GNUNET_JSON_from_data_auto (
+ &deposit->h_wire),
+ "coin_sig",
+ GNUNET_JSON_from_data_auto (
+ &deposit->csig))))
{
GNUNET_break (0);
json_decref (history);
@@ -542,7 +561,8 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
const struct TALER_EXCHANGEDB_RefreshMelt *melt = pos->details.melt;
ms.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
- ms.purpose.size = htonl (sizeof (struct TALER_RefreshMeltCoinAffirmationPS));
+ ms.purpose.size = htonl (sizeof (struct
+ TALER_RefreshMeltCoinAffirmationPS));
ms.rc = melt->session.rc;
TALER_amount_hton (&ms.amount_with_fee,
&melt->session.amount_with_fee);
@@ -566,10 +586,16 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
json_array_append_new (history,
json_pack ("{s:s, s:o, s:o, s:o, s:o}",
"type", "MELT",
- "amount", TALER_JSON_from_amount (&melt->session.amount_with_fee),
- "melt_fee", TALER_JSON_from_amount (&melt->melt_fee),
- "rc", GNUNET_JSON_from_data_auto (&melt->session.rc),
- "coin_sig", GNUNET_JSON_from_data_auto (&melt->session.coin_sig))))
+ "amount", TALER_JSON_from_amount (
+ &melt->session.amount_with_fee),
+ "melt_fee",
+ TALER_JSON_from_amount (
+ &melt->melt_fee),
+ "rc", GNUNET_JSON_from_data_auto (
+ &melt->session.rc),
+ "coin_sig",
+ GNUNET_JSON_from_data_auto (
+ &melt->session.coin_sig))))
{
GNUNET_break (0);
json_decref (history);
@@ -617,14 +643,25 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
#endif
if (0 !=
json_array_append_new (history,
- json_pack ("{s:s, s:o, s:o, s:o, s:o, s:I, s:o}",
- "type", "REFUND",
- "amount", TALER_JSON_from_amount (&value),
- "refund_fee", TALER_JSON_from_amount (&refund->refund_fee),
- "h_contract_terms", GNUNET_JSON_from_data_auto (&refund->h_contract_terms),
- "merchant_pub", GNUNET_JSON_from_data_auto (&refund->merchant_pub),
- "rtransaction_id", (json_int_t) refund->rtransaction_id,
- "merchant_sig", GNUNET_JSON_from_data_auto (&refund->merchant_sig))))
+ json_pack (
+ "{s:s, s:o, s:o, s:o, s:o, s:I, s:o}",
+ "type", "REFUND",
+ "amount", TALER_JSON_from_amount (
+ &value),
+ "refund_fee",
+ TALER_JSON_from_amount (
+ &refund->refund_fee),
+ "h_contract_terms",
+ GNUNET_JSON_from_data_auto (
+ &refund->h_contract_terms),
+ "merchant_pub",
+ GNUNET_JSON_from_data_auto (
+ &refund->merchant_pub),
+ "rtransaction_id",
+ (json_int_t) refund->rtransaction_id,
+ "merchant_sig",
+ GNUNET_JSON_from_data_auto (
+ &refund->merchant_sig))))
{
GNUNET_break (0);
json_decref (history);
@@ -634,12 +671,14 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
break;
case TALER_EXCHANGEDB_TT_OLD_COIN_PAYBACK:
{
- struct TALER_EXCHANGEDB_PaybackRefresh *pr = pos->details.old_coin_payback;
+ struct TALER_EXCHANGEDB_PaybackRefresh *pr =
+ pos->details.old_coin_payback;
struct TALER_PaybackRefreshConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig;
- pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH);
+ pc.purpose.purpose = htonl (
+ TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH);
pc.purpose.size = htonl (sizeof (pc));
pc.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp);
TALER_amount_hton (&pc.payback_amount,
@@ -664,11 +703,20 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
json_array_append_new (history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
"type", "OLD-COIN-PAYBACK",
- "amount", TALER_JSON_from_amount (&pr->value),
- "exchange_sig", GNUNET_JSON_from_data_auto (&esig),
- "exchange_pub", GNUNET_JSON_from_data_auto (&epub),
- "coin_pub", GNUNET_JSON_from_data_auto (&pr->coin.coin_pub),
- "timestamp", GNUNET_JSON_from_time_abs (pr->timestamp))))
+ "amount", TALER_JSON_from_amount (
+ &pr->value),
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (
+ &esig),
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (
+ &epub),
+ "coin_pub",
+ GNUNET_JSON_from_data_auto (
+ &pr->coin.coin_pub),
+ "timestamp",
+ GNUNET_JSON_from_time_abs (
+ pr->timestamp))))
{
GNUNET_break (0);
json_decref (history);
@@ -703,11 +751,20 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
json_array_append_new (history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
"type", "PAYBACK",
- "amount", TALER_JSON_from_amount (&payback->value),
- "exchange_sig", GNUNET_JSON_from_data_auto (&esig),
- "exchange_pub", GNUNET_JSON_from_data_auto (&epub),
- "reserve_pub", GNUNET_JSON_from_data_auto (&payback->reserve_pub),
- "timestamp", GNUNET_JSON_from_time_abs (payback->timestamp))))
+ "amount", TALER_JSON_from_amount (
+ &payback->value),
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (
+ &esig),
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (
+ &epub),
+ "reserve_pub",
+ GNUNET_JSON_from_data_auto (
+ &payback->reserve_pub),
+ "timestamp",
+ GNUNET_JSON_from_time_abs (
+ payback->timestamp))))
{
GNUNET_break (0);
json_decref (history);
@@ -717,12 +774,14 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
break;
case TALER_EXCHANGEDB_TT_PAYBACK_REFRESH:
{
- struct TALER_EXCHANGEDB_PaybackRefresh *pr = pos->details.payback_refresh;
+ struct TALER_EXCHANGEDB_PaybackRefresh *pr =
+ pos->details.payback_refresh;
struct TALER_PaybackRefreshConfirmationPS pc;
struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig;
- pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH);
+ pc.purpose.purpose = htonl (
+ TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK_REFRESH);
pc.purpose.size = htonl (sizeof (pc));
pc.timestamp = GNUNET_TIME_absolute_hton (pr->timestamp);
TALER_amount_hton (&pc.payback_amount,
@@ -747,11 +806,20 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
json_array_append_new (history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
"type", "PAYBACK-REFRESH",
- "amount", TALER_JSON_from_amount (&pr->value),
- "exchange_sig", GNUNET_JSON_from_data_auto (&esig),
- "exchange_pub", GNUNET_JSON_from_data_auto (&epub),
- "old_coin_pub", GNUNET_JSON_from_data_auto (&pr->old_coin_pub),
- "timestamp", GNUNET_JSON_from_time_abs (pr->timestamp))))
+ "amount", TALER_JSON_from_amount (
+ &pr->value),
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (
+ &esig),
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (
+ &epub),
+ "old_coin_pub",
+ GNUNET_JSON_from_data_auto (
+ &pr->old_coin_pub),
+ "timestamp",
+ GNUNET_JSON_from_time_abs (
+ pr->timestamp))))
{
GNUNET_break (0);
json_decref (history);
@@ -781,7 +849,8 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact
int
TEH_RESPONSE_reply_coin_insufficient_funds (struct MHD_Connection *connection,
enum TALER_ErrorCode ec,
- const struct TALER_EXCHANGEDB_TransactionList *tl)
+ const struct
+ TALER_EXCHANGEDB_TransactionList *tl)
{
json_t *history;
@@ -808,7 +877,8 @@ TEH_RESPONSE_reply_coin_insufficient_funds (struct MHD_Connection *connection,
* @return json representation of the @a rh, NULL on error
*/
json_t *
-TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHistory *rh,
+TEH_RESPONSE_compile_reserve_history (const struct
+ TALER_EXCHANGEDB_ReserveHistory *rh,
struct TALER_Amount *balance)
{
struct TALER_Amount deposit_total;
@@ -827,30 +897,38 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
if (0 == (1 & ret))
deposit_total = pos->details.bank->amount;
- else
- if (GNUNET_OK !=
- TALER_amount_add (&deposit_total,
- &deposit_total,
- &pos->details.bank->amount))
- {
- GNUNET_break (0);
- json_decref (json_history);
- return NULL;
- }
+ else if (GNUNET_OK !=
+ TALER_amount_add (&deposit_total,
+ &deposit_total,
+ &pos->details.bank->amount))
+ {
+ GNUNET_break (0);
+ json_decref (json_history);
+ return NULL;
+ }
ret |= 1;
if (0 !=
json_array_append_new (json_history,
json_pack ("{s:s, s:o, s:s, s:o, s:o}",
"type", "DEPOSIT",
- "timestamp", GNUNET_JSON_from_time_abs (pos->details.bank->execution_date),
- "sender_account_url", pos->details.bank->sender_account_details,
- "wire_reference", GNUNET_JSON_from_data (pos->details.bank->wire_reference,
- pos->details.bank->wire_reference_size),
- "amount", TALER_JSON_from_amount (&pos->details.bank->amount))))
+ "timestamp",
+ GNUNET_JSON_from_time_abs (
+ pos->details.bank->execution_date),
+ "sender_account_url",
+ pos->details.bank->
+ sender_account_details,
+ "wire_reference",
+ GNUNET_JSON_from_data (
+ pos->details.bank->wire_reference,
+ pos
+ ->details.
+ bank->wire_reference_size),
+ "amount", TALER_JSON_from_amount (
+ &pos->details.bank->amount))))
{
GNUNET_break (0);
- json_decref (json_history);
- return NULL;
+ json_decref (json_history);
+ return NULL;
}
break;
case TALER_EXCHANGEDB_RO_WITHDRAW_COIN:
@@ -879,11 +957,24 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
json_array_append_new (json_history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
"type", "WITHDRAW",
- "reserve_sig", GNUNET_JSON_from_data_auto (&pos->details.withdraw->reserve_sig),
- "h_coin_envelope", GNUNET_JSON_from_data_auto (&pos->details.withdraw->h_coin_envelope),
- "h_denom_pub", GNUNET_JSON_from_data_auto (&pos->details.withdraw->denom_pub_hash),
- "withdraw_fee", TALER_JSON_from_amount (&pos->details.withdraw->withdraw_fee),
- "amount", TALER_JSON_from_amount (&value))))
+ "reserve_sig",
+ GNUNET_JSON_from_data_auto (
+ &pos->details.withdraw->
+ reserve_sig),
+ "h_coin_envelope",
+ GNUNET_JSON_from_data_auto (
+ &pos->details.withdraw->
+ h_coin_envelope),
+ "h_denom_pub",
+ GNUNET_JSON_from_data_auto (
+ &pos->details.withdraw->
+ denom_pub_hash),
+ "withdraw_fee",
+ TALER_JSON_from_amount (
+ &pos->details.withdraw->
+ withdraw_fee),
+ "amount", TALER_JSON_from_amount (
+ &value))))
{
GNUNET_break (0);
json_decref (json_history);
@@ -901,16 +992,15 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
payback = pos->details.payback;
if (0 == (1 & ret))
deposit_total = payback->value;
- else
- if (GNUNET_OK !=
- TALER_amount_add (&deposit_total,
- &deposit_total,
- &payback->value))
- {
- GNUNET_break (0);
- json_decref (json_history);
- return NULL;
- }
+ else if (GNUNET_OK !=
+ TALER_amount_add (&deposit_total,
+ &deposit_total,
+ &payback->value))
+ {
+ GNUNET_break (0);
+ json_decref (json_history);
+ return NULL;
+ }
ret |= 1;
pc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_PAYBACK);
pc.purpose.size = htonl (sizeof (struct TALER_PaybackConfirmationPS));
@@ -933,11 +1023,18 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
json_array_append_new (json_history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
"type", "PAYBACK",
- "exchange_pub", GNUNET_JSON_from_data_auto (&pub),
- "exchange_sig", GNUNET_JSON_from_data_auto (&sig),
- "timestamp", GNUNET_JSON_from_time_abs (payback->timestamp),
- "amount", TALER_JSON_from_amount (&payback->value),
- "coin_pub", GNUNET_JSON_from_data_auto (&payback->coin.coin_pub))))
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (&pub),
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (&sig),
+ "timestamp",
+ GNUNET_JSON_from_time_abs (
+ payback->timestamp),
+ "amount", TALER_JSON_from_amount (
+ &payback->value),
+ "coin_pub",
+ GNUNET_JSON_from_data_auto (
+ &payback->coin.coin_pub))))
{
GNUNET_break (0);
json_decref (json_history);
@@ -971,15 +1068,19 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
}
ret |= 2;
rcc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED);
- rcc.purpose.size = htonl (sizeof (struct TALER_ReserveCloseConfirmationPS));
- rcc.timestamp = GNUNET_TIME_absolute_hton (pos->details.closing->execution_date);
+ rcc.purpose.size = htonl (sizeof (struct
+ TALER_ReserveCloseConfirmationPS));
+ rcc.timestamp = GNUNET_TIME_absolute_hton (
+ pos->details.closing->execution_date);
TALER_amount_hton (&rcc.closing_amount,
&value);
TALER_amount_hton (&rcc.closing_fee,
&pos->details.closing->closing_fee);
rcc.reserve_pub = pos->details.closing->reserve_pub;
GNUNET_CRYPTO_hash (pos->details.closing->receiver_account_details,
- strlen (pos->details.closing->receiver_account_details) + 1,
+ strlen (
+ pos->details.closing->receiver_account_details)
+ + 1,
&rcc.h_wire);
rcc.wtid = pos->details.closing->wtid;
if (GNUNET_OK !=
@@ -993,15 +1094,27 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
}
if (0 !=
json_array_append_new (json_history,
- json_pack ("{s:s, s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
- "type", "CLOSING",
- "receiver_account_details", pos->details.closing->receiver_account_details,
- "wtid", GNUNET_JSON_from_data_auto (&pos->details.closing->wtid),
- "exchange_pub", GNUNET_JSON_from_data_auto (&pub),
- "exchange_sig", GNUNET_JSON_from_data_auto (&sig),
- "timestamp", GNUNET_JSON_from_time_abs (pos->details.closing->execution_date),
- "amount", TALER_JSON_from_amount (&value),
- "closing_fee", TALER_JSON_from_amount (&pos->details.closing->closing_fee))))
+ json_pack (
+ "{s:s, s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
+ "type", "CLOSING",
+ "receiver_account_details",
+ pos->details.closing->
+ receiver_account_details,
+ "wtid",
+ GNUNET_JSON_from_data_auto (
+ &pos->details.closing->wtid),
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (&pub),
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (&sig),
+ "timestamp",
+ GNUNET_JSON_from_time_abs (
+ pos->details.closing->execution_date),
+ "amount", TALER_JSON_from_amount (
+ &value),
+ "closing_fee",
+ TALER_JSON_from_amount (
+ &pos->details.closing->closing_fee))))
{
GNUNET_break (0);
json_decref (json_history);
diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h
index 9b1271569..177eaa43e 100644
--- a/src/exchange/taler-exchange-httpd_responses.h
+++ b/src/exchange/taler-exchange-httpd_responses.h
@@ -54,7 +54,7 @@ TEH_RESPONSE_add_global_headers (struct MHD_Response *response);
*/
int
TEH_RESPONSE_body_compress (void **buf,
- size_t *buf_size);
+ size_t *buf_size);
/**
@@ -108,7 +108,7 @@ TEH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
*/
int
TEH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name);
@@ -122,7 +122,7 @@ TEH_RESPONSE_reply_signature_invalid (struct MHD_Connection *connection,
*/
int
TEH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name);
@@ -138,7 +138,7 @@ TEH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
*/
int
TEH_RESPONSE_reply_arg_unknown (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
+ enum TALER_ErrorCode ec,
const char *param_name);
@@ -239,8 +239,9 @@ TEH_RESPONSE_reply_invalid_json (struct MHD_Connection *connectionx);
* @return json representation of the @a rh, NULL on error
*/
json_t *
-TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHistory *rh,
- struct TALER_Amount *balance);
+TEH_RESPONSE_compile_reserve_history (const struct
+ TALER_EXCHANGEDB_ReserveHistory *rh,
+ struct TALER_Amount *balance);
/**
@@ -257,7 +258,8 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
int
TEH_RESPONSE_reply_coin_insufficient_funds (struct MHD_Connection *connection,
enum TALER_ErrorCode ec,
- const struct TALER_EXCHANGEDB_TransactionList *tl);
+ const struct
+ TALER_EXCHANGEDB_TransactionList *tl);
/**
@@ -271,7 +273,7 @@ TEH_RESPONSE_reply_coin_insufficient_funds (struct MHD_Connection *connection,
*/
int
TEH_RESPONSE_reply_transaction_unknown (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec);
+ enum TALER_ErrorCode ec);
/**
@@ -281,7 +283,8 @@ TEH_RESPONSE_reply_transaction_unknown (struct MHD_Connection *connection,
* @return json representation of the @a rh
*/
json_t *
-TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_TransactionList *tl);
+TEH_RESPONSE_compile_transaction_history (const struct
+ TALER_EXCHANGEDB_TransactionList *tl);
#endif
diff --git a/src/exchange/taler-exchange-httpd_test.c b/src/exchange/taler-exchange-httpd_test.c
index 73ce0e556..b55a98885 100644
--- a/src/exchange/taler-exchange-httpd_test.c
+++ b/src/exchange/taler-exchange-httpd_test.c
@@ -53,10 +53,10 @@ static struct GNUNET_CRYPTO_RsaPrivateKey *rsa_pk;
*/
int
TEH_TEST_handler_test_base32 (struct TEH_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)
{
json_t *json;
int res;
@@ -78,20 +78,20 @@ TEH_TEST_handler_test_base32 (struct TEH_RequestHandler *rh,
if ( (GNUNET_NO == res) || (NULL == json) )
return MHD_YES;
res = TEH_PARSE_json_data (connection,
- json,
- spec);
+ json,
+ spec);
if (GNUNET_YES != res)
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
GNUNET_CRYPTO_hash (in_ptr,
- in_ptr_size,
- &hc);
+ in_ptr_size,
+ &hc);
GNUNET_JSON_parse_free (spec);
json_decref (json);
return TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o}",
- "output",
- GNUNET_JSON_from_data_auto (&hc));
+ MHD_HTTP_OK,
+ "{s:o}",
+ "output",
+ GNUNET_JSON_from_data_auto (&hc));
}
@@ -114,10 +114,10 @@ TEH_TEST_handler_test_base32 (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test_encrypt (struct TEH_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)
{
json_t *json;
int res;
@@ -143,37 +143,39 @@ TEH_TEST_handler_test_encrypt (struct TEH_RequestHandler *rh,
if ( (GNUNET_NO == res) || (NULL == json) )
return MHD_YES;
res = TEH_PARSE_json_data (connection,
- json,
- spec);
+ json,
+ spec);
json_decref (json);
if (GNUNET_YES != res)
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey),
- "skey", strlen ("skey"),
- &key, sizeof (key),
- NULL, 0));
+ GNUNET_CRYPTO_kdf (&skey, sizeof (struct
+ GNUNET_CRYPTO_SymmetricSessionKey),
+ "skey", strlen ("skey"),
+ &key, sizeof (key),
+ NULL, 0));
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector),
- "iv", strlen ("iv"),
- &key, sizeof (key),
- NULL, 0));
+ GNUNET_CRYPTO_kdf (&iv, sizeof (struct
+ GNUNET_CRYPTO_SymmetricInitializationVector),
+ "iv", strlen ("iv"),
+ &key, sizeof (key),
+ NULL, 0));
out = GNUNET_malloc (in_ptr_size);
GNUNET_break (in_ptr_size ==
- GNUNET_CRYPTO_symmetric_encrypt (in_ptr,
- in_ptr_size,
- &skey,
- &iv,
- out));
+ GNUNET_CRYPTO_symmetric_encrypt (in_ptr,
+ in_ptr_size,
+ &skey,
+ &iv,
+ out));
json = GNUNET_JSON_from_data (out,
in_ptr_size);
GNUNET_free (out);
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o}",
- "output",
- json);
+ MHD_HTTP_OK,
+ "{s:o}",
+ "output",
+ json);
}
@@ -196,10 +198,10 @@ TEH_TEST_handler_test_encrypt (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test_hkdf (struct TEH_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)
{
json_t *json;
int res;
@@ -221,8 +223,8 @@ TEH_TEST_handler_test_hkdf (struct TEH_RequestHandler *rh,
if ( (GNUNET_NO == res) || (NULL == json) )
return MHD_YES;
res = TEH_PARSE_json_data (connection,
- json,
- spec);
+ json,
+ spec);
json_decref (json);
if (GNUNET_YES != res)
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
@@ -235,10 +237,10 @@ TEH_TEST_handler_test_hkdf (struct TEH_RequestHandler *rh,
GNUNET_JSON_parse_free (spec);
json = GNUNET_JSON_from_data_auto (&hc);
return TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o}",
- "output",
- json);
+ MHD_HTTP_OK,
+ "{s:o}",
+ "output",
+ json);
}
@@ -258,10 +260,10 @@ TEH_TEST_handler_test_hkdf (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test_ecdhe (struct TEH_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)
{
json_t *json;
int res;
@@ -284,27 +286,27 @@ TEH_TEST_handler_test_ecdhe (struct TEH_RequestHandler *rh,
if ( (GNUNET_NO == res) || (NULL == json) )
return MHD_YES;
res = TEH_PARSE_json_data (connection,
- json,
- spec);
+ json,
+ spec);
json_decref (json);
if (GNUNET_YES != res)
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
if (GNUNET_OK !=
GNUNET_CRYPTO_ecc_ecdh (&priv,
- &pub,
- &hc))
+ &pub,
+ &hc))
{
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_TEST_ECDH_ERROR,
- "Failed to perform ECDH");
+ TALER_EC_TEST_ECDH_ERROR,
+ "Failed to perform ECDH");
}
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o}",
- "ecdh_hash",
- GNUNET_JSON_from_data_auto (&hc));
+ MHD_HTTP_OK,
+ "{s:o}",
+ "ecdh_hash",
+ GNUNET_JSON_from_data_auto (&hc));
}
@@ -325,10 +327,10 @@ TEH_TEST_handler_test_ecdhe (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test_eddsa (struct TEH_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)
{
json_t *json;
int res;
@@ -352,8 +354,8 @@ TEH_TEST_handler_test_eddsa (struct TEH_RequestHandler *rh,
if ( (GNUNET_NO == res) || (NULL == json) )
return MHD_YES;
res = TEH_PARSE_json_data (connection,
- json,
- spec);
+ json,
+ spec);
json_decref (json);
if (GNUNET_YES != res)
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
@@ -361,38 +363,38 @@ TEH_TEST_handler_test_eddsa (struct TEH_RequestHandler *rh,
purpose.purpose = htonl (TALER_SIGNATURE_CLIENT_TEST_EDDSA);
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_CLIENT_TEST_EDDSA,
- &purpose,
- &sig,
- &pub))
+ &purpose,
+ &sig,
+ &pub))
{
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_signature_invalid (connection,
- TALER_EC_TEST_EDDSA_INVALID,
- "eddsa_sig");
+ TALER_EC_TEST_EDDSA_INVALID,
+ "eddsa_sig");
}
GNUNET_JSON_parse_free (spec);
pk = GNUNET_CRYPTO_eddsa_key_create ();
purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_TEST_EDDSA);
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_sign (pk,
- &purpose,
- &sig))
+ &purpose,
+ &sig))
{
GNUNET_free (pk);
return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_TEST_EDDSA_ERROR,
- "Failed to EdDSA-sign");
+ TALER_EC_TEST_EDDSA_ERROR,
+ "Failed to EdDSA-sign");
}
GNUNET_CRYPTO_eddsa_key_get_public (pk,
- &pub);
+ &pub);
GNUNET_free (pk);
return TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o, s:o}",
- "eddsa_pub",
- GNUNET_JSON_from_data_auto (&pub),
- "eddsa_sig",
- GNUNET_JSON_from_data_auto (&sig));
+ MHD_HTTP_OK,
+ "{s:o, s:o}",
+ "eddsa_pub",
+ GNUNET_JSON_from_data_auto (&pub),
+ "eddsa_sig",
+ GNUNET_JSON_from_data_auto (&sig));
}
@@ -423,22 +425,22 @@ TEH_TEST_handler_test_rsa_get (struct TEH_RequestHandler *rh,
{
GNUNET_break (0);
return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_TEST_RSA_GEN_ERROR,
- "Failed to create RSA key");
+ TALER_EC_TEST_RSA_GEN_ERROR,
+ "Failed to create RSA key");
}
pub = GNUNET_CRYPTO_rsa_private_key_get_public (rsa_pk);
if (NULL == pub)
{
GNUNET_break (0);
return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_TEST_RSA_PUB_ERROR,
- "Failed to get public RSA key");
+ TALER_EC_TEST_RSA_PUB_ERROR,
+ "Failed to get public RSA key");
}
res = TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o}",
- "rsa_pub",
- GNUNET_JSON_from_rsa_public_key (pub));
+ MHD_HTTP_OK,
+ "{s:o}",
+ "rsa_pub",
+ GNUNET_JSON_from_rsa_public_key (pub));
GNUNET_CRYPTO_rsa_public_key_free (pub);
return res;
}
@@ -483,8 +485,8 @@ TEH_TEST_handler_test_rsa_sign (struct TEH_RequestHandler *rh,
if ( (GNUNET_NO == res) || (NULL == json) )
return MHD_YES;
res = TEH_PARSE_json_data (connection,
- json,
- spec);
+ json,
+ spec);
json_decref (json);
if (GNUNET_YES != res)
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
@@ -495,26 +497,26 @@ TEH_TEST_handler_test_rsa_sign (struct TEH_RequestHandler *rh,
GNUNET_break (0);
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_TEST_RSA_GEN_ERROR,
- "Failed to create RSA key");
+ TALER_EC_TEST_RSA_GEN_ERROR,
+ "Failed to create RSA key");
}
sig = GNUNET_CRYPTO_rsa_sign_blinded (rsa_pk,
- in_ptr,
- in_ptr_size);
+ in_ptr,
+ in_ptr_size);
if (NULL == sig)
{
GNUNET_break (0);
GNUNET_JSON_parse_free (spec);
return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_TEST_RSA_SIGN_ERROR,
- "Failed to RSA-sign");
+ TALER_EC_TEST_RSA_SIGN_ERROR,
+ "Failed to RSA-sign");
}
GNUNET_JSON_parse_free (spec);
res = TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o}",
- "rsa_blind_sig",
- GNUNET_JSON_from_rsa_signature (sig));
+ MHD_HTTP_OK,
+ "{s:o}",
+ "rsa_blind_sig",
+ GNUNET_JSON_from_rsa_signature (sig));
GNUNET_CRYPTO_rsa_signature_free (sig);
return res;
}
@@ -536,10 +538,10 @@ TEH_TEST_handler_test_rsa_sign (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test_transfer (struct TEH_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)
{
json_t *json;
int res;
@@ -562,8 +564,8 @@ TEH_TEST_handler_test_transfer (struct TEH_RequestHandler *rh,
if ( (GNUNET_NO == res) || (NULL == json) )
return MHD_YES;
res = TEH_PARSE_json_data (connection,
- json,
- spec);
+ json,
+ spec);
json_decref (json);
if (GNUNET_YES != res)
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
@@ -571,10 +573,10 @@ TEH_TEST_handler_test_transfer (struct TEH_RequestHandler *rh,
&coin_pub,
&secret);
return TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o}",
- "secret",
- GNUNET_JSON_from_data_auto (&secret));
+ MHD_HTTP_OK,
+ "{s:o}",
+ "secret",
+ GNUNET_JSON_from_data_auto (&secret));
}
@@ -590,10 +592,10 @@ TEH_TEST_handler_test_transfer (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test (struct TEH_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)
{
json_t *json;
int res;
diff --git a/src/exchange/taler-exchange-httpd_test.h b/src/exchange/taler-exchange-httpd_test.h
index e68ae2f79..d1f8f0004 100644
--- a/src/exchange/taler-exchange-httpd_test.h
+++ b/src/exchange/taler-exchange-httpd_test.h
@@ -43,10 +43,10 @@
*/
int
TEH_TEST_handler_test_base32 (struct TEH_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);
/**
@@ -68,10 +68,10 @@ TEH_TEST_handler_test_base32 (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test_encrypt (struct TEH_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);
/**
@@ -93,10 +93,10 @@ TEH_TEST_handler_test_encrypt (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test_hkdf (struct TEH_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);
/**
@@ -115,10 +115,10 @@ TEH_TEST_handler_test_hkdf (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test_ecdhe (struct TEH_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);
/**
@@ -138,10 +138,10 @@ TEH_TEST_handler_test_ecdhe (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test_eddsa (struct TEH_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);
/**
@@ -199,10 +199,10 @@ TEH_TEST_handler_test_rsa_sign (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test_transfer (struct TEH_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);
/**
@@ -217,9 +217,9 @@ TEH_TEST_handler_test_transfer (struct TEH_RequestHandler *rh,
*/
int
TEH_TEST_handler_test (struct TEH_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);
#endif
diff --git a/src/exchange/taler-exchange-httpd_track_transaction.c b/src/exchange/taler-exchange-httpd_track_transaction.c
index fdda22b8d..c89192680 100644
--- a/src/exchange/taler-exchange-httpd_track_transaction.c
+++ b/src/exchange/taler-exchange-httpd_track_transaction.c
@@ -40,12 +40,14 @@
*/
static int
reply_transfer_pending (struct MHD_Connection *connection,
- struct GNUNET_TIME_Absolute planned_exec_time)
+ struct GNUNET_TIME_Absolute planned_exec_time)
{
return TEH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_ACCEPTED,
"{s:o}",
- "execution_time", GNUNET_JSON_from_time_abs (planned_exec_time));
+ "execution_time",
+ GNUNET_JSON_from_time_abs (
+ planned_exec_time));
}
@@ -65,12 +67,12 @@ reply_transfer_pending (struct MHD_Connection *connection,
*/
static int
reply_track_transaction (struct MHD_Connection *connection,
- const struct GNUNET_HashCode *h_contract_terms,
- const struct GNUNET_HashCode *h_wire,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct TALER_Amount *coin_contribution,
- const struct TALER_WireTransferIdentifierRawP *wtid,
- struct GNUNET_TIME_Absolute exec_time)
+ const struct GNUNET_HashCode *h_contract_terms,
+ const struct GNUNET_HashCode *h_wire,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_Amount *coin_contribution,
+ const struct TALER_WireTransferIdentifierRawP *wtid,
+ struct GNUNET_TIME_Absolute exec_time)
{
struct TALER_ConfirmWirePS cw;
struct TALER_ExchangePublicKeyP pub;
@@ -87,8 +89,8 @@ reply_track_transaction (struct MHD_Connection *connection,
coin_contribution);
if (GNUNET_OK !=
TEH_KS_sign (&cw.purpose,
- &pub,
- &sig))
+ &pub,
+ &sig))
{
return TEH_RESPONSE_reply_internal_error (connection,
TALER_EC_EXCHANGE_BAD_CONFIGURATION,
@@ -97,11 +99,17 @@ reply_track_transaction (struct MHD_Connection *connection,
return TEH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_OK,
"{s:o, s:o, s:o, s:o, s:o}",
- "wtid", GNUNET_JSON_from_data_auto (wtid),
- "execution_time", GNUNET_JSON_from_time_abs (exec_time),
- "coin_contribution", TALER_JSON_from_amount (coin_contribution),
- "exchange_sig", GNUNET_JSON_from_data_auto (&sig),
- "exchange_pub", GNUNET_JSON_from_data_auto (&pub));
+ "wtid", GNUNET_JSON_from_data_auto (
+ wtid),
+ "execution_time",
+ GNUNET_JSON_from_time_abs (exec_time),
+ "coin_contribution",
+ TALER_JSON_from_amount (
+ coin_contribution),
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (&sig),
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (&pub));
}
@@ -173,10 +181,10 @@ struct DepositWtidContext
*/
static void
handle_wtid_data (void *cls,
- const struct TALER_WireTransferIdentifierRawP *wtid,
+ const struct TALER_WireTransferIdentifierRawP *wtid,
const struct TALER_Amount *coin_contribution,
const struct TALER_Amount *coin_fee,
- struct GNUNET_TIME_Absolute execution_time)
+ struct GNUNET_TIME_Absolute execution_time)
{
struct DepositWtidContext *ctx = cls;
@@ -188,8 +196,8 @@ handle_wtid_data (void *cls,
}
if (GNUNET_SYSERR ==
TALER_amount_subtract (&ctx->coin_delta,
- coin_contribution,
- coin_fee))
+ coin_contribution,
+ coin_fee))
{
GNUNET_break (0);
ctx->pending = GNUNET_SYSERR;
@@ -221,35 +229,35 @@ handle_wtid_data (void *cls,
*/
static enum GNUNET_DB_QueryStatus
track_transaction_transaction (void *cls,
- struct MHD_Connection *connection,
- struct TALER_EXCHANGEDB_Session *session,
- int *mhd_ret)
+ struct MHD_Connection *connection,
+ struct TALER_EXCHANGEDB_Session *session,
+ int *mhd_ret)
{
struct DepositWtidContext *ctx = cls;
enum GNUNET_DB_QueryStatus qs;
qs = TEH_plugin->wire_lookup_deposit_wtid (TEH_plugin->cls,
- session,
- &ctx->tps->h_contract_terms,
- &ctx->tps->h_wire,
- &ctx->tps->coin_pub,
- ctx->merchant_pub,
- &handle_wtid_data,
- ctx);
+ session,
+ &ctx->tps->h_contract_terms,
+ &ctx->tps->h_wire,
+ &ctx->tps->coin_pub,
+ ctx->merchant_pub,
+ &handle_wtid_data,
+ ctx);
if (0 > qs)
{
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
GNUNET_break (0);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_TRACK_TRANSACTION_DB_FETCH_FAILED);
+ TALER_EC_TRACK_TRANSACTION_DB_FETCH_FAILED);
}
return qs;
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
*mhd_ret = TEH_RESPONSE_reply_transaction_unknown (connection,
- TALER_EC_TRACK_TRANSACTION_NOT_FOUND);
+ TALER_EC_TRACK_TRANSACTION_NOT_FOUND);
return GNUNET_DB_STATUS_HARD_ERROR;
}
return qs;
@@ -268,23 +276,28 @@ track_transaction_transaction (void *cls,
*/
static int
check_and_handle_track_transaction_request (struct MHD_Connection *connection,
- const struct TALER_DepositTrackPS *tps,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct TALER_MerchantSignatureP *merchant_sig)
+ const struct
+ TALER_DepositTrackPS *tps,
+ const struct
+ TALER_MerchantPublicKeyP *
+ merchant_pub,
+ const struct
+ TALER_MerchantSignatureP *
+ merchant_sig)
{
struct DepositWtidContext ctx;
int mhd_ret;
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION,
- &tps->purpose,
- &merchant_sig->eddsa_sig,
- &merchant_pub->eddsa_pub))
+ &tps->purpose,
+ &merchant_sig->eddsa_sig,
+ &merchant_pub->eddsa_pub))
{
GNUNET_break_op (0);
return TEH_RESPONSE_reply_signature_invalid (connection,
- TALER_EC_TRACK_TRANSACTION_MERCHANT_SIGNATURE_INVALID,
- "merchant_sig");
+ TALER_EC_TRACK_TRANSACTION_MERCHANT_SIGNATURE_INVALID,
+ "merchant_sig");
}
ctx.pending = GNUNET_NO;
ctx.tps = tps;
@@ -293,23 +306,23 @@ check_and_handle_track_transaction_request (struct MHD_Connection *connection,
if (GNUNET_OK !=
TEH_DB_run_transaction (connection,
"handle track transaction",
- &mhd_ret,
- &track_transaction_transaction,
- &ctx))
+ &mhd_ret,
+ &track_transaction_transaction,
+ &ctx))
return mhd_ret;
if (GNUNET_YES == ctx.pending)
return reply_transfer_pending (connection,
- ctx.execution_time);
+ ctx.execution_time);
if (GNUNET_SYSERR == ctx.pending)
return TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_TRACK_TRANSACTION_DB_FEE_INCONSISTENT);
+ TALER_EC_TRACK_TRANSACTION_DB_FEE_INCONSISTENT);
return reply_track_transaction (connection,
- &tps->h_contract_terms,
- &tps->h_wire,
- &tps->coin_pub,
- &ctx.coin_delta,
- &ctx.wtid,
- ctx.execution_time);
+ &tps->h_contract_terms,
+ &tps->h_wire,
+ &tps->coin_pub,
+ &ctx.coin_delta,
+ &ctx.wtid,
+ ctx.execution_time);
}
diff --git a/src/exchange/taler-exchange-httpd_track_transfer.c b/src/exchange/taler-exchange-httpd_track_transfer.c
index 80a29ee00..2aaeacd7e 100644
--- a/src/exchange/taler-exchange-httpd_track_transfer.c
+++ b/src/exchange/taler-exchange-httpd_track_transfer.c
@@ -84,12 +84,13 @@ struct TEH_TrackTransferDetail
*/
static int
reply_track_transfer_details (struct MHD_Connection *connection,
- const struct TALER_Amount *total,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct GNUNET_HashCode *h_wire,
- const struct TALER_Amount *wire_fee,
- struct GNUNET_TIME_Absolute exec_time,
- const struct TEH_TrackTransferDetail *wdd_head)
+ const struct TALER_Amount *total,
+ const struct
+ TALER_MerchantPublicKeyP *merchant_pub,
+ const struct GNUNET_HashCode *h_wire,
+ const struct TALER_Amount *wire_fee,
+ struct GNUNET_TIME_Absolute exec_time,
+ const struct TEH_TrackTransferDetail *wdd_head)
{
const struct TEH_TrackTransferDetail *wdd_pos;
json_t *deposits;
@@ -117,10 +118,19 @@ reply_track_transfer_details (struct MHD_Connection *connection,
GNUNET_assert (0 ==
json_array_append_new (deposits,
json_pack ("{s:o, s:o, s:o, s:o}",
- "h_contract_terms", GNUNET_JSON_from_data_auto (&wdd_pos->h_contract_terms),
- "coin_pub", GNUNET_JSON_from_data_auto (&wdd_pos->coin_pub),
- "deposit_value", TALER_JSON_from_amount (&wdd_pos->deposit_value),
- "deposit_fee", TALER_JSON_from_amount (&wdd_pos->deposit_fee))));
+ "h_contract_terms",
+ GNUNET_JSON_from_data_auto (
+ &wdd_pos->
+ h_contract_terms),
+ "coin_pub",
+ GNUNET_JSON_from_data_auto (
+ &wdd_pos->coin_pub),
+ "deposit_value",
+ TALER_JSON_from_amount (
+ &wdd_pos->deposit_value),
+ "deposit_fee",
+ TALER_JSON_from_amount (
+ &wdd_pos->deposit_fee))));
}
wdp.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT);
wdp.purpose.size = htonl (sizeof (struct TALER_WireDepositDataPS));
@@ -134,8 +144,8 @@ reply_track_transfer_details (struct MHD_Connection *connection,
&wdp.h_details);
if (GNUNET_OK !=
TEH_KS_sign (&wdp.purpose,
- &pub,
- &sig))
+ &pub,
+ &sig))
{
json_decref (deposits);
return TEH_RESPONSE_reply_internal_error (connection,
@@ -147,13 +157,20 @@ reply_track_transfer_details (struct MHD_Connection *connection,
MHD_HTTP_OK,
"{s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
"total", TALER_JSON_from_amount (total),
- "wire_fee", TALER_JSON_from_amount (wire_fee),
- "merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub),
- "H_wire", GNUNET_JSON_from_data_auto (h_wire),
- "execution_time", GNUNET_JSON_from_time_abs (exec_time),
+ "wire_fee", TALER_JSON_from_amount (
+ wire_fee),
+ "merchant_pub",
+ GNUNET_JSON_from_data_auto (
+ merchant_pub),
+ "H_wire", GNUNET_JSON_from_data_auto (
+ h_wire),
+ "execution_time",
+ GNUNET_JSON_from_time_abs (exec_time),
"deposits", deposits,
- "exchange_sig", GNUNET_JSON_from_data_auto (&sig),
- "exchange_pub", GNUNET_JSON_from_data_auto (&pub));
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (&sig),
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (&pub));
}
@@ -353,9 +370,9 @@ handle_transaction_data (void *cls,
*/
static enum GNUNET_DB_QueryStatus
track_transfer_transaction (void *cls,
- struct MHD_Connection *connection,
- struct TALER_EXCHANGEDB_Session *session,
- int *mhd_ret)
+ struct MHD_Connection *connection,
+ struct TALER_EXCHANGEDB_Session *session,
+ int *mhd_ret)
{
struct WtidTransactionContext *ctx = cls;
enum GNUNET_DB_QueryStatus qs;
@@ -369,17 +386,17 @@ track_transfer_transaction (void *cls,
ctx->wdd_tail = NULL;
ctx->wire_method = NULL;
qs = TEH_plugin->lookup_wire_transfer (TEH_plugin->cls,
- session,
- &ctx->wtid,
- &handle_transaction_data,
- ctx);
+ session,
+ &ctx->wtid,
+ &handle_transaction_data,
+ ctx);
if (0 > qs)
{
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
GNUNET_break (0);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_TRACK_TRANSFER_DB_FETCH_FAILED);
+ TALER_EC_TRACK_TRANSFER_DB_FETCH_FAILED);
}
return qs;
}
@@ -387,33 +404,33 @@ track_transfer_transaction (void *cls,
{
GNUNET_break (0);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_TRACK_TRANSFER_DB_INCONSISTENT);
+ TALER_EC_TRACK_TRANSFER_DB_INCONSISTENT);
return GNUNET_DB_STATUS_HARD_ERROR;
}
if (GNUNET_NO == ctx->is_valid)
{
*mhd_ret = TEH_RESPONSE_reply_arg_unknown (connection,
- TALER_EC_TRACK_TRANSFER_WTID_NOT_FOUND,
- "wtid");
+ TALER_EC_TRACK_TRANSFER_WTID_NOT_FOUND,
+ "wtid");
return GNUNET_DB_STATUS_HARD_ERROR;
}
qs = TEH_plugin->get_wire_fee (TEH_plugin->cls,
- session,
- ctx->wire_method,
- ctx->exec_time,
- &wire_fee_start_date,
- &wire_fee_end_date,
- &ctx->wire_fee,
- &closing_fee,
- &wire_fee_master_sig);
+ session,
+ ctx->wire_method,
+ ctx->exec_time,
+ &wire_fee_start_date,
+ &wire_fee_end_date,
+ &ctx->wire_fee,
+ &closing_fee,
+ &wire_fee_master_sig);
if (0 >= qs)
{
if ( (GNUNET_DB_STATUS_HARD_ERROR == qs) ||
- (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS) )
+ (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS) )
{
GNUNET_break (0);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_TRACK_TRANSFER_WIRE_FEE_NOT_FOUND);
+ TALER_EC_TRACK_TRANSFER_WIRE_FEE_NOT_FOUND);
}
return qs;
}
@@ -424,7 +441,7 @@ track_transfer_transaction (void *cls,
{
GNUNET_break (0);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
- TALER_EC_TRACK_TRANSFER_WIRE_FEE_INCONSISTENT);
+ TALER_EC_TRACK_TRANSFER_WIRE_FEE_INCONSISTENT);
return GNUNET_DB_STATUS_HARD_ERROR;
}
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
@@ -477,7 +494,8 @@ TEH_TRACKING_handler_track_transfer (struct TEH_RequestHandler *rh,
res = TEH_PARSE_mhd_request_arg_data (connection,
"wtid",
&ctx.wtid,
- sizeof (struct TALER_WireTransferIdentifierRawP));
+ sizeof (struct
+ TALER_WireTransferIdentifierRawP));
if (GNUNET_SYSERR == res)
return MHD_NO; /* internal error */
if (GNUNET_NO == res)
@@ -485,20 +503,20 @@ TEH_TRACKING_handler_track_transfer (struct TEH_RequestHandler *rh,
if (GNUNET_OK !=
TEH_DB_run_transaction (connection,
"run track transfer",
- &mhd_ret,
- &track_transfer_transaction,
- &ctx))
+ &mhd_ret,
+ &track_transfer_transaction,
+ &ctx))
{
free_ctx (&ctx);
return mhd_ret;
}
mhd_ret = reply_track_transfer_details (connection,
- &ctx.total,
- &ctx.merchant_pub,
- &ctx.h_wire,
- &ctx.wire_fee,
- ctx.exec_time,
- ctx.wdd_head);
+ &ctx.total,
+ &ctx.merchant_pub,
+ &ctx.h_wire,
+ &ctx.wire_fee,
+ ctx.exec_time,
+ ctx.wdd_head);
free_ctx (&ctx);
return mhd_ret;
}
diff --git a/src/exchange/taler-exchange-httpd_validation.c b/src/exchange/taler-exchange-httpd_validation.c
index acb121178..0be21528f 100644
--- a/src/exchange/taler-exchange-httpd_validation.c
+++ b/src/exchange/taler-exchange-httpd_validation.c
@@ -320,7 +320,7 @@ TEH_json_validate_wireformat (const json_t *wire,
payto_url);
return TALER_EC_PAYTO_MALFORMED;
}
- for (struct Plugin *p=wire_head; NULL != p; p = p->next)
+ for (struct Plugin *p = wire_head; NULL != p; p = p->next)
{
if (0 == strcasecmp (p->plugin->method,
method))
diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c
index bbbf3fb48..797ed8bed 100644
--- a/src/exchange/taler-exchange-httpd_wire.c
+++ b/src/exchange/taler-exchange-httpd_wire.c
@@ -57,11 +57,19 @@ fees_to_json (struct TALER_EXCHANGEDB_AggregateFees *af)
if (0 !=
json_array_append_new (a,
json_pack ("{s:o, s:o, s:o, s:o, s:o}",
- "wire_fee", TALER_JSON_from_amount (&af->wire_fee),
- "closing_fee", TALER_JSON_from_amount (&af->closing_fee),
- "start_date", GNUNET_JSON_from_time_abs (af->start_date),
- "end_date", GNUNET_JSON_from_time_abs (af->end_date),
- "sig", GNUNET_JSON_from_data_auto (&af->master_sig))))
+ "wire_fee", TALER_JSON_from_amount (
+ &af->wire_fee),
+ "closing_fee",
+ TALER_JSON_from_amount (
+ &af->closing_fee),
+ "start_date",
+ GNUNET_JSON_from_time_abs (
+ af->start_date),
+ "end_date",
+ GNUNET_JSON_from_time_abs (
+ af->end_date),
+ "sig", GNUNET_JSON_from_data_auto (
+ &af->master_sig))))
{
GNUNET_break (0);
json_decref (a);
@@ -157,7 +165,7 @@ TEH_WIRE_init ()
/**
* Clean up wire subsystem.
*/
-void __attribute__ ((destructor))
+void __attribute__ ((destructor))
TEH_wire_cleanup ()
{
if (NULL != wire_methods)
diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c
index ac2d96a0b..ea737b7b5 100644
--- a/src/exchange/taler-exchange-wirewatch.c
+++ b/src/exchange/taler-exchange-wirewatch.c
@@ -216,8 +216,9 @@ shutdown_task (void *cls)
{
char *wtid_s;
- wtid_s = wa_pos->wire_plugin->reject_transfer_cancel (wa_pos->wire_plugin->cls,
- rt);
+ wtid_s = wa_pos->wire_plugin->reject_transfer_cancel (
+ wa_pos->wire_plugin->cls,
+ rt);
rt = NULL;
GNUNET_free (wtid_s);
}
@@ -262,8 +263,8 @@ add_account_cb (void *cls,
if (NULL == wa->wire_plugin)
{
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- "Failed to load wire plugin for `%s'\n",
- ai->plugin_name);
+ "Failed to load wire plugin for `%s'\n",
+ ai->plugin_name);
GNUNET_free (wa);
return;
}
@@ -355,7 +356,7 @@ reject_cb (void *cls,
ec);
GNUNET_free (rtc->wtid_s);
db_plugin->rollback (db_plugin->cls,
- rtc->session);
+ rtc->session);
GNUNET_free (rtc);
GNUNET_SCHEDULER_shutdown ();
return;
@@ -385,10 +386,10 @@ reject_cb (void *cls,
static int
history_cb (void *cls,
enum TALER_ErrorCode ec,
- enum TALER_BANK_Direction dir,
- const void *row_off,
- size_t row_off_size,
- const struct TALER_WIRE_TransferDetails *details)
+ enum TALER_BANK_Direction dir,
+ const void *row_off,
+ size_t row_off_size,
+ const struct TALER_WIRE_TransferDetails *details)
{
struct TALER_EXCHANGEDB_Session *session = cls;
enum GNUNET_DB_QueryStatus qs;
@@ -409,7 +410,7 @@ history_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"End of list. Committing progress!\n");
qs = db_plugin->commit (db_plugin->cls,
- session);
+ session);
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -529,14 +530,14 @@ history_cb (void *cls,
&details->wtid,
sizeof (reserve_pub));
qs = db_plugin->reserves_in_insert (db_plugin->cls,
- session,
- &reserve_pub,
- &details->amount,
- details->execution_date,
- details->account_url,
+ session,
+ &reserve_pub,
+ &details->amount,
+ details->execution_date,
+ details->account_url,
wa_pos->section_name,
- row_off,
- row_off_size);
+ row_off,
+ row_off_size);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
GNUNET_break (0);
@@ -554,7 +555,7 @@ history_cb (void *cls,
/* try again */
GNUNET_assert (NULL == task);
task = GNUNET_SCHEDULER_add_now (&find_transfers,
- NULL);
+ NULL);
return GNUNET_SYSERR;
}
@@ -565,8 +566,8 @@ history_cb (void *cls,
latest_row_off_size = row_off_size;
}
memcpy (latest_row_off,
- row_off,
- row_off_size);
+ row_off,
+ row_off_size);
return GNUNET_OK;
}
@@ -705,24 +706,25 @@ main (int argc,
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_flag ('T',
- "test",
- "run in test mode and exit when idle",
- &test_mode),
+ "test",
+ "run in test mode and exit when idle",
+ &test_mode),
GNUNET_GETOPT_option_flag ('r',
- "reset",
- "start fresh with all transactions in the history",
- &reset_mode),
+ "reset",
+ "start fresh with all transactions in the history",
+ &reset_mode),
GNUNET_GETOPT_OPTION_END
};
if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv,
- &argc, &argv))
+ &argc, &argv))
return 2;
if (GNUNET_OK !=
GNUNET_PROGRAM_run (argc, argv,
"taler-exchange-wirewatch",
- gettext_noop ("background process that watches for incomming wire transfers from customers"),
+ gettext_noop (
+ "background process that watches for incomming wire transfers from customers"),
options,
&run, NULL))
{
diff --git a/src/exchange/test_taler_exchange_aggregator.c b/src/exchange/test_taler_exchange_aggregator.c
index b02c976af..274a28ac7 100644
--- a/src/exchange/test_taler_exchange_aggregator.c
+++ b/src/exchange/test_taler_exchange_aggregator.c
@@ -32,7 +32,8 @@
/**
* Commands for the interpreter.
*/
-enum OpCode {
+enum OpCode
+{
/**
* Terminate testcase with 'skipped' result.
@@ -86,14 +87,16 @@ struct Command
*/
const char *label;
- union {
+ union
+ {
/**
* If @e opcode is #OPCODE_EXPECT_TRANSACTION, this
* specifies which transaction we expected. Note that
* the WTID will be set, not checked!
*/
- struct {
+ struct
+ {
/**
* Amount to be transferred.
@@ -126,7 +129,8 @@ struct Command
* If @e opcode is #OPCODE_DATABASE_DEPOST, this
* specifies which deposit operation we should fake.
*/
- struct {
+ struct
+ {
/**
* Each merchant name is automatically mapped to a unique
@@ -174,7 +178,7 @@ struct State
/**
* Array of commands to run.
*/
- struct Command* commands;
+ struct Command*commands;
/**
* Offset of the next command to be run.
@@ -339,9 +343,10 @@ maint_child_death (void *cls)
aggregator_state->ioff++;
state = aggregator_state;
aggregator_state = NULL;
- child_death_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- pr,
- &maint_child_death, NULL);
+ child_death_task = GNUNET_SCHEDULER_add_read_file (
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ pr,
+ &maint_child_death, NULL);
interpreter (state);
}
@@ -354,7 +359,8 @@ maint_child_death (void *cls)
static void
fake_issue (struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
{
- memset (issue, 0, sizeof (struct TALER_EXCHANGEDB_DenominationKeyInformationP));
+ memset (issue, 0, sizeof (struct
+ TALER_EXCHANGEDB_DenominationKeyInformationP));
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount_nbo ("EUR:1",
&issue->properties.value));
@@ -440,7 +446,8 @@ do_deposit (struct Command *cmd)
GNUNET_asprintf (&str,
"payto://x-taler-bank/localhost:8082/%llu",
- (unsigned long long) cmd->details.deposit.merchant_account);
+ (unsigned long
+ long) cmd->details.deposit.merchant_account);
deposit.receiver_wire_account
= json_pack ("{s:s, s:s}",
"salt", "this-is-a-salt-value",
@@ -448,11 +455,13 @@ do_deposit (struct Command *cmd)
GNUNET_free (str);
}
GNUNET_assert (GNUNET_OK ==
- TALER_JSON_merchant_wire_signature_hash (deposit.receiver_wire_account,
- &deposit.h_wire));
+ TALER_JSON_merchant_wire_signature_hash (
+ deposit.receiver_wire_account,
+ &deposit.h_wire));
deposit.timestamp = GNUNET_TIME_absolute_get ();
GNUNET_TIME_round_abs (&deposit.timestamp);
- deposit.wire_deadline = GNUNET_TIME_relative_to_absolute (cmd->details.deposit.wire_deadline);
+ deposit.wire_deadline = GNUNET_TIME_relative_to_absolute (
+ cmd->details.deposit.wire_deadline);
GNUNET_TIME_round_abs (&deposit.wire_deadline);
/* finally, actually perform the DB operation */
@@ -550,7 +559,7 @@ interpreter (void *cls)
fail (cmd);
return;
}
- return;
+ return;
case OPCODE_EXPECT_TRANSACTIONS_EMPTY:
if (GNUNET_OK != TALER_FAKEBANK_check_empty (fb))
{
@@ -585,7 +594,8 @@ interpreter (void *cls)
&want_amount,
cmd->details.expect_transaction.debit_account,
cmd->details.expect_transaction.credit_account,
- cmd->details.expect_transaction.exchange_base_url,
+ cmd->details.expect_transaction.
+ exchange_base_url,
&cmd->details.expect_transaction.subject))
{
fail (cmd);
@@ -641,7 +651,8 @@ run_test ()
.label = "expect-deposit-1",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.89"
},
@@ -688,7 +699,8 @@ run_test ()
.label = "expect-deposit-2",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:1.79"
},
@@ -734,7 +746,8 @@ run_test ()
.label = "expect-deposit-3a",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.89"
},
{
@@ -742,7 +755,8 @@ run_test ()
.label = "expect-deposit-3b",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.89"
},
{
@@ -750,7 +764,8 @@ run_test ()
.label = "expect-deposit-3c",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 5,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.89"
},
{
@@ -799,7 +814,8 @@ run_test ()
.label = "expect-deposit-4",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.19"
},
@@ -844,7 +860,8 @@ run_test ()
.label = "expect-deposit-5",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.19"
},
@@ -927,7 +944,8 @@ run_test ()
.label = "expect-deposit-6",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.01"
},
@@ -967,7 +985,8 @@ run_test ()
.label = "expect-deposit-7",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.01"
},
/* Now check profit was actually taken */
@@ -989,7 +1008,8 @@ run_test ()
.label = "expect-deposit-7",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.01"
},
@@ -1047,7 +1067,8 @@ run_test ()
.label = "expect-deposit-8",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.03"
},
@@ -1107,7 +1128,8 @@ run_test ()
.label = "expect-deposit-9",
.details.expect_transaction.debit_account = 3,
.details.expect_transaction.credit_account = 4,
- .details.expect_transaction.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transaction.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transaction.amount = "EUR:0.01"
},
@@ -1166,7 +1188,7 @@ run (void *cls)
fake_issue (&issue);
dpk.rsa_public_key = coin_pub;
GNUNET_CRYPTO_rsa_public_key_hash (dpk.rsa_public_key,
- &issue.properties.denom_hash);
+ &issue.properties.denom_hash);
if ( (GNUNET_OK !=
plugin->start (plugin->cls,
session,
@@ -1179,18 +1201,18 @@ run (void *cls)
(GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->commit (plugin->cls,
session)) )
- {
- GNUNET_break (0);
- TALER_EXCHANGEDB_plugin_unload (plugin);
- plugin = NULL;
- result = 77;
- return;
- }
+ {
+ GNUNET_break (0);
+ TALER_EXCHANGEDB_plugin_unload (plugin);
+ plugin = NULL;
+ result = 77;
+ return;
+ }
child_death_task =
GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_DISK_pipe_handle (sigpipe,
- GNUNET_DISK_PIPE_END_READ),
- &maint_child_death,
+ GNUNET_DISK_pipe_handle (sigpipe,
+ GNUNET_DISK_PIPE_END_READ),
+ &maint_child_death,
NULL);
GNUNET_SCHEDULER_add_shutdown (&shutdown_action,
NULL);
@@ -1217,13 +1239,13 @@ static void
sighandler_child_death ()
{
static char c;
- int old_errno = errno; /* back-up errno */
+ int old_errno = errno; /* back-up errno */
GNUNET_break (1 ==
- GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle
- (sigpipe, GNUNET_DISK_PIPE_END_WRITE),
- &c, sizeof (c)));
- errno = old_errno; /* restore errno */
+ GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle
+ (sigpipe, GNUNET_DISK_PIPE_END_WRITE),
+ &c, sizeof (c)));
+ errno = old_errno; /* restore errno */
}
@@ -1266,14 +1288,14 @@ main (int argc,
if (NULL == proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to run `taler-exchange-keyup`, is your PATH correct?\n");
+ "Failed to run `taler-exchange-keyup`, is your PATH correct?\n");
return 77;
}
GNUNET_OS_process_wait (proc);
GNUNET_OS_process_destroy (proc);
if (GNUNET_OK !=
GNUNET_NETWORK_test_port_free (IPPROTO_TCP,
- 8082))
+ 8082))
{
fprintf (stderr,
"Required port %u not available, skipping.\n",
diff --git a/src/exchange/test_taler_exchange_wirewatch.c b/src/exchange/test_taler_exchange_wirewatch.c
index 4a23bdb5c..27b98bb06 100644
--- a/src/exchange/test_taler_exchange_wirewatch.c
+++ b/src/exchange/test_taler_exchange_wirewatch.c
@@ -34,7 +34,8 @@
/**
* Commands for the interpreter.
*/
-enum OpCode {
+enum OpCode
+{
/**
* Terminate testcase with 'skipped' result.
@@ -94,14 +95,16 @@ struct Command
*/
const char *label;
- union {
+ union
+ {
/**
* If @e opcode is #OPCODE_EXPECT_TRANSFER, this
* specifies which transaction we expected. Note that
* the WTID will be set, not checked!
*/
- struct {
+ struct
+ {
/**
* Amount to be transferred.
@@ -135,7 +138,8 @@ struct Command
* If @e opcode is #OPCODE_RUN_TRANSFER, this
* specifies which transaction the bank should do.
*/
- struct {
+ struct
+ {
/**
* Amount to be transferred.
@@ -164,7 +168,8 @@ struct Command
} run_transfer;
- struct {
+ struct
+ {
/**
* The handle for the aggregator process that we are testing.
@@ -178,7 +183,8 @@ struct Command
} aggregator;
- struct {
+ struct
+ {
/**
* The handle for the wirewatch process that we are testing.
@@ -210,7 +216,7 @@ struct State
/**
* Array of commands to run.
*/
- struct Command* commands;
+ struct Command*commands;
/**
* Offset of the next command to be run.
@@ -335,7 +341,7 @@ shutdown_action (void *cls)
TALER_FAKEBANK_stop (fb);
fb = NULL;
}
- for (unsigned int i=0;i<=state->ioff;i++)
+ for (unsigned int i = 0; i<=state->ioff; i++)
{
struct Command *cmd = &state->commands[i];
@@ -351,8 +357,9 @@ shutdown_action (void *cls)
}
if (NULL != cmd->details.aggregator.aggregator_proc)
{
- GNUNET_break (0 == GNUNET_OS_process_kill (cmd->details.aggregator.aggregator_proc,
- SIGKILL));
+ GNUNET_break (0 == GNUNET_OS_process_kill (
+ cmd->details.aggregator.aggregator_proc,
+ SIGKILL));
GNUNET_OS_process_wait (cmd->details.aggregator.aggregator_proc);
GNUNET_OS_process_destroy (cmd->details.aggregator.aggregator_proc);
cmd->details.aggregator.aggregator_proc = NULL;
@@ -366,8 +373,9 @@ shutdown_action (void *cls)
}
if (NULL != cmd->details.wirewatch.wirewatch_proc)
{
- GNUNET_break (0 == GNUNET_OS_process_kill (cmd->details.wirewatch.wirewatch_proc,
- SIGKILL));
+ GNUNET_break (0 == GNUNET_OS_process_kill (
+ cmd->details.wirewatch.wirewatch_proc,
+ SIGKILL));
GNUNET_OS_process_wait (cmd->details.wirewatch.wirewatch_proc);
GNUNET_OS_process_destroy (cmd->details.wirewatch.wirewatch_proc);
cmd->details.wirewatch.wirewatch_proc = NULL;
@@ -614,7 +622,8 @@ run (void *cls)
.label = "run-transfer-good-to-exchange",
.details.run_transfer.debit_account = 4,
.details.run_transfer.credit_account = 3,
- .details.run_transfer.subject = "SRB8VQHNTNJWSSG7BXT24Z063ZSXN7T0MHCQCBAFC1V17BZH10D0",
+ .details.run_transfer.subject =
+ "SRB8VQHNTNJWSSG7BXT24Z063ZSXN7T0MHCQCBAFC1V17BZH10D0",
.details.run_transfer.amount = "EUR:5.00"
},
/* creates reserve */
@@ -628,7 +637,8 @@ run (void *cls)
.label = "clear-good-transfer-to-exchange",
.details.expect_transfer.debit_account = 4,
.details.expect_transfer.credit_account = 3,
- .details.expect_transfer.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transfer.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transfer.amount = "EUR:5.00"
},
/* should do NOTHING, it is too early... */
@@ -658,7 +668,8 @@ run (void *cls)
.label = "check-reserve-expiration-transfer",
.details.expect_transfer.debit_account = 3,
.details.expect_transfer.credit_account = 4,
- .details.expect_transfer.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transfer.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transfer.amount = "EUR:4.99"
},
/* check nothing else happened */
@@ -685,7 +696,8 @@ run (void *cls)
.label = "expect-bad-transfer-to-exchange",
.details.expect_transfer.debit_account = 4,
.details.expect_transfer.credit_account = 3,
- .details.expect_transfer.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transfer.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transfer.amount = "EUR:5.00"
},
{
@@ -693,7 +705,8 @@ run (void *cls)
.label = "expect-rewire-transfer-from-exchange",
.details.expect_transfer.debit_account = 3,
.details.expect_transfer.credit_account = 4,
- .details.expect_transfer.exchange_base_url = "https://exchange.taler.net/",
+ .details.expect_transfer.exchange_base_url =
+ "https://exchange.taler.net/",
.details.expect_transfer.amount = "EUR:5.00"
},
{
@@ -739,13 +752,13 @@ static void
sighandler_child_death ()
{
static char c;
- int old_errno = errno; /* back-up errno */
+ int old_errno = errno; /* back-up errno */
GNUNET_break (1 ==
- GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle
- (sigpipe, GNUNET_DISK_PIPE_END_WRITE),
- &c, sizeof (c)));
- errno = old_errno; /* restore errno */
+ GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle
+ (sigpipe, GNUNET_DISK_PIPE_END_WRITE),
+ &c, sizeof (c)));
+ errno = old_errno; /* restore errno */
}
@@ -788,7 +801,7 @@ main (int argc,
if (NULL == proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to run `taler-exchange-keyup`, is your PATH correct?\n");
+ "Failed to run `taler-exchange-keyup`, is your PATH correct?\n");
return 77;
}
GNUNET_OS_process_wait (proc);
@@ -804,14 +817,14 @@ main (int argc,
if (NULL == proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to run `taler-exchange-keyup`, is your PATH correct?\n");
+ "Failed to run `taler-exchange-keyup`, is your PATH correct?\n");
return 77;
}
GNUNET_OS_process_wait (proc);
GNUNET_OS_process_destroy (proc);
if (GNUNET_OK !=
GNUNET_NETWORK_test_port_free (IPPROTO_TCP,
- 8082))
+ 8082))
{
fprintf (stderr,
"Required port %u not available, skipping.\n",