add some extra GNS-record well-formedness checks if logging is enabled
[oweals/gnunet.git] / src / ats / ats.h
index d5d5d6c3f97e3a2d04b0f732f4b34454ec97d3e4..56117e5437342ec8f0e0b92693fd5d693998b585 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2010-2015 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2010-2015 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.
 */
 /**
  * @file ats/ats.h
@@ -27,6 +27,8 @@
 #define ATS_H
 
 #include "gnunet_util_lib.h"
+#include "gnunet_ats_service.h"
+
 
 /**
  * Flag used to indicate which type of client is connecting
@@ -80,7 +82,7 @@ struct ClientStartMessage
 
 
 /**
- * Scheduling client to ATS service: we would like to have
+ * Connectivity client to ATS service: we would like to have
  * address suggestions for this peer.
  */
 struct RequestAddressMessage
@@ -93,9 +95,9 @@ struct RequestAddressMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Always zero.
+   * How "strong" is our need for an address for this peer?
    */
-  uint32_t reserved GNUNET_PACKED;
+  uint32_t strength GNUNET_PACKED;
 
   /**
    * Peer to get address suggestions for.
@@ -105,7 +107,7 @@ struct RequestAddressMessage
 
 
 /**
- * ATS client to ATS service: here is another address you can use.
+ * Scheduling client to ATS service: here is another address you can use.
  */
 struct AddressAddMessage
 {
@@ -114,16 +116,6 @@ struct AddressAddMessage
    */
   struct GNUNET_MessageHeader header;
 
-  /**
-   * Length of the `struct GNUNET_ATS_Information` array that follows this struct.
-   */
-  uint32_t ats_count GNUNET_PACKED;
-
-  /**
-   * Identity of the peer that this address is for.
-   */
-  struct GNUNET_PeerIdentity peer;
-
   /**
    * Number of bytes in the address that follows this struct.
    */
@@ -134,6 +126,11 @@ struct AddressAddMessage
    */
   uint16_t plugin_name_length GNUNET_PACKED;
 
+  /**
+   * Identity of the peer that this address is for.
+   */
+  struct GNUNET_PeerIdentity peer;
+
   /**
    * Internal number this client will henceforth use to
    * refer to this address.
@@ -146,8 +143,12 @@ struct AddressAddMessage
    */
   uint32_t address_local_info GNUNET_PACKED;
 
+  /**
+   * Performance properties of the address.
+   */
+  struct GNUNET_ATS_PropertiesNBO properties;
+
   /* followed by:
-   * - struct GNUNET_ATS_Information [ats_count];
    * - char address[address_length]
    * - char plugin_name[plugin_name_length] (including '\0'-termination).
    */
@@ -167,9 +168,9 @@ struct AddressUpdateMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Length of the `struct GNUNET_ATS_Information` array that follows.
+   * Internal number this client uses to refer to this address.
    */
-  uint32_t ats_count GNUNET_PACKED;
+  uint32_t session_id GNUNET_PACKED;
 
   /**
    * Which peer is this about? (Technically redundant, as the
@@ -179,13 +180,9 @@ struct AddressUpdateMessage
   struct GNUNET_PeerIdentity peer;
 
   /**
-   * Internal number this client uses to refer to this address.
-   */
-  uint32_t session_id GNUNET_PACKED;
-
-  /* followed by:
-   * - struct GNUNET_ATS_Information [ats_count];
+   * Performance properties of the address.
    */
+  struct GNUNET_ATS_PropertiesNBO properties;
 
 };
 
@@ -221,7 +218,7 @@ struct AddressDestroyedMessage
  * Message sent by ATS service to client to confirm that it is done
  * using the given session ID.
  */
-struct SessionReleaseMessage
+struct GNUNET_ATS_SessionReleaseMessage
 {
   /**
    * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE.
@@ -294,17 +291,12 @@ struct PeerInformationMessage
   /**
    *
    */
-  uint32_t ats_count GNUNET_PACKED;
-
-  /**
-   *
-   */
-  uint32_t address_active GNUNET_PACKED;
+  uint16_t address_length GNUNET_PACKED;
 
   /**
    *
    */
-  uint32_t id GNUNET_PACKED;
+  uint16_t plugin_name_length GNUNET_PACKED;
 
   /**
    *
@@ -314,12 +306,12 @@ struct PeerInformationMessage
   /**
    *
    */
-  uint16_t address_length GNUNET_PACKED;
+  uint32_t address_active GNUNET_PACKED;
 
   /**
    *
    */
-  uint16_t plugin_name_length GNUNET_PACKED;
+  uint32_t id GNUNET_PACKED;
 
   /**
    *
@@ -331,8 +323,18 @@ struct PeerInformationMessage
    */
   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
 
+  /**
+   * Performance properties of the address.
+   */
+  struct GNUNET_ATS_PropertiesNBO properties;
+
+  /**
+   * Local-only information of the address, see
+   * `enum GNUNET_HELLO_AddressInfo`.
+   */
+  uint32_t address_local_info GNUNET_PACKED;
+
   /* followed by:
-   * - struct GNUNET_ATS_Information [ats_count];
    * - char address[address_length]
    * - char plugin_name[plugin_name_length] (including '\0'-termination).
    */