Handling trail rejection message, not using a failed trial list.
[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  * Remove the trail as result of trail tear down message. 
69  * @param source_peer Source of the trail.
70  * @param destination_peer Destination of the trail.
71  * @param next_hop Next hop
72  * @param prev_hop Previous hop. 
73  * @return #GNUNET_YES if successful
74  *         #GNUNET_NO if not successful. 
75  */
76 int
77 GDS_ROUTING_remove_trail (struct GNUNET_PeerIdentity *source_peer,
78                           struct GNUNET_PeerIdentity *destination_peer, 
79                           const struct GNUNET_PeerIdentity *prev_hop);
80
81
82 /**
83  * Check if size of routing table is greater than threshold or not. 
84  */
85 int
86 GDS_ROUTING_check_threshold (void);
87
88 /**
89  * Initialize routing subsystem.
90  */
91 void
92 GDS_ROUTING_init (void);
93
94
95 /**
96  * Shutdown routing subsystem.
97  */
98 void
99 GDS_ROUTING_done (void);
100
101 #endif