Fixed id counters' cycling
[oweals/gnunet.git] / src / mesh / mesh_tunnel_tree.h
index f187e7957227136a41bb7234ebe22f5fad0bad4f..59a60839d43cd922698786d01fd1726bf45e043f 100644 (file)
@@ -171,6 +171,15 @@ void
 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
  *
@@ -257,6 +266,19 @@ tree_find_peer (struct MeshTunnelTreeNode *parent,
                 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
@@ -325,6 +347,23 @@ tree_notify_connection_broken (struct MeshTunnelTree *t,
                                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
  *