diff options
Diffstat (limited to 'src/merchant')
-rw-r--r-- | src/merchant/merchant_db.c | 12 | ||||
-rw-r--r-- | src/merchant/merchant_db.h | 12 | ||||
-rw-r--r-- | src/merchant/taler_merchant_dbinit.c | 4 | ||||
-rw-r--r-- | src/merchant/taler_merchant_serve.c | 10 | ||||
-rw-r--r-- | src/merchant/test_merchant_db.c | 12 |
5 files changed, 25 insertions, 25 deletions
diff --git a/src/merchant/merchant_db.c b/src/merchant/merchant_db.c index e87dbcc8..0fed805d 100644 --- a/src/merchant/merchant_db.c +++ b/src/merchant/merchant_db.c @@ -48,7 +48,7 @@ * @return connection to the postgresql database; NULL upon error */ PGconn * -MERCHANT_DB_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) +TALER_MERCHANTDB_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) { return GNUNET_POSTGRES_connect (cfg, "merchant-db"); } @@ -60,7 +60,7 @@ MERCHANT_DB_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) * @param conn database handle to close */ void -MERCHANT_DB_disconnect (PGconn *conn) +TALER_MERCHANTDB_disconnect (PGconn *conn) { PQfinish (conn); } @@ -195,7 +195,7 @@ MERCHANT_DB_initialise (PGconn *conn, int tmp) * @return -1 upon error; the serial id of the inserted contract upon success */ long long -MERCHANT_DB_contract_create (PGconn *conn, +TALER_MERCHANTDB_contract_create (PGconn *conn, struct GNUNET_TIME_Absolute expiry, struct TALER_Amount *amount, const char *desc, @@ -242,7 +242,7 @@ MERCHANT_DB_contract_create (PGconn *conn, } long long -MERCHANT_DB_get_contract_product (PGconn *conn, +TALER_MERCHANTDB_contract_get_product (PGconn *conn, uint64_t contract_id) { PGresult *res; @@ -272,7 +272,7 @@ MERCHANT_DB_get_contract_product (PGconn *conn, } unsigned int -MERCHANT_DB_checkout_create (PGconn *conn, +TALER_MERCHANTDB_checkout_create (PGconn *conn, struct GNUNET_CRYPTO_EddsaPublicKey *coin_pub, uint64_t transaction_id, struct TALER_Amount *amount, @@ -307,7 +307,7 @@ MERCHANT_DB_checkout_create (PGconn *conn, long long -MERCHANT_DB_get_checkout_product (PGconn *conn, +TALER_MERCHANTDB_checkout_get_product (PGconn *conn, struct GNUNET_CRYPTO_EddsaPublicKey *coin_pub) { PGresult *res; diff --git a/src/merchant/merchant_db.h b/src/merchant/merchant_db.h index 734d547f..463eeb07 100644 --- a/src/merchant/merchant_db.h +++ b/src/merchant/merchant_db.h @@ -33,7 +33,7 @@ * @return connection to the postgresql database; NULL upon error */ PGconn * -MERCHANT_DB_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); +TALER_MERCHANTDB_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); /** @@ -42,7 +42,7 @@ MERCHANT_DB_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); * @param conn database handle to close */ void -MERCHANT_DB_disconnect (PGconn *conn); +TALER_MERCHANTDB_disconnect (PGconn *conn); /** @@ -70,7 +70,7 @@ MERCHANT_DB_initialise (PGconn *conn, int tmp); * @return -1 upon error; the serial id of the inserted contract upon success */ long long -MERCHANT_DB_contract_create (PGconn *conn, +TALER_MERCHANTDB_contract_create (PGconn *conn, struct GNUNET_TIME_Absolute expiry, struct TALER_Amount *amount, const char *desc, @@ -78,11 +78,11 @@ MERCHANT_DB_contract_create (PGconn *conn, uint64_t product); long long -MERCHANT_DB_get_contract_product (PGconn *conn, +TALER_MERCHANTDB_contract_get_product (PGconn *conn, uint64_t contract_id); unsigned int -MERCHANT_DB_checkout_create (PGconn *conn, +TALER_MERCHANTDB_checkout_create (PGconn *conn, struct GNUNET_CRYPTO_EddsaPublicKey *coin_pub, uint64_t transaction_id, struct TALER_Amount *amount, @@ -90,7 +90,7 @@ MERCHANT_DB_checkout_create (PGconn *conn, long long -MERCHANT_DB_get_checkout_product (PGconn *conn, +TALER_MERCHANTDB_checkout_get_product (PGconn *conn, struct GNUNET_CRYPTO_EddsaPublicKey *coin_pub); #endif /* MERCHANT_DB_H */ diff --git a/src/merchant/taler_merchant_dbinit.c b/src/merchant/taler_merchant_dbinit.c index e6d0af9d..21e28f9d 100644 --- a/src/merchant/taler_merchant_dbinit.c +++ b/src/merchant/taler_merchant_dbinit.c @@ -45,12 +45,12 @@ run (void *cls, char *const *args, const char *cfgfile, { PGconn *conn; - conn = MERCHANT_DB_connect (config); + conn = TALER_MERCHANTDB_connect (config); if (NULL == conn) return; if (GNUNET_OK == MERCHANT_DB_initialise (conn, GNUNET_NO)) result = GNUNET_OK; - MERCHANT_DB_disconnect (conn); + TALER_MERCHANTDB_disconnect (conn); } diff --git a/src/merchant/taler_merchant_serve.c b/src/merchant/taler_merchant_serve.c index 0f00a8c2..345e01bb 100644 --- a/src/merchant/taler_merchant_serve.c +++ b/src/merchant/taler_merchant_serve.c @@ -511,7 +511,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } if (NULL != db_conn) { - MERCHANT_DB_disconnect (db_conn); + TALER_MERCHANTDB_disconnect (db_conn); db_conn = NULL; } if (NULL != mints_map) @@ -792,7 +792,7 @@ handle_get_contract (struct MHD_Connection *connection, template, hostname, port); - contract_id = MERCHANT_DB_contract_create (db_conn, + contract_id = TALER_MERCHANTDB_contract_create (db_conn, expiry, &amount, desc, @@ -881,7 +881,7 @@ handle_download (struct MHD_Connection *conn, GNUNET_CRYPTO_eddsa_public_key_from_string (coin_pub_enc, strlen (coin_pub_enc), &coin_pub)); - product_id = MERCHANT_DB_get_checkout_product (db_conn, + product_id = TALER_MERCHANTDB_checkout_get_product (db_conn, &coin_pub); EXITIF (-1 == product_id); EXITIF (NULL == (item = find_product ((unsigned int) product_id))); @@ -1117,7 +1117,7 @@ handle_checkout (struct MHD_Connection *conn, emsg = "Contract not found"; status = MHD_HTTP_NOT_FOUND; LOG_DEBUG ("Looking for product associated with transaction %u\n", tid); - EXITIF (-1 == (product_id = MERCHANT_DB_get_contract_product (db_conn, tid))); + EXITIF (-1 == (product_id = TALER_MERCHANTDB_contract_get_product (db_conn, tid))); emsg = "Could not find the downloadable product. Sorry :("; EXITIF (NULL == (product = find_product (product_id))); @@ -1452,7 +1452,7 @@ run (void *cls, char *const *args, const char *cfgfile, &add_download_file, NULL)); EXITIF (GNUNET_SYSERR == build_list_product_response ()); - EXITIF (NULL == (db_conn = MERCHANT_DB_connect (config))); + EXITIF (NULL == (db_conn = TALER_MERCHANTDB_connect (config))); EXITIF (GNUNET_OK != MERCHANT_DB_initialise (db_conn, dry)); EXITIF (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (config, diff --git a/src/merchant/test_merchant_db.c b/src/merchant/test_merchant_db.c index caaa1be4..505b12c3 100644 --- a/src/merchant/test_merchant_db.c +++ b/src/merchant/test_merchant_db.c @@ -52,7 +52,7 @@ static void do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (NULL != conn) - MERCHANT_DB_disconnect (conn); + TALER_MERCHANTDB_disconnect (conn); conn = NULL; } @@ -76,7 +76,7 @@ run (void *cls, char *const *args, const char *cfgfile, uint64_t product; long long transaction_id; - conn = MERCHANT_DB_connect (config); + conn = TALER_MERCHANTDB_connect (config); EXITIF (NULL == conn); GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); EXITIF (GNUNET_OK != MERCHANT_DB_initialise (conn, GNUNET_YES)); @@ -88,7 +88,7 @@ run (void *cls, char *const *args, const char *cfgfile, nounce = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE, UINT64_MAX); product = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE, UINT64_MAX); product &= (UINT64_MAX >> 1); - EXITIF (-1 == (transaction_id = MERCHANT_DB_contract_create (conn, + EXITIF (-1 == (transaction_id = TALER_MERCHANTDB_contract_create (conn, expiry, &amount, desc, @@ -103,19 +103,19 @@ run (void *cls, char *const *args, const char *cfgfile, &coin_pub, sizeof (coin_pub)); GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &coin_sig, sizeof (coin_sig)); - EXITIF (GNUNET_SYSERR == MERCHANT_DB_checkout_create (conn, + EXITIF (GNUNET_SYSERR == TALER_MERCHANTDB_checkout_create (conn, &coin_pub, transaction_id, &amount, &coin_sig)); - EXITIF (-1 == (paid_product = MERCHANT_DB_get_checkout_product (conn, + EXITIF (-1 == (paid_product = TALER_MERCHANTDB_checkout_get_product (conn, &coin_pub))); EXITIF (paid_product < 0); EXITIF (((uint64_t) paid_product) != product); /* We should get -1 for product if a coin is not paid to us */ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &coin_pub, sizeof (coin_pub)); - EXITIF (-1 != (product = MERCHANT_DB_get_checkout_product (conn, + EXITIF (-1 != (product = TALER_MERCHANTDB_checkout_get_product (conn, &coin_pub))); } result = GNUNET_OK; |