aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-01-27 04:05:12 +0100
committerChristian Grothoff <christian@grothoff.org>2019-01-27 04:05:12 +0100
commitd3f013aba71486c121800d279cd1d3af4425c412 (patch)
treec86bfc9d800e04bda51e68b3041db1d954f43737 /src/include
parent20c42b92b71cb31bc5ed9cc4e4ff32efbd95aae4 (diff)
downloadgnunet-d3f013aba71486c121800d279cd1d3af4425c412.tar.gz
gnunet-d3f013aba71486c121800d279cd1d3af4425c412.zip
more work towards fixing #5385
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_cadet_service.h142
-rw-r--r--src/include/gnunet_protocols.h30
2 files changed, 113 insertions, 59 deletions
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h
index 846260a08..ce44be88a 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -325,7 +325,7 @@ GC_u2h (uint32_t port);
325 325
326 326
327/** 327/**
328 * Struct to retrieve info about a channel. 328 * Union to retrieve info about a channel.
329 */ 329 */
330union GNUNET_CADET_ChannelInfo 330union GNUNET_CADET_ChannelInfo
331{ 331{
@@ -352,7 +352,7 @@ union GNUNET_CADET_ChannelInfo
352 */ 352 */
353const union GNUNET_CADET_ChannelInfo * 353const union GNUNET_CADET_ChannelInfo *
354GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel, 354GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel,
355 enum GNUNET_CADET_ChannelOption option, 355 enum GNUNET_CADET_ChannelOption option,
356 ...); 356 ...);
357 357
358 358
@@ -368,25 +368,34 @@ GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel,
368 368
369 369
370/** 370/**
371 * Internal details about a channel.
372 */
373struct GNUNET_CADET_ChannelInternals
374{
375 /**
376 * Root of the channel
377 */
378 struct GNUNET_PeerIdentity root;
379
380 /**
381 * Destination of the channel
382 */
383 struct GNUNET_PeerIdentity dest;
384
385 // to be expanded!
386};
387
388
389/**
371 * Method called to retrieve information about a specific channel the cadet peer 390 * Method called to retrieve information about a specific channel the cadet peer
372 * is aware of, including all transit nodes. 391 * is aware of, including all transit nodes.
373 * 392 *
374 * @param cls Closure. 393 * @param cls Closure.
375 * @param root Root of the channel. 394 * @param info internal details, NULL for end of list
376 * @param dest Destination of the channel.
377 * @param port Destination port of the channel.
378 * @param root_channel_number Local number for root, if known.
379 * @param dest_channel_number Local number for dest, if known.
380 * @param public_channel_numbe Number for P2P, always known.
381 */ 395 */
382typedef void 396typedef void
383(*GNUNET_CADET_ChannelCB) (void *cls, 397(*GNUNET_CADET_ChannelCB) (void *cls,
384 const struct GNUNET_PeerIdentity *root, 398 const struct GNUNET_CADET_ChannelInternals *info);
385 const struct GNUNET_PeerIdentity *dest,
386 uint32_t /* UGH */ port,
387 uint32_t /* ugh */ root_channel_number,
388 uint32_t /* ugh */ dest_channel_number,
389 uint32_t /* ugh */ public_channel_number);
390 399
391 400
392/** 401/**
@@ -396,18 +405,16 @@ struct GNUNET_CADET_ChannelMonitor;
396 405
397 406
398/** 407/**
399 * Request information about a specific channel of the running cadet peer. 408 * Request information about channels to @a peer from the local peer.
400 * 409 *
401 * @param cfg configuration to use 410 * @param cfg configuration to use
402 * @param peer ID of the other end of the channel. 411 * @param peer ID of the other end of the channel.
403 * @param channel_number Channel number.
404 * @param callback Function to call with the requested data. 412 * @param callback Function to call with the requested data.
405 * @param callback_cls Closure for @c callback. 413 * @param callback_cls Closure for @c callback.
406 */ 414 */
407struct GNUNET_CADET_ChannelMonitor * 415struct GNUNET_CADET_ChannelMonitor *
408GNUNET_CADET_get_channel (const struct GNUNET_CONFIGURATION_Handle *cfg, 416GNUNET_CADET_get_channel (const struct GNUNET_CONFIGURATION_Handle *cfg,
409 struct GNUNET_PeerIdentity *peer, 417 struct GNUNET_PeerIdentity *peer,
410 uint32_t /* UGH */ channel_number,
411 GNUNET_CADET_ChannelCB callback, 418 GNUNET_CADET_ChannelCB callback,
412 void *callback_cls); 419 void *callback_cls);
413 420
@@ -423,24 +430,44 @@ GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm);
423 430
424 431
425/** 432/**
433 * Information we return per peer.
434 */
435struct GNUNET_CADET_PeerListEntry
436{
437 /**
438 * Which peer is the information about?
439 */
440 struct GNUNET_PeerIdentity peer;
441
442 /**
443 * Do we have a tunnel to this peer?
444 */
445 int have_tunnel;
446
447 /**
448 * Number of disjoint known paths to @e peer.
449 */
450 unsigned int n_paths;
451
452 /**
453 * Length of the shortest path (0 = unknown, 1 = ourselves, 2 = direct neighbour).
454 */
455 unsigned int best_path_length;
456};
457
458
459/**
426 * Method called to retrieve information about all peers in CADET, called 460 * Method called to retrieve information about all peers in CADET, called
427 * once per peer. 461 * once per peer.
428 * 462 *
429 * After last peer has been reported, an additional call with NULL is done. 463 * After last peer has been reported, an additional call with NULL is done.
430 * 464 *
431 * @param cls Closure. 465 * @param cls Closure.
432 * @param peer Peer, or NULL on "EOF". 466 * @param ple information about a peer, or NULL on "EOF".
433 * @param tunnel Do we have a tunnel towards this peer?
434 * @param n_paths Number of known paths towards this peer.
435 * @param best_path How long is the best path?
436 * (0 = unknown, 1 = ourselves, 2 = neighbor)
437 */ 467 */
438typedef void 468typedef void
439(*GNUNET_CADET_PeersCB) (void *cls, 469(*GNUNET_CADET_PeersCB) (void *cls,
440 const struct GNUNET_PeerIdentity *peer, 470 const struct GNUNET_CADET_PeerListEntry *ple);
441 int tunnel,
442 unsigned int n_paths,
443 unsigned int best_path);
444 471
445 472
446/** 473/**
@@ -476,50 +503,61 @@ GNUNET_CADET_list_peers_cancel (struct GNUNET_CADET_PeersLister *pl);
476 503
477 504
478/** 505/**
479 * Method called to retrieve information about a specific peer 506 * Detailed information we return per peer.
507 */
508struct GNUNET_CADET_PeerPathDetail
509{
510 /**
511 * Peer this is about.
512 */
513 struct GNUNET_PeerIdentity peer;
514
515 /**
516 * Number of entries on the @e path.
517 */
518 unsigned int path_length;
519
520 /**
521 * Array of PEER_IDs representing all paths to reach the peer. Each
522 * path starts with the first hop (local peer not included). Each
523 * path ends with the destination peer (given in @e peer).
524 */
525 const struct GNUNET_PeerIdentity *path;
526
527};
528
529
530/**
531 * Method called to retrieve information about a specific path
480 * known to the service. 532 * known to the service.
481 * 533 *
482 * @param cls Closure. 534 * @param cls Closure.
483 * @param peer Peer ID. 535 * @param ppd details about a path to the peer, NULL for end of information
484 * @param tunnel Do we have a tunnel towards this peer? #GNUNET_YES/#GNUNET_NO
485 * @param neighbor Is this a direct neighbor? #GNUNET_YES/#GNUNET_NO
486 * @param n_paths Number of paths known towards peer.
487 * @param paths Array of PEER_IDs representing all paths to reach the peer.
488 * Each path starts with the first hop (local peer not included).
489 * Each path ends with the destination peer (given in @c peer).
490 */ 536 */
491typedef void 537typedef void
492(*GNUNET_CADET_PeerCB) (void *cls, 538(*GNUNET_CADET_PathCB) (void *cls,
493 const struct GNUNET_PeerIdentity *peer, 539 const struct GNUNET_CADET_PeerPathDetail *ppd);
494 int tunnel,
495 int neighbor,
496 unsigned int n_paths,
497 const struct GNUNET_PeerIdentity *paths,
498 int offset,
499 int finished_with_paths);
500 540
501 541
502/** 542/**
503 * Handle to cancel #GNUNET_CADET_get_peer() operation. 543 * Handle to cancel #GNUNET_CADET_get_path() operation.
504 */ 544 */
505struct GNUNET_CADET_GetPeer; 545struct GNUNET_CADET_GetPath;
506 546
507 547
508/** 548/**
509 * Request information about a peer known to the running cadet peer. 549 * Request information about a peer known to the running cadet peer.
510 * The callback will be called for the tunnel once.
511 * Only one info request (of any kind) can be active at once.
512 * 550 *
513 * @param cfg configuration to use 551 * @param cfg configuration to use
514 * @param id Peer whose tunnel to examine. 552 * @param id Peer whose paths we want to examine.
515 * @param callback Function to call with the requested data. 553 * @param callback Function to call with the requested data.
516 * @param callback_cls Closure for @c callback. 554 * @param callback_cls Closure for @c callback.
517 * @return NULL on error 555 * @return NULL on error
518 */ 556 */
519struct GNUNET_CADET_GetPeer * 557struct GNUNET_CADET_GetPath *
520GNUNET_CADET_get_peer (const struct GNUNET_CONFIGURATION_Handle *cfg, 558GNUNET_CADET_get_path (const struct GNUNET_CONFIGURATION_Handle *cfg,
521 const struct GNUNET_PeerIdentity *id, 559 const struct GNUNET_PeerIdentity *id,
522 GNUNET_CADET_PeerCB callback, 560 GNUNET_CADET_PathCB callback,
523 void *callback_cls); 561 void *callback_cls);
524 562
525 563
@@ -527,10 +565,10 @@ GNUNET_CADET_get_peer (const struct GNUNET_CONFIGURATION_Handle *cfg,
527 * Cancel @a gp operation. 565 * Cancel @a gp operation.
528 * 566 *
529 * @param gp operation to cancel 567 * @param gp operation to cancel
530 * @return closure from #GNUNET_CADET_get_peer(). 568 * @return closure from #GNUNET_CADET_get_path().
531 */ 569 */
532void * 570void *
533GNUNET_CADET_get_peer_cancel (struct GNUNET_CADET_GetPeer *gp); 571GNUNET_CADET_get_path_cancel (struct GNUNET_CADET_GetPath *gp);
534 572
535 573
536/** 574/**
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 7ef8dca8e..1b1bdc099 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2854,7 +2854,7 @@ extern "C"
2854/** 2854/**
2855 * Local information about all channels of service. 2855 * Local information about all channels of service.
2856 */ 2856 */
2857#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNELS 1030 2857#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_CHANNEL 1030
2858 2858
2859/** 2859/**
2860 * Local information of service about a specific channel. 2860 * Local information of service about a specific channel.
@@ -2887,26 +2887,42 @@ extern "C"
2887#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS 1036 2887#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS 1036
2888 2888
2889/** 2889/**
2890 * Local information of service about a specific peer. 2890 * Local information of service about a specific path.
2891 */ 2891 */
2892#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER 1037 2892#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH 1037
2893 2893
2894/** 2894/**
2895 * Debug request. 2895 * End of local information of service about channels.
2896 */ 2896 */
2897#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_DUMP 1038 2897#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL_END 1038
2898 2898
2899/** 2899/**
2900 * End of local information about all peers known to the service. 2900 * End of local information about all peers known to the service.
2901 */ 2901 */
2902#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER_END 1039 2902#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS_END 1039
2903
2904/**
2905 * Request local information about all peers known to the service.
2906 */
2907#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PEERS 1040
2908
2909/**
2910 * End of local information of service about a specific path.
2911 */
2912#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH_END 1041
2913
2914/**
2915 * Request local information of service about paths to specific peer.
2916 */
2917#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH 1042
2918
2903 2919
2904/******************************** Application *******************************/ 2920/******************************** Application *******************************/
2905 2921
2906/** 2922/**
2907 * Traffic (net-cat style) used by the Command Line Interface. 2923 * Traffic (net-cat style) used by the Command Line Interface.
2908 */ 2924 */
2909#define GNUNET_MESSAGE_TYPE_CADET_CLI 1040 2925#define GNUNET_MESSAGE_TYPE_CADET_CLI 1059
2910 2926
2911/******************************************************************************/ 2927/******************************************************************************/
2912 2928