more restructuring
This commit is contained in:
parent
9cbc31afc4
commit
c119d914b3
@ -18,9 +18,6 @@
|
|||||||
* @brief Common functionality for the mint
|
* @brief Common functionality for the mint
|
||||||
* @author Florian Dold
|
* @author Florian Dold
|
||||||
* @author Benedikt Mueller
|
* @author Benedikt Mueller
|
||||||
*
|
|
||||||
* TODO:
|
|
||||||
* - move DB functions to mint_db.h
|
|
||||||
*/
|
*/
|
||||||
#ifndef _MINT_H
|
#ifndef _MINT_H
|
||||||
#define _MINT_H
|
#define _MINT_H
|
||||||
@ -28,7 +25,6 @@
|
|||||||
#include <gnunet/gnunet_util_lib.h>
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
#include <gnunet/gnunet_common.h>
|
#include <gnunet/gnunet_common.h>
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <libpq-fe.h>
|
|
||||||
#include "taler_util.h"
|
#include "taler_util.h"
|
||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
|
|
||||||
@ -330,16 +326,4 @@ struct Reserve
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
TALER_TALER_DB_extract_amount (PGresult *result,
|
|
||||||
unsigned int row,
|
|
||||||
int indices[3],
|
|
||||||
struct TALER_Amount *denom);
|
|
||||||
|
|
||||||
int
|
|
||||||
TALER_TALER_DB_extract_amount_nbo (PGresult *result,
|
|
||||||
unsigned int row,
|
|
||||||
int indices[3],
|
|
||||||
struct TALER_AmountNBO *denom_nbo);
|
|
||||||
|
|
||||||
#endif /* _MINT_H */
|
#endif /* _MINT_H */
|
||||||
|
@ -282,4 +282,18 @@ TALER_MINT_DB_init (const char *connection_cfg);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
TALER_TALER_DB_extract_amount (PGresult *result,
|
||||||
|
unsigned int row,
|
||||||
|
int indices[3],
|
||||||
|
struct TALER_Amount *denom);
|
||||||
|
|
||||||
|
int
|
||||||
|
TALER_TALER_DB_extract_amount_nbo (PGresult *result,
|
||||||
|
unsigned int row,
|
||||||
|
int indices[3],
|
||||||
|
struct TALER_AmountNBO *denom_nbo);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _NEURO_MINT_DB_H */
|
#endif /* _NEURO_MINT_DB_H */
|
||||||
|
@ -38,6 +38,7 @@ extern struct GNUNET_CONFIGURATION_Handle *cfg;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Main directory with mint data.
|
* Main directory with mint data.
|
||||||
|
* FIXME: should we have those globals really here?
|
||||||
*/
|
*/
|
||||||
extern char *mintdir;
|
extern char *mintdir;
|
||||||
|
|
||||||
|
@ -27,10 +27,14 @@
|
|||||||
#include "taler_util.h"
|
#include "taler_util.h"
|
||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "mint.h"
|
#include "mint.h"
|
||||||
|
#include "mint_db.h"
|
||||||
|
|
||||||
|
char *mintdir;
|
||||||
|
|
||||||
static char *mintdir;
|
|
||||||
static struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub;
|
static struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub;
|
||||||
static struct GNUNET_CONFIGURATION_Handle *kcfg;
|
|
||||||
|
struct GNUNET_CONFIGURATION_Handle *cfg;
|
||||||
|
|
||||||
static PGconn *db_conn;
|
static PGconn *db_conn;
|
||||||
|
|
||||||
|
|
||||||
@ -169,22 +173,27 @@ main (int argc, char *const *argv)
|
|||||||
|
|
||||||
reserve_pub = GNUNET_new (struct GNUNET_CRYPTO_EddsaPublicKey);
|
reserve_pub = GNUNET_new (struct GNUNET_CRYPTO_EddsaPublicKey);
|
||||||
if ((NULL == reserve_pub_str) ||
|
if ((NULL == reserve_pub_str) ||
|
||||||
(GNUNET_OK != GNUNET_STRINGS_string_to_data (reserve_pub_str,
|
(GNUNET_OK !=
|
||||||
strlen (reserve_pub_str),
|
GNUNET_STRINGS_string_to_data (reserve_pub_str,
|
||||||
reserve_pub,
|
strlen (reserve_pub_str),
|
||||||
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))))
|
reserve_pub,
|
||||||
|
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "reserve key invalid\n");
|
fprintf (stderr, "reserve key invalid\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
kcfg = TALER_config_load (mintdir);
|
cfg = TALER_config_load (mintdir);
|
||||||
if (NULL == kcfg)
|
if (NULL == cfg)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "can't load mint configuration\n");
|
fprintf (stderr, "can't load mint configuration\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (kcfg, "mint", "db", &TALER_MINT_db_connection_cfg_str))
|
if (GNUNET_OK !=
|
||||||
|
GNUNET_CONFIGURATION_get_value_string (cfg,
|
||||||
|
"mint",
|
||||||
|
"db",
|
||||||
|
&TALER_MINT_db_connection_cfg_str))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "db configuration string not found\n");
|
fprintf (stderr, "db configuration string not found\n");
|
||||||
return 42;
|
return 42;
|
||||||
|
Loading…
Reference in New Issue
Block a user