-Merge branch 'master' of ssh://gnunet.org/gnunet into gsoc2018/rest_api
[oweals/gnunet.git] / src / include / gnunet_transport_manipulation_service.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009-2014, 2016 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
19 /**
20  * @author Christian Grothoff
21  *
22  * @file
23  * Low-level P2P IO
24  *
25  * @defgroup transport  Transport service
26  * Low-level P2P IO
27  *
28  * @see [Documentation](https://gnunet.org/transport-service)
29  *
30  * @{
31  */
32
33 #ifndef GNUNET_TRANSPORT_MANIPULATION_SERVICE_H
34 #define GNUNET_TRANSPORT_MANIPULATION_SERVICE_H
35
36
37 #ifdef __cplusplus
38 extern "C"
39 {
40 #if 0                           /* keep Emacsens' auto-indent happy */
41 }
42 #endif
43 #endif
44
45 #include "gnunet_util_lib.h"
46 #include "gnunet_ats_service.h"
47
48 /**
49  * Version number of the transport API.
50  */
51 #define GNUNET_TRANSPORT_MANIPULATION_VERSION 0x00000003
52
53 /**
54  * Handle for transport manipulation.
55  */
56 struct GNUNET_TRANSPORT_ManipulationHandle;
57
58
59 /**
60  * Connect to the transport service.  Note that the connection may
61  * complete (or fail) asynchronously.
62  *
63  * @param cfg configuration to use
64  * @return NULL on error
65  */
66 struct GNUNET_TRANSPORT_ManipulationHandle *
67 GNUNET_TRANSPORT_manipulation_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
68
69
70 /**
71  * Disconnect from the transport service.
72  *
73  * @param handle handle returned from connect
74  */
75 void
76 GNUNET_TRANSPORT_manipulation_disconnect (struct GNUNET_TRANSPORT_ManipulationHandle *handle);
77
78
79 /**
80  * Set transport metrics for a peer and a direction
81  *
82  * @param handle transport handle
83  * @param peer the peer to set the metric for
84  * @param prop the performance metrics to set
85  * @param delay_in inbound delay to introduce
86  * @param delay_out outbound delay to introduce
87  *
88  * Note: Delay restrictions in receiving direction will be enforced
89  * with one message delay.
90  */
91 void
92 GNUNET_TRANSPORT_manipulation_set (struct GNUNET_TRANSPORT_ManipulationHandle *handle,
93                                    const struct GNUNET_PeerIdentity *peer,
94                                    const struct GNUNET_ATS_Properties *prop,
95                                    struct GNUNET_TIME_Relative delay_in,
96                                    struct GNUNET_TIME_Relative delay_out);
97
98
99 #if 0                           /* keep Emacsens' auto-indent happy */
100 {
101 #endif
102 #ifdef __cplusplus
103 }
104 #endif
105
106 /* ifndef GNUNET_TRANSPORT_MANIPULATION_SERVICE_H */
107 #endif
108
109 /** @} */  /* end of group */
110
111 /* end of gnunet_transport_manipulation_service.h */