check
[oweals/gnunet.git] / src / core / core.h
index 021aa4184f532b46da7e6e3366c0e031402cdc4c..8a8962124fdbd1ec37085e8a4f45b8f9e8150cb1 100644 (file)
@@ -112,19 +112,21 @@ struct ConnectNotifyMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Distance to the peer.
+   * Number of ATS key-value pairs that follow this struct
+   * (excluding the 0-terminator).
    */
-  uint32_t distance GNUNET_PACKED;
+  uint32_t ats_count GNUNET_PACKED;
 
   /**
-   * Currently observed latency.
+   * Identity of the connecting peer.
    */
-  struct GNUNET_TIME_RelativeNBO latency;
+  struct GNUNET_PeerIdentity peer;
 
   /**
-   * Identity of the connecting peer.
+   * First of the ATS information blocks (we must have at least
+   * one due to the 0-termination requirement).
    */
-  struct GNUNET_PeerIdentity peer;
+  struct GNUNET_TRANSPORT_ATS_Information ats;
 
 };
 
@@ -141,14 +143,10 @@ struct PeerStatusNotifyMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Distance to the peer.
+   * Number of ATS key-value pairs that follow this struct
+   * (excluding the 0-terminator).
    */
-  uint32_t distance GNUNET_PACKED;
-
-  /**
-   * Currently observed latency.
-   */
-  struct GNUNET_TIME_RelativeNBO latency;
+  uint32_t ats_count GNUNET_PACKED;
 
   /**
    * When the peer would time out (unless we see activity)
@@ -170,6 +168,12 @@ struct PeerStatusNotifyMessage
    */
   struct GNUNET_PeerIdentity peer;
 
+  /**
+   * First of the ATS information blocks (we must have at least
+   * one due to the 0-termination requirement).
+   */
+  struct GNUNET_TRANSPORT_ATS_Information ats;
+
 };
 
 
@@ -197,7 +201,6 @@ struct DisconnectNotifyMessage
 };
 
 
-
 /**
  * Message sent by the service to clients to notify them about
  * messages being received or transmitted.  This overall message is
@@ -216,19 +219,21 @@ struct NotifyTrafficMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Distance to the peer.
+   * Number of ATS key-value pairs that follow this struct
+   * (excluding the 0-terminator).
    */
-  uint32_t distance GNUNET_PACKED;
+  uint32_t ats_count GNUNET_PACKED;
 
   /**
-   * Currently observed latency.
+   * Identity of the receiver or sender.
    */
-  struct GNUNET_TIME_RelativeNBO latency;
+  struct GNUNET_PeerIdentity peer;
 
   /**
-   * Identity of the receiver or sender.
+   * First of the ATS information blocks (we must have at least
+   * one due to the 0-termination requirement).
    */
-  struct GNUNET_PeerIdentity peer;
+  struct GNUNET_TRANSPORT_ATS_Information ats;
 
 };
 
@@ -245,9 +250,9 @@ struct RequestInfoMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Always zero.
+   * Unique request ID.
    */
-  uint32_t reserved GNUNET_PACKED;
+  uint32_t rim_id GNUNET_PACKED;
 
   /**
    * Limit the number of bytes of outbound traffic to this
@@ -296,10 +301,16 @@ struct ConfigurationInfoMessage
   int32_t reserved_amount GNUNET_PACKED;
 
   /**
-   * Available bandwidth in for this peer.
-   * 0 if we have been disconnected.
+   * If the reservation request could not be satisfied (reserved_amount
+   * was zero), how long should the client wait until retrying? 0 if
+   * bandwidth was reserved.
+   */
+  struct GNUNET_TIME_RelativeNBO reserve_delay;
+
+  /**
+   * Unique request ID.
    */
-  struct GNUNET_BANDWIDTH_Value32NBO bw_in;
+  uint32_t rim_id GNUNET_PACKED;
 
   /**
    * Available bandwidth out for this peer,
@@ -314,7 +325,7 @@ struct ConfigurationInfoMessage
   uint64_t preference;
 
   /**
-   * Identity of the receiver or sender.
+   * Identity of the peer.
    */
   struct GNUNET_PeerIdentity peer;
 
@@ -322,8 +333,86 @@ struct ConfigurationInfoMessage
 
 
 /**
- * Client asking core to transmit a particular message to
- * a particular target.  
+ * Client notifying core about the maximum-priority
+ * message it has in the queue for a particular target.
+ */
+struct SendMessageRequest
+{
+  /**
+   * Header with type GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * How important is this message?
+   */
+  uint32_t priority GNUNET_PACKED;
+
+  /**
+   * By what time would the sender really like to see this
+   * message transmitted?
+   */
+  struct GNUNET_TIME_AbsoluteNBO deadline;
+
+  /**
+   * Identity of the intended target.
+   */
+  struct GNUNET_PeerIdentity peer;
+
+  /**
+   * How large is the client's message queue for this peer?
+   */
+  uint32_t queue_size GNUNET_PACKED;
+
+  /**
+   * How large is the message?
+   */
+  uint16_t size GNUNET_PACKED;
+
+  /**
+   * Counter for this peer to match SMRs to replies.
+   */
+  uint16_t smr_id GNUNET_PACKED;
+
+};
+
+
+/**
+ * Core notifying client that it is allowed to now 
+ * transmit a message to the given target
+ * (response to GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST).
+ */
+struct SendMessageReady
+{
+  /**
+   * Header with type GNUNET_MESSAGE_TYPE_CORE_SEND_READY
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * How many bytes are allowed for transmission? 
+   * Guaranteed to be at least as big as the requested size,
+   * or ZERO if the request is rejected (will timeout, 
+   * peer disconnected, queue full, etc.).
+   */
+  uint16_t size GNUNET_PACKED;
+
+  /**
+   * smr_id from the request.
+   */
+  uint16_t smr_id GNUNET_PACKED;
+
+  /**
+   * Identity of the intended target.
+   */
+  struct GNUNET_PeerIdentity peer;
+
+};
+
+
+/**
+ * Client asking core to transmit a particular message to a particular
+ * target (responsde to GNUNET_MESSAGE_TYPE_CORE_SEND_READY).
  */
 struct SendMessage
 {
@@ -348,6 +437,16 @@ struct SendMessage
    */
   struct GNUNET_PeerIdentity peer;
 
+  /**
+   * GNUNET_YES if corking is allowed, GNUNET_NO if not.
+   */
+  uint32_t cork GNUNET_PACKED;
+
+  /**
+   * Always 0.
+   */
+  uint64_t reserved GNUNET_PACKED;
+
 };