add address test
[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   uint16_t address_length GNUNET_PACKED;
83
84   uint16_t plugin_name_length GNUNET_PACKED;
85
86   uint32_t session_id GNUNET_PACKED;
87
88   /* followed by:
89    * - struct GNUNET_ATS_Information [ats_count];
90    * - char address[address_length]
91    * - char plugin_name[plugin_name_length] (including '\0'-termination).
92    */
93
94 };
95
96 struct AddressUseMessage
97 {
98   struct GNUNET_MessageHeader header;
99
100   struct GNUNET_PeerIdentity peer;
101
102   uint16_t in_use GNUNET_PACKED;
103
104   uint16_t address_length GNUNET_PACKED;
105
106   uint16_t plugin_name_length GNUNET_PACKED;
107
108   uint32_t session_id GNUNET_PACKED;
109
110   /* followed by:
111    * - char address[address_length]
112    * - char plugin_name[plugin_name_length] (including '\0'-termination).
113    */
114
115 };
116
117
118 struct AddressDestroyedMessage
119 {
120   struct GNUNET_MessageHeader header;
121
122   uint32_t reserved GNUNET_PACKED;
123
124   struct GNUNET_PeerIdentity peer;
125
126   uint16_t address_length GNUNET_PACKED;
127
128   uint16_t plugin_name_length GNUNET_PACKED;
129
130   uint32_t session_id GNUNET_PACKED;
131
132   /* followed by:
133    * - char address[address_length]
134    * - char plugin_name[plugin_name_length] (including '\0'-termination).
135    */
136
137 };
138
139
140 struct AddressSuggestionMessage
141 {
142   struct GNUNET_MessageHeader header;
143
144   uint32_t ats_count GNUNET_PACKED;
145
146   struct GNUNET_PeerIdentity peer;
147
148   uint16_t address_length GNUNET_PACKED;
149
150   uint16_t plugin_name_length GNUNET_PACKED;
151
152   uint32_t session_id GNUNET_PACKED;
153
154   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
155
156   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
157
158   /* followed by:
159    * - struct GNUNET_ATS_Information [ats_count];
160    * - char address[address_length]
161    * - char plugin_name[plugin_name_length] (including '\0'-termination).
162    */
163
164 };
165
166
167 struct PeerInformationMessage
168 {
169   struct GNUNET_MessageHeader header;
170
171   uint32_t ats_count GNUNET_PACKED;
172
173   uint32_t address_active GNUNET_PACKED;
174
175   uint32_t id GNUNET_PACKED;
176
177   struct GNUNET_PeerIdentity peer;
178
179   uint16_t address_length GNUNET_PACKED;
180
181   uint16_t plugin_name_length GNUNET_PACKED;
182
183   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
184
185   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
186
187   /* followed by:
188    * - struct GNUNET_ATS_Information [ats_count];
189    * - char address[address_length]
190    * - char plugin_name[plugin_name_length] (including '\0'-termination).
191    */
192
193 };
194
195
196 struct AddressListRequestMessage
197 {
198   struct GNUNET_MessageHeader header;
199
200   uint32_t id GNUNET_PACKED;
201
202   int32_t all GNUNET_PACKED;
203
204   struct GNUNET_PeerIdentity peer;
205 };
206
207
208 struct ReservationRequestMessage
209 {
210   struct GNUNET_MessageHeader header;
211
212   int32_t amount GNUNET_PACKED;
213
214   struct GNUNET_PeerIdentity peer;
215 };
216
217
218 /**
219  * Message sent by ATS service to client to confirm that it is done
220  * using the given session ID.
221  */
222 struct SessionReleaseMessage
223 {
224   struct GNUNET_MessageHeader header;
225
226   uint32_t session_id GNUNET_PACKED;
227
228   struct GNUNET_PeerIdentity peer;
229 };
230
231
232 struct ReservationResultMessage
233 {
234   struct GNUNET_MessageHeader header;
235
236   int32_t amount GNUNET_PACKED;
237
238   struct GNUNET_PeerIdentity peer;
239
240   struct GNUNET_TIME_RelativeNBO res_delay;
241 };
242
243 struct PreferenceInformation
244 {
245
246   uint32_t preference_kind GNUNET_PACKED;
247
248   float preference_value GNUNET_PACKED;
249
250 };
251
252
253 struct ChangePreferenceMessage
254 {
255   struct GNUNET_MessageHeader header;
256
257   uint32_t num_preferences GNUNET_PACKED;
258
259   struct GNUNET_PeerIdentity peer;
260
261   /* followed by 'num_preferences'
262    * struct PreferenceInformation values */
263 };
264
265
266 /**
267  * Message containing application feedback for a peer
268  */
269 struct FeedbackPreferenceMessage
270 {
271   struct GNUNET_MessageHeader header;
272
273   /**
274    * Number of feedback values included
275    */
276   uint32_t num_feedback GNUNET_PACKED;
277
278   /**
279    * Relative time describing for which time interval this feedback is
280    */
281   struct GNUNET_TIME_RelativeNBO scope;
282
283   /**
284    * Peer this feedback is for
285    */
286   struct GNUNET_PeerIdentity peer;
287
288   /* followed by 'num_feedback'
289    * struct PreferenceInformation values */
290 };
291
292 GNUNET_NETWORK_STRUCT_END
293
294
295
296 #endif