Fixed reconnect
[oweals/gnunet.git] / src / datastore / datastore.h
index 92a2889d82363fce67d9f08c2ab0e404a539d719..1dcf7bb4bae20b1d2f8c6302d7bed87063304634 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file datastore/datastore.hc
+ * @file datastore/datastore.h
  * @brief structs for communication between datastore service and API
  * @author Christian Grothoff
  */
@@ -27,6 +27,8 @@
 #ifndef DATASTORE_H
 #define DATASTORE_H
 
+#define DEBUG_DATASTORE GNUNET_NO
+
 #include "gnunet_util_lib.h"
 
 /**
@@ -41,19 +43,14 @@ struct ReserveMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Always zero.
+   * Number of items to reserve.
    */
-  uint32_t reserved GNUNET_PACKED;
+  uint32_t entries GNUNET_PACKED;
 
   /**
    * Number of bytes to reserve.
    */
-  uint64_t size GNUNET_PACKED;
-
-  /**
-   * Number of items to reserve.
-   */
-  uint64_t items GNUNET_PACKED;
+  uint64_t amount GNUNET_PACKED;
 };
 
 
@@ -71,7 +68,7 @@ struct StatusMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Status code.
+   * Status code, -1 for errors.
    */
   int32_t status GNUNET_PACKED;
 
@@ -106,16 +103,21 @@ struct GetMessage
 {
   /**
    * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET.  Size
-   * can either be "sizeof(struct GetMessage)" or 
+   * can either be "sizeof(struct GetMessage)" or
    * "sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)"!
    */
   struct GNUNET_MessageHeader header;
 
   /**
-   * Desired content type.
+   * Desired content type.  (actually an enum GNUNET_BLOCK_Type)
    */
   uint32_t type GNUNET_PACKED;
 
+  /**
+   * Offset of the result.
+   */
+  uint64_t offset GNUNET_PACKED;
+
   /**
    * Desired key (optional).  Check the "size" of the
    * header to see if the key is actually present.
@@ -125,6 +127,30 @@ struct GetMessage
 };
 
 
+/**
+ * Message to the datastore service asking about zero
+ * anonymity content.
+ */
+struct GetZeroAnonymityMessage
+{
+  /**
+   * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY.
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Desired content type (actually an enum GNUNET_BLOCK_Type)
+   */
+  uint32_t type GNUNET_PACKED;
+
+  /**
+   * Offset of the result.
+   */
+  uint64_t offset GNUNET_PACKED;
+
+};
+
+
 /**
  * Message to the datastore service requesting an update
  * to the priority or expiration for some content.
@@ -179,7 +205,7 @@ struct DataMessage
   uint32_t size GNUNET_PACKED;
 
   /**
-   * Type of the item (NBO), zero for remove.
+   * Type of the item (NBO), zero for remove,  (actually an enum GNUNET_BLOCK_Type)
    */
   uint32_t type GNUNET_PACKED;
 
@@ -187,17 +213,30 @@ struct DataMessage
    * Priority of the item (NBO), zero for remove.
    */
   uint32_t priority GNUNET_PACKED;
-  
+
   /**
    * Desired anonymity level (NBO), zero for remove.
    */
   uint32_t anonymity GNUNET_PACKED;
 
   /**
-   * Unique ID for the content (can be used for UPDATE).
+   * Desired replication level. 0 from service to API.
+   */
+  uint32_t replication GNUNET_PACKED;
+
+  /**
+   * For alignment.
+   */
+  uint32_t reserved GNUNET_PACKED;
+
+  /**
+   * Unique ID for the content (can be used for UPDATE);
+   * can be zero for remove (which indicates that
+   * the datastore should use whatever UID matches
+   * the key and content).
    */
   uint64_t uid;
-  
+
   /**
    * Expiration time (NBO); zero for remove.
    */