-add newline
[oweals/gnunet.git] / src / datastore / datastore.h
index cb0604c180b60d839541873d0f9ed05aa6f664cf..4f431856b26ceec25c43ec39869fd90751fe0b43 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
  */
 #ifndef DATASTORE_H
 #define DATASTORE_H
 
-#define DEBUG_DATASTORE GNUNET_NO
 
 #include "gnunet_util_lib.h"
 
+GNUNET_NETWORK_STRUCT_BEGIN
+
 /**
  * Message from datastore service informing client about
  * the current size of the datastore.
@@ -43,19 +44,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 amount GNUNET_PACKED;
-
-  /**
-   * Number of items to reserve.
-   */
-  uint64_t entries GNUNET_PACKED;
 };
 
 
@@ -77,6 +73,12 @@ struct StatusMessage
    */
   int32_t status GNUNET_PACKED;
 
+  /**
+   * Minimum expiration time required for content to be stored
+   * by the datacache at this time, zero for unknown or no limit.
+   */
+  struct GNUNET_TIME_AbsoluteNBO min_expiration;
+
 };
 
 
@@ -108,21 +110,50 @@ struct GetMessage
 {
   /**
    * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET.  Size
-   * can either be "sizeof(struct GetMessage)" or 
-   * "sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)"!
+   * can either be "sizeof(struct GetMessage)" or
+   * "sizeof(struct GetMessage) - sizeof(struct 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.
    */
-  GNUNET_HashCode key GNUNET_PACKED;
+  struct GNUNET_HashCode key;
+
+};
+
+
+/**
+ * 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;
 
 };
 
@@ -181,7 +212,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;
 
@@ -189,12 +220,22 @@ 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;
 
+  /**
+   * 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
@@ -202,7 +243,7 @@ struct DataMessage
    * the key and content).
    */
   uint64_t uid;
-  
+
   /**
    * Expiration time (NBO); zero for remove.
    */
@@ -211,10 +252,10 @@ struct DataMessage
   /**
    * Key under which the item can be found.
    */
-  GNUNET_HashCode key GNUNET_PACKED;
+  struct GNUNET_HashCode key;
 
 };
-
+GNUNET_NETWORK_STRUCT_END