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 * Scheduling client to ATS service: reset backoff for
109 * address suggestions to this peer.
111 struct ResetBackoffMessage
114 * Type is #GNUNET_MESSAGE_TYPE_ATS_RESET_BACKOFF.
116 struct GNUNET_MessageHeader header;
121 uint32_t reserved GNUNET_PACKED;
124 * Peer to reset backoff for.
126 struct GNUNET_PeerIdentity peer;
131 * ATS client to ATS service: here is another address you can use.
133 struct AddressAddMessage
136 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD.
138 struct GNUNET_MessageHeader header;
141 * Length of the `struct GNUNET_ATS_Information` array that follows this struct.
143 uint32_t ats_count GNUNET_PACKED;
146 * Identity of the peer that this address is for.
148 struct GNUNET_PeerIdentity peer;
151 * Number of bytes in the address that follows this struct.
153 uint16_t address_length GNUNET_PACKED;
156 * Number of bytes in the plugin name that follows this struct.
158 uint16_t plugin_name_length GNUNET_PACKED;
161 * Internal number this client will henceforth use to
162 * refer to this address.
164 uint32_t session_id GNUNET_PACKED;
167 * Local-only information of the address, see
168 * `enum GNUNET_HELLO_AddressInfo`.
170 uint32_t address_local_info GNUNET_PACKED;
173 * - struct GNUNET_ATS_Information [ats_count];
174 * - char address[address_length]
175 * - char plugin_name[plugin_name_length] (including '\0'-termination).
182 * Message used to notify ATS that the performance
183 * characteristics for an address have changed.
185 struct AddressUpdateMessage
188 * Message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE.
190 struct GNUNET_MessageHeader header;
193 * Length of the `struct GNUNET_ATS_Information` array that follows.
195 uint32_t ats_count GNUNET_PACKED;
198 * Which peer is this about? (Technically redundant, as the
199 * @e session_id should be sufficient, but enables ATS service
200 * to find the session faster).
202 struct GNUNET_PeerIdentity peer;
205 * Internal number this client uses to refer to this address.
207 uint32_t session_id GNUNET_PACKED;
210 * - struct GNUNET_ATS_Information [ats_count];
217 * Message sent from ATS client to ATS service to notify
218 * it if we started (or stopped) using an address.
220 struct AddressUseMessage
223 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE.
225 struct GNUNET_MessageHeader header;
228 * Internal number this client uses to refer to this address.
230 uint32_t session_id GNUNET_PACKED;
233 * Which peer is this about? (Technically redundant, as the
234 * @e session_id should be sufficient, but enables ATS service
235 * to find the session faster).
237 struct GNUNET_PeerIdentity peer;
240 * #GNUNET_YES or #GNUNET_NO.
242 uint32_t in_use GNUNET_PACKED;
248 * Message sent by ATS client to ATS service when an address
249 * was destroyed and must thus henceforth no longer be considered
252 struct AddressDestroyedMessage
255 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED.
257 struct GNUNET_MessageHeader header;
260 * Internal number this client uses to refer to this address.
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 enables ATS service
267 * to find the session faster).
269 struct GNUNET_PeerIdentity peer;
275 * Message sent by ATS service to client to confirm that it is done
276 * using the given session ID.
278 struct SessionReleaseMessage
281 * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE.
283 struct GNUNET_MessageHeader header;
286 * Number the client used to identify the session.
288 uint32_t session_id GNUNET_PACKED;
291 * Which peer is this about? (Technically redundant, as the
292 * @e session_id should be sufficient, but may enable client
293 * to find the session faster).
295 struct GNUNET_PeerIdentity peer;
301 * ATS Service suggests to the transport service to use the address
302 * identified by the given @e session_id for the given @e peer with
303 * the given @e bandwidth_in and @e bandwidth_out limits from now on.
305 struct AddressSuggestionMessage
308 * A message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION.
310 struct GNUNET_MessageHeader header;
313 * Internal number this client uses to refer to the address this
314 * suggestion is about.
316 uint32_t session_id GNUNET_PACKED;
319 * Which peer is this about? (Technically redundant, as the
320 * @e session_id should be sufficient, but may enable client
321 * to find the session faster and/or check consistency).
323 struct GNUNET_PeerIdentity peer;
326 * How much bandwidth we are allowed for sending.
328 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
331 * How much bandwidth we are allowed for receiving.
333 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
340 struct PeerInformationMessage
342 struct GNUNET_MessageHeader header;
344 uint32_t ats_count GNUNET_PACKED;
346 uint32_t address_active GNUNET_PACKED;
348 uint32_t id GNUNET_PACKED;
350 struct GNUNET_PeerIdentity peer;
352 uint16_t address_length GNUNET_PACKED;
354 uint16_t plugin_name_length GNUNET_PACKED;
356 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
358 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
361 * - struct GNUNET_ATS_Information [ats_count];
362 * - char address[address_length]
363 * - char plugin_name[plugin_name_length] (including '\0'-termination).
370 * Client to service: please give us an overview of the addresses.
372 struct AddressListRequestMessage
375 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST
377 struct GNUNET_MessageHeader header;
380 * ID used to match replies to this request.
382 uint32_t id GNUNET_PACKED;
385 * Which peer do we care about? All zeros for all.
387 struct GNUNET_PeerIdentity peer;
390 * #GNUNET_YES to get information about all addresses,
391 * #GNUNET_NO to only return addresses that are in use.
393 int32_t all GNUNET_PACKED;
398 struct ReservationRequestMessage
400 struct GNUNET_MessageHeader header;
402 int32_t amount GNUNET_PACKED;
404 struct GNUNET_PeerIdentity peer;
409 struct ReservationResultMessage
411 struct GNUNET_MessageHeader header;
413 int32_t amount GNUNET_PACKED;
415 struct GNUNET_PeerIdentity peer;
417 struct GNUNET_TIME_RelativeNBO res_delay;
420 struct PreferenceInformation
423 uint32_t preference_kind GNUNET_PACKED;
425 float preference_value GNUNET_PACKED;
430 struct ChangePreferenceMessage
432 struct GNUNET_MessageHeader header;
434 uint32_t num_preferences GNUNET_PACKED;
436 struct GNUNET_PeerIdentity peer;
438 /* followed by 'num_preferences'
439 * struct PreferenceInformation values */
444 * Message containing application feedback for a peer
446 struct FeedbackPreferenceMessage
448 struct GNUNET_MessageHeader header;
451 * Number of feedback values included
453 uint32_t num_feedback GNUNET_PACKED;
456 * Relative time describing for which time interval this feedback is
458 struct GNUNET_TIME_RelativeNBO scope;
461 * Peer this feedback is for
463 struct GNUNET_PeerIdentity peer;
465 /* followed by 'num_feedback'
466 * struct PreferenceInformation values */
469 GNUNET_NETWORK_STRUCT_END