-consistently use struct GNUNET_HashCode
[oweals/gnunet.git] / src / chat / chat.h
index a9cf83a8c569fc721d2e5b5c029990a556f493af..c65b75de9c807cf68cf3ee9e3859d1cd824b0e25 100644 (file)
@@ -41,6 +41,8 @@
  * Client-service messages
  */
 
+GNUNET_NETWORK_STRUCT_BEGIN
+
 /**
  * Notification sent by service to client indicating that we've received a chat
  * message.  After this struct, the remaining bytes are the actual text message.
@@ -69,11 +71,16 @@ struct ReceiveNotificationMessage
    */
   uint32_t reserved GNUNET_PACKED;
 
+  /**
+   * Timestamp of the message.
+   */
+  struct GNUNET_TIME_AbsoluteNBO timestamp;
+
   /**
    * Hash of the public key of the pseudonym of the sender of the message.
-   * TBD: Should be all zeros for anonymous.
+   * Should be all zeros for anonymous.
    */
-  GNUNET_HashCode sender;
+  struct GNUNET_HashCode sender;
 
   /**
    * The encrypted session key.
@@ -121,22 +128,30 @@ struct TransmitRequestMessage
    */
   uint32_t sequence_number GNUNET_PACKED;
 
+  /**
+   * Timestamp of the message.
+   */
+  struct GNUNET_TIME_AbsoluteNBO timestamp;
+
   /**
    * Who should receive this message?  Set to all zeros for "everyone".
    */
-  GNUNET_HashCode target;
+  struct GNUNET_HashCode target;
 
 };
 
 
 /**
  * Receipt sent from a message receiver to the service to confirm delivery of
- * a chat message.
+ * a chat message and from the service to sender of the original message to
+ * acknowledge delivery.
  */
 struct ConfirmationReceiptMessage
 {
   /**
-   * Message type will be GNUNET_MESSAGE_TYPE_CHAT_CONFIRMATION_RECEIPT 
+   * Message type will be
+   * GNUNET_MESSAGE_TYPE_CHAT_CONFIRMATION_RECEIPT when sending from client,
+   * GNUNET_MESSAGE_TYPE_CHAT_CONFIRMATION_NOTIFICATION when sending to client.
    */
   struct GNUNET_MessageHeader header;
 
@@ -174,17 +189,17 @@ struct ConfirmationReceiptMessage
   /**
    * Who is confirming the receipt?
    */
-  GNUNET_HashCode target;
+  struct GNUNET_HashCode target;
 
   /**
    * Who is the author of the chat message?
    */
-  GNUNET_HashCode author;
+  struct GNUNET_HashCode author;
 
   /**
    * Hash of the (possibly encrypted) content.
    */
-  GNUNET_HashCode content;
+  struct GNUNET_HashCode content;
 
 };
 
@@ -351,8 +366,9 @@ struct P2PLeaveNotificationMessage
 
 /**
  * Message send by one peer to another to indicate receiving of a chat message.
- * After this struct, the remaining bytes are the actual text message.  If the
- * mesasge is private, then the text is encrypted, otherwise it's plaintext.
+ * This struct is followed by the room name (only if the message is anonymous)
+ * and then the remaining bytes are the actual text message.  If the mesasge is
+ * private, then the text is encrypted, otherwise it's plaintext.
  */
 struct P2PReceiveNotificationMessage
 {
@@ -371,21 +387,31 @@ struct P2PReceiveNotificationMessage
    */
   uint32_t sequence_number GNUNET_PACKED;
 
+  /**
+   * Length of the room name. This is only used for anonymous messages.
+   */
+  uint16_t room_name_len GNUNET_PACKED;
+
   /**
    * Reserved (for alignment).
    */
-  uint32_t reserved GNUNET_PACKED;
+  uint16_t reserved GNUNET_PACKED;
+
+  /**
+   * Timestamp of the message.
+   */
+  struct GNUNET_TIME_AbsoluteNBO timestamp;
 
   /**
    * Hash of the public key of the pseudonym of the sender of the message
-   * TBD: Should be all zeros for anonymous.
+   * Should be all zeros for anonymous.
    */
-  GNUNET_HashCode sender;
+  struct GNUNET_HashCode sender;
 
   /**
    * Who should receive this message?  Set to all zeros for "everyone".
    */
-  GNUNET_HashCode target;
+  struct GNUNET_HashCode target;
 
   /**
    * The encrypted session key.
@@ -439,19 +465,20 @@ struct P2PConfirmationReceiptMessage
   /**
    * Who is confirming the receipt?
    */
-  GNUNET_HashCode target;
+  struct GNUNET_HashCode target;
 
   /**
    * Who is the author of the chat message?
    */
-  GNUNET_HashCode author;
+  struct GNUNET_HashCode author;
 
   /**
    * Hash of the (possibly encrypted) content.
    */
-  GNUNET_HashCode content;
+  struct GNUNET_HashCode content;
 
 };
+GNUNET_NETWORK_STRUCT_END
 
 #endif