-fix (C) notices
[oweals/gnunet.git] / src / dht / gnunet-service-dht_datacache.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009, 2010, 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_datacache.h
23  * @brief GNUnet DHT service's datacache integration
24  * @author Christian Grothoff
25  * @author Nathan Evans
26  */
27 #ifndef GNUNET_SERVICE_DHT_DATACACHE_H
28 #define GNUNET_SERVICE_DHT_DATACACHE_H
29
30 #include "gnunet_util_lib.h"
31 #include "gnunet_block_lib.h"
32
33 /**
34  * Handle a datum we've received from another peer.  Cache if
35  * possible.
36  *
37  * @param expiration when will the reply expire
38  * @param key the query this reply is for
39  * @param put_path_length number of peers in 'put_path'
40  * @param put_path path the reply took on put
41  * @param type type of the reply
42  * @param data_size number of bytes in 'data'
43  * @param data application payload data
44  */
45 void
46 GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
47                           const struct GNUNET_HashCode * key,
48                           unsigned int put_path_length,
49                           const struct GNUNET_PeerIdentity *put_path,
50                           enum GNUNET_BLOCK_Type type, size_t data_size,
51                           const void *data);
52
53
54 /**
55  * Handle a GET request we've received from another peer.
56  *
57  * @param key the query
58  * @param type requested data type
59  * @param xquery extended query
60  * @param xquery_size number of bytes in xquery
61  * @param reply_bf where the reply bf is (to be) stored, possibly updated!, can be NULL
62  * @param reply_bf_mutator mutation value for reply_bf
63  * @return evaluation result for the local replies
64  */
65 enum GNUNET_BLOCK_EvaluationResult
66 GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key,
67                           enum GNUNET_BLOCK_Type type, const void *xquery,
68                           size_t xquery_size,
69                           struct GNUNET_CONTAINER_BloomFilter **reply_bf,
70                           uint32_t reply_bf_mutator);
71
72
73 /**
74  * Initialize datacache subsystem.
75  */
76 void
77 GDS_DATACACHE_init (void);
78
79
80 /**
81  * Shutdown datacache subsystem.
82  */
83 void
84 GDS_DATACACHE_done (void);
85
86 #endif