merge
[oweals/gnunet.git] / src / include / gnunet_transport_address_service.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009-2018 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 /**
22  * @author Christian Grothoff
23  *
24  * @file
25  * Provide addresses to transport for validation
26  *
27  * @defgroup transport TRANSPORT service
28  * Low-level communication with other peers
29  *
30  * @see [Documentation](https://gnunet.org/transport-service)
31  *
32  * @{
33  */
34
35 #ifndef GNUNET_TRANSPORT_ADDRESS_SERVICE_H
36 #define GNUNET_TRANSPORT_ADDRESS_SERVICE_H
37
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #if 0                           /* keep Emacsens' auto-indent happy */
42 }
43 #endif
44 #endif
45
46 #include "gnunet_util_lib.h"
47 #include "gnunet_nt_lib.h"
48
49 /**
50  * Version number of the transport address API.
51  */
52 #define GNUNET_TRANSPORT_ADDRESS_VERSION 0x00000000
53
54
55 /**
56  * Opaque handle to the transport service for communicators.
57  */
58 struct GNUNET_TRANSPORT_AddressHandle;
59
60
61 /**
62  * Connect to the transport service.
63  *
64  * @param cfg configuration to use
65  * @return NULL on error
66  */
67 struct GNUNET_TRANSPORT_AddressHandle *
68 GNUNET_TRANSPORT_address_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
69
70
71 /**
72  * Disconnect from the transport service.
73  *
74  * @param ch handle returned from connect
75  */
76 void
77 GNUNET_TRANSPORT_address_disconnect (struct GNUNET_TRANSPORT_AddressHandle *ch);
78
79
80 /**
81  * The client has learned about a possible address for peer @a pid
82  * (i.e. via broadcast, multicast, DHT, ...).  The transport service
83  * should consider validating it. Note that the plugin is NOT expected
84  * to have verified the signature, the transport service must decide
85  * whether to check the signature.
86  *
87  * While the notification is sent to @a ch asynchronously, this API
88  * does not return a handle as the delivery of addresses is simply
89  * unreliable, and if @a ch is down, the data provided will simply be
90  * lost.
91  *
92  * @param ch communicator handle
93  * @param pid peer the address is for
94  * @param raw raw address data
95  * @param raw_size number of bytes in @a raw
96  */
97 void
98 GNUNET_TRANSPORT_address_try (struct GNUNET_TRANSPORT_AddressHandle *ch,
99                               const struct GNUNET_PeerIdentity *pid,
100                               const void *raw,
101                               const size_t raw_size);
102
103
104 #if 0                           /* keep Emacsens' auto-indent happy */
105 {
106 #endif
107 #ifdef __cplusplus
108 }
109 #endif
110
111 /* ifndef GNUNET_TRANSPORT_ADDRESS_SERVICE_H */
112 #endif
113
114 /** @} */  /* end of group */
115
116 /* end of gnunet_transport_address_service.h */