gnunet-service-ats_plugins.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2011-2014 Christian Grothoff (and other contributing authors)
  4. GNUnet is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published
  6. by the Free Software Foundation; either version 3, or (at your
  7. option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNUnet; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. */
  17. /**
  18. * @file ats/gnunet-service-ats_plugins.h
  19. * @brief ats service plugin management
  20. * @author Matthias Wachs
  21. * @author Christian Grothoff
  22. */
  23. #ifndef GNUNET_SERVICE_ATS_PLUGINS_H
  24. #define GNUNET_SERVICE_ATS_PLUGINS_H
  25. #include "gnunet-service-ats_addresses.h"
  26. /**
  27. * Initialize address subsystem. The addresses subsystem manages the addresses
  28. * known and current performance information. It has a solver component
  29. * responsible for the resource allocation. It tells the solver about changes
  30. * and receives updates when the solver changes the ressource allocation.
  31. *
  32. * @param cfg configuration to use
  33. * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (failed to load
  34. * solver plugin)
  35. */
  36. int
  37. GAS_plugin_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
  38. /**
  39. * Shutdown address subsystem.
  40. */
  41. void
  42. GAS_plugin_done (void);
  43. /**
  44. * The preference changed for a peer, update solver.
  45. *
  46. * @param peer the peer
  47. * @param kind the ATS kind
  48. * @param pref_rel the new relative preference value
  49. */
  50. void
  51. GAS_plugin_notify_preference_changed (const struct GNUNET_PeerIdentity *peer,
  52. enum GNUNET_ATS_PreferenceKind kind,
  53. double pref_rel);
  54. /**
  55. * The relative value for a property changed.
  56. *
  57. * @param address the peer
  58. */
  59. void
  60. GAS_plugin_notify_property_changed (struct ATS_Address *address);
  61. /**
  62. * Tell the solver that the given address can now be used
  63. * for talking to the respective peer.
  64. *
  65. * @param new_address the new address
  66. * @param addr_net network scope the address is in
  67. */
  68. void
  69. GAS_plugin_new_address (struct ATS_Address *new_address);
  70. /**
  71. * Tell the solver that the given address is no longer valid
  72. * can cannot be used any longer.
  73. *
  74. * @param address address that was deleted
  75. */
  76. void
  77. GAS_plugin_delete_address (struct ATS_Address *address);
  78. /**
  79. * Tell the solver that the given client has expressed its
  80. * appreciation for the past performance of a given connection.
  81. *
  82. * @param application client providing the feedback
  83. * @param peer peer the feedback is about
  84. * @param scope timeframe the feedback applies to
  85. * @param kind performance property the feedback relates to
  86. * @param score_abs degree of the appreciation
  87. */
  88. void
  89. GAS_plugin_notify_feedback (struct GNUNET_SERVER_Client *application,
  90. const struct GNUNET_PeerIdentity *peer,
  91. const struct GNUNET_TIME_Relative scope,
  92. enum GNUNET_ATS_PreferenceKind kind,
  93. float score_abs);
  94. /**
  95. * Stop instant solving, there are many state updates
  96. * happening in bulk right now.
  97. */
  98. void
  99. GAS_plugin_solver_lock (void);
  100. /**
  101. * Resume instant solving, we are done with the bulk state updates.
  102. */
  103. void
  104. GAS_plugin_solver_unlock (void);
  105. /**
  106. * Notify the plugin that a request to connect to
  107. * a particular peer was given to us.
  108. *
  109. * @param pid identity of peer we now care about
  110. */
  111. void
  112. GAS_plugin_request_connect_start (const struct GNUNET_PeerIdentity *pid);
  113. /**
  114. * Notify the plugin that a request to connect to
  115. * a particular peer was dropped.
  116. *
  117. * @param pid identity of peer we care now less about
  118. */
  119. void
  120. GAS_plugin_request_connect_stop (const struct GNUNET_PeerIdentity *pid);
  121. #endif