summaryrefslogtreecommitdiff
path: root/src/include/anastasis_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/anastasis_service.h')
-rw-r--r--src/include/anastasis_service.h188
1 files changed, 135 insertions, 53 deletions
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index ba55314..2f30a8b 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -51,51 +51,82 @@ struct ANASTASIS_AuthorizationMethodConfig
*/
struct ANASTASIS_Config
{
- /**
- * Protocol version supported by the server.
- */
- const char *version;
/**
- * Business name of the anastasis provider.
+ * HTTP status returned.
*/
- const char *business_name;
+ unsigned int http_status;
/**
- * Array of authorization methods supported by the server.
+ * Taler-specific error code, #TALER_EC_NONE on success.
*/
- const struct ANASTASIS_AuthorizationMethodConfig *methods;
+ enum TALER_ErrorCode ec;
/**
- * Length of the @e methods array.
+ * Full response in JSON, if provided.
*/
- unsigned int methods_length;
+ const json_t *response;
/**
- * Maximum size of an upload in megabytes.
+ * Details depending on @e http_status.
*/
- uint32_t storage_limit_in_megabytes;
+ union
+ {
- /**
- * Annual fee for an account / policy upload.
- */
- struct TALER_Amount annual_fee;
+ /**
+ * Details on #MHD_HTTP_OK.
+ */
+ struct
+ {
- /**
- * Fee for a truth upload.
- */
- struct TALER_Amount truth_upload_fee;
+ /**
+ * Protocol version supported by the server.
+ */
+ const char *version;
- /**
- * Maximum legal liability for data loss covered by the
- * provider.
- */
- struct TALER_Amount liability_limit;
+ /**
+ * Business name of the anastasis provider.
+ */
+ const char *business_name;
- /**
- * Provider salt.
- */
- struct ANASTASIS_CRYPTO_ProviderSaltP provider_salt;
+ /**
+ * Array of authorization methods supported by the server.
+ */
+ const struct ANASTASIS_AuthorizationMethodConfig *methods;
+
+ /**
+ * Length of the @e methods array.
+ */
+ unsigned int methods_length;
+
+ /**
+ * Maximum size of an upload in megabytes.
+ */
+ uint32_t storage_limit_in_megabytes;
+
+ /**
+ * Annual fee for an account / policy upload.
+ */
+ struct TALER_Amount annual_fee;
+
+ /**
+ * Fee for a truth upload.
+ */
+ struct TALER_Amount truth_upload_fee;
+
+ /**
+ * Maximum legal liability for data loss covered by the
+ * provider.
+ */
+ struct TALER_Amount liability_limit;
+
+ /**
+ * Provider salt.
+ */
+ struct ANASTASIS_CRYPTO_ProviderSaltP provider_salt;
+ } ok;
+
+ } details;
};
@@ -107,12 +138,10 @@ struct ANASTASIS_Config
* the server provided an acceptable response.
*
* @param cls closure
- * @param http_status the HTTP status
* @param acfg configuration obtained, NULL if we could not parse it
*/
typedef void
(*ANASTASIS_ConfigCallback)(void *cls,
- unsigned int http_status,
const struct ANASTASIS_Config *acfg);
@@ -185,15 +214,45 @@ struct ANASTASIS_MetaDownloadDetails
{
/**
- * Version-sorted array of meta data we downloaded.
+ * HTTP status returned.
+ */
+ unsigned int http_status;
+
+ /**
+ * Taler-specific error code, #TALER_EC_NONE on success.
+ */
+ enum TALER_ErrorCode ec;
+
+ /**
+ * Full response in JSON, if provided.
*/
- const struct ANASTASIS_MetaDataEntry *metas;
+ const json_t *response;
/**
- * Number of entries in @e metas.
+ * Details depending on @e http_status.
*/
- size_t metas_length;
+ union
+ {
+ /**
+ * Details on #MHD_HTTP_OK.
+ */
+ struct
+ {
+
+ /**
+ * Version-sorted array of meta data we downloaded.
+ */
+ const struct ANASTASIS_MetaDataEntry *metas;
+
+ /**
+ * Number of entries in @e metas.
+ */
+ size_t metas_length;
+
+ } ok;
+
+ } details;
};
@@ -201,13 +260,11 @@ struct ANASTASIS_MetaDownloadDetails
* 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);
@@ -247,30 +304,57 @@ ANASTASIS_policy_meta_lookup_cancel (
*/
struct ANASTASIS_DownloadDetails
{
- /**
- * Signature (already verified).
- */
- struct ANASTASIS_AccountSignatureP sig;
/**
- * Hash over @e policy and @e policy_size.
+ * HTTP status returned.
*/
- struct GNUNET_HashCode curr_policy_hash;
+ unsigned int http_status;
/**
- * The backup we downloaded.
+ * Taler-specific error code, #TALER_EC_NONE on success.
*/
- const void *policy;
+ enum TALER_ErrorCode ec;
/**
- * Number of bytes in @e backup.
+ * Details depending on @e http_status.
*/
- size_t policy_size;
+ union
+ {
+
+ /**
+ * Details on #MHD_HTTP_OK.
+ */
+ struct
+ {
+
+ /**
+ * Signature (already verified).
+ */
+ struct ANASTASIS_AccountSignatureP sig;
+
+ /**
+ * Hash over @e policy and @e policy_size.
+ */
+ struct GNUNET_HashCode curr_policy_hash;
+
+ /**
+ * The backup we downloaded.
+ */
+ const void *policy;
+
+ /**
+ * Number of bytes in @e backup.
+ */
+ size_t policy_size;
+
+ /**
+ * Policy version returned by the service.
+ */
+ uint32_t version;
+ } ok;
+
+ } details;
- /**
- * Policy version returned by the service.
- */
- uint32_t version;
};
@@ -284,12 +368,10 @@ struct ANASTASIS_PolicyLookupOperation;
* Callback to process a GET /policy request
*
* @param cls closure
- * @param http_status HTTP status code for this request
* @param dd the response details
*/
typedef void
(*ANASTASIS_PolicyLookupCallback) (void *cls,
- unsigned int http_status,
const struct ANASTASIS_DownloadDetails *dd);