2 This file is part of GNUnet.
3 Copyright (C) 2015 Christian Grothoff (and other contributing authors)
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.
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.
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 * @file transport/gnunet-service-transport_ats.h
22 * @brief interfacing between transport and ATS service
23 * @author Christian Grothoff
25 #ifndef GNUNET_SERVICE_TRANSPORT_ATS_H
26 #define GNUNET_SERVICE_TRANSPORT_ATS_H
28 #include "gnunet_ats_service.h"
31 * Initialize ATS subsystem.
38 * Shutdown ATS subsystem.
45 * Test if ATS knows about this address.
47 * @param address the address
48 * @param session the session
49 * @return #GNUNET_YES if address is known, #GNUNET_NO if not.
52 GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
53 struct Session *session);
57 * Temporarily block a valid address for use by ATS for address
58 * suggestions. This function should be called if an address was
59 * suggested by ATS but failed to perform (i.e. failure to establish a
60 * session or to exchange the PING/PONG).
62 * @param address the address to block
63 * @param session the session (can be NULL)
66 GST_ats_block_address (const struct GNUNET_HELLO_Address *address,
67 struct Session *session);
71 * Reset address blocking time. Resets the exponential
72 * back-off timer for this address to zero. Done when
73 * an address was used to create a successful connection.
75 * @param address the address to reset the blocking timer
76 * @param session the session (can be NULL)
79 GST_ats_block_reset (const struct GNUNET_HELLO_Address *address,
80 struct Session *session);
84 * Notify ATS about the a new inbound address. We may already
85 * know the address (as this is called each time we receive
86 * a message from an inbound connection). If the address is
87 * indeed new, make it available to ATS.
89 * @param address the address
90 * @param session the session
91 * @param prop performance information
94 GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address,
95 struct Session *session,
96 const struct GNUNET_ATS_Properties *prop);
100 * Notify ATS about the new address including the network this address is
101 * located in. The address must NOT be inbound and must be new to ATS.
103 * @param address the address
104 * @param prop performance information
107 GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
108 const struct GNUNET_ATS_Properties *prop);
112 * Notify ATS about a new session now existing for the given
115 * @param address the address
116 * @param session the session
119 GST_ats_new_session (const struct GNUNET_HELLO_Address *address,
120 struct Session *session);
124 * Notify ATS about property changes to an address's properties.
125 * FIXME: we probably want to split this one up for the different
126 * updatable properties.
128 * @param address the address
129 * @param session the session
130 * @param prop updated performance information
133 GST_ats_update_metrics (const struct GNUNET_HELLO_Address *address,
134 struct Session *session,
135 const struct GNUNET_ATS_Properties *prop);
139 * Notify ATS about utilization changes to an address.
141 * @param address our information about the address
142 * @param bps_in new utilization inbound
143 * @param bps_out new utilization outbound
146 GST_ats_update_utilization (const struct GNUNET_HELLO_Address *address,
152 * Notify ATS about property changes to an address's properties.
154 * @param address the address
155 * @param session the session
156 * @param delay new delay value
159 GST_ats_update_delay (const struct GNUNET_HELLO_Address *address,
160 struct GNUNET_TIME_Relative delay);
164 * Notify ATS about property changes to an address's properties.
166 * @param address the address
167 * @param distance new distance value
170 GST_ats_update_distance (const struct GNUNET_HELLO_Address *address,
175 * Notify ATS that the session (but not the address) of
176 * a given address is no longer relevant.
178 * @param address the address
179 * @param session the session
182 GST_ats_del_session (const struct GNUNET_HELLO_Address *address,
183 struct Session *session);
187 * Notify ATS that the address has expired and thus cannot
188 * be used any longer. This function must only be called
189 * if the corresponding session is already gone.
191 * @param address the address
194 GST_ats_expire_address (const struct GNUNET_HELLO_Address *address);