-simplifying core API (#2400)
[oweals/gnunet.git] / src / chat / chat.h
index a9cf83a8c569fc721d2e5b5c029990a556f493af..5df7773a7ccf33957c5e50f7ca6f993b9c07cfde 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,9 +71,14 @@ 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;
 
@@ -121,6 +128,11 @@ 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".
    */
@@ -131,12 +143,15 @@ struct TransmitRequestMessage
 
 /**
  * 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;
 
@@ -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,14 +387,24 @@ 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;
 
@@ -452,6 +478,7 @@ struct P2PConfirmationReceiptMessage
   GNUNET_HashCode content;
 
 };
+GNUNET_NETWORK_STRUCT_END
 
 #endif