-fix time assertion introduce in last patch
[oweals/gnunet.git] / src / transport / gnunet-service-transport_manipulation.h
1 /*
2      This file is part of GNUnet.
3      (C) 2010,2011 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      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      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @file transport/gnunet-service-transport_neighbours.h
23  * @brief neighbour management API
24  * @author Christian Grothoff
25  */
26 #ifndef GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
27 #define GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
28
29 #include "platform.h"
30 #include "gnunet-service-transport_blacklist.h"
31 #include "gnunet-service-transport_clients.h"
32 #include "gnunet-service-transport_hello.h"
33 #include "gnunet-service-transport_neighbours.h"
34 #include "gnunet-service-transport_plugins.h"
35 #include "gnunet-service-transport_validation.h"
36 #include "gnunet-service-transport.h"
37 #include "transport.h"
38
39
40 /**
41  * Set traffic metric to manipulate
42  *
43  * @param cls closure
44  * @param client client sending message
45  * @param message containing information
46  */
47
48 void
49 GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client,
50     const struct GNUNET_MessageHeader *message);
51
52 /**
53  * Adapter function between transport's send function and transport plugins
54  *
55  * @param target the peer the message to send to
56  * @param msg the message received
57  * @param msg_size message size
58  * @param timeout timeout
59  * @param cont the continuation to call after sending
60  * @param cont_cls cls for continuation
61  */
62 void
63 GST_manipulation_send (const struct GNUNET_PeerIdentity *target,
64                                                                                          const void *msg, size_t msg_size,
65                                                                                          struct GNUNET_TIME_Relative timeout,
66                                                                                          GST_NeighbourSendContinuation cont, void *cont_cls);
67
68 /**
69  * Adapter function between transport plugins and transport receive function
70  * manipulation delays for next send.
71  *
72  * @param cls the closure for transport
73  * @param address the address and the peer the message was received from
74  * @param message the message received
75  * @param session the session the message was received on
76  * @return manipulated delay for next receive
77  */
78 struct GNUNET_TIME_Relative
79 GST_manipulation_recv (void *cls,
80     const struct GNUNET_HELLO_Address *address,
81     struct Session *session,
82     const struct GNUNET_MessageHeader *message);
83
84 /**
85  * Function that will be called to manipulate ATS information according to
86  * current manipulation settings
87  *
88  * @param peer the peer
89  * @param address binary address
90  * @param session the session
91  * @param ats the ats information
92  * @param ats_count the number of ats information
93  */
94 struct GNUNET_ATS_Information *
95 GST_manipulation_manipulate_metrics (const struct GNUNET_PeerIdentity *peer,
96                 const struct GNUNET_HELLO_Address *address,
97                 struct Session *session,
98                 const struct GNUNET_ATS_Information *ats,
99                 uint32_t ats_count);
100
101 /**
102  * Notify manipulation about disconnect so it can discard queued messages
103  *
104  * @param peer the disconnecting peer
105  */
106 void
107 GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer);
108
109 /**
110  * Initialize traffic manipulation
111  *
112  * @param GST_cfg configuration handle
113  */
114 void
115 GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg);
116
117 /**
118  * Stop traffic manipulation
119  */
120 void
121 GST_manipulation_stop ();
122
123 #endif
124 /* end of file gnunet-service-transport_neighbours.h */