- cancel SYNACK retry task when forced to SYNACK by an incoming SYN
[oweals/gnunet.git] / src / mesh / mesh_path.h
index c3f3264b00d48ec53d852566128dbbff272f930c..8b8e20a1ebd4a0dbd65cc14bef0e835923d0e0cd 100644 (file)
@@ -24,8 +24,8 @@
  * @author Bartlomiej Polot
  */
 
-#ifndef MESH_PATH_H
-#define MESH_PATH_H
+#ifndef MESH_PATH_H_
+#define MESH_PATH_H_
 
 #ifdef __cplusplus
 extern "C"
@@ -35,8 +35,6 @@ extern "C"
 #endif
 #endif
 
-#include "mesh2.h"
-
 /******************************************************************************/
 /************************      DATA STRUCTURES     ****************************/
 /******************************************************************************/
@@ -63,6 +61,17 @@ struct MeshPeerPath
      */
   unsigned int length;
 
+    /**
+     * Path's score, how reliable is the path.
+     */
+//   int score;
+
+  /**
+   * Task to delete the path.
+   * We tried it, it didn't work, don't try again in a while.
+   */
+  GNUNET_SCHEDULER_TaskIdentifier path_delete;
+
 };
 
 /******************************************************************************/
@@ -95,7 +104,7 @@ path_invert (struct MeshPeerPath *path);
  * @param path The path to duplicate.
  */
 struct MeshPeerPath *
-path_duplicate (struct MeshPeerPath *path);
+path_duplicate (const struct MeshPeerPath *path);
 
 
 /**
@@ -109,6 +118,27 @@ path_duplicate (struct MeshPeerPath *path);
 unsigned int
 path_get_length (struct MeshPeerPath *path);
 
+/**
+ * Mark path as invalid: keep it aroud for a while to avoid trying it in a loop.
+ *
+ * DHT_get sometimes returns bad cached results, for instance, on a locally
+ * cached result where the PUT followed a path that is no longer current.
+ *
+ * @param p Path to invalidate.
+ */
+void
+path_invalidate (struct MeshPeerPath *p);
+
+/**
+ * Test if a path is valid (or at least not known to be invalid).
+ *
+ * @param path Path to test.
+ *
+ * @return #GNUNET_YES If the path is valid or unknown,
+ *         #GNUNET_NO If the path is known to be invalid.
+ */
+int
+path_is_valid (const struct MeshPeerPath *path);
 
 /**
  * Destroy the path and free any allocated resources linked to it
@@ -120,6 +150,21 @@ path_get_length (struct MeshPeerPath *path);
 int
 path_destroy (struct MeshPeerPath *p);
 
+/**
+ * Path -> allocated one line string. Caller must free.
+ *
+ * @param p Path.
+ */
+char *
+path_2s (struct MeshPeerPath *p);
+
+/**
+ * Print info about the path for debug.
+ *
+ * @param p Path to debug.
+ */
+void
+path_debug (struct MeshPeerPath *p);
 
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
@@ -130,4 +175,4 @@ path_destroy (struct MeshPeerPath *p);
 
 
 /* ifndef MESH_PATH_H */
-#endif
\ No newline at end of file
+#endif