aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_ats_plugin_new.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_ats_plugin_new.h')
-rw-r--r--src/include/gnunet_ats_plugin_new.h85
1 files changed, 83 insertions, 2 deletions
diff --git a/src/include/gnunet_ats_plugin_new.h b/src/include/gnunet_ats_plugin_new.h
index 267477871..d2960c9cf 100644
--- a/src/include/gnunet_ats_plugin_new.h
+++ b/src/include/gnunet_ats_plugin_new.h
@@ -147,16 +147,40 @@ struct GNUNET_ATS_SolverFunctions
147 struct GNUNET_ATS_PreferenceHandle *ph, 147 struct GNUNET_ATS_PreferenceHandle *ph,
148 const struct GNUNET_ATS_Preference *pref); 148 const struct GNUNET_ATS_Preference *pref);
149 149
150 150 /**
151 * Transport established a new session with performance
152 * characteristics given in @a data.
153 *
154 * @param cls closure
155 * @param data performance characteristics of @a sh
156 * @param address address information (for debugging)
157 * @return handle by which the plugin will identify this session
158 */
151 struct GNUNET_ATS_SessionHandle * 159 struct GNUNET_ATS_SessionHandle *
152 (*session_add)(void *cls, 160 (*session_add)(void *cls,
153 const struct GNUNET_ATS_SessionData *data); 161 const struct GNUNET_ATS_SessionData *data,
162 const char *address);
154 163
164 /**
165 * @a data changed for a given @a sh, solver should consider
166 * the updated performance characteristics.
167 *
168 * @param cls closure
169 * @param sh session this is about
170 * @param data performance characteristics of @a sh
171 */
155 void 172 void
156 (*session_update)(void *cls, 173 (*session_update)(void *cls,
157 struct GNUNET_ATS_SessionHandle *sh, 174 struct GNUNET_ATS_SessionHandle *sh,
158 const struct GNUNET_ATS_SessionData *data); 175 const struct GNUNET_ATS_SessionData *data);
159 176
177 /**
178 * A session went away. Solver should update accordingly.
179 *
180 * @param cls closure
181 * @param sh session this is about
182 * @param data (last) performance characteristics of @a sh
183 */
160 void 184 void
161 (*session_del)(void *cls, 185 (*session_del)(void *cls,
162 struct GNUNET_ATS_SessionHandle *sh, 186 struct GNUNET_ATS_SessionHandle *sh,
@@ -164,6 +188,63 @@ struct GNUNET_ATS_SolverFunctions
164 188
165}; 189};
166 190
191
192/**
193 * The ATS plugin will pass a pointer to a struct
194 * of this type as to the initialization function
195 * of the ATS plugins.
196 */
197struct GNUNET_ATS_PluginEnvironment
198{
199 /**
200 * Configuration handle to be used by the solver
201 */
202 const struct GNUNET_CONFIGURATION_Handle *cfg;
203
204 /**
205 * Statistics handle to be used by the solver
206 */
207 struct GNUNET_STATISTICS_Handle *stats;
208
209 /**
210 * Closure to pass to all callbacks in this struct.
211 */
212 void *cls;
213
214 /**
215 * Suggest to the transport that it should try establishing
216 * a connection using the given address.
217 *
218 * @param cls closure, NULL
219 * @param pid peer this is about
220 * @param address address the transport should try
221 */
222 void
223 (*suggest_cb) (void *cls,
224 const struct GNUNET_PeerIdentity *pid,
225 const char *address);
226
227 /**
228 * Tell the transport that it should allocate the given
229 * bandwidth to the specified session.
230 *
231 * @param cls closure, NULL
232 * @param session session this is about
233 * @param peer peer this is about
234 * @param bw_in suggested bandwidth for receiving
235 * @param bw_out suggested bandwidth for transmission
236 */
237 void
238 (*allocate_cb) (void *cls,
239 struct GNUNET_ATS_Session *session,
240 const struct GNUNET_PeerIdentity *peer,
241 struct GNUNET_BANDWIDTH_Value32NBO bw_in,
242 struct GNUNET_BANDWIDTH_Value32NBO bw_out);
243
244};
245
246
247
167#endif 248#endif
168 249
169/** @} */ /* end of group */ 250/** @} */ /* end of group */