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 @a address and @a session.
47 * @param address the address
48 * @param session the session
49 * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
52 GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
53 struct Session *session);
57 * Test if ATS knows about this @a address.
59 * @param address the address
60 * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
63 GST_ats_is_known_no_session (const struct GNUNET_HELLO_Address *address);
67 * Temporarily block a valid address for use by ATS for address
68 * suggestions. This function should be called if an address was
69 * suggested by ATS but failed to perform (i.e. failure to establish a
70 * session or to exchange the PING/PONG).
72 * @param address the address to block
73 * @param session the session (can be NULL)
76 GST_ats_block_address (const struct GNUNET_HELLO_Address *address,
77 struct Session *session);
81 * Reset address blocking time. Resets the exponential
82 * back-off timer for this address to zero. Done when
83 * an address was used to create a successful connection.
85 * @param address the address to reset the blocking timer
86 * @param session the session (can be NULL)
89 GST_ats_block_reset (const struct GNUNET_HELLO_Address *address,
90 struct Session *session);
94 * Notify ATS about the a new inbound address. We may already
95 * know the address (as this is called each time we receive
96 * a message from an inbound connection). If the address is
97 * indeed new, make it available to ATS.
99 * @param address the address
100 * @param session the session
101 * @param prop performance information
104 GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address,
105 struct Session *session,
106 const struct GNUNET_ATS_Properties *prop);
110 * Notify ATS about the new address including the network this address is
111 * located in. The address must NOT be inbound and must be new to ATS.
113 * @param address the address
114 * @param prop performance information
117 GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
118 const struct GNUNET_ATS_Properties *prop);
122 * Notify ATS about a new session now existing for the given
125 * @param address the address
126 * @param session the session
129 GST_ats_new_session (const struct GNUNET_HELLO_Address *address,
130 struct Session *session);
134 * Notify ATS about property changes to an address's properties.
135 * FIXME: we probably want to split this one up for the different
136 * updatable properties.
138 * @param address the address
139 * @param session the session
140 * @param prop updated performance information
143 GST_ats_update_metrics (const struct GNUNET_HELLO_Address *address,
144 struct Session *session,
145 const struct GNUNET_ATS_Properties *prop);
149 * Notify ATS about utilization changes to an address.
151 * @param address our information about the address
152 * @param bps_in new utilization inbound
153 * @param bps_out new utilization outbound
156 GST_ats_update_utilization (const struct GNUNET_HELLO_Address *address,
162 * Notify ATS about property changes to an address's properties.
164 * @param address the address
165 * @param session the session
166 * @param delay new delay value
169 GST_ats_update_delay (const struct GNUNET_HELLO_Address *address,
170 struct GNUNET_TIME_Relative delay);
174 * Notify ATS about property changes to an address's properties.
176 * @param address the address
177 * @param distance new distance value
180 GST_ats_update_distance (const struct GNUNET_HELLO_Address *address,
185 * Notify ATS that the session (but not the address) of
186 * a given address is no longer relevant.
188 * @param address the address
189 * @param session the session
192 GST_ats_del_session (const struct GNUNET_HELLO_Address *address,
193 struct Session *session);
197 * Notify ATS that the address has expired and thus cannot
198 * be used any longer. This function must only be called
199 * if the corresponding session is already gone.
201 * @param address the address
204 GST_ats_expire_address (const struct GNUNET_HELLO_Address *address);