-do not run test without sqlite
[oweals/gnunet.git] / src / psycstore / psycstore.h
index 65d32d9fa6ce2c3a90e5712c157b2b1aa566a7bb..67104e8ad9bf238a88c07fb6af7eeb0aecc2ad6d 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.
  */
 
 /**
@@ -42,15 +42,17 @@ struct OperationResult
    */
   struct GNUNET_MessageHeader header;
 
+  uint32_t reserved GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   /**
    * Status code for the operation.
    */
-  int64_t result_code GNUNET_PACKED;
+  uint64_t result_code GNUNET_PACKED;
 
   /* followed by 0-terminated error message (on error) */
 
@@ -69,10 +71,18 @@ struct CountersResult
    */
   struct GNUNET_MessageHeader header;
 
+  /**
+   * 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.
+   */
+  uint32_t result_code GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   uint64_t max_fragment_id GNUNET_PACKED;
 
@@ -81,14 +91,6 @@ struct CountersResult
   uint64_t max_group_generation GNUNET_PACKED;
 
   uint64_t max_state_message_id GNUNET_PACKED;
-
-  /**
-   * 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.
-   */
-  int32_t result_code GNUNET_PACKED;
 };
 
 
@@ -102,15 +104,14 @@ struct FragmentResult
    */
   struct GNUNET_MessageHeader header;
 
+  uint32_t psycstore_flags GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
-
-  uint32_t psycstore_flags GNUNET_PACKED;
-
-  /* followed by GNUNET_MULTICAST_MessageHeader */
+  uint64_t op_id GNUNET_PACKED;
 
+  /* Followed by GNUNET_MULTICAST_MessageHeader */
 };
 
 
@@ -124,14 +125,16 @@ struct StateResult
    */
   struct GNUNET_MessageHeader header;
 
+  uint16_t name_size GNUNET_PACKED;
+
+  uint16_t reserved GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
-  uint16_t name_size  GNUNET_PACKED;
-
-  /* followed by name and value */
+  /* Followed by name and value */
 };
 
 
@@ -142,13 +145,14 @@ struct OperationRequest
 {
   struct GNUNET_MessageHeader header;
 
+  uint32_t reserved GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
-
 };
 
 
@@ -162,10 +166,12 @@ struct MembershipStoreRequest
    */
   struct GNUNET_MessageHeader header;
 
+  uint32_t reserved GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   /**
    * Channel's public key.
@@ -180,7 +186,7 @@ struct MembershipStoreRequest
   uint64_t announced_at GNUNET_PACKED;
   uint64_t effective_since GNUNET_PACKED;
   uint64_t group_generation GNUNET_PACKED;
-  int did_join GNUNET_PACKED;
+  uint8_t did_join;
 };
 
 
@@ -194,10 +200,12 @@ struct MembershipTestRequest
    */
   struct GNUNET_MessageHeader header;
 
+  uint32_t reserved GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   /**
    * Channel's public key.
@@ -226,9 +234,9 @@ struct FragmentStoreRequest
   struct GNUNET_MessageHeader header;
 
   /**
-   * Operation ID.
+   * enum GNUNET_PSYCSTORE_MessageFlags
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint32_t psycstore_flags GNUNET_PACKED;
 
   /**
    * Channel's public key.
@@ -236,9 +244,9 @@ struct FragmentStoreRequest
   struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
 
   /**
-   * enum GNUNET_PSYCSTORE_MessageFlags
+   * Operation ID.
    */
-  uint32_t psycstore_flags GNUNET_PACKED;
+  uint64_t op_id;
 
   /* Followed by fragment */
 };
@@ -254,10 +262,12 @@ struct FragmentGetRequest
    */
   struct GNUNET_MessageHeader header;
 
+  uint32_t reserved GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   /**
    * Channel's public key.
@@ -270,9 +280,19 @@ struct FragmentGetRequest
   struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
 
   /**
-   * Fragment ID to request.
+   * First fragment ID to request.
+   */
+  uint64_t first_fragment_id GNUNET_PACKED;
+
+  /**
+   * Last fragment ID to request.
    */
-  uint64_t fragment_id GNUNET_PACKED;
+  uint64_t last_fragment_id GNUNET_PACKED;
+
+  /**
+   * Maximum number of fragments to retrieve.
+   */
+  uint64_t fragment_limit GNUNET_PACKED;
 
   /**
    * Do membership test with @a slave_key before returning fragment?
@@ -292,10 +312,12 @@ struct MessageGetRequest
    */
   struct GNUNET_MessageHeader header;
 
+  uint32_t reserved GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   /**
    * Channel's public key.
@@ -308,9 +330,19 @@ struct MessageGetRequest
   struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
 
   /**
-   * Message ID to request.
+   * First message ID to request.
    */
-  uint64_t message_id GNUNET_PACKED;
+  uint64_t first_message_id GNUNET_PACKED;
+
+  /**
+   * Last message ID to request.
+   */
+  uint64_t last_message_id GNUNET_PACKED;
+
+  /**
+   * Maximum number of messages to retrieve.
+   */
+  uint64_t message_limit GNUNET_PACKED;
 
   /**
    * Do membership test with @a slave_key before returning fragment?
@@ -330,10 +362,12 @@ struct MessageGetFragmentRequest
    */
   struct GNUNET_MessageHeader header;
 
+  uint32_t reserved GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   /**
    * Channel's public key.
@@ -373,10 +407,12 @@ struct StateHashUpdateRequest
    */
   struct GNUNET_MessageHeader header;
 
+  uint32_t reserved GNUNET_PACKED;
+
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   /**
    * Channel's public key.
@@ -407,33 +443,22 @@ struct StateModifyRequest
   /**
    * Operation ID.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   /**
-   * Channel's public key.
+   * ID of the message to apply the state changes in.
    */
-  struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
-
   uint64_t message_id GNUNET_PACKED;
 
-  uint64_t state_delta GNUNET_PACKED;
-
   /**
-   * Size of name, including NUL terminator.
+   * State delta of the message with ID @a message_id.
    */
-  uint16_t name_size GNUNET_PACKED;
-
-  /**
-   * OR'd StateOpFlags
-   */
-  uint8_t flags;
+  uint64_t state_delta GNUNET_PACKED;
 
   /**
-   * enum GNUNET_ENV_Operator
+   * Channel's public key.
    */
-  uint8_t oper;
-
-  /* Followed by NUL-terminated name, then the value. */
+  struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
 };
 
 
@@ -448,26 +473,36 @@ struct StateSyncRequest
   struct GNUNET_MessageHeader header;
 
   /**
-   * Operation ID.
+   * Size of name, including NUL terminator.
    */
-  uint32_t op_id GNUNET_PACKED;
+  uint16_t name_size GNUNET_PACKED;
 
   /**
-   * Channel's public key.
+   * OR'd StateOpFlags
    */
-  struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
+  uint8_t flags;
 
-  uint64_t message_id GNUNET_PACKED;
+  uint8_t reserved;
 
   /**
-   * Size of name, including NUL terminator.
+   * Operation ID.
    */
-  uint16_t name_size GNUNET_PACKED;
+  uint64_t op_id GNUNET_PACKED;
 
   /**
-   * OR'd StateOpFlags
+   * ID of the message that contains the state_hash PSYC header variable.
    */
-  uint8_t flags;
+  uint64_t state_hash_message_id GNUNET_PACKED;
+
+  /**
+   * ID of the last stateful message before @a state_hash_message_id.
+   */
+  uint64_t max_state_message_id GNUNET_PACKED;
+
+  /**
+   * Channel's public key.
+   */
+  struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
 
   /* Followed by NUL-terminated name, then the value. */
 };