gnunet_ats_application_service.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2010-2015, 2018 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
  18. * Bandwidth allocation API for applications to interact with
  19. *
  20. * @author Christian Grothoff
  21. * @author Matthias Wachs
  22. *
  23. * @defgroup ats ATS service
  24. * Bandwidth allocation
  25. *
  26. * @see [Documentation](https://gnunet.org/ats-subsystem)
  27. *
  28. * @{
  29. */
  30. #ifndef GNUNET_ATS_APPLICATION_SERVICE_H
  31. #define GNUNET_ATS_APPLICATION_SERVICE_H
  32. #include "gnunet_constants.h"
  33. #include "gnunet_util_lib.h"
  34. /**
  35. * Handle to the ATS subsystem for making suggestions about
  36. * connections the peer would like to have.
  37. */
  38. struct GNUNET_ATS_ApplicationHandle;
  39. /**
  40. * Initialize the ATS application client handle.
  41. *
  42. * @param cfg configuration to use
  43. * @return ats application handle, NULL on error
  44. */
  45. struct GNUNET_ATS_ApplicationHandle *
  46. GNUNET_ATS_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
  47. /**
  48. * Shutdown ATS application client.
  49. *
  50. * @param ch handle to destroy
  51. */
  52. void
  53. GNUNET_ATS_application_done (struct GNUNET_ATS_ApplicationHandle *ch);
  54. /**
  55. * Handle for suggestion requests.
  56. */
  57. struct GNUNET_ATS_ApplicationSuggestHandle;
  58. /**
  59. * An application would like to communicate with a peer. ATS should
  60. * allocate bandwith using a suitable address for requiremetns @a pk
  61. * to transport.
  62. *
  63. * @param ch handle
  64. * @param peer identity of the peer we need an address for
  65. * @param pk what kind of application will the application require (can be
  66. * #GNUNET_MQ_PREFERENCE_NONE, we will still try to connect)
  67. * @param bw desired bandwith, can be zero (we will still try to connect)
  68. * @return suggestion handle, NULL if request is already pending
  69. */
  70. struct GNUNET_ATS_ApplicationSuggestHandle *
  71. GNUNET_ATS_application_suggest (struct GNUNET_ATS_ApplicationHandle *ch,
  72. const struct GNUNET_PeerIdentity *peer,
  73. enum GNUNET_MQ_PreferenceKind pk,
  74. struct GNUNET_BANDWIDTH_Value32NBO bw);
  75. /**
  76. * We no longer care about communicating with a peer.
  77. *
  78. * @param sh handle
  79. */
  80. void
  81. GNUNET_ATS_application_suggest_cancel (struct GNUNET_ATS_ApplicationSuggestHandle *sh);
  82. /** @} */ /* end of group */
  83. #endif
  84. /* end of file gnunet_ats_application_service.h */