aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-01-26 20:49:59 +0100
committerChristian Grothoff <christian@grothoff.org>2019-01-26 20:49:59 +0100
commit7fc78674a6d3f2edb41e32cea59200908d0b344b (patch)
treeb99608184fa08dcc6cd3e297369cb2761a03524f /src/include
parenta5a54c51011a9498e72b2a9341b35333c6beef1a (diff)
downloadgnunet-7fc78674a6d3f2edb41e32cea59200908d0b344b.tar.gz
gnunet-7fc78674a6d3f2edb41e32cea59200908d0b344b.zip
starting with #5385 in earnest
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_cadet_service.h254
1 files changed, 134 insertions, 120 deletions
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h
index 00bef48f1..fb4499db0 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -310,17 +310,6 @@ void
310GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel); 310GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel);
311 311
312 312
313/******************************************************************************/
314/******************** MONITORING /DEBUG API *************************/
315/******************************************************************************/
316/* The following calls are not useful for normal CADET operation, but for */
317/* debug and monitoring of the cadet state. They can be safely ignored. */
318/* The API can change at any point without notice. */
319/* Please contact the developer if you consider any of this calls useful for */
320/* normal cadet applications. */
321/******************************************************************************/
322
323
324/** 313/**
325 * Transitional function to convert an unsigned int port to a hash value. 314 * Transitional function to convert an unsigned int port to a hash value.
326 * WARNING: local static value returned, NOT reentrant! 315 * WARNING: local static value returned, NOT reentrant!
@@ -367,6 +356,17 @@ GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel,
367 ...); 356 ...);
368 357
369 358
359/******************************************************************************/
360/******************** MONITORING /DEBUG API *************************/
361/******************************************************************************/
362/* The following calls are not useful for normal CADET operation, but for */
363/* debug and monitoring of the cadet state. They can be safely ignored. */
364/* The API can change at any point without notice. */
365/* Please contact the developer if you consider any of this calls useful for */
366/* normal cadet applications. */
367/******************************************************************************/
368
369
370/** 370/**
371 * Method called to retrieve information about a specific channel the cadet peer 371 * Method called to retrieve information about a specific channel the cadet peer
372 * is aware of, including all transit nodes. 372 * is aware of, including all transit nodes.
@@ -388,6 +388,33 @@ typedef void
388 uint32_t /* ugh */ dest_channel_number, 388 uint32_t /* ugh */ dest_channel_number,
389 uint32_t /* ugh */ public_channel_number); 389 uint32_t /* ugh */ public_channel_number);
390 390
391
392struct GNUNET_CADET_ChannelMonitor;
393
394
395/**
396 * Request information about a specific channel of the running cadet peer.
397 *
398 * WARNING: unstable API, likely to change in the future!
399 *
400 * @param h Handle to the cadet peer.
401 * @param peer ID of the other end of the channel.
402 * @param channel_number Channel number.
403 * @param callback Function to call with the requested data.
404 * @param callback_cls Closure for @c callback.
405 */
406struct GNUNET_CADET_ChannelMonitor *
407GNUNET_CADET_get_channel (const struct GNUNET_CONFIGURATION_Handle *cfg,
408 struct GNUNET_PeerIdentity *peer,
409 uint32_t /* UGH */ channel_number,
410 GNUNET_CADET_ChannelCB callback,
411 void *callback_cls);
412
413
414void *
415GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm);
416
417
391/** 418/**
392 * Method called to retrieve information about all peers in CADET, called 419 * Method called to retrieve information about all peers in CADET, called
393 * once per peer. 420 * once per peer.
@@ -408,6 +435,40 @@ typedef void
408 unsigned int n_paths, 435 unsigned int n_paths,
409 unsigned int best_path); 436 unsigned int best_path);
410 437
438
439struct GNUNET_CADET_PeersLister;
440
441
442/**
443 * Request information about peers known to the running cadet service.
444 * The callback will be called for every peer known to the service.
445 * Only one info request (of any kind) can be active at once.
446 *
447 * WARNING: unstable API, likely to change in the future!
448 *
449 * @param h Handle to the cadet peer.
450 * @param callback Function to call with the requested data.
451 * @param callback_cls Closure for @c callback.
452 *
453 * @return #GNUNET_OK / #GNUNET_SYSERR
454 */
455struct GNUNET_CADET_PeersLister *
456GNUNET_CADET_list_peers (const struct GNUNET_CONFIGURATION_Handle *cfg,
457 GNUNET_CADET_PeersCB callback,
458 void *callback_cls);
459
460
461/**
462 * Cancel a peer info request. The callback will not be called (anymore).
463 *
464 * @param h Cadet handle.
465 * @return Closure that was given to #GNUNET_CADET_list_peers().
466 */
467void *
468GNUNET_CADET_list_peers_cancel (struct GNUNET_CADET_PeersLister *pl);
469
470
471
411/** 472/**
412 * Method called to retrieve information about a specific peer 473 * Method called to retrieve information about a specific peer
413 * known to the service. 474 * known to the service.
@@ -432,6 +493,33 @@ typedef void
432 int finished_with_paths); 493 int finished_with_paths);
433 494
434 495
496struct GNUNET_CADET_GetPeer;
497
498/**
499 * Request information about a peer known to the running cadet peer.
500 * The callback will be called for the tunnel once.
501 * Only one info request (of any kind) can be active at once.
502 *
503 * WARNING: unstable API, likely to change in the future!
504 *
505 * @param h Handle to the cadet peer.
506 * @param id Peer whose tunnel to examine.
507 * @param callback Function to call with the requested data.
508 * @param callback_cls Closure for @c callback.
509 *
510 * @return #GNUNET_OK / #GNUNET_SYSERR
511 */
512struct GNUNET_CADET_GetPeer *
513GNUNET_CADET_get_peer (const struct GNUNET_CONFIGURATION_Handle *cfg,
514 const struct GNUNET_PeerIdentity *id,
515 GNUNET_CADET_PeerCB callback,
516 void *callback_cls);
517
518
519void *
520GNUNET_CADET_get_peer_cancel (struct GNUNET_CADET_GetPeer *gp);
521
522
435/** 523/**
436 * Method called to retrieve information about all tunnels in CADET, called 524 * Method called to retrieve information about all tunnels in CADET, called
437 * once per tunnel. 525 * once per tunnel.
@@ -454,66 +542,14 @@ typedef void
454 uint16_t cstate); 542 uint16_t cstate);
455 543
456 544
457/** 545struct GNUNET_CADET_ListTunnels;
458 * Method called to retrieve information about a specific tunnel the cadet peer
459 * has established, o`r is trying to establish.
460 *
461 * @param cls Closure.
462 * @param peer Peer towards whom the tunnel is directed.
463 * @param n_channels Number of channels.
464 * @param n_connections Number of connections.
465 * @param channels Channels.
466 * @param connections Connections.
467 * @param estate Encryption state.
468 * @param cstate Connectivity state.
469 */
470typedef void
471(*GNUNET_CADET_TunnelCB) (void *cls,
472 const struct GNUNET_PeerIdentity *peer,
473 unsigned int n_channels,
474 unsigned int n_connections,
475 const struct GNUNET_CADET_ChannelTunnelNumber *channels,
476 const struct GNUNET_CADET_ConnectionTunnelIdentifier *connections,
477 unsigned int estate,
478 unsigned int cstate);
479 546
480 547
481/** 548/**
482 * Request information about a specific channel of the running cadet peer. 549 * Request information about tunnels of the running cadet peer.
483 * 550 * The callback will be called for every tunnel of the service.
484 * WARNING: unstable API, likely to change in the future!
485 *
486 * @param h Handle to the cadet peer.
487 * @param peer ID of the other end of the channel.
488 * @param channel_number Channel number.
489 * @param callback Function to call with the requested data.
490 * @param callback_cls Closure for @c callback.
491 */
492void
493GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h,
494 struct GNUNET_PeerIdentity *peer,
495 uint32_t /* UGH */ channel_number,
496 GNUNET_CADET_ChannelCB callback,
497 void *callback_cls);
498
499
500/**
501 * Request a debug dump on the service's STDERR.
502 *
503 * WARNING: unstable API, likely to change in the future!
504 *
505 * @param h cadet handle
506 */
507void
508GNUNET_CADET_request_dump (struct GNUNET_CADET_Handle *h);
509
510
511/**
512 * Request information about peers known to the running cadet service.
513 * The callback will be called for every peer known to the service.
514 * Only one info request (of any kind) can be active at once. 551 * Only one info request (of any kind) can be active at once.
515 * 552 *
516 *
517 * WARNING: unstable API, likely to change in the future! 553 * WARNING: unstable API, likely to change in the future!
518 * 554 *
519 * @param h Handle to the cadet peer. 555 * @param h Handle to the cadet peer.
@@ -522,74 +558,49 @@ GNUNET_CADET_request_dump (struct GNUNET_CADET_Handle *h);
522 * 558 *
523 * @return #GNUNET_OK / #GNUNET_SYSERR 559 * @return #GNUNET_OK / #GNUNET_SYSERR
524 */ 560 */
525int 561struct GNUNET_CADET_ListTunnels *
526GNUNET_CADET_get_peers (struct GNUNET_CADET_Handle *h, 562GNUNET_CADET_list_tunnels (const struct GNUNET_CONFIGURATION_Handle *cfg,
527 GNUNET_CADET_PeersCB callback, 563 GNUNET_CADET_TunnelsCB callback,
528 void *callback_cls); 564 void *callback_cls);
529 565
530 566
531/** 567/**
532 * Cancel a peer info request. The callback will not be called (anymore). 568 * Cancel a monitor request. The monitor callback will not be called.
533 *
534 * WARNING: unstable API, likely to change in the future!
535 * 569 *
536 * @param h Cadet handle. 570 * @param h Cadet handle.
537 * 571 *
538 * @return Closure that was given to #GNUNET_CADET_get_peers(). 572 * @return Closure given to #GNUNET_CADET_list_tunnels(), if any.
539 */ 573 */
540void * 574void *
541GNUNET_CADET_get_peers_cancel (struct GNUNET_CADET_Handle *h); 575GNUNET_CADET_list_tunnels_cancel (struct GNUNET_CADET_ListTunnels *lt);
542 576
543 577
544/**
545 * Request information about a peer known to the running cadet peer.
546 * The callback will be called for the tunnel once.
547 * Only one info request (of any kind) can be active at once.
548 *
549 * WARNING: unstable API, likely to change in the future!
550 *
551 * @param h Handle to the cadet peer.
552 * @param id Peer whose tunnel to examine.
553 * @param callback Function to call with the requested data.
554 * @param callback_cls Closure for @c callback.
555 *
556 * @return #GNUNET_OK / #GNUNET_SYSERR
557 */
558int
559GNUNET_CADET_get_peer (struct GNUNET_CADET_Handle *h,
560 const struct GNUNET_PeerIdentity *id,
561 GNUNET_CADET_PeerCB callback,
562 void *callback_cls);
563
564 578
565/** 579/**
566 * Request information about tunnels of the running cadet peer. 580 * Method called to retrieve information about a specific tunnel the cadet peer
567 * The callback will be called for every tunnel of the service. 581 * has established, o`r is trying to establish.
568 * Only one info request (of any kind) can be active at once.
569 *
570 * WARNING: unstable API, likely to change in the future!
571 *
572 * @param h Handle to the cadet peer.
573 * @param callback Function to call with the requested data.
574 * @param callback_cls Closure for @c callback.
575 * 582 *
576 * @return #GNUNET_OK / #GNUNET_SYSERR 583 * @param cls Closure.
584 * @param peer Peer towards whom the tunnel is directed.
585 * @param n_channels Number of channels.
586 * @param n_connections Number of connections.
587 * @param channels Channels.
588 * @param connections Connections.
589 * @param estate Encryption state.
590 * @param cstate Connectivity state.
577 */ 591 */
578int 592typedef void
579GNUNET_CADET_get_tunnels (struct GNUNET_CADET_Handle *h, 593(*GNUNET_CADET_TunnelCB) (void *cls,
580 GNUNET_CADET_TunnelsCB callback, 594 const struct GNUNET_PeerIdentity *peer,
581 void *callback_cls); 595 unsigned int n_channels,
596 unsigned int n_connections,
597 const struct GNUNET_CADET_ChannelTunnelNumber *channels,
598 const struct GNUNET_CADET_ConnectionTunnelIdentifier *connections,
599 unsigned int estate,
600 unsigned int cstate);
582 601
583 602
584/** 603struct GNUNET_CADET_GetTunnel;
585 * Cancel a monitor request. The monitor callback will not be called.
586 *
587 * @param h Cadet handle.
588 *
589 * @return Closure given to #GNUNET_CADET_get_tunnels(), if any.
590 */
591void *
592GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h);
593 604
594 605
595/** 606/**
@@ -606,13 +617,16 @@ GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h);
606 * 617 *
607 * @return #GNUNET_OK / #GNUNET_SYSERR 618 * @return #GNUNET_OK / #GNUNET_SYSERR
608 */ 619 */
609int 620struct GNUNET_CADET_GetTunnel *
610GNUNET_CADET_get_tunnel (struct GNUNET_CADET_Handle *h, 621GNUNET_CADET_get_tunnel (const struct GNUNET_CONFIGURATION_Handle *cfg,
611 const struct GNUNET_PeerIdentity *id, 622 const struct GNUNET_PeerIdentity *id,
612 GNUNET_CADET_TunnelCB callback, 623 GNUNET_CADET_TunnelCB callback,
613 void *callback_cls); 624 void *callback_cls);
614 625
615 626
627void *
628GNUNET_CADET_get_tunnel_cancel (struct GNUNET_CADET_GetTunnel *gt);
629
616 630
617#if 0 /* keep Emacsens' auto-indent happy */ 631#if 0 /* keep Emacsens' auto-indent happy */
618{ 632{