Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials
[oweals/gnunet.git] / src / datastore / datastore.h
index aa2646c0a7b04ad166be11dea91eda16552d3800..dc3d9d1f26a0c7d927f11f8c8704facc88a04cf2 100644 (file)
@@ -1,10 +1,10 @@
 /*
      This file is part of GNUnet
 /*
      This file is part of GNUnet
-     (C) 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2004, 2005, 2006, 2007, 2009 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
 
      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
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -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
 
      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.
 */
 
 /**
 */
 
 /**
 #ifndef DATASTORE_H
 #define DATASTORE_H
 
 #ifndef DATASTORE_H
 #define DATASTORE_H
 
-#define DEBUG_DATASTORE GNUNET_NO
 
 #include "gnunet_util_lib.h"
 
 
 #include "gnunet_util_lib.h"
 
+GNUNET_NETWORK_STRUCT_BEGIN
+
 /**
  * Message from datastore service informing client about
  * the current size of the datastore.
 /**
  * Message from datastore service informing client about
  * the current size of the datastore.
@@ -72,6 +73,12 @@ struct StatusMessage
    */
   int32_t status GNUNET_PACKED;
 
    */
   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;
+
 };
 
 
 };
 
 
@@ -95,6 +102,35 @@ struct ReleaseReserveMessage
 };
 
 
 };
 
 
+/**
+ * Message to the datastore service asking about specific
+ * content.
+ */
+struct GetKeyMessage
+{
+  /**
+   * Type is #GNUNET_MESSAGE_TYPE_DATASTORE_GET_KEY.
+   */
+  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;
+
+  /**
+   * Desired key.
+   */
+  struct GNUNET_HashCode key;
+
+};
+
+
 /**
  * Message to the datastore service asking about specific
  * content.
 /**
  * Message to the datastore service asking about specific
  * content.
@@ -102,22 +138,43 @@ struct ReleaseReserveMessage
 struct GetMessage
 {
   /**
 struct GetMessage
 {
   /**
-   * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET.  Size
-   * can either be "sizeof(struct GetMessage)" or 
-   * "sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)"!
+   * Type is #GNUNET_MESSAGE_TYPE_DATASTORE_GET.
    */
   struct GNUNET_MessageHeader header;
 
   /**
    */
   struct GNUNET_MessageHeader header;
 
   /**
-   * Desired content type.
+   * Desired content type.  (actually an enum GNUNET_BLOCK_Type)
    */
   uint32_t type GNUNET_PACKED;
 
   /**
    */
   uint32_t type GNUNET_PACKED;
 
   /**
-   * Desired key (optional).  Check the "size" of the
-   * header to see if the key is actually present.
+   * Offset of the result.
    */
    */
-  GNUNET_HashCode key GNUNET_PACKED;
+  uint64_t offset GNUNET_PACKED;
+
+};
+
+
+/**
+ * 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;
 
 };
 
 
 };
 
@@ -176,7 +233,7 @@ struct DataMessage
   uint32_t size GNUNET_PACKED;
 
   /**
   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;
 
    */
   uint32_t type GNUNET_PACKED;
 
@@ -184,12 +241,22 @@ struct DataMessage
    * Priority of the item (NBO), zero for remove.
    */
   uint32_t priority GNUNET_PACKED;
    * 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 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
   /**
    * Unique ID for the content (can be used for UPDATE);
    * can be zero for remove (which indicates that
@@ -197,7 +264,7 @@ struct DataMessage
    * the key and content).
    */
   uint64_t uid;
    * the key and content).
    */
   uint64_t uid;
-  
+
   /**
    * Expiration time (NBO); zero for remove.
    */
   /**
    * Expiration time (NBO); zero for remove.
    */
@@ -206,10 +273,10 @@ struct DataMessage
   /**
    * Key under which the item can be found.
    */
   /**
    * Key under which the item can be found.
    */
-  GNUNET_HashCode key GNUNET_PACKED;
+  struct GNUNET_HashCode key;
 
 };
 
 };
-
+GNUNET_NETWORK_STRUCT_END