first batch of license fixes (boring)
[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 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
16 /**
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
21  */
22 #ifndef GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
23 #define GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
24
25 #include "platform.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"
32
33
34 /**
35  * Set traffic metric to manipulate
36  *
37  * @param message containing information
38  */
39 void
40 GST_manipulation_set_metric (const struct TrafficMetricMessage *tm);
41
42
43 /**
44  * Adapter function between transport's send function and transport plugins
45  *
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
52  */
53 void
54 GST_manipulation_send (const struct GNUNET_PeerIdentity *target,
55                        const void *msg,
56                        size_t msg_size,
57                        struct GNUNET_TIME_Relative timeout,
58                        GST_NeighbourSendContinuation cont,
59                        void *cont_cls);
60
61
62 /**
63  * Adapter function between transport plugins and transport receive function
64  * manipulation delays for next send.
65  *
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
71  */
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);
77
78
79 /**
80  * Function that will be called to manipulate ATS information according to
81  * current manipulation settings
82  *
83  * @param address binary address
84  * @param session the session
85  * @param prop[IN|OUT] metrics to modify
86  */
87 void
88 GST_manipulation_manipulate_metrics (const struct GNUNET_HELLO_Address *address,
89                                      struct GNUNET_ATS_Session *session,
90                                      struct GNUNET_ATS_Properties *prop);
91
92
93 /**
94  * Notify manipulation about disconnect so it can discard queued messages
95  *
96  * @param peer the disconnecting peer
97  */
98 void
99 GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer);
100
101
102 /**
103  * Initialize traffic manipulation
104  */
105 void
106 GST_manipulation_init (void);
107
108
109 /**
110  * Stop traffic manipulation
111  */
112 void
113 GST_manipulation_stop (void);
114
115 #endif
116 /* end of file gnunet-service-transport_neighbours.h */