diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-03-01 16:16:36 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-03-01 16:16:36 +0100 |
commit | 94059c0329921b422b1c7f27d946b0f550fe7978 (patch) | |
tree | cd4adc78a6d0687b5b6f12512184a9db1cc2d5aa /src/backend/taler-merchant-httpd_exchanges.h | |
parent | 281d39c6afbd4133ab1f13acd0915276f45a9b57 (diff) |
mint->exchange renaming
Diffstat (limited to 'src/backend/taler-merchant-httpd_exchanges.h')
-rw-r--r-- | src/backend/taler-merchant-httpd_exchanges.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd_exchanges.h b/src/backend/taler-merchant-httpd_exchanges.h new file mode 100644 index 00000000..6612f4f4 --- /dev/null +++ b/src/backend/taler-merchant-httpd_exchanges.h @@ -0,0 +1,105 @@ +/* + This file is part of TALER + (C) 2014, 2015 GNUnet e.V. + + 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 backend/taler-merchant-httpd_exchanges.h + * @brief logic this HTTPD keeps for each exchange we interact with + * @author Marcello Stanisci + * @author Christian Grothoff + */ +#ifndef TALER_MERCHANT_HTTPD_EXCHANGES_H +#define TALER_MERCHANT_HTTPD_EXCHANGES_H + +#include <jansson.h> +#include <gnunet/gnunet_util_lib.h> +#include <curl/curl.h> +#include <taler/taler_util.h> +#include <taler/taler_exchange_service.h> +#include "taler-merchant-httpd.h" + + +/** + * List of our trusted exchanges in JSON format for inclusion in contracts. + */ +extern json_t *trusted_exchanges; + + +/** + * Parses "trusted" exchanges listed in the configuration. + * + * @param cfg the configuration + * @return #GNUNET_OK on success; #GNUNET_SYSERR upon error in + * parsing or initialization. + */ +int +TMH_EXCHANGES_init (const struct GNUNET_CONFIGURATION_Handle *cfg); + + +/** + * Function called to shutdown the exchanges subsystem. + */ +void +TMH_EXCHANGES_done (void); + + +/** + * Function called with the result of a #TMH_EXCHANGES_find_exchange() + * operation. + * + * @param cls closure + * @param mh handle to the exchange context + * @param exchange_trusted #GNUNET_YES if this exchange is trusted by config + */ +typedef void +(*TMH_EXCHANGES_FindContinuation)(void *cls, + struct TALER_EXCHANGE_Handle *mh, + int exchange_trusted); + + +/** + * Information we keep for a pending #MMH_EXCHANGES_find_exchange() operation. + */ +struct TMH_EXCHANGES_FindOperation; + + +/** + * Find a exchange that matches @a chosen_exchange. If we cannot connect + * to the exchange, or if it is not acceptable, @a fc is called with + * NULL for the exchange. + * + * @param chosen_exchange URI of the exchange we would like to talk to + * @param fc function to call with the handles for the exchange + * @param fc_cls closure for @a fc + * + * FIXME: should probably return a value to *cancel* the + * operation in case MHD connection goes down and needs to + * free fc_cls. + */ +struct TMH_EXCHANGES_FindOperation * +TMH_EXCHANGES_find_exchange (const char *chosen_exchange, + TMH_EXCHANGES_FindContinuation fc, + void *fc_cls); + + +/** + * Abort pending find operation. + * + * @param fo handle to operation to abort + */ +void +TMH_EXCHANGES_find_exchange_cancel (struct TMH_EXCHANGES_FindOperation *fo); + + +#endif |