diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-08 09:44:09 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-08 09:44:09 +0000 |
commit | 4cb072889dd55664992ebcdce2ae8549a0545198 (patch) | |
tree | c066a8a88d9950e31daa3d62d9d50a213f59865a /src/include | |
parent | 30b0483d7a219c24497c34f5ba21ed6d9c675819 (diff) | |
download | gnunet-4cb072889dd55664992ebcdce2ae8549a0545198.tar.gz gnunet-4cb072889dd55664992ebcdce2ae8549a0545198.zip |
indentation and inmproved documentation for feedback
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_ats_service.h | 654 |
1 files changed, 308 insertions, 346 deletions
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index 97dce3b0c..710e14a11 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2010,2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2010,2011 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 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 | 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 | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 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 | 16 | along with GNUnet; see the file COPYING. If not, write to the |
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file include/gnunet_ats_service.h | 21 | * @file include/gnunet_ats_service.h |
22 | * @brief automatic transport selection and outbound bandwidth determination | 22 | * @brief automatic transport selection and outbound bandwidth determination |
@@ -212,246 +212,246 @@ enum GNUNET_ATS_Property | |||
212 | * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb] | 212 | * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb] |
213 | */ | 213 | */ |
214 | GNUNET_ATS_COST_WLAN | 214 | GNUNET_ATS_COST_WLAN |
215 | /* Cost related values */ | 215 | /* Cost related values */ |
216 | /* =================== */ | 216 | /* =================== */ |
217 | /** | 217 | /** |
218 | * Volume based cost in financial units to transmit data | 218 | * Volume based cost in financial units to transmit data |
219 | * | 219 | * |
220 | * Note: This value is not bound to a specific currency or unit and only | 220 | * Note: This value is not bound to a specific currency or unit and only |
221 | * used locally. | 221 | * used locally. |
222 | * "cent" just refers the smallest amount of money in the respective | 222 | * "cent" just refers the smallest amount of money in the respective |
223 | * currency. | 223 | * currency. |
224 | * | 224 | * |
225 | * Unit: [cent/MB] | 225 | * Unit: [cent/MB] |
226 | * | 226 | * |
227 | * Interpretation: less is better | 227 | * Interpretation: less is better |
228 | * | 228 | * |
229 | * Examples: | 229 | * Examples: |
230 | * LAN: 0 [cent/MB] | 230 | * LAN: 0 [cent/MB] |
231 | * 2G : 10 [cent/MB] | 231 | * 2G : 10 [cent/MB] |
232 | */ | 232 | */ |
233 | // GNUNET_ATS_COST_FINANCIAL_PER_VOLUME = 1, | 233 | // GNUNET_ATS_COST_FINANCIAL_PER_VOLUME = 1, |
234 | /** | 234 | /** |
235 | * Time based cost in financial units to transmit data | 235 | * Time based cost in financial units to transmit data |
236 | * | 236 | * |
237 | * Note: This value is not bound to a specific currency or unit and only | 237 | * Note: This value is not bound to a specific currency or unit and only |
238 | * used locally. | 238 | * used locally. |
239 | * "cent" just refers the smallest amount of money in the respective | 239 | * "cent" just refers the smallest amount of money in the respective |
240 | * currency. | 240 | * currency. |
241 | * | 241 | * |
242 | * Unit: [cent/h] | 242 | * Unit: [cent/h] |
243 | * | 243 | * |
244 | * Interpretation: less is better | 244 | * Interpretation: less is better |
245 | * | 245 | * |
246 | * Examples: | 246 | * Examples: |
247 | * LAN : 0 [cent/h] | 247 | * LAN : 0 [cent/h] |
248 | * Dialup: 10 [cent/h] | 248 | * Dialup: 10 [cent/h] |
249 | */ | 249 | */ |
250 | // GNUNET_ATS_COST_FINANCIAL_PER_TIME = 2, | 250 | // GNUNET_ATS_COST_FINANCIAL_PER_TIME = 2, |
251 | /** | 251 | /** |
252 | * Computational costs | 252 | * Computational costs |
253 | * | 253 | * |
254 | * Effort of preparing data to be sent with this transport | 254 | * Effort of preparing data to be sent with this transport |
255 | * Includes encoding, encryption and conversion of data | 255 | * Includes encoding, encryption and conversion of data |
256 | * Partial values can be summed up: c_sum = c_enc + c_enc + c_conv | 256 | * Partial values can be summed up: c_sum = c_enc + c_enc + c_conv |
257 | * Resulting values depend on local system properties, e.g. CPU | 257 | * Resulting values depend on local system properties, e.g. CPU |
258 | * | 258 | * |
259 | * Unit: [ms/GB] | 259 | * Unit: [ms/GB] |
260 | * | 260 | * |
261 | * Interpretation: less is better | 261 | * Interpretation: less is better |
262 | * | 262 | * |
263 | * Examples: | 263 | * Examples: |
264 | * | 264 | * |
265 | * HTTPS with AES CBC-256: 7,382 | 265 | * HTTPS with AES CBC-256: 7,382 |
266 | * HTTPS with AES CBC-128: 5,279 | 266 | * HTTPS with AES CBC-128: 5,279 |
267 | * HTTPS with RC4-1024: 2,652 | 267 | * HTTPS with RC4-1024: 2,652 |
268 | */ | 268 | */ |
269 | // GNUNET_ATS_COST_COMPUTATIONAL = 3, | 269 | // GNUNET_ATS_COST_COMPUTATIONAL = 3, |
270 | /** | 270 | /** |
271 | * Energy consumption | 271 | * Energy consumption |
272 | * | 272 | * |
273 | * Energy consumption using this transport when sending with a certain | 273 | * Energy consumption using this transport when sending with a certain |
274 | * power at a certain bitrate. This is only an approximation based on: | 274 | * power at a certain bitrate. This is only an approximation based on: |
275 | * Energy consumption E = P / D | 275 | * Energy consumption E = P / D |
276 | * | 276 | * |
277 | * with: | 277 | * with: |
278 | * Power P in Watt (J/s) | 278 | * Power P in Watt (J/s) |
279 | * Datarate D in MBit/s | 279 | * Datarate D in MBit/s |
280 | * | 280 | * |
281 | * Conversion between power P and dBm used by WLAN in radiotap's dBm TX power: | 281 | * Conversion between power P and dBm used by WLAN in radiotap's dBm TX power: |
282 | * | 282 | * |
283 | * Lp(dbm) = 10 log10 (P/ 1mW) | 283 | * Lp(dbm) = 10 log10 (P/ 1mW) |
284 | * | 284 | * |
285 | * => P = 1 mW * 10^(Lp(dbm)/10) | 285 | * => P = 1 mW * 10^(Lp(dbm)/10) |
286 | * | 286 | * |
287 | * Unit: [mJ/MB] | 287 | * Unit: [mJ/MB] |
288 | * | 288 | * |
289 | * Interpretation: less is better | 289 | * Interpretation: less is better |
290 | * | 290 | * |
291 | * Examples: | 291 | * Examples: |
292 | * | 292 | * |
293 | * LAN: 0 | 293 | * LAN: 0 |
294 | * WLAN: 89 (600 mW @ 802.11g /w 54 MBit/s) | 294 | * WLAN: 89 (600 mW @ 802.11g /w 54 MBit/s) |
295 | * Bluetooth: 267 (100 mW @ BT2.0 EDR /w 3 MBit/s) | 295 | * Bluetooth: 267 (100 mW @ BT2.0 EDR /w 3 MBit/s) |
296 | */ | 296 | */ |
297 | // GNUNET_ATS_COST_ENERGY_CONSUMPTION = 4, | 297 | // GNUNET_ATS_COST_ENERGY_CONSUMPTION = 4, |
298 | /** | 298 | /** |
299 | * Connect cost | 299 | * Connect cost |
300 | * How many bytes are transmitted to initiate a new connection using | 300 | * How many bytes are transmitted to initiate a new connection using |
301 | * this transport? | 301 | * this transport? |
302 | * | 302 | * |
303 | * Unit: [bytes] | 303 | * Unit: [bytes] |
304 | * | 304 | * |
305 | * Interpretation: less is better | 305 | * Interpretation: less is better |
306 | * | 306 | * |
307 | * Examples: | 307 | * Examples: |
308 | * | 308 | * |
309 | * UDP (No connection) : | 309 | * UDP (No connection) : |
310 | * 0 bytes | 310 | * 0 bytes |
311 | * TCP (TCP 3-Way handshake): | 311 | * TCP (TCP 3-Way handshake): |
312 | * 220 bytes Ethernet, 172 bytes TCP/IP, 122 bytes TCP | 312 | * 220 bytes Ethernet, 172 bytes TCP/IP, 122 bytes TCP |
313 | * HTTP (TCP + Header) : | 313 | * HTTP (TCP + Header) : |
314 | * 477 bytes Ethernet, 429 bytes TCP/IP, 374 bytes TCP, 278 bytes HTTP | 314 | * 477 bytes Ethernet, 429 bytes TCP/IP, 374 bytes TCP, 278 bytes HTTP |
315 | * HTTPS HTTP+TLS Handshake: | 315 | * HTTPS HTTP+TLS Handshake: |
316 | * 2129 bytes Ethernet, 1975 bytes TCP/IP, 1755 bytes TCP, 1403 bytes HTTPS | 316 | * 2129 bytes Ethernet, 1975 bytes TCP/IP, 1755 bytes TCP, 1403 bytes HTTPS |
317 | * | 317 | * |
318 | * */ | 318 | * */ |
319 | // GNUNET_ATS_COST_CONNECT = 5, | 319 | // GNUNET_ATS_COST_CONNECT = 5, |
320 | /** | 320 | /** |
321 | * Bandwidth cost | 321 | * Bandwidth cost |
322 | * | 322 | * |
323 | * How many bandwidth is available to consume? | 323 | * How many bandwidth is available to consume? |
324 | * Used to calculate which impact sending data with this transport has | 324 | * Used to calculate which impact sending data with this transport has |
325 | * | 325 | * |
326 | * Unit: [kB/s] | 326 | * Unit: [kB/s] |
327 | * | 327 | * |
328 | * Interpretation: more is better | 328 | * Interpretation: more is better |
329 | * | 329 | * |
330 | * Examples: | 330 | * Examples: |
331 | * LAN: 12,800 (100 MBit/s) | 331 | * LAN: 12,800 (100 MBit/s) |
332 | * WLAN: 6,912 (54 MBit/s) | 332 | * WLAN: 6,912 (54 MBit/s) |
333 | * Dial-up: 8 (64 Kbit/s) | 333 | * Dial-up: 8 (64 Kbit/s) |
334 | * | 334 | * |
335 | */ | 335 | */ |
336 | // GNUNET_ATS_COST_BANDWITH_AVAILABLE = 6, | 336 | // GNUNET_ATS_COST_BANDWITH_AVAILABLE = 6, |
337 | /** | 337 | /** |
338 | * Network overhead | 338 | * Network overhead |
339 | * | 339 | * |
340 | * How many bytes are sent over the wire when 1 kilobyte (1024 bytes) | 340 | * How many bytes are sent over the wire when 1 kilobyte (1024 bytes) |
341 | * of application data is transmitted? | 341 | * of application data is transmitted? |
342 | * A factor used with connect cost, bandwidth cost and energy cost | 342 | * A factor used with connect cost, bandwidth cost and energy cost |
343 | * to describe the overhead produced by the transport protocol | 343 | * to describe the overhead produced by the transport protocol |
344 | * | 344 | * |
345 | * Unit: [bytes/kb] | 345 | * Unit: [bytes/kb] |
346 | * | 346 | * |
347 | * Interpretation: less is better | 347 | * Interpretation: less is better |
348 | * | 348 | * |
349 | * Examples: | 349 | * Examples: |
350 | * | 350 | * |
351 | * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb] | 351 | * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb] |
352 | * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb] | 352 | * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb] |
353 | * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb] | 353 | * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb] |
354 | * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb] | 354 | * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb] |
355 | */ | 355 | */ |
356 | // GNUNET_ATS_COST_NETWORK_OVERHEAD = 7, | 356 | // GNUNET_ATS_COST_NETWORK_OVERHEAD = 7, |
357 | /* Quality related values */ | 357 | /* Quality related values */ |
358 | /* ====================== */ | 358 | /* ====================== */ |
359 | /* Physical layer quality properties */ | 359 | /* Physical layer quality properties */ |
360 | /** | 360 | /** |
361 | * Signal strength on physical layer | 361 | * Signal strength on physical layer |
362 | * | 362 | * |
363 | * Unit: [dBm] | 363 | * Unit: [dBm] |
364 | */ | 364 | */ |
365 | // GNUNET_ATS_QUALITY_PHY_SIGNAL_STRENGTH = 1025, | 365 | // GNUNET_ATS_QUALITY_PHY_SIGNAL_STRENGTH = 1025, |
366 | /** | 366 | /** |
367 | * Collision rate on physical layer | 367 | * Collision rate on physical layer |
368 | * | 368 | * |
369 | * Unit: [B/s] | 369 | * Unit: [B/s] |
370 | */ | 370 | */ |
371 | // GNUNET_ATS_QUALITY_PHY_COLLISION_RATE = 1026, | 371 | // GNUNET_ATS_QUALITY_PHY_COLLISION_RATE = 1026, |
372 | /** | 372 | /** |
373 | * Error rate on physical layer | 373 | * Error rate on physical layer |
374 | * | 374 | * |
375 | * Unit: [B/s] | 375 | * Unit: [B/s] |
376 | */ | 376 | */ |
377 | // GNUNET_ATS_QUALITY_PHY_ERROR_RATE = 1027, | 377 | // GNUNET_ATS_QUALITY_PHY_ERROR_RATE = 1027, |
378 | /** | 378 | /** |
379 | * Jitter | 379 | * Jitter |
380 | * Time variations of the delay | 380 | * Time variations of the delay |
381 | * 1st derivative of a delay function | 381 | * 1st derivative of a delay function |
382 | * | 382 | * |
383 | * Unit: [ms] | 383 | * Unit: [ms] |
384 | */ | 384 | */ |
385 | // GNUNET_ATS_QUALITY_NET_JITTER = 1029, | 385 | // GNUNET_ATS_QUALITY_NET_JITTER = 1029, |
386 | /** | 386 | /** |
387 | * Error rate on network layer | 387 | * Error rate on network layer |
388 | * | 388 | * |
389 | * Unit: [B/s] | 389 | * Unit: [B/s] |
390 | * | 390 | * |
391 | * Examples: | 391 | * Examples: |
392 | * | 392 | * |
393 | * LAN : 0 | 393 | * LAN : 0 |
394 | * WLAN : 400 | 394 | * WLAN : 400 |
395 | * Bluetooth : 100 | 395 | * Bluetooth : 100 |
396 | * Note: This numbers are just assumptions as an example, not | 396 | * Note: This numbers are just assumptions as an example, not |
397 | * measured or somehow determined | 397 | * measured or somehow determined |
398 | */ | 398 | */ |
399 | // GNUNET_ATS_QUALITY_NET_ERRORRATE = 1030, | 399 | // GNUNET_ATS_QUALITY_NET_ERRORRATE = 1030, |
400 | /** | 400 | /** |
401 | * Drop rate on network layer | 401 | * Drop rate on network layer |
402 | * Bytes actively dismissed by a network component during transmission | 402 | * Bytes actively dismissed by a network component during transmission |
403 | * Reasons for dropped data can be full queues, congestion, quota violations... | 403 | * Reasons for dropped data can be full queues, congestion, quota violations... |
404 | * | 404 | * |
405 | * Unit: [B/s] | 405 | * Unit: [B/s] |
406 | * | 406 | * |
407 | * Examples: | 407 | * Examples: |
408 | * | 408 | * |
409 | * LAN : 0 | 409 | * LAN : 0 |
410 | * WLAN : 400 | 410 | * WLAN : 400 |
411 | * Bluetooth : 100 | 411 | * Bluetooth : 100 |
412 | * Note: This numbers are just assumptions as an example, not | 412 | * Note: This numbers are just assumptions as an example, not |
413 | * measured or somehow determined | 413 | * measured or somehow determined |
414 | */ | 414 | */ |
415 | // GNUNET_ATS_QUALITY_NET_DROPRATE = 1031, | 415 | // GNUNET_ATS_QUALITY_NET_DROPRATE = 1031, |
416 | /** | 416 | /** |
417 | * Loss rate on network layer | 417 | * Loss rate on network layer |
418 | * Bytes lost during transmission | 418 | * Bytes lost during transmission |
419 | * Reasons can be collisions, ... | 419 | * Reasons can be collisions, ... |
420 | * | 420 | * |
421 | * Unit: [B/s] | 421 | * Unit: [B/s] |
422 | * | 422 | * |
423 | * Examples: | 423 | * Examples: |
424 | * | 424 | * |
425 | * LAN : 0 | 425 | * LAN : 0 |
426 | * WLAN : 40 | 426 | * WLAN : 40 |
427 | * Bluetooth : 10 | 427 | * Bluetooth : 10 |
428 | * Note: This numbers are just assumptions as an example, not measured | 428 | * Note: This numbers are just assumptions as an example, not measured |
429 | * or somehow determined | 429 | * or somehow determined |
430 | */ | 430 | */ |
431 | // GNUNET_ATS_QUALITY_NET_LOSSRATE = 1032, | 431 | // GNUNET_ATS_QUALITY_NET_LOSSRATE = 1032, |
432 | /** | 432 | /** |
433 | * Throughput on network layer | 433 | * Throughput on network layer |
434 | * | 434 | * |
435 | * Unit: [kB/s] | 435 | * Unit: [kB/s] |
436 | * | 436 | * |
437 | * Examples: | 437 | * Examples: |
438 | * | 438 | * |
439 | * LAN : 3400 | 439 | * LAN : 3400 |
440 | * WLAN : 1200 | 440 | * WLAN : 1200 |
441 | * Dialup: 4 | 441 | * Dialup: 4 |
442 | * | 442 | * |
443 | */ | 443 | */ |
444 | // GNUNET_ATS_QUALITY_NET_THROUGHPUT = 1033, | 444 | // GNUNET_ATS_QUALITY_NET_THROUGHPUT = 1033, |
445 | /* Availability related values */ | 445 | /* Availability related values */ |
446 | /* =========================== */ | 446 | /* =========================== */ |
447 | /** | 447 | /** |
448 | * Is a peer reachable? | 448 | * Is a peer reachable? |
449 | */ | 449 | */ |
450 | // GNUNET_ATS_AVAILABILITY_REACHABLE = 2048, | 450 | // GNUNET_ATS_AVAILABILITY_REACHABLE = 2048, |
451 | /** | 451 | /** |
452 | * Is there a connection established to a peer using this transport | 452 | * Is there a connection established to a peer using this transport |
453 | */ | 453 | */ |
454 | // GNUNET_ATS_AVAILABILITY_CONNECTED = 2049 | 454 | // GNUNET_ATS_AVAILABILITY_CONNECTED = 2049 |
455 | }; | 455 | }; |
456 | 456 | ||
457 | /** | 457 | /** |
@@ -469,7 +469,6 @@ enum GNUNET_ATS_Property | |||
469 | */ | 469 | */ |
470 | #define GNUNET_ATS_QualityPropertiesString {"Delay", "Distance"} | 470 | #define GNUNET_ATS_QualityPropertiesString {"Delay", "Distance"} |
471 | 471 | ||
472 | |||
473 | GNUNET_NETWORK_STRUCT_BEGIN | 472 | GNUNET_NETWORK_STRUCT_BEGIN |
474 | 473 | ||
475 | /** | 474 | /** |
@@ -504,7 +503,6 @@ struct GNUNET_ATS_Information | |||
504 | }; | 503 | }; |
505 | GNUNET_NETWORK_STRUCT_END | 504 | GNUNET_NETWORK_STRUCT_END |
506 | 505 | ||
507 | |||
508 | /* ******************************** Scheduling API ***************************** */ | 506 | /* ******************************** Scheduling API ***************************** */ |
509 | 507 | ||
510 | /** | 508 | /** |
@@ -518,15 +516,11 @@ struct GNUNET_ATS_SchedulingHandle; | |||
518 | */ | 516 | */ |
519 | struct GNUNET_ATS_SuggestHandle; | 517 | struct GNUNET_ATS_SuggestHandle; |
520 | 518 | ||
521 | |||
522 | |||
523 | /** | 519 | /** |
524 | * Opaque session handle, defined by plugins. Contents not known to ATS. | 520 | * Opaque session handle, defined by plugins. Contents not known to ATS. |
525 | */ | 521 | */ |
526 | struct Session; | 522 | struct Session; |
527 | 523 | ||
528 | |||
529 | |||
530 | /** | 524 | /** |
531 | * Signature of a function called by ATS with the current bandwidth | 525 | * Signature of a function called by ATS with the current bandwidth |
532 | * and address preferences as determined by ATS. | 526 | * and address preferences as determined by ATS. |
@@ -539,21 +533,12 @@ struct Session; | |||
539 | * @param ats performance data for the address (as far as known) | 533 | * @param ats performance data for the address (as far as known) |
540 | * @param ats_count number of performance records in 'ats' | 534 | * @param ats_count number of performance records in 'ats' |
541 | */ | 535 | */ |
542 | typedef void (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, | 536 | typedef void |
543 | const struct | 537 | (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, |
544 | GNUNET_HELLO_Address * | 538 | const struct GNUNET_HELLO_Address * address, struct Session * session, |
545 | address, | 539 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
546 | struct Session * session, | 540 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
547 | struct | 541 | const struct GNUNET_ATS_Information * ats, uint32_t ats_count); |
548 | GNUNET_BANDWIDTH_Value32NBO | ||
549 | bandwidth_out, | ||
550 | struct | ||
551 | GNUNET_BANDWIDTH_Value32NBO | ||
552 | bandwidth_in, | ||
553 | const struct | ||
554 | GNUNET_ATS_Information * | ||
555 | ats, uint32_t ats_count); | ||
556 | |||
557 | 542 | ||
558 | /** | 543 | /** |
559 | * Initialize the ATS subsystem. | 544 | * Initialize the ATS subsystem. |
@@ -565,9 +550,7 @@ typedef void (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, | |||
565 | */ | 550 | */ |
566 | struct GNUNET_ATS_SchedulingHandle * | 551 | struct GNUNET_ATS_SchedulingHandle * |
567 | GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 552 | GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
568 | GNUNET_ATS_AddressSuggestionCallback suggest_cb, | 553 | GNUNET_ATS_AddressSuggestionCallback suggest_cb, void *suggest_cb_cls); |
569 | void *suggest_cb_cls); | ||
570 | |||
571 | 554 | ||
572 | /** | 555 | /** |
573 | * Client is done with ATS scheduling, release resources. | 556 | * Client is done with ATS scheduling, release resources. |
@@ -577,7 +560,6 @@ GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
577 | void | 560 | void |
578 | GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh); | 561 | GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh); |
579 | 562 | ||
580 | |||
581 | /** | 563 | /** |
582 | * We would like to reset the address suggestion block time for this | 564 | * We would like to reset the address suggestion block time for this |
583 | * peer | 565 | * peer |
@@ -587,7 +569,7 @@ GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh); | |||
587 | */ | 569 | */ |
588 | void | 570 | void |
589 | GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh, | 571 | GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh, |
590 | const struct GNUNET_PeerIdentity *peer); | 572 | const struct GNUNET_PeerIdentity *peer); |
591 | 573 | ||
592 | /** | 574 | /** |
593 | * We would like to establish a new connection with a peer. ATS | 575 | * We would like to establish a new connection with a peer. ATS |
@@ -599,8 +581,7 @@ GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh, | |||
599 | */ | 581 | */ |
600 | struct GNUNET_ATS_SuggestHandle * | 582 | struct GNUNET_ATS_SuggestHandle * |
601 | GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh, | 583 | GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh, |
602 | const struct GNUNET_PeerIdentity *peer); | 584 | const struct GNUNET_PeerIdentity *peer); |
603 | |||
604 | 585 | ||
605 | /** | 586 | /** |
606 | * We want to cancel ATS suggesting addresses for a peer. | 587 | * We want to cancel ATS suggesting addresses for a peer. |
@@ -610,7 +591,7 @@ GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh, | |||
610 | */ | 591 | */ |
611 | void | 592 | void |
612 | GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh, | 593 | GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh, |
613 | const struct GNUNET_PeerIdentity *peer); | 594 | const struct GNUNET_PeerIdentity *peer); |
614 | 595 | ||
615 | /** | 596 | /** |
616 | * Convert a ATS property to a string | 597 | * Convert a ATS property to a string |
@@ -621,7 +602,6 @@ GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh, | |||
621 | const char * | 602 | const char * |
622 | GNUNET_ATS_print_property_type (uint32_t type); | 603 | GNUNET_ATS_print_property_type (uint32_t type); |
623 | 604 | ||
624 | |||
625 | /** | 605 | /** |
626 | * Convert a GNUNET_ATS_NetworkType to a string | 606 | * Convert a GNUNET_ATS_NetworkType to a string |
627 | * | 607 | * |
@@ -640,8 +620,7 @@ GNUNET_ATS_print_network_type (uint32_t net); | |||
640 | */ | 620 | */ |
641 | struct GNUNET_ATS_Information | 621 | struct GNUNET_ATS_Information |
642 | GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh, | 622 | GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh, |
643 | const struct sockaddr * addr, | 623 | const struct sockaddr * addr, socklen_t addrlen); |
644 | socklen_t addrlen); | ||
645 | 624 | ||
646 | /** | 625 | /** |
647 | * Test if a address and a session is known to ATS | 626 | * Test if a address and a session is known to ATS |
@@ -653,8 +632,7 @@ GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh, | |||
653 | */ | 632 | */ |
654 | int | 633 | int |
655 | GNUNET_ATS_session_known (struct GNUNET_ATS_SchedulingHandle *sh, | 634 | GNUNET_ATS_session_known (struct GNUNET_ATS_SchedulingHandle *sh, |
656 | const struct GNUNET_HELLO_Address *address, | 635 | const struct GNUNET_HELLO_Address *address, struct Session *session); |
657 | struct Session *session); | ||
658 | 636 | ||
659 | /** | 637 | /** |
660 | * We have a new address ATS should know. Addresses have to be added with this | 638 | * We have a new address ATS should know. Addresses have to be added with this |
@@ -668,11 +646,8 @@ GNUNET_ATS_session_known (struct GNUNET_ATS_SchedulingHandle *sh, | |||
668 | */ | 646 | */ |
669 | int | 647 | int |
670 | GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh, | 648 | GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh, |
671 | const struct GNUNET_HELLO_Address *address, | 649 | const struct GNUNET_HELLO_Address *address, struct Session *session, |
672 | struct Session *session, | 650 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count); |
673 | const struct GNUNET_ATS_Information *ats, | ||
674 | uint32_t ats_count); | ||
675 | |||
676 | 651 | ||
677 | /** | 652 | /** |
678 | * We have updated performance statistics for a given address. Note | 653 | * We have updated performance statistics for a given address. Note |
@@ -691,11 +666,8 @@ GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh, | |||
691 | */ | 666 | */ |
692 | int | 667 | int |
693 | GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh, | 668 | GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh, |
694 | const struct GNUNET_HELLO_Address *address, | 669 | const struct GNUNET_HELLO_Address *address, struct Session *session, |
695 | struct Session *session, | 670 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count); |
696 | const struct GNUNET_ATS_Information *ats, | ||
697 | uint32_t ats_count); | ||
698 | |||
699 | 671 | ||
700 | /** | 672 | /** |
701 | * An address is now in use or not used any more. | 673 | * An address is now in use or not used any more. |
@@ -708,9 +680,8 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh, | |||
708 | */ | 680 | */ |
709 | void | 681 | void |
710 | GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh, | 682 | GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh, |
711 | const struct GNUNET_HELLO_Address *address, | 683 | const struct GNUNET_HELLO_Address *address, struct Session *session, |
712 | struct Session *session, int in_use); | 684 | int in_use); |
713 | |||
714 | 685 | ||
715 | /** | 686 | /** |
716 | * A session got destroyed, stop including it as a valid address. | 687 | * A session got destroyed, stop including it as a valid address. |
@@ -721,9 +692,7 @@ GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh, | |||
721 | */ | 692 | */ |
722 | void | 693 | void |
723 | GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh, | 694 | GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh, |
724 | const struct GNUNET_HELLO_Address *address, | 695 | const struct GNUNET_HELLO_Address *address, struct Session *session); |
725 | struct Session *session); | ||
726 | |||
727 | 696 | ||
728 | /* ******************************** Performance API ***************************** */ | 697 | /* ******************************** Performance API ***************************** */ |
729 | 698 | ||
@@ -744,20 +713,18 @@ struct GNUNET_ATS_PerformanceHandle; | |||
744 | * @param ats performance data for the address (as far as known) | 713 | * @param ats performance data for the address (as far as known) |
745 | * @param ats_count number of performance records in 'ats' | 714 | * @param ats_count number of performance records in 'ats' |
746 | */ | 715 | */ |
747 | typedef void (*GNUNET_ATS_AddressInformationCallback) (void *cls, | 716 | typedef void |
748 | const struct GNUNET_HELLO_Address *address, | 717 | (*GNUNET_ATS_AddressInformationCallback) (void *cls, |
749 | int address_active, | 718 | const struct GNUNET_HELLO_Address *address, int address_active, |
750 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 719 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
751 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 720 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
752 | const struct GNUNET_ATS_Information *ats, | 721 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count); |
753 | uint32_t ats_count); | ||
754 | 722 | ||
755 | /** | 723 | /** |
756 | * Handle for an address listing operation | 724 | * Handle for an address listing operation |
757 | */ | 725 | */ |
758 | struct GNUNET_ATS_AddressListHandle; | 726 | struct GNUNET_ATS_AddressListHandle; |
759 | 727 | ||
760 | |||
761 | /** | 728 | /** |
762 | * Get handle to access performance API of the ATS subsystem. | 729 | * Get handle to access performance API of the ATS subsystem. |
763 | * | 730 | * |
@@ -769,8 +736,7 @@ struct GNUNET_ATS_AddressListHandle; | |||
769 | */ | 736 | */ |
770 | struct GNUNET_ATS_PerformanceHandle * | 737 | struct GNUNET_ATS_PerformanceHandle * |
771 | GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 738 | GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
772 | GNUNET_ATS_AddressInformationCallback addr_info_cb, | 739 | GNUNET_ATS_AddressInformationCallback addr_info_cb, void *addr_info_cb_cls); |
773 | void *addr_info_cb_cls); | ||
774 | 740 | ||
775 | /** | 741 | /** |
776 | * Get information about addresses known to the ATS subsystem. | 742 | * Get information about addresses known to the ATS subsystem. |
@@ -785,12 +751,10 @@ GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
785 | * @return ats performance context | 751 | * @return ats performance context |
786 | */ | 752 | */ |
787 | struct GNUNET_ATS_AddressListHandle * | 753 | struct GNUNET_ATS_AddressListHandle * |
788 | GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *handle, | 754 | GNUNET_ATS_performance_list_addresses ( |
789 | const struct GNUNET_PeerIdentity *peer, | 755 | struct GNUNET_ATS_PerformanceHandle *handle, |
790 | int all, | 756 | const struct GNUNET_PeerIdentity *peer, int all, |
791 | GNUNET_ATS_AddressInformationCallback infocb, | 757 | GNUNET_ATS_AddressInformationCallback infocb, void *infocb_cls); |
792 | void *infocb_cls); | ||
793 | |||
794 | 758 | ||
795 | /** | 759 | /** |
796 | * Cancel a pending address listing operation | 760 | * Cancel a pending address listing operation |
@@ -798,8 +762,8 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *hand | |||
798 | * @param handle the GNUNET_ATS_AddressListHandle handle to cancel | 762 | * @param handle the GNUNET_ATS_AddressListHandle handle to cancel |
799 | */ | 763 | */ |
800 | void | 764 | void |
801 | GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressListHandle *handle); | 765 | GNUNET_ATS_performance_list_addresses_cancel ( |
802 | 766 | struct GNUNET_ATS_AddressListHandle *handle); | |
803 | 767 | ||
804 | /** | 768 | /** |
805 | * Client is done using the ATS performance subsystem, release resources. | 769 | * Client is done using the ATS performance subsystem, release resources. |
@@ -809,7 +773,6 @@ GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressListHandl | |||
809 | void | 773 | void |
810 | GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph); | 774 | GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph); |
811 | 775 | ||
812 | |||
813 | /** | 776 | /** |
814 | * Function called with reservation result. | 777 | * Function called with reservation result. |
815 | * | 778 | * |
@@ -820,20 +783,16 @@ GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph); | |||
820 | * @param res_delay if the reservation could not be satisfied (amount was 0), how | 783 | * @param res_delay if the reservation could not be satisfied (amount was 0), how |
821 | * long should the client wait until re-trying? | 784 | * long should the client wait until re-trying? |
822 | */ | 785 | */ |
823 | typedef void (*GNUNET_ATS_ReservationCallback) (void *cls, | 786 | typedef void |
824 | const struct GNUNET_PeerIdentity | 787 | (*GNUNET_ATS_ReservationCallback) (void *cls, |
825 | * peer, int32_t amount, | 788 | const struct GNUNET_PeerIdentity * peer, int32_t amount, |
826 | struct GNUNET_TIME_Relative | 789 | struct GNUNET_TIME_Relative res_delay); |
827 | res_delay); | ||
828 | |||
829 | |||
830 | 790 | ||
831 | /** | 791 | /** |
832 | * Context that can be used to cancel a peer information request. | 792 | * Context that can be used to cancel a peer information request. |
833 | */ | 793 | */ |
834 | struct GNUNET_ATS_ReservationContext; | 794 | struct GNUNET_ATS_ReservationContext; |
835 | 795 | ||
836 | |||
837 | /** | 796 | /** |
838 | * Reserve inbound bandwidth from the given peer. ATS will look at | 797 | * Reserve inbound bandwidth from the given peer. ATS will look at |
839 | * the current amount of traffic we receive from the peer and ensure | 798 | * the current amount of traffic we receive from the peer and ensure |
@@ -850,11 +809,8 @@ struct GNUNET_ATS_ReservationContext; | |||
850 | */ | 809 | */ |
851 | struct GNUNET_ATS_ReservationContext * | 810 | struct GNUNET_ATS_ReservationContext * |
852 | GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph, | 811 | GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph, |
853 | const struct GNUNET_PeerIdentity *peer, | 812 | const struct GNUNET_PeerIdentity *peer, int32_t amount, |
854 | int32_t amount, | 813 | GNUNET_ATS_ReservationCallback rcb, void *rcb_cls); |
855 | GNUNET_ATS_ReservationCallback rcb, | ||
856 | void *rcb_cls); | ||
857 | |||
858 | 814 | ||
859 | /** | 815 | /** |
860 | * Cancel request for reserving bandwidth. | 816 | * Cancel request for reserving bandwidth. |
@@ -864,7 +820,6 @@ GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph, | |||
864 | void | 820 | void |
865 | GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc); | 821 | GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc); |
866 | 822 | ||
867 | |||
868 | /** | 823 | /** |
869 | * Number of preference types supported by ATS | 824 | * Number of preference types supported by ATS |
870 | */ | 825 | */ |
@@ -880,7 +835,6 @@ GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc); | |||
880 | */ | 835 | */ |
881 | #define GNUNET_ATS_PreferenceTypeString {"END", "BANDWIDTH", "LATENCY"} | 836 | #define GNUNET_ATS_PreferenceTypeString {"END", "BANDWIDTH", "LATENCY"} |
882 | 837 | ||
883 | |||
884 | /** | 838 | /** |
885 | * Enum defining all known preference categories. | 839 | * Enum defining all known preference categories. |
886 | */ | 840 | */ |
@@ -928,13 +882,21 @@ GNUNET_ATS_print_preference_type (uint32_t type); | |||
928 | * @param ... 0-terminated specification of the desired changes | 882 | * @param ... 0-terminated specification of the desired changes |
929 | */ | 883 | */ |
930 | void | 884 | void |
931 | GNUNET_ATS_performance_change_preference (struct GNUNET_ATS_PerformanceHandle *ph, | 885 | GNUNET_ATS_performance_change_preference ( |
932 | const struct GNUNET_PeerIdentity *peer, ...); | 886 | struct GNUNET_ATS_PerformanceHandle *ph, |
933 | 887 | const struct GNUNET_PeerIdentity *peer, ...); | |
934 | 888 | ||
935 | /** | 889 | /** |
936 | * Send feedback to ATS on how good a the requirements for a peer and a | 890 | * Application feedback on how good preference requirements are fulfilled |
937 | * preference is satisfied by ATS | 891 | * for the preferences included in the given time scope [now - scope .. now] |
892 | * | ||
893 | * An application notifies ATS if (and only if) it has feedback information | ||
894 | * for specific properties. This values are valid until the feedback scores are | ||
895 | * updated by the application. | ||
896 | * | ||
897 | * If the application has no feedback for this preference kind the application | ||
898 | * will not explicitly call for this property and will not include it in this | ||
899 | * function call. | ||
938 | * | 900 | * |
939 | * @param ph performance handle | 901 | * @param ph performance handle |
940 | * @param scope the time interval this valid for: [now - scope .. now] | 902 | * @param scope the time interval this valid for: [now - scope .. now] |
@@ -943,8 +905,8 @@ GNUNET_ATS_performance_change_preference (struct GNUNET_ATS_PerformanceHandle *p | |||
943 | */ | 905 | */ |
944 | void | 906 | void |
945 | GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph, | 907 | GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph, |
946 | const struct GNUNET_PeerIdentity *peer, | 908 | const struct GNUNET_PeerIdentity *peer, |
947 | const struct GNUNET_TIME_Relative scope, ...); | 909 | const struct GNUNET_TIME_Relative scope, ...); |
948 | 910 | ||
949 | #endif | 911 | #endif |
950 | /* end of file gnunet-service-transport_ats.h */ | 912 | /* end of file gnunet-service-transport_ats.h */ |