summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-03-28 12:29:35 +0100
committerChristian Grothoff <christian@grothoff.org>2015-03-28 12:29:35 +0100
commit44b894ebe16f2646b49429bc45208dabb8bbc30b (patch)
tree5529b660eec8a9ce491673c0f594bb96c9a828dd
parentc626ccac51dc968725b2ead1ecb0cebedd9987fc (diff)
downloadexchange-44b894ebe16f2646b49429bc45208dabb8bbc30b.tar.gz
exchange-44b894ebe16f2646b49429bc45208dabb8bbc30b.tar.bz2
exchange-44b894ebe16f2646b49429bc45208dabb8bbc30b.zip
more rename-fest work
-rw-r--r--src/include/taler_mintdb_lib.h48
-rw-r--r--src/mint-tools/Makefile.am9
-rw-r--r--src/mint-tools/taler-mint-dbinit.c6
-rw-r--r--src/mint-tools/taler-mint-keycheck.c8
-rw-r--r--src/mint-tools/taler-mint-keyup.c20
-rw-r--r--src/mint-tools/taler-mint-reservemod.c1
-rw-r--r--src/mint/taler-mint-httpd.c4
-rw-r--r--src/mint/taler-mint-httpd_db.c8
-rw-r--r--src/mint/taler-mint-httpd_deposit.c2
-rw-r--r--src/mint/taler-mint-httpd_keystate.c18
-rw-r--r--src/mint/taler-mint-httpd_keystate.h2
-rw-r--r--src/mint/taler-mint-httpd_refresh.c2
-rw-r--r--src/mint/taler-mint-httpd_responses.c2
-rw-r--r--src/mintdb/mintdb_keyio.c46
-rw-r--r--src/mintdb/mintdb_plugin.c18
-rw-r--r--src/mintdb/test_mintdb.c12
-rw-r--r--src/mintdb/test_mintdb_deposits.c22
-rw-r--r--src/mintdb/test_mintdb_keyio.c10
18 files changed, 126 insertions, 112 deletions
diff --git a/src/include/taler_mintdb_lib.h b/src/include/taler_mintdb_lib.h
index cceec330..a5d3d8d9 100644
--- a/src/include/taler_mintdb_lib.h
+++ b/src/include/taler_mintdb_lib.h
@@ -30,13 +30,13 @@
* Subdirectroy under the mint's base directory which contains
* the mint's signing keys.
*/
-#define DIR_SIGNKEYS "signkeys"
+#define TALER_MINTDB_DIR_SIGNING_KEYS "signkeys"
/**
* Subdirectory under the mint's base directory which contains
* the mint's denomination keys.
*/
-#define DIR_DENOMKEYS "denomkeys"
+#define TALER_MINTDB_DIR_DENOMINATION_KEYS "denomkeys"
GNUNET_NETWORK_STRUCT_BEGIN
@@ -47,7 +47,7 @@ GNUNET_NETWORK_STRUCT_BEGIN
* Includes the private key followed by the public information about
* the signing key.
*/
-struct TALER_MintSigningKeyValidityPSPriv
+struct TALER_MINTDB_PrivateSigningKeyInformationP
{
/**
* Private key part of the mint's signing key.
@@ -68,7 +68,7 @@ GNUNET_NETWORK_STRUCT_END
* All information about a denomination key (which is used to
* sign coins into existence).
*/
-struct TALER_DenominationKeyIssueInformation
+struct TALER_MINTDB_DenominationKeyIssueInformation
{
/**
* The private key of the denomination. Will be NULL if the private
@@ -101,9 +101,9 @@ struct TALER_DenominationKeyIssueInformation
* #GNUNET_SYSERR to abort iteration with error!
*/
typedef int
-(*TALER_MINT_SignkeyIterator)(void *cls,
- const char *filename,
- const struct TALER_MintSigningKeyValidityPSPriv *ski);
+(*TALER_MINTDB_SigningKeyIterator)(void *cls,
+ const char *filename,
+ const struct TALER_MINTDB_PrivateSigningKeyInformationP *ski);
/**
@@ -117,9 +117,9 @@ typedef int
* #GNUNET_SYSERR to abort iteration with error!
*/
typedef int
-(*TALER_MINT_DenomkeyIterator)(void *cls,
- const char *alias,
- const struct TALER_DenominationKeyIssueInformation *dki);
+(*TALER_MINTDB_DenominationKeyIterator)(void *cls,
+ const char *alias,
+ const struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
@@ -127,7 +127,7 @@ typedef int
* Call @a it for each signing key found in the @a mint_base_dir.
*
* @param mint_base_dir base directory for the mint,
- * the signing keys must be in the #DIR_SIGNKEYS
+ * the signing keys must be in the #TALER_MINTDB_DIR_SIGNING_KEYS
* subdirectory
* @param it function to call on each signing key
* @param it_cls closure for @a it
@@ -136,16 +136,16 @@ typedef int
* files are simply skipped), -1 on error
*/
int
-TALER_MINT_signkeys_iterate (const char *mint_base_dir,
- TALER_MINT_SignkeyIterator it,
- void *it_cls);
+TALER_MINTDB_signing_keys_iterate (const char *mint_base_dir,
+ TALER_MINTDB_SigningKeyIterator it,
+ void *it_cls);
/**
* Call @a it for each denomination key found in the @a mint_base_dir.
*
* @param mint_base_dir base directory for the mint,
- * the signing keys must be in the #DIR_DENOMKEYS
+ * the signing keys must be in the #TALER_MINTDB_DIR_DENOMINATION_KEYS
* subdirectory
* @param it function to call on each denomination key found
* @param it_cls closure for @a it
@@ -155,9 +155,9 @@ TALER_MINT_signkeys_iterate (const char *mint_base_dir,
* as maybe none of the files were well-formed)
*/
int
-TALER_MINT_denomkeys_iterate (const char *mint_base_dir,
- TALER_MINT_DenomkeyIterator it,
- void *it_cls);
+TALER_MINTDB_denomination_keys_iterate (const char *mint_base_dir,
+ TALER_MINTDB_DenominationKeyIterator it,
+ void *it_cls);
/**
@@ -168,8 +168,8 @@ TALER_MINT_denomkeys_iterate (const char *mint_base_dir,
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure.
*/
int
-TALER_MINT_write_denom_key (const char *filename,
- const struct TALER_DenominationKeyIssueInformation *dki);
+TALER_MINTDB_denomination_key_write (const char *filename,
+ const struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
/**
@@ -180,8 +180,8 @@ TALER_MINT_write_denom_key (const char *filename,
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/
int
-TALER_MINT_read_denom_key (const char *filename,
- struct TALER_DenominationKeyIssueInformation *dki);
+TALER_MINTDB_denomination_key_read (const char *filename,
+ struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
/**
@@ -191,7 +191,7 @@ TALER_MINT_read_denom_key (const char *filename,
* @return NULL on failure
*/
struct TALER_MINTDB_Plugin *
-TALER_MINT_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg);
+TALER_MINTDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
@@ -200,7 +200,7 @@ TALER_MINT_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg);
* @param plugin plugin to unload
*/
void
-TALER_MINT_plugin_unload (struct TALER_MINTDB_Plugin *plugin);
+TALER_MINTDB_plugin_unload (struct TALER_MINTDB_Plugin *plugin);
diff --git a/src/mint-tools/Makefile.am b/src/mint-tools/Makefile.am
index 7ae6f355..5230f0b6 100644
--- a/src/mint-tools/Makefile.am
+++ b/src/mint-tools/Makefile.am
@@ -14,7 +14,7 @@ taler_mint_keyup_LDADD = \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/pq/libtalerpq.la \
- $(top_builddir)/src/mint/libtalermint_common.la \
+ $(top_builddir)/src/mintdb/libtalermintdb.la \
-lgnunetutil
taler_mint_keyup_LDFLAGS = $(POSTGRESQL_LDFLAGS)
@@ -25,8 +25,7 @@ taler_mint_keycheck_SOURCES = \
taler_mint_keycheck_LDADD = \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \
- $(top_builddir)/src/pq/libtalerpq.la \
- $(top_builddir)/src/mint/libtalermint_common.la \
+ $(top_builddir)/src/mintdb/libtalermintdb.la \
-lgnunetutil
taler_mint_keycheck_LDFLAGS = $(POSTGRESQL_LDFLAGS)
@@ -36,7 +35,7 @@ taler_mint_reservemod_LDADD = \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/pq/libtalerpq.la \
- $(top_builddir)/src/mint/libtalermint_common.la \
+ $(top_builddir)/src/mintdb/libtalermintdb.la \
-lpq \
-lgnunetutil
taler_mint_reservemod_LDFLAGS = \
@@ -52,7 +51,7 @@ taler_mint_dbinit_LDADD = \
$(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/pq/libtalerpq.la \
- $(top_builddir)/src/mint/libtalermint_common.la \
+ $(top_builddir)/src/mintdb/libtalermintdb.la \
-lpq \
-lgnunetutil
taler_mint_dbinit_LDFLAGS = \
diff --git a/src/mint-tools/taler-mint-dbinit.c b/src/mint-tools/taler-mint-dbinit.c
index ec08369b..612cb4c3 100644
--- a/src/mint-tools/taler-mint-dbinit.c
+++ b/src/mint-tools/taler-mint-dbinit.c
@@ -84,7 +84,7 @@ main (int argc,
return 1;
}
if (NULL ==
- (plugin = TALER_MINT_plugin_load (cfg)))
+ (plugin = TALER_MINTDB_plugin_load (cfg)))
{
fprintf (stderr,
"Failed to initialize database plugin.\n");
@@ -96,10 +96,10 @@ main (int argc,
{
fprintf (stderr,
"Failed to initialize database.\n");
- TALER_MINT_plugin_unload (plugin);
+ TALER_MINTDB_plugin_unload (plugin);
return 1;
}
- TALER_MINT_plugin_unload (plugin);
+ TALER_MINTDB_plugin_unload (plugin);
return 0;
}
diff --git a/src/mint-tools/taler-mint-keycheck.c b/src/mint-tools/taler-mint-keycheck.c
index b18ebdf7..df228994 100644
--- a/src/mint-tools/taler-mint-keycheck.c
+++ b/src/mint-tools/taler-mint-keycheck.c
@@ -50,7 +50,7 @@ static struct GNUNET_CONFIGURATION_Handle *kcfg;
static int
signkeys_iter (void *cls,
const char *filename,
- const struct TALER_MintSigningKeyValidityPSPriv *ski)
+ const struct TALER_MINTDB_PrivateSigningKeyInformationP *ski)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Iterating over key `%s' for start time %s\n",
@@ -93,7 +93,7 @@ signkeys_iter (void *cls,
static int
mint_signkeys_check ()
{
- if (0 > TALER_MINT_signkeys_iterate (mint_directory,
+ if (0 > TALER_MINTDB_signing_keys_iterate (mint_directory,
&signkeys_iter,
NULL))
return GNUNET_NO;
@@ -114,7 +114,7 @@ mint_signkeys_check ()
static int
denomkeys_iter (void *cls,
const char *alias,
- const struct TALER_DenominationKeyIssueInformation *dki)
+ const struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
{
struct GNUNET_HashCode hc;
@@ -165,7 +165,7 @@ denomkeys_iter (void *cls,
static int
mint_denomkeys_check ()
{
- if (0 > TALER_MINT_denomkeys_iterate (mint_directory,
+ if (0 > TALER_MINTDB_denomination_keys_iterate (mint_directory,
&denomkeys_iter,
NULL))
return GNUNET_NO;
diff --git a/src/mint-tools/taler-mint-keyup.c b/src/mint-tools/taler-mint-keyup.c
index 8ffe7d16..0d84635a 100644
--- a/src/mint-tools/taler-mint-keyup.c
+++ b/src/mint-tools/taler-mint-keyup.c
@@ -207,7 +207,7 @@ get_signkey_file (struct GNUNET_TIME_Absolute start)
GNUNET_snprintf (dir,
sizeof (dir),
- "%s" DIR_SEPARATOR_STR DIR_SIGNKEYS DIR_SEPARATOR_STR "%llu",
+ "%s" DIR_SEPARATOR_STR TALER_MINTDB_DIR_SIGNING_KEYS DIR_SEPARATOR_STR "%llu",
mint_directory,
(unsigned long long) start.abs_value_us);
return dir;
@@ -285,7 +285,7 @@ get_cointype_dir (const struct CoinTypeParams *p)
GNUNET_snprintf (dir,
sizeof (dir),
- "%s" DIR_SEPARATOR_STR DIR_DENOMKEYS DIR_SEPARATOR_STR "%s-%s",
+ "%s" DIR_SEPARATOR_STR TALER_MINTDB_DIR_DENOMINATION_KEYS DIR_SEPARATOR_STR "%s-%s",
mint_directory,
val_str,
hash_str);
@@ -434,7 +434,7 @@ get_anchor (const char *dir,
static void
create_signkey_issue_priv (struct GNUNET_TIME_Absolute start,
struct GNUNET_TIME_Relative duration,
- struct TALER_MintSigningKeyValidityPSPriv *pi)
+ struct TALER_MINTDB_PrivateSigningKeyInformationP *pi)
{
struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
struct TALER_MintSigningKeyValidityPS *issue = &pi->issue;
@@ -487,7 +487,7 @@ mint_keys_update_signkeys ()
ROUND_TO_SECS (signkey_duration,
rel_value_us);
GNUNET_asprintf (&signkey_dir,
- "%s" DIR_SEPARATOR_STR DIR_SIGNKEYS,
+ "%s" DIR_SEPARATOR_STR TALER_MINTDB_DIR_SIGNING_KEYS,
mint_directory);
/* make sure the directory exists */
if (GNUNET_OK !=
@@ -506,7 +506,7 @@ mint_keys_update_signkeys ()
while (anchor.abs_value_us < lookahead_sign_stamp.abs_value_us)
{
const char *skf;
- struct TALER_MintSigningKeyValidityPSPriv signkey_issue;
+ struct TALER_MINTDB_PrivateSigningKeyInformationP signkey_issue;
ssize_t nwrite;
skf = get_signkey_file (anchor);
@@ -676,7 +676,7 @@ get_cointype_params (const char *ct,
*/
static void
create_denomkey_issue (const struct CoinTypeParams *params,
- struct TALER_DenominationKeyIssueInformation *dki)
+ struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
{
dki->denom_priv.rsa_private_key
= GNUNET_CRYPTO_rsa_private_key_create (params->rsa_keysize);
@@ -702,8 +702,8 @@ create_denomkey_issue (const struct CoinTypeParams *params,
TALER_amount_hton (&dki->issue.fee_refresh,
&params->fee_refresh);
dki->issue.purpose.purpose = htonl (TALER_SIGNATURE_MINT_DENOMINATION_KEY_VALIDITY);
- dki->issue.purpose.size = htonl (sizeof (struct TALER_DenominationKeyIssueInformation) -
- offsetof (struct TALER_DenominationKeyIssueInformation,
+ dki->issue.purpose.size = htonl (sizeof (struct TALER_MINTDB_DenominationKeyIssueInformation) -
+ offsetof (struct TALER_MINTDB_DenominationKeyIssueInformation,
issue.purpose));
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv,
@@ -726,7 +726,7 @@ mint_keys_update_cointype (void *cls,
int *ret = cls;
struct CoinTypeParams p;
const char *dkf;
- struct TALER_DenominationKeyIssueInformation denomkey_issue;
+ struct TALER_MINTDB_DenominationKeyIssueInformation denomkey_issue;
if (0 != strncasecmp (coin_alias,
"coin_",
@@ -759,7 +759,7 @@ mint_keys_update_cointype (void *cls,
create_denomkey_issue (&p,
&denomkey_issue);
if (GNUNET_OK !=
- TALER_MINT_write_denom_key (dkf,
+ TALER_MINTDB_denomination_key_write (dkf,
&denomkey_issue))
{
fprintf (stderr,
diff --git a/src/mint-tools/taler-mint-reservemod.c b/src/mint-tools/taler-mint-reservemod.c
index 3261f47c..3f3bdcd9 100644
--- a/src/mint-tools/taler-mint-reservemod.c
+++ b/src/mint-tools/taler-mint-reservemod.c
@@ -24,6 +24,7 @@
#include <libpq-fe.h>
#include "taler_util.h"
#include "taler_signatures.h"
+#include "taler_pq_lib.h"
#include "taler_mintdb_plugin.h"
#include "taler_mintdb_lib.h"
diff --git a/src/mint/taler-mint-httpd.c b/src/mint/taler-mint-httpd.c
index a8673596..5e7557b9 100644
--- a/src/mint/taler-mint-httpd.c
+++ b/src/mint/taler-mint-httpd.c
@@ -264,7 +264,7 @@ mint_serve_process_config (const char *mint_directory)
GNUNET_free (TMH_master_public_key_str);
if (NULL ==
- (TMH_plugin = TALER_MINT_plugin_load (cfg)))
+ (TMH_plugin = TALER_MINTDB_plugin_load (cfg)))
{
fprintf (stderr,
"failed to initialize DB subsystem\n");
@@ -358,6 +358,6 @@ main (int argc, char *const *argv)
ret = TMH_KS_loop ();
MHD_stop_daemon (mydaemon);
- TALER_MINT_plugin_unload (TMH_plugin);
+ TALER_MINTDB_plugin_unload (TMH_plugin);
return (GNUNET_OK == ret) ? 0 : 1;
}
diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c
index 13fde724..f1253bd5 100644
--- a/src/mint/taler-mint-httpd_db.c
+++ b/src/mint/taler-mint-httpd_db.c
@@ -106,7 +106,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
struct TALER_Amount spent;
struct TALER_Amount value;
struct TMH_KS_StateHandle *mks;
- struct TALER_DenominationKeyIssueInformation *dki;
+ struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
int ret;
if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
@@ -266,8 +266,8 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection,
const struct ReserveHistory *pos;
struct TMH_KS_StateHandle *key_state;
struct CollectableBlindcoin collectable;
- struct TALER_DenominationKeyIssueInformation *dki;
- struct TALER_DenominationKeyIssueInformation *tdki;
+ struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
+ struct TALER_MINTDB_DenominationKeyIssueInformation *tdki;
struct GNUNET_CRYPTO_rsa_Signature *sig;
struct TALER_Amount amount_required;
struct TALER_Amount deposit_total;
@@ -987,7 +987,7 @@ refresh_mint_coin (struct MHD_Connection *connection,
const struct RefreshCommitCoin *commit_coin,
unsigned int coin_off)
{
- struct TALER_DenominationKeyIssueInformation *dki;
+ struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
struct TALER_DenominationSignature ev_sig;
dki = TMH_KS_denomination_key_lookup (key_state,
diff --git a/src/mint/taler-mint-httpd_deposit.c b/src/mint/taler-mint-httpd_deposit.c
index ee2d2484..e732c87d 100644
--- a/src/mint/taler-mint-httpd_deposit.c
+++ b/src/mint/taler-mint-httpd_deposit.c
@@ -57,7 +57,7 @@ verify_and_execute_deposit (struct MHD_Connection *connection,
{
struct TMH_KS_StateHandle *key_state;
struct TALER_DepositRequestPS dr;
- struct TALER_DenominationKeyIssueInformation *dki;
+ struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
struct TALER_Amount fee_deposit;
dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_DEPOSIT);
diff --git a/src/mint/taler-mint-httpd_keystate.c b/src/mint/taler-mint-httpd_keystate.c
index 746c257a..16b23aae 100644
--- a/src/mint/taler-mint-httpd_keystate.c
+++ b/src/mint/taler-mint-httpd_keystate.c
@@ -76,7 +76,7 @@ struct TMH_KS_StateHandle
/**
* Mint signing key that should be used currently.
*/
- struct TALER_MintSigningKeyValidityPSPriv current_sign_key_issue;
+ struct TALER_MINTDB_PrivateSigningKeyInformationP current_sign_key_issue;
/**
* Reference count. The struct is released when the RC hits zero.
@@ -189,13 +189,13 @@ TALER_MINT_conf_duration_provide ()
static int
reload_keys_denom_iter (void *cls,
const char *alias,
- const struct TALER_DenominationKeyIssueInformation *dki)
+ const struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
{
struct TMH_KS_StateHandle *ctx = cls;
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute horizon;
struct GNUNET_HashCode denom_key_hash;
- struct TALER_DenominationKeyIssueInformation *d2;
+ struct TALER_MINTDB_DenominationKeyIssueInformation *d2;
int res;
horizon = GNUNET_TIME_relative_to_absolute (TALER_MINT_conf_duration_provide ());
@@ -220,7 +220,7 @@ reload_keys_denom_iter (void *cls,
GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub.rsa_public_key,
&denom_key_hash);
d2 = GNUNET_memdup (dki,
- sizeof (struct TALER_DenominationKeyIssueInformation));
+ sizeof (struct TALER_MINTDB_DenominationKeyIssueInformation));
res = GNUNET_CONTAINER_multihashmap_put (ctx->denomkey_map,
&denom_key_hash,
d2,
@@ -277,7 +277,7 @@ sign_key_issue_to_json (const struct TALER_MintSigningKeyValidityPS *ski)
static int
reload_keys_sign_iter (void *cls,
const char *filename,
- const struct TALER_MintSigningKeyValidityPSPriv *ski)
+ const struct TALER_MINTDB_PrivateSigningKeyInformationP *ski)
{
struct TMH_KS_StateHandle *ctx = cls;
struct GNUNET_TIME_Absolute now;
@@ -332,7 +332,7 @@ free_denom_key (void *cls,
const struct GNUNET_HashCode *key,
void *value)
{
- struct TALER_DenominationKeyIssueInformation *dki = value;
+ struct TALER_MINTDB_DenominationKeyIssueInformation *dki = value;
GNUNET_free (dki);
return GNUNET_OK;
@@ -398,10 +398,10 @@ TMH_KS_acquire (void)
key_state->denomkey_map = GNUNET_CONTAINER_multihashmap_create (32,
GNUNET_NO);
key_state->reload_time = GNUNET_TIME_absolute_get ();
- TALER_MINT_denomkeys_iterate (TMH_mint_directory,
+ TALER_MINTDB_denomination_keys_iterate (TMH_mint_directory,
&reload_keys_denom_iter,
key_state);
- TALER_MINT_signkeys_iterate (TMH_mint_directory,
+ TALER_MINTDB_signing_keys_iterate (TMH_mint_directory,
&reload_keys_sign_iter,
key_state);
key_state->next_reload = GNUNET_TIME_absolute_ntoh (key_state->current_sign_key_issue.issue.expire);
@@ -452,7 +452,7 @@ TMH_KS_acquire (void)
* @return the denomination key issue,
* or NULL if denom_pub could not be found
*/
-struct TALER_DenominationKeyIssueInformation *
+struct TALER_MINTDB_DenominationKeyIssueInformation *
TMH_KS_denomination_key_lookup (const struct TMH_KS_StateHandle *key_state,
const struct TALER_DenominationPublicKey *denom_pub)
{
diff --git a/src/mint/taler-mint-httpd_keystate.h b/src/mint/taler-mint-httpd_keystate.h
index 26c9ccad..ec0d24aa 100644
--- a/src/mint/taler-mint-httpd_keystate.h
+++ b/src/mint/taler-mint-httpd_keystate.h
@@ -65,7 +65,7 @@ TMH_KS_release (struct TMH_KS_StateHandle *key_state);
* @return the denomination key issue,
* or NULL if denom_pub could not be found
*/
-struct TALER_DenominationKeyIssueInformation *
+struct TALER_MINTDB_DenominationKeyIssueInformation *
TMH_KS_denomination_key_lookup (const struct TMH_KS_StateHandle *key_state,
const struct TALER_DenominationPublicKey *denom_pub);
diff --git a/src/mint/taler-mint-httpd_refresh.c b/src/mint/taler-mint-httpd_refresh.c
index e315555c..ef7fb03a 100644
--- a/src/mint/taler-mint-httpd_refresh.c
+++ b/src/mint/taler-mint-httpd_refresh.c
@@ -240,7 +240,7 @@ verify_coin_public_info (struct MHD_Connection *connection,
{
struct TALER_RefreshMeltCoinAffirmationPS body;
struct TMH_KS_StateHandle *key_state;
- struct TALER_DenominationKeyIssueInformation *dki;
+ struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
struct TALER_Amount fee_refresh;
body.purpose.size = htonl (sizeof (struct TALER_RefreshMeltCoinAffirmationPS));
diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c
index 31a4ecd0..95bb95ce 100644
--- a/src/mint/taler-mint-httpd_responses.c
+++ b/src/mint/taler-mint-httpd_responses.c
@@ -437,7 +437,7 @@ compile_reserve_history (const struct ReserveHistory *rh,
json_t *transaction;
int ret;
const struct ReserveHistory *pos;
- struct TALER_DenominationKeyIssueInformation *dki;
+ struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
struct TMH_KS_StateHandle *key_state;
struct TALER_WithdrawRequestPS wr;
diff --git a/src/mintdb/mintdb_keyio.c b/src/mintdb/mintdb_keyio.c
index 321b890c..9add5797 100644
--- a/src/mintdb/mintdb_keyio.c
+++ b/src/mintdb/mintdb_keyio.c
@@ -34,7 +34,7 @@ struct SignkeysIterateContext
/**
* Function to call on each signing key.
*/
- TALER_MINT_SignkeyIterator it;
+ TALER_MINTDB_SigningKeyIterator it;
/**
* Closure for @e it.
@@ -60,12 +60,12 @@ signkeys_iterate_dir_iter (void *cls,
{
struct SignkeysIterateContext *skc = cls;
ssize_t nread;
- struct TALER_MintSigningKeyValidityPSPriv issue;
+ struct TALER_MINTDB_PrivateSigningKeyInformationP issue;
nread = GNUNET_DISK_fn_read (filename,
&issue,
- sizeof (struct TALER_MintSigningKeyValidityPSPriv));
- if (nread != sizeof (struct TALER_MintSigningKeyValidityPSPriv))
+ sizeof (struct TALER_MINTDB_PrivateSigningKeyInformationP));
+ if (nread != sizeof (struct TALER_MINTDB_PrivateSigningKeyInformationP))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Invalid signkey file `%s': wrong size\n",
@@ -82,7 +82,7 @@ signkeys_iterate_dir_iter (void *cls,
* Call @a it for each signing key found in the @a mint_base_dir.
*
* @param mint_base_dir base directory for the mint,
- * the signing keys must be in the #DIR_SIGNKEYS
+ * the signing keys must be in the #TALER_MINTDB_DIR_SIGNING_KEYS
* subdirectory
* @param it function to call on each signing key
* @param it_cls closure for @a it
@@ -91,16 +91,16 @@ signkeys_iterate_dir_iter (void *cls,
* files are simply skipped), -1 on error
*/
int
-TALER_MINT_signkeys_iterate (const char *mint_base_dir,
- TALER_MINT_SignkeyIterator it,
- void *it_cls)
+TALER_MINTDB_signing_keys_iterate (const char *mint_base_dir,
+ TALER_MINTDB_SigningKeyIterator it,
+ void *it_cls)
{
char *signkey_dir;
struct SignkeysIterateContext skc;
int ret;
GNUNET_asprintf (&signkey_dir,
- "%s" DIR_SEPARATOR_STR DIR_SIGNKEYS,
+ "%s" DIR_SEPARATOR_STR TALER_MINTDB_DIR_SIGNING_KEYS,
mint_base_dir);
skc.it = it;
skc.it_cls = it_cls;
@@ -121,8 +121,8 @@ TALER_MINT_signkeys_iterate (const char *mint_base_dir,
* #GNUNET_SYSERR upon failure
*/
int
-TALER_MINT_read_denom_key (const char *filename,
- struct TALER_DenominationKeyIssueInformation *dki)
+TALER_MINTDB_denomination_key_read (const char *filename,
+ struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
{
uint64_t size;
size_t offset;
@@ -183,8 +183,8 @@ TALER_MINT_read_denom_key (const char *filename,
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure.
*/
int
-TALER_MINT_write_denom_key (const char *filename,
- const struct TALER_DenominationKeyIssueInformation *dki)
+TALER_MINTDB_denomination_key_write (const char *filename,
+ const struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
{
char *priv_enc;
size_t priv_enc_size;
@@ -242,7 +242,7 @@ struct DenomkeysIterateContext
/**
* Function to call on each denomination key.
*/
- TALER_MINT_DenomkeyIterator it;
+ TALER_MINTDB_DenominationKeyIterator it;
/**
* Closure for @e it.
@@ -267,10 +267,10 @@ denomkeys_iterate_keydir_iter (void *cls,
const char *filename)
{
struct DenomkeysIterateContext *dic = cls;
- struct TALER_DenominationKeyIssueInformation issue;
+ struct TALER_MINTDB_DenominationKeyIssueInformation issue;
if (GNUNET_OK !=
- TALER_MINT_read_denom_key (filename,
+ TALER_MINTDB_denomination_key_read (filename,
&issue))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -285,7 +285,7 @@ denomkeys_iterate_keydir_iter (void *cls,
/**
- * Function called on each subdirectory in the #DIR_DENOMKEYS. Will
+ * Function called on each subdirectory in the #TALER_MINTDB_DIR_DENOMINATION_KEYS. Will
* call the #denomkeys_iterate_keydir_iter() on each file in the
* subdirectory.
*
@@ -313,7 +313,7 @@ denomkeys_iterate_topdir_iter (void *cls,
* Call @a it for each denomination key found in the @a mint_base_dir.
*
* @param mint_base_dir base directory for the mint,
- * the signing keys must be in the #DIR_DENOMKEYS
+ * the signing keys must be in the #TALER_MINTDB_DIR_DENOMINATION_KEYS
* subdirectory
* @param it function to call on each denomination key found
* @param it_cls closure for @a it
@@ -323,16 +323,16 @@ denomkeys_iterate_topdir_iter (void *cls,
* as maybe none of the files were well-formed)
*/
int
-TALER_MINT_denomkeys_iterate (const char *mint_base_dir,
- TALER_MINT_DenomkeyIterator it,
- void *it_cls)
+TALER_MINTDB_denomination_keys_iterate (const char *mint_base_dir,
+ TALER_MINTDB_DenominationKeyIterator it,
+ void *it_cls)
{
char *dir;
struct DenomkeysIterateContext dic;
int ret;
GNUNET_asprintf (&dir,
- "%s" DIR_SEPARATOR_STR DIR_DENOMKEYS,
+ "%s" DIR_SEPARATOR_STR TALER_MINTDB_DIR_DENOMINATION_KEYS,
mint_base_dir);
dic.it = it;
dic.it_cls = it_cls;
@@ -344,4 +344,4 @@ TALER_MINT_denomkeys_iterate (const char *mint_base_dir,
}
-/* end of key_io.c */
+/* end of mintdb_keyio.c */
diff --git a/src/mintdb/mintdb_plugin.c b/src/mintdb/mintdb_plugin.c
index b109ff3d..13d7c8f7 100644
--- a/src/mintdb/mintdb_plugin.c
+++ b/src/mintdb/mintdb_plugin.c
@@ -25,19 +25,13 @@
/**
- * Libtool search path before we started.
- */
-static char *old_dlsearchpath;
-
-
-/**
* Initialize the plugin.
*
* @param cfg configuration to use
* @return #GNUNET_OK on success
*/
struct TALER_MINTDB_Plugin *
-TALER_MINT_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
+TALER_MINTDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
char *plugin_name;
char *lib_name;
@@ -76,7 +70,7 @@ TALER_MINT_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
* @param plugin the plugin to unload
*/
void
-TALER_MINT_plugin_unload (struct TALER_MINTDB_Plugin *plugin)
+TALER_MINTDB_plugin_unload (struct TALER_MINTDB_Plugin *plugin)
{
char *lib_name;
@@ -90,6 +84,12 @@ TALER_MINT_plugin_unload (struct TALER_MINTDB_Plugin *plugin)
/**
+ * Libtool search path before we started.
+ */
+static char *old_dlsearchpath;
+
+
+/**
* Setup libtool paths.
*/
void __attribute__ ((constructor))
@@ -146,4 +146,4 @@ plugin_fini ()
}
-/* end of plugin.c */
+/* end of mintdb_plugin.c */
diff --git a/src/mintdb/test_mintdb.c b/src/mintdb/test_mintdb.c
index a8209407..b98a09cd 100644
--- a/src/mintdb/test_mintdb.c
+++ b/src/mintdb/test_mintdb.c
@@ -19,7 +19,8 @@
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#include "platform.h"
-#include "plugin.h"
+#include "taler_mintdb_lib.h"
+#include "taler_mintdb_plugin.h"
static int result;
@@ -40,6 +41,8 @@ static int result;
#define CURRENCY "EUR"
+static struct TALER_MINTDB_Plugin *plugin;
+
/**
* Checks if the given reserve has the given amount of balance and expiry
*
@@ -154,8 +157,8 @@ run (void *cls,
session = NULL;
ZR_BLK (&cbc);
ZR_BLK (&cbc2);
- if (GNUNET_OK !=
- TALER_MINT_plugin_load (cfg))
+ if (NULL ==
+ (plugin = TALER_MINTDB_plugin_load (cfg)))
{
result = 1;
return;
@@ -344,7 +347,8 @@ run (void *cls,
if (NULL != cbc2.sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (cbc2.sig.rsa_signature);
dkp = NULL;
- TALER_MINT_plugin_unload ();
+ TALER_MINTDB_plugin_unload (plugin);
+ plugin = NULL;
}
diff --git a/src/mintdb/test_mintdb_deposits.c b/src/mintdb/test_mintdb_deposits.c
index dbe12e88..766bedd7 100644
--- a/src/mintdb/test_mintdb_deposits.c
+++ b/src/mintdb/test_mintdb_deposits.c
@@ -21,9 +21,11 @@
#include "platform.h"
#include <libpq-fe.h>
#include <gnunet/gnunet_util_lib.h>
-#include "plugin.h"
#include "taler_pq_lib.h"
-#include "taler-mint-httpd.h"
+#include "taler_mintdb_lib.h"
+#include "taler_mintdb_plugin.h"
+
+#define MINT_CURRENCY "EUR"
#define DB_URI "postgres:///taler"
@@ -51,6 +53,10 @@ static int persistent;
*/
static int result;
+/**
+ * The plugin.
+ */
+static struct TALER_MINTDB_Plugin *plugin;
/**
* Main function that will be run by the scheduler.
@@ -77,7 +83,7 @@ run (void *cls,
struct TALER_MINTDB_Session *session;
deposit = NULL;
- EXITIF (GNUNET_OK != TALER_MINT_plugin_load (cfg));
+ EXITIF (NULL == (plugin = TALER_MINTDB_plugin_load (cfg)));
EXITIF (GNUNET_OK !=
plugin->create_tables (plugin->cls,
! persistent));
@@ -98,8 +104,8 @@ run (void *cls,
htonl (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX));
deposit->amount_with_fee.fraction =
htonl (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX));
- GNUNET_assert (strlen (TMH_MINT_CURRENCY) < sizeof (deposit->amount_with_fee.currency));
- strcpy (deposit->amount_with_fee.currency, TMH_MINT_CURRENCY);
+ GNUNET_assert (strlen (MINT_CURRENCY) < sizeof (deposit->amount_with_fee.currency));
+ strcpy (deposit->amount_with_fee.currency, MINT_CURRENCY);
/* Copy wireformat */
deposit->wire = json_loads (wire, 0, NULL);
EXITIF (GNUNET_OK !=
@@ -114,7 +120,11 @@ run (void *cls,
EXITIF_exit:
GNUNET_free_non_null (deposit);
- return;
+ if (NULL != plugin)
+ {
+ TALER_MINTDB_plugin_unload (plugin);
+ plugin = NULL;
+ }
}
diff --git a/src/mintdb/test_mintdb_keyio.c b/src/mintdb/test_mintdb_keyio.c
index 83df2504..a32d6493 100644
--- a/src/mintdb/test_mintdb_keyio.c
+++ b/src/mintdb/test_mintdb_keyio.c
@@ -21,7 +21,7 @@
#include "platform.h"
#include "gnunet/gnunet_util_lib.h"
#include "taler_signatures.h"
-#include "key_io.h"
+#include "taler_mintdb_lib.h"
#define RSA_KEY_SIZE 1024
@@ -36,10 +36,10 @@ int
main (int argc,
const char *const argv[])
{
- struct TALER_DenominationKeyIssueInformation dki;
+ struct TALER_MINTDB_DenominationKeyIssueInformation dki;
char *enc;
size_t enc_size;
- struct TALER_DenominationKeyIssueInformation dki_read;
+ struct TALER_MINTDB_DenominationKeyIssueInformation dki_read;
char *enc_read;
size_t enc_read_size;
char *tmpfile;
@@ -60,8 +60,8 @@ main (int argc,
enc_size = GNUNET_CRYPTO_rsa_private_key_encode (dki.denom_priv.rsa_private_key,
&enc);
EXITIF (NULL == (tmpfile = GNUNET_DISK_mktemp ("test_mint_common")));
- EXITIF (GNUNET_OK != TALER_MINT_write_denom_key (tmpfile, &dki));
- EXITIF (GNUNET_OK != TALER_MINT_read_denom_key (tmpfile, &dki_read));
+ EXITIF (GNUNET_OK != TALER_MINTDB_denomination_key_write (tmpfile, &dki));
+ EXITIF (GNUNET_OK != TALER_MINTDB_denomination_key_read (tmpfile, &dki_read));
enc_read_size = GNUNET_CRYPTO_rsa_private_key_encode (dki_read.denom_priv.rsa_private_key,
&enc_read);
EXITIF (enc_size != enc_read_size);