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/>.
20 * @brief automatic transport selection messages
21 * @author Christian Grothoff
22 * @author Matthias Wachs
27 #include "gnunet_util_lib.h"
28 #include "gnunet_ats_transport_service.h"
31 GNUNET_NETWORK_STRUCT_BEGIN
35 * ATS performance characteristics for an address.
41 * Delay. Time between when the time packet is sent and the packet
42 * arrives. FOREVER if we did not (successfully) measure yet.
44 struct GNUNET_TIME_RelativeNBO delay;
47 * Confirmed successful payload on this connection from this peer to
48 * the other peer. In NBO.
50 * Unit: [bytes/second]
55 * Confirmed useful payload on this connection to this peer from
56 * the other peer. In NBO.
58 * Unit: [bytes/second]
63 * Actual traffic on this connection from this peer to the other peer.
64 * Includes transport overhead. In NBO.
66 * Unit: [bytes/second]
68 uint32_t utilization_out;
71 * Actual traffic on this connection from the other peer to this peer.
72 * Includes transport overhead. In NBO.
74 * Unit: [bytes/second]
76 uint32_t utilization_in;
79 * Distance on network layer (required for distance-vector routing)
80 * in hops. Zero for direct connections (i.e. plain TCP/UDP). In NBO.
85 * MTU of the network layer, UINT32_MAX for no MTU (stream).
87 * Unit: [bytes]. In NBO.
92 * Which network scope does the respective address belong to?
93 * A `enum GNUNET_NetworkType nt` in NBO.
98 * What characteristics does this communicator have?
99 * A `enum GNUNET_TRANSPORT_CommunicatorCharacteristics` in NBO.
107 * Application client to ATS service: we would like to have
108 * address suggestions for this peer.
110 struct ExpressPreferenceMessage
113 * Type is #GNUNET_MESSAGE_TYPE_ATS_SUGGEST or
114 * #GNUNET_MESSAGE_TYPE_ATS_SUGGEST_CANCEL to stop
117 struct GNUNET_MessageHeader header;
120 * What type of performance preference does the client have?
122 uint32_t pk GNUNET_PACKED;
125 * Peer to get address suggestions for.
127 struct GNUNET_PeerIdentity peer;
130 * How much bandwidth in bytes/second does the application expect?
132 struct GNUNET_BANDWIDTH_Value32NBO bw;
138 * Transport client to ATS service: here is another session you can use.
140 struct SessionAddMessage
143 * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD or
144 * #GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD_INBOUND_ONLY
146 struct GNUNET_MessageHeader header;
149 * Internal number this client will henceforth use to
150 * refer to this session.
152 uint32_t session_id GNUNET_PACKED;
155 * Identity of the peer that this session is for.
157 struct GNUNET_PeerIdentity peer;
160 * Performance properties of the session.
162 struct PropertiesNBO properties;
165 * - char * address (including '\0'-termination).
172 * Message used to notify ATS that the performance
173 * characteristics for an session have changed.
175 struct SessionUpdateMessage
178 * Message of type #GNUNET_MESSAGE_TYPE_ATS_SESSION_UPDATE.
180 struct GNUNET_MessageHeader header;
183 * Internal number this client uses to refer to this session.
185 uint32_t session_id GNUNET_PACKED;
188 * Which peer is this about? (Technically redundant, as the
189 * @e session_id should be sufficient, but enables ATS service
190 * to find the session faster).
192 struct GNUNET_PeerIdentity peer;
195 * Performance properties of the session.
197 struct PropertiesNBO properties;
203 * Message sent by ATS client to ATS service when an session
204 * was destroyed and must thus henceforth no longer be considered
207 struct SessionDelMessage
210 * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_DEL.
212 struct GNUNET_MessageHeader header;
215 * Internal number this client uses to refer to this session.
217 uint32_t session_id GNUNET_PACKED;
220 * Which peer is this about? (Technically redundant, as the
221 * @e session_id should be sufficient, but enables ATS service
222 * to find the session faster).
224 struct GNUNET_PeerIdentity peer;
230 * ATS Service allocates resources to an session
231 * identified by the given @e session_id for the given @e peer with
232 * the given @e bandwidth_in and @e bandwidth_out limits from now on.
234 struct SessionAllocationMessage
237 * A message of type #GNUNET_MESSAGE_TYPE_ATS_SESSION_ALLOCATION.
239 struct GNUNET_MessageHeader header;
242 * Internal number this client uses to refer to the session this
243 * suggestion is about.
245 uint32_t session_id GNUNET_PACKED;
248 * Which peer is this about? (Technically redundant, as the
249 * @e session_id should be sufficient, but may enable client
250 * to find the session faster and/or check consistency).
252 struct GNUNET_PeerIdentity peer;
255 * How much bandwidth we are allowed for sending.
257 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
260 * How much bandwidth we are allowed for receiving.
262 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
268 * ATS Service suggests to the transport service to try the address
269 * for the given @e peer.
271 struct AddressSuggestionMessage
274 * A message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION.
276 struct GNUNET_MessageHeader header;
281 uint32_t reserved GNUNET_PACKED;
284 * Which peer is this about? (Technically redundant, as the
285 * @e session_id should be sufficient, but may enable client
286 * to find the session faster and/or check consistency).
288 struct GNUNET_PeerIdentity peer;
290 /* Followed by 0-terminated address */
294 GNUNET_NETWORK_STRUCT_END