summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2023-11-25 15:04:44 +0900
committerChristian Grothoff <grothoff@gnunet.org>2023-11-25 15:04:44 +0900
commit9a4407f7a58af8cfe208436152fa32233a5ca0b3 (patch)
treeaeef9137133ab3bc3e0fd545b9b428f17e0286c5 /src/include
parentbaa070d19cda046cb0349e85a9a8aabcd9f52661 (diff)
downloadexchange-9a4407f7a58af8cfe208436152fa32233a5ca0b3.tar.gz
exchange-9a4407f7a58af8cfe208436152fa32233a5ca0b3.tar.bz2
exchange-9a4407f7a58af8cfe208436152fa32233a5ca0b3.zip
more strict spec parsers for payto URIs, Web URLs, and AML decision states
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_crypto_lib.h6
-rw-r--r--src/include/taler_exchange_service.h2
-rw-r--r--src/include/taler_json_lib.h100
-rw-r--r--src/include/taler_util.h11
4 files changed, 113 insertions, 6 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 2089d77a0..0d3935238 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -69,8 +69,12 @@ enum TALER_AmlDecisionState
/**
* An AML decision has concluded that the funds must be frozen.
*/
- TALER_AML_FROZEN = 2
+ TALER_AML_FROZEN = 2,
+ /**
+ * Maximum allowed numeric value for AML status.
+ */
+ TALER_AML_MAX = 2
};
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index d2bf918da..7b9b1dd41 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -2075,7 +2075,7 @@ struct TALER_EXCHANGE_ReserveHistoryEntry
struct
{
/**
- * Receiver account information for the outgoing wire transfer.
+ * Receiver account information for the outgoing wire transfer as a payto://-URI.
*/
const char *receiver_account_details;
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index 1a1466700..dc8061705 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -355,6 +355,98 @@ struct GNUNET_JSON_Specification
TALER_JSON_spec_denom_pub (const char *field,
struct TALER_DenominationPublicKey *pk);
+
+/**
+ * Generate line in parser specification for error codes.
+ *
+ * @param field name of the field
+ * @param[out] ec error code to initialize
+ * @return corresponding field spec
+ */
+struct GNUNET_JSON_Specification
+TALER_JSON_spec_ec (const char *field,
+ enum TALER_ErrorCode *ec);
+
+
+/**
+ * Generate line in parser specification for
+ * HTTP/HTTPS URLs.
+ *
+ * @param field name of the field
+ * @param[out] url web URL to initialize
+ * @return corresponding field spec
+ */
+struct GNUNET_JSON_Specification
+TALER_JSON_spec_web_url (const char *field,
+ const char **url);
+
+
+/**
+ * Generate line in parser specification for
+ * "payto://" URIs.
+ *
+ * @param field name of the field
+ * @param[out] payto_uri RFC 8905 URI to initialize
+ * @return corresponding field spec
+ */
+struct GNUNET_JSON_Specification
+TALER_JSON_spec_payto_uri (const char *field,
+ const char **payto_uri);
+
+
+/**
+ * Generate line in parser specification for AML decision states.
+ *
+ * @param field name of the field
+ * @param[out] aml_state AML state to initialize
+ * @return corresponding field spec
+ */
+struct GNUNET_JSON_Specification
+TALER_JSON_spec_aml_decision (const char *field,
+ enum TALER_AmlDecisionState *aml_state);
+
+
+/**
+ * Representation of a protocol version.
+ */
+struct TALER_JSON_ProtocolVersion
+{
+ /**
+ * Current version of the protocol.
+ */
+ unsigned int current;
+
+ /**
+ * Implementation revision for the @e current
+ * version.
+ */
+ unsigned int revision;
+
+ /**
+ * Number of protocol versions this @e revision is
+ * backwards-compatible with. Subtract this number
+ * from @a current to get the minimum protocol version
+ * required from the client.
+ */
+ unsigned int age;
+};
+
+
+/**
+ * Generate line in parser specification for protocol
+ * versions (``/config``). The field must be a string
+ * encoding the version as "$CURRENT:$REVISION:$AGE".
+ *
+ * @param field name of the field (usually "version")
+ * @param[out] current protocol current to initialize
+ * @param[out] revision protocol revision to initialize
+ * @param[out] age protocol age to initialize
+ * @return corresponding field spec
+ */
+struct GNUNET_JSON_Specification
+TALER_JSON_spec_version (const char *field,
+ struct TALER_JSON_ProtocolVersion *ver);
+
/**
* Generate a parser specification for a denomination public key of a given
* cipher.
@@ -365,10 +457,10 @@ TALER_JSON_spec_denom_pub (const char *field,
* @return corresponding field spec
*/
struct GNUNET_JSON_Specification
-TALER_JSON_spec_denom_pub_cipher (const char *field,
- enum GNUNET_CRYPTO_BlindSignatureAlgorithm
- cipher,
- struct TALER_DenominationPublicKey *pk);
+TALER_JSON_spec_denom_pub_cipher (
+ const char *field,
+ enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher,
+ struct TALER_DenominationPublicKey *pk);
/**
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index 19dc84fc0..7c2cc6880 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -367,6 +367,17 @@ TALER_url_valid_charset (const char *url);
/**
+ * Test if the URL is a valid "http" (or "https")
+ * URL (includes test for #TALER_url_valid_charset()).
+ *
+ * @param url a string to test if it could be a valid URL
+ * @return true if @a url is well-formed
+ */
+bool
+TALER_is_web_url (const char *url);
+
+
+/**
* Check if @a lang matches the @a language_pattern, and if so with
* which preference.
* See also: https://tools.ietf.org/html/rfc7231#section-5.3.1