2 This file is part of GNUnet.
3 (C) 2010,2011 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
38 START_FLAG_SCHEDULING = 0,
40 START_FLAG_PERFORMANCE_WITH_PIC = 1,
42 START_FLAG_PERFORMANCE_NO_PIC = 2
46 GNUNET_NETWORK_STRUCT_BEGIN
48 struct ClientStartMessage
50 struct GNUNET_MessageHeader header;
53 * NBO value of an `enum StartFlag`.
55 uint32_t start_flag GNUNET_PACKED;
59 struct RequestAddressMessage
61 struct GNUNET_MessageHeader header;
63 uint32_t reserved GNUNET_PACKED;
65 struct GNUNET_PeerIdentity peer;
68 struct ResetBackoffMessage
70 struct GNUNET_MessageHeader header;
72 uint32_t reserved GNUNET_PACKED;
74 struct GNUNET_PeerIdentity peer;
79 * ATS client to ATS service: here is another address you can use.
81 struct AddressAddMessage
84 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD.
86 struct GNUNET_MessageHeader header;
89 * Length of the `struct GNUNET_ATS_Information` array that follows this struct.
91 uint32_t ats_count GNUNET_PACKED;
94 * Identity of the peer that this address is for.
96 struct GNUNET_PeerIdentity peer;
99 * Number of bytes in the address that follows this struct.
101 uint16_t address_length GNUNET_PACKED;
104 * Number of bytes in the plugin name that follows this struct.
106 uint16_t plugin_name_length GNUNET_PACKED;
109 * Internal number this client will henceforth use to
110 * refer to this address.
112 uint32_t session_id GNUNET_PACKED;
115 * Local-only information of the address, see
116 * `enum GNUNET_HELLO_AddressInfo`.
118 uint32_t address_local_info GNUNET_PACKED;
121 * - struct GNUNET_ATS_Information [ats_count];
122 * - char address[address_length]
123 * - char plugin_name[plugin_name_length] (including '\0'-termination).
130 * Message used to notify ATS that the performance
131 * characteristics for an address have changed.
133 struct AddressUpdateMessage
136 * Message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE.
138 struct GNUNET_MessageHeader header;
141 * Length of the `struct GNUNET_ATS_Information` array that follows.
143 uint32_t ats_count GNUNET_PACKED;
146 * Which peer is this about? (Technically redundant, as the
147 * @e session_id should be sufficient, but enables ATS service
148 * to find the session faster).
150 struct GNUNET_PeerIdentity peer;
153 * Internal number this client uses to refer to this address.
155 uint32_t session_id GNUNET_PACKED;
158 * - struct GNUNET_ATS_Information [ats_count];
165 * Message sent from ATS client to ATS service to notify
166 * it if we started (or stopped) using an address.
168 struct AddressUseMessage
171 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE.
173 struct GNUNET_MessageHeader header;
176 * Internal number this client uses to refer to this address.
178 uint32_t session_id GNUNET_PACKED;
181 * Which peer is this about? (Technically redundant, as the
182 * @e session_id should be sufficient, but enables ATS service
183 * to find the session faster).
185 struct GNUNET_PeerIdentity peer;
188 * #GNUNET_YES or #GNUNET_NO.
190 uint32_t in_use GNUNET_PACKED;
196 * Message sent by ATS client to ATS service when an address
197 * was destroyed and must thus henceforth no longer be considered
200 struct AddressDestroyedMessage
203 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED.
205 struct GNUNET_MessageHeader header;
208 * Internal number this client uses to refer to this address.
210 uint32_t session_id GNUNET_PACKED;
213 * Which peer is this about? (Technically redundant, as the
214 * @e session_id should be sufficient, but enables ATS service
215 * to find the session faster).
217 struct GNUNET_PeerIdentity peer;
223 * ATS Service suggests to the transport service to use the address
224 * identified by the given @e session_id for the given @e peer with
225 * the given @e bandwidth_in and @e bandwidth_out limits from now on.
227 struct AddressSuggestionMessage
230 * A message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION.
232 struct GNUNET_MessageHeader header;
235 * Internal number this client uses to refer to the address this
236 * suggestion is about.
238 uint32_t session_id GNUNET_PACKED;
241 * Which peer is this about? (Technically redundant, as the
242 * @e session_id should be sufficient, but may enable client
243 * to find the session faster and/or check consistency).
245 struct GNUNET_PeerIdentity peer;
248 * How much bandwidth we are allowed for sending.
250 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
253 * How much bandwidth we are allowed for receiving.
255 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
260 struct PeerInformationMessage
262 struct GNUNET_MessageHeader header;
264 uint32_t ats_count GNUNET_PACKED;
266 uint32_t address_active GNUNET_PACKED;
268 uint32_t id GNUNET_PACKED;
270 struct GNUNET_PeerIdentity peer;
272 uint16_t address_length GNUNET_PACKED;
274 uint16_t plugin_name_length GNUNET_PACKED;
276 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
278 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
281 * - struct GNUNET_ATS_Information [ats_count];
282 * - char address[address_length]
283 * - char plugin_name[plugin_name_length] (including '\0'-termination).
290 * Client to service: please give us an overview of the addresses.
292 struct AddressListRequestMessage
295 * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST
297 struct GNUNET_MessageHeader header;
300 * ID used to match replies to this request.
302 uint32_t id GNUNET_PACKED;
305 * Which peer do we care about? All zeros for all.
307 struct GNUNET_PeerIdentity peer;
310 * #GNUNET_YES to get information about all addresses,
311 * #GNUNET_NO to only return addresses that are in use.
313 int32_t all GNUNET_PACKED;
318 struct ReservationRequestMessage
320 struct GNUNET_MessageHeader header;
322 int32_t amount GNUNET_PACKED;
324 struct GNUNET_PeerIdentity peer;
329 * Message sent by ATS service to client to confirm that it is done
330 * using the given session ID.
332 struct SessionReleaseMessage
334 struct GNUNET_MessageHeader header;
336 uint32_t session_id GNUNET_PACKED;
338 struct GNUNET_PeerIdentity peer;
342 struct ReservationResultMessage
344 struct GNUNET_MessageHeader header;
346 int32_t amount GNUNET_PACKED;
348 struct GNUNET_PeerIdentity peer;
350 struct GNUNET_TIME_RelativeNBO res_delay;
353 struct PreferenceInformation
356 uint32_t preference_kind GNUNET_PACKED;
358 float preference_value GNUNET_PACKED;
363 struct ChangePreferenceMessage
365 struct GNUNET_MessageHeader header;
367 uint32_t num_preferences GNUNET_PACKED;
369 struct GNUNET_PeerIdentity peer;
371 /* followed by 'num_preferences'
372 * struct PreferenceInformation values */
377 * Message containing application feedback for a peer
379 struct FeedbackPreferenceMessage
381 struct GNUNET_MessageHeader header;
384 * Number of feedback values included
386 uint32_t num_feedback GNUNET_PACKED;
389 * Relative time describing for which time interval this feedback is
391 struct GNUNET_TIME_RelativeNBO scope;
394 * Peer this feedback is for
396 struct GNUNET_PeerIdentity peer;
398 /* followed by 'num_feedback'
399 * struct PreferenceInformation values */
402 GNUNET_NETWORK_STRUCT_END