fix #3284: support lib/MULTIARCH/ paths in installation, use GNUNET_PREFIX=@libdir...
[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  *
37  * @param sender peer that originated the request
38  * @param type type of the block
39  * @param options options for processing
40  * @param key key for the content
41  * @param xquery extended query
42  * @param xquery_size number of bytes in @a xquery
43  * @param reply_bf bloomfilter to filter duplicates
44  * @param reply_bf_mutator mutator for @a reply_bf
45 */
46 void
47 GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
48                  enum GNUNET_BLOCK_Type type,
49                  enum GNUNET_DHT_RouteOption options,
50                  const struct GNUNET_HashCode * key, const void *xquery,
51                  size_t xquery_size,
52                  const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
53                  uint32_t reply_bf_mutator);
54
55
56 /**
57  * Search the next hop to send the packet to in routing table.
58  * @return next hop peer id
59  */
60 struct GNUNET_PeerIdentity *
61 GDS_Routing_search(struct GNUNET_PeerIdentity *source_peer,
62                    struct GNUNET_PeerIdentity *destination_peer,
63                    struct GNUNET_PeerIdentity *prev_hop);
64
65 /**
66  * Handle a reply (route to origin).  Only forwards the reply back to
67  * other peers waiting for it.  Does not do local caching or
68  * forwarding to local clients.  Essentially calls
69  * GDS_NEIGHBOURS_handle_reply for all peers that sent us a matching
70  * request recently.
71  *
72  * @param type type of the block
73  * @param expiration_time when does the content expire
74  * @param key key for the content
75  * @param put_path_length number of entries in @a put_path
76  * @param put_path peers the original PUT traversed (if tracked)
77  * @param get_path_length number of entries in @a get_path
78  * @param get_path peers this reply has traversed so far (if tracked)
79  * @param data payload of the reply
80  * @param data_size number of bytes in @a data
81  */
82 void
83 GDS_ROUTING_process (enum GNUNET_BLOCK_Type type,
84                      struct GNUNET_TIME_Absolute expiration_time,
85                      const struct GNUNET_HashCode * key, unsigned int put_path_length,
86                      const struct GNUNET_PeerIdentity *put_path,
87                      unsigned int get_path_length,
88                      const struct GNUNET_PeerIdentity *get_path,
89                      const void *data, size_t data_size);
90
91 /**
92  * Initialize routing subsystem.
93  */
94 void
95 GDS_ROUTING_init (void);
96
97
98 /**
99  * Shutdown routing subsystem.
100  */
101 void
102 GDS_ROUTING_done (void);
103
104 #endif