Removing routing table entries corresponding to disconnected peer
[oweals/gnunet.git] / src / dht / gnunet-service-xdht_routing.h
1 /*
2      This file is part of GNUnet.
3      (C) 2011 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19 */
20
21 /**
22  * @file dht/gnunet-service-xdht_routing.h
23  * @brief GNUnet DHT tracking of requests for routing replies
24  * @author Christian Grothoff
25  */
26 #ifndef GNUNET_SERVICE_XDHT_ROUTING_H
27 #define GNUNET_SERVICE_XDHT_ROUTING_H
28
29 #include "gnunet_util_lib.h"
30 #include "gnunet_block_lib.h"
31 #include "gnunet_dht_service.h"
32
33
34 /**
35  * Add a new entry to our routing table.
36  * @param source peer Source of the trail.
37  * @param destintation Destination of the trail.
38  * @param next_hop Next peer to forward the message to reach the destination.
39  * @return GNUNET_YES
40  *         GNUNET_SYSERR If the number of routing entries crossed thershold.
41  */
42 int
43 GDS_ROUTING_add (const struct GNUNET_PeerIdentity *source,
44                  const struct GNUNET_PeerIdentity *dest,
45                  const struct GNUNET_PeerIdentity *next_hop,
46                  struct GNUNET_PeerIdentity *prev_hop);
47
48
49 /**
50  * Iterate over routing table and remove entries for which peer is a part. 
51  * @param peer
52  * @return 
53  */
54 void
55 GDS_ROUTING_remove_entry (const struct GNUNET_PeerIdentity *peer);
56
57
58 /**
59  * Search the next hop to send the packet to in routing table.
60  * @return next hop peer id
61  */
62 struct GNUNET_PeerIdentity *
63 GDS_ROUTING_search(struct GNUNET_PeerIdentity *source_peer,
64                    struct GNUNET_PeerIdentity *destination_peer,
65                    const struct GNUNET_PeerIdentity *prev_hop);
66
67
68 /**
69  * Check if size of routing table is greater than threshold or not. 
70  */
71 int
72 GDS_ROUTING_check_threshold (void);
73
74 /**
75  * Initialize routing subsystem.
76  */
77 void
78 GDS_ROUTING_init (void);
79
80
81 /**
82  * Shutdown routing subsystem.
83  */
84 void
85 GDS_ROUTING_done (void);
86
87 #endif