2 This file is part of GNUnet.
3 (C) 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.
22 * @file ats/plugin_ats_proportional.h
23 * @brief ATS proportional solver
24 * @author Matthias Wachs
25 * @author Christian Grothoff
28 #include "gnunet_statistics_service.h"
29 #include "gnunet_ats_plugin.h"
30 #include "gnunet-service-ats_addresses.h"
33 * ATS proportional solver
39 * Changes the preferences for a peer in the problem
41 * @param solver the solver handle
42 * @param peer the peer to change the preference for
43 * @param kind the kind to change the preference
44 * @param pref_rel the normalized preference value for this kind over all clients
47 GAS_proportional_address_change_preference (void *solver,
48 const struct GNUNET_PeerIdentity *peer, enum GNUNET_ATS_PreferenceKind kind,
52 * Get application feedback for a peer
54 * @param solver the solver handle
55 * @param application the application
56 * @param peer the peer to change the preference for
57 * @param scope the time interval for this feedback: [now - scope .. now]
58 * @param kind the kind to change the preference
59 * @param score the score
62 GAS_proportional_address_preference_feedback (void *solver, void *application,
63 const struct GNUNET_PeerIdentity *peer,
64 const struct GNUNET_TIME_Relative scope,
65 enum GNUNET_ATS_PreferenceKind kind, double score);
68 * Shutdown the proportional problem solver
70 * @param solver the respective handle to shutdown
73 GAS_proportional_done (void * solver);
76 * Add a single address within a network to the solver
78 * @param solver the solver Handle
79 * @param address the address to add
80 * @param network network type of this address
83 GAS_proportional_address_add (void *solver, struct ATS_Address *address,
87 * Transport properties for this address have changed
89 * @param solver solver handle
90 * @param address the address
91 * @param type the ATSI type in HBO
92 * @param abs_value the absolute value of the property
93 * @param rel_value the normalized value
96 GAS_proportional_address_property_changed (void *solver,
97 struct ATS_Address *address, uint32_t type, uint32_t abs_value,
101 * Transport session for this address has changed
103 * NOTE: values in addresses are already updated
105 * @param solver solver handle
106 * @param address the address
107 * @param cur_session the current session
108 * @param new_session the new session
111 GAS_proportional_address_session_changed (void *solver,
112 struct ATS_Address *address, uint32_t cur_session, uint32_t new_session);
115 * Usage for this address has changed
117 * NOTE: values in addresses are already updated
119 * @param solver solver handle
120 * @param address the address
121 * @param in_use usage state
124 GAS_proportional_address_inuse_changed (void *solver,
125 struct ATS_Address *address, int in_use);
128 * Network scope for this address has changed
130 * NOTE: values in addresses are already updated
132 * @param solver solver handle
133 * @param address the address
134 * @param current_network the current network
135 * @param new_network the new network
138 GAS_proportional_address_change_network (void *solver,
139 struct ATS_Address *address, uint32_t current_network, uint32_t new_network);
142 * Remove an address from the solver
144 * @param solver the solver handle
145 * @param address the address to remove
146 * @param session_only delete only session not whole address
149 GAS_proportional_address_delete (void *solver, struct ATS_Address *address,
153 * Start a bulk operation
155 * @param solver the solver
158 GAS_proportional_bulk_start (void *solver);
161 * Bulk operation done
164 GAS_proportional_bulk_stop (void *solver);
167 * Stop notifying about address and bandwidth changes for this peer
169 * @param solver the proportional handle
170 * @param peer the peer
173 GAS_proportional_stop_get_preferred_address (void *solver,
174 const struct GNUNET_PeerIdentity *peer);
177 * Get the prefered address for a specific peer
179 * @param solver the solver handle
180 * @param peer the identity of the peer
182 const struct ATS_Address *
183 GAS_proportional_get_preferred_address (void *solver,
184 const struct GNUNET_PeerIdentity *peer);
186 /* end of plugin_ats_proportional.h */