-fix compiler warning: do not return const double
[oweals/gnunet.git] / src / ats / plugin_ats_ril.h
1 /*
2  This file is part of GNUnet.
3  (C) 2011 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19  */
20
21 /**
22  * @file ats/plugin_ats_ril.h
23  * @brief ATS reinforcement learning solver
24  * @author Fabian Oehlmann
25  * @author Matthias Wachs
26  */
27 #include "platform.h"
28 #include <float.h>
29 #include <math.h>
30 #include "gnunet_ats_plugin.h"
31 #include "gnunet-service-ats_addresses.h"
32
33 /**
34  * ATS reinforcement learning solver
35  *
36  * General description
37  */
38
39 /**
40  * Changes the preferences for a peer in the problem
41  *
42  * @param solver the solver handle
43  * @param peer the peer to change the preference for
44  * @param kind the kind to change the preference
45  * @param pref_rel the normalized preference value for this kind over all clients
46  */
47 void
48 GAS_ril_address_change_preference (void *solver,
49     const struct GNUNET_PeerIdentity *peer,
50     enum GNUNET_ATS_PreferenceKind kind,
51     double pref_rel);
52
53 /**
54  * Add a single address within a network to the solver
55  *
56  * @param solver the solver Handle
57  * @param address the address to add
58  * @param network network type of this address
59  */
60 void
61 GAS_ril_address_add (void *solver,
62     struct ATS_Address *address,
63     uint32_t network);
64
65 /**
66  * Transport properties for this address have changed
67  *
68  * @param solver solver handle
69  * @param address the address
70  * @param type the ATSI type in HBO
71  * @param abs_value the absolute value of the property
72  * @param rel_value the normalized value
73  */
74 void
75 GAS_ril_address_property_changed (void *solver,
76     struct ATS_Address *address,
77     uint32_t type,
78     uint32_t abs_value,
79     double rel_value);
80
81 /**
82  * Transport session for this address has changed
83  *
84  * NOTE: values in addresses are already updated
85  *
86  * @param solver solver handle
87  * @param address the address
88  * @param cur_session the current session
89  * @param new_session the new session
90  */
91 void
92 GAS_ril_address_session_changed (void *solver,
93     struct ATS_Address *address,
94     uint32_t cur_session,
95     uint32_t new_session);
96
97 /**
98  * Usage for this address has changed
99  *
100  * NOTE: values in addresses are already updated
101  *
102  * @param solver solver handle
103  * @param address the address
104  * @param in_use usage state
105  */
106 void
107 GAS_ril_address_inuse_changed (void *solver,
108     struct ATS_Address *address,
109     int in_use);
110
111 /**
112  * Network scope for this address has changed
113  *
114  * NOTE: values in addresses are already updated
115  *
116  * @param solver solver handle
117  * @param address the address
118  * @param current_network the current network
119  * @param new_network the new network
120  */
121 void
122 GAS_ril_address_change_network (void *solver,
123     struct ATS_Address *address,
124     uint32_t current_network,
125     uint32_t new_network);
126
127 /**
128  * Remove an address from the solver
129  *
130  * @param solver the solver handle
131  * @param address the address to remove
132  * @param session_only delete only session not whole address
133  */
134 void
135 GAS_ril_address_delete (void *solver,
136     struct ATS_Address *address,
137     int session_only);
138
139 /**
140  * Get application feedback for a peer
141  *
142  * @param solver the solver handle
143  * @param application the application
144  * @param peer the peer to change the preference for
145  * @param scope the time interval for this feedback: [now - scope .. now]
146  * @param kind the kind to change the preference
147  * @param score the score
148  */
149 void
150 GAS_ril_address_preference_feedback (void *solver,
151     void *application,
152     const struct GNUNET_PeerIdentity *peer,
153     const struct GNUNET_TIME_Relative scope,
154     enum GNUNET_ATS_PreferenceKind kind,
155     double score);
156
157 /**
158  * Start a bulk operation
159  *
160  * @param solver the solver
161  */
162 void
163 GAS_ril_bulk_start (void *solver);
164
165 /**
166  * Bulk operation done
167  */
168 void
169 GAS_ril_bulk_stop (void *solver);
170
171 /**
172  * Stop notifying about address and bandwidth changes for this peer
173  *
174  * @param solver the solver handle
175  * @param peer the peer
176  */
177 void
178 GAS_ril_stop_get_preferred_address (void *solver,
179     const struct GNUNET_PeerIdentity *peer);
180
181 /**
182  * Get the prefered address for a specific peer
183  *
184  * @param solver the solver handle
185  * @param peer the identity of the peer
186  */
187 const struct ATS_Address *
188 GAS_ril_get_preferred_address (void *solver,
189     const struct GNUNET_PeerIdentity *peer);
190
191 /* end of plugin_ats_ril.h */