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
57 GNUNET_NETWORK_STRUCT_BEGIN
60 * First message any client sends to ATS, used to self-identify
61 * (what type of client this is).
63 struct ClientStartMessage
66 * Type is #GNUNET_MESSAGE_TYPE_ATS_START.
68 struct GNUNET_MessageHeader header;
71 * NBO value of an `enum StartFlag`.
73 uint32_t start_flag GNUNET_PACKED;
78 * Scheduling client to ATS service: we would like to have
79 * address suggestions for this peer.
81 struct RequestAddressMessage
84 * Type is #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS or
85 * #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL to stop
88 struct GNUNET_MessageHeader header;
93 uint32_t reserved GNUNET_PACKED;
96 * Peer to get address suggestions for.
98 struct GNUNET_PeerIdentity peer;
103 * Scheduling client to ATS service: reset backoff for
104 * address suggestions to this peer.
106 struct ResetBackoffMessage
109 * Type is #GNUNET_MESSAGE_TYPE_ATS_RESET_BACKOFF.
111 struct GNUNET_MessageHeader header;
116 uint32_t reserved GNUNET_PACKED;
119 * Peer to reset backoff for.
121 struct GNUNET_PeerIdentity peer;
126 * ATS client to ATS service: here is another address you can use.
128 struct AddressAddMessage
131 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD.
133 struct GNUNET_MessageHeader header;
136 * Length of the `struct GNUNET_ATS_Information` array that follows this struct.
138 uint32_t ats_count GNUNET_PACKED;
141 * Identity of the peer that this address is for.
143 struct GNUNET_PeerIdentity peer;
146 * Number of bytes in the address that follows this struct.
148 uint16_t address_length GNUNET_PACKED;
151 * Number of bytes in the plugin name that follows this struct.
153 uint16_t plugin_name_length GNUNET_PACKED;
156 * Internal number this client will henceforth use to
157 * refer to this address.
159 uint32_t session_id GNUNET_PACKED;
162 * Local-only information of the address, see
163 * `enum GNUNET_HELLO_AddressInfo`.
165 uint32_t address_local_info GNUNET_PACKED;
168 * - struct GNUNET_ATS_Information [ats_count];
169 * - char address[address_length]
170 * - char plugin_name[plugin_name_length] (including '\0'-termination).
177 * Message used to notify ATS that the performance
178 * characteristics for an address have changed.
180 struct AddressUpdateMessage
183 * Message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE.
185 struct GNUNET_MessageHeader header;
188 * Length of the `struct GNUNET_ATS_Information` array that follows.
190 uint32_t ats_count GNUNET_PACKED;
193 * Which peer is this about? (Technically redundant, as the
194 * @e session_id should be sufficient, but enables ATS service
195 * to find the session faster).
197 struct GNUNET_PeerIdentity peer;
200 * Internal number this client uses to refer to this address.
202 uint32_t session_id GNUNET_PACKED;
205 * - struct GNUNET_ATS_Information [ats_count];
212 * Message sent from ATS client to ATS service to notify
213 * it if we started (or stopped) using an address.
215 struct AddressUseMessage
218 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE.
220 struct GNUNET_MessageHeader header;
223 * Internal number this client uses to refer to this address.
225 uint32_t session_id GNUNET_PACKED;
228 * Which peer is this about? (Technically redundant, as the
229 * @e session_id should be sufficient, but enables ATS service
230 * to find the session faster).
232 struct GNUNET_PeerIdentity peer;
235 * #GNUNET_YES or #GNUNET_NO.
237 uint32_t in_use GNUNET_PACKED;
243 * Message sent by ATS client to ATS service when an address
244 * was destroyed and must thus henceforth no longer be considered
247 struct AddressDestroyedMessage
250 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED.
252 struct GNUNET_MessageHeader header;
255 * Internal number this client uses to refer to this address.
257 uint32_t session_id GNUNET_PACKED;
260 * Which peer is this about? (Technically redundant, as the
261 * @e session_id should be sufficient, but enables ATS service
262 * to find the session faster).
264 struct GNUNET_PeerIdentity peer;
270 * Message sent by ATS service to client to confirm that it is done
271 * using the given session ID.
273 struct SessionReleaseMessage
276 * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE.
278 struct GNUNET_MessageHeader header;
281 * Number the client used to identify the session.
283 uint32_t session_id GNUNET_PACKED;
286 * Which peer is this about? (Technically redundant, as the
287 * @e session_id should be sufficient, but may enable client
288 * to find the session faster).
290 struct GNUNET_PeerIdentity peer;
296 * ATS Service suggests to the transport service to use the address
297 * identified by the given @e session_id for the given @e peer with
298 * the given @e bandwidth_in and @e bandwidth_out limits from now on.
300 struct AddressSuggestionMessage
303 * A message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION.
305 struct GNUNET_MessageHeader header;
308 * Internal number this client uses to refer to the address this
309 * suggestion is about.
311 uint32_t session_id GNUNET_PACKED;
314 * Which peer is this about? (Technically redundant, as the
315 * @e session_id should be sufficient, but may enable client
316 * to find the session faster and/or check consistency).
318 struct GNUNET_PeerIdentity peer;
321 * How much bandwidth we are allowed for sending.
323 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
326 * How much bandwidth we are allowed for receiving.
328 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
335 struct PeerInformationMessage
337 struct GNUNET_MessageHeader header;
339 uint32_t ats_count GNUNET_PACKED;
341 uint32_t address_active GNUNET_PACKED;
343 uint32_t id GNUNET_PACKED;
345 struct GNUNET_PeerIdentity peer;
347 uint16_t address_length GNUNET_PACKED;
349 uint16_t plugin_name_length GNUNET_PACKED;
351 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
353 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
356 * - struct GNUNET_ATS_Information [ats_count];
357 * - char address[address_length]
358 * - char plugin_name[plugin_name_length] (including '\0'-termination).
365 * Client to service: please give us an overview of the addresses.
367 struct AddressListRequestMessage
370 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST
372 struct GNUNET_MessageHeader header;
375 * ID used to match replies to this request.
377 uint32_t id GNUNET_PACKED;
380 * Which peer do we care about? All zeros for all.
382 struct GNUNET_PeerIdentity peer;
385 * #GNUNET_YES to get information about all addresses,
386 * #GNUNET_NO to only return addresses that are in use.
388 int32_t all GNUNET_PACKED;
393 struct ReservationRequestMessage
395 struct GNUNET_MessageHeader header;
397 int32_t amount GNUNET_PACKED;
399 struct GNUNET_PeerIdentity peer;
404 struct ReservationResultMessage
406 struct GNUNET_MessageHeader header;
408 int32_t amount GNUNET_PACKED;
410 struct GNUNET_PeerIdentity peer;
412 struct GNUNET_TIME_RelativeNBO res_delay;
415 struct PreferenceInformation
418 uint32_t preference_kind GNUNET_PACKED;
420 float preference_value GNUNET_PACKED;
425 struct ChangePreferenceMessage
427 struct GNUNET_MessageHeader header;
429 uint32_t num_preferences GNUNET_PACKED;
431 struct GNUNET_PeerIdentity peer;
433 /* followed by 'num_preferences'
434 * struct PreferenceInformation values */
439 * Message containing application feedback for a peer
441 struct FeedbackPreferenceMessage
443 struct GNUNET_MessageHeader header;
446 * Number of feedback values included
448 uint32_t num_feedback GNUNET_PACKED;
451 * Relative time describing for which time interval this feedback is
453 struct GNUNET_TIME_RelativeNBO scope;
456 * Peer this feedback is for
458 struct GNUNET_PeerIdentity peer;
460 /* followed by 'num_feedback'
461 * struct PreferenceInformation values */
464 GNUNET_NETWORK_STRUCT_END