Merge branch 'master' of git+ssh://git.taler.net/var/git/mint
This commit is contained in:
commit
699f283ca7
@ -376,6 +376,8 @@ PERF_TALER_MINTDB_coin_public_info_init ()
|
|||||||
int
|
int
|
||||||
PERF_TALER_MINTDB_coin_public_info_free (struct TALER_CoinPublicInfo *cpi)
|
PERF_TALER_MINTDB_coin_public_info_free (struct TALER_CoinPublicInfo *cpi)
|
||||||
{
|
{
|
||||||
|
GNUNET_CRYPTO_rsa_signature_free (cpi->denom_sig.rsa_signature);
|
||||||
|
GNUNET_CRYPTO_rsa_public_key_free (cpi->denom_pub.rsa_public_key);
|
||||||
GNUNET_free (cpi);
|
GNUNET_free (cpi);
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
@ -27,40 +27,86 @@
|
|||||||
#define CURRENCY "EUR"
|
#define CURRENCY "EUR"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a randomly generated CollectableBlindcoin
|
||||||
|
*/
|
||||||
struct TALER_MINTDB_CollectableBlindcoin *
|
struct TALER_MINTDB_CollectableBlindcoin *
|
||||||
PERF_TALER_MINTDB_collectable_blindcoin_init (void);
|
PERF_TALER_MINTDB_collectable_blindcoin_init (void);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liberate memory of @a coin
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
PERF_TALER_MINTDB_collectable_blindcoin_free (struct TALER_MINTDB_CollectableBlindcoin *NAME);
|
PERF_TALER_MINTDB_collectable_blindcoin_free (struct TALER_MINTDB_CollectableBlindcoin *NAME);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a randomly generated reserve
|
||||||
|
*/
|
||||||
struct TALER_MINTDB_Reserve *
|
struct TALER_MINTDB_Reserve *
|
||||||
PERF_TALER_MINTDB_reserve_init (void);
|
PERF_TALER_MINTDB_reserve_init (void);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free memory of a reserve
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
PERF_TALER_MINTDB_reserve_free (struct TALER_MINTDB_Reserve *reserve);
|
PERF_TALER_MINTDB_reserve_free (struct TALER_MINTDB_Reserve *reserve);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a randomly generated refresh session
|
||||||
|
*/
|
||||||
struct TALER_MINTDB_RefreshSession *
|
struct TALER_MINTDB_RefreshSession *
|
||||||
PERF_TALER_MINTDB_refresh_session_init (void);
|
PERF_TALER_MINTDB_refresh_session_init (void);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Frees memory of a refresh_session
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
PERF_TALER_MINTDB_refresh_session_free (struct TALER_MINTDB_RefreshSession *refresh_session);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a randomly generated deposit
|
||||||
|
*/
|
||||||
struct TALER_MINTDB_Deposit *
|
struct TALER_MINTDB_Deposit *
|
||||||
PERF_TALER_MINTDB_deposit_init ();
|
PERF_TALER_MINTDB_deposit_init ();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free memory of a deposit
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
PERF_TALER_MINTDB_deposit_free (struct TALER_MINTDB_Deposit *deposit);
|
PERF_TALER_MINTDB_deposit_free (struct TALER_MINTDB_Deposit *deposit);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a randomly generate DenominationKeyInformation
|
||||||
|
*/
|
||||||
struct TALER_MINTDB_DenominationKeyIssueInformation *
|
struct TALER_MINTDB_DenominationKeyIssueInformation *
|
||||||
PERF_TALER_MINTDB_init_denomination(void);
|
PERF_TALER_MINTDB_denomination_init (void);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free memory for a DenominationKeyIssueInformation
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
PERF_TALER_MINTDB_denomination_free (struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
|
PERF_TALER_MINTDB_denomination_free (struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a random CoinPublicInfo
|
||||||
|
*/
|
||||||
|
struct TALER_CoinPublicInfo *
|
||||||
|
PERF_TALER_MINTDB_coin_public_info_init (void);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free a CoinPublicInfo
|
||||||
|
*/
|
||||||
|
int PERF_TALER_MINTDB_coin_public_info_free (struct TALER_CoinPublicInfo *cpi);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -135,7 +135,7 @@ static int
|
|||||||
cmd_clean (struct PERF_TALER_MINTDB_Cmd cmd[])
|
cmd_clean (struct PERF_TALER_MINTDB_Cmd cmd[])
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i=0; PERF_TALER_MINTDB_CMD_END != cmd[i].command; i++)
|
for (i = 0; PERF_TALER_MINTDB_CMD_END != cmd[i].command; i++)
|
||||||
{
|
{
|
||||||
switch (cmd[i].command)
|
switch (cmd[i].command)
|
||||||
{
|
{
|
||||||
@ -152,15 +152,12 @@ cmd_clean (struct PERF_TALER_MINTDB_Cmd cmd[])
|
|||||||
cmd[i].details.save_array.data_saved = NULL;
|
cmd[i].details.save_array.data_saved = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT:
|
|
||||||
PERF_TALER_MINTDB_deposit_free (cmd[i].exposed.deposit);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PERF_TALER_MINTDB_CMD_LOAD_ARRAY:
|
case PERF_TALER_MINTDB_CMD_LOAD_ARRAY:
|
||||||
GNUNET_free (cmd[i].details.load_array.permutation);
|
GNUNET_free (cmd[i].details.load_array.permutation);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
data_free (&cmd[i].exposed, cmd[i].exposed_type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -178,15 +175,17 @@ interpret_end_loop (struct PERF_TALER_MINTDB_interpreter_state *state)
|
|||||||
{
|
{
|
||||||
int jump = cmd_find (state->cmd,
|
int jump = cmd_find (state->cmd,
|
||||||
state->cmd[state->i].details.end_loop.label_loop);
|
state->cmd[state->i].details.end_loop.label_loop);
|
||||||
|
|
||||||
|
state->cmd[jump].details.loop.curr_iteration++;
|
||||||
// If the loop is not finished
|
// If the loop is not finished
|
||||||
if (state->cmd[jump].details.loop.max_iterations >
|
if (state->cmd[jump].details.loop.max_iterations >
|
||||||
state->cmd[jump].details.loop.curr_iteration)
|
state->cmd[jump].details.loop.curr_iteration)
|
||||||
{
|
{
|
||||||
// jump back to the start
|
// jump back to the start
|
||||||
state->i = jump -1;
|
state->i = jump;
|
||||||
}else{
|
}else{
|
||||||
// Reset the loop counter and continue running
|
// Reset the loop counter and continue running
|
||||||
state->cmd[jump].details.loop.curr_iteration = -1;
|
state->cmd[jump].details.loop.curr_iteration = 0;
|
||||||
}
|
}
|
||||||
// Cleaning up the memory in the loop
|
// Cleaning up the memory in the loop
|
||||||
int j;
|
int j;
|
||||||
@ -216,8 +215,11 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
|
|||||||
case PERF_TALER_MINTDB_CMD_END:
|
case PERF_TALER_MINTDB_CMD_END:
|
||||||
return GNUNET_YES;
|
return GNUNET_YES;
|
||||||
|
|
||||||
|
case PERF_TALER_MINTDB_CMD_DEBUG:
|
||||||
|
printf("%s\n", state->cmd[state->i].label);
|
||||||
|
break;
|
||||||
|
|
||||||
case PERF_TALER_MINTDB_CMD_LOOP:
|
case PERF_TALER_MINTDB_CMD_LOOP:
|
||||||
state->cmd[state->i].details.loop.curr_iteration++;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PERF_TALER_MINTDB_CMD_END_LOOP:
|
case PERF_TALER_MINTDB_CMD_END_LOOP:
|
||||||
|
@ -36,6 +36,16 @@
|
|||||||
.exposed_type = PERF_TALER_MINTDB_NONE \
|
.exposed_type = PERF_TALER_MINTDB_NONE \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define PERF_TALER_MINTDB_INIT_CMD_DEBUG(_label) \
|
||||||
|
{ \
|
||||||
|
.command = PERF_TALER_MINTDB_CMD_DEBUG, \
|
||||||
|
.label = _label, \
|
||||||
|
.exposed_type = PERF_TALER_MINTDB_NONE \
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* The begining of a loop
|
* The begining of a loop
|
||||||
* @param _label the name of the loop
|
* @param _label the name of the loop
|
||||||
@ -48,7 +58,7 @@
|
|||||||
.exposed_type = PERF_TALER_MINTDB_NONE , \
|
.exposed_type = PERF_TALER_MINTDB_NONE , \
|
||||||
.details.loop = { \
|
.details.loop = { \
|
||||||
.max_iterations = _iter , \
|
.max_iterations = _iter , \
|
||||||
.curr_iteration = -1} \
|
.curr_iteration = 0} \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,6 +165,7 @@
|
|||||||
{ \
|
{ \
|
||||||
.command = PERF_TALER_MINTDB_CMD_LOAD_ARRAY, \
|
.command = PERF_TALER_MINTDB_CMD_LOAD_ARRAY, \
|
||||||
.label = _label, \
|
.label = _label, \
|
||||||
|
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
||||||
.details.load_array = { \
|
.details.load_array = { \
|
||||||
.label_loop = _label_loop, \
|
.label_loop = _label_loop, \
|
||||||
.label_save = _label_save \
|
.label_save = _label_save \
|
||||||
@ -170,8 +181,8 @@
|
|||||||
enum PERF_TALER_MINTDB_Type
|
enum PERF_TALER_MINTDB_Type
|
||||||
{
|
{
|
||||||
PERF_TALER_MINTDB_NONE,
|
PERF_TALER_MINTDB_NONE,
|
||||||
PERF_TALER_MINTDB_DEPOSIT,
|
|
||||||
PERF_TALER_MINTDB_TIME,
|
PERF_TALER_MINTDB_TIME,
|
||||||
|
PERF_TALER_MINTDB_DEPOSIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -192,7 +203,8 @@ enum PERF_TALER_MINTDB_CMD_Name
|
|||||||
{
|
{
|
||||||
// All comand chain must hace this as their last command
|
// All comand chain must hace this as their last command
|
||||||
PERF_TALER_MINTDB_CMD_END,
|
PERF_TALER_MINTDB_CMD_END,
|
||||||
|
// Prints it's label
|
||||||
|
PERF_TALER_MINTDB_CMD_DEBUG,
|
||||||
// Define the start of al command chain loop
|
// Define the start of al command chain loop
|
||||||
PERF_TALER_MINTDB_CMD_LOOP,
|
PERF_TALER_MINTDB_CMD_LOOP,
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user