-test cleanup
[oweals/gnunet.git] / src / ats / ats.h
1 /*
2      This file is part of GNUnet.
3      (C) 2010,2011 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19 */
20 /**
21  * @file ats/ats.h
22  * @brief automatic transport selection messages
23  * @author Christian Grothoff
24  * @author Matthias Wachs
25  */
26 #ifndef ATS_H
27 #define ATS_H
28
29 #include "gnunet_util_lib.h"
30
31
32 enum StartFlag
33 {
34
35   START_FLAG_SCHEDULING = 0,
36
37   START_FLAG_PERFORMANCE_WITH_PIC = 1,
38
39   START_FLAG_PERFORMANCE_NO_PIC = 2
40 };
41
42 GNUNET_NETWORK_STRUCT_BEGIN
43
44 struct ClientStartMessage
45 {
46   struct GNUNET_MessageHeader header;
47
48   /**
49    * NBO value of an 'enum StartFlag'.
50    */
51   uint32_t start_flag GNUNET_PACKED;
52 };
53
54
55 struct RequestAddressMessage
56 {
57   struct GNUNET_MessageHeader header;
58
59   uint32_t reserved GNUNET_PACKED;
60
61   struct GNUNET_PeerIdentity peer;
62 };
63
64 struct ResetBackoffMessage
65 {
66   struct GNUNET_MessageHeader header;
67
68   uint32_t reserved GNUNET_PACKED;
69
70   struct GNUNET_PeerIdentity peer;
71 };
72
73
74 struct AddressUpdateMessage
75 {
76   struct GNUNET_MessageHeader header;
77
78   uint32_t ats_count GNUNET_PACKED;
79
80   struct GNUNET_PeerIdentity peer;
81
82
83   uint16_t address_length GNUNET_PACKED;
84
85   uint16_t plugin_name_length GNUNET_PACKED;
86
87   uint32_t session_id GNUNET_PACKED;
88
89   uint32_t address_local_info GNUNET_PACKED;
90
91   /* followed by:
92    * - struct GNUNET_ATS_Information [ats_count];
93    * - char address[address_length]
94    * - char plugin_name[plugin_name_length] (including '\0'-termination).
95    */
96
97 };
98
99 struct AddressUseMessage
100 {
101   struct GNUNET_MessageHeader header;
102
103   struct GNUNET_PeerIdentity peer;
104
105   uint16_t in_use GNUNET_PACKED;
106
107   uint16_t address_length GNUNET_PACKED;
108
109   uint16_t plugin_name_length GNUNET_PACKED;
110
111   uint32_t session_id GNUNET_PACKED;
112
113   uint32_t address_local_info GNUNET_PACKED;
114
115   /* followed by:
116    * - char address[address_length]
117    * - char plugin_name[plugin_name_length] (including '\0'-termination).
118    */
119
120 };
121
122
123 struct AddressDestroyedMessage
124 {
125   struct GNUNET_MessageHeader header;
126
127   uint32_t reserved GNUNET_PACKED;
128
129   struct GNUNET_PeerIdentity peer;
130
131   uint16_t address_length GNUNET_PACKED;
132
133   uint16_t plugin_name_length GNUNET_PACKED;
134
135   uint32_t session_id GNUNET_PACKED;
136
137   uint32_t address_local_info GNUNET_PACKED;
138
139   /* followed by:
140    * - char address[address_length]
141    * - char plugin_name[plugin_name_length] (including '\0'-termination).
142    */
143
144 };
145
146
147 struct AddressSuggestionMessage
148 {
149   struct GNUNET_MessageHeader header;
150
151   uint32_t ats_count GNUNET_PACKED;
152
153   struct GNUNET_PeerIdentity peer;
154
155   uint16_t address_length GNUNET_PACKED;
156
157   uint16_t plugin_name_length GNUNET_PACKED;
158
159   uint32_t session_id GNUNET_PACKED;
160
161   uint32_t address_local_info GNUNET_PACKED;
162
163   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
164
165   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
166
167   /* followed by:
168    * - struct GNUNET_ATS_Information [ats_count];
169    * - char address[address_length]
170    * - char plugin_name[plugin_name_length] (including '\0'-termination).
171    */
172
173 };
174
175
176 struct PeerInformationMessage
177 {
178   struct GNUNET_MessageHeader header;
179
180   uint32_t ats_count GNUNET_PACKED;
181
182   uint32_t address_active GNUNET_PACKED;
183
184   uint32_t id GNUNET_PACKED;
185
186   struct GNUNET_PeerIdentity peer;
187
188   uint16_t address_length GNUNET_PACKED;
189
190   uint16_t plugin_name_length GNUNET_PACKED;
191
192   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
193
194   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
195
196   /* followed by:
197    * - struct GNUNET_ATS_Information [ats_count];
198    * - char address[address_length]
199    * - char plugin_name[plugin_name_length] (including '\0'-termination).
200    */
201
202 };
203
204
205 /**
206  * Client to service: please give us an overview of the addresses.
207  */
208 struct AddressListRequestMessage
209 {
210   /**
211    * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST
212    */
213   struct GNUNET_MessageHeader header;
214
215   /**
216    * ID used to match replies to this request.
217    */
218   uint32_t id GNUNET_PACKED;
219
220   /**
221    * Which peer do we care about? All zeros for all.
222    */
223   struct GNUNET_PeerIdentity peer;
224
225   /**
226    * #GNUNET_YES to get information about all addresses,
227    * #GNUNET_NO to only return addresses that are in use.
228    */
229   int32_t all GNUNET_PACKED;
230
231 };
232
233
234 struct ReservationRequestMessage
235 {
236   struct GNUNET_MessageHeader header;
237
238   int32_t amount GNUNET_PACKED;
239
240   struct GNUNET_PeerIdentity peer;
241 };
242
243
244 /**
245  * Message sent by ATS service to client to confirm that it is done
246  * using the given session ID.
247  */
248 struct SessionReleaseMessage
249 {
250   struct GNUNET_MessageHeader header;
251
252   uint32_t session_id GNUNET_PACKED;
253
254   struct GNUNET_PeerIdentity peer;
255 };
256
257
258 struct ReservationResultMessage
259 {
260   struct GNUNET_MessageHeader header;
261
262   int32_t amount GNUNET_PACKED;
263
264   struct GNUNET_PeerIdentity peer;
265
266   struct GNUNET_TIME_RelativeNBO res_delay;
267 };
268
269 struct PreferenceInformation
270 {
271
272   uint32_t preference_kind GNUNET_PACKED;
273
274   float preference_value GNUNET_PACKED;
275
276 };
277
278
279 struct ChangePreferenceMessage
280 {
281   struct GNUNET_MessageHeader header;
282
283   uint32_t num_preferences GNUNET_PACKED;
284
285   struct GNUNET_PeerIdentity peer;
286
287   /* followed by 'num_preferences'
288    * struct PreferenceInformation values */
289 };
290
291
292 /**
293  * Message containing application feedback for a peer
294  */
295 struct FeedbackPreferenceMessage
296 {
297   struct GNUNET_MessageHeader header;
298
299   /**
300    * Number of feedback values included
301    */
302   uint32_t num_feedback GNUNET_PACKED;
303
304   /**
305    * Relative time describing for which time interval this feedback is
306    */
307   struct GNUNET_TIME_RelativeNBO scope;
308
309   /**
310    * Peer this feedback is for
311    */
312   struct GNUNET_PeerIdentity peer;
313
314   /* followed by 'num_feedback'
315    * struct PreferenceInformation values */
316 };
317
318 GNUNET_NETWORK_STRUCT_END
319
320
321
322 #endif