summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-19 17:30:07 +0100
committerChristian Grothoff <christian@grothoff.org>2022-01-19 17:30:07 +0100
commit285e1ab3bd2754598da2bae802e8482c3f8b4f24 (patch)
tree7e897bd03a896223c0f8ed22e3061b10b854bec1 /src/include
parent21e28d6d049a948fe71817da7cb3e3b0f1639eb6 (diff)
downloadanastasis-285e1ab3bd2754598da2bae802e8482c3f8b4f24.tar.gz
anastasis-285e1ab3bd2754598da2bae802e8482c3f8b4f24.tar.bz2
anastasis-285e1ab3bd2754598da2bae802e8482c3f8b4f24.zip
implement parallel deduplicating optional attribute brute-forcing discovery process on top of reducer state, but as a side-activity
Diffstat (limited to 'src/include')
-rw-r--r--src/include/anastasis_redux.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/include/anastasis_redux.h b/src/include/anastasis_redux.h
index 39ed021..fc7bd56 100644
--- a/src/include/anastasis_redux.h
+++ b/src/include/anastasis_redux.h
@@ -111,4 +111,84 @@ void
ANASTASIS_redux_action_cancel (struct ANASTASIS_ReduxAction *ra);
+/**
+ * Handle for a policy discovery operation.
+ */
+struct ANASTASIS_PolicyDiscovery;
+
+
+/**
+ * Function called on each discovered recovery policy. Called
+ * with all arguments NULL if we have received all policies that
+ * we could possibly receive for the current operation.
+ *
+ * The client can then start a new policy discovery process, using the
+ * smallest (also most recent) @a version received per @a provider_url
+ * in the cursor to resume. Note that in this case, the application
+ * logic is responsible for de-duplication using @a hcpd, or it may show
+ * policies again if they are at different providers under versions not
+ * queried up to the cursor.
+ *
+ * @param cls closure
+ * @param hcpd hash of the compressed policy document (unique per policy)
+ * @param provider_url which provider claims to have this policy
+ * @param version version of the policy at this provider
+ * @param attribute_mask combination of optional identity attributes
+ * present in the state that was used to locate this version
+ * @param server_time when did the provider receive the upload
+ * @param secret_name name the user assigned to the backup
+ */
+typedef void
+(*ANASTASIS_PolicyDiscoveryCallback)(void *cls,
+ const struct GNUNET_HashCode *hcpd,
+ const char *provider_url,
+ uint32_t version,
+ json_int_t attribute_mask,
+ struct GNUNET_TIME_Timestamp server_time,
+ const char *secret_name);
+
+
+/**
+ * Start requesting providers for available policies for the
+ * recovery specified in @a state.
+ *
+ * @param state state to discover polices in
+ * @param cursor array containing "provider_url", attribute "mask",
+ * and "max_version" values (max_version is exclusive).
+ * Used for incremental discovery, NULL is allowed
+ * to begin from the latest version(s).
+ * @param cb function to call with results
+ * @param cb_cls closure for @a cb
+ * @return NULL on failure
+ */
+struct ANASTASIS_PolicyDiscovery *
+ANASTASIS_policy_discovery_start (const json_t *state,
+ const json_t *cursor,
+ ANASTASIS_PolicyDiscoveryCallback cb,
+ void *cb_cls);
+
+/**
+ * Stop policy discovery.
+ *
+ * @param[in] pd operation to stop
+ */
+void
+ANASTASIS_policy_discovery_stop (struct ANASTASIS_PolicyDiscovery *pd);
+
+
+/**
+ * Compute a subset of @a master_id removing optional attributes
+ * based on the bits set in @a mask.
+ *
+ * @param state reducer state (tells us which attributes are optional)
+ * @param master_id set of identity attributes to mask
+ * @param mask bitmask to apply
+ * @return masked copy of the @a master_id
+ */
+json_t *
+ANASTASIS_mask_id_data (const json_t *state,
+ const json_t *master_id,
+ json_int_t mask);
+
+
#endif /* _ANASTASIS_REDUX_H */