317528cade0510e02fe0001f4888c3498ae1b906
[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
44
45 struct ClientStart
46 {
47   struct GNUNET_MessageHeader header;
48
49   /**
50    * NBO value of an 'enum StartFlag'.
51    */
52   uint32_t start_flag;
53 };
54
55
56
57 struct RequestAddressMessage
58 {
59   struct GNUNET_MessageHeader header;
60  
61   uint32_t reserved GNUNET_PACKED;
62
63   struct GNUNET_PeerIdentity peer;
64 };
65
66 struct AddressUpdateMessage
67 {
68   struct GNUNET_MessageHeader header;
69
70   uint32_t ats_count GNUNET_PACKED;
71
72   struct GNUNET_PeerIdentity peer;
73
74   uint16_t address_length GNUNET_PACKED;
75
76   uint16_t plugin_name_length GNUNET_PACKED;
77
78   uint32_t session_id GNUNET_PACKED;
79
80   /* followed by:
81      - struct GNUNET_TRANSPORT_ATS_Information [ats_count];
82      - char address[address_length]
83      - char plugin_name[plugin_name_length] (including '\0'-termination).
84   */
85
86 };
87
88 struct AddressDestroyedMessage
89 {
90   struct GNUNET_MessageHeader header;
91
92   uint32_t reserved GNUNET_PACKED;
93
94   struct GNUNET_PeerIdentity peer;
95
96   uint16_t address_length GNUNET_PACKED;
97
98   uint16_t plugin_name_length GNUNET_PACKED;
99
100   uint32_t session_id GNUNET_PACKED;
101
102   /* followed by:
103      - char address[address_length]
104      - char plugin_name[plugin_name_length] (including '\0'-termination).
105   */
106
107 };
108
109
110 struct AddressSuggestionMessage
111 {
112   struct GNUNET_MessageHeader header;
113
114   uint32_t reserved GNUNET_PACKED;
115
116   struct GNUNET_PeerIdentity peer;
117
118   uint16_t address_length GNUNET_PACKED;
119
120   uint16_t plugin_name_length GNUNET_PACKED;
121
122   uint32_t session_id GNUNET_PACKED;
123
124   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
125   
126   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
127
128   /* followed by:
129      - char address[address_length]
130      - char plugin_name[plugin_name_length] (including '\0'-termination).
131   */
132
133 };
134
135
136
137 struct PeerInformationMessage
138 {
139   struct GNUNET_MessageHeader header;
140
141   uint32_t ats_count GNUNET_PACKED;
142
143   struct GNUNET_PeerIdentity peer;
144
145   uint16_t address_length GNUNET_PACKED;
146
147   uint16_t plugin_name_length GNUNET_PACKED;
148
149   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
150   
151   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
152
153   /* followed by: 
154      - struct GNUNET_TRANSPORT_ATS_Information [ats_count];
155      - char address[address_length]
156      - char plugin_name[plugin_name_length] (including '\0'-termination).
157   */
158
159 };
160
161
162
163
164 struct ReservationRequestMessage
165 {
166   struct GNUNET_MessageHeader header;
167
168   int32_t amount GNUNET_PACKED;
169
170   struct GNUNET_PeerIdentity peer;
171 };
172
173
174 struct ReservationResultMessage
175 {
176   struct GNUNET_MessageHeader header;
177
178   int32_t amount GNUNET_PACKED;
179
180   struct GNUNET_PeerIdentity peer;
181
182   struct GNUNET_TIME_RelativeNBO res_delay;
183 };
184
185
186 struct PreferenceInformation
187 {
188
189   uint32_t preference_kind GNUNET_PACKED;
190
191   float preference_value GNUNET_PACKED;
192   
193 };
194
195
196 struct ChangePreferenceMessage
197 {
198   struct GNUNET_MessageHeader header;
199
200   uint32_t num_preferences GNUNET_PACKED;
201
202   struct GNUNET_PeerIdentity peer;
203
204   /* followed by 'num_preferences' 
205      struct PreferenceInformation values */
206 };
207
208
209
210 #endif