summaryrefslogtreecommitdiff
path: root/src/include/taler_json_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2021-07-26 17:25:53 +0200
committerChristian Grothoff <grothoff@gnunet.org>2021-07-26 17:26:09 +0200
commit91bb5623de1586912d323bf4dfd19c02d2a376d6 (patch)
tree0ed1cd99d433e776d063b82fde1e0306d70407f2 /src/include/taler_json_lib.h
parent8951c9debef86f2c462f99b8ec37681f51fa8dd1 (diff)
downloadexchange-91bb5623de1586912d323bf4dfd19c02d2a376d6.tar.gz
exchange-91bb5623de1586912d323bf4dfd19c02d2a376d6.tar.bz2
exchange-91bb5623de1586912d323bf4dfd19c02d2a376d6.zip
JSON: implement taler-specific json pack functions
Diffstat (limited to 'src/include/taler_json_lib.h')
-rw-r--r--src/include/taler_json_lib.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index 1089f5bdf..4ed259b21 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -37,6 +37,117 @@
"JSON parsing failed at %s:%u: %s (%s)\n", \
__FILE__, __LINE__, error.text, error.source)
+
+/**
+ * Generate packer instruction for a JSON field of type
+ * absolute time.
+ * The absolute time value is expected to be already rounded.
+ *
+ * @param name name of the field to add to the object
+ * @param at absolute time to pack
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_time_abs (const char *name,
+ struct GNUNET_TIME_Absolute at);
+
+
+/**
+ * Generate packer instruction for a JSON field of type
+ * absolute time in network byte order.
+ * The absolute time value is expected to be already rounded.
+ *
+ * @param name name of the field to add to the object
+ * @param at absolute time to pack
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_time_abs_nbo (const char *name,
+ struct GNUNET_TIME_AbsoluteNBO at);
+
+
+/**
+ * Generate packer instruction for a JSON field of type
+ * relative time.
+ * The relative time value is expected to be already rounded.
+ *
+ * @param name name of the field to add to the object
+ * @param rt relative time to pack
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_time_rel (const char *name,
+ struct GNUNET_TIME_Relative rt);
+
+
+/**
+ * Generate packer instruction for a JSON field of type
+ * relative time in network byte order.
+ * The relative time value is expected to be already rounded.
+ *
+ * @param name name of the field to add to the object
+ * @param rt relative time to pack
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_time_rel_nbo (const char *name,
+ struct GNUNET_TIME_RelativeNBO rt);
+
+
+/**
+ * Generate packer instruction for a JSON field of type
+ * denomination public key.
+ *
+ * @param name name of the field to add to the object
+ * @param pk public key
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_denomination_public_key (const char *name,
+ const struct
+ TALER_DenominationPublicKey *pk);
+
+
+/**
+ * Generate packer instruction for a JSON field of type
+ * denomination signature.
+ *
+ * @param name name of the field to add to the object
+ * @param sig signature
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_denomination_signature (const char *name,
+ const struct
+ TALER_DenominationSignature *sig);
+
+
+/**
+ * Generate packer instruction for a JSON field of type
+ * amount.
+ *
+ * @param name name of the field to add to the object
+ * @param amount valid amount to pack
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_amount (const char *name,
+ const struct TALER_Amount *amount);
+
+
+/**
+ * Generate packer instruction for a JSON field of type
+ * amount.
+ *
+ * @param name name of the field to add to the object
+ * @param amount valid amount to pack
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_amount_nbo (const char *name,
+ const struct TALER_AmountNBO *amount);
+
+
/**
* Convert a TALER amount to a JSON object.
*