use -Wl on -no-undefined as it is a linker option:
[oweals/gnunet.git] / src / include / gnunet_ats_service.h
index 710e14a1143f74b76e957a3c2d5a55f2f6b2a73f..932446400a73be4e26682ac7c2581e325fc0df6a 100644 (file)
@@ -83,12 +83,12 @@ enum GNUNET_ATS_Network_Type
 /**
  * Number of property types supported by ATS
  */
-#define GNUNET_ATS_PropertyCount 9
+#define GNUNET_ATS_PropertyCount 11
 
 /**
  * ATS properties types as string array initializer
  */
-#define GNUNET_ATS_PropertyStrings {"TERMINATOR", "UTILIZATION_UP", "UTILIZATION_DOWN", "NETWORK_TYPE", "DELAY", "DISTANCE", "COST_WAN", "COST_LAN", "COST_WLAN"}
+#define GNUNET_ATS_PropertyStrings {"TERMINATOR", "UTILIZATION_UP", "UTILIZATION_DOWN", "UTILIZATION_PAYLOAD_UP", "UTILIZATION_PAYLOAD_DOWN", "NETWORK_TYPE", "DELAY", "DISTANCE", "COST_WAN", "COST_LAN", "COST_WLAN"}
 
 /**
  * Enum defining all known property types for ATS Enum values are used
@@ -109,19 +109,38 @@ enum GNUNET_ATS_Property
    */
   GNUNET_ATS_ARRAY_TERMINATOR = 0,
 
+  /**
+   * Actual traffic on this connection from this peer to the other peer.
+   * Includes transport overhead
+   *
+   * Unit: [bytes/second]
+   */
+  GNUNET_ATS_UTILIZATION_OUT,
+
   /**
    * Actual traffic on this connection from the other peer to this peer.
+   * Includes transport overhead
    *
    * Unit: [bytes/second]
    */
-  GNUNET_ATS_UTILIZATION_UP,
+  GNUNET_ATS_UTILIZATION_IN,
+
 
   /**
    * Actual traffic on this connection from this peer to the other peer.
+   * Only payload from layers > transport
    *
    * Unit: [bytes/second]
    */
-  GNUNET_ATS_UTILIZATION_DOWN,
+  GNUNET_ATS_UTILIZATION_PAYLOAD_OUT,
+
+  /**
+   * Actual traffic on this connection from the other peer to this peer.
+   * Only payload from layers > transport
+   *
+   * Unit: [bytes/second]
+   */
+  GNUNET_ATS_UTILIZATION_PAYLOAD_IN,
 
   /**
    * Is this address located in WAN, LAN or a loopback address
@@ -512,7 +531,6 @@ struct GNUNET_ATS_SchedulingHandle;
 
 /**
  * Handle for address suggestion requests
- *
  */
 struct GNUNET_ATS_SuggestHandle;
 
@@ -525,20 +543,27 @@ struct Session;
  * Signature of a function called by ATS with the current bandwidth
  * and address preferences as determined by ATS.
  *
+ * If an address is available immediately the address will be included. If no
+ * address can be suggested, address, session, bandwidth and ATS information will
+ * be NULL/0. ATS will suggest an address as soon as it can provide such an
+ * address
+ *
  * @param cls closure
  * @param address suggested address (including peer identity of the peer)
  * @param session session to use
  * @param bandwidth_out assigned outbound bandwidth for the connection
  * @param bandwidth_in assigned inbound bandwidth for the connection
  * @param ats performance data for the address (as far as known)
- * @param ats_count number of performance records in 'ats'
+ * @param ats_count number of performance records in @a ats
  */
 typedef void
 (*GNUNET_ATS_AddressSuggestionCallback) (void *cls,
-    const struct GNUNET_HELLO_Address * address, struct Session * session,
+    const struct GNUNET_PeerIdentity *peer,
+    const struct GNUNET_HELLO_Address *address, struct Session *session,
     struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
     struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-    const struct GNUNET_ATS_Information * ats, uint32_t ats_count);
+    const struct GNUNET_ATS_Information *ats, uint32_t ats_count);
+
 
 /**
  * Initialize the ATS subsystem.
@@ -569,7 +594,8 @@ GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh);
  */
 void
 GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_PeerIdentity *peer);
+                          const struct GNUNET_PeerIdentity *peer);
+
 
 /**
  * We would like to establish a new connection with a peer.  ATS
@@ -577,11 +603,16 @@ GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh,
  *
  * @param sh handle
  * @param peer identity of the peer we need an address for
+ * @param cont the continuation to indicate success to call with the address
+ * @param cont_cls the cls for the continuation
  * @return suggestion handle
  */
 struct GNUNET_ATS_SuggestHandle *
 GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_PeerIdentity *peer);
+                            const struct GNUNET_PeerIdentity *peer,
+                            GNUNET_ATS_AddressSuggestionCallback cont,
+                            void *cont_cls);
+
 
 /**
  * We want to cancel ATS suggesting addresses for a peer.
@@ -591,7 +622,8 @@ GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh,
  */
 void
 GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_PeerIdentity *peer);
+                                   const struct GNUNET_PeerIdentity *peer);
+
 
 /**
  * Convert a ATS property to a string
@@ -602,6 +634,7 @@ GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh,
 const char *
 GNUNET_ATS_print_property_type (uint32_t type);
 
+
 /**
  * Convert a GNUNET_ATS_NetworkType to a string
  *
@@ -611,6 +644,7 @@ GNUNET_ATS_print_property_type (uint32_t type);
 const char *
 GNUNET_ATS_print_network_type (uint32_t net);
 
+
 /**
  * Returns where the address is located: LAN or WAN or ...
  * @param sh the GNUNET_ATS_SchedulingHandle handle
@@ -620,7 +654,9 @@ GNUNET_ATS_print_network_type (uint32_t net);
  */
 struct GNUNET_ATS_Information
 GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct sockaddr * addr, socklen_t addrlen);
+                             const struct sockaddr * addr,
+                             socklen_t addrlen);
+
 
 /**
  * Test if a address and a session is known to ATS
@@ -628,11 +664,13 @@ GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh,
  * @param sh the scheduling handle
  * @param address the address
  * @param session the session
- * @return GNUNET_YES or GNUNET_NO
+ * @return #GNUNET_YES or #GNUNET_NO
  */
 int
 GNUNET_ATS_session_known (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_HELLO_Address *address, struct Session *session);
+                          const struct GNUNET_HELLO_Address *address,
+                          struct Session *session);
+
 
 /**
  * We have a new address ATS should know. Addresses have to be added with this
@@ -642,12 +680,15 @@ GNUNET_ATS_session_known (struct GNUNET_ATS_SchedulingHandle *sh,
  * @param address the address
  * @param session session handle (if available)
  * @param ats performance data for the address
- * @param ats_count number of performance records in 'ats'
+ * @param ats_count number of performance records in @a ats
  */
 int
 GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_HELLO_Address *address, struct Session *session,
-    const struct GNUNET_ATS_Information *ats, uint32_t ats_count);
+                        const struct GNUNET_HELLO_Address *address,
+                        struct Session *session,
+                        const struct GNUNET_ATS_Information *ats,
+                        uint32_t ats_count);
+
 
 /**
  * We have updated performance statistics for a given address.  Note
@@ -661,13 +702,16 @@ GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
  * @param address updated address
  * @param session session handle (if available)
  * @param ats performance data for the address
- * @param ats_count number of performance records in 'ats'
- * @return GNUNET_OK or GNUNET_SYSERR
+ * @param ats_count number of performance records in @a ats
+ * @return #GNUNET_OK or #GNUNET_SYSERR
  */
 int
 GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_HELLO_Address *address, struct Session *session,
-    const struct GNUNET_ATS_Information *ats, uint32_t ats_count);
+                           const struct GNUNET_HELLO_Address *address,
+                           struct Session *session,
+                           const struct GNUNET_ATS_Information *ats,
+                           uint32_t ats_count);
+
 
 /**
  * An address is now in use or not used any more.
@@ -675,13 +719,15 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
  * @param sh handle
  * @param address the address
  * @param session session handle
- * @param in_use GNUNET_YES if this address is now used, GNUNET_NO
+ * @param in_use #GNUNET_YES if this address is now used, #GNUNET_NO
  * if address is not used any more
  */
 void
 GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_HELLO_Address *address, struct Session *session,
-    int in_use);
+                           const struct GNUNET_HELLO_Address *address,
+                           struct Session *session,
+                           int in_use);
+
 
 /**
  * A session got destroyed, stop including it as a valid address.
@@ -692,7 +738,9 @@ GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
  */
 void
 GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_HELLO_Address *address, struct Session *session);
+                              const struct GNUNET_HELLO_Address *address,
+                              struct Session *session);
+
 
 /* ******************************** Performance API ***************************** */