3ddfcc66e7b7c13e0723cf861c6b793860bb4e59
[oweals/gnunet.git] / src / dht / gnunet-service-dht_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-dht_routing.h
23  * @brief GNUnet DHT tracking of requests for routing replies
24  * @author Christian Grothoff
25  */
26 #ifndef GNUNET_SERVICE_DHT_ROUTING_H
27 #define GNUNET_SERVICE_DHT_ROUTING_H
28
29
30 /**
31  * Handle a reply (route to origin).  Only forwards the reply back to
32  * other peers waiting for it.  Does not do local caching or
33  * forwarding to local clients.  Essentially calls
34  * GDS_NEIGHBOURS_handle_reply for all peers that sent us a matching
35  * request recently.
36  *
37  * @param type type of the block
38  * @param expiration_time when does the content expire
39  * @param key key for the content
40  * @param put_path_length number of entries in put_path
41  * @param put_path peers the original PUT traversed (if tracked)
42  * @param get_path_length number of entries in put_path
43  * @param get_path peers this reply has traversed so far (if tracked)
44  * @param data payload of the reply
45  * @param data_size number of bytes in data
46  */
47 void
48 GDS_ROUTING_process (uint32_t type,
49                      GNUNET_TIME_Absolute expiration_time,
50                      const GNUNET_HashCode *key,
51                      unsigned int put_path_length,
52                      struct GNUNET_PeerIdentity *put_path,
53                      unsigned int get_path_length,
54                      struct GNUNET_PeerIdentity *get_path,
55                      const void *data,
56                      size_t data_size);
57
58
59 /**
60  * Add a new entry to our routing table.
61  *
62  * @param sender peer that originated the request
63  * @param type type of the block
64  * @param key key for the content
65  * @param xquery extended query
66  * @param xquery_size number of bytes in xquery
67  * @param reply_bf bloomfilter to filter duplicates
68  * @param reply_bf_mutator mutator for reply_bf
69 */
70 void
71 GDS_ROUTING_add (const GNUNET_PeerIdentity *sender,
72                  uint32_t type,
73                  const GNUNET_HashCode *key,
74                  const void *xquery,
75                  size_t xquery_size,
76                  const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
77                  uint32_t reply_bf_mutator);
78
79
80 /**
81  * Initialize routing subsystem.
82  */
83 void
84 GDS_ROUTING_init (void);
85
86
87 /**
88  * Shutdown routing subsystem.
89  */
90 void
91 GDS_ROUTING_done (void);
92
93 #endif