08357d7ff1e8552360fecbdfe98c46fe28b1fa55
[oweals/gnunet.git] / src / dht / gnunet-service-dht_neighbours.h
1 /*
2      This file is part of GNUnet.
3      (C) 2009, 2010, 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_neighbours.h
23  * @brief GNUnet DHT routing code
24  * @author Christian Grothoff
25  * @author Nathan Evans
26  */
27 #ifndef GNUNET_SERVICE_DHT_NEIGHBOURS_H
28 #define GNUNET_SERVICE_DHT_NEIGHBOURS_H
29
30
31 /**
32  * Perform a PUT operation.
33  *
34  * @param type type of the block
35  * @param options routing options
36  * @param desired_replication_level desired replication count
37  * @param expiration_time when does the content expire
38  * @param key key for the content
39  * @param put_path_length number of entries in put_path
40  * @param put_path peers this request has traversed so far (if tracked)
41  * @param data payload to store
42  * @param data_size number of bytes in data
43  */
44 void
45 GST_NEIGHBOURS_handle_put (uint32_t type,
46                            uint32_t options,
47                            uint32_t desired_replication_level,
48                            GNUNET_TIME_Absolute expiration_time,
49                            const GNUNET_HashCode *key,
50                            unsigned int put_path_length,
51                            struct GNUNET_PeerIdentity *put_path,
52                            const void *data,
53                            size_t data_size);
54
55
56 /**
57  * Perform a GET operation.
58  *
59  *
60  * @param type type of the block
61  * @param options routing options
62  * @param desired_replication_level desired replication count
63  * @param key key for the content
64  * @param xquery extended query
65  * @param xquery_size number of bytes in xquery
66  * @param reply_bf bloomfilter to filter duplicates
67  * @param reply_bf_mutator mutator for reply_bf
68  * @param peer_bf filter for peers not to select (again)
69  */
70 void
71 GST_NEIGHBOURS_handle_get (uint32_t type,
72                            uint32_t options,
73                            uint32_t desired_replication_level,
74                            const GNUNET_HashCode *key,
75                            const void *xquery,
76                            size_t xquery_size,
77                            const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
78                            uint32_t reply_bf_mutator,
79                            const struct GNUNET_CONTAINER_BloomFilter *peer_bf);
80
81
82 /**
83  * Handle a reply (route to origin).
84  *
85  * @param type type of the block
86  * @param options routing options
87  * @param expiration_time when does the content expire
88  * @param key key for the content
89  * @param put_path_length number of entries in put_path
90  * @param put_path peers the original PUT traversed (if tracked)
91  * @param get_path_length number of entries in put_path
92  * @param get_path peers this reply has traversed so far (if tracked)
93  * @param data payload of the reply
94  * @param data_size number of bytes in data
95  */
96 void
97 GST_NEIGHBOURS_handle_reply (uint32_t type,
98                              uint32_t options,
99                              GNUNET_TIME_Absolute expiration_time,
100                              const GNUNET_HashCode *key,
101                              unsigned int put_path_length,
102                              struct GNUNET_PeerIdentity *put_path,
103                              unsigned int get_path_length,
104                              struct GNUNET_PeerIdentity *get_path,
105                              const void *data,
106                              size_t data_size);
107
108
109 /**
110  * Initialize neighbours subsystem.
111  */
112 void
113 GST_NEIGHBOURS_init (void);
114
115 /**
116  * Shutdown neighbours subsystem.
117  */
118 void
119 GST_NEIGHBOURS_done (void);
120
121
122 #endif