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?
121 * A `enum GNUNET_MQ_PreferenceKind` in NBO.
123 uint32_t pk GNUNET_PACKED;
126 * Peer to get address suggestions for.
128 struct GNUNET_PeerIdentity peer;
131 * How much bandwidth in bytes/second does the application expect?
133 struct GNUNET_BANDWIDTH_Value32NBO bw;
139 * Transport client to ATS service: here is another session you can use.
141 struct SessionAddMessage
144 * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD or
145 * #GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD_INBOUND_ONLY
147 struct GNUNET_MessageHeader header;
150 * Internal number this client will henceforth use to
151 * refer to this session.
153 uint32_t session_id GNUNET_PACKED;
156 * Identity of the peer that this session is for.
158 struct GNUNET_PeerIdentity peer;
161 * Performance properties of the session.
163 struct PropertiesNBO properties;
166 * - char * address (including '\0'-termination).
173 * Message used to notify ATS that the performance
174 * characteristics for an session have changed.
176 struct SessionUpdateMessage
179 * Message of type #GNUNET_MESSAGE_TYPE_ATS_SESSION_UPDATE.
181 struct GNUNET_MessageHeader header;
184 * Internal number this client uses to refer to this session.
186 uint32_t session_id GNUNET_PACKED;
189 * Which peer is this about? (Technically redundant, as the
190 * @e session_id should be sufficient, but enables ATS service
191 * to find the session faster).
193 struct GNUNET_PeerIdentity peer;
196 * Performance properties of the session.
198 struct PropertiesNBO properties;
204 * Message sent by ATS client to ATS service when an session
205 * was destroyed and must thus henceforth no longer be considered
208 struct SessionDelMessage
211 * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_DEL.
213 struct GNUNET_MessageHeader header;
216 * Internal number this client uses to refer to this session.
218 uint32_t session_id GNUNET_PACKED;
221 * Which peer is this about? (Technically redundant, as the
222 * @e session_id should be sufficient, but enables ATS service
223 * to find the session faster).
225 struct GNUNET_PeerIdentity peer;
231 * ATS Service allocates resources to an session
232 * identified by the given @e session_id for the given @e peer with
233 * the given @e bandwidth_in and @e bandwidth_out limits from now on.
235 struct SessionAllocationMessage
238 * A message of type #GNUNET_MESSAGE_TYPE_ATS_SESSION_ALLOCATION.
240 struct GNUNET_MessageHeader header;
243 * Internal number this client uses to refer to the session this
244 * suggestion is about.
246 uint32_t session_id GNUNET_PACKED;
249 * Which peer is this about? (Technically redundant, as the
250 * @e session_id should be sufficient, but may enable client
251 * to find the session faster and/or check consistency).
253 struct GNUNET_PeerIdentity peer;
256 * How much bandwidth we are allowed for sending.
258 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
261 * How much bandwidth we are allowed for receiving.
263 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
269 * ATS Service suggests to the transport service to try the address
270 * for the given @e peer.
272 struct AddressSuggestionMessage
275 * A message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION.
277 struct GNUNET_MessageHeader header;
282 uint32_t reserved GNUNET_PACKED;
285 * Which peer is this about? (Technically redundant, as the
286 * @e session_id should be sufficient, but may enable client
287 * to find the session faster and/or check consistency).
289 struct GNUNET_PeerIdentity peer;
291 /* Followed by 0-terminated address */
295 GNUNET_NETWORK_STRUCT_END