2 This file is part of GNUnet.
3 Copyright (C) 2010-2015, 2018, 2019 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * Bandwidth allocation API for applications to interact with
24 * @author Christian Grothoff
25 * @author Matthias Wachs
27 * @defgroup TRANSPORT service
28 * Bandwidth allocation
32 #ifndef GNUNET_TRANSPORT_APPLICATION_SERVICE_H
33 #define GNUNET_TRANSPORT_APPLICATION_SERVICE_H
35 #include "gnunet_constants.h"
36 #include "gnunet_util_lib.h"
37 #include "gnunet_nt_lib.h"
40 * Handle to the TRANSPORT subsystem for making suggestions about
41 * connections the peer would like to have.
43 struct GNUNET_TRANSPORT_ApplicationHandle;
47 * Initialize the TRANSPORT application client handle.
49 * @param cfg configuration to use
50 * @return ats application handle, NULL on error
52 struct GNUNET_TRANSPORT_ApplicationHandle *
53 GNUNET_TRANSPORT_application_init(
54 const struct GNUNET_CONFIGURATION_Handle *cfg);
58 * Shutdown TRANSPORT application client.
60 * @param ch handle to destroy
63 GNUNET_TRANSPORT_application_done(
64 struct GNUNET_TRANSPORT_ApplicationHandle *ch);
68 * An application would like TRANSPORT to connect to a peer.
71 * @param peer identity of the peer we need an address for
72 * @param pk what kind of application will the application require (can be
73 * #GNUNET_MQ_PRIO_BACKGROUND, we will still try to connect)
74 * @param bw desired bandwith, can be zero (we will still try to connect)
75 * @return suggest handle, NULL if a request is already pending
77 struct GNUNET_TRANSPORT_ApplicationSuggestHandle *
78 GNUNET_TRANSPORT_application_suggest(
79 struct GNUNET_TRANSPORT_ApplicationHandle *ch,
80 const struct GNUNET_PeerIdentity *peer,
81 enum GNUNET_MQ_PriorityPreferences pk,
82 struct GNUNET_BANDWIDTH_Value32NBO bw);
86 * We no longer care about being connected to a peer.
88 * @param sh handle to stop
91 GNUNET_TRANSPORT_application_suggest_cancel(
92 struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh);
96 * An application (or a communicator) has received a HELLO (or other address
97 * data of another peer) and wants TRANSPORT to validate that the address is
98 * correct. The result is NOT returned, in fact TRANSPORT may do nothing
99 * (i.e. if it has too many active validations or recently tried this one
100 * already). If the @a addr validates, TRANSPORT will persist the address
104 * @param peer identity of the peer we have an address for
105 * @param nt network type of @a addr (as claimed by the other peer);
106 * used by TRANSPORT to avoid trying @a addr's that really cannot work
107 * due to network type missmatches
108 * @param addr address to validate
111 GNUNET_TRANSPORT_application_validate(
112 struct GNUNET_TRANSPORT_ApplicationHandle *ch,
113 const struct GNUNET_PeerIdentity *peer,
114 enum GNUNET_NetworkType nt,
117 /** @} */ /* end of group */
120 /* end of file gnunet_ats_application_service.h */