2 This file is part of GNUnet.
3 (C) 2010,2011 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file include/gnunet_ats_service.h
22 * @brief automatic transport selection and outbound bandwidth determination
23 * @author Christian Grothoff
24 * @author Matthias Wachs
26 #ifndef GNUNET_ATS_SERVICE_H
27 #define GNUNET_ATS_SERVICE_H
29 #include "gnunet_constants.h"
30 #include "gnunet_util_lib.h"
31 #include "gnunet_hello_lib.h"
34 * Number of network types supported by ATS
36 #define GNUNET_ATS_NetworkTypeCount 6
39 * ATS network types as array initializer
41 #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_ATS_NET_BT}
44 * ATS network types as string array initializer
46 #define GNUNET_ATS_NetworkTypeString {"UNSPECIFIED", "LOOPBACK", "LAN", "WAN", "WLAN", "BLUETOOTH"}
48 enum GNUNET_ATS_Network_Type
50 GNUNET_ATS_NET_UNSPECIFIED = 0,
51 GNUNET_ATS_NET_LOOPBACK = 1,
52 GNUNET_ATS_NET_LAN = 2,
53 GNUNET_ATS_NET_WAN = 3,
54 GNUNET_ATS_NET_WLAN = 4,
59 * Default bandwidth assigned to a network : 64 KB/s
61 #define GNUNET_ATS_DefaultBandwidth 65536
64 * Undefined value for a GNUNET_ATS_Property
66 #define GNUNET_ATS_VALUE_UNDEFINED UINT32_MAX
69 * String representation for GNUNET_ATS_VALUE_UNDEFINED
71 #define GNUNET_ATS_VALUE_UNDEFINED_STR "undefined"
74 * Maximum bandwidth assigned to a network : 4095 MB/s
76 #define GNUNET_ATS_MaxBandwidth UINT32_MAX
79 * Textual equivalent for GNUNET_ATS_MaxBandwidth
81 #define GNUNET_ATS_MaxBandwidthString "unlimited"
84 * Number of property types supported by ATS
86 #define GNUNET_ATS_PropertyCount 9
89 * ATS properties types as string array initializer
91 #define GNUNET_ATS_PropertyStrings {"TERMINATOR", "UTILIZATION_UP", "UTILIZATION_DOWN", "NETWORK_TYPE", "DELAY", "DISTANCE", "COST_WAN", "COST_LAN", "COST_WLAN"}
94 * Enum defining all known property types for ATS Enum values are used
95 * in the GNUNET_ATS_Information struct as
98 * Cost are always stored in uint32_t, so all units used to define costs
99 * have to be normalized to fit in uint32_t [0 .. UINT32_MAX-1]
101 * UINT32_MAX is reserved for uninitialized values GNUNET_ATS_VALUE_UNDEFINED
103 enum GNUNET_ATS_Property
110 GNUNET_ATS_ARRAY_TERMINATOR = 0,
113 * Actual traffic on this connection from the other peer to this peer.
115 * Unit: [bytes/second]
117 GNUNET_ATS_UTILIZATION_UP,
120 * Actual traffic on this connection from this peer to the other peer.
122 * Unit: [bytes/second]
124 GNUNET_ATS_UTILIZATION_DOWN,
127 * Is this address located in WAN, LAN or a loopback address
128 * Value is element of GNUNET_ATS_Network_Type
130 GNUNET_ATS_NETWORK_TYPE,
134 * Time between when the time packet is sent and the packet arrives
136 * Unit: [microseconds]
144 GNUNET_ATS_QUALITY_NET_DELAY,
147 * Distance on network layer (required for distance-vector routing).
151 GNUNET_ATS_QUALITY_NET_DISTANCE,
154 * Network overhead on WAN (Wide-Area Network)
156 * How many bytes are sent on the WAN when 1 kilobyte (1024 bytes)
157 * of application data is transmitted?
158 * A factor used with connect cost, bandwidth cost and energy cost
159 * to describe the overhead produced by the transport protocol
163 * Interpretation: less is better
167 * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb]
168 * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb]
169 * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb]
170 * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb]
175 * Network overhead on LAN (Local-Area Network)
177 * How many bytes are sent on the LAN when 1 kilobyte (1024 bytes)
178 * of application data is transmitted?
179 * A factor used with connect cost, bandwidth cost and energy cost
180 * to describe the overhead produced by the transport protocol
184 * Interpretation: less is better
188 * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb]
189 * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb]
190 * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb]
191 * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb]
196 * Network overhead on WLAN (Wireless Local Area Network)
198 * How many bytes are sent on the LAN when 1 kilobyte (1024 bytes)
199 * of application data is transmitted?
200 * A factor used with connect cost, bandwidth cost and energy cost
201 * to describe the overhead produced by the transport protocol
205 * Interpretation: less is better
209 * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb]
210 * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb]
211 * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb]
212 * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb]
215 /* Cost related values */
216 /* =================== */
218 * Volume based cost in financial units to transmit data
220 * Note: This value is not bound to a specific currency or unit and only
222 * "cent" just refers the smallest amount of money in the respective
227 * Interpretation: less is better
233 // GNUNET_ATS_COST_FINANCIAL_PER_VOLUME = 1,
235 * Time based cost in financial units to transmit data
237 * Note: This value is not bound to a specific currency or unit and only
239 * "cent" just refers the smallest amount of money in the respective
244 * Interpretation: less is better
248 * Dialup: 10 [cent/h]
250 // GNUNET_ATS_COST_FINANCIAL_PER_TIME = 2,
252 * Computational costs
254 * Effort of preparing data to be sent with this transport
255 * Includes encoding, encryption and conversion of data
256 * Partial values can be summed up: c_sum = c_enc + c_enc + c_conv
257 * Resulting values depend on local system properties, e.g. CPU
261 * Interpretation: less is better
265 * HTTPS with AES CBC-256: 7,382
266 * HTTPS with AES CBC-128: 5,279
267 * HTTPS with RC4-1024: 2,652
269 // GNUNET_ATS_COST_COMPUTATIONAL = 3,
273 * Energy consumption using this transport when sending with a certain
274 * power at a certain bitrate. This is only an approximation based on:
275 * Energy consumption E = P / D
278 * Power P in Watt (J/s)
279 * Datarate D in MBit/s
281 * Conversion between power P and dBm used by WLAN in radiotap's dBm TX power:
283 * Lp(dbm) = 10 log10 (P/ 1mW)
285 * => P = 1 mW * 10^(Lp(dbm)/10)
289 * Interpretation: less is better
294 * WLAN: 89 (600 mW @ 802.11g /w 54 MBit/s)
295 * Bluetooth: 267 (100 mW @ BT2.0 EDR /w 3 MBit/s)
297 // GNUNET_ATS_COST_ENERGY_CONSUMPTION = 4,
300 * How many bytes are transmitted to initiate a new connection using
305 * Interpretation: less is better
309 * UDP (No connection) :
311 * TCP (TCP 3-Way handshake):
312 * 220 bytes Ethernet, 172 bytes TCP/IP, 122 bytes TCP
313 * HTTP (TCP + Header) :
314 * 477 bytes Ethernet, 429 bytes TCP/IP, 374 bytes TCP, 278 bytes HTTP
315 * HTTPS HTTP+TLS Handshake:
316 * 2129 bytes Ethernet, 1975 bytes TCP/IP, 1755 bytes TCP, 1403 bytes HTTPS
319 // GNUNET_ATS_COST_CONNECT = 5,
323 * How many bandwidth is available to consume?
324 * Used to calculate which impact sending data with this transport has
328 * Interpretation: more is better
331 * LAN: 12,800 (100 MBit/s)
332 * WLAN: 6,912 (54 MBit/s)
333 * Dial-up: 8 (64 Kbit/s)
336 // GNUNET_ATS_COST_BANDWITH_AVAILABLE = 6,
340 * How many bytes are sent over the wire when 1 kilobyte (1024 bytes)
341 * of application data is transmitted?
342 * A factor used with connect cost, bandwidth cost and energy cost
343 * to describe the overhead produced by the transport protocol
347 * Interpretation: less is better
351 * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb]
352 * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb]
353 * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb]
354 * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb]
356 // GNUNET_ATS_COST_NETWORK_OVERHEAD = 7,
357 /* Quality related values */
358 /* ====================== */
359 /* Physical layer quality properties */
361 * Signal strength on physical layer
365 // GNUNET_ATS_QUALITY_PHY_SIGNAL_STRENGTH = 1025,
367 * Collision rate on physical layer
371 // GNUNET_ATS_QUALITY_PHY_COLLISION_RATE = 1026,
373 * Error rate on physical layer
377 // GNUNET_ATS_QUALITY_PHY_ERROR_RATE = 1027,
380 * Time variations of the delay
381 * 1st derivative of a delay function
385 // GNUNET_ATS_QUALITY_NET_JITTER = 1029,
387 * Error rate on network layer
396 * Note: This numbers are just assumptions as an example, not
397 * measured or somehow determined
399 // GNUNET_ATS_QUALITY_NET_ERRORRATE = 1030,
401 * Drop rate on network layer
402 * Bytes actively dismissed by a network component during transmission
403 * Reasons for dropped data can be full queues, congestion, quota violations...
412 * Note: This numbers are just assumptions as an example, not
413 * measured or somehow determined
415 // GNUNET_ATS_QUALITY_NET_DROPRATE = 1031,
417 * Loss rate on network layer
418 * Bytes lost during transmission
419 * Reasons can be collisions, ...
428 * Note: This numbers are just assumptions as an example, not measured
429 * or somehow determined
431 // GNUNET_ATS_QUALITY_NET_LOSSRATE = 1032,
433 * Throughput on network layer
444 // GNUNET_ATS_QUALITY_NET_THROUGHPUT = 1033,
445 /* Availability related values */
446 /* =========================== */
448 * Is a peer reachable?
450 // GNUNET_ATS_AVAILABILITY_REACHABLE = 2048,
452 * Is there a connection established to a peer using this transport
454 // GNUNET_ATS_AVAILABILITY_CONNECTED = 2049
458 * Number of ATS quality properties
460 #define GNUNET_ATS_QualityPropertiesCount 2
463 * ATS quality properties as array initializer
465 #define GNUNET_ATS_QualityProperties {GNUNET_ATS_QUALITY_NET_DELAY, GNUNET_ATS_QUALITY_NET_DISTANCE}
468 * ATS quality properties as string array initializer
470 #define GNUNET_ATS_QualityPropertiesString {"Delay", "Distance"}
472 GNUNET_NETWORK_STRUCT_BEGIN
475 * struct used to communicate the transport's properties like cost and
476 * quality of service as well as high-level constraints on resource
480 * +-----------+ Constraints | | Plugin properties +---------+
481 * | Highlevel |------------> |ATS| <------------------|Transport|
482 * | Component | ATS struct | | ATS struct | Plugin |
483 * +-----------+ | | +---------+
486 * This structure will be used by transport plugins to communicate
487 * costs to ATS or by higher level components to tell ATS their
488 * constraints. Always a pair of (GNUNET_ATS_Property,
489 * uint32_t value). Value is always uint32_t, so all units used to
490 * define costs have to be normalized to fit uint32_t.
492 struct GNUNET_ATS_Information
495 * ATS property type, in network byte order.
497 uint32_t type GNUNET_PACKED;
500 * ATS property value, in network byte order.
502 uint32_t value GNUNET_PACKED;
504 GNUNET_NETWORK_STRUCT_END
506 /* ******************************** Scheduling API ***************************** */
509 * Handle to the ATS subsystem for bandwidth/transport scheduling information.
511 struct GNUNET_ATS_SchedulingHandle;
514 * Handle for address suggestion requests
517 struct GNUNET_ATS_SuggestHandle;
520 * Opaque session handle, defined by plugins. Contents not known to ATS.
525 * Signature of a function called by ATS with the current bandwidth
526 * and address preferences as determined by ATS.
529 * @param address suggested address (including peer identity of the peer)
530 * @param session session to use
531 * @param bandwidth_out assigned outbound bandwidth for the connection
532 * @param bandwidth_in assigned inbound bandwidth for the connection
533 * @param ats performance data for the address (as far as known)
534 * @param ats_count number of performance records in 'ats'
537 (*GNUNET_ATS_AddressSuggestionCallback) (void *cls,
538 const struct GNUNET_HELLO_Address * address, struct Session * session,
539 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
540 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
541 const struct GNUNET_ATS_Information * ats, uint32_t ats_count);
544 * Initialize the ATS subsystem.
546 * @param cfg configuration to use
547 * @param suggest_cb notification to call whenever the suggestation changed
548 * @param suggest_cb_cls closure for 'suggest_cb'
549 * @return ats context
551 struct GNUNET_ATS_SchedulingHandle *
552 GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
553 GNUNET_ATS_AddressSuggestionCallback suggest_cb, void *suggest_cb_cls);
556 * Client is done with ATS scheduling, release resources.
558 * @param sh handle to release
561 GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh);
564 * We would like to reset the address suggestion block time for this
568 * @param peer identity of the peer we want to reset
571 GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh,
572 const struct GNUNET_PeerIdentity *peer);
575 * We would like to establish a new connection with a peer. ATS
576 * should suggest a good address to begin with.
579 * @param peer identity of the peer we need an address for
580 * @return suggestion handle
582 struct GNUNET_ATS_SuggestHandle *
583 GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh,
584 const struct GNUNET_PeerIdentity *peer);
587 * We want to cancel ATS suggesting addresses for a peer.
590 * @param peer identity of the peer
593 GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh,
594 const struct GNUNET_PeerIdentity *peer);
597 * Convert a ATS property to a string
599 * @param type the atsi type
600 * @return a string or NULL if invalid
603 GNUNET_ATS_print_property_type (uint32_t type);
606 * Convert a GNUNET_ATS_NetworkType to a string
608 * @param net the network type
609 * @return a string or NULL if invalid
612 GNUNET_ATS_print_network_type (uint32_t net);
615 * Returns where the address is located: LAN or WAN or ...
616 * @param sh the GNUNET_ATS_SchedulingHandle handle
617 * @param addr address
618 * @param addrlen address length
619 * @return location as GNUNET_ATS_Information
621 struct GNUNET_ATS_Information
622 GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh,
623 const struct sockaddr * addr, socklen_t addrlen);
626 * Test if a address and a session is known to ATS
628 * @param sh the scheduling handle
629 * @param address the address
630 * @param session the session
631 * @return GNUNET_YES or GNUNET_NO
634 GNUNET_ATS_session_known (struct GNUNET_ATS_SchedulingHandle *sh,
635 const struct GNUNET_HELLO_Address *address, struct Session *session);
638 * We have a new address ATS should know. Addresses have to be added with this
639 * function before they can be: updated, set in use and destroyed
642 * @param address the address
643 * @param session session handle (if available)
644 * @param ats performance data for the address
645 * @param ats_count number of performance records in 'ats'
648 GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
649 const struct GNUNET_HELLO_Address *address, struct Session *session,
650 const struct GNUNET_ATS_Information *ats, uint32_t ats_count);
653 * We have updated performance statistics for a given address. Note
654 * that this function can be called for addresses that are currently
655 * in use as well as addresses that are valid but not actively in use.
656 * Furthermore, the peer may not even be connected to us right now (in
657 * which case the call may be ignored or the information may be stored
658 * for later use). Update bandwidth assignments.
661 * @param address updated address
662 * @param session session handle (if available)
663 * @param ats performance data for the address
664 * @param ats_count number of performance records in 'ats'
665 * @return GNUNET_OK or GNUNET_SYSERR
668 GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
669 const struct GNUNET_HELLO_Address *address, struct Session *session,
670 const struct GNUNET_ATS_Information *ats, uint32_t ats_count);
673 * An address is now in use or not used any more.
676 * @param address the address
677 * @param session session handle
678 * @param in_use GNUNET_YES if this address is now used, GNUNET_NO
679 * if address is not used any more
682 GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
683 const struct GNUNET_HELLO_Address *address, struct Session *session,
687 * A session got destroyed, stop including it as a valid address.
690 * @param address the address
691 * @param session session handle that is no longer valid (if available)
694 GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh,
695 const struct GNUNET_HELLO_Address *address, struct Session *session);
697 /* ******************************** Performance API ***************************** */
700 * ATS Handle to obtain and/or modify performance information.
702 struct GNUNET_ATS_PerformanceHandle;
705 * Signature of a function that is called with QoS information about an address.
708 * @param address the address
709 * @param address_active is this address actively used to maintain a connection
711 * @param bandwidth_out assigned outbound bandwidth for the connection
712 * @param bandwidth_in assigned inbound bandwidth for the connection
713 * @param ats performance data for the address (as far as known)
714 * @param ats_count number of performance records in 'ats'
717 (*GNUNET_ATS_AddressInformationCallback) (void *cls,
718 const struct GNUNET_HELLO_Address *address, int address_active,
719 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
720 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
721 const struct GNUNET_ATS_Information *ats, uint32_t ats_count);
724 * Handle for an address listing operation
726 struct GNUNET_ATS_AddressListHandle;
729 * Get handle to access performance API of the ATS subsystem.
731 * @param cfg configuration to use
732 * @param addr_info_cb callback called when performance characteristics for
734 * @param addr_info_cb_cls closure for infocb
735 * @return ats performance context
737 struct GNUNET_ATS_PerformanceHandle *
738 GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
739 GNUNET_ATS_AddressInformationCallback addr_info_cb, void *addr_info_cb_cls);
742 * Get information about addresses known to the ATS subsystem.
744 * @param handle the performance handle to use
745 * @param peer peer idm can be NULL for all peers
746 * @param all GNUNET_YES to get information about all addresses or GNUNET_NO to
747 * get only address currently used
748 * @param infocb callback to call with the addresses,
749 * will callback with address == NULL when done
750 * @param infocb_cls closure for infocb
751 * @return ats performance context
753 struct GNUNET_ATS_AddressListHandle *
754 GNUNET_ATS_performance_list_addresses (
755 struct GNUNET_ATS_PerformanceHandle *handle,
756 const struct GNUNET_PeerIdentity *peer, int all,
757 GNUNET_ATS_AddressInformationCallback infocb, void *infocb_cls);
760 * Cancel a pending address listing operation
762 * @param handle the GNUNET_ATS_AddressListHandle handle to cancel
765 GNUNET_ATS_performance_list_addresses_cancel (
766 struct GNUNET_ATS_AddressListHandle *handle);
769 * Client is done using the ATS performance subsystem, release resources.
774 GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph);
777 * Function called with reservation result.
780 * @param peer identifies the peer
781 * @param amount set to the amount that was actually reserved or unreserved;
782 * either the full requested amount or zero (no partial reservations)
783 * @param res_delay if the reservation could not be satisfied (amount was 0), how
784 * long should the client wait until re-trying?
787 (*GNUNET_ATS_ReservationCallback) (void *cls,
788 const struct GNUNET_PeerIdentity * peer, int32_t amount,
789 struct GNUNET_TIME_Relative res_delay);
792 * Context that can be used to cancel a peer information request.
794 struct GNUNET_ATS_ReservationContext;
797 * Reserve inbound bandwidth from the given peer. ATS will look at
798 * the current amount of traffic we receive from the peer and ensure
799 * that the peer could add 'amount' of data to its stream.
801 * @param ph performance handle
802 * @param peer identifies the peer
803 * @param amount reserve N bytes for receiving, negative
804 * amounts can be used to undo a (recent) reservation;
805 * @param rcb function to call with the resulting reservation information
806 * @param rcb_cls closure for info
807 * @return NULL on error
808 * @deprecated will be replaced soon
810 struct GNUNET_ATS_ReservationContext *
811 GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph,
812 const struct GNUNET_PeerIdentity *peer, int32_t amount,
813 GNUNET_ATS_ReservationCallback rcb, void *rcb_cls);
816 * Cancel request for reserving bandwidth.
818 * @param rc context returned by the original GNUNET_ATS_reserve_bandwidth call
821 GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc);
824 * Number of preference types supported by ATS
826 #define GNUNET_ATS_PreferenceCount 3
829 * ATS preference types as array initializer
831 #define GNUNET_ATS_PreferenceType {GNUNET_ATS_PREFERENCE_END, GNUNET_ATS_PREFERENCE_BANDWIDTH, GNUNET_ATS_PREFERENCE_LATENCY}
834 * ATS preference types as string array initializer
836 #define GNUNET_ATS_PreferenceTypeString {"END", "BANDWIDTH", "LATENCY"}
839 * Enum defining all known preference categories.
841 enum GNUNET_ATS_PreferenceKind
845 * End of preference list.
847 GNUNET_ATS_PREFERENCE_END = 0,
850 * Change the peer's bandwidth value (value per byte of bandwidth in
851 * the goal function) to the given amount. The argument is followed
852 * by a double value giving the desired value (can be negative).
853 * Preference changes are forgotten if peers disconnect.
855 GNUNET_ATS_PREFERENCE_BANDWIDTH,
858 * Change the peer's latency value to the given amount. The
859 * argument is followed by a double value giving the desired value
860 * (can be negative). The absolute score in the goal function is
861 * the inverse of the latency in microseconds (minimum: 1
862 * microsecond) multiplied by the latency preferences.
864 GNUNET_ATS_PREFERENCE_LATENCY
868 * Convert a GNUNET_ATS_PreferenceType to a string
870 * @param type the preference type
871 * @return a string or NULL if invalid
874 GNUNET_ATS_print_preference_type (uint32_t type);
877 * Change preferences for the given peer. Preference changes are forgotten if peers
880 * @param ph performance handle
881 * @param peer identifies the peer
882 * @param ... 0-terminated specification of the desired changes
885 GNUNET_ATS_performance_change_preference (
886 struct GNUNET_ATS_PerformanceHandle *ph,
887 const struct GNUNET_PeerIdentity *peer, ...);
890 * Application feedback on how good preference requirements are fulfilled
891 * for the preferences included in the given time scope [now - scope .. now]
893 * An application notifies ATS if (and only if) it has feedback information
894 * for specific properties. This values are valid until the feedback scores are
895 * updated by the application.
897 * If the application has no feedback for this preference kind the application
898 * will not explicitly call for this property and will not include it in this
901 * @param ph performance handle
902 * @param scope the time interval this valid for: [now - scope .. now]
903 * @param peer identifies the peer
904 * @param ... 0-terminated specification of the desired changes
907 GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph,
908 const struct GNUNET_PeerIdentity *peer,
909 const struct GNUNET_TIME_Relative scope, ...);
912 /* end of file gnunet-service-transport_ats.h */