aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-01-30 12:28:39 +0000
committerBart Polot <bart@net.in.tum.de>2014-01-30 12:28:39 +0000
commit0d83dd0910566a4b1f95227cd62a42b1521c3bc6 (patch)
treea2ba5e34e02a42b6997973300ba827729c4c6824 /src/include
parent7067d8df58abce4636ff94cd3621aee9de1ab594 (diff)
downloadgnunet-0d83dd0910566a4b1f95227cd62a42b1521c3bc6.tar.gz
gnunet-0d83dd0910566a4b1f95227cd62a42b1521c3bc6.zip
- use a memory-efficient, cleaner info API (limiting concurrent info requests to 1)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_mesh_service.h119
1 files changed, 42 insertions, 77 deletions
diff --git a/src/include/gnunet_mesh_service.h b/src/include/gnunet_mesh_service.h
index 40a4060db..21a51b7b2 100644
--- a/src/include/gnunet_mesh_service.h
+++ b/src/include/gnunet_mesh_service.h
@@ -362,34 +362,26 @@ GNUNET_MESH_receive_done (struct GNUNET_MESH_Channel *channel);
362/* normal mesh applications. */ 362/* normal mesh applications. */
363/******************************************************************************/ 363/******************************************************************************/
364 364
365/**
366 * Method called to retrieve information about each channel the mesh peer
367 * is aware of.
368 *
369 * @param cls Closure.
370 * @param channel_number Channel number.
371 * @param origin that started the channel (owner).
372 * @param target other endpoint of the channel
373 */
374typedef void (*GNUNET_MESH_ChannelsCB) (void *cls,
375 uint32_t root_channel_number,
376 uint32_t dest_channel_number,
377 uint32_t public_channel_number,
378 const struct GNUNET_PeerIdentity *origin,
379 const struct GNUNET_PeerIdentity *target);
380
381 365
382/** 366/**
383 * Method called to retrieve information about a specific channel the mesh peer 367 * Method called to retrieve information about a specific channel the mesh peer
384 * is aware of, including all transit nodes. 368 * is aware of, including all transit nodes.
385 * 369 *
386 * @param cls Closure. 370 * @param cls Closure.
387 * @param peer Peer in the channel's tree. 371 * @param root Root of the channel.
388 * @param parent Parent of the current peer. All 0 when peer is root. 372 * @param dest Destination of the channel.
373 * @param port Destination port of the channel.
374 * @param root_channel_number Local number for root, if known.
375 * @param dest_channel_number Local number for dest, if known.
376 * @param public_channel_numbe Number for P2P, always known.
389 */ 377 */
390typedef void (*GNUNET_MESH_ChannelCB) (void *cls, 378typedef void (*GNUNET_MESH_ChannelCB) (void *cls,
391 const struct GNUNET_PeerIdentity *peer, 379 const struct GNUNET_PeerIdentity *root,
392 const struct GNUNET_PeerIdentity *parent); 380 const struct GNUNET_PeerIdentity *dest,
381 uint32_t port,
382 uint32_t root_channel_number,
383 uint32_t dest_channel_number,
384 uint32_t public_channel_number);
393 385
394/** 386/**
395 * Method called to retrieve information about all peers in MESH, called 387 * Method called to retrieve information about all peers in MESH, called
@@ -454,28 +446,6 @@ typedef void (*GNUNET_MESH_TunnelCB) (void *cls,
454 unsigned int estate, 446 unsigned int estate,
455 unsigned int cstate); 447 unsigned int cstate);
456 448
457
458/**
459 * Request information about the running mesh peer.
460 * The callback will be called for every channel known to the service,
461 * listing all active peers that belong to the channel.
462 *
463 * If called again on the same handle, it will overwrite the previous
464 * callback and cls. To retrieve the cls, monitor_cancel must be
465 * called first.
466 *
467 * WARNING: unstable API, likely to change in the future!
468 *
469 * @param h Handle to the mesh peer.
470 * @param callback Function to call with the requested data.
471 * @param callback_cls Closure for @c callback.
472 */
473void
474GNUNET_MESH_get_channels (struct GNUNET_MESH_Handle *h,
475 GNUNET_MESH_ChannelsCB callback,
476 void *callback_cls);
477
478
479/** 449/**
480 * Request information about a specific channel of the running mesh peer. 450 * Request information about a specific channel of the running mesh peer.
481 * 451 *
@@ -496,55 +466,50 @@ GNUNET_MESH_get_channel (struct GNUNET_MESH_Handle *h,
496 466
497 467
498/** 468/**
499 * Cancel a monitor request. The monitor callback will not be called. 469 * Request information about peers known to the running mesh service.
500 *
501 * WARNING: unstable API, likely to change in the future!
502 *
503 * @param h Mesh handle.
504 *
505 * @return Closure given to GNUNET_MESH_monitor, if any.
506 */
507void *
508GNUNET_MESH_get_channels_cancel (struct GNUNET_MESH_Handle *h);
509
510
511
512/**
513 * Request information about the running mesh peer.
514 * The callback will be called for every peer known to the service. 470 * The callback will be called for every peer known to the service.
471 * Only one info request (of any kind) can be active at once.
515 * 472 *
516 * If called again on the same handle, it will overwrite the previous
517 * callback and cls. To retrieve the cls, monitor_cancel must be
518 * called first.
519 * 473 *
520 * WARNING: unstable API, likely to change in the future! 474 * WARNING: unstable API, likely to change in the future!
521 * 475 *
522 * @param h Handle to the mesh peer. 476 * @param h Handle to the mesh peer.
523 * @param callback Function to call with the requested data. 477 * @param callback Function to call with the requested data.
524 * @param callback_cls Closure for @c callback. 478 * @param callback_cls Closure for @c callback.
479 *
480 * @return #GNUNET_OK / #GNUNET_SYSERR
525 */ 481 */
526void 482int
527GNUNET_MESH_get_peers (struct GNUNET_MESH_Handle *h, 483GNUNET_MESH_get_peers (struct GNUNET_MESH_Handle *h,
528 GNUNET_MESH_PeersCB callback, 484 GNUNET_MESH_PeersCB callback,
529 void *callback_cls); 485 void *callback_cls);
530 486
531
532/** 487/**
533 * Request information about the running mesh peer. 488 * Cancel a peer info request. The callback will not be called (anymore).
534 * The callback will be called for every channel known to the service,
535 * listing all active peers that blong to the channel.
536 * 489 *
537 * If called again on the same handle, it will overwrite the previous 490 * WARNING: unstable API, likely to change in the future!
538 * callback and cls. To retrieve the cls, monitor_cancel must be 491 *
539 * called first. 492 * @param h Mesh handle.
493 *
494 * @return Closure given to GNUNET_MESH_get_peers.
495 */
496void *
497GNUNET_MESH_get_peers_cancel (struct GNUNET_MESH_Handle *h);
498
499/**
500 * Request information about tunnels of the running mesh peer.
501 * The callback will be called for every tunnel of the service.
502 * Only one info request (of any kind) can be active at once.
540 * 503 *
541 * WARNING: unstable API, likely to change in the future! 504 * WARNING: unstable API, likely to change in the future!
542 * 505 *
543 * @param h Handle to the mesh peer. 506 * @param h Handle to the mesh peer.
544 * @param callback Function to call with the requested data. 507 * @param callback Function to call with the requested data.
545 * @param callback_cls Closure for @c callback. 508 * @param callback_cls Closure for @c callback.
509 *
510 * @return #GNUNET_OK / #GNUNET_SYSERR
546 */ 511 */
547void 512int
548GNUNET_MESH_get_tunnels (struct GNUNET_MESH_Handle *h, 513GNUNET_MESH_get_tunnels (struct GNUNET_MESH_Handle *h,
549 GNUNET_MESH_TunnelsCB callback, 514 GNUNET_MESH_TunnelsCB callback,
550 void *callback_cls); 515 void *callback_cls);
@@ -559,22 +524,22 @@ GNUNET_MESH_get_tunnels (struct GNUNET_MESH_Handle *h,
559void * 524void *
560GNUNET_MESH_get_tunnels_cancel (struct GNUNET_MESH_Handle *h); 525GNUNET_MESH_get_tunnels_cancel (struct GNUNET_MESH_Handle *h);
561 526
527
562/** 528/**
563 * Request information about the running mesh peer. 529 * Request information about a tunnel of the running mesh peer.
564 * The callback will be called for every channel known to the service, 530 * The callback will be called for the tunnel once.
565 * listing all active peers that blong to the channel. 531 * Only one info request (of any kind) can be active at once.
566 *
567 * If called again on the same handle, it will overwrite the previous
568 * callback and cls. To retrieve the cls, monitor_cancel must be
569 * called first.
570 * 532 *
571 * WARNING: unstable API, likely to change in the future! 533 * WARNING: unstable API, likely to change in the future!
572 * 534 *
573 * @param h Handle to the mesh peer. 535 * @param h Handle to the mesh peer.
536 * @param id Peer whose tunnel to examine.
574 * @param callback Function to call with the requested data. 537 * @param callback Function to call with the requested data.
575 * @param callback_cls Closure for @c callback. 538 * @param callback_cls Closure for @c callback.
539 *
540 * @return #GNUNET_OK / #GNUNET_SYSERR
576 */ 541 */
577void 542int
578GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h, 543GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h,
579 const struct GNUNET_PeerIdentity *id, 544 const struct GNUNET_PeerIdentity *id,
580 GNUNET_MESH_TunnelCB callback, 545 GNUNET_MESH_TunnelCB callback,