Use Suffix Extensions in Makefiles (doc, src/{arm,dht,integration,statistics}) for...
[oweals/gnunet.git] / src / conversation / conversation.h
index 4b42277a55fcf6fb3437d5c98f12079ef56735ea..1ca816f0e825cc28e07b4950b0d717c4150d0afb 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2013-2016 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
@@ -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.
 */
 
 /**
@@ -39,6 +39,16 @@ extern "C"
 #define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
 
 
+/**
+ * Highest bit in a 32-bit unsigned integer,
+ * bit set if we are making an outgoing call,
+ * bit unset for local lines.
+ */
+#define HIGH_BIT ((uint32_t) (1LL << 31))
+
+GNUNET_NETWORK_STRUCT_BEGIN
+
+
 /**
  * Message to transmit the audio (between client and helpers).
  */
@@ -65,9 +75,14 @@ struct ClientPhoneRegisterMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Phone line to register.
+   * Always zero.
+   */
+  uint32_t reserved GNUNET_PACKED;
+
+  /**
+   * Phone line / CADET port to register.
    */
-  uint32_t line GNUNET_PACKED;
+  struct GNUNET_HashCode line_port;
 };
 
 
@@ -82,28 +97,54 @@ struct ClientPhoneRingMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Always zero.
+   * CID, internal caller ID number used in the future to identify
+   * which active call we are talking about.
    */
-  uint32_t reserved GNUNET_PACKED;
+  uint32_t cid GNUNET_PACKED;
 
   /**
    * Who is calling us?
    */
-  struct GNUNET_CRYPTO_EccPublicSignKey caller_id;
+  struct GNUNET_CRYPTO_EcdsaPublicKey caller_id;
+
+};
+
+
+/**
+ * Service <-> Client message for phone was suspended.
+ */
+struct ClientPhoneSuspendMessage
+{
+  /**
+   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * CID, internal caller ID to identify which active call we are
+   * talking about.
+   */
+  uint32_t cid GNUNET_PACKED;
 
 };
 
 
 /**
- * Service -> Client message for phone is busy.
+ * Service <-> Client message for phone was resumed.
  */
-struct ClientPhoneBusyMessage
+struct ClientPhoneResumeMessage
 {
   /**
-   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY
+   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME
    */
   struct GNUNET_MessageHeader header;
 
+  /**
+   * CID, internal caller ID to identify which active call we are
+   * talking about.
+   */
+  uint32_t cid GNUNET_PACKED;
+
 };
 
 
@@ -117,7 +158,11 @@ struct ClientPhonePickupMessage
    */
   struct GNUNET_MessageHeader header;
 
-  /* followed by variable length 0-terminated string with meta data */
+  /**
+   * CID, internal caller ID to identify which active call we are
+   * talking about.
+   */
+  uint32_t cid GNUNET_PACKED;
 
 };
 
@@ -133,13 +178,17 @@ struct ClientPhoneHangupMessage
    */
   struct GNUNET_MessageHeader header;
 
-  /* followed by variable length 0-terminated string with meta data */
+  /**
+   * CID, internal caller ID to identify which active call we are
+   * talking about.
+   */
+  uint32_t cid GNUNET_PACKED;
 
 };
 
 
 /**
- * Message Client <->Service to transmit the audio.
+ * Message Client <-> Service to transmit the audio.
  */
 struct ClientAudioMessage
 {
@@ -148,6 +197,12 @@ struct ClientAudioMessage
    */
   struct GNUNET_MessageHeader header;
 
+  /**
+   * CID, internal caller ID to identify which active call we are
+   * sending data to.
+   */
+  uint32_t cid GNUNET_PACKED;
+
   /* followed by audio data */
 
 };
@@ -164,19 +219,24 @@ struct ClientCallMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Which phone line to call at the peer?
+   * Always zero.
    */
-  uint32_t line GNUNET_PACKED;
+  uint32_t reserved GNUNET_PACKED;
 
   /**
    * Which peer is hosting the line?
    */
   struct GNUNET_PeerIdentity target;
 
+  /**
+   * Which phone line to call at the peer?
+   */
+  struct GNUNET_HashCode line_port;
+
   /**
    * Identity of the caller.
    */
-  struct GNUNET_CRYPTO_EccPrivateKey caller_id;
+  struct GNUNET_CRYPTO_EcdsaPrivateKey caller_id;
 };
 
 
@@ -191,99 +251,111 @@ struct ClientPhonePickedupMessage
    */
   struct GNUNET_MessageHeader header;
 
-  /* followed by variable length 0-terminated string with meta data */
+  /**
+   * Call ID of the corresponding
+   * #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
+   */
+  uint32_t cid GNUNET_PACKED;
 
 };
 
 
 /**
- * Mesh message for phone is ringing.
+ * Information signed in a `struct CadetPhoneRingMessage`
+ * whereby the caller self-identifies to the receiver.
  */
-struct MeshPhoneRingMessage
+struct CadetPhoneRingInfoPS
 {
   /**
-   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING
+   * Purpose for the signature, must be
+   * #GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING.
    */
-  struct GNUNET_MessageHeader header;
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
 
   /**
-   * Desired target line.
+   * Which port did the call go to?
    */
-  uint32_t remote_line GNUNET_PACKED;
+  struct GNUNET_HashCode line_port;
 
   /**
-   * Purpose for the signature.
+   * Which peer is the call for?
    */
-  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+  struct GNUNET_PeerIdentity target_peer;
 
   /**
-   * Who is calling us? (also who is signing).
+   * When does the signature expire?
    */
-  struct GNUNET_CRYPTO_EccPublicSignKey caller_id;
+  struct GNUNET_TIME_AbsoluteNBO expiration_time;
+};
+
 
+/**
+ * Cadet message to make a phone ring.  Sent to the port
+ * of the respective phone.
+ */
+struct CadetPhoneRingMessage
+{
   /**
-   * Who are we calling?
+   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING
    */
-  struct GNUNET_PeerIdentity target;
+  struct GNUNET_MessageHeader header;
 
   /**
-   * From where are we calling?
+   * Always zero.
    */
-  struct GNUNET_PeerIdentity source;
+  uint32_t reserved GNUNET_PACKED;
 
   /**
-   * When does the signature expire?
+   * Who is calling us? (also who is signing).
    */
-  struct GNUNET_TIME_AbsoluteNBO expiration_time;
+  struct GNUNET_CRYPTO_EcdsaPublicKey caller_id;
 
   /**
-   * Signature on the above.
+   * When does the signature expire?
    */
-  struct GNUNET_CRYPTO_EccSignature signature;
+  struct GNUNET_TIME_AbsoluteNBO expiration_time;
 
   /**
-   * Source line for audio data in the other direction.
+   * Signature over a `struct CadetPhoneRingInfoPS`
    */
-  uint32_t source_line GNUNET_PACKED;
+  struct GNUNET_CRYPTO_EcdsaSignature signature;
 
 };
 
 
 /**
- * Mesh message for hanging up.
+ * Cadet message for hanging up.
  */
-struct MeshPhoneHangupMessage
+struct CadetPhoneHangupMessage
 {
   /**
-   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP
+   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP
    */
   struct GNUNET_MessageHeader header;
 
-  /* followed by variable-size 0-terminated reason string */
 };
 
 
 /**
- * Mesh message for picking up.
+ * Cadet message for picking up.
  */
-struct MeshPhonePickupMessage
+struct CadetPhonePickupMessage
 {
   /**
-   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP
+   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP
    */
   struct GNUNET_MessageHeader header;
 
-  /* followed by variable-size 0-terminated metadata string */
 };
 
 
 /**
- * Mesh message for phone busy.
+ * Cadet message for phone suspended.
  */
-struct MeshPhoneBusyMessage
+struct CadetPhoneSuspendMessage
 {
   /**
-   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY
+   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND
    */
   struct GNUNET_MessageHeader header;
 
@@ -291,25 +363,35 @@ struct MeshPhoneBusyMessage
 
 
 /**
- * Mesh message to transmit the audio.
+ * Cadet message for phone resumed.
  */
-struct MeshAudioMessage
+struct CadetPhoneResumeMessage
 {
   /**
-   * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO
+   * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME
    */
   struct GNUNET_MessageHeader header;
 
+};
+
+
+/**
+ * Cadet message to transmit the audio.
+ */
+struct CadetAudioMessage
+{
   /**
-   * Target line on the receiving end.
+   * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO
    */
-  uint32_t remote_line;
+  struct GNUNET_MessageHeader header;
 
   /* followed by audio data */
 
 };
 
 
+GNUNET_NETWORK_STRUCT_END
+
 
 #if 0                          /* keep Emacsens' auto-indent happy */
 {