summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-19 12:55:56 +0100
committerChristian Grothoff <christian@grothoff.org>2022-01-19 12:55:56 +0100
commit16bb30ce4b424fa5ada004c53721a6f3f202b538 (patch)
tree1e25885759a5b19201c972b023726dfc40c123ef /src/include
parentfbf87011b5129a44e2494758effc7bd6716d6d3b (diff)
downloadanastasis-16bb30ce4b424fa5ada004c53721a6f3f202b538.tar.gz
anastasis-16bb30ce4b424fa5ada004c53721a6f3f202b538.tar.bz2
anastasis-16bb30ce4b424fa5ada004c53721a6f3f202b538.zip
add meta handler and client implementation
Diffstat (limited to 'src/include')
-rw-r--r--src/include/anastasis_crypto_lib.h6
-rw-r--r--src/include/anastasis_service.h90
2 files changed, 94 insertions, 2 deletions
diff --git a/src/include/anastasis_crypto_lib.h b/src/include/anastasis_crypto_lib.h
index 780fb34..c28b83a 100644
--- a/src/include/anastasis_crypto_lib.h
+++ b/src/include/anastasis_crypto_lib.h
@@ -41,6 +41,12 @@
"Anastasis-Truth-Decryption-Key"
/**
+ * Client to server: please store this meta data.
+ */
+#define ANASTASIS_HTTP_HEADER_POLICY_META_DATA "Anastasis-Policy-Meta-Data"
+
+
+/**
* Client to server: I paid using this payment secret.
*/
#define ANASTASIS_HTTP_HEADER_PAYMENT_IDENTIFIER "Anastasis-Payment-Identifier"
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index 0ef31d6..5a8ca21 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -156,6 +156,93 @@ ANASTASIS_config_cancel (struct ANASTASIS_ConfigOperation *co);
/**
+ * Detailed meta data result.
+ */
+struct ANASTASIS_MetaDataEntry
+{
+
+ /**
+ * The encrypted meta data we downloaded.
+ */
+ const void *meta_data;
+
+ /**
+ * Number of bytes in @e meta_data.
+ */
+ size_t meta_data_size;
+
+ /**
+ * Policy version this @e meta_data is for.
+ */
+ uint32_t version;
+};
+
+
+/**
+ * Detailed results for meta data download.
+ */
+struct ANASTASIS_MetaDownloadDetails
+{
+
+ /**
+ * Version-sorted array of meta data we downloaded.
+ */
+ const struct ANASTASIS_MetaDataEntry *metas;
+
+ /**
+ * Number of entries in @e metas.
+ */
+ unsigned int metas_length;
+
+};
+
+
+/**
+ * Callback to process a GET /policy/$POL/meta request
+ *
+ * @param cls closure
+ * @param http_status HTTP status code for this request
+ * @param dd the response details
+ */
+typedef void
+(*ANASTASIS_PolicyMetaLookupCallback) (
+ void *cls,
+ unsigned int http_status,
+ const struct ANASTASIS_MetaDownloadDetails *dd);
+
+
+/**
+ * Does a GET /policy/$POL/meta.
+ *
+ * @param ctx execution context
+ * @param backend_url base URL of the merchant backend
+ * @param anastasis_pub public key of the user's account
+ * @param max_version maximum version number to fetch
+ * @param cb callback which will work the response gotten from the backend
+ * @param cb_cls closure to pass to the callback
+ * @return handle for this operation, NULL upon errors
+ */
+struct ANASTASIS_PolicyMetaLookupOperation *
+ANASTASIS_policy_meta_lookup (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
+ uint32_t max_version,
+ ANASTASIS_PolicyMetaLookupCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel a GET /policy/$POL/meta request.
+ *
+ * @param plo cancel the policy lookup operation
+ */
+void
+ANASTASIS_policy_meta_lookup_cancel (
+ struct ANASTASIS_PolicyMetaLookupOperation *plo);
+
+
+/**
* Detailed results from the successful download.
*/
struct ANASTASIS_DownloadDetails
@@ -198,8 +285,7 @@ struct ANASTASIS_PolicyLookupOperation;
*
* @param cls closure
* @param http_status HTTP status code for this request
- * @param ec anastasis-specific error code
- * @param obj the response body
+ * @param dd the response details
*/
typedef void
(*ANASTASIS_PolicyLookupCallback) (void *cls,