diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-07-13 23:07:50 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-07-13 23:08:23 +0200 |
commit | 86f9c6823ec9d92dfbbbc1220655c91b129020cf (patch) | |
tree | c2a21180a3b8350ab4a98644bd359139df150c8c /src/backend/taler-merchant-httpd_exchanges.h | |
parent | 4e45f3a965d5454b136eaf041d5d523f614343d4 (diff) |
merging /keys and /wire API in the exchange
Diffstat (limited to 'src/backend/taler-merchant-httpd_exchanges.h')
-rw-r--r-- | src/backend/taler-merchant-httpd_exchanges.h | 90 |
1 files changed, 35 insertions, 55 deletions
diff --git a/src/backend/taler-merchant-httpd_exchanges.h b/src/backend/taler-merchant-httpd_exchanges.h index 89e5deee..b0f2d879 100644 --- a/src/backend/taler-merchant-httpd_exchanges.h +++ b/src/backend/taler-merchant-httpd_exchanges.h @@ -37,19 +37,6 @@ struct TMH_Exchange; /** - * Return the list of exchanges we would find - * acceptable for a payment given the @a wire_method. - * - * @param wm wire method the payment should be - * made with - * @return list of exchanges we accept for @a wire_method - * (and that would accept our bank account) - */ -json_t * -TMH_exchange_get_acceptable (const struct TMH_WireMethod *wm); - - -/** * Parses "trusted" exchanges listed in the configuration. * * @param cfg the configuration @@ -73,30 +60,13 @@ TMH_EXCHANGES_done (void); * * @param cls closure * @param keys the keys of the exchange + * @param exchange representation of the exchange */ typedef void (*TMH_EXCHANGES_Find2Continuation)( void *cls, - struct TALER_EXCHANGE_Keys *keys); - - -/** - * Abstraction of wire knowledge returned internally. - */ -struct TMH_ExchangeWireDetails; - - -/** - * Function called with the result of a #TMH_EXCHANGES_wire4exchange() - * operation. - * - * @param cls closure - * @param wire the wire data of the exchange - */ -typedef void -(*TMH_EXCHANGES_WireContinuation)( - void *cls, - const struct TMH_ExchangeWireDetails *wire); + struct TALER_EXCHANGE_Keys *keys, + struct TMH_Exchange *exchange); /** @@ -104,22 +74,19 @@ typedef void */ struct TMH_EXCHANGES_KeysOperation; -/** - * Information we keep for a pending #MMH_EXCHANGES_wire4exchange() operation. - */ -struct TMH_EXCHANGES_WireOperation; - /** * Get /keys of the given @a exchange. * * @param exchange URL of the exchange we would like to talk to + * @param force_download force /keys download now * @param fc function to call with the handles for the exchange * @param fc_cls closure for @a fc */ struct TMH_EXCHANGES_KeysOperation * TMH_EXCHANGES_keys4exchange ( const char *exchange, + bool force_download, TMH_EXCHANGES_Find2Continuation fc, void *fc_cls); @@ -134,34 +101,47 @@ TMH_EXCHANGES_keys4exchange_cancel (struct TMH_EXCHANGES_KeysOperation *fo); /** - * Get /wire of the given @a exchange. + * Callback on an exchange known to us. Does not warrant + * that the "keys" information is actually available for + * @a exchange. * - * @param exchange URL 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 + * @param cls closure + * @param url base URL of the exchange + * @param exchange internal handle for the exchange */ -struct TMH_EXCHANGES_WireOperation * -TMH_EXCHANGES_wire4exchange ( - const char *exchange, - TMH_EXCHANGES_WireContinuation fc, - void *fc_cls); +typedef void +(*TMH_ExchangeCallback)(void *cls, + const char *url, + const struct TMH_Exchange *exchange); /** - * Abort pending wire details lookup operation. + * Return all trusted exchanges to @a cb. * - * @param fo handle to operation to abort + * @param cb function to call + * @param cb_cls closure for @a cb */ void -TMH_EXCHANGES_wire4exchange_cancel ( - struct TMH_EXCHANGES_WireOperation *fo); +TMH_exchange_get_trusted (TMH_ExchangeCallback cb, + void *cb_cls); +/** + * Return the master public key of the given @a exchange. + * Will be returned from configuration for trusted + * exchanges. + * + * @param exchange exchange to get master public key for + * @return the master public key of @a exchange + */ +const struct TALER_MasterPublicKeyP * +TMH_EXCHANGES_get_master_pub ( + const struct TMH_Exchange *exchange); /** * Lookup current wire fee by @a exchange_url and * @a wire_method. * - * @param wd wire details of the exchange + * @param exchange the exchange to check * @param wire_method wire method to lookup fee by * @param[out] wire_fee set to the wire fee * @return #GNUNET_OK on success @@ -170,7 +150,7 @@ TMH_EXCHANGES_wire4exchange_cancel ( */ enum GNUNET_GenericReturnValue TMH_EXCHANGES_lookup_wire_fee ( - const struct TMH_ExchangeWireDetails *wd, + const struct TMH_Exchange *exchange, const char *wire_method, struct TALER_Amount *wire_fee); @@ -181,13 +161,13 @@ TMH_EXCHANGES_lookup_wire_fee ( * is trusted and that @a ex allows wire transfers * into the account given in @a wm. * - * @param wd the wire details of the exchange to check + * @param exchange the exchange to check * @param wm the wire method to check with * @return #GNUNET_OK if such a debit can happen */ enum GNUNET_GenericReturnValue TMH_exchange_check_debit ( - const struct TMH_ExchangeWireDetails *wd, + const struct TMH_Exchange *exchange, const struct TMH_WireMethod *wm); |