aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-01-30 02:11:20 +0000
committerBart Polot <bart@net.in.tum.de>2014-01-30 02:11:20 +0000
commitff21154a0805872ee6dbedb82d2fd64e1a7ed1ac (patch)
tree5370668a8eda5dcc92abbcaa39a2bbbe8de348e3 /src
parent100eeaebcba97bcea73ff4a29e4a55d068a46e15 (diff)
downloadgnunet-ff21154a0805872ee6dbedb82d2fd64e1a7ed1ac.tar.gz
gnunet-ff21154a0805872ee6dbedb82d2fd64e1a7ed1ac.zip
- document tunnel internal API
- change iterator parameter order
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-service-mesh_local.c4
-rw-r--r--src/mesh/gnunet-service-mesh_tunnel.c32
-rw-r--r--src/mesh/gnunet-service-mesh_tunnel.h27
3 files changed, 58 insertions, 5 deletions
diff --git a/src/mesh/gnunet-service-mesh_local.c b/src/mesh/gnunet-service-mesh_local.c
index a02ef84c8..b1f974b41 100644
--- a/src/mesh/gnunet-service-mesh_local.c
+++ b/src/mesh/gnunet-service-mesh_local.c
@@ -589,7 +589,7 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
589 * @return #GNUNET_YES, to keep iterating. 589 * @return #GNUNET_YES, to keep iterating.
590 */ 590 */
591static int 591static int
592monitor_all_tunnels_iterator (void *cls, 592get_all_tunnels_iterator (void *cls,
593 const struct GNUNET_PeerIdentity * peer, 593 const struct GNUNET_PeerIdentity * peer,
594 void *value) 594 void *value)
595{ 595{
@@ -640,7 +640,7 @@ handle_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client,
640 "Received get tunnels request from client %u (%p)\n", 640 "Received get tunnels request from client %u (%p)\n",
641 c->id, client); 641 c->id, client);
642 642
643 GMT_iterate_all (client, monitor_all_tunnels_iterator); 643 GMT_iterate_all (get_all_tunnels_iterator, client);
644 reply.size = htons (sizeof (reply)); 644 reply.size = htons (sizeof (reply));
645 reply.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS); 645 reply.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
646 GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO); 646 GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO);
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c
index 30d3408e9..e5ca08828 100644
--- a/src/mesh/gnunet-service-mesh_tunnel.c
+++ b/src/mesh/gnunet-service-mesh_tunnel.c
@@ -2631,7 +2631,7 @@ GMT_2s (const struct MeshTunnel3 *t)
2631 2631
2632 2632
2633/** 2633/**
2634 * Log all possible info about the tunnel state. 2634 * Log all possible info about the tunnel state to stderr.
2635 * 2635 *
2636 * @param t Tunnel to debug. 2636 * @param t Tunnel to debug.
2637 */ 2637 */
@@ -2671,18 +2671,38 @@ GMT_debug (const struct MeshTunnel3 *t)
2671} 2671}
2672 2672
2673 2673
2674/**
2675 * Iterate all tunnels.
2676 *
2677 * @param iter Iterator.
2678 * @param cls Closure for @c iter.
2679 */
2674void 2680void
2675GMT_iterate_all (void *cls, GNUNET_CONTAINER_PeerMapIterator iter) 2681GMT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls)
2676{ 2682{
2677 GNUNET_CONTAINER_multipeermap_iterate (tunnels, iter, cls); 2683 GNUNET_CONTAINER_multipeermap_iterate (tunnels, iter, cls);
2678} 2684}
2679 2685
2686
2687/**
2688 * Count all tunnels.
2689 *
2690 * @return Number of tunnels to remote peers kept by this peer.
2691 */
2680unsigned int 2692unsigned int
2681GMT_count_all (void) 2693GMT_count_all (void)
2682{ 2694{
2683 return GNUNET_CONTAINER_multipeermap_size (tunnels); 2695 return GNUNET_CONTAINER_multipeermap_size (tunnels);
2684} 2696}
2685 2697
2698
2699/**
2700 * Iterate all connections of a tunnel.
2701 *
2702 * @param t Tunnel whose connections to iterate.
2703 * @param iter Iterator.
2704 * @param cls Closure for @c iter.
2705 */
2686void 2706void
2687GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls) 2707GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls)
2688{ 2708{
@@ -2692,6 +2712,14 @@ GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls)
2692 iter (cls, ct->c); 2712 iter (cls, ct->c);
2693} 2713}
2694 2714
2715
2716/**
2717 * Iterate all channels of a tunnel.
2718 *
2719 * @param t Tunnel whose channels to iterate.
2720 * @param iter Iterator.
2721 * @param cls Closure for @c iter.
2722 */
2695void 2723void
2696GMT_iterate_channels (struct MeshTunnel3 *t, GMT_chan_iter iter, void *cls) 2724GMT_iterate_channels (struct MeshTunnel3 *t, GMT_chan_iter iter, void *cls)
2697{ 2725{
diff --git a/src/mesh/gnunet-service-mesh_tunnel.h b/src/mesh/gnunet-service-mesh_tunnel.h
index afa12aa6a..6ade6f866 100644
--- a/src/mesh/gnunet-service-mesh_tunnel.h
+++ b/src/mesh/gnunet-service-mesh_tunnel.h
@@ -481,15 +481,40 @@ GMT_2s (const struct MeshTunnel3 *t);
481void 481void
482GMT_debug (const struct MeshTunnel3 *t); 482GMT_debug (const struct MeshTunnel3 *t);
483 483
484/**
485 * Iterate all tunnels.
486 *
487 * @param iter Iterator.
488 * @param cls Closure for @c iter.
489 */
484void 490void
485GMT_iterate_all (void *cls, GNUNET_CONTAINER_PeerMapIterator iter); 491GMT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls);
486 492
493/**
494 * Count all tunnels.
495 *
496 * @return Number of tunnels to remote peers kept by this peer.
497 */
487unsigned int 498unsigned int
488GMT_count_all (void); 499GMT_count_all (void);
489 500
501/**
502 * Iterate all connections of a tunnel.
503 *
504 * @param t Tunnel whose connections to iterate.
505 * @param iter Iterator.
506 * @param cls Closure for @c iter.
507 */
490void 508void
491GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls); 509GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls);
492 510
511/**
512 * Iterate all channels of a tunnel.
513 *
514 * @param t Tunnel whose channels to iterate.
515 * @param iter Iterator.
516 * @param cls Closure for @c iter.
517 */
493void 518void
494GMT_iterate_channels (struct MeshTunnel3 *t, GMT_chan_iter iter, void *cls); 519GMT_iterate_channels (struct MeshTunnel3 *t, GMT_chan_iter iter, void *cls);
495 520