session end function must include address to notify address
[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 struct AddressListRequestMessage
206 {
207   struct GNUNET_MessageHeader header;
208
209   uint32_t id GNUNET_PACKED;
210
211   int32_t all GNUNET_PACKED;
212
213   struct GNUNET_PeerIdentity peer;
214 };
215
216
217 struct ReservationRequestMessage
218 {
219   struct GNUNET_MessageHeader header;
220
221   int32_t amount GNUNET_PACKED;
222
223   struct GNUNET_PeerIdentity peer;
224 };
225
226
227 /**
228  * Message sent by ATS service to client to confirm that it is done
229  * using the given session ID.
230  */
231 struct SessionReleaseMessage
232 {
233   struct GNUNET_MessageHeader header;
234
235   uint32_t session_id GNUNET_PACKED;
236
237   struct GNUNET_PeerIdentity peer;
238 };
239
240
241 struct ReservationResultMessage
242 {
243   struct GNUNET_MessageHeader header;
244
245   int32_t amount GNUNET_PACKED;
246
247   struct GNUNET_PeerIdentity peer;
248
249   struct GNUNET_TIME_RelativeNBO res_delay;
250 };
251
252 struct PreferenceInformation
253 {
254
255   uint32_t preference_kind GNUNET_PACKED;
256
257   float preference_value GNUNET_PACKED;
258
259 };
260
261
262 struct ChangePreferenceMessage
263 {
264   struct GNUNET_MessageHeader header;
265
266   uint32_t num_preferences GNUNET_PACKED;
267
268   struct GNUNET_PeerIdentity peer;
269
270   /* followed by 'num_preferences'
271    * struct PreferenceInformation values */
272 };
273
274
275 /**
276  * Message containing application feedback for a peer
277  */
278 struct FeedbackPreferenceMessage
279 {
280   struct GNUNET_MessageHeader header;
281
282   /**
283    * Number of feedback values included
284    */
285   uint32_t num_feedback GNUNET_PACKED;
286
287   /**
288    * Relative time describing for which time interval this feedback is
289    */
290   struct GNUNET_TIME_RelativeNBO scope;
291
292   /**
293    * Peer this feedback is for
294    */
295   struct GNUNET_PeerIdentity peer;
296
297   /* followed by 'num_feedback'
298    * struct PreferenceInformation values */
299 };
300
301 GNUNET_NETWORK_STRUCT_END
302
303
304
305 #endif