2 This file is part of GNUnet.
3 Copyright (C) 2015 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero 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.
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.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
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.
46 * Note that even if the address is expired, we return
47 * #GNUNET_YES if the respective session matches.
49 * @param address the address
50 * @param session the session
51 * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
54 GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
55 struct GNUNET_ATS_Session *session);
59 * Test if ATS knows about this @a address. Note that
60 * expired addresses do not count.
62 * @param address the address
63 * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
66 GST_ats_is_known_no_session (const struct GNUNET_HELLO_Address *address);
70 * Temporarily block a valid address for use by ATS for address
71 * suggestions. This function should be called if an address was
72 * suggested by ATS but failed to perform (i.e. failure to establish a
73 * session or to exchange the PING/PONG).
75 * @param address the address to block
76 * @param session the session (can be NULL)
79 GST_ats_block_address (const struct GNUNET_HELLO_Address *address,
80 struct GNUNET_ATS_Session *session);
84 * Reset address blocking time. Resets the exponential
85 * back-off timer for this address to zero. Called when
86 * an address was used to create a successful connection.
88 * @param address the address to reset the blocking timer
89 * @param session the session (can be NULL)
92 GST_ats_block_reset (const struct GNUNET_HELLO_Address *address,
93 struct GNUNET_ATS_Session *session);
97 * Notify ATS about a new inbound @a address. The @a address in
98 * combination with the @a session must be new, but this function will
99 * perform a santiy check. If the @a address is indeed new, make it
102 * @param address the address
103 * @param session the session
104 * @param prop performance information
107 GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address,
108 struct GNUNET_ATS_Session *session,
109 const struct GNUNET_ATS_Properties *prop);
113 * Notify ATS about a new address including the network this address is
114 * located in. The address must NOT be inbound and must be new to ATS.
116 * @param address the address
117 * @param prop performance information
120 GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
121 const struct GNUNET_ATS_Properties *prop);
125 * Notify ATS about a new @a session now existing for the given
126 * @a address. Essentially, an outbound @a address was used
127 * to establish a @a session. It is safe to call this function
128 * repeatedly for the same @a address and @a session pair.
130 * @param address the address
131 * @param session the session
134 GST_ats_new_session (const struct GNUNET_HELLO_Address *address,
135 struct GNUNET_ATS_Session *session);
139 * Notify ATS about utilization changes to an @a address.
140 * Does nothing if the @a address is not known to us.
142 * @param address our information about the address
143 * @param bps_in new utilization inbound
144 * @param bps_out new utilization outbound
147 GST_ats_update_utilization (const struct GNUNET_HELLO_Address *address,
153 * Notify ATS about @a delay changes to properties of an @a address.
154 * Does nothing if the @a address is not known to us.
156 * @param address the address
157 * @param session the session
158 * @param delay new delay value
161 GST_ats_update_delay (const struct GNUNET_HELLO_Address *address,
162 struct GNUNET_TIME_Relative delay);
166 * Notify ATS about DV @a distance change to an @a address.
167 * Does nothing if the @a address is not known to us.
169 * @param address the address
170 * @param distance new distance value
173 GST_ats_update_distance (const struct GNUNET_HELLO_Address *address,
178 * Notify ATS that the @a session (but not the @a address) of
179 * a given @a address is no longer relevant. (The @a session
180 * went down.) This function may be called even if for the
181 * respective outbound address #GST_ats_new_session() was
182 * never called and thus the pair is unknown to ATS. In this
183 * case, the call is simply ignored.
185 * @param address the address
186 * @param session the session
189 GST_ats_del_session (const struct GNUNET_HELLO_Address *address,
190 struct GNUNET_ATS_Session *session);
194 * Notify ATS that the address has expired and thus cannot
195 * be used any longer. This function must only be called
196 * if the corresponding session is already gone.
198 * @param address the address
201 GST_ats_expire_address (const struct GNUNET_HELLO_Address *address);