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