add nick name for cached records
[oweals/gnunet.git] / src / datastore / datastore.h
index 8fa0ca0446559539416e4a2ffaa8aa4f6ecc4503..75e122058d30db0cf61bcfc3acb02e41b13e04d5 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
 #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.
@@ -72,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;
+
 };
 
 
@@ -103,8 +110,8 @@ 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;
 
@@ -113,11 +120,16 @@ struct GetMessage
    */
   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;
 
 };
 
@@ -138,6 +150,11 @@ struct GetZeroAnonymityMessage
    */
   uint32_t type GNUNET_PACKED;
 
+  /**
+   * Offset of the result.
+   */
+  uint64_t offset GNUNET_PACKED;
+
 };
 
 
@@ -203,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
@@ -216,7 +243,7 @@ struct DataMessage
    * the key and content).
    */
   uint64_t uid;
-  
+
   /**
    * Expiration time (NBO); zero for remove.
    */
@@ -225,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