aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/mesh_tunnel_tree.h
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-09-22 18:12:27 +0000
committerBart Polot <bart@net.in.tum.de>2011-09-22 18:12:27 +0000
commit17e4c95ee4c555db7ab3ab9c57412b7866ee5411 (patch)
tree25a8e79563ba3a6890cba8de7015cae8f3a0d9ba /src/mesh/mesh_tunnel_tree.h
parent1e018e4e2e1d57cee223aa84f2ebd7e6c8160480 (diff)
downloadgnunet-17e4c95ee4c555db7ab3ab9c57412b7866ee5411.tar.gz
gnunet-17e4c95ee4c555db7ab3ab9c57412b7866ee5411.zip
Changed tree children magement from array to DLL, fixed bugs, extended testcase.
Diffstat (limited to 'src/mesh/mesh_tunnel_tree.h')
-rw-r--r--src/mesh/mesh_tunnel_tree.h31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/mesh/mesh_tunnel_tree.h b/src/mesh/mesh_tunnel_tree.h
index 6573a85bd..a929f7a6d 100644
--- a/src/mesh/mesh_tunnel_tree.h
+++ b/src/mesh/mesh_tunnel_tree.h
@@ -76,14 +76,24 @@ struct MeshTunnelTreeNode
76 struct MeshTunnelTreeNode *parent; 76 struct MeshTunnelTreeNode *parent;
77 77
78 /** 78 /**
79 * Array of children 79 * DLL of siblings
80 */ 80 */
81 struct MeshTunnelTreeNode *children; 81 struct MeshTunnelTreeNode *next;
82 82
83 /** 83 /**
84 * Number of children 84 * DLL of siblings
85 */ 85 */
86 unsigned int nchildren; 86 struct MeshTunnelTreeNode *prev;
87
88 /**
89 * DLL of children
90 */
91 struct MeshTunnelTreeNode *children_head;
92
93 /**
94 * DLL of children
95 */
96 struct MeshTunnelTreeNode *children_tail;
87 97
88 /** 98 /**
89 * Status of the peer in the tunnel 99 * Status of the peer in the tunnel
@@ -257,6 +267,19 @@ tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
257 267
258 268
259/** 269/**
270 * Allocates and initializes a new node.
271 * Sets ID and parent of the new node and inserts it in the DLL of the parent
272 *
273 * @param parent Node that will be the parent from the new node, NULL for root
274 * @param id Short Id of the new node
275 *
276 * @return Newly allocated node
277 */
278struct MeshTunnelTreeNode *
279tree_node_new(struct MeshTunnelTreeNode *parent, GNUNET_PEER_Id id);
280
281
282/**
260 * Destroy the node and all children 283 * Destroy the node and all children
261 * 284 *
262 * @param n Parent node to be destroyed 285 * @param n Parent node to be destroyed