gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r25376 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r25376 - gnunet/src/mesh
Date: Mon, 10 Dec 2012 18:44:05 +0100

Author: bartpolot
Date: 2012-12-10 18:44:05 +0100 (Mon, 10 Dec 2012)
New Revision: 25376

Modified:
   gnunet/src/mesh/mesh_tunnel_tree.c
   gnunet/src/mesh/mesh_tunnel_tree.h
Log:
- add children count api call

Modified: gnunet/src/mesh/mesh_tunnel_tree.c
===================================================================
--- gnunet/src/mesh/mesh_tunnel_tree.c  2012-12-10 17:28:48 UTC (rev 25375)
+++ gnunet/src/mesh/mesh_tunnel_tree.c  2012-12-10 17:44:05 UTC (rev 25376)
@@ -672,6 +672,34 @@
 
 
 /**
+ * Iterator to count the children in a tree.
+ */
+static void
+count_children_cb (void *cls, GNUNET_PEER_Id peer)
+{
+  unsigned int *i = cls;
+
+  (*i)++;
+}
+
+
+/**
+ * Count how many children does the local node have in the tree.
+ *
+ * @param tree Tree to use. Must have "me" set.
+ */
+unsigned int
+tree_count_children (struct MeshTunnelTree *tree)
+{
+  unsigned int i;
+
+  i = 0;
+  tree_iterate_children(tree, &count_children_cb, &i);
+  return i;
+}
+
+
+/**
  * Recusively update the info about what is the first hop to reach the node
  *
  * @param tree Tree this nodes belongs to.

Modified: gnunet/src/mesh/mesh_tunnel_tree.h
===================================================================
--- gnunet/src/mesh/mesh_tunnel_tree.h  2012-12-10 17:28:48 UTC (rev 25375)
+++ gnunet/src/mesh/mesh_tunnel_tree.h  2012-12-10 17:44:05 UTC (rev 25376)
@@ -243,7 +243,15 @@
                   MeshWholeTreeCallback cb,
                   void *cb_cls);
 
+/**
+ * Count how many children does the local node have in the tree.
+ *
+ * @param tree Tree to use. Must have "me" set.
+ */
+unsigned int
+tree_count_children (struct MeshTunnelTree *tree);
 
+
 /**
  * Recusively update the info about what is the first hop to reach the node
  *




reply via email to

[Prev in Thread] Current Thread [Next in Thread]