summaryrefslogtreecommitdiff
path: root/src/backend/merchant.c
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2015-10-26 16:28:11 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2015-10-26 16:28:11 +0100
commit4254332bd1bd01c41088a158d21d3e1e4ab4eb90 (patch)
tree2d6f044251b154927b3d1c9a646aebf0be1297c5 /src/backend/merchant.c
parentb0097e0389376fe5b1fc78684c53c2b0de647582 (diff)
downloadmerchant-4254332bd1bd01c41088a158d21d3e1e4ab4eb90.tar.gz
merchant-4254332bd1bd01c41088a158d21d3e1e4ab4eb90.tar.bz2
merchant-4254332bd1bd01c41088a158d21d3e1e4ab4eb90.zip
Fetching mint's details (compliant to the new API) from the
configuration file. To test.
Diffstat (limited to 'src/backend/merchant.c')
-rw-r--r--src/backend/merchant.c95
1 files changed, 93 insertions, 2 deletions
diff --git a/src/backend/merchant.c b/src/backend/merchant.c
index f124a030..31223aeb 100644
--- a/src/backend/merchant.c
+++ b/src/backend/merchant.c
@@ -48,10 +48,18 @@ TALER_MERCHANT_parse_mints (const struct GNUNET_CONFIGURATION_Handle *cfg,
char *token_nf; /* do no free (nf) */
char *mint_section;
char *mint_hostname;
+ char *mint_country;
+ char *mint_city;
+ char *mint_state;
+ char *mint_region;
+ char *mint_province;
char *mint_pubkey_enc;
+ char *mint_street;
struct MERCHANT_MintInfo *r_mints;
struct MERCHANT_MintInfo mint;
unsigned long long mint_port;
+ unsigned long long mint_zip_code;
+ unsigned long long mint_street_no;
unsigned int cnt;
int OK;
@@ -60,6 +68,15 @@ TALER_MERCHANT_parse_mints (const struct GNUNET_CONFIGURATION_Handle *cfg,
token_nf = NULL;
mint_section = NULL;
mint_hostname = NULL;
+ mint_port = 0;
+ mint_country = NULL;
+ mint_city = NULL;
+ mint_state = NULL;
+ mint_region = NULL;
+ mint_province = NULL;
+ mint_zip_code = 0;
+ mint_street = NULL;
+ mint_street_no = 0;
mint_pubkey_enc = NULL;
r_mints = NULL;
cnt = 0;
@@ -73,6 +90,8 @@ TALER_MERCHANT_parse_mints (const struct GNUNET_CONFIGURATION_Handle *cfg,
{
GNUNET_assert (0 < GNUNET_asprintf (&mint_section,
"mint-%s", token_nf));
+ memset (&mint, 0, sizeof (mint));
+
EXITIF (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
mint_section,
@@ -92,14 +111,86 @@ TALER_MERCHANT_parse_mints (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_CRYPTO_eddsa_public_key_from_string (mint_pubkey_enc,
strlen (mint_pubkey_enc),
&mint.pubkey));
+
+ EXITIF (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ mint_section,
+ "COUNTRY",
+ &mint_country));
+
+ EXITIF (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ mint_section,
+ "CITY",
+ &mint_city));
+
+
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ mint_section,
+ "STATE",
+ &mint_state))
+ mint.state = mint_state;
+
+
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ mint_section,
+ "REGION",
+ &mint_region))
+ mint.region = mint_region;
+
+
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ mint_section,
+ "PROVINCE",
+ &mint_province))
+ mint.province = mint_province;
+
+
+ EXITIF (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg,
+ mint_section,
+ "ZIP_CODE",
+ &mint_zip_code));
+
+ EXITIF (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ mint_section,
+ "STREET",
+ &mint_street));
+
+ EXITIF (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg,
+ mint_section,
+ "STREET_NUMBER",
+ &mint_street_no));
mint.hostname = mint_hostname;
mint.port = (uint16_t) mint_port;
+ mint.country = mint_country;
+ mint.city = mint_city;
+ mint.zip_code = (uint16_t) mint_zip_code;
+ mint.street = mint_street;
+ mint.street_no = (uint16_t) mint_street_no;
GNUNET_array_append (r_mints, cnt, mint);
+ GNUNET_free (mint_hostname);
mint_hostname = NULL;
- GNUNET_free (mint_pubkey_enc);
+ GNUNET_free (mint_country);
+ mint_country = NULL;
+ GNUNET_free (mint_city);
+ mint_city = NULL;
+ GNUNET_free_non_null (mint_state);
+ mint_state = NULL;
+ GNUNET_free_non_null (mint_region);
+ mint_region = NULL;
+ GNUNET_free_non_null (mint_province);
+ mint_province = NULL;
+ GNUNET_free_non_null (mint_pubkey_enc);
mint_pubkey_enc = NULL;
- GNUNET_free (mint_section);
+ GNUNET_free_non_null (mint_section);
mint_section = NULL;
+
}
OK = 1;