gnunet-service-ats_preferences.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2011-2014 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your 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. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @file ats/gnunet-service-ats_preferences.h
  18. * @brief manage preferences expressed by clients
  19. * @author Matthias Wachs
  20. * @author Christian Grothoff
  21. */
  22. #ifndef GNUNET_SERVICE_ATS_PREFERENCES_H
  23. #define GNUNET_SERVICE_ATS_PREFERENCES_H
  24. #include "gnunet_util_lib.h"
  25. #include "gnunet_ats_service.h"
  26. #include "gnunet-service-ats.h"
  27. #include "gnunet_statistics_service.h"
  28. #include "ats.h"
  29. /**
  30. * Default preference value we assume if we know nothing.
  31. */
  32. #define DEFAULT_ABS_PREFERENCE 0.0
  33. /**
  34. * Default relative preference value we assume if we know nothing.
  35. */
  36. #define DEFAULT_REL_PREFERENCE 0.0
  37. /**
  38. * Handle 'preference change' messages from clients.
  39. *
  40. * @param client the client that sent the request
  41. * @param msg the request message
  42. */
  43. void
  44. GAS_handle_preference_change(struct GNUNET_SERVICE_Client *client,
  45. const struct ChangePreferenceMessage *msg);
  46. /**
  47. * Initialize preferences subsystem.
  48. */
  49. void
  50. GAS_preference_init(void);
  51. /**
  52. * Shutdown preferences subsystem.
  53. */
  54. void
  55. GAS_preference_done(void);
  56. /**
  57. * Get the normalized preference values for a specific peer.
  58. *
  59. * @param cls ignored
  60. * @param id the peer
  61. * @return pointer to the values, can be indexed
  62. * with `enum GNUNET_ATS_PreferenceKind`, never NULL
  63. */
  64. const double *
  65. GAS_preference_get_by_peer(void *cls,
  66. const struct GNUNET_PeerIdentity *id);
  67. /**
  68. * A performance client disconnected
  69. *
  70. * @param client the disconnecting client
  71. */
  72. void
  73. GAS_preference_client_disconnect(struct GNUNET_SERVICE_Client *client);
  74. #endif