aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_ats_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_ats_service.h')
-rw-r--r--src/include/gnunet_ats_service.h137
1 files changed, 77 insertions, 60 deletions
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h
index a226c7b55..cd1e62bee 100644
--- a/src/include/gnunet_ats_service.h
+++ b/src/include/gnunet_ats_service.h
@@ -68,7 +68,8 @@
68/** 68/**
69 * ATS performance characteristics for an address. 69 * ATS performance characteristics for an address.
70 */ 70 */
71struct GNUNET_ATS_Properties { 71struct GNUNET_ATS_Properties
72{
72 /** 73 /**
73 * Delay. Time between when the time packet is sent and the packet 74 * Delay. Time between when the time packet is sent and the packet
74 * arrives. FOREVER if we did not measure yet. 75 * arrives. FOREVER if we did not measure yet.
@@ -109,7 +110,8 @@ struct GNUNET_ATS_Properties {
109 * ATS performance characteristics for an address in 110 * ATS performance characteristics for an address in
110 * network byte order (for IPC). 111 * network byte order (for IPC).
111 */ 112 */
112struct GNUNET_ATS_PropertiesNBO { 113struct GNUNET_ATS_PropertiesNBO
114{
113 /** 115 /**
114 * Actual traffic on this connection from this peer to the other peer. 116 * Actual traffic on this connection from this peer to the other peer.
115 * Includes transport overhead. 117 * Includes transport overhead.
@@ -158,8 +160,8 @@ struct GNUNET_ATS_PropertiesNBO {
158 * @param hbo value read 160 * @param hbo value read
159 */ 161 */
160void 162void
161GNUNET_ATS_properties_hton(struct GNUNET_ATS_PropertiesNBO *nbo, 163GNUNET_ATS_properties_hton (struct GNUNET_ATS_PropertiesNBO *nbo,
162 const struct GNUNET_ATS_Properties *hbo); 164 const struct GNUNET_ATS_Properties *hbo);
163 165
164 166
165/** 167/**
@@ -169,8 +171,8 @@ GNUNET_ATS_properties_hton(struct GNUNET_ATS_PropertiesNBO *nbo,
169 * @param nbo value read 171 * @param nbo value read
170 */ 172 */
171void 173void
172GNUNET_ATS_properties_ntoh(struct GNUNET_ATS_Properties *hbo, 174GNUNET_ATS_properties_ntoh (struct GNUNET_ATS_Properties *hbo,
173 const struct GNUNET_ATS_PropertiesNBO *nbo); 175 const struct GNUNET_ATS_PropertiesNBO *nbo);
174 176
175 177
176 178
@@ -195,7 +197,7 @@ struct GNUNET_ATS_ConnectivitySuggestHandle;
195 * @return ats connectivity handle, NULL on error 197 * @return ats connectivity handle, NULL on error
196 */ 198 */
197struct GNUNET_ATS_ConnectivityHandle * 199struct GNUNET_ATS_ConnectivityHandle *
198GNUNET_ATS_connectivity_init(const struct GNUNET_CONFIGURATION_Handle *cfg); 200GNUNET_ATS_connectivity_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
199 201
200 202
201/** 203/**
@@ -204,7 +206,7 @@ GNUNET_ATS_connectivity_init(const struct GNUNET_CONFIGURATION_Handle *cfg);
204 * @param ch handle to destroy 206 * @param ch handle to destroy
205 */ 207 */
206void 208void
207GNUNET_ATS_connectivity_done(struct GNUNET_ATS_ConnectivityHandle *ch); 209GNUNET_ATS_connectivity_done (struct GNUNET_ATS_ConnectivityHandle *ch);
208 210
209 211
210/** 212/**
@@ -217,9 +219,9 @@ GNUNET_ATS_connectivity_done(struct GNUNET_ATS_ConnectivityHandle *ch);
217 * @return suggestion handle, NULL if request is already pending 219 * @return suggestion handle, NULL if request is already pending
218 */ 220 */
219struct GNUNET_ATS_ConnectivitySuggestHandle * 221struct GNUNET_ATS_ConnectivitySuggestHandle *
220GNUNET_ATS_connectivity_suggest(struct GNUNET_ATS_ConnectivityHandle *ch, 222GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch,
221 const struct GNUNET_PeerIdentity *peer, 223 const struct GNUNET_PeerIdentity *peer,
222 uint32_t strength); 224 uint32_t strength);
223 225
224 226
225/** 227/**
@@ -228,7 +230,8 @@ GNUNET_ATS_connectivity_suggest(struct GNUNET_ATS_ConnectivityHandle *ch,
228 * @param sh handle 230 * @param sh handle
229 */ 231 */
230void 232void
231GNUNET_ATS_connectivity_suggest_cancel(struct GNUNET_ATS_ConnectivitySuggestHandle *sh); 233GNUNET_ATS_connectivity_suggest_cancel (struct
234 GNUNET_ATS_ConnectivitySuggestHandle *sh);
232 235
233 236
234/* ******************************** Scheduling API ***************************** */ 237/* ******************************** Scheduling API ***************************** */
@@ -263,10 +266,13 @@ struct GNUNET_ATS_Session;
263typedef void 266typedef void
264(*GNUNET_ATS_AddressSuggestionCallback) (void *cls, 267(*GNUNET_ATS_AddressSuggestionCallback) (void *cls,
265 const struct GNUNET_PeerIdentity *peer, 268 const struct GNUNET_PeerIdentity *peer,
266 const struct GNUNET_HELLO_Address *address, 269 const struct
270 GNUNET_HELLO_Address *address,
267 struct GNUNET_ATS_Session *session, 271 struct GNUNET_ATS_Session *session,
268 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 272 struct GNUNET_BANDWIDTH_Value32NBO
269 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in); 273 bandwidth_out,
274 struct GNUNET_BANDWIDTH_Value32NBO
275 bandwidth_in);
270 276
271 277
272/** 278/**
@@ -278,9 +284,9 @@ typedef void
278 * @return ats context 284 * @return ats context
279 */ 285 */
280struct GNUNET_ATS_SchedulingHandle * 286struct GNUNET_ATS_SchedulingHandle *
281GNUNET_ATS_scheduling_init(const struct GNUNET_CONFIGURATION_Handle *cfg, 287GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
282 GNUNET_ATS_AddressSuggestionCallback suggest_cb, 288 GNUNET_ATS_AddressSuggestionCallback suggest_cb,
283 void *suggest_cb_cls); 289 void *suggest_cb_cls);
284 290
285 291
286/** 292/**
@@ -289,7 +295,7 @@ GNUNET_ATS_scheduling_init(const struct GNUNET_CONFIGURATION_Handle *cfg,
289 * @param sh handle to release 295 * @param sh handle to release
290 */ 296 */
291void 297void
292GNUNET_ATS_scheduling_done(struct GNUNET_ATS_SchedulingHandle *sh); 298GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh);
293 299
294 300
295/** 301/**
@@ -311,10 +317,10 @@ struct GNUNET_ATS_AddressRecord;
311 * address is invalid) 317 * address is invalid)
312 */ 318 */
313struct GNUNET_ATS_AddressRecord * 319struct GNUNET_ATS_AddressRecord *
314GNUNET_ATS_address_add(struct GNUNET_ATS_SchedulingHandle *sh, 320GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
315 const struct GNUNET_HELLO_Address *address, 321 const struct GNUNET_HELLO_Address *address,
316 struct GNUNET_ATS_Session *session, 322 struct GNUNET_ATS_Session *session,
317 const struct GNUNET_ATS_Properties *prop); 323 const struct GNUNET_ATS_Properties *prop);
318 324
319 325
320/** 326/**
@@ -324,8 +330,8 @@ GNUNET_ATS_address_add(struct GNUNET_ATS_SchedulingHandle *sh,
324 * @param session session handle 330 * @param session session handle
325 */ 331 */
326void 332void
327GNUNET_ATS_address_add_session(struct GNUNET_ATS_AddressRecord *ar, 333GNUNET_ATS_address_add_session (struct GNUNET_ATS_AddressRecord *ar,
328 struct GNUNET_ATS_Session *session); 334 struct GNUNET_ATS_Session *session);
329 335
330 336
331/** 337/**
@@ -341,8 +347,8 @@ GNUNET_ATS_address_add_session(struct GNUNET_ATS_AddressRecord *ar,
341 * use it still to establish a new session 347 * use it still to establish a new session
342 */ 348 */
343int 349int
344GNUNET_ATS_address_del_session(struct GNUNET_ATS_AddressRecord *ar, 350GNUNET_ATS_address_del_session (struct GNUNET_ATS_AddressRecord *ar,
345 struct GNUNET_ATS_Session *session); 351 struct GNUNET_ATS_Session *session);
346 352
347 353
348/** 354/**
@@ -359,8 +365,8 @@ GNUNET_ATS_address_del_session(struct GNUNET_ATS_AddressRecord *ar,
359 * @param prop performance data for the address 365 * @param prop performance data for the address
360 */ 366 */
361void 367void
362GNUNET_ATS_address_update(struct GNUNET_ATS_AddressRecord *ar, 368GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar,
363 const struct GNUNET_ATS_Properties *prop); 369 const struct GNUNET_ATS_Properties *prop);
364 370
365 371
366/** 372/**
@@ -370,7 +376,7 @@ GNUNET_ATS_address_update(struct GNUNET_ATS_AddressRecord *ar,
370 * expired and ATS may no longer use it 376 * expired and ATS may no longer use it
371 */ 377 */
372void 378void
373GNUNET_ATS_address_destroy(struct GNUNET_ATS_AddressRecord *ar); 379GNUNET_ATS_address_destroy (struct GNUNET_ATS_AddressRecord *ar);
374 380
375 381
376 382
@@ -398,11 +404,15 @@ struct GNUNET_ATS_PerformanceHandle;
398 */ 404 */
399typedef void 405typedef void
400(*GNUNET_ATS_AddressInformationCallback) (void *cls, 406(*GNUNET_ATS_AddressInformationCallback) (void *cls,
401 const struct GNUNET_HELLO_Address *address, 407 const struct
408 GNUNET_HELLO_Address *address,
402 int address_active, 409 int address_active,
403 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 410 struct GNUNET_BANDWIDTH_Value32NBO
404 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 411 bandwidth_out,
405 const struct GNUNET_ATS_Properties *prop); 412 struct GNUNET_BANDWIDTH_Value32NBO
413 bandwidth_in,
414 const struct
415 GNUNET_ATS_Properties *prop);
406 416
407 417
408/** 418/**
@@ -421,9 +431,9 @@ struct GNUNET_ATS_AddressListHandle;
421 * @return ats performance context 431 * @return ats performance context
422 */ 432 */
423struct GNUNET_ATS_PerformanceHandle * 433struct GNUNET_ATS_PerformanceHandle *
424GNUNET_ATS_performance_init(const struct GNUNET_CONFIGURATION_Handle *cfg, 434GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
425 GNUNET_ATS_AddressInformationCallback addr_info_cb, 435 GNUNET_ATS_AddressInformationCallback addr_info_cb,
426 void *addr_info_cb_cls); 436 void *addr_info_cb_cls);
427 437
428 438
429/** 439/**
@@ -439,11 +449,12 @@ GNUNET_ATS_performance_init(const struct GNUNET_CONFIGURATION_Handle *cfg,
439 * @return handle to abort the operation 449 * @return handle to abort the operation
440 */ 450 */
441struct GNUNET_ATS_AddressListHandle * 451struct GNUNET_ATS_AddressListHandle *
442GNUNET_ATS_performance_list_addresses(struct GNUNET_ATS_PerformanceHandle *ph, 452GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *ph,
443 const struct GNUNET_PeerIdentity *peer, 453 const struct GNUNET_PeerIdentity *peer,
444 int all, 454 int all,
445 GNUNET_ATS_AddressInformationCallback infocb, 455 GNUNET_ATS_AddressInformationCallback
446 void *infocb_cls); 456 infocb,
457 void *infocb_cls);
447 458
448 459
449/** 460/**
@@ -452,7 +463,8 @@ GNUNET_ATS_performance_list_addresses(struct GNUNET_ATS_PerformanceHandle *ph,
452 * @param alh the `struct GNUNET_ATS_AddressListHandle` handle to cancel 463 * @param alh the `struct GNUNET_ATS_AddressListHandle` handle to cancel
453 */ 464 */
454void 465void
455GNUNET_ATS_performance_list_addresses_cancel(struct GNUNET_ATS_AddressListHandle *alh); 466GNUNET_ATS_performance_list_addresses_cancel (struct
467 GNUNET_ATS_AddressListHandle *alh);
456 468
457 469
458/** 470/**
@@ -461,7 +473,7 @@ GNUNET_ATS_performance_list_addresses_cancel(struct GNUNET_ATS_AddressListHandle
461 * @param ph handle 473 * @param ph handle
462 */ 474 */
463void 475void
464GNUNET_ATS_performance_done(struct GNUNET_ATS_PerformanceHandle *ph); 476GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph);
465 477
466 478
467/** 479/**
@@ -502,11 +514,11 @@ struct GNUNET_ATS_ReservationContext;
502 * @deprecated will be replaced soon 514 * @deprecated will be replaced soon
503 */ 515 */
504struct GNUNET_ATS_ReservationContext * 516struct GNUNET_ATS_ReservationContext *
505GNUNET_ATS_reserve_bandwidth(struct GNUNET_ATS_PerformanceHandle *ph, 517GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph,
506 const struct GNUNET_PeerIdentity *peer, 518 const struct GNUNET_PeerIdentity *peer,
507 int32_t amount, 519 int32_t amount,
508 GNUNET_ATS_ReservationCallback rcb, 520 GNUNET_ATS_ReservationCallback rcb,
509 void *rcb_cls); 521 void *rcb_cls);
510 522
511 523
512/** 524/**
@@ -515,13 +527,15 @@ GNUNET_ATS_reserve_bandwidth(struct GNUNET_ATS_PerformanceHandle *ph,
515 * @param rc context returned by the original GNUNET_ATS_reserve_bandwidth call 527 * @param rc context returned by the original GNUNET_ATS_reserve_bandwidth call
516 */ 528 */
517void 529void
518GNUNET_ATS_reserve_bandwidth_cancel(struct GNUNET_ATS_ReservationContext *rc); 530GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc);
519 531
520 532
521/** 533/**
522 * ATS preference types as array initializer 534 * ATS preference types as array initializer
523 */ 535 */
524#define GNUNET_ATS_PreferenceType { GNUNET_ATS_PREFERENCE_BANDWIDTH, GNUNET_ATS_PREFERENCE_LATENCY, GNUNET_ATS_PREFERENCE_END } 536#define GNUNET_ATS_PreferenceType { GNUNET_ATS_PREFERENCE_BANDWIDTH, \
537 GNUNET_ATS_PREFERENCE_LATENCY, \
538 GNUNET_ATS_PREFERENCE_END }
525 539
526/** 540/**
527 * ATS preference types as string array initializer 541 * ATS preference types as string array initializer
@@ -531,7 +545,8 @@ GNUNET_ATS_reserve_bandwidth_cancel(struct GNUNET_ATS_ReservationContext *rc);
531/** 545/**
532 * Enum defining all known preference categories. 546 * Enum defining all known preference categories.
533 */ 547 */
534enum GNUNET_ATS_PreferenceKind { 548enum GNUNET_ATS_PreferenceKind
549{
535 /** 550 /**
536 * Change the peer's bandwidth value (value per byte of bandwidth in 551 * Change the peer's bandwidth value (value per byte of bandwidth in
537 * the goal function) to the given amount. The argument is followed 552 * the goal function) to the given amount. The argument is followed
@@ -563,7 +578,7 @@ enum GNUNET_ATS_PreferenceKind {
563 * @return a string or NULL if invalid 578 * @return a string or NULL if invalid
564 */ 579 */
565const char * 580const char *
566GNUNET_ATS_print_preference_type(enum GNUNET_ATS_PreferenceKind type); 581GNUNET_ATS_print_preference_type (enum GNUNET_ATS_PreferenceKind type);
567 582
568 583
569/** 584/**
@@ -575,9 +590,11 @@ GNUNET_ATS_print_preference_type(enum GNUNET_ATS_PreferenceKind type);
575 * desired changes 590 * desired changes
576 */ 591 */
577void 592void
578GNUNET_ATS_performance_change_preference(struct GNUNET_ATS_PerformanceHandle *ph, 593GNUNET_ATS_performance_change_preference (struct
579 const struct GNUNET_PeerIdentity *peer, 594 GNUNET_ATS_PerformanceHandle *ph,
580 ...); 595 const struct
596 GNUNET_PeerIdentity *peer,
597 ...);
581 598
582 599
583/** 600/**
@@ -598,10 +615,10 @@ GNUNET_ATS_performance_change_preference(struct GNUNET_ATS_PerformanceHandle *ph
598 * @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the desired changes 615 * @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the desired changes
599 */ 616 */
600void 617void
601GNUNET_ATS_performance_give_feedback(struct GNUNET_ATS_PerformanceHandle *ph, 618GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph,
602 const struct GNUNET_PeerIdentity *peer, 619 const struct GNUNET_PeerIdentity *peer,
603 const struct GNUNET_TIME_Relative scope, 620 const struct GNUNET_TIME_Relative scope,
604 ...); 621 ...);
605 622
606#endif 623#endif
607 624