2 This file is part of GNUnet.
3 Copyright (C) 2010-2015 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/>.
20 * @file transport/gnunet-service-transport_neighbours.h
21 * @brief neighbour manipulation API, allows manipulation of
22 * performance metrics (delay and towards ATS)
23 * @author Christian Grothoff
25 #ifndef GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
26 #define GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
29 #include "gnunet-service-transport_hello.h"
30 #include "gnunet-service-transport_neighbours.h"
31 #include "gnunet-service-transport_plugins.h"
32 #include "gnunet-service-transport_validation.h"
33 #include "gnunet-service-transport.h"
34 #include "transport.h"
38 * Set traffic metric to manipulate
40 * @param message containing information
43 GST_manipulation_set_metric (const struct TrafficMetricMessage *tm);
47 * Adapter function between transport's send function and transport plugins
49 * @param target the peer the message to send to
50 * @param msg the message received
51 * @param msg_size message size
52 * @param timeout timeout
53 * @param cont the continuation to call after sending
54 * @param cont_cls cls for continuation
57 GST_manipulation_send (const struct GNUNET_PeerIdentity *target,
60 struct GNUNET_TIME_Relative timeout,
61 GST_NeighbourSendContinuation cont,
66 * Adapter function between transport plugins and transport receive function
67 * manipulation delays for next send.
69 * @param cls the closure for transport
70 * @param address the address and the peer the message was received from
71 * @param message the message received
72 * @param session the session the message was received on
73 * @return manipulated delay for next receive
75 struct GNUNET_TIME_Relative
76 GST_manipulation_recv (void *cls,
77 const struct GNUNET_HELLO_Address *address,
78 struct GNUNET_ATS_Session *session,
79 const struct GNUNET_MessageHeader *message);
83 * Function that will be called to manipulate ATS information according to
84 * current manipulation settings
86 * @param address binary address
87 * @param session the session
88 * @param prop[IN|OUT] metrics to modify
91 GST_manipulation_manipulate_metrics (const struct GNUNET_HELLO_Address *address,
92 struct GNUNET_ATS_Session *session,
93 struct GNUNET_ATS_Properties *prop);
97 * Notify manipulation about disconnect so it can discard queued messages
99 * @param peer the disconnecting peer
102 GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer);
106 * Initialize traffic manipulation
109 GST_manipulation_init (void);
113 * Stop traffic manipulation
116 GST_manipulation_stop (void);
119 /* end of file gnunet-service-transport_neighbours.h */