2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2003, 2004, 2009, 2011 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * @author Christian Grothoff
23 * @author Nathan Evans
32 * Size of the bloom filter the DHT uses to filter peers.
34 #define DHT_BLOOM_SIZE 128
37 GNUNET_NETWORK_STRUCT_BEGIN
40 * Message which indicates the DHT should cancel outstanding
41 * requests and discard any state.
43 struct GNUNET_DHT_ClientGetStopMessage
46 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_STOP
48 struct GNUNET_MessageHeader header;
53 uint32_t reserved GNUNET_PACKED;
56 * Unique ID identifying this request
58 uint64_t unique_id GNUNET_PACKED;
63 struct GNUNET_HashCode key;
68 * DHT GET message sent from clients to service. Indicates that a GET
69 * request should be issued.
71 struct GNUNET_DHT_ClientGetMessage
74 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET
76 struct GNUNET_MessageHeader header;
79 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
81 uint32_t options GNUNET_PACKED;
84 * Replication level for this message
86 uint32_t desired_replication_level GNUNET_PACKED;
89 * The type for the data for the GET request; actually an 'enum
92 uint32_t type GNUNET_PACKED;
95 * The key to search for
97 struct GNUNET_HashCode key GNUNET_PACKED;
100 * Unique ID identifying this request, if 0 then
101 * the client will not expect a response
103 uint64_t unique_id GNUNET_PACKED;
105 /* Possibly followed by xquery, copied to end of this dealy do */
110 * DHT GET RESULTS KNOWN message sent from clients to service. Indicates that a GET
111 * request should exclude certain results which are already known.
113 struct GNUNET_DHT_ClientGetResultSeenMessage
116 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN
118 struct GNUNET_MessageHeader header;
121 * Reserved, always 0.
123 uint32_t reserved GNUNET_PACKED;
126 * The key we are searching for (to make it easy to find the corresponding
127 * GET inside the service).
129 struct GNUNET_HashCode key GNUNET_PACKED;
132 * Unique ID identifying this request.
134 uint64_t unique_id GNUNET_PACKED;
136 /* Followed by an array of the hash codes of known results */
141 * Reply to a GET send from the service to a client.
143 struct GNUNET_DHT_ClientResultMessage
146 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT
148 struct GNUNET_MessageHeader header;
151 * The type for the data.
153 uint32_t type GNUNET_PACKED;
156 * Number of peers recorded in the outgoing path from source to the
157 * storgage location of this message.
159 uint32_t put_path_length GNUNET_PACKED;
162 * The number of peer identities recorded from the storage location
165 uint32_t get_path_length GNUNET_PACKED;
168 * Unique ID of the matching GET request.
170 uint64_t unique_id GNUNET_PACKED;
173 * When does this entry expire?
175 struct GNUNET_TIME_AbsoluteNBO expiration;
178 * The key that was searched for
180 struct GNUNET_HashCode key GNUNET_PACKED;
182 /* put path, get path and actual data are copied to end of this dealy do */
187 * Message to insert data into the DHT, sent from clients to DHT service.
189 struct GNUNET_DHT_ClientPutMessage
192 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT
194 struct GNUNET_MessageHeader header;
197 * The type of data to insert.
199 uint32_t type GNUNET_PACKED;
202 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
204 uint32_t options GNUNET_PACKED;
207 * Replication level for this message
209 uint32_t desired_replication_level GNUNET_PACKED;
212 * How long should this data persist?
214 struct GNUNET_TIME_AbsoluteNBO expiration;
217 * The key to store the value under.
219 struct GNUNET_HashCode key GNUNET_PACKED;
221 /* DATA copied to end of this message */
226 * Message to monitor put requests going through peer, DHT service -> clients.
228 struct GNUNET_DHT_MonitorPutMessage
231 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT
233 struct GNUNET_MessageHeader header;
236 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
238 uint32_t options GNUNET_PACKED;
241 * The type of data in the request.
243 uint32_t type GNUNET_PACKED;
248 uint32_t hop_count GNUNET_PACKED;
251 * Replication level for this message
253 uint32_t desired_replication_level GNUNET_PACKED;
256 * Number of peers recorded in the outgoing path from source to the
257 * storage location of this message.
259 uint32_t put_path_length GNUNET_PACKED;
262 * How long should this data persist?
264 struct GNUNET_TIME_AbsoluteNBO expiration_time;
267 * The key to store the value under.
269 struct GNUNET_HashCode key GNUNET_PACKED;
271 /* put path (if tracked) */
278 * Message to request monitoring messages, clients -> DHT service.
280 struct GNUNET_DHT_MonitorStartStopMessage
283 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_START or
284 * #GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP
286 struct GNUNET_MessageHeader header;
289 * The type of data desired, GNUNET_BLOCK_TYPE_ANY for all.
291 uint32_t type GNUNET_PACKED;
294 * Flag whether to notify about GET messages.
296 int16_t get GNUNET_PACKED;
299 * Flag whether to notify about GET_REPONSE messages.
301 int16_t get_resp GNUNET_PACKED;
304 * Flag whether to notify about PUT messages.
306 int16_t put GNUNET_PACKED;
309 * Flag whether to use the provided key to filter messages.
311 int16_t filter_key GNUNET_PACKED;
314 * The key to filter messages by.
316 struct GNUNET_HashCode key GNUNET_PACKED;
321 * Message to monitor get requests going through peer, DHT service -> clients.
323 struct GNUNET_DHT_MonitorGetMessage
326 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET
328 struct GNUNET_MessageHeader header;
331 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
333 uint32_t options GNUNET_PACKED;
336 * The type of data in the request.
338 uint32_t type GNUNET_PACKED;
343 uint32_t hop_count GNUNET_PACKED;
346 * Replication level for this message
348 uint32_t desired_replication_level GNUNET_PACKED;
351 * Number of peers recorded in the outgoing path from source to the
352 * storage location of this message.
354 uint32_t get_path_length GNUNET_PACKED;
357 * The key to store the value under.
359 struct GNUNET_HashCode key GNUNET_PACKED;
361 /* get path (if tracked) */
365 * Message to monitor get results going through peer, DHT service -> clients.
367 struct GNUNET_DHT_MonitorGetRespMessage
370 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT
372 struct GNUNET_MessageHeader header;
377 uint32_t type GNUNET_PACKED;
380 * Length of the PUT path that follows (if tracked).
382 uint32_t put_path_length GNUNET_PACKED;
385 * Length of the GET path that follows (if tracked).
387 uint32_t get_path_length GNUNET_PACKED;
390 * When does the content expire?
392 struct GNUNET_TIME_AbsoluteNBO expiration_time;
395 * The key of the corresponding GET request.
397 struct GNUNET_HashCode key GNUNET_PACKED;
399 /* put path (if tracked) */
401 /* get path (if tracked) */
406 GNUNET_NETWORK_STRUCT_END