make wireformat configurable (#3624)

This commit is contained in:
Christian Grothoff 2015-04-12 22:52:54 +02:00
parent 68774b20da
commit 15bec8f464
2 changed files with 22 additions and 23 deletions

View File

@ -2,6 +2,9 @@
# Currency supported by the mint (can only be one) # Currency supported by the mint (can only be one)
CURRENCY = EUR CURRENCY = EUR
# Wire format supproted by the mint (currently only SEPA is implemented)
WIREFORMAT = SEPA
# How to access our database # How to access our database
DB = postgres:///taler DB = postgres:///taler

View File

@ -60,7 +60,7 @@ struct GNUNET_CRYPTO_EddsaPublicKey TMH_master_public_key;
/** /**
* In which format does this MINT expect wiring instructions? * In which format does this MINT expect wiring instructions?
*/ */
char *TMH_expected_wire_format = "sepa"; char *TMH_expected_wire_format;
/** /**
* Our DB plugin. * Our DB plugin.
@ -72,11 +72,6 @@ struct TALER_MINTDB_Plugin *TMH_plugin;
*/ */
static struct MHD_Daemon *mydaemon; static struct MHD_Daemon *mydaemon;
/**
* The kappa value for refreshing.
*/
static unsigned int refresh_security_parameter;
/** /**
* Port to run the daemon on. * Port to run the daemon on.
*/ */
@ -245,7 +240,6 @@ static int
mint_serve_process_config (const char *mint_directory) mint_serve_process_config (const char *mint_directory)
{ {
unsigned long long port; unsigned long long port;
unsigned long long kappa;
char *TMH_master_public_key_str; char *TMH_master_public_key_str;
cfg = TALER_config_load (mint_directory); cfg = TALER_config_load (mint_directory);
@ -273,6 +267,16 @@ mint_serve_process_config (const char *mint_directory)
(unsigned int) TALER_CURRENCY_LEN); (unsigned int) TALER_CURRENCY_LEN);
return GNUNET_NO; return GNUNET_NO;
} }
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
"mint",
"wireformat",
&TMH_expected_wire_format))
{
fprintf (stderr,
"No wireformat given in mint configuration.");
return GNUNET_NO;
}
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg, GNUNET_CONFIGURATION_get_value_string (cfg,
"mint", "mint",
@ -305,32 +309,24 @@ mint_serve_process_config (const char *mint_directory)
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg, GNUNET_CONFIGURATION_get_value_number (cfg,
"mint", "port", "mint",
"port",
&port)) &port))
{ {
fprintf (stderr, fprintf (stderr,
"invalid configuration: mint.port\n"); "Missing or invalid configuration for the port of the mint\n");
return GNUNET_NO; return GNUNET_NO;
} }
if ((port == 0) || (port > UINT16_MAX)) if ( (0 == port) ||
(port > UINT16_MAX) )
{ {
fprintf (stderr, fprintf (stderr,
"invalid configuration (value out of range): mint.port\n"); "Invalid configuration (value out of range): %llu is not a valid port\n",
port);
return GNUNET_NO; return GNUNET_NO;
} }
serve_port = port; serve_port = (uint16_t) port;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg,
"mint", "refresh_security_parameter",
&kappa))
{
fprintf (stderr,
"invalid configuration: mint.refresh_security_parameter\n");
return GNUNET_NO;
}
refresh_security_parameter = kappa;
return GNUNET_OK; return GNUNET_OK;
} }