dbg-only
[oweals/gnunet.git] / src / core / core.h
index fe8bcf9ccf6ae19a148cfcf2ae42e7c5eb267186..3a313a292c46eb8103d6c0d7079796a0b5c0892e 100644 (file)
 #define GNUNET_CORE_OPTION_NOTHING             0
 #define GNUNET_CORE_OPTION_SEND_CONNECT        1
 #define GNUNET_CORE_OPTION_SEND_DISCONNECT     2
-#define GNUNET_CORE_OPTION_SEND_BFC            4
-#define GNUNET_CORE_OPTION_SEND_FULL_INBOUND   8
-#define GNUNET_CORE_OPTION_SEND_HDR_INBOUND   16
-#define GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND 32
-#define GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND  64
+#define GNUNET_CORE_OPTION_SEND_FULL_INBOUND   4
+#define GNUNET_CORE_OPTION_SEND_HDR_INBOUND    8
+#define GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND 16
+#define GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND  32
 
 
 /**
@@ -112,23 +111,44 @@ struct ConnectNotifyMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Available bandwidth to this peer; zero for disconnect.
-   * [TODO: currently set to hard-coded constant and hence
-   * not really useful, right?]
+   * Distance to the peer.
    */
-  uint32_t bpm_available GNUNET_PACKED;
+  uint32_t distance GNUNET_PACKED;
+
+  /**
+   * Currently observed latency.
+   */
+  struct GNUNET_TIME_RelativeNBO latency;
 
   /**
    * Identity of the connecting peer.
    */
   struct GNUNET_PeerIdentity peer;
 
+};
+
+
+
+/**
+ * Message sent by the service to clients to notify them
+ * about a peer disconnecting.
+ */
+struct DisconnectNotifyMessage
+{
+  /**
+   * Header with type GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT.
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Always zero.
+   */
+  uint32_t reserved GNUNET_PACKED;
+
   /**
-   * Time of our last interaction with the peer; close
-   * to "now" for connect messages.
-   * [TODO: is this useful?]
+   * Identity of the connecting peer.
    */
-  struct GNUNET_TIME_AbsoluteNBO last_activity;
+  struct GNUNET_PeerIdentity peer;
 
 };
 
@@ -152,9 +172,14 @@ struct NotifyTrafficMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Always zero.
+   * Distance to the peer.
    */
-  uint32_t reserved GNUNET_PACKED;
+  uint32_t distance GNUNET_PACKED;
+
+  /**
+   * Currently observed latency.
+   */
+  struct GNUNET_TIME_RelativeNBO latency;
 
   /**
    * Identity of the receiver or sender.
@@ -168,7 +193,7 @@ struct NotifyTrafficMessage
  * Message sent to the core asking for configuration
  * information and possibly preference changes.
  */
-struct RequestConfigureMessage
+struct RequestInfoMessage
 {
   /**
    * Header with type GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONFIGURE
@@ -185,7 +210,7 @@ struct RequestConfigureMessage
    * peer to at most the specified amount (naturally, the
    * amount is also limited by the receiving peer).
    */
-  uint32_t limit_outbound_bpm GNUNET_PACKED;
+  struct GNUNET_BANDWIDTH_Value32NBO limit_outbound;
 
   /**
    * Number of bytes of inbound traffic to reserve, can
@@ -198,7 +223,7 @@ struct RequestConfigureMessage
    * the specified amont.  The traffic preference is used to determine
    * the share of bandwidth this peer will typcially be assigned.
    */
-  double preference_change GNUNET_PACKED;
+  uint64_t preference_change GNUNET_PACKED;
 
   /**
    * Identity of the peer being configured.
@@ -209,7 +234,7 @@ struct RequestConfigureMessage
 
 
 /**
- * Response from the core to a "RequestConfigureMessage"
+ * Response from the core to a "RequestInfoMessage"
  * providing traffic status information for a peer.
  */
 struct ConfigurationInfoMessage
@@ -227,28 +252,22 @@ struct ConfigurationInfoMessage
   int32_t reserved_amount GNUNET_PACKED;
 
   /**
-   * Available bandwidth in (in bytes per minute) for this peer.
+   * Available bandwidth in for this peer.
    * 0 if we have been disconnected.
    */
-  uint32_t bpm_in GNUNET_PACKED;
+  struct GNUNET_BANDWIDTH_Value32NBO bw_in;
 
   /**
-   * Available bandwidth out (in bytes per minute) for this peer,
+   * Available bandwidth out for this peer,
    * 0 if we have been disconnected.
    */
-  uint32_t bpm_out GNUNET_PACKED;
-
-  /**
-   * Latest transport latency estimate for the peer.
-   * FOREVER if we have been disconnected.
-   */
-  struct GNUNET_TIME_RelativeNBO latency;
+  struct GNUNET_BANDWIDTH_Value32NBO bw_out;
 
   /**
    * Current traffic preference for the peer.
    * 0 if we have been disconnected.
    */
-  double preference;
+  uint64_t preference;
 
   /**
    * Identity of the receiver or sender.
@@ -259,21 +278,26 @@ struct ConfigurationInfoMessage
 
 
 /**
- * Core asking a client to generate traffic for a particular
- * target.
+ * Client asking core to transmit a particular message to
+ * a particular target.  
  */
-struct SolicitTrafficMessage
+struct SendMessage
 {
   /**
-   * Header with type GNUNET_MESSAGE_TYPE_CORE_SOLICIT_TRAFFIC
-   * or GNUNET_MESSAGE_TYPE_CORE_RECV_OK
+   * Header with type GNUNET_MESSAGE_TYPE_CORE_SEND
    */
   struct GNUNET_MessageHeader header;
 
   /**
-   * Number of bytes of traffic being solicited.
+   * How important is this message?
    */
-  uint32_t solicit_size GNUNET_PACKED;
+  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 receiver or sender.
@@ -284,33 +308,35 @@ struct SolicitTrafficMessage
 
 
 /**
- * Client asking core to transmit a particular message to
- * a particular target.  Does NOT have to be solicited.
+ * Client asking core to connect to a particular target.  There is no
+ * response from the core to this type of request (however, if an
+ * actual connection is created or destroyed, be it because of this
+ * type request or not, the core generally needs to notify the
+ * clients).
  */
-struct SendMessage
+struct ConnectMessage
 {
   /**
-   * Header with type GNUNET_MESSAGE_TYPE_CORE_SEND
+   * Header with type GNUNET_MESSAGE_TYPE_REQUEST_CONNECT or
+   * GNUNET_MESSAGE_TYPE_REQUEST_DISCONNECT.
    */
   struct GNUNET_MessageHeader header;
 
   /**
-   * How important is this message?
+   * For alignment.
    */
-  uint32_t priority GNUNET_PACKED;
+  uint32_t reserved GNUNET_PACKED;
 
   /**
-   * By what time would the sender really like to see this
-   * message transmitted?
+   * When to time out.
    */
-  struct GNUNET_TIME_AbsoluteNBO deadline;
+  struct GNUNET_TIME_RelativeNBO timeout;
 
   /**
-   * Identity of the receiver or sender.
+   * Identity of the other peer.
    */
   struct GNUNET_PeerIdentity peer;
 
 };
 
-
 /* end of core.h */