RECLAIM/OIDC: code cleanup
[oweals/gnunet.git] / src / include / gnunet_transport_application_service.h
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2010-2015, 2018, 2019 GNUnet e.V.
4
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.
9
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.
14
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/>.
17
18      SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 /**
21  * @file
22  * Bandwidth allocation API for applications to interact with
23  *
24  * @author Christian Grothoff
25  * @author Matthias Wachs
26  *
27  * @defgroup TRANSPORT service
28  * Bandwidth allocation
29  *
30  * @{
31  */
32 #ifndef GNUNET_TRANSPORT_APPLICATION_SERVICE_H
33 #define GNUNET_TRANSPORT_APPLICATION_SERVICE_H
34
35 #include "gnunet_constants.h"
36 #include "gnunet_util_lib.h"
37 #include "gnunet_nt_lib.h"
38
39 /**
40  * Handle to the TRANSPORT subsystem for making suggestions about
41  * connections the peer would like to have.
42  */
43 struct GNUNET_TRANSPORT_ApplicationHandle;
44
45
46 /**
47  * Initialize the TRANSPORT application client handle.
48  *
49  * @param cfg configuration to use
50  * @return ats application handle, NULL on error
51  */
52 struct GNUNET_TRANSPORT_ApplicationHandle *
53 GNUNET_TRANSPORT_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
54
55
56 /**
57  * Shutdown TRANSPORT application client.
58  *
59  * @param ch handle to destroy
60  */
61 void
62 GNUNET_TRANSPORT_application_done (struct GNUNET_TRANSPORT_ApplicationHandle *ch);
63
64
65 /**
66  * An application (or a communicator) has received a HELLO (or other address
67  * data of another peer) and wants TRANSPORT to validate that the address is
68  * correct.  The result is NOT returned, in fact TRANSPORT may do nothing
69  * (i.e. if it has too many active validations or recently tried this one
70  * already).  If the @a addr validates, TRANSPORT will persist the address
71  * with PEERSTORE.
72  *
73  * @param ch handle
74  * @param peer identity of the peer we have an address for
75  * @param expiration when does @a addr expire; used by TRANSPORT to know when
76  *        to definitively give up attempting to validate
77  * @param nt network type of @a addr (as claimed by the other peer);
78  *        used by TRANSPORT to avoid trying @a addr's that really cannot work
79  *        due to network type missmatches
80  * @param addr address to validate
81  */
82 void
83 GNUNET_TRANSPORT_application_validate (struct GNUNET_TRANSPORT_ApplicationHandle *ch,
84                                        const struct GNUNET_PeerIdentity *peer,
85                                        struct GNUNET_TIME_Absolute expiration,
86                                        enum GNUNET_NetworkType nt,
87                                        const char *addr);
88
89 /** @} */  /* end of group */
90
91 #endif
92 /* end of file gnunet_ats_application_service.h */