better command check

This commit is contained in:
Fournier Nicolas 2015-07-28 14:07:12 +02:00
parent fe11e2f4dc
commit da0b72311f
3 changed files with 481 additions and 229 deletions

View File

@ -24,8 +24,6 @@
#include "gauger.h" #include "gauger.h"
#define FIND_TEST(cmd, string, arg) \
/** /**
* Represents the state of the interpreter * Represents the state of the interpreter
*/ */
@ -169,8 +167,11 @@ cmd_find (const struct PERF_TALER_MINTDB_Cmd *cmd, const char *search)
/** /**
* Initialization of a command array * Initialization of a command array
* and check for the type of the label
* *
* @param cmd the comand array initialized * @param cmd the comand array initialized
* @return #GNUNET_OK if the initialization was sucessful
* #GNUNET_SYSERR if there was a probleb. See the log for details
*/ */
static int static int
cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[]) cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
@ -181,34 +182,412 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
{ {
switch (cmd[i].command) switch (cmd[i].command)
{ {
case PERF_TALER_MINTDB_CMD_END_LOOP:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.end_loop.label_loop);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.end_loop.label_loop);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_CMD_LOOP != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.end_loop.label_loop);
return GNUNET_SYSERR;
}
cmd[i].details.end_loop.index_loop = ret;
}
break;
case PERF_TALER_MINTDB_CMD_SAVE_ARRAY: case PERF_TALER_MINTDB_CMD_SAVE_ARRAY:
{ {
int save_label; int ret;
ret = cmd_find (cmd,
cmd[i].details.save_array.label_save);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.save_array.label_save);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_NONE == cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.save_array.label_save);
return GNUNET_SYSERR;
}
cmd[i].details.save_array.index_save = ret;
ret = cmd_find (cmd,
cmd[i].details.save_array.label_loop);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.save_array.label_loop);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_CMD_LOOP != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.save_array.label_loop);
return GNUNET_SYSERR;
}
cmd[i].details.save_array.index_loop = ret;
GNUNET_assert (GNUNET_SYSERR !=
(save_label = cmd_find (cmd,
cmd[i].details.save_array.label_save)));
/* Allocation of memory for saving data */
cmd[i].details.save_array.data_saved = cmd[i].details.save_array.data_saved =
GNUNET_new_array (cmd[i].details.save_array.nb_saved, GNUNET_new_array (cmd[i].details.save_array.nb_saved,
struct PERF_TALER_MINTDB_Data); struct PERF_TALER_MINTDB_Data);
GNUNET_assert (NULL != cmd[i].details.save_array.data_saved);
cmd[i].details.save_array.data_saved->type =
cmd[cmd[i].details.save_array.index_save].exposed.type;
} }
break; break;
case PERF_TALER_MINTDB_CMD_LOAD_ARRAY: case PERF_TALER_MINTDB_CMD_LOAD_ARRAY:
/* Creating the permutation array to randomize the data order */
{ {
int save_index; int ret;
GNUNET_assert (GNUNET_SYSERR != ret = cmd_find (cmd,
(save_index = cmd_find ( cmd[i].details.load_array.label_save);
cmd, if (GNUNET_SYSERR == ret)
cmd[i].details.load_array.label_save))); {
GNUNET_assert (NULL != GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
(cmd[i].details.load_array.permutation = "%d:Undefined reference to %s",
GNUNET_CRYPTO_random_permute ( i,
GNUNET_CRYPTO_QUALITY_WEAK, cmd[i].details.load_array.label_save);
cmd[save_index].details.save_array.nb_saved))); return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_CMD_SAVE_ARRAY != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.load_array.label_save);
return GNUNET_SYSERR;
}
cmd[i].details.load_array.index_save = ret;
ret = cmd_find (cmd,
cmd[i].details.load_array.label_loop);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.load_array.label_loop);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_CMD_LOOP != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.load_array.label_loop);
return GNUNET_SYSERR;
}
cmd[i].details.load_array.index_loop = ret;
cmd[i].details.load_array.permutation =
GNUNET_CRYPTO_random_permute (
GNUNET_CRYPTO_QUALITY_WEAK,
cmd[cmd[i].details.load_array.index_loop].details.save_array.nb_saved);
GNUNET_assert (NULL != cmd[i].details.load_array.permutation);
cmd[i].exposed.type = cmd[cmd[i].details.load_array.index_save].details.save_array.data_saved->type;
}
break;
case PERF_TALER_MINTDB_CMD_LOAD_RANDOM:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.load_random.label_save);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.load_random.label_save);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_CMD_SAVE_ARRAY != cmd[ret].command)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.load_random.label_save);
return GNUNET_SYSERR;
}
cmd[i].details.load_random.index_save = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GAUGER:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.gauger.label_start);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.gauger.label_start);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_TIME != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.gauger.label_start);
return GNUNET_SYSERR;
}
cmd[i].details.gauger.index_start = ret;
ret = cmd_find (cmd,
cmd[i].details.gauger.label_stop);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.gauger.label_stop);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_TIME != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.gauger.label_stop);
return GNUNET_SYSERR;
}
cmd[i].details.gauger.index_stop = ret;
}
break;
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT:
{
int ret;
ret = cmd_find( cmd,
cmd[i].details.insert_deposit.label_coin);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.insert_deposit.label_coin);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.insert_deposit.label_coin);
return GNUNET_SYSERR;
}
cmd[i].details.insert_deposit.index_coin = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_DEPOSIT:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_deposit.label_deposit);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.get_deposit.label_deposit);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_DEPOSIT != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.get_deposit.label_deposit);
return GNUNET_SYSERR;
}
cmd[i].details.get_deposit.index_deposit = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_RESERVE:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_reserve.label_reserve);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.get_reserve.label_reserve);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.get_reserve.label_reserve);
return GNUNET_SYSERR;
}
cmd[i].details.get_reserve.index_reserve = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_RESERVE_HISTORY:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_reserve_history.label_reserve);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.get_reserve_history.label_reserve);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.get_reserve_history.label_reserve);
return GNUNET_SYSERR;
}
cmd[i].details.get_reserve_history.index_reserve = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_DENOMINATION:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_denomination.label_denom);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.get_denomination.label_denom);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.get_denomination.label_denom);
return GNUNET_SYSERR;
}
cmd[i].details.get_denomination.index_denom = ret;
}
break;
case PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.insert_withdraw.label_dki);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.insert_withdraw.label_dki);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.insert_withdraw.label_dki);
return GNUNET_SYSERR;
}
cmd[i].details.insert_withdraw.index_dki = ret;
ret = cmd_find (cmd,
cmd[i].details.insert_withdraw.label_reserve);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.insert_withdraw.label_reserve);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.insert_withdraw.label_reserve);
return GNUNET_SYSERR;
}
cmd[i].details.insert_withdraw.index_reserve = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_WITHDRAW:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_withdraw.label_coin);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s",
i,
cmd[i].details.get_withdraw.label_coin);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s",
i,
cmd[i].details.get_withdraw.label_coin);
return GNUNET_SYSERR;
}
cmd[i].details.get_withdraw.index_coin = ret;
} }
break; break;
@ -270,10 +649,7 @@ interpret_end_loop (struct PERF_TALER_MINTDB_interpreter_state *state)
unsigned int i; unsigned int i;
int jump; int jump;
GNUNET_assert (GNUNET_SYSERR != jump = state->cmd[state->i].details.end_loop.index_loop;
(jump = cmd_find (state->cmd,
state->cmd[state->i]
.details.end_loop.label_loop)));
// Cleaning up the memory in the loop // Cleaning up the memory in the loop
for (i = jump; i < state->i; i++) for (i = jump; i < state->i; i++)
{ {
@ -312,13 +688,9 @@ interpret_save_array (struct PERF_TALER_MINTDB_interpreter_state *state)
int save_index; int save_index;
unsigned int selection_chance; unsigned int selection_chance;
GNUNET_assert (GNUNET_SYSERR != loop_index = cmd->details.save_array.index_loop;
(loop_index = cmd_find (state->cmd, save_index = cmd->details.save_array.index_save;
cmd->details.save_array.label_loop)));
loop_ref = &state->cmd[loop_index]; loop_ref = &state->cmd[loop_index];
GNUNET_assert (GNUNET_SYSERR !=
(save_index = cmd_find (state->cmd,
cmd->details.save_array.label_save)));
save_ref = &state->cmd[save_index]; save_ref = &state->cmd[save_index];
/* Array initialization on first loop iteration /* Array initialization on first loop iteration
Alows for nested loops */ Alows for nested loops */
@ -364,19 +736,14 @@ interpret_save_array (struct PERF_TALER_MINTDB_interpreter_state *state)
static void static void
interpret_load_array (struct PERF_TALER_MINTDB_interpreter_state *state) interpret_load_array (struct PERF_TALER_MINTDB_interpreter_state *state)
{ {
struct PERF_TALER_MINTDB_Cmd *cmd = &state->cmd[state->i];
unsigned int loop_iter; unsigned int loop_iter;
int loop_index; int loop_index;
int save_index; int save_index;
struct PERF_TALER_MINTDB_Data *loaded_data; struct PERF_TALER_MINTDB_Data *loaded_data;
GNUNET_assert (GNUNET_SYSERR != loop_index = cmd->details.load_array.index_loop;
(loop_index = cmd_find (state->cmd, save_index = cmd->details.load_array.index_save;
state->cmd[state->i]
.details.load_array.label_loop)));
GNUNET_assert (GNUNET_SYSERR !=
(save_index = cmd_find (state->cmd,
state->cmd[state->i]
.details.load_array.label_save)));
loop_iter = state->cmd[loop_index].details.loop.curr_iteration; loop_iter = state->cmd[loop_index].details.loop.curr_iteration;
{ {
int i, quotient; int i, quotient;
@ -386,13 +753,13 @@ interpret_load_array (struct PERF_TALER_MINTDB_interpreter_state *state)
quotient = loop_iter / state->cmd[save_index].details.save_array.nb_saved; quotient = loop_iter / state->cmd[save_index].details.save_array.nb_saved;
loop_iter = loop_iter % state->cmd[save_index].details.save_array.nb_saved; loop_iter = loop_iter % state->cmd[save_index].details.save_array.nb_saved;
for (i=0; i<=quotient; i++) for (i=0; i<=quotient; i++)
loop_iter = state->cmd[state->i].details.load_array.permutation[loop_iter]; loop_iter = cmd->details.load_array.permutation[loop_iter];
} }
/* Extracting the data from the loop_indexth indice in save_index /* Extracting the data from the loop_indexth indice in save_index
* array. * array.
*/ */
loaded_data = &state->cmd[save_index].details.save_array.data_saved[loop_iter]; loaded_data = &state->cmd[save_index].details.save_array.data_saved[loop_iter];
data_copy (loaded_data, &state->cmd[state->i].exposed); data_copy (loaded_data, &cmd->exposed);
} }
@ -404,16 +771,15 @@ interpret_load_array (struct PERF_TALER_MINTDB_interpreter_state *state)
static void static void
interprete_load_random (struct PERF_TALER_MINTDB_interpreter_state *state) interprete_load_random (struct PERF_TALER_MINTDB_interpreter_state *state)
{ {
struct PERF_TALER_MINTDB_Cmd *cmd = &state->cmd[state->i];
unsigned int index; unsigned int index;
int save_index; int save_index;
GNUNET_assert (0 <= save_index = cmd->details.load_random.index_save;
(save_index = cmd_find (state->cmd, index = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
state->cmd[state->i].details.load_random.label_save))); state->cmd[save_index].details.save_array.nb_saved);
index = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, data_copy (&state->cmd[save_index].details.save_array.data_saved[index],
state->cmd[save_index].details.save_array.nb_saved); &cmd->exposed);
data_copy (&state->cmd[save_index].details.save_array.data_saved[index],
&state->cmd[state->i].exposed);
} }
/** /**
@ -457,14 +823,9 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
float ips; float ips;
struct GNUNET_TIME_Absolute start, stop; struct GNUNET_TIME_Absolute start, stop;
struct GNUNET_TIME_Relative elapsed; struct GNUNET_TIME_Relative elapsed;
GNUNET_assert (GNUNET_SYSERR !=
(start_index = cmd_find (state->cmd, start_index = state->cmd[state->i].details.gauger.index_start;
state->cmd[state->i] stop_index = state->cmd[state->i].details.gauger.index_stop;
.details.gauger.label_start)));
GNUNET_assert (GNUNET_SYSERR !=
(stop_index = cmd_find (state->cmd,
state->cmd[state->i]
.details.gauger.label_stop)));
start = *state->cmd[start_index].exposed.data.time; start = *state->cmd[start_index].exposed.data.time;
stop = *state->cmd[stop_index].exposed.data.time; stop = *state->cmd[stop_index].exposed.data.time;
elapsed = GNUNET_TIME_absolute_get_difference (start, elapsed = GNUNET_TIME_absolute_get_difference (start,
@ -511,12 +872,9 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
int coin_index; int coin_index;
struct TALER_MINTDB_Deposit *deposit; struct TALER_MINTDB_Deposit *deposit;
GNUNET_assert (GNUNET_SYSERR != coin_index = state->cmd[state->i].details.insert_deposit.index_coin;
(coin_index = cmd_find (state->cmd, deposit = PERF_TALER_MINTDB_deposit_init (state->cmd[coin_index].exposed.data.coin);
state->cmd[state->i].details.insert_deposit.label_coin))); GNUNET_assert (NULL != deposit);
GNUNET_assert (NULL !=
(deposit = PERF_TALER_MINTDB_deposit_init (state->cmd[coin_index].exposed.data.coin)));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
state->plugin->insert_deposit (state->plugin->cls, state->plugin->insert_deposit (state->plugin->cls,
state->session, state->session,
@ -1018,9 +1376,6 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
{ {
init = init_def; init = init_def;
} }
if (GNUNET_SYSERR == PERF_TALER_MINTDB_check (init))
return GNUNET_SYSERR;
ret = PERF_TALER_MINTDB_interpret (plugin, ret = PERF_TALER_MINTDB_interpret (plugin,
init); init);
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
@ -1032,8 +1387,6 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
/* /*
* Running the benchmark * Running the benchmark
*/ */
if (GNUNET_SYSERR == PERF_TALER_MINTDB_check (benchmark))
return GNUNET_SYSERR;
ret = PERF_TALER_MINTDB_interpret (plugin, ret = PERF_TALER_MINTDB_interpret (plugin,
benchmark); benchmark);
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
@ -1062,140 +1415,3 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
return ret; return ret;
} }
/**
* Tests if @a label is reference to a command of @a cmd
* Prints an error containing @a desc if a problem occurs
*
* @param cmd the cmd array checked
* @param label the label checked
* @param i the index of the command beeing checked (used for error reporting
* @param desc a description of the label checked
*/
static int
find_test (const struct PERF_TALER_MINTDB_Cmd *cmd,
const char *label,
const unsigned int i,
const char *desc)
{
int ret;
ret = cmd_find (cmd, label);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Error at %s:index %d wrong label for %s",
cmd[i].label,
i,
desc);
}
return ret;
}
/**
* Check if the given command array is syntaxicly correct
* This will check if the label are corrects but will not check if
* they are pointing to an apropriate command.
*
* @param cmd the command array to check
* @return #GNUNET_OK is @a cmd is correct; #GNUNET_SYSERR if it is'nt
*/
int
PERF_TALER_MINTDB_check (const struct PERF_TALER_MINTDB_Cmd *cmd)
{
unsigned int i;
int ret = GNUNET_OK;
for (i = 0; PERF_TALER_MINTDB_CMD_END != cmd[i].command; i++)
{
int ret_loc = GNUNET_OK;
switch (cmd[i].command)
{
case PERF_TALER_MINTDB_CMD_END_LOOP:
ret_loc = find_test (cmd,
cmd[i].details.end_loop.label_loop,
i,
"label_loop");
break;
case PERF_TALER_MINTDB_CMD_GAUGER:
ret_loc = find_test (cmd,
cmd[i].details.gauger.label_start,
i,
"label_start");
break;
case PERF_TALER_MINTDB_CMD_SAVE_ARRAY:
ret_loc = find_test (cmd,
cmd[i].details.save_array.label_loop,
i,
"label_loop");
ret_loc = find_test (cmd,
cmd[i].details.save_array.label_save,
i,
"label_save");
break;
case PERF_TALER_MINTDB_CMD_LOAD_ARRAY:
ret_loc = find_test (cmd,
cmd[i].details.load_array.label_loop,
i,
"label_loop");
ret_loc = find_test (cmd,
cmd[i].details.load_array.label_save,
i,
"label_save");
break;
case PERF_TALER_MINTDB_CMD_GET_DENOMINATION:
ret_loc = find_test (cmd,
cmd[i].details.get_denomination.label_denom,
i,
"label_denom");
break;
case PERF_TALER_MINTDB_CMD_GET_RESERVE:
ret_loc = find_test (cmd,
cmd[i].details.get_reserve.label_reserve,
i,
"label_reserve");
break;
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT:
ret_loc = find_test (cmd,
cmd[i].details.insert_deposit.label_coin,
i,
"label_dki");
break;
case PERF_TALER_MINTDB_CMD_GET_DEPOSIT:
ret_loc = find_test (cmd,
cmd[i].details.get_deposit.label_deposit,
i,
"label_deposit");
break;
case PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW:
ret_loc = find_test (cmd,
cmd[i].details.insert_withdraw.label_dki,
i,
"label_dki");
break;
case PERF_TALER_MINTDB_CMD_GET_WITHDRAW:
ret_loc = find_test (cmd,
cmd[i].details.get_withdraw.label_coin,
i,
"label_coin");
break;
default :
break;
}
if (GNUNET_OK == ret)
ret = (GNUNET_SYSERR == ret_loc)?GNUNET_SYSERR:GNUNET_OK;
}
return ret;
}

View File

@ -112,7 +112,7 @@
{ \ { \
.command = PERF_TALER_MINTDB_CMD_GET_TIME, \ .command = PERF_TALER_MINTDB_CMD_GET_TIME, \
.label = _label, \ .label = _label, \
.exposed.type = PERF_TALER_MINTDB_NONE \ .exposed.type = PERF_TALER_MINTDB_TIME \
} }
/** /**
@ -657,6 +657,7 @@ union PERF_TALER_MINTDB_CMD_Details
* Maximum number of iteration in the loop * Maximum number of iteration in the loop
*/ */
const unsigned int max_iterations; const unsigned int max_iterations;
/** /**
* The current iteration of the loop * The current iteration of the loop
*/ */
@ -673,6 +674,7 @@ union PERF_TALER_MINTDB_CMD_Details
* Label of the loop closed by the command * Label of the loop closed by the command
*/ */
const char *label_loop; const char *label_loop;
unsigned int index_loop;
} end_loop; } end_loop;
@ -685,11 +687,13 @@ union PERF_TALER_MINTDB_CMD_Details
* Label of the starting timestamp * Label of the starting timestamp
*/ */
const char *label_start; const char *label_start;
unsigned int index_start;
/** /**
* Label of the ending timestamp * Label of the ending timestamp
*/ */
const char *label_stop; const char *label_stop;
unsigned int index_stop;
/** /**
* The category of the measurment * The category of the measurment
@ -723,18 +727,24 @@ union PERF_TALER_MINTDB_CMD_Details
* Number of items to save * Number of items to save
*/ */
unsigned int nb_saved; unsigned int nb_saved;
/** /**
* Number of items already saved * Number of items already saved
*/ */
unsigned int index; unsigned int index;
/** /**
* Label of the loop it is attached to * Label of the loop it is attached to
*/ */
const char *label_loop; const char *label_loop;
unsigned int index_loop;
/** /**
* Label of the command exposing the item * Label of the command exposing the item
*/ */
const char *label_save; const char *label_save;
unsigned int index_save;
/** /**
* Array of data saved * Array of data saved
*/ */
@ -751,11 +761,13 @@ union PERF_TALER_MINTDB_CMD_Details
* The loop in which the command is located * The loop in which the command is located
*/ */
const char *label_loop; const char *label_loop;
unsigned int index_loop;
/** /**
* Label of the command where the items were saved * Label of the command where the items were saved
*/ */
const char *label_save; const char *label_save;
unsigned int index_save;
/** /**
* A permutation array used to randomize the order the items are loaded in * A permutation array used to randomize the order the items are loaded in
@ -773,6 +785,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The label of the #PERF_TALER_MINTDB_CMD_SAVE_ARRAY the items will be extracted from * The label of the #PERF_TALER_MINTDB_CMD_SAVE_ARRAY the items will be extracted from
*/ */
const char *label_save; const char *label_save;
unsigned int index_save;
} load_random; } load_random;
/** /**
@ -784,6 +797,7 @@ union PERF_TALER_MINTDB_CMD_Details
* Label of the source where the reserve used to create the coin is * Label of the source where the reserve used to create the coin is
*/ */
const char *label_coin; const char *label_coin;
unsigned int index_coin;
} insert_deposit; } insert_deposit;
@ -796,6 +810,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The label of the source of the deposit to check * The label of the source of the deposit to check
*/ */
const char *label_deposit; const char *label_deposit;
unsigned int index_deposit;
} get_deposit; } get_deposit;
@ -808,6 +823,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The label of the source of the reserve to check * The label of the source of the reserve to check
*/ */
const char *label_reserve; const char *label_reserve;
unsigned int index_reserve;
} get_reserve; } get_reserve;
@ -820,6 +836,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The label of the source of the reserve to check * The label of the source of the reserve to check
*/ */
const char *label_reserve; const char *label_reserve;
unsigned int index_reserve;
} get_reserve_history; } get_reserve_history;
@ -832,6 +849,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The label of the source of the denomination to check * The label of the source of the denomination to check
*/ */
const char *label_denom; const char *label_denom;
unsigned int index_denom;
} get_denomination; } get_denomination;
@ -844,11 +862,13 @@ union PERF_TALER_MINTDB_CMD_Details
* label of the denomination key used to sign the coin * label of the denomination key used to sign the coin
*/ */
const char *label_dki; const char *label_dki;
unsigned int index_dki;
/** /**
* label of the reserve the money to mint the coin comes from * label of the reserve the money to mint the coin comes from
*/ */
const char *label_reserve; const char *label_reserve;
unsigned int index_reserve;
} insert_withdraw; } insert_withdraw;
/** /**
@ -860,6 +880,7 @@ union PERF_TALER_MINTDB_CMD_Details
* label of the source for the coin information * label of the source for the coin information
*/ */
const char *label_coin; const char *label_coin;
unsigned int index_coin;
} get_withdraw; } get_withdraw;
/** /**
@ -871,6 +892,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The coin which history is checked * The coin which history is checked
*/ */
const char *label_coin; const char *label_coin;
unsigned int index_coin;
} get_coin_transaction; } get_coin_transaction;
/** /**
@ -882,6 +904,7 @@ union PERF_TALER_MINTDB_CMD_Details
* label of the source of the hash of the session * label of the source of the hash of the session
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
} get_refresh_session; } get_refresh_session;
/** /**
@ -893,11 +916,13 @@ union PERF_TALER_MINTDB_CMD_Details
* The label of the hash of the refresh session * The label of the hash of the refresh session
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
/** /**
* The label of the coin to melt * The label of the coin to melt
*/ */
const char *label_coin; const char *label_coin;
const char coin;
} insert_refresh_melt; } insert_refresh_melt;
/** /**
@ -909,6 +934,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The label of the hash of the session * The label of the hash of the session
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
} get_refresh_melt; } get_refresh_melt;
/** /**
@ -920,11 +946,13 @@ union PERF_TALER_MINTDB_CMD_Details
* The refresh session hash * The refresh session hash
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
/** /**
* The new coin denomination * The new coin denomination
*/ */
const char *label_denom; const char *label_denom;
unsigned int index_denom;
} insert_refresh_order; } insert_refresh_order;
/** /**
@ -936,6 +964,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The session hash * The session hash
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
} get_refresh_order; } get_refresh_order;
@ -948,6 +977,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The refresh session hash * The refresh session hash
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
} insert_refresh_commit_coin; } insert_refresh_commit_coin;
@ -960,6 +990,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The refresh session hash * The refresh session hash
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
} insert_refresh_commit_link; } insert_refresh_commit_link;
@ -972,6 +1003,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The refresh session hash * The refresh session hash
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
} get_refresh_commit_link; } get_refresh_commit_link;
/** /**
@ -983,6 +1015,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The refresh session hash * The refresh session hash
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
} get_melt_commitment; } get_melt_commitment;
/** /**
@ -994,6 +1027,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The refresh session hash * The refresh session hash
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
} insert_refresh_out; } insert_refresh_out;
/** /**
@ -1005,6 +1039,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The refresh session hash * The refresh session hash
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
} get_link_datat_list; } get_link_datat_list;
/** /**
@ -1016,6 +1051,7 @@ union PERF_TALER_MINTDB_CMD_Details
* The refresh session hash * The refresh session hash
*/ */
const char *label_hash; const char *label_hash;
unsigned int index_hash;
} get_transfer; } get_transfer;
}; };