diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-11-07 09:49:16 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-11-07 09:49:16 +0000 |
commit | 605667faf9a8907486221f3f789ef0e1e81f5132 (patch) | |
tree | 908f28f1e14e43bf95bcd24b5b137f9ece40fc19 /src/include/gnunet_ats_plugin.h | |
parent | 7e7725d9e354fb94e9af9cdbcb49372836b41fb3 (diff) | |
download | gnunet-605667faf9a8907486221f3f789ef0e1e81f5132.tar.gz gnunet-605667faf9a8907486221f3f789ef0e1e81f5132.zip |
extend info cb and documentation
Diffstat (limited to 'src/include/gnunet_ats_plugin.h')
-rw-r--r-- | src/include/gnunet_ats_plugin.h | 143 |
1 files changed, 97 insertions, 46 deletions
diff --git a/src/include/gnunet_ats_plugin.h b/src/include/gnunet_ats_plugin.h index ed081f39a..15c3ebbf4 100644 --- a/src/include/gnunet_ats_plugin.h +++ b/src/include/gnunet_ats_plugin.h | |||
@@ -36,13 +36,11 @@ | |||
36 | 36 | ||
37 | struct ATS_Address; | 37 | struct ATS_Address; |
38 | 38 | ||
39 | |||
40 | /* | 39 | /* |
41 | * Solver API | 40 | * Solver API |
42 | * ---------- | 41 | * ---------- |
43 | */ | 42 | */ |
44 | 43 | ||
45 | |||
46 | /** | 44 | /** |
47 | * Change the preference for a peer | 45 | * Change the preference for a peer |
48 | * | 46 | * |
@@ -193,7 +191,6 @@ typedef void | |||
193 | (*GAS_solver_stop_get_preferred_address) (void *solver, | 191 | (*GAS_solver_stop_get_preferred_address) (void *solver, |
194 | const struct GNUNET_PeerIdentity *peer); | 192 | const struct GNUNET_PeerIdentity *peer); |
195 | 193 | ||
196 | |||
197 | /** | 194 | /** |
198 | * Solver functions | 195 | * Solver functions |
199 | * | 196 | * |
@@ -210,26 +207,22 @@ struct GNUNET_ATS_SolverFunctions | |||
210 | */ | 207 | */ |
211 | GAS_solver_address_add s_add; | 208 | GAS_solver_address_add s_add; |
212 | 209 | ||
213 | |||
214 | /** | 210 | /** |
215 | * Update the properties of an address in the solver | 211 | * Update the properties of an address in the solver |
216 | */ | 212 | */ |
217 | GAS_solver_address_property_changed s_address_update_property; | 213 | GAS_solver_address_property_changed s_address_update_property; |
218 | 214 | ||
219 | |||
220 | /** | 215 | /** |
221 | * Update the session of an address in the solver | 216 | * Update the session of an address in the solver |
222 | */ | 217 | */ |
223 | GAS_solver_address_session_changed s_address_update_session; | 218 | GAS_solver_address_session_changed s_address_update_session; |
224 | 219 | ||
225 | |||
226 | /** | 220 | /** |
227 | * Notify the solver that in address is (not) actively used by transport | 221 | * Notify the solver that in address is (not) actively used by transport |
228 | * to communicate with a remote peer | 222 | * to communicate with a remote peer |
229 | */ | 223 | */ |
230 | GAS_solver_address_inuse_changed s_address_update_inuse; | 224 | GAS_solver_address_inuse_changed s_address_update_inuse; |
231 | 225 | ||
232 | |||
233 | /** | 226 | /** |
234 | * Notify solver that the network an address is located in has changed | 227 | * Notify solver that the network an address is located in has changed |
235 | */ | 228 | */ |
@@ -245,14 +238,13 @@ struct GNUNET_ATS_SolverFunctions | |||
245 | GAS_solver_get_preferred_address s_get; | 238 | GAS_solver_get_preferred_address s_get; |
246 | 239 | ||
247 | /** | 240 | /** |
248 | * Tell solver stop notifying ATS about changes for this peers | 241 | * Tell solver stop notifying ATS about changes for this peers |
249 | * | 242 | * |
250 | * The solver must only notify about changes for peers with pending address | 243 | * The solver must only notify about changes for peers with pending address |
251 | * requests! | 244 | * requests! |
252 | */ | 245 | */ |
253 | GAS_solver_stop_get_preferred_address s_get_stop; | 246 | GAS_solver_stop_get_preferred_address s_get_stop; |
254 | 247 | ||
255 | |||
256 | /** | 248 | /** |
257 | * Delete an address in the solver | 249 | * Delete an address in the solver |
258 | * | 250 | * |
@@ -260,19 +252,16 @@ struct GNUNET_ATS_SolverFunctions | |||
260 | */ | 252 | */ |
261 | GAS_solver_address_delete s_del; | 253 | GAS_solver_address_delete s_del; |
262 | 254 | ||
263 | |||
264 | /** | 255 | /** |
265 | * Change relative preference for quality in solver | 256 | * Change relative preference for quality in solver |
266 | */ | 257 | */ |
267 | GAS_solver_address_change_preference s_pref; | 258 | GAS_solver_address_change_preference s_pref; |
268 | 259 | ||
269 | |||
270 | /** | 260 | /** |
271 | * Give feedback about the current assignment | 261 | * Give feedback about the current assignment |
272 | */ | 262 | */ |
273 | GAS_solver_address_feedback_preference s_feedback; | 263 | GAS_solver_address_feedback_preference s_feedback; |
274 | 264 | ||
275 | |||
276 | /** | 265 | /** |
277 | * Start a bulk operation | 266 | * Start a bulk operation |
278 | * | 267 | * |
@@ -284,7 +273,6 @@ struct GNUNET_ATS_SolverFunctions | |||
284 | */ | 273 | */ |
285 | GAS_solver_bulk_start s_bulk_start; | 274 | GAS_solver_bulk_start s_bulk_start; |
286 | 275 | ||
287 | |||
288 | /** | 276 | /** |
289 | * Bulk operation done | 277 | * Bulk operation done |
290 | * | 278 | * |
@@ -294,29 +282,89 @@ struct GNUNET_ATS_SolverFunctions | |||
294 | GAS_solver_bulk_stop s_bulk_stop; | 282 | GAS_solver_bulk_stop s_bulk_stop; |
295 | }; | 283 | }; |
296 | 284 | ||
297 | |||
298 | /** | 285 | /** |
299 | * Operation codes for solver information callback | 286 | * Operation codes for solver information callback |
287 | * | ||
288 | * Order of calls is expected to be: | ||
289 | * GAS_OP_SOLVE_START | ||
290 | * | ||
291 | * GAS_OP_SOLVE_STOP | ||
292 | * GAS_OP_SOLVE_UPDATE_NOTIFICATION_START | ||
293 | * GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP | ||
294 | * | ||
300 | */ | 295 | */ |
301 | enum GAS_Solver_Operation | 296 | enum GAS_Solver_Operation |
302 | { | 297 | { |
298 | /** | ||
299 | * A solution iteration has been started | ||
300 | */ | ||
303 | GAS_OP_SOLVE_START, | 301 | GAS_OP_SOLVE_START, |
302 | |||
303 | /** | ||
304 | * A solution iteration has been finished | ||
305 | */ | ||
304 | GAS_OP_SOLVE_STOP, | 306 | GAS_OP_SOLVE_STOP, |
307 | |||
308 | /** | ||
309 | * The setup of the problem as a preparation to solve it was started | ||
310 | */ | ||
305 | GAS_OP_SOLVE_SETUP_START, | 311 | GAS_OP_SOLVE_SETUP_START, |
312 | |||
313 | /** | ||
314 | * The setup of the problem as a preparation to solve is finished | ||
315 | */ | ||
306 | GAS_OP_SOLVE_SETUP_STOP, | 316 | GAS_OP_SOLVE_SETUP_STOP, |
307 | GAS_OP_SOLVE_LP_START, | ||
308 | GAS_OP_SOLVE_LP_STOP, | ||
309 | GAS_OP_SOLVE_MLP_START, | ||
310 | GAS_OP_SOLVE_MLP_STOP | ||
311 | }; | ||
312 | 317 | ||
318 | /** | ||
319 | * Solving of the LP problem was started | ||
320 | * MLP solver only | ||
321 | */ | ||
322 | GAS_OP_SOLVE_MLP_LP_START, | ||
323 | |||
324 | /** | ||
325 | * Solving of the LP problem is done | ||
326 | * MLP solver only | ||
327 | */ | ||
328 | GAS_OP_SOLVE_MLP_LP_STOP, | ||
329 | |||
330 | /** | ||
331 | * Solving of the MLP problem was started | ||
332 | * MLP solver only | ||
333 | */ | ||
334 | GAS_OP_SOLVE_MLP_MLP_START, | ||
335 | |||
336 | /** | ||
337 | * Solving of the MLP problem is done | ||
338 | * MLP solver only | ||
339 | */ | ||
340 | GAS_OP_SOLVE_MLP_MLP_STOP, | ||
341 | |||
342 | /** | ||
343 | * After the problem was finished, start notifications about changes | ||
344 | * to addresses | ||
345 | */ | ||
346 | GAS_OP_SOLVE_UPDATE_NOTIFICATION_START, | ||
347 | |||
348 | /** | ||
349 | * After the problem was finished, notifications about changes to addresses | ||
350 | * are done | ||
351 | */ | ||
352 | GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP | ||
353 | }; | ||
313 | 354 | ||
314 | /** | 355 | /** |
315 | * Status of the operation | 356 | * Status of a GAS_Solver_Operation operation |
316 | */ | 357 | */ |
317 | enum GAS_Solver_Status | 358 | enum GAS_Solver_Status |
318 | { | 359 | { |
360 | /** | ||
361 | * Success | ||
362 | */ | ||
319 | GAS_STAT_SUCCESS, | 363 | GAS_STAT_SUCCESS, |
364 | |||
365 | /** | ||
366 | * Failure | ||
367 | */ | ||
320 | GAS_STAT_FAIL | 368 | GAS_STAT_FAIL |
321 | }; | 369 | }; |
322 | 370 | ||
@@ -325,13 +373,33 @@ enum GAS_Solver_Status | |||
325 | */ | 373 | */ |
326 | enum GAS_Solver_Additional_Information | 374 | enum GAS_Solver_Additional_Information |
327 | { | 375 | { |
376 | /** | ||
377 | * No more specific information | ||
378 | */ | ||
328 | GAS_INFO_NONE, | 379 | GAS_INFO_NONE, |
380 | |||
381 | /** | ||
382 | * A full solution process is performed | ||
383 | * Quite specific to the MLP solver | ||
384 | */ | ||
329 | GAS_INFO_FULL, | 385 | GAS_INFO_FULL, |
386 | |||
387 | /** | ||
388 | * An existing solution was reused | ||
389 | * Quite specific to the MLP solver | ||
390 | */ | ||
330 | GAS_INFO_UPDATED, | 391 | GAS_INFO_UPDATED, |
331 | GAS_INFO_PROP_ALL, | ||
332 | GAS_INFO_PROP_SINGLE | ||
333 | }; | ||
334 | 392 | ||
393 | /** | ||
394 | * The proportional solver had to recalculate for a single network | ||
395 | */ | ||
396 | GAS_INFO_PROP_SINGLE, | ||
397 | |||
398 | /** | ||
399 | * The proportional solver had to recalculate for all networks | ||
400 | */ | ||
401 | GAS_INFO_PROP_ALL | ||
402 | }; | ||
335 | 403 | ||
336 | /** | 404 | /** |
337 | * Callback to call with additional information | 405 | * Callback to call with additional information |
@@ -345,11 +413,8 @@ enum GAS_Solver_Additional_Information | |||
345 | * @param pref_rel the normalized preference value for this kind over all clients | 413 | * @param pref_rel the normalized preference value for this kind over all clients |
346 | */ | 414 | */ |
347 | typedef void | 415 | typedef void |
348 | (*GAS_solver_information_callback) (void *cls, | 416 | (*GAS_solver_information_callback) (void *cls, enum GAS_Solver_Operation op, |
349 | enum GAS_Solver_Operation op, | 417 | enum GAS_Solver_Status stat, enum GAS_Solver_Additional_Information); |
350 | enum GAS_Solver_Status stat, | ||
351 | enum GAS_Solver_Additional_Information); | ||
352 | |||
353 | 418 | ||
354 | /** | 419 | /** |
355 | * Callback to call from solver when bandwidth for address has changed | 420 | * Callback to call from solver when bandwidth for address has changed |
@@ -383,7 +448,6 @@ typedef const double * | |||
383 | typedef const double * | 448 | typedef const double * |
384 | (*GAS_get_properties) (void *cls, const struct ATS_Address *address); | 449 | (*GAS_get_properties) (void *cls, const struct ATS_Address *address); |
385 | 450 | ||
386 | |||
387 | /** | 451 | /** |
388 | * The ATS service will pass a pointer to a struct | 452 | * The ATS service will pass a pointer to a struct |
389 | * of this type as the first and only argument to the | 453 | * of this type as the first and only argument to the |
@@ -396,55 +460,46 @@ struct GNUNET_ATS_PluginEnvironment | |||
396 | */ | 460 | */ |
397 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 461 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
398 | 462 | ||
399 | |||
400 | /** | 463 | /** |
401 | * Statistics handle to be used by the solver | 464 | * Statistics handle to be used by the solver |
402 | */ | 465 | */ |
403 | const struct GNUNET_STATISTICS_Handle *stats; | 466 | const struct GNUNET_STATISTICS_Handle *stats; |
404 | 467 | ||
405 | |||
406 | /** | 468 | /** |
407 | * Hashmap containing all addresses available | 469 | * Hashmap containing all addresses available |
408 | */ | 470 | */ |
409 | struct GNUNET_CONTAINER_MultiPeerMap *addresses; | 471 | struct GNUNET_CONTAINER_MultiPeerMap *addresses; |
410 | 472 | ||
411 | |||
412 | /** | 473 | /** |
413 | * ATS addresses callback to be notified about bandwidth assignment changes | 474 | * ATS addresses callback to be notified about bandwidth assignment changes |
414 | */ | 475 | */ |
415 | GAS_bandwidth_changed_cb bandwidth_changed_cb; | 476 | GAS_bandwidth_changed_cb bandwidth_changed_cb; |
416 | 477 | ||
417 | |||
418 | /** | 478 | /** |
419 | * ATS addresses closure to be notified about bandwidth assignment changes | 479 | * ATS addresses closure to be notified about bandwidth assignment changes |
420 | */ | 480 | */ |
421 | void *bw_changed_cb_cls; | 481 | void *bw_changed_cb_cls; |
422 | 482 | ||
423 | |||
424 | /** | 483 | /** |
425 | * ATS addresses function to obtain preference values | 484 | * ATS addresses function to obtain preference values |
426 | */ | 485 | */ |
427 | GAS_get_preferences get_preferences; | 486 | GAS_get_preferences get_preferences; |
428 | 487 | ||
429 | |||
430 | /** | 488 | /** |
431 | * ATS addresses function closure to obtain preference values | 489 | * ATS addresses function closure to obtain preference values |
432 | */ | 490 | */ |
433 | void *get_preference_cls; | 491 | void *get_preference_cls; |
434 | 492 | ||
435 | |||
436 | /** | 493 | /** |
437 | * ATS addresses function to obtain property values | 494 | * ATS addresses function to obtain property values |
438 | */ | 495 | */ |
439 | GAS_get_properties get_property; | 496 | GAS_get_properties get_property; |
440 | 497 | ||
441 | |||
442 | /** | 498 | /** |
443 | * ATS addresses function closure to obtain property values | 499 | * ATS addresses function closure to obtain property values |
444 | */ | 500 | */ |
445 | void *get_property_cls; | 501 | void *get_property_cls; |
446 | 502 | ||
447 | |||
448 | /** | 503 | /** |
449 | * Callback for solver to call with status information, | 504 | * Callback for solver to call with status information, |
450 | * can be NULL | 505 | * can be NULL |
@@ -462,26 +517,22 @@ struct GNUNET_ATS_PluginEnvironment | |||
462 | */ | 517 | */ |
463 | struct GNUNET_ATS_SolverFunctions sf; | 518 | struct GNUNET_ATS_SolverFunctions sf; |
464 | 519 | ||
465 | |||
466 | /** | 520 | /** |
467 | * Available networks | 521 | * Available networks |
468 | */ | 522 | */ |
469 | int networks[GNUNET_ATS_NetworkTypeCount]; | 523 | int networks[GNUNET_ATS_NetworkTypeCount]; |
470 | 524 | ||
471 | |||
472 | /** | 525 | /** |
473 | * Number of networks available | 526 | * Number of networks available |
474 | */ | 527 | */ |
475 | int network_count; | 528 | int network_count; |
476 | 529 | ||
477 | |||
478 | /** | 530 | /** |
479 | * Array of configured outbound quotas | 531 | * Array of configured outbound quotas |
480 | * Order according to networks in network array | 532 | * Order according to networks in network array |
481 | */ | 533 | */ |
482 | unsigned long long out_quota[GNUNET_ATS_NetworkTypeCount]; | 534 | unsigned long long out_quota[GNUNET_ATS_NetworkTypeCount]; |
483 | 535 | ||
484 | |||
485 | /** | 536 | /** |
486 | * Array of configured inbound quotas | 537 | * Array of configured inbound quotas |
487 | * Order according to networks in network array | 538 | * Order according to networks in network array |