2 This file is part of GNUnet.
3 (C) 2010-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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @brief automatic transport selection messages
23 * @author Christian Grothoff
24 * @author Matthias Wachs
29 #include "gnunet_util_lib.h"
32 * Flag used to indicate which type of client is connecting
39 * This is a scheduling client (aka transport service)
41 START_FLAG_SCHEDULING = 0,
44 * Performance monitoring client that wants to learn about
45 * changes in performance characteristics.
47 START_FLAG_PERFORMANCE_WITH_PIC = 1,
50 * Performance monitoring client that does NOT want to learn
51 * about changes in performance characteristics.
53 START_FLAG_PERFORMANCE_NO_PIC = 2,
56 * Connection suggestion handle.
58 START_FLAG_CONNECTION_SUGGESTION = 3
62 GNUNET_NETWORK_STRUCT_BEGIN
65 * First message any client sends to ATS, used to self-identify
66 * (what type of client this is).
68 struct ClientStartMessage
71 * Type is #GNUNET_MESSAGE_TYPE_ATS_START.
73 struct GNUNET_MessageHeader header;
76 * NBO value of an `enum StartFlag`.
78 uint32_t start_flag GNUNET_PACKED;
83 * Scheduling client to ATS service: we would like to have
84 * address suggestions for this peer.
86 struct RequestAddressMessage
89 * Type is #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS or
90 * #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL to stop
93 struct GNUNET_MessageHeader header;
98 uint32_t reserved GNUNET_PACKED;
101 * Peer to get address suggestions for.
103 struct GNUNET_PeerIdentity peer;
108 * ATS client to ATS service: here is another address you can use.
110 struct AddressAddMessage
113 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD.
115 struct GNUNET_MessageHeader header;
118 * Length of the `struct GNUNET_ATS_Information` array that follows this struct.
120 uint32_t ats_count GNUNET_PACKED;
123 * Identity of the peer that this address is for.
125 struct GNUNET_PeerIdentity peer;
128 * Number of bytes in the address that follows this struct.
130 uint16_t address_length GNUNET_PACKED;
133 * Number of bytes in the plugin name that follows this struct.
135 uint16_t plugin_name_length GNUNET_PACKED;
138 * Internal number this client will henceforth use to
139 * refer to this address.
141 uint32_t session_id GNUNET_PACKED;
144 * Local-only information of the address, see
145 * `enum GNUNET_HELLO_AddressInfo`.
147 uint32_t address_local_info GNUNET_PACKED;
150 * - struct GNUNET_ATS_Information [ats_count];
151 * - char address[address_length]
152 * - char plugin_name[plugin_name_length] (including '\0'-termination).
159 * Message used to notify ATS that the performance
160 * characteristics for an address have changed.
162 struct AddressUpdateMessage
165 * Message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE.
167 struct GNUNET_MessageHeader header;
170 * Length of the `struct GNUNET_ATS_Information` array that follows.
172 uint32_t ats_count GNUNET_PACKED;
175 * Which peer is this about? (Technically redundant, as the
176 * @e session_id should be sufficient, but enables ATS service
177 * to find the session faster).
179 struct GNUNET_PeerIdentity peer;
182 * Internal number this client uses to refer to this address.
184 uint32_t session_id GNUNET_PACKED;
187 * - struct GNUNET_ATS_Information [ats_count];
194 * Message sent by ATS client to ATS service when an address
195 * was destroyed and must thus henceforth no longer be considered
198 struct AddressDestroyedMessage
201 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED.
203 struct GNUNET_MessageHeader header;
206 * Internal number this client uses to refer to this address.
208 uint32_t session_id GNUNET_PACKED;
211 * Which peer is this about? (Technically redundant, as the
212 * @e session_id should be sufficient, but enables ATS service
213 * to find the session faster).
215 struct GNUNET_PeerIdentity peer;
221 * Message sent by ATS service to client to confirm that it is done
222 * using the given session ID.
224 struct SessionReleaseMessage
227 * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE.
229 struct GNUNET_MessageHeader header;
232 * Number the client used to identify the session.
234 uint32_t session_id GNUNET_PACKED;
237 * Which peer is this about? (Technically redundant, as the
238 * @e session_id should be sufficient, but may enable client
239 * to find the session faster).
241 struct GNUNET_PeerIdentity peer;
247 * ATS Service suggests to the transport service to use the address
248 * identified by the given @e session_id for the given @e peer with
249 * the given @e bandwidth_in and @e bandwidth_out limits from now on.
251 struct AddressSuggestionMessage
254 * A message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION.
256 struct GNUNET_MessageHeader header;
259 * Internal number this client uses to refer to the address this
260 * suggestion is about.
262 uint32_t session_id GNUNET_PACKED;
265 * Which peer is this about? (Technically redundant, as the
266 * @e session_id should be sufficient, but may enable client
267 * to find the session faster and/or check consistency).
269 struct GNUNET_PeerIdentity peer;
272 * How much bandwidth we are allowed for sending.
274 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
277 * How much bandwidth we are allowed for receiving.
279 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
286 struct PeerInformationMessage
288 struct GNUNET_MessageHeader header;
290 uint32_t ats_count GNUNET_PACKED;
292 uint32_t address_active GNUNET_PACKED;
294 uint32_t id GNUNET_PACKED;
296 struct GNUNET_PeerIdentity peer;
298 uint16_t address_length GNUNET_PACKED;
300 uint16_t plugin_name_length GNUNET_PACKED;
302 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
304 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
307 * - struct GNUNET_ATS_Information [ats_count];
308 * - char address[address_length]
309 * - char plugin_name[plugin_name_length] (including '\0'-termination).
316 * Client to service: please give us an overview of the addresses.
318 struct AddressListRequestMessage
321 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST
323 struct GNUNET_MessageHeader header;
326 * ID used to match replies to this request.
328 uint32_t id GNUNET_PACKED;
331 * Which peer do we care about? All zeros for all.
333 struct GNUNET_PeerIdentity peer;
336 * #GNUNET_YES to get information about all addresses,
337 * #GNUNET_NO to only return addresses that are in use.
339 int32_t all GNUNET_PACKED;
344 struct ReservationRequestMessage
346 struct GNUNET_MessageHeader header;
348 int32_t amount GNUNET_PACKED;
350 struct GNUNET_PeerIdentity peer;
355 struct ReservationResultMessage
357 struct GNUNET_MessageHeader header;
359 int32_t amount GNUNET_PACKED;
361 struct GNUNET_PeerIdentity peer;
363 struct GNUNET_TIME_RelativeNBO res_delay;
366 struct PreferenceInformation
369 uint32_t preference_kind GNUNET_PACKED;
371 float preference_value GNUNET_PACKED;
376 struct ChangePreferenceMessage
378 struct GNUNET_MessageHeader header;
380 uint32_t num_preferences GNUNET_PACKED;
382 struct GNUNET_PeerIdentity peer;
384 /* followed by 'num_preferences'
385 * struct PreferenceInformation values */
390 * Message containing application feedback for a peer
392 struct FeedbackPreferenceMessage
394 struct GNUNET_MessageHeader header;
397 * Number of feedback values included
399 uint32_t num_feedback GNUNET_PACKED;
402 * Relative time describing for which time interval this feedback is
404 struct GNUNET_TIME_RelativeNBO scope;
407 * Peer this feedback is for
409 struct GNUNET_PeerIdentity peer;
411 /* followed by 'num_feedback'
412 * struct PreferenceInformation values */
415 GNUNET_NETWORK_STRUCT_END