#include "gnunet_hello_lib.h"
+enum GNUNET_ATS_Network_Type
+{
+ GNUNET_ATS_NET_UNSPECIFIED = 0,
+ GNUNET_ATS_NET_LOOPBACK = 1,
+ GNUNET_ATS_NET_LAN = 2,
+ GNUNET_ATS_NET_WAN = 3,
+ GNUNET_ATS_NET_WLAN = 4,
+};
+
/**
* Enum defining all known property types for ATS Enum values are used
* in the GNUNET_ATS_Information struct as
*/
GNUNET_ATS_UTILIZATION_DOWN,
+ /**
+ * Is this address located in WAN, LAN or a loopback address
+ * Value is element of GNUNET_ATS_Network_Type
+ */
+ GNUNET_ATS_NETWORK_TYPE,
+
/**
* Delay
* Time between when the time packet is sent and the packet arrives
// GNUNET_ATS_AVAILABILITY_CONNECTED = 2049
};
+/**
+ * Number of ATS quality properties
+ */
+#define GNUNET_ATS_QualityPropertiesCount 2
+
+/**
+ * ATS quality properties as array initializer
+ */
+#define GNUNET_ATS_QualityProperties {GNUNET_ATS_QUALITY_NET_DELAY, GNUNET_ATS_QUALITY_NET_DISTANCE}
+
+/**
+ * Number of ATS quality properties
+ */
+#define GNUNET_ATS_NetworkTypeCount 5
+
+/**
+ * ATS quality properties as array initializer
+ */
+#define GNUNET_ATS_NetworkType {GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_LOOPBACK, GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN}
+
+GNUNET_NETWORK_STRUCT_BEGIN
/**
* struct used to communicate the transport's properties like cost and
*/
uint32_t value GNUNET_PACKED;
};
-
+GNUNET_NETWORK_STRUCT_END
/* ******************************** Scheduling API ***************************** */
* @param ats_count number of performance records in 'ats'
*/
typedef void (*GNUNET_ATS_AddressSuggestionCallback) (void *cls,
- const struct GNUNET_HELLO_Address *address,
+ const struct
+ GNUNET_HELLO_Address *
+ address,
struct Session * session,
struct
GNUNET_BANDWIDTH_Value32NBO
GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh);
+/**
+ * We would like to reset the address suggestion block time for this
+ * peer
+ *
+ * @param sh handle
+ * @param peer identity of the peer we want to reset
+ */
+void
+GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh,
+ const struct GNUNET_PeerIdentity *peer);
+
/**
* We would like to establish a new connection with a peer. ATS
* should suggest a good address to begin with.
const struct GNUNET_PeerIdentity *peer);
+/**
+ * We want to cancel ATS suggesting addresses for a peer.
+ *
+ * @param sh handle
+ * @param peer identity of the peer
+ */
+void
+GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh,
+ const struct GNUNET_PeerIdentity *peer);
+
+
+/**
+ * Returns where the address is located: LAN or WAN or ...
+ * @param sh the GNUNET_ATS_SchedulingHandle handle
+ * @param addr address
+ * @param addrlen address length
+ * @return location as GNUNET_ATS_Information
+ */
+struct GNUNET_ATS_Information
+GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh,
+ const struct sockaddr * addr,
+ socklen_t addrlen);
+
+/**
+ * We have a new address ATS should know. Addresses have to be added with this
+ * function before they can be: updated, set in use and destroyed
+ *
+ * @param sh handle
+ * @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'
+ */
+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);
+
+
/**
* We have updated performance statistics for a given address. Note
* that this function can be called for addresses that are currently
*/
void
GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
- const struct GNUNET_HELLO_Address *address,
+ const struct GNUNET_HELLO_Address *address,
struct Session *session,
const struct GNUNET_ATS_Information *ats,
uint32_t ats_count);
void
GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
- int in_use);
+ struct Session *session, int in_use);
+
/**
* A session got destroyed, stop including it as a valid address.
void
GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh,
const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct Session *session);
/* ******************************** Performance API ***************************** */
* @param ats_count number of performance records in 'ats'
*/
typedef void (*GNUNET_ATS_PeerInformationCallback) (void *cls,
- const struct GNUNET_HELLO_Address *address,
+ const struct
+ GNUNET_HELLO_Address *
+ address,
struct
GNUNET_BANDWIDTH_Value32NBO
bandwidth_out,