summaryrefslogtreecommitdiff
path: root/src/include/taler_json_lib.h
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/taler_json_lib.h
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/taler_json_lib.h')
-rw-r--r--src/include/taler_json_lib.h100
1 files changed, 96 insertions, 4 deletions
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);
/**