summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-01-13 18:16:01 +0100
committerChristian Grothoff <christian@grothoff.org>2020-01-13 18:16:01 +0100
commit4d6ef1da29e5c1bf4c2216d9fe0c14dcab0f04cd (patch)
tree8141db7f726c59d21a81fe37846970237a75d892 /src/include
parent258ed8617bdcad9f1c278a5fdcff97bcf2e29e54 (diff)
downloadexchange-4d6ef1da29e5c1bf4c2216d9fe0c14dcab0f04cd.tar.gz
exchange-4d6ef1da29e5c1bf4c2216d9fe0c14dcab0f04cd.tar.bz2
exchange-4d6ef1da29e5c1bf4c2216d9fe0c14dcab0f04cd.zip
eliminate libtalerwire
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am1
-rw-r--r--src/include/taler_amount_lib.h12
-rw-r--r--src/include/taler_bank_service.h100
-rw-r--r--src/include/taler_crypto_lib.h8
-rw-r--r--src/include/taler_util.h10
-rw-r--r--src/include/taler_wire_lib.h124
6 files changed, 128 insertions, 127 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 39e2c3f58..b1068d5d7 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -27,7 +27,6 @@ talerinclude_HEADERS = \
taler_json_lib.h \
taler_testing_auditor_lib.h \
taler_testing_lib.h \
- taler_wire_lib.h \
taler_util.h \
taler_mhd_lib.h \
taler_pq_lib.h \
diff --git a/src/include/taler_amount_lib.h b/src/include/taler_amount_lib.h
index ef323f83b..37f42bd99 100644
--- a/src/include/taler_amount_lib.h
+++ b/src/include/taler_amount_lib.h
@@ -309,6 +309,18 @@ const char *
TALER_amount2s (const struct TALER_Amount *amount);
+/**
+ * Round the amount to something that can be
+ * transferred on the wire.
+ *
+ * @param[in,out] amount amount to round down
+ * @return #GNUNET_OK on success, #GNUNET_NO if rounding was unnecessary,
+ * #GNUNET_SYSERR if the amount or currency was invalid
+ */
+int
+TALER_amount_round (struct TALER_Amount *amount);
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h
index 08b29ed11..f52d095d4 100644
--- a/src/include/taler_bank_service.h
+++ b/src/include/taler_bank_service.h
@@ -85,6 +85,83 @@ struct TALER_BANK_AuthenticationData
};
+/**
+ * Different account types supported by payto://.
+ */
+enum TALER_PaytoAccountType
+{
+
+ /**
+ * Used to indicate an uninitialized struct.
+ */
+ TALER_PAC_NONE = 0,
+
+ /**
+ * Account type of a bank running the x-taler-bank protocol.
+ */
+ TALER_PAC_X_TALER_BANK,
+
+ /**
+ * Account identified by IBAN number.
+ */
+ TALER_PAC_IBAN
+};
+
+
+/**
+ * Information about an account extracted from a payto://-URL.
+ */
+struct TALER_Account
+{
+
+ /**
+ * How this the account represented.
+ */
+ enum TALER_PaytoAccountType type;
+
+ /**
+ * Internals depending on @e type.
+ */
+ union
+ {
+
+ /**
+ * Taler bank address from x-taler-bank. Set if
+ * @e type is #TALER_AC_X_TALER_BANK.
+ */
+ struct
+ {
+
+ /**
+ * Bank account base URL.
+ */
+ char *account_base_url;
+
+ /**
+ * Only the hostname of the bank.
+ */
+ char *hostname;
+
+ } x_taler_bank;
+
+ /**
+ * Taler bank address from iban. Set if
+ * @e type is #TALER_AC_IBAN.
+ */
+ struct
+ {
+
+ /**
+ * IBAN number.
+ */
+ char *number;
+
+ } iban;
+
+ } details;
+};
+
+
/* ********************* /admin/add/incoming *********************** */
@@ -447,6 +524,8 @@ void
TALER_BANK_debit_history_cancel (struct TALER_BANK_DebitHistoryHandle *hh);
+/* ******************** Convenience functions **************** */
+
/**
* Convenience method for parsing configuration section with bank account data.
*
@@ -460,6 +539,26 @@ TALER_BANK_account_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section,
struct TALER_Account *acc);
+/**
+ * Release memory allocated in @a acc.
+ *
+ * @param acc account to free, the pointer itself is NOT free'd.
+ */
+void
+TALER_BANK_account_free (struct TALER_Account *acc);
+
+
+/**
+ * Parse @a payto_url and store the result in @a acc
+ *
+ * @param payto_url URL to parse
+ * @param acc[in,out] account to initialize, free using #TALER_BANK_account_free() later
+ * @return #TALER_EC_NONE if @a payto_url is well-formed
+ */
+enum TALER_ErrorCode
+TALER_BANK_payto_to_account (const char *payto_url,
+ struct TALER_Account *acc);
+
/**
* Convenience method for parsing configuration section with bank
@@ -486,4 +585,5 @@ TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
void
TALER_BANK_auth_free (struct TALER_BANK_AuthenticationData *auth);
+
#endif /* _TALER_BANK_SERVICE_H */
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 81ea0bb95..f8dc1e665 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -510,12 +510,12 @@ struct TALER_TransferSecretP
* Length of the raw value in the Taler wire transfer identifier
* (in binary representation).
*/
-#define TALER_WIRE_TRANSFER_IDENTIFIER_LEN 32
+#define TALER_BANK_TRANSFER_IDENTIFIER_LEN 32
/**
- * #TALER_WIRE_TRANSFER_IDENTIFIER_LEN as a string.
+ * #TALER_BANK_TRANSFER_IDENTIFIER_LEN as a string.
*/
-#define TALER_WIRE_TRANSFER_IDENTIFIER_LEN_STR "32"
+#define TALER_BANK_TRANSFER_IDENTIFIER_LEN_STR "32"
/**
@@ -536,7 +536,7 @@ struct TALER_WireTransferIdentifierRawP
* encode the actual value (i.e. a 256-bit / 32-byte public key or
* a hash code), and the last byte for a minimalistic checksum.
*/
- uint8_t raw[TALER_WIRE_TRANSFER_IDENTIFIER_LEN];
+ uint8_t raw[TALER_BANK_TRANSFER_IDENTIFIER_LEN];
};
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index e1b42f134..105dba61a 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -381,4 +381,14 @@ TALER_url_absolute_mhd (struct MHD_Connection *connection,
...);
+/**
+ * Obtain the payment method from a @a payto_url
+ *
+ * @param payto_url the URL to parse
+ * @return NULL on error (malformed @a payto_url)
+ */
+char *
+TALER_payto_get_method (const char *payto_url);
+
+
#endif
diff --git a/src/include/taler_wire_lib.h b/src/include/taler_wire_lib.h
index c7d9f78d8..02a3d91c9 100644
--- a/src/include/taler_wire_lib.h
+++ b/src/include/taler_wire_lib.h
@@ -18,130 +18,10 @@
* @brief Interface for loading and unloading wire plugins
* @author Christian Grothoff <christian@grothoff.org>
*/
-#ifndef TALER_WIRE_H
-#define TALER_WIRE_H
+#ifndef TALER_BANK_H
+#define TALER_BANK_H
#include <gnunet/gnunet_util_lib.h>
-/**
- * Different account types supported by payto://.
- */
-enum TALER_PaytoAccountType
-{
-
- /**
- * Used to indicate an uninitialized struct.
- */
- TALER_PAC_NONE = 0,
-
- /**
- * Account type of a bank running the x-taler-bank protocol.
- */
- TALER_PAC_X_TALER_BANK,
-
- /**
- * Account identified by IBAN number.
- */
- TALER_PAC_IBAN
-};
-
-
-/**
- * Information about an account extracted from a payto://-URL.
- */
-struct TALER_Account
-{
-
- /**
- * How this the account represented.
- */
- enum TALER_PaytoAccountType type;
-
- /**
- * Internals depending on @e type.
- */
- union
- {
-
- /**
- * Taler bank address from x-taler-bank. Set if
- * @e type is #TALER_AC_X_TALER_BANK.
- */
- struct
- {
-
- /**
- * Bank account base URL.
- */
- char *account_base_url;
-
- /**
- * Only the hostname of the bank.
- */
- char *hostname;
-
- } x_taler_bank;
-
- /**
- * Taler bank address from iban. Set if
- * @e type is #TALER_AC_IBAN.
- */
- struct
- {
-
- /**
- * IBAN number.
- */
- char *number;
-
- } iban;
-
- } details;
-};
-
-
-/**
- * Release memory allocated in @a acc.
- *
- * @param acc account to free, the pointer itself is NOT free'd.
- */
-void
-TALER_WIRE_account_free (struct TALER_Account *acc);
-
-
-/**
- * Round the amount to something that can be
- * transferred on the wire.
- *
- * @param[in,out] amount amount to round down
- * @return #GNUNET_OK on success, #GNUNET_NO if rounding was unnecessary,
- * #GNUNET_SYSERR if the amount or currency was invalid
- */
-int
-TALER_WIRE_amount_round (struct TALER_Amount *amount);
-
-
-/**
- * Parse @a payto_url and store the result in @a acc
- *
- * @param payto_url URL to parse
- * @param acc[in,out] account to initialize, free using #TALER_WIRE_account_free() later
- * @return #TALER_EC_NONE if @a payto_url is well-formed
- */
-enum TALER_ErrorCode
-TALER_WIRE_payto_to_account (const char *payto_url,
- struct TALER_Account *acc);
-
-
-/**
- * Obtain the payment method from a @a payto_url
- *
- * @param payto_url the URL to parse
- * @return NULL on error (malformed @a payto_url)
- */
-char *
-TALER_WIRE_payto_get_method (const char *payto_url);
-
-
#endif