also config files
[oweals/gnunet.git] / src / transport / gnunet-service-transport_manipulation.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2010-2015 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  * @file transport/gnunet-service-transport_neighbours.h
23  * @brief neighbour manipulation API, allows manipulation of
24  *        performance metrics (delay and towards ATS)
25  * @author Christian Grothoff
26  */
27 #ifndef GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
28 #define GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
29
30 #include "platform.h"
31 #include "gnunet-service-transport_hello.h"
32 #include "gnunet-service-transport_neighbours.h"
33 #include "gnunet-service-transport_plugins.h"
34 #include "gnunet-service-transport_validation.h"
35 #include "gnunet-service-transport.h"
36 #include "transport.h"
37
38
39 /**
40  * Set traffic metric to manipulate
41  *
42  * @param message containing information
43  */
44 void
45 GST_manipulation_set_metric (const struct TrafficMetricMessage *tm);
46
47
48 /**
49  * Adapter function between transport's send function and transport plugins
50  *
51  * @param target the peer the message to send to
52  * @param msg the message received
53  * @param msg_size message size
54  * @param timeout timeout
55  * @param cont the continuation to call after sending
56  * @param cont_cls cls for continuation
57  */
58 void
59 GST_manipulation_send (const struct GNUNET_PeerIdentity *target,
60                        const void *msg,
61                        size_t msg_size,
62                        struct GNUNET_TIME_Relative timeout,
63                        GST_NeighbourSendContinuation cont,
64                        void *cont_cls);
65
66
67 /**
68  * Adapter function between transport plugins and transport receive function
69  * manipulation delays for next send.
70  *
71  * @param cls the closure for transport
72  * @param address the address and the peer the message was received from
73  * @param message the message received
74  * @param session the session the message was received on
75  * @return manipulated delay for next receive
76  */
77 struct GNUNET_TIME_Relative
78 GST_manipulation_recv (void *cls,
79                        const struct GNUNET_HELLO_Address *address,
80                        struct GNUNET_ATS_Session *session,
81                        const struct GNUNET_MessageHeader *message);
82
83
84 /**
85  * Function that will be called to manipulate ATS information according to
86  * current manipulation settings
87  *
88  * @param address binary address
89  * @param session the session
90  * @param prop[IN|OUT] metrics to modify
91  */
92 void
93 GST_manipulation_manipulate_metrics (const struct GNUNET_HELLO_Address *address,
94                                      struct GNUNET_ATS_Session *session,
95                                      struct GNUNET_ATS_Properties *prop);
96
97
98 /**
99  * Notify manipulation about disconnect so it can discard queued messages
100  *
101  * @param peer the disconnecting peer
102  */
103 void
104 GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer);
105
106
107 /**
108  * Initialize traffic manipulation
109  */
110 void
111 GST_manipulation_init (void);
112
113
114 /**
115  * Stop traffic manipulation
116  */
117 void
118 GST_manipulation_stop (void);
119
120 #endif
121 /* end of file gnunet-service-transport_neighbours.h */