2 This file is part of GNUnet.
3 (C) 2011 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.
38 GDS_ROUTING_add (struct GNUNET_PeerIdentity *source,
39 struct GNUNET_PeerIdentity *destination_peer,
40 const struct GNUNET_PeerIdentity *next_hop,
41 struct GNUNET_PeerIdentity *prev_hop);
45 * Search the next hop to send the packet to in routing table.
46 * @return next hop peer id
48 struct GNUNET_PeerIdentity *
49 GDS_ROUTING_search(struct GNUNET_PeerIdentity *source_peer,
50 struct GNUNET_PeerIdentity *destination_peer,
51 const struct GNUNET_PeerIdentity *prev_hop);
54 * Handle a reply (route to origin). Only forwards the reply back to
55 * other peers waiting for it. Does not do local caching or
56 * forwarding to local clients. Essentially calls
57 * GDS_NEIGHBOURS_handle_reply for all peers that sent us a matching
60 * @param type type of the block
61 * @param expiration_time when does the content expire
62 * @param key key for the content
63 * @param put_path_length number of entries in @a put_path
64 * @param put_path peers the original PUT traversed (if tracked)
65 * @param get_path_length number of entries in @a get_path
66 * @param get_path peers this reply has traversed so far (if tracked)
67 * @param data payload of the reply
68 * @param data_size number of bytes in @a data
71 GDS_ROUTING_process (enum GNUNET_BLOCK_Type type,
72 struct GNUNET_TIME_Absolute expiration_time,
73 const struct GNUNET_HashCode * key, unsigned int put_path_length,
74 const struct GNUNET_PeerIdentity *put_path,
75 unsigned int get_path_length,
76 const struct GNUNET_PeerIdentity *get_path,
77 const void *data, size_t data_size);
80 * Check if size of routing table is greater than threshold or not.
83 GDS_ROUTING_size (void);
86 * Initialize routing subsystem.
89 GDS_ROUTING_init (void);
93 * Shutdown routing subsystem.
96 GDS_ROUTING_done (void);