use gnunetcheck for the DB
[oweals/gnunet.git] / src / dht / gnunet-service-dht_routing.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2011 GNUnet e.V.
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., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, 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 #include "gnunet_util_lib.h"
30 #include "gnunet_block_lib.h"
31 #include "gnunet_dht_service.h"
32
33
34 /**
35  * Handle a reply (route to origin).  Only forwards the reply back to
36  * other peers waiting for it.  Does not do local caching or
37  * forwarding to local clients.  Essentially calls
38  * GDS_NEIGHBOURS_handle_reply for all peers that sent us a matching
39  * request recently.
40  *
41  * @param cls closure
42  * @param type type of the block
43  * @param expiration_time when does the content expire
44  * @param key key for the content
45  * @param put_path_length number of entries in @a put_path
46  * @param put_path peers the original PUT traversed (if tracked)
47  * @param get_path_length number of entries in @a get_path
48  * @param get_path peers this reply has traversed so far (if tracked)
49  * @param data payload of the reply
50  * @param data_size number of bytes in @a data
51  */
52 void
53 GDS_ROUTING_process (void *cls,
54                      enum GNUNET_BLOCK_Type type,
55                      struct GNUNET_TIME_Absolute expiration_time,
56                      const struct GNUNET_HashCode *key,
57                      unsigned int put_path_length,
58                      const struct GNUNET_PeerIdentity *put_path,
59                      unsigned int get_path_length,
60                      const struct GNUNET_PeerIdentity *get_path,
61                      const void *data,
62                      size_t data_size);
63
64
65 /**
66  * Add a new entry to our routing table.
67  *
68  * @param sender peer that originated the request
69  * @param type type of the block
70  * @param options options for processing
71  * @param key key for the content
72  * @param xquery extended query
73  * @param xquery_size number of bytes in @a xquery
74  * @param reply_bf bloomfilter to filter duplicates
75  * @param reply_bf_mutator mutator for @a reply_bf
76 */
77 void
78 GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
79                  enum GNUNET_BLOCK_Type type,
80                  enum GNUNET_DHT_RouteOption options,
81                  const struct GNUNET_HashCode * key, const void *xquery,
82                  size_t xquery_size,
83                  const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
84                  uint32_t reply_bf_mutator);
85
86
87 /**
88  * Initialize routing subsystem.
89  */
90 void
91 GDS_ROUTING_init (void);
92
93
94 /**
95  * Shutdown routing subsystem.
96  */
97 void
98 GDS_ROUTING_done (void);
99
100 #endif