diff options
Diffstat (limited to 'src/mesh/mesh_tunnel_tree.h')
-rw-r--r-- | src/mesh/mesh_tunnel_tree.h | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/src/mesh/mesh_tunnel_tree.h b/src/mesh/mesh_tunnel_tree.h index e5d65921d..779d330e7 100644 --- a/src/mesh/mesh_tunnel_tree.h +++ b/src/mesh/mesh_tunnel_tree.h | |||
@@ -19,12 +19,12 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file mesh/mesh_tunnel_tree.h | 22 | * @file cadet/cadet_tunnel_tree.h |
23 | * @brief Tunnel tree handling functions | 23 | * @brief Tunnel tree handling functions |
24 | * @author Bartlomiej Polot | 24 | * @author Bartlomiej Polot |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "mesh.h" | 27 | #include "cadet.h" |
28 | 28 | ||
29 | /******************************************************************************/ | 29 | /******************************************************************************/ |
30 | /************************ DATA STRUCTURES ****************************/ | 30 | /************************ DATA STRUCTURES ****************************/ |
@@ -33,14 +33,14 @@ | |||
33 | /** | 33 | /** |
34 | * Information regarding a possible path to reach a single peer | 34 | * Information regarding a possible path to reach a single peer |
35 | */ | 35 | */ |
36 | struct MeshPeerPath | 36 | struct CadetPeerPath |
37 | { | 37 | { |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Linked list | 40 | * Linked list |
41 | */ | 41 | */ |
42 | struct MeshPeerPath *next; | 42 | struct CadetPeerPath *next; |
43 | struct MeshPeerPath *prev; | 43 | struct CadetPeerPath *prev; |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * List of all the peers that form the path from origin to target. | 46 | * List of all the peers that form the path from origin to target. |
@@ -58,13 +58,13 @@ struct MeshPeerPath | |||
58 | /** | 58 | /** |
59 | * Node of path tree for a tunnel | 59 | * Node of path tree for a tunnel |
60 | */ | 60 | */ |
61 | struct MeshTunnelTreeNode; | 61 | struct CadetTunnelTreeNode; |
62 | 62 | ||
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Tree to reach all peers in the tunnel | 65 | * Tree to reach all peers in the tunnel |
66 | */ | 66 | */ |
67 | struct MeshTunnelTree; | 67 | struct CadetTunnelTree; |
68 | 68 | ||
69 | 69 | ||
70 | /******************************************************************************/ | 70 | /******************************************************************************/ |
@@ -78,7 +78,7 @@ struct MeshTunnelTree; | |||
78 | * | 78 | * |
79 | * @return A newly allocated path with a peer array of the specified length. | 79 | * @return A newly allocated path with a peer array of the specified length. |
80 | */ | 80 | */ |
81 | struct MeshPeerPath * | 81 | struct CadetPeerPath * |
82 | path_new (unsigned int length); | 82 | path_new (unsigned int length); |
83 | 83 | ||
84 | 84 | ||
@@ -88,7 +88,7 @@ path_new (unsigned int length); | |||
88 | * @param path The path to invert. | 88 | * @param path The path to invert. |
89 | */ | 89 | */ |
90 | void | 90 | void |
91 | path_invert (struct MeshPeerPath *path); | 91 | path_invert (struct CadetPeerPath *path); |
92 | 92 | ||
93 | 93 | ||
94 | /** | 94 | /** |
@@ -96,8 +96,8 @@ path_invert (struct MeshPeerPath *path); | |||
96 | * | 96 | * |
97 | * @param path The path to duplicate. | 97 | * @param path The path to duplicate. |
98 | */ | 98 | */ |
99 | struct MeshPeerPath * | 99 | struct CadetPeerPath * |
100 | path_duplicate (struct MeshPeerPath *path); | 100 | path_duplicate (struct CadetPeerPath *path); |
101 | 101 | ||
102 | 102 | ||
103 | /** | 103 | /** |
@@ -109,7 +109,7 @@ path_duplicate (struct MeshPeerPath *path); | |||
109 | * UINT_MAX in case the peer is not in the path. | 109 | * UINT_MAX in case the peer is not in the path. |
110 | */ | 110 | */ |
111 | unsigned int | 111 | unsigned int |
112 | path_get_length (struct MeshPeerPath *path); | 112 | path_get_length (struct CadetPeerPath *path); |
113 | 113 | ||
114 | 114 | ||
115 | /** | 115 | /** |
@@ -120,7 +120,7 @@ path_get_length (struct MeshPeerPath *path); | |||
120 | * @return GNUNET_OK on success | 120 | * @return GNUNET_OK on success |
121 | */ | 121 | */ |
122 | int | 122 | int |
123 | path_destroy (struct MeshPeerPath *p); | 123 | path_destroy (struct CadetPeerPath *p); |
124 | 124 | ||
125 | 125 | ||
126 | /******************************************************************************/ | 126 | /******************************************************************************/ |
@@ -131,7 +131,7 @@ path_destroy (struct MeshPeerPath *p); | |||
131 | * @param cls Closure. | 131 | * @param cls Closure. |
132 | * @param peer_id Short ID of the peer. | 132 | * @param peer_id Short ID of the peer. |
133 | */ | 133 | */ |
134 | typedef void (*MeshTreeCallback) (void *cls, GNUNET_PEER_Id peer_id); | 134 | typedef void (*CadetTreeCallback) (void *cls, GNUNET_PEER_Id peer_id); |
135 | 135 | ||
136 | 136 | ||
137 | /** | 137 | /** |
@@ -141,7 +141,7 @@ typedef void (*MeshTreeCallback) (void *cls, GNUNET_PEER_Id peer_id); | |||
141 | * @param peer_id Short ID of the peer. | 141 | * @param peer_id Short ID of the peer. |
142 | * @param peer_id Short ID of the parent of the peer. | 142 | * @param peer_id Short ID of the parent of the peer. |
143 | */ | 143 | */ |
144 | typedef void (*MeshWholeTreeCallback) (void *cls, | 144 | typedef void (*CadetWholeTreeCallback) (void *cls, |
145 | GNUNET_PEER_Id peer_id, | 145 | GNUNET_PEER_Id peer_id, |
146 | GNUNET_PEER_Id parent_id); | 146 | GNUNET_PEER_Id parent_id); |
147 | 147 | ||
@@ -152,7 +152,7 @@ typedef void (*MeshWholeTreeCallback) (void *cls, | |||
152 | * | 152 | * |
153 | * @return A newly allocated and initialized tunnel tree | 153 | * @return A newly allocated and initialized tunnel tree |
154 | */ | 154 | */ |
155 | struct MeshTunnelTree * | 155 | struct CadetTunnelTree * |
156 | tree_new (GNUNET_PEER_Id peer); | 156 | tree_new (GNUNET_PEER_Id peer); |
157 | 157 | ||
158 | 158 | ||
@@ -164,8 +164,8 @@ tree_new (GNUNET_PEER_Id peer); | |||
164 | * @param status New status to set. | 164 | * @param status New status to set. |
165 | */ | 165 | */ |
166 | void | 166 | void |
167 | tree_set_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer, | 167 | tree_set_status (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer, |
168 | enum MeshPeerState status); | 168 | enum CadetPeerState status); |
169 | 169 | ||
170 | 170 | ||
171 | /** | 171 | /** |
@@ -176,8 +176,8 @@ tree_set_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer, | |||
176 | * | 176 | * |
177 | * @return Short peer id of local peer. | 177 | * @return Short peer id of local peer. |
178 | */ | 178 | */ |
179 | enum MeshPeerState | 179 | enum CadetPeerState |
180 | tree_get_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer); | 180 | tree_get_status (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer); |
181 | 181 | ||
182 | 182 | ||
183 | /** | 183 | /** |
@@ -188,7 +188,7 @@ tree_get_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer); | |||
188 | * @return Short peer id of local peer. | 188 | * @return Short peer id of local peer. |
189 | */ | 189 | */ |
190 | GNUNET_PEER_Id | 190 | GNUNET_PEER_Id |
191 | tree_get_predecessor (struct MeshTunnelTree *tree); | 191 | tree_get_predecessor (struct CadetTunnelTree *tree); |
192 | 192 | ||
193 | 193 | ||
194 | /** | 194 | /** |
@@ -201,7 +201,7 @@ tree_get_predecessor (struct MeshTunnelTree *tree); | |||
201 | * NULL on error | 201 | * NULL on error |
202 | */ | 202 | */ |
203 | struct GNUNET_PeerIdentity * | 203 | struct GNUNET_PeerIdentity * |
204 | tree_get_first_hop (struct MeshTunnelTree *t, GNUNET_PEER_Id peer); | 204 | tree_get_first_hop (struct CadetTunnelTree *t, GNUNET_PEER_Id peer); |
205 | 205 | ||
206 | 206 | ||
207 | /** | 207 | /** |
@@ -212,8 +212,8 @@ tree_get_first_hop (struct MeshTunnelTree *t, GNUNET_PEER_Id peer); | |||
212 | * | 212 | * |
213 | * @return Pointer to the node of the peer. NULL if not found. | 213 | * @return Pointer to the node of the peer. NULL if not found. |
214 | */ | 214 | */ |
215 | struct MeshTunnelTreeNode * | 215 | struct CadetTunnelTreeNode * |
216 | tree_find_peer (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer_id); | 216 | tree_find_peer (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer_id); |
217 | 217 | ||
218 | 218 | ||
219 | /** | 219 | /** |
@@ -224,8 +224,8 @@ tree_find_peer (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer_id); | |||
224 | * @param cb_cls Closure for @c cb. | 224 | * @param cb_cls Closure for @c cb. |
225 | */ | 225 | */ |
226 | void | 226 | void |
227 | tree_iterate_children (struct MeshTunnelTree *tree, | 227 | tree_iterate_children (struct CadetTunnelTree *tree, |
228 | MeshTreeCallback cb, | 228 | CadetTreeCallback cb, |
229 | void *cb_cls); | 229 | void *cb_cls); |
230 | 230 | ||
231 | 231 | ||
@@ -239,8 +239,8 @@ tree_iterate_children (struct MeshTunnelTree *tree, | |||
239 | * TODO: recursive implementation? (s/heap/stack/g) | 239 | * TODO: recursive implementation? (s/heap/stack/g) |
240 | */ | 240 | */ |
241 | void | 241 | void |
242 | tree_iterate_all (struct MeshTunnelTree *tree, | 242 | tree_iterate_all (struct CadetTunnelTree *tree, |
243 | MeshWholeTreeCallback cb, | 243 | CadetWholeTreeCallback cb, |
244 | void *cb_cls); | 244 | void *cb_cls); |
245 | 245 | ||
246 | /** | 246 | /** |
@@ -249,7 +249,7 @@ tree_iterate_all (struct MeshTunnelTree *tree, | |||
249 | * @param tree Tree to use. Must have "me" set. | 249 | * @param tree Tree to use. Must have "me" set. |
250 | */ | 250 | */ |
251 | unsigned int | 251 | unsigned int |
252 | tree_count_children (struct MeshTunnelTree *tree); | 252 | tree_count_children (struct CadetTunnelTree *tree); |
253 | 253 | ||
254 | 254 | ||
255 | /** | 255 | /** |
@@ -261,7 +261,7 @@ tree_count_children (struct MeshTunnelTree *tree); | |||
261 | * If not known, NULL to find out and pass on children. | 261 | * If not known, NULL to find out and pass on children. |
262 | */ | 262 | */ |
263 | void | 263 | void |
264 | tree_update_first_hops (struct MeshTunnelTree *tree, GNUNET_PEER_Id parent_id, | 264 | tree_update_first_hops (struct CadetTunnelTree *tree, GNUNET_PEER_Id parent_id, |
265 | struct GNUNET_PeerIdentity *hop); | 265 | struct GNUNET_PeerIdentity *hop); |
266 | 266 | ||
267 | /** | 267 | /** |
@@ -278,9 +278,9 @@ tree_update_first_hops (struct MeshTunnelTree *tree, GNUNET_PEER_Id parent_id, | |||
278 | * @return pointer to the pathless node. | 278 | * @return pointer to the pathless node. |
279 | * NULL when not found | 279 | * NULL when not found |
280 | */ | 280 | */ |
281 | struct MeshTunnelTreeNode * | 281 | struct CadetTunnelTreeNode * |
282 | tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id, | 282 | tree_del_path (struct CadetTunnelTree *t, GNUNET_PEER_Id peer_id, |
283 | MeshTreeCallback cb, void *cbcls); | 283 | CadetTreeCallback cb, void *cbcls); |
284 | 284 | ||
285 | 285 | ||
286 | /** | 286 | /** |
@@ -293,8 +293,8 @@ tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id, | |||
293 | * @return A newly allocated individual path to reach the destination peer. | 293 | * @return A newly allocated individual path to reach the destination peer. |
294 | * Path must be destroyed afterwards. | 294 | * Path must be destroyed afterwards. |
295 | */ | 295 | */ |
296 | struct MeshPeerPath * | 296 | struct CadetPeerPath * |
297 | tree_get_path_to_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer); | 297 | tree_get_path_to_peer (struct CadetTunnelTree *t, GNUNET_PEER_Id peer); |
298 | 298 | ||
299 | 299 | ||
300 | /** | 300 | /** |
@@ -309,8 +309,8 @@ tree_get_path_to_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer); | |||
309 | * GNUNET_SYSERR in case of error. | 309 | * GNUNET_SYSERR in case of error. |
310 | */ | 310 | */ |
311 | int | 311 | int |
312 | tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p, | 312 | tree_add_path (struct CadetTunnelTree *t, const struct CadetPeerPath *p, |
313 | MeshTreeCallback cb, void *cbcls); | 313 | CadetTreeCallback cb, void *cbcls); |
314 | 314 | ||
315 | 315 | ||
316 | /** | 316 | /** |
@@ -326,8 +326,8 @@ tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p, | |||
326 | * @return Short ID of the first disconnected peer in the tree. | 326 | * @return Short ID of the first disconnected peer in the tree. |
327 | */ | 327 | */ |
328 | GNUNET_PEER_Id | 328 | GNUNET_PEER_Id |
329 | tree_notify_connection_broken (struct MeshTunnelTree *t, GNUNET_PEER_Id p1, | 329 | tree_notify_connection_broken (struct CadetTunnelTree *t, GNUNET_PEER_Id p1, |
330 | GNUNET_PEER_Id p2, MeshTreeCallback cb, | 330 | GNUNET_PEER_Id p2, CadetTreeCallback cb, |
331 | void *cbcls); | 331 | void *cbcls); |
332 | 332 | ||
333 | 333 | ||
@@ -347,8 +347,8 @@ tree_notify_connection_broken (struct MeshTunnelTree *t, GNUNET_PEER_Id p1, | |||
347 | * @return GNUNET_YES if the tunnel still has nodes | 347 | * @return GNUNET_YES if the tunnel still has nodes |
348 | */ | 348 | */ |
349 | int | 349 | int |
350 | tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer, | 350 | tree_del_peer (struct CadetTunnelTree *t, GNUNET_PEER_Id peer, |
351 | MeshTreeCallback cb, void *cbcls); | 351 | CadetTreeCallback cb, void *cbcls); |
352 | 352 | ||
353 | 353 | ||
354 | /** | 354 | /** |
@@ -361,7 +361,7 @@ tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer, | |||
361 | * in the path | 361 | * in the path |
362 | */ | 362 | */ |
363 | unsigned int | 363 | unsigned int |
364 | tree_get_path_cost (struct MeshTunnelTree *t, struct MeshPeerPath *path); | 364 | tree_get_path_cost (struct CadetTunnelTree *t, struct CadetPeerPath *path); |
365 | 365 | ||
366 | 366 | ||
367 | /** | 367 | /** |
@@ -370,7 +370,7 @@ tree_get_path_cost (struct MeshTunnelTree *t, struct MeshPeerPath *path); | |||
370 | * @param t The tree | 370 | * @param t The tree |
371 | */ | 371 | */ |
372 | void | 372 | void |
373 | tree_debug (struct MeshTunnelTree *t); | 373 | tree_debug (struct CadetTunnelTree *t); |
374 | 374 | ||
375 | 375 | ||
376 | /** | 376 | /** |
@@ -379,4 +379,4 @@ tree_debug (struct MeshTunnelTree *t); | |||
379 | * @param t Tree to be destroyed | 379 | * @param t Tree to be destroyed |
380 | */ | 380 | */ |
381 | void | 381 | void |
382 | tree_destroy (struct MeshTunnelTree *t); | 382 | tree_destroy (struct CadetTunnelTree *t); |