diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-28 15:06:09 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-28 15:06:09 +0100 |
commit | c119d914b39305add86ef58e058e80ef7af20a40 (patch) | |
tree | 3cb3df8840179218f861b9c5669237d796b4ffbb | |
parent | 9cbc31afc495ebdfe7b24535ca2eee54b5a17ab7 (diff) | |
download | exchange-c119d914b39305add86ef58e058e80ef7af20a40.tar.gz exchange-c119d914b39305add86ef58e058e80ef7af20a40.zip |
more restructuring
-rw-r--r-- | src/mint/mint.h | 16 | ||||
-rw-r--r-- | src/mint/mint_db.h | 14 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd.h | 1 | ||||
-rw-r--r-- | src/mint/taler-mint-reservemod.c | 27 |
4 files changed, 33 insertions, 25 deletions
diff --git a/src/mint/mint.h b/src/mint/mint.h index 1c5e9802e..202de94d3 100644 --- a/src/mint/mint.h +++ b/src/mint/mint.h | |||
@@ -18,9 +18,6 @@ | |||
18 | * @brief Common functionality for the mint | 18 | * @brief Common functionality for the mint |
19 | * @author Florian Dold | 19 | * @author Florian Dold |
20 | * @author Benedikt Mueller | 20 | * @author Benedikt Mueller |
21 | * | ||
22 | * TODO: | ||
23 | * - move DB functions to mint_db.h | ||
24 | */ | 21 | */ |
25 | #ifndef _MINT_H | 22 | #ifndef _MINT_H |
26 | #define _MINT_H | 23 | #define _MINT_H |
@@ -28,7 +25,6 @@ | |||
28 | #include <gnunet/gnunet_util_lib.h> | 25 | #include <gnunet/gnunet_util_lib.h> |
29 | #include <gnunet/gnunet_common.h> | 26 | #include <gnunet/gnunet_common.h> |
30 | #include <jansson.h> | 27 | #include <jansson.h> |
31 | #include <libpq-fe.h> | ||
32 | #include "taler_util.h" | 28 | #include "taler_util.h" |
33 | #include "taler_signatures.h" | 29 | #include "taler_signatures.h" |
34 | 30 | ||
@@ -330,16 +326,4 @@ struct Reserve | |||
330 | 326 | ||
331 | 327 | ||
332 | 328 | ||
333 | int | ||
334 | TALER_TALER_DB_extract_amount (PGresult *result, | ||
335 | unsigned int row, | ||
336 | int indices[3], | ||
337 | struct TALER_Amount *denom); | ||
338 | |||
339 | int | ||
340 | TALER_TALER_DB_extract_amount_nbo (PGresult *result, | ||
341 | unsigned int row, | ||
342 | int indices[3], | ||
343 | struct TALER_AmountNBO *denom_nbo); | ||
344 | |||
345 | #endif /* _MINT_H */ | 329 | #endif /* _MINT_H */ |
diff --git a/src/mint/mint_db.h b/src/mint/mint_db.h index 3a62f1835..64d72a350 100644 --- a/src/mint/mint_db.h +++ b/src/mint/mint_db.h | |||
@@ -282,4 +282,18 @@ TALER_MINT_DB_init (const char *connection_cfg); | |||
282 | 282 | ||
283 | 283 | ||
284 | 284 | ||
285 | |||
286 | int | ||
287 | TALER_TALER_DB_extract_amount (PGresult *result, | ||
288 | unsigned int row, | ||
289 | int indices[3], | ||
290 | struct TALER_Amount *denom); | ||
291 | |||
292 | int | ||
293 | TALER_TALER_DB_extract_amount_nbo (PGresult *result, | ||
294 | unsigned int row, | ||
295 | int indices[3], | ||
296 | struct TALER_AmountNBO *denom_nbo); | ||
297 | |||
298 | |||
285 | #endif /* _NEURO_MINT_DB_H */ | 299 | #endif /* _NEURO_MINT_DB_H */ |
diff --git a/src/mint/taler-mint-httpd.h b/src/mint/taler-mint-httpd.h index 59f38aadb..cff2859db 100644 --- a/src/mint/taler-mint-httpd.h +++ b/src/mint/taler-mint-httpd.h | |||
@@ -38,6 +38,7 @@ extern struct GNUNET_CONFIGURATION_Handle *cfg; | |||
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Main directory with mint data. | 40 | * Main directory with mint data. |
41 | * FIXME: should we have those globals really here? | ||
41 | */ | 42 | */ |
42 | extern char *mintdir; | 43 | extern char *mintdir; |
43 | 44 | ||
diff --git a/src/mint/taler-mint-reservemod.c b/src/mint/taler-mint-reservemod.c index 48a9c88b4..b2129d261 100644 --- a/src/mint/taler-mint-reservemod.c +++ b/src/mint/taler-mint-reservemod.c | |||
@@ -27,10 +27,14 @@ | |||
27 | #include "taler_util.h" | 27 | #include "taler_util.h" |
28 | #include "taler_signatures.h" | 28 | #include "taler_signatures.h" |
29 | #include "mint.h" | 29 | #include "mint.h" |
30 | #include "mint_db.h" | ||
31 | |||
32 | char *mintdir; | ||
30 | 33 | ||
31 | static char *mintdir; | ||
32 | static struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub; | 34 | static struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub; |
33 | static struct GNUNET_CONFIGURATION_Handle *kcfg; | 35 | |
36 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
37 | |||
34 | static PGconn *db_conn; | 38 | static PGconn *db_conn; |
35 | 39 | ||
36 | 40 | ||
@@ -169,22 +173,27 @@ main (int argc, char *const *argv) | |||
169 | 173 | ||
170 | reserve_pub = GNUNET_new (struct GNUNET_CRYPTO_EddsaPublicKey); | 174 | reserve_pub = GNUNET_new (struct GNUNET_CRYPTO_EddsaPublicKey); |
171 | if ((NULL == reserve_pub_str) || | 175 | if ((NULL == reserve_pub_str) || |
172 | (GNUNET_OK != GNUNET_STRINGS_string_to_data (reserve_pub_str, | 176 | (GNUNET_OK != |
173 | strlen (reserve_pub_str), | 177 | GNUNET_STRINGS_string_to_data (reserve_pub_str, |
174 | reserve_pub, | 178 | strlen (reserve_pub_str), |
175 | sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))) | 179 | reserve_pub, |
180 | sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))) | ||
176 | { | 181 | { |
177 | fprintf (stderr, "reserve key invalid\n"); | 182 | fprintf (stderr, "reserve key invalid\n"); |
178 | return 1; | 183 | return 1; |
179 | } | 184 | } |
180 | 185 | ||
181 | kcfg = TALER_config_load (mintdir); | 186 | cfg = TALER_config_load (mintdir); |
182 | if (NULL == kcfg) | 187 | if (NULL == cfg) |
183 | { | 188 | { |
184 | fprintf (stderr, "can't load mint configuration\n"); | 189 | fprintf (stderr, "can't load mint configuration\n"); |
185 | return 1; | 190 | return 1; |
186 | } | 191 | } |
187 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (kcfg, "mint", "db", &TALER_MINT_db_connection_cfg_str)) | 192 | if (GNUNET_OK != |
193 | GNUNET_CONFIGURATION_get_value_string (cfg, | ||
194 | "mint", | ||
195 | "db", | ||
196 | &TALER_MINT_db_connection_cfg_str)) | ||
188 | { | 197 | { |
189 | fprintf (stderr, "db configuration string not found\n"); | 198 | fprintf (stderr, "db configuration string not found\n"); |
190 | return 42; | 199 | return 42; |