docu
[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 void
41 GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client,
42     const struct GNUNET_MessageHeader *message);
43
44 /**
45  * Adapter function between transport's send function and transport plugins
46  *
47  * @param target the peer the message to send to
48  * @param msg the message received
49  * @param msg_size message size
50  * @param timeout timeout
51  * @param cont the continuation to call after sending
52  * @param cont_cls cls for continuation
53  */
54 void
55 GST_manipulation_send (const struct GNUNET_PeerIdentity *target,
56                                                                                          const void *msg, size_t msg_size,
57                                                                                          struct GNUNET_TIME_Relative timeout,
58                                                                                          GST_NeighbourSendContinuation cont, void *cont_cls);
59
60 /**
61  * Adapter function between transport plugins and transport receive function
62  * manipulation delays for next send.
63  *
64  * @param cls the closure for transport
65  * @param peer the peer the message was received from
66  * @param message the message received
67  * @param session the session the message was received on
68  * @param sender_address the sender address
69  * @param sender_address_len the length of the sender address
70  * @return manipulated delay for next receive
71  */
72 struct GNUNET_TIME_Relative
73 GST_manipulation_recv (void *cls,
74                                                                                          const struct GNUNET_PeerIdentity *peer,
75                                                                                          const struct GNUNET_MessageHeader *message,
76                                                                                          struct Session *session,
77                                                                                          const char *sender_address,
78                                                                                          uint16_t sender_address_len);
79
80 /**
81  * Function that will be called to manipulate ATS information according to
82  * current manipulation settings
83  *
84  * @param peer the peer
85  * @param address binary address
86  * @param session the session
87  * @param ats the ats information
88  * @param ats_count the number of ats information
89  */
90 struct GNUNET_ATS_Information *
91 GST_manipulation_manipulate_metrics (const struct GNUNET_PeerIdentity *peer,
92                 const struct GNUNET_HELLO_Address *address,
93                 struct Session *session,
94                 const struct GNUNET_ATS_Information *ats,
95                 uint32_t ats_count);
96
97 /**
98  * Initialize traffic manipulation
99  *
100  * @param GST_cfg configuration handle
101  */
102 void
103 GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg);
104
105 /**
106  * Stop traffic manipulation
107  */
108 void
109 GST_manipulation_stop ();
110
111 #endif
112 /* end of file gnunet-service-transport_neighbours.h */