2 This file is part of GNUnet.
3 Copyright (C) 2010-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
22 * @brief automatic transport selection messages
23 * @author Christian Grothoff
24 * @author Matthias Wachs
29 #include "gnunet_util_lib.h"
30 #include "gnunet_ats_transport_service.h"
33 GNUNET_NETWORK_STRUCT_BEGIN
37 * ATS performance characteristics for an address.
43 * Delay. Time between when the time packet is sent and the packet
44 * arrives. FOREVER if we did not (successfully) measure yet.
46 struct GNUNET_TIME_RelativeNBO delay;
49 * Confirmed successful payload on this connection from this peer to
50 * the other peer. In NBO.
52 * Unit: [bytes/second]
57 * Confirmed useful payload on this connection to this peer from
58 * the other peer. In NBO.
60 * Unit: [bytes/second]
65 * Actual traffic on this connection from this peer to the other peer.
66 * Includes transport overhead. In NBO.
68 * Unit: [bytes/second]
70 uint32_t utilization_out;
73 * Actual traffic on this connection from the other peer to this peer.
74 * Includes transport overhead. In NBO.
76 * Unit: [bytes/second]
78 uint32_t utilization_in;
81 * Distance on network layer (required for distance-vector routing)
82 * in hops. Zero for direct connections (i.e. plain TCP/UDP). In NBO.
87 * MTU of the network layer, UINT32_MAX for no MTU (stream).
89 * Unit: [bytes]. In NBO.
94 * Which network scope does the respective address belong to?
95 * A `enum GNUNET_NetworkType nt` in NBO.
100 * What characteristics does this communicator have?
101 * A `enum GNUNET_TRANSPORT_CommunicatorCharacteristics` in NBO.
109 * Application client to ATS service: we would like to have
110 * address suggestions for this peer.
112 struct ExpressPreferenceMessage
115 * Type is #GNUNET_MESSAGE_TYPE_ATS_SUGGEST or
116 * #GNUNET_MESSAGE_TYPE_ATS_SUGGEST_CANCEL to stop
119 struct GNUNET_MessageHeader header;
122 * What type of performance preference does the client have?
123 * A `enum GNUNET_MQ_PreferenceKind` in NBO.
125 uint32_t pk GNUNET_PACKED;
128 * Peer to get address suggestions for.
130 struct GNUNET_PeerIdentity peer;
133 * How much bandwidth in bytes/second does the application expect?
135 struct GNUNET_BANDWIDTH_Value32NBO bw;
141 * Transport client to ATS service: here is another session you can use.
143 struct SessionAddMessage
146 * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD or
147 * #GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD_INBOUND_ONLY
149 struct GNUNET_MessageHeader header;
152 * Internal number this client will henceforth use to
153 * refer to this session.
155 uint32_t session_id GNUNET_PACKED;
158 * Identity of the peer that this session is for.
160 struct GNUNET_PeerIdentity peer;
163 * Performance properties of the session.
165 struct PropertiesNBO properties;
168 * - char * address (including '\0'-termination).
175 * Message used to notify ATS that the performance
176 * characteristics for an session have changed.
178 struct SessionUpdateMessage
181 * Message of type #GNUNET_MESSAGE_TYPE_ATS_SESSION_UPDATE.
183 struct GNUNET_MessageHeader header;
186 * Internal number this client uses to refer to this session.
188 uint32_t session_id GNUNET_PACKED;
191 * Which peer is this about? (Technically redundant, as the
192 * @e session_id should be sufficient, but enables ATS service
193 * to find the session faster).
195 struct GNUNET_PeerIdentity peer;
198 * Performance properties of the session.
200 struct PropertiesNBO properties;
206 * Message sent by ATS client to ATS service when an session
207 * was destroyed and must thus henceforth no longer be considered
210 struct SessionDelMessage
213 * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_DEL.
215 struct GNUNET_MessageHeader header;
218 * Internal number this client uses to refer to this session.
220 uint32_t session_id GNUNET_PACKED;
223 * Which peer is this about? (Technically redundant, as the
224 * @e session_id should be sufficient, but enables ATS service
225 * to find the session faster).
227 struct GNUNET_PeerIdentity peer;
233 * ATS Service allocates resources to an session
234 * identified by the given @e session_id for the given @e peer with
235 * the given @e bandwidth_in and @e bandwidth_out limits from now on.
237 struct SessionAllocationMessage
240 * A message of type #GNUNET_MESSAGE_TYPE_ATS_SESSION_ALLOCATION.
242 struct GNUNET_MessageHeader header;
245 * Internal number this client uses to refer to the session this
246 * suggestion is about.
248 uint32_t session_id GNUNET_PACKED;
251 * Which peer is this about? (Technically redundant, as the
252 * @e session_id should be sufficient, but may enable client
253 * to find the session faster and/or check consistency).
255 struct GNUNET_PeerIdentity peer;
258 * How much bandwidth we are allowed for sending.
260 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
263 * How much bandwidth we are allowed for receiving.
265 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
271 * ATS Service suggests to the transport service to try the address
272 * for the given @e peer.
274 struct AddressSuggestionMessage
277 * A message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION.
279 struct GNUNET_MessageHeader header;
284 uint32_t reserved GNUNET_PACKED;
287 * Which peer is this about? (Technically redundant, as the
288 * @e session_id should be sufficient, but may enable client
289 * to find the session faster and/or check consistency).
291 struct GNUNET_PeerIdentity peer;
293 /* Followed by 0-terminated address */
297 GNUNET_NETWORK_STRUCT_END