diff options
author | Fournier Nicolas <nicolas.fournier@ensta-paristech.fr> | 2015-07-20 10:24:09 +0200 |
---|---|---|
committer | Fournier Nicolas <nicolas.fournier@ensta-paristech.fr> | 2015-07-20 10:24:09 +0200 |
commit | 3e8a837a078a5aa7975c669a2cc8652174b6bd73 (patch) | |
tree | b88b0aac4e244e8a2e7609393f4043e4a77c1162 /src/mintdb/perf_taler_mintdb_interpreter.c | |
parent | cb37f25146d5c98cd7b4498db9fc14d181cf4fe3 (diff) |
added new commands for melting
Diffstat (limited to 'src/mintdb/perf_taler_mintdb_interpreter.c')
-rw-r--r-- | src/mintdb/perf_taler_mintdb_interpreter.c | 95 |
1 files changed, 94 insertions, 1 deletions
diff --git a/src/mintdb/perf_taler_mintdb_interpreter.c b/src/mintdb/perf_taler_mintdb_interpreter.c index e9ee05e3..45a3002a 100644 --- a/src/mintdb/perf_taler_mintdb_interpreter.c +++ b/src/mintdb/perf_taler_mintdb_interpreter.c @@ -678,7 +678,100 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state) } break; - default : + case PERF_TALER_MINTDB_CMD_GET_COIN_TRANSACTION: + { + int coin_index; + struct PERF_TALER_MINTDB_Coin *coin; + struct TALER_MINTDB_TransactionList *transactions; + + coin_index = cmd_find (state->cmd, + state->cmd[state->i].details.get_coin_transaction.label_coin); + GNUNET_assert (GNUNET_SYSERR != coin_index); + coin = state->cmd[coin_index].exposed.data.coin; + transactions = state->plugin->get_coin_transactions (state->plugin->cls, + state->session, + &coin->public_info.coin_pub); + state->plugin->free_coin_transaction_list (state->plugin->cls, + transactions); + } + break; + + case PERF_TALER_MINTDB_CMD_CREATE_REFRESH_SESSION: + { + struct GNUNET_HashCode hash; + struct TALER_MINTDB_RefreshSession *refresh_session; + + refresh_session = PERF_TALER_MINTDB_refresh_session_init (); + GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, + &hash); + state->plugin->create_refresh_session (state->session, + state->session, + &hash, + refresh_session); + state->cmd[state->i].exposed.data.session_hash = hash; + PERF_TALER_MINTDB_refresh_session_free (refresh_session); + GNUNET_free (refresh_session); + } + break; + + case PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION: + { + int hash_index; + struct GNUNET_HashCode hash; + struct TALER_MINTDB_RefreshSession refresh; + + hash_index = cmd_find (state->cmd, + state->cmd[state->i].details.get_refresh_session.label_hash); + hash = state->cmd[hash_index].exposed.data.session_hash; + state->plugin->get_refresh_session (state->session, + state->session, + &hash, + &refresh); + } + break; + + case PERF_TALER_MINTDB_CMD_INSERT_REFRESH_MELT: + { + int hash_index; + int coin_index; + struct GNUNET_HashCode hash; + struct TALER_MINTDB_RefreshMelt *melt; + struct PERF_TALER_MINTDB_Coin *coin; + + hash_index = cmd_find (state->cmd, + state->cmd[state->i].details.insert_refresh_melt.label_hash); + coin_index = cmd_find (state->cmd, + state->cmd[state->i].details.insert_refresh_melt.label_coin); + hash = state->cmd[hash_index].exposed.data.session_hash; + coin = state->cmd[coin_index].exposed.data.coin; + melt = PERF_TALER_MINTDB_refresh_melt_init (&hash, + coin); + state->plugin->insert_refresh_melt (state->plugin->cls, + state->session, + 1, + melt); + state->cmd[state->i].exposed.data.session_hash = hash; + } + break; + + case PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT: + { + int hash_index; + struct GNUNET_HashCode hash; + struct TALER_MINTDB_RefreshMelt melt; + + hash_index = cmd_find (state->cmd, + state->cmd[state->i].details.get_refresh_melt.label_hash); + hash = state->cmd[hash_index].exposed.data.session_hash; + state->plugin->get_refresh_melt (state->plugin->cls, + state->session, + &hash, + 1, + &melt); + } + break; + + default: break; } } |