aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats_addresses.h
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-10-08 16:34:07 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-10-08 16:34:07 +0000
commit8929c943f1f57aaf48a1bc3f6edc9939698e688b (patch)
tree6c7c3c01b13826a72b7cc9e2d71923304f00f061 /src/ats/gnunet-service-ats_addresses.h
parente6c06a3f18b4c3a5a3cae2aa572c927d737ce532 (diff)
downloadgnunet-8929c943f1f57aaf48a1bc3f6edc9939698e688b.tar.gz
gnunet-8929c943f1f57aaf48a1bc3f6edc9939698e688b.zip
ats solver are now implemented as plugins
initial commit: tests pass, no crashes with tests ...
Diffstat (limited to 'src/ats/gnunet-service-ats_addresses.h')
-rw-r--r--src/ats/gnunet-service-ats_addresses.h227
1 files changed, 0 insertions, 227 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index 38ccd95c3..6d3377f1b 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -348,234 +348,7 @@ struct ATS_Address
348 struct GAS_NormalizationInfo atsin[GNUNET_ATS_QualityPropertiesCount]; 348 struct GAS_NormalizationInfo atsin[GNUNET_ATS_QualityPropertiesCount];
349}; 349};
350 350
351/**
352 * Callback to call from solver when bandwidth for address has changed
353 *
354 * @param address the with changed bandwidth assigned
355 */
356typedef void
357(*GAS_bandwidth_changed_cb) (void *cls, struct ATS_Address *address);
358
359/**
360 * Callback to call from solver to obtain application preference values for a
361 * peer
362 *
363 * @param cls the cls
364 * @param id the peer id
365 * @return carry of double values containing the preferences with
366 * GNUNET_ATS_PreferenceCount elements
367 */
368typedef const double *
369(*GAS_get_preferences) (void *cls, const struct GNUNET_PeerIdentity *id);
370
371/**
372 * Callback to call from solver to obtain transport properties for an
373 * address
374 *
375 * @param cls the cls
376 * @param address the address
377 * @return carry of double values containing the preferences with
378 * GNUNET_ATS_PreferenceCount elements
379 */
380typedef const double *
381(*GAS_get_properties) (void *cls, const struct ATS_Address *address);
382
383/*
384 * Solver API
385 * ----------
386 */
387
388/**
389 * Init the problem solving component
390 *
391 * Quotas:
392 * network[i] contains the network type as type GNUNET_ATS_NetworkType[i]
393 * out_quota[i] contains outbound quota for network type i
394 * in_quota[i] contains inbound quota for network type i
395 *
396 * Example
397 * network = {GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_LOOPBACK, GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN}
398 * network[2] == GNUNET_ATS_NET_LAN
399 * out_quota[2] == 65353
400 * in_quota[2] == 65353
401 *
402 * @param cfg configuration handle
403 * @param stats the GNUNET_STATISTICS handle
404 * @param addresses hashmap containing all addresses
405 * @param network array of GNUNET_ATS_NetworkType with length dest_length
406 * @param out_quota array of outbound quotas
407 * @param in_quota array of outbound quota
408 * @param bw_changed_cb callback to call when assigned changes
409 * @return handle for the solver on success, NULL on fail
410 */
411typedef void *
412(*GAS_solver_init) (const struct GNUNET_CONFIGURATION_Handle *cfg,
413 const struct GNUNET_STATISTICS_Handle *stats,
414 const struct GNUNET_CONTAINER_MultiPeerMap *addresses, int *network,
415 unsigned long long *out_quota, unsigned long long *in_quota,
416 int dest_length, GAS_bandwidth_changed_cb bw_changed_cb,
417 void *bw_changed_cb_cls, GAS_get_preferences get_preference,
418 void *get_preference_cls, GAS_get_properties get_properties,
419 void *get_properties_cls);
420
421/**
422 * Change the preference for a peer
423 *
424 * @param handle the solver handle
425 * @param client the client sending this request
426 * @param peer the peer id
427 * @param kind the preference kind to change
428 * @param score the new preference score
429 * @param pref_rel the normalized preference value for this kind over all clients
430 */
431typedef void
432(*GAS_solver_address_change_preference) (void *solver,
433 const struct GNUNET_PeerIdentity *peer, enum GNUNET_ATS_PreferenceKind kind,
434 double pref_rel);
435
436/**
437 * Give feedback about the current assignment
438 *
439 * @param handle the solver handle
440 * @param application the application sending this request
441 * @param peer the peer id
442 * @param scope the time interval for this feedback: [now - scope .. now]
443 * @param kind the preference kind for this feedback
444 * @param score the feedback score
445 */
446typedef void
447(*GAS_solver_address_feedback_preference) (void *solver, void *application,
448 const struct GNUNET_PeerIdentity *peer,
449 const struct GNUNET_TIME_Relative scope,
450 enum GNUNET_ATS_PreferenceKind kind, double score);
451
452/**
453 * Notify the solver about a bulk operation changing possibly a lot of values
454 * Solver will not resolve until all bulk operations are marked as done
455 *
456 * @param solver the solver
457 */
458typedef void
459(*GAS_solver_bulk_start) (void *solver);
460
461/**
462 * Mark a bulk operation as done
463 * Solver will resolve if values have changed
464 *
465 * @param solver the solver
466 */
467typedef void
468(*GAS_solver_bulk_stop) (void *solver);
469
470/**
471 * Add a single address within a network to the solver
472 *
473 * @param solver the solver Handle
474 * @param addresses the address hashmap containing all addresses
475 * @param address the address to add
476 * @param network network type of this address
477 */
478typedef void
479(*GAS_solver_address_add) (void *solver, struct ATS_Address *address,
480 uint32_t network);
481
482/**
483 * Delete an address or just the session from the solver
484 *
485 * @param solver the solver Handle
486 * @param addresses the address hashmap containing all addresses
487 * @param address the address to delete
488 * @param session_only remove address or just session
489 */
490typedef void
491(*GAS_solver_address_delete) (void *solver, struct ATS_Address *address,
492 int session_only);
493
494/**
495 * Transport properties for this address have changed
496 *
497 * @param solver solver handle
498 * @param address the address
499 * @param type the ATSI type in HBO
500 * @param abs_value the absolute value of the property
501 * @param rel_value the normalized value
502 */
503typedef void
504(*GAS_solver_address_property_changed) (void *solver,
505 struct ATS_Address *address, uint32_t type, uint32_t abs_value,
506 double rel_value);
507
508/**
509 * Transport session for this address has changed
510 *
511 * NOTE: values in addresses are already updated
512 *
513 * @param solver solver handle
514 * @param address the address
515 * @param cur_session the current session
516 * @param new_session the new session
517 */
518typedef void
519(*GAS_solver_address_session_changed) (void *solver,
520 struct ATS_Address *address, uint32_t cur_session, uint32_t new_session);
521
522/**
523 * Transport session for this address has changed
524 *
525 * NOTE: values in addresses are already updated
526 *
527 * @param solver solver handle
528 * @param address the address
529 * @param in_use usage state
530 */
531typedef void
532(*GAS_solver_address_inuse_changed) (void *solver, struct ATS_Address *address,
533 int in_use);
534
535/**
536 * Network scope for this address has changed
537 *
538 * NOTE: values in addresses are already updated
539 *
540 * @param solver solver handle
541 * @param address the address
542 * @param current_network the current network
543 * @param new_network the new network
544 */
545typedef void
546(*GAS_solver_address_network_changed) (void *solver,
547 struct ATS_Address *address, uint32_t current_network, uint32_t new_network);
548
549/**
550 * Get the prefered address for a peer from solver
551 *
552 * @param solver the solver to use
553 * @param addresses the address hashmap containing all addresses
554 * @param peer the peer
555 */
556typedef const struct ATS_Address *
557(*GAS_solver_get_preferred_address) (void *solver,
558 const struct GNUNET_PeerIdentity *peer);
559
560/**
561 * Stop getting the prefered address for a peer from solver
562 *
563 * @param solver the solver to use
564 * @param addresses the address hashmap containing all addresses
565 * @param peer the peer
566 */
567typedef void
568(*GAS_solver_stop_get_preferred_address) (void *solver,
569 const struct GNUNET_PeerIdentity *peer);
570
571/**
572 * Shutdown solver
573 *
574 * @param solver the solver to shutdown
575 */
576 351
577typedef void
578(*GAS_solver_done) (void *solver);
579 352
580/** 353/**
581 * Initialize address subsystem. The addresses subsystem manages the addresses 354 * Initialize address subsystem. The addresses subsystem manages the addresses