2 This file is part of GNUnet.
3 Copyright (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;
287 struct PeerInformationMessage
290 * Type is #GNUNET_MESSAGE_TYPE_ATS_PEER_INFORMATION
292 struct GNUNET_MessageHeader header;
297 uint32_t ats_count GNUNET_PACKED;
302 uint32_t address_active GNUNET_PACKED;
307 uint32_t id GNUNET_PACKED;
312 struct GNUNET_PeerIdentity peer;
317 uint16_t address_length GNUNET_PACKED;
322 uint16_t plugin_name_length GNUNET_PACKED;
327 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
332 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
335 * - struct GNUNET_ATS_Information [ats_count];
336 * - char address[address_length]
337 * - char plugin_name[plugin_name_length] (including '\0'-termination).
344 * Client to service: please give us an overview of the addresses.
346 struct AddressListRequestMessage
349 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST
351 struct GNUNET_MessageHeader header;
354 * ID used to match replies to this request.
356 uint32_t id GNUNET_PACKED;
359 * Which peer do we care about? All zeros for all.
361 struct GNUNET_PeerIdentity peer;
364 * #GNUNET_YES to get information about all addresses,
365 * #GNUNET_NO to only return addresses that are in use.
367 int32_t all GNUNET_PACKED;
375 struct ReservationRequestMessage
378 * Type is #GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST
380 struct GNUNET_MessageHeader header;
385 int32_t amount GNUNET_PACKED;
390 struct GNUNET_PeerIdentity peer;
397 struct ReservationResultMessage
400 * Type is #GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT
402 struct GNUNET_MessageHeader header;
407 int32_t amount GNUNET_PACKED;
412 struct GNUNET_PeerIdentity peer;
417 struct GNUNET_TIME_RelativeNBO res_delay;
422 * Variable-size entry in a `struct ChangePreferenceMessage` or
423 * `struct FeedbackPreferenceMessage`.
425 struct PreferenceInformation
429 * An `enum GNUNET_ATS_PreferenceKind` in NBO.
431 uint32_t preference_kind GNUNET_PACKED;
434 * Degree of preference (or appreciation) for this @e
435 * preference_kind being expressed.
437 float preference_value GNUNET_PACKED;
443 * Client to ATS: I have a performance preference for a peer.
445 struct ChangePreferenceMessage
448 * Type is #GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE.
450 struct GNUNET_MessageHeader header;
453 * How many `struct PreferenceInformation` entries follow
456 uint32_t num_preferences GNUNET_PACKED;
459 * Which peer is the preference being expressed for?
461 struct GNUNET_PeerIdentity peer;
463 /* followed by 'num_preferences'
464 * struct PreferenceInformation values */
469 * Message containing application feedback for a peer
471 struct FeedbackPreferenceMessage
474 * Type is #GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK.
476 struct GNUNET_MessageHeader header;
479 * Number of feedback values included
481 uint32_t num_feedback GNUNET_PACKED;
484 * Relative time describing for which time interval this feedback is
486 struct GNUNET_TIME_RelativeNBO scope;
489 * Peer this feedback is for
491 struct GNUNET_PeerIdentity peer;
493 /* followed by 'num_feedback'
494 * struct PreferenceInformation values */
497 GNUNET_NETWORK_STRUCT_END