gnunet_transport_application_service.h 2.9 KB

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