summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-11-25 13:38:54 +0100
committerChristian Grothoff <christian@grothoff.org>2015-11-25 13:38:54 +0100
commit8e8e59917a09298f0e8d46884a93bef14c2ae98b (patch)
tree8c952f44255f8f87f18399a6431568b3124c0d6e
parent0a073f8bf4b6611c4436d093deef7631c643f5bf (diff)
downloadmerchant-8e8e59917a09298f0e8d46884a93bef14c2ae98b.tar.gz
merchant-8e8e59917a09298f0e8d46884a93bef14c2ae98b.tar.bz2
merchant-8e8e59917a09298f0e8d46884a93bef14c2ae98b.zip
rename fest to satisfy naming conventions
-rw-r--r--configure.ac6
-rw-r--r--src/backend/Makefile.am13
-rw-r--r--src/backend/merchant.c36
-rw-r--r--src/backend/taler-merchant-httpd.c20
-rw-r--r--src/backend/taler-merchant-httpd.h67
-rw-r--r--src/backend/taler-merchant-httpd_contract.c8
-rw-r--r--src/backend/taler-merchant-httpd_contract.h4
-rw-r--r--src/backend/taler-merchant-httpd_mhd.c (renamed from src/backend/taler-mint-httpd_mhd.c)10
-rw-r--r--src/backend/taler-merchant-httpd_mhd.h (renamed from src/backend/taler-mint-httpd_mhd.h)4
-rw-r--r--src/backend/taler-merchant-httpd_parsing.c (renamed from src/backend/taler-mint-httpd_parsing.c)5
-rw-r--r--src/backend/taler-merchant-httpd_parsing.h (renamed from src/backend/taler-mint-httpd_parsing.h)0
-rw-r--r--src/backend/taler-merchant-httpd_pay.c12
-rw-r--r--src/backend/taler-merchant-httpd_pay.h4
-rw-r--r--src/backend/taler-merchant-httpd_responses.c (renamed from src/backend/taler-mint-httpd_responses.c)4
-rw-r--r--src/backend/taler-merchant-httpd_responses.h (renamed from src/backend/taler-mint-httpd_responses.h)4
-rw-r--r--src/backend/taler-mint-httpd.h85
-rw-r--r--src/backenddb/merchant_db.c29
-rw-r--r--src/include/platform.h4
-rw-r--r--src/include/taler_merchantdb_lib.h26
-rw-r--r--src/merchant/merchant_db.c12
-rw-r--r--src/merchant/merchant_db.h12
-rw-r--r--src/merchant/taler_merchant_dbinit.c4
-rw-r--r--src/merchant/taler_merchant_serve.c10
-rw-r--r--src/merchant/test_merchant_db.c12
-rw-r--r--src/tests/test_contract.c10
25 files changed, 169 insertions, 232 deletions
diff --git a/configure.ac b/configure.ac
index 89cfe25d..b66b8b00 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,9 +2,9 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
-AC_INIT([taler], [0.0.0], [taler-bug@gnunet.org])
-AC_CONFIG_SRCDIR([src/merchant/merchant.c])
-AC_CONFIG_HEADERS([taler_config.h])
+AC_INIT([taler-merchant], [0.0.0], [taler-bug@gnunet.org])
+AC_CONFIG_SRCDIR([src/backend/taler-merchant-httpd.c])
+AC_CONFIG_HEADERS([taler_merchant_config.h])
# support for non-recursive builds
AM_INIT_AUTOMAKE([subdir-objects])
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index 81fbd4ed..b1936990 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -6,14 +6,11 @@ bin_PROGRAMS = \
taler_merchant_httpd_SOURCES = \
taler-merchant-httpd.c taler-merchant-httpd.h \
- taler-mint-httpd_parsing.c taler-mint-httpd_parsing.h \
- taler-mint-httpd_responses.c taler-mint-httpd_responses.h \
- taler-mint-httpd.h \
- taler-mint-httpd_mhd.c taler-mint-httpd_mhd.h \
- taler-merchant-httpd_contract.c \
- taler-merchant-httpd_contract.h \
- taler-merchant-httpd_pay.c \
- taler-merchant-httpd_pay.h
+ taler-merchant-httpd_parsing.c taler-merchant-httpd_parsing.h \
+ taler-merchant-httpd_responses.c taler-merchant-httpd_responses.h \
+ taler-merchant-httpd_mhd.c taler-merchant-httpd_mhd.h \
+ taler-merchant-httpd_contract.c taler-merchant-httpd_contract.h \
+ taler-merchant-httpd_pay.c taler-merchant-httpd_pay.h
taler_merchant_httpd_LDADD = \
diff --git a/src/backend/merchant.c b/src/backend/merchant.c
deleted file mode 100644
index b0ab811f..00000000
--- a/src/backend/merchant.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- This file is part of TALER
- (C) 2014 Christian Grothoff (and other contributing authors)
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-
-/**
- * @file merchant/merchant.c
- * @brief Common utility functions for merchant
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
- */
-
-#include "platform.h"
-#include <gnunet/gnunet_util_lib.h>
-#include "merchant.h"
-
-
-#define EXITIF(cond) \
- do { \
- if (cond) { GNUNET_break (0); goto EXITIF_exit; } \
- } while (0)
-
-
-
-
-/* end of merchant.c */
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index d135a7c5..d24f10a9 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -28,11 +28,11 @@
#include <curl/curl.h>
#include <taler/taler_util.h>
#include <taler/taler_mint_service.h>
-#include "taler-mint-httpd_parsing.h"
-#include "taler-mint-httpd_responses.h"
+#include "taler-merchant-httpd_parsing.h"
+#include "taler-merchant-httpd_responses.h"
#include "taler_merchantdb_lib.h"
#include "taler-merchant-httpd.h"
-#include "taler-mint-httpd_mhd.h"
+#include "taler-merchant-httpd_mhd.h"
#include "taler-merchant-httpd_contract.h"
#include "taler-merchant-httpd_pay.h"
@@ -351,7 +351,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 != keyfile)
@@ -618,8 +618,8 @@ parse_auditors (const struct GNUNET_CONFIGURATION_Handle *cfg,
/**
- * Parse the SEPA information from the configuration. If any of the required
- * fileds is missing return NULL.
+ * Parse the SEPA information from the configuration. If any of the
+ * required fields is missing return NULL.
*
* @param cfg the configuration
* @return Sepa details as a structure; NULL upon error
@@ -740,10 +740,6 @@ run (void *cls,
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&do_shutdown,
NULL);
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "merchant launched\n");
-
EXITIF (GNUNET_SYSERR ==
(nmints =
parse_mints (config)));
@@ -763,9 +759,9 @@ run (void *cls,
(privkey =
GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile)));
EXITIF (NULL ==
- (db_conn = MERCHANT_DB_connect (config)));
+ (db_conn = TALER_MERCHANTDB_connect (config)));
EXITIF (GNUNET_OK !=
- MERCHANT_DB_initialize (db_conn, dry));
+ TALER_MERCHANTDB_initialize (db_conn, dry));
EXITIF (GNUNET_SYSERR ==
GNUNET_CONFIGURATION_get_value_number (config,
"merchant",
diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h
index 7dc1b647..d2fe3921 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -18,9 +18,12 @@
* @brief HTTP serving layer mainly intended to communicate with the frontend
* @author Marcello Stanisci
*/
+#ifndef TALER_MERCHANT_HTTPD_H
+#define TALER_MERCHANT_HTTPD_H
#include "platform.h"
#include "taler_merchantdb_lib.h"
+#include <microhttpd.h>
/**
* Shorthand for exit jumps.
@@ -31,6 +34,64 @@
} while (0)
+
+
+/**
+ * @brief Struct describing an URL and the handler for it.
+ */
+struct TMH_RequestHandler
+{
+
+ /**
+ * URL the handler is for.
+ */
+ const char *url;
+
+ /**
+ * Method the handler is for, NULL for "all".
+ */
+ const char *method;
+
+ /**
+ * Mime type to use in reply (hint, can be NULL).
+ */
+ const char *mime_type;
+
+ /**
+ * Raw data for the @e handler
+ */
+ const void *data;
+
+ /**
+ * Number of bytes in @e data, 0 for 0-terminated.
+ */
+ size_t data_size;
+
+ /**
+ * Function to call to handle the request.
+ *
+ * @param rh this struct
+ * @param mime_type the @e mime_type for the reply (hint, can be NULL)
+ * @param connection the MHD connection to handle
+ * @param[in,out] connection_cls the connection's closure (can be updated)
+ * @param upload_data upload data
+ * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
+ * @return MHD result code
+ */
+ int (*handler)(struct TMH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size);
+
+ /**
+ * Default response code.
+ */
+ int response_code;
+};
+
+
+
/**
* Mint
*/
@@ -122,6 +183,9 @@ struct TM_HandlerContext
};
+extern struct MERCHANT_Auditor *auditors;
+extern unsigned int nauditors;
+
extern struct MERCHANT_WIREFORMAT_Sepa *wire;
@@ -164,3 +228,6 @@ MERCHANT_get_wire_json (const struct MERCHANT_WIREFORMAT_Sepa *wire,
*/
void
TM_trigger_daemon (void);
+
+
+#endif
diff --git a/src/backend/taler-merchant-httpd_contract.c b/src/backend/taler-merchant-httpd_contract.c
index d6c1b8fd..88757b53 100644
--- a/src/backend/taler-merchant-httpd_contract.c
+++ b/src/backend/taler-merchant-httpd_contract.c
@@ -29,14 +29,12 @@
#include <taler/taler_amount_lib.h>
#include <taler/taler_json_lib.h>
#include <taler/taler_mint_service.h>
-#include "taler-mint-httpd.h"
-#include "taler-mint-httpd_parsing.h"
-#include "taler-mint-httpd_responses.h"
+#include "taler-merchant-httpd.h"
+#include "taler-merchant-httpd_parsing.h"
+#include "taler-merchant-httpd_responses.h"
#include "taler_merchantdb_lib.h"
#include "taler-merchant-httpd.h"
-extern struct MERCHANT_Auditor *auditors;
-extern unsigned int nauditors;
/**
* Manage a contract request. In practical terms, it adds the fields 'mints',
diff --git a/src/backend/taler-merchant-httpd_contract.h b/src/backend/taler-merchant-httpd_contract.h
index 5e72c514..5a1aa6dd 100644
--- a/src/backend/taler-merchant-httpd_contract.h
+++ b/src/backend/taler-merchant-httpd_contract.h
@@ -23,7 +23,7 @@
#ifndef TALER_MINT_HTTPD_CONTRACT_H
#define TALER_MINT_HTTPD_CONTRACT_H
#include <microhttpd.h>
-#include "taler-mint-httpd.h"
+#include "taler-merchant-httpd.h"
/**
* Manage a contract request
@@ -33,7 +33,7 @@
* @param[in,out] connection_cls the connection's closure (can be updated)
* @param upload_data upload data
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
- *
+ *
* @return MHD result code
*/
int
diff --git a/src/backend/taler-mint-httpd_mhd.c b/src/backend/taler-merchant-httpd_mhd.c
index 419c4fb0..7b47bc9d 100644
--- a/src/backend/taler-mint-httpd_mhd.c
+++ b/src/backend/taler-merchant-httpd_mhd.c
@@ -15,7 +15,7 @@
*/
/**
- * @file taler-mint-httpd_mhd.c
+ * @file taler-merchant-httpd_mhd.c
* @brief helpers for MHD interaction; these are TALER_MINT_handler_ functions
* that generate simple MHD replies that do not require any real operations
* to be performed (error handling, static pages, etc.)
@@ -28,10 +28,10 @@
#include <jansson.h>
#include <microhttpd.h>
#include <pthread.h>
-#include "taler-mint-httpd_responses.h"
-#include "taler-mint-httpd.h"
-#include "taler-mint-httpd_mhd.h"
-#include "taler-mint-httpd_responses.h"
+#include "taler-merchant-httpd_responses.h"
+#include "taler-merchant-httpd.h"
+#include "taler-merchant-httpd_mhd.h"
+#include "taler-merchant-httpd_responses.h"
/**
diff --git a/src/backend/taler-mint-httpd_mhd.h b/src/backend/taler-merchant-httpd_mhd.h
index a9f575df..3fe137db 100644
--- a/src/backend/taler-mint-httpd_mhd.h
+++ b/src/backend/taler-merchant-httpd_mhd.h
@@ -15,7 +15,7 @@
*/
/**
- * @file taler-mint-httpd_mhd.h
+ * @file taler-merchant-httpd_mhd.h
* @brief helpers for MHD interaction, used to generate simple responses
* @author Florian Dold
* @author Benedikt Mueller
@@ -25,7 +25,7 @@
#define TALER_MINT_HTTPD_MHD_H
#include <gnunet/gnunet_util_lib.h>
#include <microhttpd.h>
-#include "taler-mint-httpd.h"
+#include "taler-merchant-httpd.h"
/**
diff --git a/src/backend/taler-mint-httpd_parsing.c b/src/backend/taler-merchant-httpd_parsing.c
index 314d8839..e7141b64 100644
--- a/src/backend/taler-mint-httpd_parsing.c
+++ b/src/backend/taler-merchant-httpd_parsing.c
@@ -21,11 +21,10 @@
* @author Benedikt Mueller
* @author Christian Grothoff
*/
-
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
-#include "taler-mint-httpd_parsing.h"
-#include "taler-mint-httpd_responses.h"
+#include "taler-merchant-httpd_parsing.h"
+#include "taler-merchant-httpd_responses.h"
/* Although the following declaration isn't in any case useful
to a merchant's activity, it's needed here to make the function
diff --git a/src/backend/taler-mint-httpd_parsing.h b/src/backend/taler-merchant-httpd_parsing.h
index dae65092..dae65092 100644
--- a/src/backend/taler-mint-httpd_parsing.h
+++ b/src/backend/taler-merchant-httpd_parsing.h
diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c
index 1885c59c..5191d711 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -28,10 +28,10 @@
#include <taler/taler_json_lib.h>
#include <taler/taler_mint_service.h>
#include "taler-merchant-httpd.h"
-#include "taler-mint-httpd.h"
-#include "taler-mint-httpd_parsing.h"
-#include "taler-mint-httpd_responses.h"
-#include "taler-mint-httpd_mhd.h"
+#include "taler-merchant-httpd.h"
+#include "taler-merchant-httpd_parsing.h"
+#include "taler-merchant-httpd_responses.h"
+#include "taler-merchant-httpd_mhd.h"
#include "taler_merchantdb_lib.h"
@@ -214,7 +214,7 @@ deposit_cb (void *cls,
/*FIXME the index is the same for every individual cb */
if (GNUNET_SYSERR ==
- MERCHANT_DB_update_deposit_permission (db_conn,
+ TALER_MERCHANTDB_deposit_permission_update (db_conn,
dcc->pc->transaction_id,
0))
/* TODO */
@@ -525,7 +525,7 @@ MH_handler_pay (struct TMH_RequestHandler *rh,
/* b */
char *deposit_permission_str = json_dumps (root, JSON_COMPACT);
- if (GNUNET_OK != MERCHANT_DB_store_deposit_permission (db_conn,
+ if (GNUNET_OK != TALER_MERCHANTDB_deposit_permission_store (db_conn,
deposit_permission_str,
transaction_id,
1,
diff --git a/src/backend/taler-merchant-httpd_pay.h b/src/backend/taler-merchant-httpd_pay.h
index 6a796e06..6fa7b8f3 100644
--- a/src/backend/taler-merchant-httpd_pay.h
+++ b/src/backend/taler-merchant-httpd_pay.h
@@ -23,7 +23,7 @@
#ifndef TALER_MINT_HTTPD_PAY_H
#define TALER_MINT_HTTPD_PAY_H
#include <microhttpd.h>
-#include "taler-mint-httpd.h"
+#include "taler-merchant-httpd.h"
/**
* Manage a payment
@@ -33,7 +33,7 @@
* @param[in,out] connection_cls the connection's closure (can be updated)
* @param upload_data upload data
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
- *
+ *
* @return MHD result code
*/
int
diff --git a/src/backend/taler-mint-httpd_responses.c b/src/backend/taler-merchant-httpd_responses.c
index 00a4d25f..1e2902c2 100644
--- a/src/backend/taler-mint-httpd_responses.c
+++ b/src/backend/taler-merchant-httpd_responses.c
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file taler-mint-httpd_responses.c
+ * @file taler-merchant-httpd_responses.c
* @brief API for generating the various replies of the mint; these
* functions are called TMH_RESPONSE_reply_ and they generate
* and queue MHD response objects for a given connection.
@@ -23,7 +23,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "taler-mint-httpd_responses.h"
+#include "taler-merchant-httpd_responses.h"
#include <taler/taler_util.h>
#include <gnunet/gnunet_util_lib.h>
diff --git a/src/backend/taler-mint-httpd_responses.h b/src/backend/taler-merchant-httpd_responses.h
index f947bd57..ad063eb8 100644
--- a/src/backend/taler-mint-httpd_responses.h
+++ b/src/backend/taler-merchant-httpd_responses.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014 GNUnet e.V.
+ Copyright (C) 2014, 2015 GNUnet e.V.
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -15,7 +15,7 @@
*/
/**
- * @file taler-mint-httpd_responses.h
+ * @file taler-merchant-httpd_responses.h
* @brief API for generating the various replies of the mint; these
* functions are called TMH_RESPONSE_reply_ and they generate
* and queue MHD response objects for a given connection.
diff --git a/src/backend/taler-mint-httpd.h b/src/backend/taler-mint-httpd.h
deleted file mode 100644
index ad8702f0..00000000
--- a/src/backend/taler-mint-httpd.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014, 2015 GNUnet e.V.
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file taler-mint-httpd.h
- * @brief Global declarations for the mint
- * @author Florian Dold
- * @author Benedikt Mueller
- * @author Christian Grothoff
- *
- * FIXME: Consider which of these need to really be globals...
- */
-#ifndef TALER_MINT_HTTPD_H
-#define TALER_MINT_HTTPD_H
-
-#include <microhttpd.h>
-
-/**
- * @brief Struct describing an URL and the handler for it.
- */
-struct TMH_RequestHandler
-{
-
- /**
- * URL the handler is for.
- */
- const char *url;
-
- /**
- * Method the handler is for, NULL for "all".
- */
- const char *method;
-
- /**
- * Mime type to use in reply (hint, can be NULL).
- */
- const char *mime_type;
-
- /**
- * Raw data for the @e handler
- */
- const void *data;
-
- /**
- * Number of bytes in @e data, 0 for 0-terminated.
- */
- size_t data_size;
-
- /**
- * Function to call to handle the request.
- *
- * @param rh this struct
- * @param mime_type the @e mime_type for the reply (hint, can be NULL)
- * @param connection the MHD connection to handle
- * @param[in,out] connection_cls the connection's closure (can be updated)
- * @param upload_data upload data
- * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
- * @return MHD result code
- */
- int (*handler)(struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size);
-
- /**
- * Default response code.
- */
- int response_code;
-};
-
-
-#endif
diff --git a/src/backenddb/merchant_db.c b/src/backenddb/merchant_db.c
index 6575b9ed..d8bef636 100644
--- a/src/backenddb/merchant_db.c
+++ b/src/backenddb/merchant_db.c
@@ -56,7 +56,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");
}
@@ -68,7 +68,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);
}
@@ -83,7 +83,7 @@ MERCHANT_DB_disconnect (PGconn *conn)
* @return GNUNET_OK upon success; GNUNET_SYSERR upon failure
*/
int
-MERCHANT_DB_initialize (PGconn *conn, int tmp)
+TALER_MERCHANTDB_initialize (PGconn *conn, int tmp)
{
const char *tmp_str = (1 == tmp) ? "TEMPORARY" : "";
char *sql;
@@ -264,7 +264,7 @@ MERCHANT_DB_initialize (PGconn *conn, int tmp)
* @return #GNUNET_OK if successful, #GNUNET_SYSERR upon errors
*/
uint32_t
-MERCHANT_DB_update_deposit_permission (PGconn *conn,
+TALER_MERCHANTDB_deposit_permission_update (PGconn *conn,
uint64_t transaction_id,
unsigned int pending)
{
@@ -299,6 +299,7 @@ MERCHANT_DB_update_deposit_permission (PGconn *conn,
PQclear (res);
return GNUNET_SYSERR;
}
+ return GNUNET_OK;
}
@@ -315,7 +316,7 @@ MERCHANT_DB_update_deposit_permission (PGconn *conn,
* @return #GNUNET_OK if successful, #GNUNET_SYSERR upon errors
*/
uint32_t
-MERCHANT_DB_store_deposit_permission (PGconn *conn,
+TALER_MERCHANTDB_deposit_permission_store (PGconn *conn,
const char *deposit_permission,
uint64_t transaction_id,
unsigned int pending,
@@ -390,7 +391,7 @@ MERCHANT_DB_store_deposit_permission (PGconn *conn,
* already inserted @a c_id, #GNUNET_SYSERR for other errors.
*/
uint32_t
-MERCHANT_DB_contract_create (PGconn *conn,
+TALER_MERCHANTDB_contract_create (PGconn *conn,
const struct GNUNET_TIME_Absolute timestamp,
const struct GNUNET_TIME_Absolute expiry,
struct GNUNET_TIME_Absolute edate,
@@ -428,7 +429,7 @@ MERCHANT_DB_contract_create (PGconn *conn,
TALER_PQ_query_param_end
};
- /* NOTE: the statement is prepared by MERCHANT_DB_initialize function */
+ /* NOTE: the statement is prepared by TALER_MERCHANTDB_initialize function */
res = TALER_PQ_exec_prepared (conn, "contract_create", params);
status = PQresultStatus (res);
@@ -465,7 +466,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;
@@ -496,7 +497,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_rsa_PublicKey *coin_pub,
uint64_t transaction_id,
struct TALER_Amount *amount,
@@ -531,7 +532,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_rsa_PublicKey *coin_pub)
{
PGresult *res;
@@ -578,7 +579,7 @@ MERCHANT_DB_get_checkout_product (PGconn *conn,
* @return #GNUNET_OK on success, #GNUNET_SYSERR upon errors
*/
uint32_t
-MERCHANT_DB_get_contract_values (PGconn *conn,
+TALER_MERCHANTDB_contract_get_values (PGconn *conn,
const struct GNUNET_HashCode *h_contract,
uint64_t *nounce,
struct GNUNET_TIME_Absolute *edate)
@@ -627,11 +628,11 @@ MERCHANT_DB_get_contract_values (PGconn *conn,
* upon errors
*/
uint32_t
-MERCHANT_DB_get_contract_handle (PGconn *conn,
+TALER_MERCHANTDB_contract_get_handle (PGconn *conn,
const struct GNUNET_HashCode *h_contract,
- struct MERCHANT_contract_handle *contract_handle)
+ struct TALER_MERCHANTDB_ContractHandle *contract_handle)
{
- struct MERCHANT_contract_handle ch;
+ struct TALER_MERCHANTDB_ContractHandle ch;
PGresult *res;
ExecStatusType status;
diff --git a/src/include/platform.h b/src/include/platform.h
index 4cba7abf..6e4baec6 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -18,7 +18,7 @@
* @file include/platform.h
* @brief This file contains the includes and definitions which are used by the
* rest of the modules
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#ifndef PLATFORM_H_
@@ -28,7 +28,7 @@
#ifndef HAVE_USED_CONFIG_H
# define HAVE_USED_CONFIG_H
# ifdef HAVE_CONFIG_H
-# include "taler_config.h"
+# include "taler_merchant_config.h"
# endif
#endif
diff --git a/src/include/taler_merchantdb_lib.h b/src/include/taler_merchantdb_lib.h
index f650a8aa..fe5adffc 100644
--- a/src/include/taler_merchantdb_lib.h
+++ b/src/include/taler_merchantdb_lib.h
@@ -30,7 +30,7 @@
/* Set of values that represent a contract. To be expanded on an
as-needed basis */
-struct MERCHANT_contract_handle
+struct TALER_MERCHANTDB_ContractHandle
{
/* The nounce used when hashing the wire details
for this contract */
@@ -59,7 +59,7 @@ struct MERCHANT_contract_handle
* @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);
/**
@@ -68,7 +68,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);
/**
@@ -80,7 +80,7 @@ MERCHANT_DB_disconnect (PGconn *conn);
* @return GNUNET_OK upon success; GNUNET_SYSERR upon failure
*/
int
-MERCHANT_DB_initialize (PGconn *conn, int tmp);
+TALER_MERCHANTDB_initialize (PGconn *conn, int tmp);
/**
@@ -102,7 +102,7 @@ MERCHANT_DB_initialize (PGconn *conn, int tmp);
* @return #GNUNET_OK on success, #GNUNET_SYSERR upon error
*/
uint32_t
-MERCHANT_DB_contract_create (PGconn *conn,
+TALER_MERCHANTDB_contract_create (PGconn *conn,
const struct GNUNET_TIME_Absolute timestamp,
const struct GNUNET_TIME_Absolute expiry,
struct GNUNET_TIME_Absolute edate,
@@ -116,7 +116,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);
@@ -131,12 +131,12 @@ MERCHANT_DB_get_contract_product (PGconn *conn,
* @return #GNUNET_OK if successful, #GNUNET_SYSERR upon errors
*/
uint32_t
-MERCHANT_DB_update_deposit_permission (PGconn *conn,
+TALER_MERCHANTDB_deposit_permission_update (PGconn *conn,
uint64_t transaction_id,
unsigned int pending);
unsigned int
-MERCHANT_DB_checkout_create (PGconn *conn,
+TALER_MERCHANTDB_checkout_create (PGconn *conn,
struct GNUNET_CRYPTO_rsa_PublicKey *coin_pub,
uint64_t transaction_id,
struct TALER_Amount *amount,
@@ -144,7 +144,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_rsa_PublicKey *coin_pub);
/**
@@ -159,7 +159,7 @@ MERCHANT_DB_get_checkout_product (PGconn *conn,
* @return #GNUNET_OK on success, #GNUNET_SYSERR upon errors
*/
uint32_t
-MERCHANT_DB_get_contract_values (PGconn *conn,
+TALER_MERCHANTDB_contract_get_values (PGconn *conn,
const struct GNUNET_HashCode *h_contract,
uint64_t *nounce,
struct GNUNET_TIME_Absolute *edate);
@@ -176,9 +176,9 @@ MERCHANT_DB_get_contract_values (PGconn *conn,
* upon errors
*/
uint32_t
-MERCHANT_DB_get_contract_handle (PGconn *conn,
+TALER_MERCHANTDB_contract_get_handle (PGconn *conn,
const struct GNUNET_HashCode *h_contract,
- struct MERCHANT_contract_handle *contract_handle);
+ struct TALER_MERCHANTDB_ContractHandle *contract_handle);
/**
* Store a deposit permission in DB. To be mainly used if /deposit should
@@ -192,7 +192,7 @@ MERCHANT_DB_get_contract_handle (PGconn *conn,
* @return #GNUNET_OK if successful, #GNUNET_SYSERR upon errors
*/
uint32_t
-MERCHANT_DB_store_deposit_permission (PGconn *conn,
+TALER_MERCHANTDB_deposit_permission_store (PGconn *conn,
const char *deposit_permission,
uint64_t transaction_id,
unsigned int pending,
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;
diff --git a/src/tests/test_contract.c b/src/tests/test_contract.c
index 147ea4f3..68572a38 100644
--- a/src/tests/test_contract.c
+++ b/src/tests/test_contract.c
@@ -54,13 +54,13 @@ 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;
}
}
extern uint32_t
-MERCHANT_DB_get_contract_values (PGconn *conn,
+TALER_MERCHANTDB_contract_get_values (PGconn *conn,
const struct GNUNET_HashCode *h_contract,
uint64_t *nounce,
struct GNUNET_TIME_Absolute *edate);
@@ -116,8 +116,8 @@ run (void *cls, char *const *args, const char *cfgfile,
wire = NULL;
- db_conn = MERCHANT_DB_connect (config);
- if (GNUNET_OK != MERCHANT_DB_initialize (db_conn, GNUNET_NO))
+ db_conn = TALER_MERCHANTDB_connect (config);
+ if (GNUNET_OK != TALER_MERCHANTDB_initialize (db_conn, GNUNET_NO))
{
printf ("no db init'd\n");
result = GNUNET_SYSERR;
@@ -293,7 +293,7 @@ run (void *cls, char *const *args, const char *cfgfile,
printf ("contract string : %s\n", aa);
GNUNET_CRYPTO_hash (aa, strlen (aa) + 1, &h_contract_str);
- if (GNUNET_SYSERR == MERCHANT_DB_get_contract_values (db_conn, &h_contract_str, &nounce, &edate))
+ if (GNUNET_SYSERR == TALER_MERCHANTDB_contract_get_values (db_conn, &h_contract_str, &nounce, &edate))
printf ("no hash found\n");
else
{