2 This file is part of GNUnet.
3 (C) 2001 - 2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file mesh/mesh_path.h
23 * @brief Path handling functions
24 * @author Bartlomiej Polot
33 #if 0 /* keep Emacsens' auto-indent happy */
38 /******************************************************************************/
39 /************************ DATA STRUCTURES ****************************/
40 /******************************************************************************/
43 * Information regarding a possible path to reach a single peer
51 struct MeshPeerPath *next;
52 struct MeshPeerPath *prev;
55 * List of all the peers that form the path from origin to target.
57 GNUNET_PEER_Id *peers;
60 * Number of peers (hops) in the path
65 * Path's score, how reliable is the path.
71 /******************************************************************************/
72 /************************* FUNCTIONS *****************************/
73 /******************************************************************************/
78 * @param length How many hops will the path have.
80 * @return A newly allocated path with a peer array of the specified length.
83 path_new (unsigned int length);
89 * @param path The path to invert.
92 path_invert (struct MeshPeerPath *path);
96 * Duplicate a path, incrementing short peer's rc.
98 * @param path The path to duplicate.
100 struct MeshPeerPath *
101 path_duplicate (const struct MeshPeerPath *path);
105 * Get the length of a path.
107 * @param path The path to measure, with the local peer at any point of it.
109 * @return Number of hops to reach destination.
110 * UINT_MAX in case the peer is not in the path.
113 path_get_length (struct MeshPeerPath *path);
117 * Destroy the path and free any allocated resources linked to it
119 * @param p the path to destroy
121 * @return GNUNET_OK on success
124 path_destroy (struct MeshPeerPath *p);
127 #if 0 /* keep Emacsens' auto-indent happy */
135 /* ifndef MESH_PATH_H */