diff options
Diffstat (limited to 'src/mintdb')
-rw-r--r-- | src/mintdb/plugin_mintdb_common.c | 26 | ||||
-rw-r--r-- | src/mintdb/plugin_mintdb_postgres.c | 70 | ||||
-rw-r--r-- | src/mintdb/test_mintdb.c | 24 | ||||
-rw-r--r-- | src/mintdb/test_mintdb_deposits.c | 6 |
4 files changed, 63 insertions, 63 deletions
diff --git a/src/mintdb/plugin_mintdb_common.c b/src/mintdb/plugin_mintdb_common.c index a95cf4be2..b8f86da0f 100644 --- a/src/mintdb/plugin_mintdb_common.c +++ b/src/mintdb/plugin_mintdb_common.c @@ -28,23 +28,23 @@ */ static void common_free_reserve_history (void *cls, - struct ReserveHistory *rh) + struct TALER_MINTDB_ReserveHistory *rh) { - struct BankTransfer *bt; - struct CollectableBlindcoin *cbc; - struct ReserveHistory *backref; + struct TALER_MINTDB_BankTransfer *bt; + struct TALER_MINTDB_CollectableBlindcoin *cbc; + struct TALER_MINTDB_ReserveHistory *backref; while (NULL != rh) { switch(rh->type) { - case TALER_MINT_DB_RO_BANK_TO_MINT: + case TALER_MINTDB_RO_BANK_TO_MINT: bt = rh->details.bank; if (NULL != bt->wire) json_decref (bt->wire); GNUNET_free (bt); break; - case TALER_MINT_DB_RO_WITHDRAW_COIN: + case TALER_MINTDB_RO_WITHDRAW_COIN: cbc = rh->details.withdraw; GNUNET_CRYPTO_rsa_signature_free (cbc->sig.rsa_signature); GNUNET_CRYPTO_rsa_public_key_free (cbc->denom_pub.rsa_public_key); @@ -66,9 +66,9 @@ common_free_reserve_history (void *cls, */ static void common_free_link_data_list (void *cls, - struct LinkDataList *ldl) + struct TALER_MINTDB_LinkDataList *ldl) { - struct LinkDataList *next; + struct TALER_MINTDB_LinkDataList *next; while (NULL != ldl) { @@ -88,9 +88,9 @@ common_free_link_data_list (void *cls, */ static void common_free_coin_transaction_list (void *cls, - struct TALER_MINT_DB_TransactionList *list) + struct TALER_MINTDB_TransactionList *list) { - struct TALER_MINT_DB_TransactionList *next; + struct TALER_MINTDB_TransactionList *next; while (NULL != list) { @@ -98,14 +98,14 @@ common_free_coin_transaction_list (void *cls, switch (list->type) { - case TALER_MINT_DB_TT_DEPOSIT: + case TALER_MINTDB_TT_DEPOSIT: json_decref (list->details.deposit->wire); GNUNET_free (list->details.deposit); break; - case TALER_MINT_DB_TT_REFRESH_MELT: + case TALER_MINTDB_TT_REFRESH_MELT: GNUNET_free (list->details.melt); break; - case TALER_MINT_DB_TT_LOCK: + case TALER_MINTDB_TT_LOCK: GNUNET_free (list->details.lock); /* FIXME: look at this again once locking is implemented (#3625) */ break; diff --git a/src/mintdb/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c index fa2c19db0..0cf8e51e9 100644 --- a/src/mintdb/plugin_mintdb_postgres.c +++ b/src/mintdb/plugin_mintdb_postgres.c @@ -753,7 +753,7 @@ postgres_commit (void *cls, static int postgres_reserve_get (void *cls, struct TALER_MINTDB_Session *session, - struct Reserve *reserve) + struct TALER_MINTDB_Reserve *reserve) { PGresult *result; uint64_t expiration_date_nbo; @@ -809,7 +809,7 @@ postgres_reserve_get (void *cls, static int postgres_reserves_update (void *cls, struct TALER_MINTDB_Session *session, - struct Reserve *reserve) + struct TALER_MINTDB_Reserve *reserve) { PGresult *result; struct TALER_AmountNBO balance_nbo; @@ -858,7 +858,7 @@ postgres_reserves_update (void *cls, static int postgres_reserves_in_insert (void *cls, struct TALER_MINTDB_Session *session, - struct Reserve *reserve, + struct TALER_MINTDB_Reserve *reserve, const struct TALER_Amount *balance, const struct GNUNET_TIME_Absolute expiry) { @@ -946,7 +946,7 @@ postgres_reserves_in_insert (void *cls, return GNUNET_OK; } /* Update reserve */ - struct Reserve updated_reserve; + struct TALER_MINTDB_Reserve updated_reserve; updated_reserve.pub = reserve->pub; if (GNUNET_OK != @@ -993,7 +993,7 @@ static int postgres_get_collectable_blindcoin (void *cls, struct TALER_MINTDB_Session *session, const struct GNUNET_HashCode *h_blind, - struct CollectableBlindcoin *collectable) + struct TALER_MINTDB_CollectableBlindcoin *collectable) { PGresult *result; struct TALER_PQ_QueryParam params[] = { @@ -1086,10 +1086,10 @@ postgres_insert_collectable_blindcoin (void *cls, struct TALER_MINTDB_Session *session, const struct GNUNET_HashCode *h_blind, struct TALER_Amount withdraw, - const struct CollectableBlindcoin *collectable) + const struct TALER_MINTDB_CollectableBlindcoin *collectable) { PGresult *result; - struct Reserve reserve; + struct TALER_MINTDB_Reserve reserve; char *denom_pub_enc = NULL; char *denom_sig_enc = NULL; size_t denom_pub_enc_size; @@ -1163,14 +1163,14 @@ postgres_insert_collectable_blindcoin (void *cls, * @param reserve_pub public key of the reserve * @return known transaction history (NULL if reserve is unknown) */ -static struct ReserveHistory * +static struct TALER_MINTDB_ReserveHistory * postgres_get_reserve_history (void *cls, struct TALER_MINTDB_Session *session, const struct TALER_ReservePublicKeyP *reserve_pub) { PGresult *result; - struct ReserveHistory *rh; - struct ReserveHistory *rh_head; + struct TALER_MINTDB_ReserveHistory *rh; + struct TALER_MINTDB_ReserveHistory *rh_head; int rows; int ret; @@ -1179,7 +1179,7 @@ postgres_get_reserve_history (void *cls, rh_head = NULL; ret = GNUNET_SYSERR; { - struct BankTransfer *bt; + struct TALER_MINTDB_BankTransfer *bt; struct TALER_PQ_QueryParam params[] = { TALER_PQ_QUERY_PARAM_PTR (reserve_pub), TALER_PQ_QUERY_PARAM_END @@ -1201,7 +1201,7 @@ postgres_get_reserve_history (void *cls, } while (0 < rows) { - bt = GNUNET_new (struct BankTransfer); + bt = GNUNET_new (struct TALER_MINTDB_BankTransfer); if (GNUNET_OK != TALER_PQ_extract_amount (result, --rows, "balance_value", @@ -1216,15 +1216,15 @@ postgres_get_reserve_history (void *cls, bt->reserve_pub = *reserve_pub; if (NULL != rh_head) { - rh_head->next = GNUNET_new (struct ReserveHistory); + rh_head->next = GNUNET_new (struct TALER_MINTDB_ReserveHistory); rh_head = rh_head->next; } else { - rh_head = GNUNET_new (struct ReserveHistory); + rh_head = GNUNET_new (struct TALER_MINTDB_ReserveHistory); rh = rh_head; } - rh_head->type = TALER_MINT_DB_RO_BANK_TO_MINT; + rh_head->type = TALER_MINTDB_RO_BANK_TO_MINT; rh_head->details.bank = bt; } } @@ -1233,7 +1233,7 @@ postgres_get_reserve_history (void *cls, { struct GNUNET_HashCode blind_ev; struct TALER_ReserveSignatureP reserve_sig; - struct CollectableBlindcoin *cbc; + struct TALER_MINTDB_CollectableBlindcoin *cbc; char *denom_pub_enc; char *denom_sig_enc; size_t denom_pub_enc_size; @@ -1273,7 +1273,7 @@ postgres_get_reserve_history (void *cls, GNUNET_break (0); goto cleanup; } - cbc = GNUNET_new (struct CollectableBlindcoin); + cbc = GNUNET_new (struct TALER_MINTDB_CollectableBlindcoin); cbc->sig.rsa_signature = GNUNET_CRYPTO_rsa_signature_decode (denom_sig_enc, denom_sig_enc_size); @@ -1298,9 +1298,9 @@ postgres_get_reserve_history (void *cls, (void) memcpy (&cbc->h_coin_envelope, &blind_ev, sizeof (blind_ev)); (void) memcpy (&cbc->reserve_pub, reserve_pub, sizeof (cbc->reserve_pub)); (void) memcpy (&cbc->reserve_sig, &reserve_sig, sizeof (cbc->reserve_sig)); - rh_head->next = GNUNET_new (struct ReserveHistory); + rh_head->next = GNUNET_new (struct TALER_MINTDB_ReserveHistory); rh_head = rh_head->next; - rh_head->type = TALER_MINT_DB_RO_WITHDRAW_COIN; + rh_head->type = TALER_MINTDB_RO_WITHDRAW_COIN; rh_head->details.withdraw = cbc; } } @@ -1331,7 +1331,7 @@ postgres_get_reserve_history (void *cls, static int postgres_have_deposit (void *cls, struct TALER_MINTDB_Session *session, - const struct Deposit *deposit) + const struct TALER_MINTDB_Deposit *deposit) { struct TALER_PQ_QueryParam params[] = { TALER_PQ_QUERY_PARAM_PTR (&deposit->coin.coin_pub), @@ -1378,7 +1378,7 @@ postgres_have_deposit (void *cls, static int postgres_insert_deposit (void *cls, struct TALER_MINTDB_Session *session, - const struct Deposit *deposit) + const struct TALER_MINTDB_Deposit *deposit) { char *denom_pub_enc; char *denom_sig_enc; @@ -1448,7 +1448,7 @@ static int postgres_get_refresh_session (void *cls, struct TALER_MINTDB_Session *session, const struct GNUNET_HashCode *session_hash, - struct RefreshSession *refresh_session) + struct TALER_MINTDB_RefreshSession *refresh_session) { // FIXME: check logic! int res; @@ -1481,7 +1481,7 @@ postgres_get_refresh_session (void *cls, if (NULL == refresh_session) return GNUNET_YES; - memset (session, 0, sizeof (struct RefreshSession)); + memset (session, 0, sizeof (struct TALER_MINTDB_RefreshSession)); struct TALER_PQ_ResultSpec rs[] = { TALER_PQ_RESULT_SPEC("num_oldcoins", &refresh_session->num_oldcoins), @@ -1522,7 +1522,7 @@ static int postgres_create_refresh_session (void *cls, struct TALER_MINTDB_Session *session, const struct GNUNET_HashCode *session_hash, - const struct RefreshSession *refresh_session) + const struct TALER_MINTDB_RefreshSession *refresh_session) { // FIXME: actually store session data! uint16_t noreveal_index; @@ -1566,7 +1566,7 @@ static int postgres_insert_refresh_melt (void *cls, struct TALER_MINTDB_Session *session, uint16_t oldcoin_index, - const struct RefreshMelt *melt) + const struct TALER_MINTDB_RefreshMelt *melt) { // FIXME: check logic! uint16_t oldcoin_index_nbo = htons (oldcoin_index); @@ -1616,7 +1616,7 @@ postgres_get_refresh_melt (void *cls, struct TALER_MINTDB_Session *session, const struct GNUNET_HashCode *session_hash, uint16_t oldcoin_index, - struct RefreshMelt *melt) + struct TALER_MINTDB_RefreshMelt *melt) { // FIXME: check logic! GNUNET_break (0); @@ -1766,7 +1766,7 @@ postgres_insert_refresh_commit_coins (void *cls, const struct GNUNET_HashCode *session_hash, unsigned int i, unsigned int num_newcoins, - const struct RefreshCommitCoin *commit_coins) + const struct TALER_MINTDB_RefreshCommitCoin *commit_coins) { // FIXME: check logic! -- was written for single commit_coin! uint16_t cnc_index_nbo = htons (i); @@ -1824,7 +1824,7 @@ postgres_get_refresh_commit_coins (void *cls, const struct GNUNET_HashCode *session_hash, unsigned int cnc_index, unsigned int newcoin_index, - struct RefreshCommitCoin *cc) + struct TALER_MINTDB_RefreshCommitCoin *cc) { // FIXME: check logic! uint16_t cnc_index_nbo = htons (cnc_index); @@ -1903,7 +1903,7 @@ postgres_insert_refresh_commit_links (void *cls, const struct GNUNET_HashCode *session_hash, unsigned int i, unsigned int j, - const struct RefreshCommitLink *commit_link) + const struct TALER_MINTDB_RefreshCommitLinkP *commit_link) { // FIXME: check logic! uint16_t cnc_index_nbo = htons (i); @@ -1958,7 +1958,7 @@ postgres_get_refresh_commit_links (void *cls, const struct GNUNET_HashCode *session_hash, unsigned int i, unsigned int num_links, - struct RefreshCommitLink *links) + struct TALER_MINTDB_RefreshCommitLinkP *links) { // FIXME: check logic: was written for a single link! uint16_t cnc_index_nbo = htons (i); @@ -2064,14 +2064,14 @@ postgres_insert_refresh_collectable (void *cls, * @param coin_pub public key to use to retrieve linkage data * @return all known link data for the coin */ -static struct LinkDataList * +static struct TALER_MINTDB_LinkDataList * postgres_get_link_data_list (void *cls, struct TALER_MINTDB_Session *session, const union TALER_CoinSpendPublicKeyP *coin_pub) { // FIXME: check logic! - struct LinkDataList *ldl; - struct LinkDataList *pos; + struct TALER_MINTDB_LinkDataList *ldl; + struct TALER_MINTDB_LinkDataList *pos; struct TALER_PQ_QueryParam params[] = { TALER_PQ_QUERY_PARAM_PTR(coin_pub), TALER_PQ_QUERY_PARAM_END @@ -2163,7 +2163,7 @@ postgres_get_link_data_list (void *cls, ldl); return NULL; } - pos = GNUNET_new (struct LinkDataList); + pos = GNUNET_new (struct TALER_MINTDB_LinkDataList); pos->next = ldl; pos->link_data_enc = link_enc; pos->denom_pub.rsa_public_key = denom_pub; @@ -2253,7 +2253,7 @@ postgres_get_transfer (void *cls, * @param coin_pub coin to investigate * @return list of transactions, NULL if coin is fresh */ -static struct TALER_MINT_DB_TransactionList * +static struct TALER_MINTDB_TransactionList * postgres_get_coin_transactions (void *cls, struct TALER_MINTDB_Session *session, const union TALER_CoinSpendPublicKeyP *coin_pub) diff --git a/src/mintdb/test_mintdb.c b/src/mintdb/test_mintdb.c index b98a09cd5..99eb9b78c 100644 --- a/src/mintdb/test_mintdb.c +++ b/src/mintdb/test_mintdb.c @@ -63,7 +63,7 @@ check_reserve (struct TALER_MINTDB_Session *session, const char *currency, uint64_t expiry) { - struct Reserve reserve; + struct TALER_MINTDB_Reserve reserve; reserve.pub = *pub; @@ -127,19 +127,19 @@ run (void *cls, { struct TALER_MINTDB_Session *session; struct TALER_ReservePublicKeyP reserve_pub; - struct Reserve reserve; + struct TALER_MINTDB_Reserve reserve; struct GNUNET_TIME_Absolute expiry; struct TALER_Amount amount; struct DenomKeyPair *dkp; struct GNUNET_HashCode h_blind; - struct CollectableBlindcoin cbc; - struct CollectableBlindcoin cbc2; - struct ReserveHistory *rh; - struct ReserveHistory *rh_head; - struct BankTransfer *bt; - struct CollectableBlindcoin *withdraw; - struct Deposit deposit; - struct Deposit deposit2; + struct TALER_MINTDB_CollectableBlindcoin cbc; + struct TALER_MINTDB_CollectableBlindcoin cbc2; + struct TALER_MINTDB_ReserveHistory *rh; + struct TALER_MINTDB_ReserveHistory *rh_head; + struct TALER_MINTDB_BankTransfer *bt; + struct TALER_MINTDB_CollectableBlindcoin *withdraw; + struct TALER_MINTDB_Deposit deposit; + struct TALER_MINTDB_Deposit deposit2; struct json_t *wire; const char * const json_wire_str = "{ \"type\":\"SEPA\", \ @@ -262,7 +262,7 @@ run (void *cls, { switch (rh_head->type) { - case TALER_MINT_DB_RO_BANK_TO_MINT: + case TALER_MINTDB_RO_BANK_TO_MINT: bt = rh_head->details.bank; FAILIF (0 != memcmp (&bt->reserve_pub, &reserve_pub, @@ -272,7 +272,7 @@ run (void *cls, FAILIF (0 != strcmp (CURRENCY, bt->amount.currency)); FAILIF (NULL != bt->wire); /* FIXME: write wire details to db */ break; - case TALER_MINT_DB_RO_WITHDRAW_COIN: + case TALER_MINTDB_RO_WITHDRAW_COIN: withdraw = rh_head->details.withdraw; FAILIF (0 != memcmp (&withdraw->reserve_pub, &reserve_pub, diff --git a/src/mintdb/test_mintdb_deposits.c b/src/mintdb/test_mintdb_deposits.c index 766bedd70..171fa2c69 100644 --- a/src/mintdb/test_mintdb_deposits.c +++ b/src/mintdb/test_mintdb_deposits.c @@ -78,7 +78,7 @@ run (void *cls, "\"NAME\":\"GNUNET E.V\"," "\"BIC\":\"GENODEF1SRL\"" "}"; - struct Deposit *deposit; + struct TALER_MINTDB_Deposit *deposit; uint64_t transaction_id; struct TALER_MINTDB_Session *session; @@ -90,11 +90,11 @@ run (void *cls, session = plugin->get_session (plugin->cls, ! persistent); EXITIF (NULL == session); - deposit = GNUNET_malloc (sizeof (struct Deposit) + sizeof (wire)); + deposit = GNUNET_malloc (sizeof (struct TALER_MINTDB_Deposit) + sizeof (wire)); /* Makeup a random coin public key */ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, deposit, - sizeof (struct Deposit)); + sizeof (struct TALER_MINTDB_Deposit)); /* Makeup a random 64bit transaction ID */ transaction_id = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); |