diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/include/gnunet_bandwidth_lib.h | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/include/gnunet_bandwidth_lib.h')
-rw-r--r-- | src/include/gnunet_bandwidth_lib.h | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/src/include/gnunet_bandwidth_lib.h b/src/include/gnunet_bandwidth_lib.h index 945c0321a..9130ff57e 100644 --- a/src/include/gnunet_bandwidth_lib.h +++ b/src/include/gnunet_bandwidth_lib.h | |||
@@ -47,7 +47,8 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
47 | /** | 47 | /** |
48 | * 32-bit bandwidth used for network exchange by GNUnet, in bytes per second. | 48 | * 32-bit bandwidth used for network exchange by GNUnet, in bytes per second. |
49 | */ | 49 | */ |
50 | struct GNUNET_BANDWIDTH_Value32NBO { | 50 | struct GNUNET_BANDWIDTH_Value32NBO |
51 | { | ||
51 | /** | 52 | /** |
52 | * The actual value (bytes per second). | 53 | * The actual value (bytes per second). |
53 | */ | 54 | */ |
@@ -82,7 +83,8 @@ typedef void (*GNUNET_BANDWIDTH_ExcessNotificationCallback) (void *cls); | |||
82 | * structures (reducing malloc-ing); however, values should not be | 83 | * structures (reducing malloc-ing); however, values should not be |
83 | * accessed directly by clients (hence the '__'). | 84 | * accessed directly by clients (hence the '__'). |
84 | */ | 85 | */ |
85 | struct GNUNET_BANDWIDTH_Tracker { | 86 | struct GNUNET_BANDWIDTH_Tracker |
87 | { | ||
86 | /** | 88 | /** |
87 | * Closure for @e update_cb. | 89 | * Closure for @e update_cb. |
88 | */ | 90 | */ |
@@ -138,7 +140,7 @@ struct GNUNET_BANDWIDTH_Tracker { | |||
138 | /** | 140 | /** |
139 | * Convenience definition to use for 0-bandwidth. | 141 | * Convenience definition to use for 0-bandwidth. |
140 | */ | 142 | */ |
141 | #define GNUNET_BANDWIDTH_ZERO GNUNET_BANDWIDTH_value_init(0) | 143 | #define GNUNET_BANDWIDTH_ZERO GNUNET_BANDWIDTH_value_init (0) |
142 | 144 | ||
143 | 145 | ||
144 | /** | 146 | /** |
@@ -148,13 +150,13 @@ struct GNUNET_BANDWIDTH_Tracker { | |||
148 | * @return the new bandwidth value | 150 | * @return the new bandwidth value |
149 | */ | 151 | */ |
150 | struct GNUNET_BANDWIDTH_Value32NBO | 152 | struct GNUNET_BANDWIDTH_Value32NBO |
151 | GNUNET_BANDWIDTH_value_init(uint32_t bytes_per_second); | 153 | GNUNET_BANDWIDTH_value_init (uint32_t bytes_per_second); |
152 | 154 | ||
153 | 155 | ||
154 | /** | 156 | /** |
155 | * Maximum possible bandwidth value. | 157 | * Maximum possible bandwidth value. |
156 | */ | 158 | */ |
157 | #define GNUNET_BANDWIDTH_VALUE_MAX GNUNET_BANDWIDTH_value_init(UINT32_MAX) | 159 | #define GNUNET_BANDWIDTH_VALUE_MAX GNUNET_BANDWIDTH_value_init (UINT32_MAX) |
158 | 160 | ||
159 | 161 | ||
160 | /** | 162 | /** |
@@ -166,7 +168,7 @@ GNUNET_BANDWIDTH_value_init(uint32_t bytes_per_second); | |||
166 | * @return number of bytes available at bps until deadline | 168 | * @return number of bytes available at bps until deadline |
167 | */ | 169 | */ |
168 | uint64_t | 170 | uint64_t |
169 | GNUNET_BANDWIDTH_value_get_available_until( | 171 | GNUNET_BANDWIDTH_value_get_available_until ( |
170 | struct GNUNET_BANDWIDTH_Value32NBO bps, | 172 | struct GNUNET_BANDWIDTH_Value32NBO bps, |
171 | struct GNUNET_TIME_Relative deadline); | 173 | struct GNUNET_TIME_Relative deadline); |
172 | 174 | ||
@@ -180,8 +182,8 @@ GNUNET_BANDWIDTH_value_get_available_until( | |||
180 | * @return how long it would take | 182 | * @return how long it would take |
181 | */ | 183 | */ |
182 | struct GNUNET_TIME_Relative | 184 | struct GNUNET_TIME_Relative |
183 | GNUNET_BANDWIDTH_value_get_delay_for(struct GNUNET_BANDWIDTH_Value32NBO bps, | 185 | GNUNET_BANDWIDTH_value_get_delay_for (struct GNUNET_BANDWIDTH_Value32NBO bps, |
184 | uint64_t size); | 186 | uint64_t size); |
185 | 187 | ||
186 | 188 | ||
187 | /** | 189 | /** |
@@ -192,8 +194,8 @@ GNUNET_BANDWIDTH_value_get_delay_for(struct GNUNET_BANDWIDTH_Value32NBO bps, | |||
192 | * @return the min of b1 and b2 | 194 | * @return the min of b1 and b2 |
193 | */ | 195 | */ |
194 | struct GNUNET_BANDWIDTH_Value32NBO | 196 | struct GNUNET_BANDWIDTH_Value32NBO |
195 | GNUNET_BANDWIDTH_value_min(struct GNUNET_BANDWIDTH_Value32NBO b1, | 197 | GNUNET_BANDWIDTH_value_min (struct GNUNET_BANDWIDTH_Value32NBO b1, |
196 | struct GNUNET_BANDWIDTH_Value32NBO b2); | 198 | struct GNUNET_BANDWIDTH_Value32NBO b2); |
197 | 199 | ||
198 | 200 | ||
199 | /** | 201 | /** |
@@ -204,8 +206,8 @@ GNUNET_BANDWIDTH_value_min(struct GNUNET_BANDWIDTH_Value32NBO b1, | |||
204 | * @return the min of b1 and b2 | 206 | * @return the min of b1 and b2 |
205 | */ | 207 | */ |
206 | struct GNUNET_BANDWIDTH_Value32NBO | 208 | struct GNUNET_BANDWIDTH_Value32NBO |
207 | GNUNET_BANDWIDTH_value_max(struct GNUNET_BANDWIDTH_Value32NBO b1, | 209 | GNUNET_BANDWIDTH_value_max (struct GNUNET_BANDWIDTH_Value32NBO b1, |
208 | struct GNUNET_BANDWIDTH_Value32NBO b2); | 210 | struct GNUNET_BANDWIDTH_Value32NBO b2); |
209 | 211 | ||
210 | 212 | ||
211 | /** | 213 | /** |
@@ -216,8 +218,8 @@ GNUNET_BANDWIDTH_value_max(struct GNUNET_BANDWIDTH_Value32NBO b1, | |||
216 | * @return the sum of b1 and b2 | 218 | * @return the sum of b1 and b2 |
217 | */ | 219 | */ |
218 | struct GNUNET_BANDWIDTH_Value32NBO | 220 | struct GNUNET_BANDWIDTH_Value32NBO |
219 | GNUNET_BANDWIDTH_value_sum(struct GNUNET_BANDWIDTH_Value32NBO b1, | 221 | GNUNET_BANDWIDTH_value_sum (struct GNUNET_BANDWIDTH_Value32NBO b1, |
220 | struct GNUNET_BANDWIDTH_Value32NBO b2); | 222 | struct GNUNET_BANDWIDTH_Value32NBO b2); |
221 | 223 | ||
222 | 224 | ||
223 | /** | 225 | /** |
@@ -237,7 +239,7 @@ GNUNET_BANDWIDTH_value_sum(struct GNUNET_BANDWIDTH_Value32NBO b1, | |||
237 | * may accumulate before it expires | 239 | * may accumulate before it expires |
238 | */ | 240 | */ |
239 | void | 241 | void |
240 | GNUNET_BANDWIDTH_tracker_init( | 242 | GNUNET_BANDWIDTH_tracker_init ( |
241 | struct GNUNET_BANDWIDTH_Tracker *av, | 243 | struct GNUNET_BANDWIDTH_Tracker *av, |
242 | GNUNET_BANDWIDTH_TrackerUpdateCallback update_cb, | 244 | GNUNET_BANDWIDTH_TrackerUpdateCallback update_cb, |
243 | void *update_cb_cls, | 245 | void *update_cb_cls, |
@@ -264,7 +266,7 @@ GNUNET_BANDWIDTH_tracker_init( | |||
264 | * @param excess_cb_cls closure for @a excess_cb | 266 | * @param excess_cb_cls closure for @a excess_cb |
265 | */ | 267 | */ |
266 | void | 268 | void |
267 | GNUNET_BANDWIDTH_tracker_init2( | 269 | GNUNET_BANDWIDTH_tracker_init2 ( |
268 | struct GNUNET_BANDWIDTH_Tracker *av, | 270 | struct GNUNET_BANDWIDTH_Tracker *av, |
269 | GNUNET_BANDWIDTH_TrackerUpdateCallback update_cb, | 271 | GNUNET_BANDWIDTH_TrackerUpdateCallback update_cb, |
270 | void *update_cb_cls, | 272 | void *update_cb_cls, |
@@ -280,7 +282,7 @@ GNUNET_BANDWIDTH_tracker_init2( | |||
280 | * @param av the respective trackers | 282 | * @param av the respective trackers |
281 | */ | 283 | */ |
282 | void | 284 | void |
283 | GNUNET_BANDWIDTH_tracker_notification_stop( | 285 | GNUNET_BANDWIDTH_tracker_notification_stop ( |
284 | struct GNUNET_BANDWIDTH_Tracker *av); | 286 | struct GNUNET_BANDWIDTH_Tracker *av); |
285 | 287 | ||
286 | 288 | ||
@@ -296,8 +298,8 @@ GNUNET_BANDWIDTH_tracker_notification_stop( | |||
296 | * @return #GNUNET_YES if this consumption is above the limit | 298 | * @return #GNUNET_YES if this consumption is above the limit |
297 | */ | 299 | */ |
298 | int | 300 | int |
299 | GNUNET_BANDWIDTH_tracker_consume(struct GNUNET_BANDWIDTH_Tracker *av, | 301 | GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av, |
300 | ssize_t size); | 302 | ssize_t size); |
301 | 303 | ||
302 | 304 | ||
303 | /** | 305 | /** |
@@ -310,8 +312,8 @@ GNUNET_BANDWIDTH_tracker_consume(struct GNUNET_BANDWIDTH_Tracker *av, | |||
310 | * @return time to wait for consumption to be OK | 312 | * @return time to wait for consumption to be OK |
311 | */ | 313 | */ |
312 | struct GNUNET_TIME_Relative | 314 | struct GNUNET_TIME_Relative |
313 | GNUNET_BANDWIDTH_tracker_get_delay(struct GNUNET_BANDWIDTH_Tracker *av, | 315 | GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av, |
314 | size_t size); | 316 | size_t size); |
315 | 317 | ||
316 | 318 | ||
317 | /** | 319 | /** |
@@ -322,7 +324,7 @@ GNUNET_BANDWIDTH_tracker_get_delay(struct GNUNET_BANDWIDTH_Tracker *av, | |||
322 | * @return number of bytes available for consumption right now | 324 | * @return number of bytes available for consumption right now |
323 | */ | 325 | */ |
324 | int64_t | 326 | int64_t |
325 | GNUNET_BANDWIDTH_tracker_get_available(struct GNUNET_BANDWIDTH_Tracker *av); | 327 | GNUNET_BANDWIDTH_tracker_get_available (struct GNUNET_BANDWIDTH_Tracker *av); |
326 | 328 | ||
327 | 329 | ||
328 | /** | 330 | /** |
@@ -332,7 +334,7 @@ GNUNET_BANDWIDTH_tracker_get_available(struct GNUNET_BANDWIDTH_Tracker *av); | |||
332 | * @param bytes_per_second_limit new limit to assume | 334 | * @param bytes_per_second_limit new limit to assume |
333 | */ | 335 | */ |
334 | void | 336 | void |
335 | GNUNET_BANDWIDTH_tracker_update_quota( | 337 | GNUNET_BANDWIDTH_tracker_update_quota ( |
336 | struct GNUNET_BANDWIDTH_Tracker *av, | 338 | struct GNUNET_BANDWIDTH_Tracker *av, |
337 | struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit); | 339 | struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit); |
338 | 340 | ||