*/
struct MeshTunnelTreeNode *me;
+ /**
+ * DLL of disconneted nodes
+ */
+ struct MeshTunnelTreeNode *disconnected_head;
+
+ /**
+ * DLL of disconneted nodes
+ */
+ struct MeshTunnelTreeNode *disconnected_tail;
+
/**
* Cache of all peers and the first hop to them.
* Indexed by PeerIdentity, contains a pointer to the PeerIdentity
path_invert (struct MeshPeerPath *p);
+/**
+ * Duplicate a path, incrementing short peer's rc.
+ *
+ * @param p The path to duplicate.
+ */
+struct MeshPeerPath *
+path_duplicate (struct MeshPeerPath *path);
+
+
/**
* Find the first peer whom to send a packet to go down this path
*
GNUNET_PEER_Id peer);
+/**
+ * Recusively update the info about what is the first hop to reach the node
+ *
+ * @param tree Tree this nodes belongs to
+ * @param parent Node to be start updating
+ * @param hop If known, ID of the first hop.
+ * If not known, NULL to find out and pass on children.
+ */
+void
+tree_update_first_hops (struct MeshTunnelTree *tree,
+ struct MeshTunnelTreeNode *parent,
+ struct GNUNET_PeerIdentity *hop);
+
/**
* Delete the current path to the peer, including all now unused relays.
* The destination peer is NOT destroyed, it is returned in order to either set
MeshNodeDisconnectCB cb);
+/**
+ * Notifies a tree that a connection it might be using is broken.
+ * Marks all peers down the paths as disconnected and notifies the client.
+ *
+ * @param t Tree to use.
+ * @param p1 Short id of one of the peers (order unimportant)
+ * @param p2 Short id of one of the peers (order unimportant)
+ * @param cb Function to call for every peer that is marked as disconnected.
+ *
+ * @return Short ID of the first disconnected peer in the tree.
+ */
+GNUNET_PEER_Id
+tree_notify_connection_broken (struct MeshTunnelTree *t,
+ GNUNET_PEER_Id p1,
+ GNUNET_PEER_Id p2,
+ MeshNodeDisconnectCB cb);
+
+
+/**
+ * Deletes a peer from a tunnel, liberating all unused resources on the path to
+ * it. It shouldn't have children, if it has they will be destroyed as well.
+ * If the tree is not local and no longer has any paths, the root node will be
+ * destroyed and marked as NULL.
+ *
+ * @param t Tunnel tree to use.
+ * @param peer Short ID of the peer to remove from the tunnel tree.
+ * @param cb Callback to notify client of disconnected peers.
+ *
+ * @return GNUNET_OK or GNUNET_SYSERR
+ */
+int
+tree_del_peer (struct MeshTunnelTree *t,
+ GNUNET_PEER_Id peer,
+ MeshNodeDisconnectCB cb);
+
/**
* Print the tree on stderr
*