summaryrefslogtreecommitdiff
path: root/src/reducer
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-04-05 17:16:04 +0200
committerChristian Grothoff <christian@grothoff.org>2022-04-05 17:16:04 +0200
commit71f889186973ef26e8ae684ec47fd570138bc4e5 (patch)
tree02898d03575384c26b5399d28d702d97f4683403 /src/reducer
parent452aa5391b75ab6637b62398f9b0627593570d5d (diff)
downloadanastasis-71f889186973ef26e8ae684ec47fd570138bc4e5.tar.gz
anastasis-71f889186973ef26e8ae684ec47fd570138bc4e5.tar.bz2
anastasis-71f889186973ef26e8ae684ec47fd570138bc4e5.zip
adapt to latest GNUnet API: GNUNET_JSON_spec_mark_optional() changed
Diffstat (limited to 'src/reducer')
-rw-r--r--src/reducer/anastasis_api_backup_redux.c81
-rw-r--r--src/reducer/anastasis_api_discovery.c6
-rw-r--r--src/reducer/anastasis_api_recovery_redux.c9
-rw-r--r--src/reducer/anastasis_api_redux.c27
4 files changed, 80 insertions, 43 deletions
diff --git a/src/reducer/anastasis_api_backup_redux.c b/src/reducer/anastasis_api_backup_redux.c
index b3ee9dd..4d14479 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -357,16 +357,20 @@ add_authentication (json_t *state,
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes",
- &size_limit_in_mb)),
+ &size_limit_in_mb),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("methods",
- &methods)),
+ &methods),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -1165,10 +1169,12 @@ provider_candidate (struct PolicyBuilder *pb,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -1967,10 +1973,12 @@ add_policy (json_t *state,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes",
&limit),
GNUNET_JSON_spec_json ("methods",
@@ -2447,10 +2455,12 @@ update_expiration_cost (json_t *state,
struct GNUNET_JSON_Specification pspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
TALER_JSON_spec_amount_any ("annual_fee",
&annual_fee),
GNUNET_JSON_spec_end ()
@@ -2554,10 +2564,12 @@ update_expiration_cost (json_t *state,
struct GNUNET_JSON_Specification pspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
TALER_JSON_spec_amount_any ("truth_upload_fee",
&upload_cost),
GNUNET_JSON_spec_end ()
@@ -2682,7 +2694,8 @@ done_policy_review (json_t *state,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("expiration",
- &exp)),
+ &exp),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -3137,7 +3150,8 @@ share_secret (struct UploadContext *uc)
&core_secret),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("secret_name",
- &secret_name)),
+ &secret_name),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -3159,7 +3173,8 @@ share_secret (struct UploadContext *uc)
struct GNUNET_JSON_Specification pspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("timeout",
- &timeout)),
+ &timeout),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -3259,7 +3274,8 @@ share_secret (struct UploadContext *uc)
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("truth",
- &jtruth)),
+ &jtruth),
+ NULL),
GNUNET_JSON_spec_string ("provider",
&provider_url),
GNUNET_JSON_spec_uint32 ("authentication_method",
@@ -3362,7 +3378,8 @@ share_secret (struct UploadContext *uc)
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("payment_secret",
- &pds[i].payment_secret)),
+ &pds[i].payment_secret),
+ NULL),
GNUNET_JSON_spec_string ("provider_url",
&pds[i].provider_url),
GNUNET_JSON_spec_end ()
@@ -3609,7 +3626,8 @@ add_truth_object (struct UploadContext *uc,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("upload_status",
- &status)),
+ &status),
+ NULL),
GNUNET_JSON_spec_end ()
};
if (GNUNET_OK !=
@@ -3793,10 +3811,12 @@ check_truth_upload (struct UploadContext *uc,
&type),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("mime_type",
- &mime_type)),
+ &mime_type),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("instructions",
- &instructions)),
+ &instructions),
+ NULL),
GNUNET_JSON_spec_varsize ("challenge",
&truth_data,
&truth_data_size),
@@ -3984,7 +4004,8 @@ upload (json_t *state,
struct GNUNET_JSON_Specification pspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("timeout",
- &uc->timeout)),
+ &uc->timeout),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -4043,7 +4064,8 @@ upload (json_t *state,
&am_idx),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("truth",
- &truth)),
+ &truth),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -4206,13 +4228,16 @@ check_upload_size_limit (json_t *state,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes",
- &limit)),
+ &limit),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -4265,7 +4290,8 @@ enter_secret (json_t *state,
&jsecret),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("expiration",
- &expiration)),
+ &expiration),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -5037,7 +5063,8 @@ ANASTASIS_REDUX_backup_begin_ (json_t *state,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_end ()
};
diff --git a/src/reducer/anastasis_api_discovery.c b/src/reducer/anastasis_api_discovery.c
index 727f00b..76731ad 100644
--- a/src/reducer/anastasis_api_discovery.c
+++ b/src/reducer/anastasis_api_discovery.c
@@ -318,7 +318,8 @@ ANASTASIS_policy_discovery_start (const json_t *state,
&name),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_boolean ("optional",
- &optional)),
+ &optional),
+ NULL),
GNUNET_JSON_spec_end ()
};
bool present;
@@ -464,7 +465,8 @@ ANASTASIS_mask_id_data (const json_t *state,
&name),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_boolean ("optional",
- &optional)),
+ &optional),
+ NULL),
GNUNET_JSON_spec_end ()
};
bool present;
diff --git a/src/reducer/anastasis_api_recovery_redux.c b/src/reducer/anastasis_api_recovery_redux.c
index 6026fc0..e08c7e7 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -1057,7 +1057,8 @@ solve_challenge_cb (void *cls,
struct GNUNET_JSON_Specification tspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("timeout",
- &timeout)),
+ &timeout),
+ NULL),
GNUNET_JSON_spec_end ()
};
struct GNUNET_JSON_Specification pspec[] = {
@@ -1648,7 +1649,8 @@ pay_challenge (json_t *state,
struct GNUNET_JSON_Specification aspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("timeout",
- &timeout)),
+ &timeout),
+ NULL),
GNUNET_JSON_spec_fixed_auto ("payment_secret",
&sctx->ps),
GNUNET_JSON_spec_end ()
@@ -1746,7 +1748,8 @@ select_challenge_cb (void *cls,
struct GNUNET_JSON_Specification tspec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("timeout",
- &timeout)),
+ &timeout),
+ NULL),
GNUNET_JSON_spec_end ()
};
struct GNUNET_JSON_Specification pspec[] = {
diff --git a/src/reducer/anastasis_api_redux.c b/src/reducer/anastasis_api_redux.c
index bcc0e77..bc2cb5e 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -1254,19 +1254,22 @@ enter_user_attributes (json_t *state,
const char *attribute_value;
const char *regexp = NULL;
const char *reglog = NULL;
- int optional = false;
+ bool optional = false;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("name",
&name),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("validation-regex",
- &regexp)),
+ &regexp),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("validation-logic",
- &reglog)),
+ &reglog),
+ NULL),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_boolean ("optional",
- &optional)),
+ GNUNET_JSON_spec_bool ("optional",
+ &optional),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -2024,16 +2027,20 @@ ANASTASIS_reducer_lookup_salt (const json_t *state,
const json_t *cfg;
uint32_t http_status = 0;
bool disabled = false;
+ bool no_salt;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("disabled",
- &disabled)),
+ &disabled),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("http_status",
- &http_status)),
+ &http_status),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("salt",
- salt)),
+ salt),
+ &no_salt),
GNUNET_JSON_spec_end ()
};
@@ -2062,9 +2069,7 @@ ANASTASIS_reducer_lookup_salt (const json_t *state,
}
if (disabled)
return GNUNET_NO;
- if (NULL ==
- json_object_get (cfg,
- "salt"))
+ if (no_salt)
return GNUNET_NO;
return GNUNET_OK;
}