added ATS addresstype information to unix
[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
43 struct ClientStartMessage
44 {
45   struct GNUNET_MessageHeader header;
46
47   /**
48    * NBO value of an 'enum StartFlag'.
49    */
50   uint32_t start_flag GNUNET_PACKED;
51 };
52
53
54 struct RequestAddressMessage
55 {
56   struct GNUNET_MessageHeader header;
57
58   uint32_t reserved GNUNET_PACKED;
59
60   struct GNUNET_PeerIdentity peer;
61 };
62
63
64 struct AddressUpdateMessage
65 {
66   struct GNUNET_MessageHeader header;
67
68   uint32_t ats_count GNUNET_PACKED;
69
70   struct GNUNET_PeerIdentity peer;
71
72   uint16_t address_length GNUNET_PACKED;
73
74   uint16_t plugin_name_length GNUNET_PACKED;
75
76   uint32_t session_id GNUNET_PACKED;
77
78   /* followed by:
79    * - struct GNUNET_ATS_Information [ats_count];
80    * - char address[address_length]
81    * - char plugin_name[plugin_name_length] (including '\0'-termination).
82    */
83
84 };
85
86 struct AddressUseMessage
87 {
88   struct GNUNET_MessageHeader header;
89
90   struct GNUNET_PeerIdentity peer;
91
92   uint16_t in_use GNUNET_PACKED;
93
94   uint16_t address_length GNUNET_PACKED;
95
96   uint16_t plugin_name_length GNUNET_PACKED;
97
98   uint32_t session_id GNUNET_PACKED;
99
100   /* followed by:
101    * - char address[address_length]
102    * - char plugin_name[plugin_name_length] (including '\0'-termination).
103    */
104
105 };
106
107
108 struct AddressDestroyedMessage
109 {
110   struct GNUNET_MessageHeader header;
111
112   uint32_t reserved GNUNET_PACKED;
113
114   struct GNUNET_PeerIdentity peer;
115
116   uint16_t address_length GNUNET_PACKED;
117
118   uint16_t plugin_name_length GNUNET_PACKED;
119
120   uint32_t session_id GNUNET_PACKED;
121
122   /* followed by:
123    * - char address[address_length]
124    * - char plugin_name[plugin_name_length] (including '\0'-termination).
125    */
126
127 };
128
129
130 struct AddressSuggestionMessage
131 {
132   struct GNUNET_MessageHeader header;
133
134   uint32_t ats_count GNUNET_PACKED;
135
136   struct GNUNET_PeerIdentity peer;
137
138   uint16_t address_length GNUNET_PACKED;
139
140   uint16_t plugin_name_length GNUNET_PACKED;
141
142   uint32_t session_id GNUNET_PACKED;
143
144   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
145
146   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
147
148   /* followed by:
149    * - struct GNUNET_ATS_Information [ats_count];
150    * - char address[address_length]
151    * - char plugin_name[plugin_name_length] (including '\0'-termination).
152    */
153
154 };
155
156
157 struct PeerInformationMessage
158 {
159   struct GNUNET_MessageHeader header;
160
161   uint32_t ats_count GNUNET_PACKED;
162
163   struct GNUNET_PeerIdentity peer;
164
165   uint16_t address_length GNUNET_PACKED;
166
167   uint16_t plugin_name_length GNUNET_PACKED;
168
169   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
170
171   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
172
173   /* followed by:
174    * - struct GNUNET_ATS_Information [ats_count];
175    * - char address[address_length]
176    * - char plugin_name[plugin_name_length] (including '\0'-termination).
177    */
178
179 };
180
181
182 struct ReservationRequestMessage
183 {
184   struct GNUNET_MessageHeader header;
185
186   int32_t amount GNUNET_PACKED;
187
188   struct GNUNET_PeerIdentity peer;
189 };
190
191
192 /**
193  * Message sent by ATS service to client to confirm that it is done
194  * using the given session ID.
195  */
196 struct SessionReleaseMessage
197 {
198   struct GNUNET_MessageHeader header;
199
200   uint32_t session_id GNUNET_PACKED;
201
202   struct GNUNET_PeerIdentity peer;
203 };
204
205
206 struct ReservationResultMessage
207 {
208   struct GNUNET_MessageHeader header;
209
210   int32_t amount GNUNET_PACKED;
211
212   struct GNUNET_PeerIdentity peer;
213
214   struct GNUNET_TIME_RelativeNBO res_delay;
215 };
216
217
218 struct PreferenceInformation
219 {
220
221   uint32_t preference_kind GNUNET_PACKED;
222
223   float preference_value GNUNET_PACKED;
224
225 };
226
227
228 struct ChangePreferenceMessage
229 {
230   struct GNUNET_MessageHeader header;
231
232   uint32_t num_preferences GNUNET_PACKED;
233
234   struct GNUNET_PeerIdentity peer;
235
236   /* followed by 'num_preferences'
237    * struct PreferenceInformation values */
238 };
239
240
241
242 #endif