2 This file is part of GNUnet.
3 (C) 2011 - 2014 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 dht/gnunet-service-xdht_routing.h
23 * @brief GNUnet DHT tracking of requests for routing replies
24 * @author Christian Grothoff
26 #ifndef GNUNET_SERVICE_XDHT_ROUTING_H
27 #define GNUNET_SERVICE_XDHT_ROUTING_H
29 #include "gnunet_util_lib.h"
30 #include "gnunet_block_lib.h"
31 #include "gnunet_dht_service.h"
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.
40 * GNUNET_SYSERR If the number of routing entries crossed thershold.
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);
50 * Iterate over routing table and remove entries for which peer is a part.
55 GDS_ROUTING_remove_entry (const struct GNUNET_PeerIdentity *peer);
59 * Search the next hop to send the packet to in routing table.
60 * @return next hop peer id
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);
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.
77 GDS_ROUTING_remove_trail (struct GNUNET_PeerIdentity *source_peer,
78 struct GNUNET_PeerIdentity *destination_peer,
79 const struct GNUNET_PeerIdentity *prev_hop);
83 * Check if size of routing table is greater than threshold or not.
86 GDS_ROUTING_check_threshold (void);
89 * Initialize routing subsystem.
92 GDS_ROUTING_init (void);
96 * Shutdown routing subsystem.
99 GDS_ROUTING_done (void);