WIP commit of scalar product 2.0. It is unfinished and does not yet pass tests. This...
[oweals/gnunet.git] / src / consensus / consensus.h
index 3f1efe3401b8f5871aad3e1049828caf828c6241..4ff21829877a8a320544e2524f173b04051679a0 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
  * @file consensus/consensus.h
  * @brief
  */
-#ifndef NSE_H
-#define NSE_H
+#ifndef CONSENSUS_H
+#define CONSENSUS_H
 
 #include "gnunet_common.h"
 
 GNUNET_NETWORK_STRUCT_BEGIN
 
+/**
+ * Sent by the client to the service,
+ * when the client wants the service to join a consensus session.
+ */
 struct GNUNET_CONSENSUS_JoinMessage
 {
   /**
@@ -37,35 +41,28 @@ struct GNUNET_CONSENSUS_JoinMessage
    */
   struct GNUNET_MessageHeader header;
 
-  struct GNUNET_HashCode session_id;
-
-  uint16_t num_peers;
-
-  /* GNUNET_PeerIdentity[num_peers] */
-};
-
-
-struct GNUNET_CONSENSUS_ConcludeMessage
-{
   /**
-   * Type: GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE
+   * Number of peers (at the end of this message) that want to
+   * participate in the consensus.
    */
-  struct GNUNET_MessageHeader header;
-
-  struct GNUNET_TIME_RelativeNBO timeout;
-};
+  uint32_t num_peers GNUNET_PACKED;
 
+  /**
+   * Session id of the consensus.
+   */
+  struct GNUNET_HashCode session_id;
 
-struct GNUNET_CONSENSUS_ConcludeDoneMessage
-{
   /**
-   * Type: GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE_DONE
+   * Start time for the consensus.
    */
-  struct GNUNET_MessageHeader header;
+  struct GNUNET_TIME_AbsoluteNBO start;
 
-  uint16_t num_peers;
+  /**
+   * Deadline for conclude.
+   */
+  struct GNUNET_TIME_AbsoluteNBO deadline;
 
-  /*PeerIdentity[num_peers] */
+  /* GNUNET_PeerIdentity[num_peers] */
 };
 
 
@@ -85,11 +82,12 @@ struct GNUNET_CONSENSUS_ElementMessage
   /**
    * Type: GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_NEW_ELEMENT
    */
-  uint16_t element_type;
+  uint16_t element_type GNUNET_PACKED; /* FIXME: alignment? => uint32_t */
 
   /* rest: element data */
 };
 
+
 GNUNET_NETWORK_STRUCT_END
 
 #endif