summaryrefslogtreecommitdiff
path: root/src/include/anastasis_database_plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/anastasis_database_plugin.h')
-rw-r--r--src/include/anastasis_database_plugin.h78
1 files changed, 76 insertions, 2 deletions
diff --git a/src/include/anastasis_database_plugin.h b/src/include/anastasis_database_plugin.h
index 45efb09..6b686e2 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -1,6 +1,6 @@
/*
This file is part of Anastasis
- Copyright (C) 2019 Anastasis SARL
+ Copyright (C) 2019-2021 Anastasis SARL
Anastasis is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free Software
@@ -241,6 +241,46 @@ struct ANASTASIS_DatabasePlugin
/**
+ * Register callback to be invoked on events of type @a es.
+ *
+ * @param cls database context to use
+ * @param es specification of the event to listen for
+ * @param cb function to call when the event happens, possibly
+ * multiple times (until cancel is invoked)
+ * @param cb_cls closure for @a cb
+ * @return handle useful to cancel the listener
+ */
+ struct GNUNET_DB_EventHandler *
+ (*event_listen)(void *cls,
+ const struct GNUNET_DB_EventHeaderP *es,
+ GNUNET_DB_EventCallback cb,
+ void *cb_cls);
+
+ /**
+ * Stop notifications.
+ *
+ * @param eh handle to unregister.
+ */
+ void
+ (*event_listen_cancel)(struct GNUNET_DB_EventHandler *eh);
+
+
+ /**
+ * Notify all that listen on @a es of an event.
+ *
+ * @param cls database context to use
+ * @param es specification of the event to generate
+ * @param extra additional event data provided
+ * @param extra_size number of bytes in @a extra
+ */
+ void
+ (*event_notify)(void *cls,
+ const struct GNUNET_DB_EventHeaderP *es,
+ const void *extra,
+ size_t extra_size);
+
+
+ /**
* Store encrypted recovery document.
*
* @param cls closure
@@ -535,6 +575,41 @@ struct ANASTASIS_DatabasePlugin
const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid,
const struct GNUNET_HashCode *hashed_code);
+
+ /**
+ * Set the 'satisfied' bit for the given challenge and code to
+ * 'true'.
+ *
+ * @param cls closure
+ * @param truth_uuid identification of the challenge which the code corresponds to
+ * @param code code which is now satisfied
+ * @return transaction status
+ */
+ enum ANASTASIS_DB_CodeStatus
+ (*mark_challenge_code_satisfied)(
+ void *cls,
+ const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid,
+ const uint64_t code);
+
+
+ /**
+ * Check if the 'satisfied' bit for the given challenge and code is
+ * 'true' and the challenge code is not yet expired.
+ *
+ * @param cls closure
+ * @param truth_uuid identification of the challenge which the code corresponds to
+ * @param code code which is now satisfied
+ * @return transaction status,
+ * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the challenge code is not satisfied or expired
+ * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if the challenge code has been marked as satisfied
+ */
+ enum ANASTASIS_DB_CodeStatus
+ (*test_challenge_code_satisfied)(
+ void *cls,
+ const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid,
+ const uint64_t code);
+
+
/**
* Insert a new challenge code for a given challenge identified by the challenge
* public key. The function will first check if there is already a valid code
@@ -641,7 +716,6 @@ struct ANASTASIS_DatabasePlugin
/**
* Function called to remove all expired codes from the database.
- * FIXME: maybe implement as part of @e gc() in the future.
*
* @return transaction status
*/