diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-11-25 13:38:54 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-11-25 13:38:54 +0100 |
commit | 8e8e59917a09298f0e8d46884a93bef14c2ae98b (patch) | |
tree | 8c952f44255f8f87f18399a6431568b3124c0d6e /src/backend | |
parent | 0a073f8bf4b6611c4436d093deef7631c643f5bf (diff) | |
download | merchant-8e8e59917a09298f0e8d46884a93bef14c2ae98b.tar.gz merchant-8e8e59917a09298f0e8d46884a93bef14c2ae98b.tar.bz2 merchant-8e8e59917a09298f0e8d46884a93bef14c2ae98b.zip |
rename fest to satisfy naming conventions
Diffstat (limited to 'src/backend')
15 files changed, 106 insertions, 170 deletions
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 |