aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats_addresses.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-22 23:04:40 +0000
committerChristian Grothoff <christian@grothoff.org>2015-01-22 23:04:40 +0000
commita57305cef1ec471aea627810955e6f6cec36d847 (patch)
tree475a79a451277b60033a9919fb2499c197cc77ab /src/ats/gnunet-service-ats_addresses.h
parent78b8e1c2a54c44992a16b65cdf67fea973e2cad0 (diff)
downloadgnunet-a57305cef1ec471aea627810955e6f6cec36d847.tar.gz
gnunet-a57305cef1ec471aea627810955e6f6cec36d847.zip
use statics instead of singleton struct, simplify internal APIs
Diffstat (limited to 'src/ats/gnunet-service-ats_addresses.h')
-rw-r--r--src/ats/gnunet-service-ats_addresses.h68
1 files changed, 19 insertions, 49 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index ee599721d..2f21ae380 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -408,11 +408,6 @@ struct ATS_Address
408 408
409 409
410/** 410/**
411 * Handle for ATS address component
412 */
413struct GAS_Addresses_Handle;
414
415/**
416 * Initialize address subsystem. The addresses subsystem manages the addresses 411 * Initialize address subsystem. The addresses subsystem manages the addresses
417 * known and current performance information. It has a solver component 412 * known and current performance information. It has a solver component
418 * responsible for the resource allocation. It tells the solver about changes 413 * responsible for the resource allocation. It tells the solver about changes
@@ -420,26 +415,24 @@ struct GAS_Addresses_Handle;
420 * 415 *
421 * @param cfg configuration to use 416 * @param cfg configuration to use
422 * @param stats the statistics handle to use 417 * @param stats the statistics handle to use
423 * @return an address handle 418 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (failed to load
419 * solver plugin)
424 */ 420 */
425struct GAS_Addresses_Handle * 421int
426GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, 422GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
427 struct GNUNET_STATISTICS_Handle *stats); 423 struct GNUNET_STATISTICS_Handle *stats);
428 424
429 425
430/** 426/**
431 * Shutdown address subsystem. 427 * Shutdown address subsystem.
432 *
433 * @param handle the address handle to shutdown
434 */ 428 */
435void 429void
436GAS_addresses_done (struct GAS_Addresses_Handle *handle); 430GAS_addresses_done (void);
437 431
438 432
439/** 433/**
440 * Add a new address for a peer. 434 * Add a new address for a peer.
441 * 435 *
442 * @param handle the address handle to use
443 * @param peer peer 436 * @param peer peer
444 * @param plugin_name transport plugin name 437 * @param plugin_name transport plugin name
445 * @param plugin_addr plugin address 438 * @param plugin_addr plugin address
@@ -450,8 +443,7 @@ GAS_addresses_done (struct GAS_Addresses_Handle *handle);
450 * @param atsi_count number of performance information contained in @a atsi 443 * @param atsi_count number of performance information contained in @a atsi
451 */ 444 */
452void 445void
453GAS_addresses_add (struct GAS_Addresses_Handle *handle, 446GAS_addresses_add (const struct GNUNET_PeerIdentity *peer,
454 const struct GNUNET_PeerIdentity *peer,
455 const char *plugin_name, 447 const char *plugin_name,
456 const void *plugin_addr, 448 const void *plugin_addr,
457 size_t plugin_addr_len, 449 size_t plugin_addr_len,
@@ -471,15 +463,13 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle,
471 * Note: can only be called with in_use == #GNUNET_NO if called with #GNUNET_YES 463 * Note: can only be called with in_use == #GNUNET_NO if called with #GNUNET_YES
472 * before 464 * before
473 * 465 *
474 * @param handle the address handle to use
475 * @param peer peer 466 * @param peer peer
476 * @param session_id session id, can never be 0 467 * @param session_id session id, can never be 0
477 * @param in_use #GNUNET_YES if #GNUNET_NO FIXME 468 * @param in_use #GNUNET_YES if #GNUNET_NO FIXME
478 * @return #GNUNET_SYSERR on failure (address unknown ...) 469 * @return #GNUNET_SYSERR on failure (address unknown ...)
479 */ 470 */
480int 471int
481GAS_addresses_in_use (struct GAS_Addresses_Handle *handle, 472GAS_addresses_in_use (const struct GNUNET_PeerIdentity *peer,
482 const struct GNUNET_PeerIdentity *peer,
483 uint32_t session_id, 473 uint32_t session_id,
484 int in_use); 474 int in_use);
485 475
@@ -487,15 +477,13 @@ GAS_addresses_in_use (struct GAS_Addresses_Handle *handle,
487/** 477/**
488 * Update an address with new performance information for a peer. 478 * Update an address with new performance information for a peer.
489 * 479 *
490 * @param handle the address handle to use
491 * @param peer peer 480 * @param peer peer
492 * @param session_id session id, can never be 0 481 * @param session_id session id, can never be 0
493 * @param atsi performance information for this address 482 * @param atsi performance information for this address
494 * @param atsi_count number of performance information contained in @a atsi 483 * @param atsi_count number of performance information contained in @a atsi
495 */ 484 */
496void 485void
497GAS_addresses_update (struct GAS_Addresses_Handle *handle, 486GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
498 const struct GNUNET_PeerIdentity *peer,
499 uint32_t session_id, 487 uint32_t session_id,
500 const struct GNUNET_ATS_Information *atsi, 488 const struct GNUNET_ATS_Information *atsi,
501 uint32_t atsi_count); 489 uint32_t atsi_count);
@@ -504,45 +492,37 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle,
504/** 492/**
505 * Remove an address or just a session for a peer. 493 * Remove an address or just a session for a peer.
506 * 494 *
507 * @param handle the address handle to use
508 * @param peer peer 495 * @param peer peer
509 * @param session_id session id, can never be 0 496 * @param session_id session id, can never be 0
510 */ 497 */
511void 498void
512GAS_addresses_destroy (struct GAS_Addresses_Handle *handle, 499GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
513 const struct GNUNET_PeerIdentity *peer,
514 uint32_t session_id); 500 uint32_t session_id);
515 501
516 502
517/** 503/**
518 * Remove all addresses 504 * Remove all addresses
519 *
520 * @param handle the address handle to use
521 */ 505 */
522void 506void
523GAS_addresses_destroy_all (struct GAS_Addresses_Handle *handle); 507GAS_addresses_destroy_all (void);
524 508
525 509
526/** 510/**
527 * Request address suggestions for a peer 511 * Request address suggestions for a peer
528 * 512 *
529 * @param handle the address handle
530 * @param peer the peer id 513 * @param peer the peer id
531 */ 514 */
532void 515void
533GAS_addresses_request_address (struct GAS_Addresses_Handle *handle, 516GAS_addresses_request_address (const struct GNUNET_PeerIdentity *peer);
534 const struct GNUNET_PeerIdentity *peer);
535 517
536 518
537/** 519/**
538 * Cancel address suggestions for a peer 520 * Cancel address suggestions for a peer
539 * 521 *
540 * @param handle the address handle
541 * @param peer the peer id 522 * @param peer the peer id
542 */ 523 */
543void 524void
544GAS_addresses_request_address_cancel (struct GAS_Addresses_Handle *handle, 525GAS_addresses_request_address_cancel (const struct GNUNET_PeerIdentity *peer);
545 const struct GNUNET_PeerIdentity *peer);
546 526
547 527
548/** 528/**
@@ -551,37 +531,31 @@ GAS_addresses_request_address_cancel (struct GAS_Addresses_Handle *handle,
551 * Suggesting addresses is blocked for ATS_BLOCKING_DELTA. Blocking can be 531 * Suggesting addresses is blocked for ATS_BLOCKING_DELTA. Blocking can be
552 * reset using this function 532 * reset using this function
553 * 533 *
554 * @param handle the address handle
555 * @param peer the peer id 534 * @param peer the peer id
556 */ 535 */
557void 536void
558GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle, 537GAS_addresses_handle_backoff_reset (const struct GNUNET_PeerIdentity *peer);
559 const struct GNUNET_PeerIdentity *peer);
560 538
561 539
562/** 540/**
563 * A performance client disconnected 541 * A performance client disconnected
564 * 542 *
565 * @param handle address handle 543 * @param client the client; FIXME: type!?
566 * @param client the client
567 */ 544 */
568void 545void
569GAS_addresses_preference_client_disconnect (struct GAS_Addresses_Handle *handle, 546GAS_addresses_preference_client_disconnect (void *client);
570 void *client);
571 547
572 548
573/** 549/**
574 * Change the preference for a peer 550 * Change the preference for a peer
575 * 551 *
576 * @param handle the address handle 552 * @param client the client sending this request; FIXME: type!?
577 * @param client the client sending this request
578 * @param peer the peer id 553 * @param peer the peer id
579 * @param kind the preference kind to change 554 * @param kind the preference kind to change
580 * @param score_abs the new preference score 555 * @param score_abs the new preference score
581 */ 556 */
582void 557void
583GAS_addresses_preference_change (struct GAS_Addresses_Handle *handle, 558GAS_addresses_preference_change (void *client,
584 void *client,
585 const struct GNUNET_PeerIdentity *peer, 559 const struct GNUNET_PeerIdentity *peer,
586 enum GNUNET_ATS_PreferenceKind kind, 560 enum GNUNET_ATS_PreferenceKind kind,
587 float score_abs); 561 float score_abs);
@@ -598,16 +572,14 @@ GAS_addresses_preference_change (struct GAS_Addresses_Handle *handle,
598 * If the application has no feedback for this preference kind the application 572 * If the application has no feedback for this preference kind the application
599 * will not explicitly call. 573 * will not explicitly call.
600 * 574 *
601 * @param handle the address handle 575 * @param application the application sending this request; FIXME: type?
602 * @param application the application sending this request
603 * @param peer the peer id 576 * @param peer the peer id
604 * @param scope the time interval this valid for: [now - scope .. now] 577 * @param scope the time interval this valid for: [now - scope .. now]
605 * @param kind the preference kind this feedback is intended for 578 * @param kind the preference kind this feedback is intended for
606 * @param score_abs the new preference score 579 * @param score_abs the new preference score
607 */ 580 */
608void 581void
609GAS_addresses_preference_feedback (struct GAS_Addresses_Handle *handle, 582GAS_addresses_preference_feedback (void *application,
610 void *application,
611 const struct GNUNET_PeerIdentity *peer, 583 const struct GNUNET_PeerIdentity *peer,
612 const struct GNUNET_TIME_Relative scope, 584 const struct GNUNET_TIME_Relative scope,
613 enum GNUNET_ATS_PreferenceKind kind, 585 enum GNUNET_ATS_PreferenceKind kind,
@@ -644,14 +616,12 @@ typedef void
644/** 616/**
645 * Return information all peers currently known to ATS 617 * Return information all peers currently known to ATS
646 * 618 *
647 * @param handle the address handle to use
648 * @param peer the respective peer 619 * @param peer the respective peer
649 * @param pi_it the iterator to call for every peer 620 * @param pi_it the iterator to call for every peer
650 * @param pi_it_cls the closure for @a pi_it 621 * @param pi_it_cls the closure for @a pi_it
651 */ 622 */
652void 623void
653GAS_addresses_get_peer_info (struct GAS_Addresses_Handle *handle, 624GAS_addresses_get_peer_info (const struct GNUNET_PeerIdentity *peer,
654 const struct GNUNET_PeerIdentity *peer,
655 GNUNET_ATS_PeerInfo_Iterator pi_it, 625 GNUNET_ATS_PeerInfo_Iterator pi_it,
656 void *pi_it_cls); 626 void *pi_it_cls);
657 627