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.
17 * @file transport/gnunet-service-transport_neighbours.h
18 * @brief neighbour manipulation API, allows manipulation of
19 * performance metrics (delay and towards ATS)
20 * @author Christian Grothoff
22 #ifndef GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
23 #define GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
26 #include "gnunet-service-transport_hello.h"
27 #include "gnunet-service-transport_neighbours.h"
28 #include "gnunet-service-transport_plugins.h"
29 #include "gnunet-service-transport_validation.h"
30 #include "gnunet-service-transport.h"
31 #include "transport.h"
35 * Set traffic metric to manipulate
37 * @param message containing information
40 GST_manipulation_set_metric (const struct TrafficMetricMessage *tm);
44 * Adapter function between transport's send function and transport plugins
46 * @param target the peer the message to send to
47 * @param msg the message received
48 * @param msg_size message size
49 * @param timeout timeout
50 * @param cont the continuation to call after sending
51 * @param cont_cls cls for continuation
54 GST_manipulation_send (const struct GNUNET_PeerIdentity *target,
57 struct GNUNET_TIME_Relative timeout,
58 GST_NeighbourSendContinuation cont,
63 * Adapter function between transport plugins and transport receive function
64 * manipulation delays for next send.
66 * @param cls the closure for transport
67 * @param address the address and the peer the message was received from
68 * @param message the message received
69 * @param session the session the message was received on
70 * @return manipulated delay for next receive
72 struct GNUNET_TIME_Relative
73 GST_manipulation_recv (void *cls,
74 const struct GNUNET_HELLO_Address *address,
75 struct GNUNET_ATS_Session *session,
76 const struct GNUNET_MessageHeader *message);
80 * Function that will be called to manipulate ATS information according to
81 * current manipulation settings
83 * @param address binary address
84 * @param session the session
85 * @param prop[IN|OUT] metrics to modify
88 GST_manipulation_manipulate_metrics (const struct GNUNET_HELLO_Address *address,
89 struct GNUNET_ATS_Session *session,
90 struct GNUNET_ATS_Properties *prop);
94 * Notify manipulation about disconnect so it can discard queued messages
96 * @param peer the disconnecting peer
99 GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer);
103 * Initialize traffic manipulation
106 GST_manipulation_init (void);
110 * Stop traffic manipulation
113 GST_manipulation_stop (void);
116 /* end of file gnunet-service-transport_neighbours.h */