summaryrefslogtreecommitdiff
path: root/src/include/taler_pq_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-05-07 13:59:56 +0200
committerChristian Grothoff <christian@grothoff.org>2015-05-07 13:59:56 +0200
commit17055134a3df2c9d84aec69b1da1cb3c273a55fb (patch)
tree3f121578947eb48148b35ab69a8f8505f899c57f /src/include/taler_pq_lib.h
parente2fb24f0a9ba8caf2f3e9cb628f842846b7e00ef (diff)
downloadexchange-17055134a3df2c9d84aec69b1da1cb3c273a55fb.tar.gz
exchange-17055134a3df2c9d84aec69b1da1cb3c273a55fb.tar.bz2
exchange-17055134a3df2c9d84aec69b1da1cb3c273a55fb.zip
extend PQ library to support Absolute time values
Diffstat (limited to 'src/include/taler_pq_lib.h')
-rw-r--r--src/include/taler_pq_lib.h37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h
index ba9de3079..b826ae26a 100644
--- a/src/include/taler_pq_lib.h
+++ b/src/include/taler_pq_lib.h
@@ -69,7 +69,13 @@ enum TALER_PQ_QueryFormat
* We have an RSA signature.
* Data points to a `struct GNUNET_CRYPTO_rsa_Signature`, size is not used.
*/
- TALER_PQ_QF_RSA_SIGNATURE
+ TALER_PQ_QF_RSA_SIGNATURE,
+
+ /**
+ * We have an absolute time.
+ * Data points to a `struct GNUNET_TIME_Absolute`, size is only used to check.
+ */
+ TALER_PQ_QF_TIME_ABSOLUTE
};
@@ -164,6 +170,16 @@ struct TALER_PQ_QueryParam
/**
+ * Generate query parameter for an absolute time value.
+ * The database must store a 64-bit integer.
+ *
+ * @param x pointer to the query parameter to pass, must be
+ * a variable of type `struct GNUNET_TIME_Absolute`.
+ */
+#define TALER_PQ_QUERY_PARAM_ABSOLUTE_TIME(x) { TALER_PQ_QF_TIME_ABSOLUTE, &(x), sizeof (x) }
+
+
+/**
* Different formats of results that can be extracted.
*/
enum TALER_PQ_ResultFormat
@@ -206,7 +222,13 @@ enum TALER_PQ_ResultFormat
* We expect an RSA signature.
* Data points to a `struct GNUNET_CRYPTO_rsa_Signature **`, size is not used.
*/
- TALER_PQ_RF_RSA_SIGNATURE
+ TALER_PQ_RF_RSA_SIGNATURE,
+
+ /**
+ * We expect an absolute time.
+ * Data points to a `struct GNUNET_TIME_Absolute`, size is only used for checking.
+ */
+ TALER_PQ_RF_TIME_ABSOLUTE
};
@@ -287,7 +309,7 @@ struct TALER_PQ_ResultSpec
* @param name name of the field in the table
* @param amount a `struct TALER_AmountNBO` where to store the result
*/
-#define TALER_PQ_RESULT_SPEC_AMOUNT_NBO(name, amount) {TALER_PQ_RF_AMOUNT_NBO, (void *) (&dst), sizeof (amount), (name), NULL }
+#define TALER_PQ_RESULT_SPEC_AMOUNT_NBO(name, amount) {TALER_PQ_RF_AMOUNT_NBO, (void *) (&amount), sizeof (amount), (name), NULL }
/**
* Currency amount expected.
@@ -295,7 +317,7 @@ struct TALER_PQ_ResultSpec
* @param name name of the field in the table
* @param amount a `struct TALER_Amount` where to store the result
*/
-#define TALER_PQ_RESULT_SPEC_AMOUNT(name, amount) {TALER_PQ_RF_AMOUNT, (void *) (&dst), sizeof (amount), (name), NULL }
+#define TALER_PQ_RESULT_SPEC_AMOUNT(name, amount) {TALER_PQ_RF_AMOUNT, (void *) (&amount), sizeof (amount), (name), NULL }
/**
* RSA public key expected.
@@ -315,6 +337,13 @@ struct TALER_PQ_ResultSpec
*/
#define TALER_PQ_RESULT_SPEC_RSA_SIGNATURE(name, sig) {TALER_PQ_RF_RSA_SIGNATURE, (void *) &(sig), 0, (name), NULL }
+/**
+ * Absolute time expected.
+ *
+ * @param name name of the field in the table
+ * @param at a `struct GNUNET_TIME_Absolute` where to store the result
+ */
+#define TALER_PQ_RESULT_SPEC_ABSOLUTE_TIME(name,at) {TALER_PQ_RF_TIME_ABSOLUTE, (void *) (&at), sizeof (at), (name), NULL }
/**