missing changes to headers
[oweals/gnunet.git] / src / include / gnunet_psycstore_service.h
index 78d016bb3e705336f734fc7566b96daa710d23f1..17d53b34d267a117c171b89460ec134992ff6f91 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2013 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -107,15 +107,20 @@ struct GNUNET_PSYCSTORE_OperationHandle;
 /**
  * Function called with the result of an asynchronous operation.
  *
+ * @param cls
+ *        Closure.
  * @param result
- *        #GNUNET_YES on success or if the peer was a member,
- *        #GNUNET_NO if the peer was not a member,
- *        #GNUNET_SYSERR on error,
+ *        Result of the operation.
+ * @param err_msg
+ *        Error message, or NULL if there's no error.
+ * @param err_msg_size
+ *        Size of @a err_msg
  */
 typedef void
 (*GNUNET_PSYCSTORE_ResultCallback) (void *cls,
                                     int64_t result,
-                                    const char *err_msg);
+                                    const char *err_msg,
+                                    uint16_t err_msg_size);
 
 
 /**
@@ -318,15 +323,15 @@ GNUNET_PSYCSTORE_fragment_get_latest (struct GNUNET_PSYCSTORE_Handle *h,
  * @param channel_key
  *        The channel we are interested in.
  * @param slave_key
- *        The slave requesting the message.  If not NULL, a membership test is
- *        performed first and the message is only returned if the slave has
- *        access to it.
+ *        The slave requesting the message.
+ *        If not NULL, a membership test is performed first
+ *        and the message is only returned if the slave has access to it.
  * @param first_message_id
  *        First message ID to retrieve.
- *        Use 0 to get the latest message.
  * @param last_message_id
  *        Last consecutive message ID to retrieve.
- *        Use 0 to get the latest message.
+ * @param method_prefix
+ *        Retrieve only messages with a matching method prefix.
  * @param fragment_cb
  *        Callback to call with the retrieved fragments.
  * @param result_cb
@@ -342,6 +347,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
                               const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
                               uint64_t first_message_id,
                               uint64_t last_message_id,
+                              const char *method_prefix,
                               GNUNET_PSYCSTORE_FragmentCallback fragment_cb,
                               GNUNET_PSYCSTORE_ResultCallback result_cb,
                               void *cls);
@@ -355,14 +361,16 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
  * @param channel_key
  *        The channel we are interested in.
  * @param slave_key
- *        The slave requesting the message.  If not NULL, a membership test is
- *        performed first and the message is only returned if the slave has
- *        access to it.
+ *        The slave requesting the message.
+ *        If not NULL, a membership test is performed first
+ *        and the message is only returned if the slave has access to it.
  * @param message_limit
  *        Maximum number of messages to retrieve.
+ * @param method_prefix
+ *        Retrieve only messages with a matching method prefix.
  * @param fragment_cb
  *        Callback to call with the retrieved fragments.
- * @param rcb
+ * @param result_cb
  *        Callback to call with the result of the operation.
  * @param cls
  *        Closure for the callbacks.
@@ -374,6 +382,7 @@ GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h,
                                      const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
                                      const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key,
                                      uint64_t message_limit,
+                                     const char *method_prefix,
                                      GNUNET_PSYCSTORE_FragmentCallback fragment_cb,
                                      GNUNET_PSYCSTORE_ResultCallback rcb,
                                      void *cls);
@@ -421,14 +430,19 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h,
  * @see GNUNET_PSYCSTORE_counters_get()
  *
  * @param cls Closure.
- * @param result_code Status code for the operation:
+ * @param result_code
+ *        Status code for the operation:
  *        #GNUNET_OK: success, counter values are returned.
  *        #GNUNET_NO: no message has been sent to the channel yet.
  *        #GNUNET_SYSERR: an error occurred.
- * @param max_fragment_id Latest message fragment ID, used by multicast.
- * @param max_message_id Latest message ID, used by PSYC.
- * @param max_group_generation Latest group generation, used by PSYC.
- * @param max_state_message_id Latest message ID containing state modifiers that
+ * @param max_fragment_id
+ *        Latest message fragment ID, used by multicast.
+ * @param max_message_id
+ *        Latest message ID, used by PSYC.
+ * @param max_group_generation
+ *        Latest group generation, used by PSYC.
+ * @param max_state_message_id
+ *        Latest message ID containing state modifiers that
  *        was applied to the state store.  Used for the state sync process.
  */
 typedef void
@@ -448,10 +462,14 @@ typedef void
  *   the counters from their last value.
  * - when a channel slave rejoins and starts the state synchronization process.
  *
- * @param h Handle for the PSYCstore.
- * @param channel_key Public key that identifies the channel.
- * @param ccb Callback to call with the result.
- * @param ccb_cls Closure for the @a ccb callback.
+ * @param h
+ *        Handle for the PSYCstore.
+ * @param channel_key
+ *        Public key that identifies the channel.
+ * @param ccb
+ *        Callback to call with the result.
+ * @param ccb_cls
+ *        Closure for the @a ccb callback.
  *
  * @return Handle that can be used to cancel the operation.
  */
@@ -468,14 +486,18 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h,
  * An error is returned if there are missing messages containing state
  * operations before the current one.
  *
- * @param h Handle for the PSYCstore.
- * @param channel_key The channel we are interested in.
- * @param message_id ID of the message that contains the @a modifiers.
- * @param state_delta Value of the @e state_delta PSYC header variable of the message.
- * @param modifier_count Number of elements in the @a modifiers array.
- * @param modifiers List of modifiers to apply.
- * @param rcb Callback to call with the result of the operation.
- * @param rcb_cls Closure for the @a rcb callback.
+ * @param h
+ *        Handle for the PSYCstore.
+ * @param channel_key
+ *        The channel we are interested in.
+ * @param message_id
+ *        ID of the message that contains the @a modifiers.
+ * @param state_delta
+ *        Value of the @e state_delta PSYC header variable of the message.
+ * @param rcb
+ *        Callback to call with the result of the operation.
+ * @param rcb_cls
+ *        Closure for the @a rcb callback.
  *
  * @return Handle that can be used to cancel the operation.
  */
@@ -484,8 +506,6 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h,
                                const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
                                uint64_t message_id,
                                uint64_t state_delta,
-                               size_t modifier_count,
-                               const struct GNUNET_ENV_Modifier *modifiers,
                                GNUNET_PSYCSTORE_ResultCallback rcb,
                                void *rcb_cls);
 
@@ -493,20 +513,30 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h,
 /**
  * Store synchronized state.
  *
- * @param h Handle for the PSYCstore.
- * @param channel_key The channel we are interested in.
- * @param message_id ID of the message that contains the state_hash PSYC header variable.
- * @param modifier_count Number of elements in the @a modifiers array.
- * @param modifiers Full state to store.
- * @param rcb Callback to call with the result of the operation.
- * @param rcb_cls Closure for the callback.
+ * @param h
+ *        Handle for the PSYCstore.
+ * @param channel_key
+ *        The channel we are interested in.
+ * @param max_state_message_id
+ *        ID of the last stateful message before @a state_hash_message_id.
+ * @param state_hash_message_id
+ *        ID of the message that contains the state_hash PSYC header variable.
+ * @param modifier_count
+ *        Number of elements in the @a modifiers array.
+ * @param modifiers
+ *        Full state to store.
+ * @param rcb
+ *        Callback to call with the result of the operation.
+ * @param rcb_cls
+ *        Closure for the callback.
  *
  * @return Handle that can be used to cancel the operation.
  */
 struct GNUNET_PSYCSTORE_OperationHandle *
 GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h,
                              const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
-                             uint64_t message_id,
+                             uint64_t max_state_message_id,
+                             uint64_t state_hash_message_id,
                              size_t modifier_count,
                              const struct GNUNET_ENV_Modifier *modifiers,
                              GNUNET_PSYCSTORE_ResultCallback rcb,
@@ -519,10 +549,14 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h,
  *
  * Delete all state variables stored for the given channel.
  *
- * @param h Handle for the PSYCstore.
- * @param channel_key The channel we are interested in.
- * @param rcb Callback to call with the result of the operation.
- * @param rcb_cls Closure for the callback.
+ * @param h
+ *        Handle for the PSYCstore.
+ * @param channel_key
+ *        The channel we are interested in.
+ * @param rcb
+ *        Callback to call with the result of the operation.
+ * @param rcb_cls
+ *        Closure for the callback.
  *
  * @return Handle that can be used to cancel the operation.
  */
@@ -537,12 +571,18 @@ GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h,
 /**
  * Update signed values of state variables in the state store.
  *
- * @param h Handle for the PSYCstore.
- * @param channel_key The channel we are interested in.
- * @param message_id Message ID that contained the state @a hash.
- * @param hash Hash of the serialized full state.
- * @param rcb Callback to call with the result of the operation.
- * @param rcb_cls Closure for the callback.
+ * @param h
+ *        Handle for the PSYCstore.
+ * @param channel_key
+ *        The channel we are interested in.
+ * @param message_id
+ *        Message ID that contained the state @a hash.
+ * @param hash
+ *        Hash of the serialized full state.
+ * @param rcb
+ *        Callback to call with the result of the operation.
+ * @param rcb_cls
+ *        Closure for the callback.
  *
  */
 struct GNUNET_PSYCSTORE_OperationHandle *
@@ -557,29 +597,39 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h,
 /**
  * Function called with the value of a state variable.
  *
- * @param cls Closure.
- * @param name Name of the state variable.  A NULL value indicates that there are no more
+ * @param cls
+ *        Closure.
+ * @param name
+ *        Name of the state variable.  A NULL value indicates that there are no more
  *        state variables to be returned.
- * @param value Value of the state variable.
- * @param value_size Number of bytes in @a value.
+ * @param value
+ *        Value of the state variable.
+ * @param value_size
+ *        Number of bytes in @a value.
  *
  * @return #GNUNET_NO to stop calling this callback with further variables,
  *         #GNUNET_YES to continue.
  */;
 typedef int
 (*GNUNET_PSYCSTORE_StateCallback) (void *cls, const char *name,
-                                   const void *value, size_t value_size);
+                                   const void *value, uint32_t value_size);
 
 
 /**
  * Retrieve the best matching state variable.
  *
- * @param h Handle for the PSYCstore.
- * @param channel_key The channel we are interested in.
- * @param name Name of variable to match, the returned variable might be less specific.
- * @param scb Callback to return the matching state variable.
- * @param rcb Callback to call with the result of the operation.
- * @param cls Closure for the callbacks.
+ * @param h
+ *        Handle for the PSYCstore.
+ * @param channel_key
+ *        The channel we are interested in.
+ * @param name
+ *        Name of variable to match, the returned variable might be less specific.
+ * @param scb
+ *        Callback to return the matching state variable.
+ * @param rcb
+ *        Callback to call with the result of the operation.
+ * @param cls
+ *        Closure for the callbacks.
  *
  * @return Handle that can be used to cancel the operation.
  */
@@ -595,12 +645,18 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h,
 /**
  * Retrieve all state variables for a channel with the given prefix.
  *
- * @param h Handle for the PSYCstore.
- * @param channel_key The channel we are interested in.
- * @param name_prefix Prefix of state variable names to match.
- * @param scb Callback to return matching state variables.
- * @param rcb Callback to call with the result of the operation.
- * @param cls Closure for the callbacks.
+ * @param h
+ *        Handle for the PSYCstore.
+ * @param channel_key
+ *        The channel we are interested in.
+ * @param name_prefix
+ *        Prefix of state variable names to match.
+ * @param scb
+ *        Callback to return matching state variables.
+ * @param rcb
+ *        Callback to call with the result of the operation.
+ * @param cls
+ *        Closure for the callbacks.
  *
  * @return Handle that can be used to cancel the operation.
  */