aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/mesh_tunnel_tree.h
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-11-20 12:01:04 +0000
committerBart Polot <bart@net.in.tum.de>2012-11-20 12:01:04 +0000
commitafd56af75f0a16ee5b8ab7777871294931ca265c (patch)
tree3822744a61f09b586bc8853570f8d20b842b2230 /src/mesh/mesh_tunnel_tree.h
parentaba63e824e9867baad05307d7efbdf453e38626b (diff)
downloadgnunet-afd56af75f0a16ee5b8ab7777871294931ca265c.tar.gz
gnunet-afd56af75f0a16ee5b8ab7777871294931ca265c.zip
- Add whole-tree iterator, for debugging / monitoring / visualization purposes.
Diffstat (limited to 'src/mesh/mesh_tunnel_tree.h')
-rw-r--r--src/mesh/mesh_tunnel_tree.h37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/mesh/mesh_tunnel_tree.h b/src/mesh/mesh_tunnel_tree.h
index 84fd0acb2..b1d89d6ff 100644
--- a/src/mesh/mesh_tunnel_tree.h
+++ b/src/mesh/mesh_tunnel_tree.h
@@ -126,15 +126,26 @@ path_destroy (struct MeshPeerPath *p);
126/******************************************************************************/ 126/******************************************************************************/
127 127
128/** 128/**
129 * Method called whenever a node has been marked as disconnected. 129 * Iterator over all children of a node.
130 * 130 *
131 * @param cls Closure. 131 * @param cls Closure.
132 * @param peer_id short ID of peer that is no longer reachable. 132 * @param peer_id Short ID of the peer.
133 */ 133 */
134typedef void (*MeshTreeCallback) (void *cls, GNUNET_PEER_Id peer_id); 134typedef void (*MeshTreeCallback) (void *cls, GNUNET_PEER_Id peer_id);
135 135
136 136
137/** 137/**
138 * Iterator over all nodes in a tree.
139 *
140 * @param cls Closure.
141 * @param peer_id Short ID of the peer.
142 * @param peer_id Short ID of the parent of the peer.
143 */
144typedef void (*MeshWholeTreeCallback) (void *cls,
145 GNUNET_PEER_Id peer_id,
146 GNUNET_PEER_Id parent_id);
147
148/**
138 * Create a new tunnel tree associated to a tunnel 149 * Create a new tunnel tree associated to a tunnel
139 * 150 *
140 * @param peer A short peer id of the root of the tree 151 * @param peer A short peer id of the root of the tree
@@ -210,11 +221,27 @@ tree_find_peer (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer_id);
210 * 221 *
211 * @param tree Tree to use. Must have "me" set. 222 * @param tree Tree to use. Must have "me" set.
212 * @param cb Callback to call over each child. 223 * @param cb Callback to call over each child.
213 * @param cls Closure. 224 * @param cb_cls Closure for @c cb.
225 */
226void
227tree_iterate_children (struct MeshTunnelTree *tree,
228 MeshTreeCallback cb,
229 void *cb_cls);
230
231
232/**
233 * Iterate over all nodes in the tree.
234 *
235 * @param tree Tree to use..
236 * @param cb Callback to call over each child.
237 * @param cb_cls Closure for @c cb.
238 *
239 * TODO: recursive implementation? (s/heap/stack/g)
214 */ 240 */
215void 241void
216tree_iterate_children (struct MeshTunnelTree *tree, MeshTreeCallback cb, 242tree_iterate_all (struct MeshTunnelTree *tree,
217 void *cls); 243 MeshWholeTreeCallback cb,
244 void *cb_cls);
218 245
219 246
220/** 247/**