diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-11-02 14:34:27 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-11-02 14:34:27 +0000 |
commit | 5d4dd95a17d90d532b52e1060dd259f80a333931 (patch) | |
tree | cbce3e30515d17f551814c7bfed09df72bf7f11a /src/mesh/mesh_tunnel_tree.h | |
parent | 5510235d61541aa1a52544918d8f3605efb40b5a (diff) | |
download | gnunet-5d4dd95a17d90d532b52e1060dd259f80a333931.tar.gz gnunet-5d4dd95a17d90d532b52e1060dd259f80a333931.zip |
Make tree library independent from tunnels, add cls to callbacks
Diffstat (limited to 'src/mesh/mesh_tunnel_tree.h')
-rw-r--r-- | src/mesh/mesh_tunnel_tree.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/mesh/mesh_tunnel_tree.h b/src/mesh/mesh_tunnel_tree.h index 59a60839d..2cb28a28c 100644 --- a/src/mesh/mesh_tunnel_tree.h +++ b/src/mesh/mesh_tunnel_tree.h | |||
@@ -61,11 +61,6 @@ struct MeshPeerPath | |||
61 | struct MeshTunnelTreeNode | 61 | struct MeshTunnelTreeNode |
62 | { | 62 | { |
63 | /** | 63 | /** |
64 | * Tunnel this node belongs to (and therefore tree) | ||
65 | */ | ||
66 | struct MeshTunnel *t; | ||
67 | |||
68 | /** | ||
69 | * Peer this node describes | 64 | * Peer this node describes |
70 | */ | 65 | */ |
71 | GNUNET_PEER_Id peer; | 66 | GNUNET_PEER_Id peer; |
@@ -113,11 +108,6 @@ struct MeshTunnelTree | |||
113 | struct GNUNET_TIME_Relative refresh; | 108 | struct GNUNET_TIME_Relative refresh; |
114 | 109 | ||
115 | /** | 110 | /** |
116 | * Tunnel this path belongs to | ||
117 | */ | ||
118 | struct MeshTunnel *t; | ||
119 | |||
120 | /** | ||
121 | * Root node of peer tree | 111 | * Root node of peer tree |
122 | */ | 112 | */ |
123 | struct MeshTunnelTreeNode *root; | 113 | struct MeshTunnelTreeNode *root; |
@@ -236,9 +226,11 @@ path_destroy (struct MeshPeerPath *p); | |||
236 | /** | 226 | /** |
237 | * Method called whenever a node has been marked as disconnected. | 227 | * Method called whenever a node has been marked as disconnected. |
238 | * | 228 | * |
239 | * @param node peer identity the tunnel stopped working with | 229 | * @param cls Closure. |
230 | * @param peer_id short ID of peer that is no longer reachable. | ||
240 | */ | 231 | */ |
241 | typedef void (*MeshNodeDisconnectCB) (const struct MeshTunnelTreeNode * node); | 232 | typedef void (*MeshNodeDisconnectCB) (void *cls, |
233 | GNUNET_PEER_Id peer_id); | ||
242 | 234 | ||
243 | 235 | ||
244 | /** | 236 | /** |
@@ -250,7 +242,7 @@ typedef void (*MeshNodeDisconnectCB) (const struct MeshTunnelTreeNode * node); | |||
250 | * @return A newly allocated and initialized tunnel tree | 242 | * @return A newly allocated and initialized tunnel tree |
251 | */ | 243 | */ |
252 | struct MeshTunnelTree * | 244 | struct MeshTunnelTree * |
253 | tree_new (struct MeshTunnel *t, GNUNET_PEER_Id peer); | 245 | tree_new (GNUNET_PEER_Id peer); |
254 | 246 | ||
255 | 247 | ||
256 | /** | 248 | /** |
@@ -288,6 +280,7 @@ tree_update_first_hops (struct MeshTunnelTree *tree, | |||
288 | * @param peer Destination peer whose path we want to remove. | 280 | * @param peer Destination peer whose path we want to remove. |
289 | * @param cb Callback to use to notify about which peers are going to be | 281 | * @param cb Callback to use to notify about which peers are going to be |
290 | * disconnected. | 282 | * disconnected. |
283 | * @param cbcls Closure for cb. | ||
291 | * | 284 | * |
292 | * @return pointer to the pathless node. | 285 | * @return pointer to the pathless node. |
293 | * NULL when not found | 286 | * NULL when not found |
@@ -295,7 +288,8 @@ tree_update_first_hops (struct MeshTunnelTree *tree, | |||
295 | struct MeshTunnelTreeNode * | 288 | struct MeshTunnelTreeNode * |
296 | tree_del_path (struct MeshTunnelTree *t, | 289 | tree_del_path (struct MeshTunnelTree *t, |
297 | GNUNET_PEER_Id peer, | 290 | GNUNET_PEER_Id peer, |
298 | MeshNodeDisconnectCB cb); | 291 | MeshNodeDisconnectCB cb, |
292 | void *cbcls); | ||
299 | 293 | ||
300 | 294 | ||
301 | /** | 295 | /** |
@@ -318,7 +312,8 @@ tree_get_path_to_peer(struct MeshTunnelTree *t, | |||
318 | * | 312 | * |
319 | * @param t Tunnel where to add the new path. | 313 | * @param t Tunnel where to add the new path. |
320 | * @param p Path to be integrated. | 314 | * @param p Path to be integrated. |
321 | * @param cb Callback to use to notify about peers temporarily disconnecting | 315 | * @param cb Callback to use to notify about peers temporarily disconnecting. |
316 | * @param cbcls Closure for cb. | ||
322 | * | 317 | * |
323 | * @return GNUNET_OK in case of success. | 318 | * @return GNUNET_OK in case of success. |
324 | * GNUNET_SYSERR in case of error. | 319 | * GNUNET_SYSERR in case of error. |
@@ -326,7 +321,8 @@ tree_get_path_to_peer(struct MeshTunnelTree *t, | |||
326 | int | 321 | int |
327 | tree_add_path (struct MeshTunnelTree *t, | 322 | tree_add_path (struct MeshTunnelTree *t, |
328 | const struct MeshPeerPath *p, | 323 | const struct MeshPeerPath *p, |
329 | MeshNodeDisconnectCB cb); | 324 | MeshNodeDisconnectCB cb, |
325 | void *cbcls); | ||
330 | 326 | ||
331 | 327 | ||
332 | /** | 328 | /** |
@@ -337,6 +333,7 @@ tree_add_path (struct MeshTunnelTree *t, | |||
337 | * @param p1 Short id of one of the peers (order unimportant) | 333 | * @param p1 Short id of one of the peers (order unimportant) |
338 | * @param p2 Short id of one of the peers (order unimportant) | 334 | * @param p2 Short id of one of the peers (order unimportant) |
339 | * @param cb Function to call for every peer that is marked as disconnected. | 335 | * @param cb Function to call for every peer that is marked as disconnected. |
336 | * @param cbcls Closure for cb. | ||
340 | * | 337 | * |
341 | * @return Short ID of the first disconnected peer in the tree. | 338 | * @return Short ID of the first disconnected peer in the tree. |
342 | */ | 339 | */ |
@@ -344,7 +341,8 @@ GNUNET_PEER_Id | |||
344 | tree_notify_connection_broken (struct MeshTunnelTree *t, | 341 | tree_notify_connection_broken (struct MeshTunnelTree *t, |
345 | GNUNET_PEER_Id p1, | 342 | GNUNET_PEER_Id p1, |
346 | GNUNET_PEER_Id p2, | 343 | GNUNET_PEER_Id p2, |
347 | MeshNodeDisconnectCB cb); | 344 | MeshNodeDisconnectCB cb, |
345 | void *cbcls); | ||
348 | 346 | ||
349 | 347 | ||
350 | /** | 348 | /** |
@@ -356,13 +354,15 @@ tree_notify_connection_broken (struct MeshTunnelTree *t, | |||
356 | * @param t Tunnel tree to use. | 354 | * @param t Tunnel tree to use. |
357 | * @param peer Short ID of the peer to remove from the tunnel tree. | 355 | * @param peer Short ID of the peer to remove from the tunnel tree. |
358 | * @param cb Callback to notify client of disconnected peers. | 356 | * @param cb Callback to notify client of disconnected peers. |
357 | * @param cbcls Closure for cb. | ||
359 | * | 358 | * |
360 | * @return GNUNET_OK or GNUNET_SYSERR | 359 | * @return GNUNET_OK or GNUNET_SYSERR |
361 | */ | 360 | */ |
362 | int | 361 | int |
363 | tree_del_peer (struct MeshTunnelTree *t, | 362 | tree_del_peer (struct MeshTunnelTree *t, |
364 | GNUNET_PEER_Id peer, | 363 | GNUNET_PEER_Id peer, |
365 | MeshNodeDisconnectCB cb); | 364 | MeshNodeDisconnectCB cb, |
365 | void *cbcls); | ||
366 | 366 | ||
367 | /** | 367 | /** |
368 | * Print the tree on stderr | 368 | * Print the tree on stderr |