-fix logging, revert to break instead of assert
[oweals/gnunet.git] / src / core / core.h
index 37580bb826645fa9d3a5dbb981e1771681849804..9b1802fbc4284f8bb1301060c1e9df5558076d32 100644 (file)
  * @brief common internal definitions for core service
  * @author Christian Grothoff
  */
+#ifndef CORE_H
+#define CORE_H
+
 #include "gnunet_bandwidth_lib.h"
+#include "gnunet_transport_service.h"
 #include "gnunet_crypto_lib.h"
 #include "gnunet_time_lib.h"
 
 /**
  * General core debugging.
  */
-#define DEBUG_CORE GNUNET_NO
-
-/**
- * Debugging interaction core-clients.
- */
-#define DEBUG_CORE_CLIENT GNUNET_NO
+#define DEBUG_CORE GNUNET_EXTRA_LOGGING
 
 /**
  * Definition of bits in the InitMessage's options field that specify
@@ -44,8 +43,6 @@
  * transmitted to the client.
  */
 #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_STATUS_CHANGE  4
 #define GNUNET_CORE_OPTION_SEND_FULL_INBOUND   8
 #define GNUNET_CORE_OPTION_SEND_HDR_INBOUND   16
@@ -53,6 +50,8 @@
 #define GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND  64
 
 
+GNUNET_NETWORK_STRUCT_BEGIN
+
 /**
  * Message transmitted core clients to gnunet-service-core
  * to start the interaction.  This header is followed by
@@ -95,7 +94,7 @@ struct InitReplyMessage
   /**
    * Public key of the local peer.
    */
-  struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded publicKey;
+  struct GNUNET_PeerIdentity my_identity;
 
 };
 
@@ -113,7 +112,6 @@ struct ConnectNotifyMessage
 
   /**
    * Number of ATS key-value pairs that follow this struct
-   * (excluding the 0-terminator).
    */
   uint32_t ats_count GNUNET_PACKED;
 
@@ -122,12 +120,6 @@ struct ConnectNotifyMessage
    */
   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;
-
 };
 
 
@@ -172,7 +164,7 @@ struct PeerStatusNotifyMessage
    * First of the ATS information blocks (we must have at least
    * one due to the 0-termination requirement).
    */
-  struct GNUNET_TRANSPORT_ATS_Information ats;
+  struct GNUNET_ATS_Information ats;
 
 };
 
@@ -229,106 +221,11 @@ struct NotifyTrafficMessage
    */
   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;
-
-};
-
-
-/**
- * Message sent to the core asking for configuration
- * information and possibly preference changes.
- */
-struct RequestInfoMessage
-{
-  /**
-   * Header with type GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONFIGURE
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Unique request ID.
-   */
-  uint32_t rim_id GNUNET_PACKED;
-
-  /**
-   * Limit the number of bytes of outbound traffic to this
-   * peer to at most the specified amount (naturally, the
-   * amount is also limited by the receiving peer).
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO limit_outbound;
-
-  /**
-   * Number of bytes of inbound traffic to reserve, can
-   * be negative (to unreserve).  NBO.
-   */
-  int32_t reserve_inbound GNUNET_PACKED;
-
-  /**
-   * Increment the current traffic preference for the given peer by
-   * the specified amont.  The traffic preference is used to determine
-   * the share of bandwidth this peer will typcially be assigned.
-   */
-  uint64_t preference_change GNUNET_PACKED;
-
-  /**
-   * Identity of the peer being configured.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-};
-
-
-/**
- * Response from the core to a "RequestInfoMessage"
- * providing traffic status information for a peer.
- */
-struct ConfigurationInfoMessage
-{
-  /**
-   * Header with type GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Amount of traffic (inbound number of bytes) that was reserved in
-   * response to the configuration change request.  Negative for
-   * "unreserved" bytes.
-   */
-  int32_t reserved_amount GNUNET_PACKED;
-
-  /**
-   * 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.
+  /* Followed by ATS information blocks:
+   * struct GNUNET_ATS_Information ats[ats_count]
    */
-  struct GNUNET_TIME_RelativeNBO reserve_delay;
-
-  /**
-   * Unique request ID.
-   */
-  uint32_t rim_id GNUNET_PACKED;
-
-  /**
-   * Available bandwidth out for this peer,
-   * 0 if we have been disconnected.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bw_out;
-
-  /**
-   * Current traffic preference for the peer.
-   * 0 if we have been disconnected.
-   */
-  uint64_t preference;
-
-  /**
-   * Identity of the peer.
-   */
-  struct GNUNET_PeerIdentity peer;
 
+  /* Followed by payload (message or just header), variable size */
 };
 
 
@@ -360,9 +257,9 @@ struct SendMessageRequest
   struct GNUNET_PeerIdentity peer;
 
   /**
-   * How large is the client's message queue for this peer?
+   * Always zero.
    */
-  uint32_t queue_size GNUNET_PACKED;
+  uint32_t reserved GNUNET_PACKED;
 
   /**
    * How large is the message?
@@ -412,7 +309,7 @@ struct SendMessageReady
 
 /**
  * Client asking core to transmit a particular message to a particular
- * target (responsde to GNUNET_MESSAGE_TYPE_CORE_SEND_READY).
+ * target (response to GNUNET_MESSAGE_TYPE_CORE_SEND_READY).
  */
 struct SendMessage
 {
@@ -433,7 +330,7 @@ struct SendMessage
   struct GNUNET_TIME_AbsoluteNBO deadline;
 
   /**
-   * Identity of the receiver or sender.
+   * Identity of the intended receiver.
    */
   struct GNUNET_PeerIdentity peer;
 
@@ -450,31 +347,6 @@ struct SendMessage
 };
 
 
-/**
- * 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 ConnectMessage
-{
-  /**
-   * Header with type GNUNET_MESSAGE_TYPE_REQUEST_CONNECT or
-   * GNUNET_MESSAGE_TYPE_REQUEST_DISCONNECT.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * For alignment.
-   */
-  uint32_t reserved GNUNET_PACKED;
-
-  /**
-   * Identity of the other peer.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-};
-
+GNUNET_NETWORK_STRUCT_END
+#endif
 /* end of core.h */