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;
69 * DHT GET message sent from clients to service. Indicates that a GET
70 * request should be issued.
72 struct GNUNET_DHT_ClientGetMessage
75 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET
77 struct GNUNET_MessageHeader header;
80 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
82 uint32_t options GNUNET_PACKED;
85 * Replication level for this message
87 uint32_t desired_replication_level GNUNET_PACKED;
90 * The type for the data for the GET request; actually an 'enum
93 uint32_t type GNUNET_PACKED;
96 * The key to search for
98 struct GNUNET_HashCode key GNUNET_PACKED;
101 * Unique ID identifying this request, if 0 then
102 * the client will not expect a response
104 uint64_t unique_id GNUNET_PACKED;
106 /* Possibly followed by xquery, copied to end of this dealy do */
112 * DHT GET RESULTS KNOWN message sent from clients to service. Indicates that a GET
113 * request should exclude certain results which are already known.
115 struct GNUNET_DHT_ClientGetResultSeenMessage
118 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN
120 struct GNUNET_MessageHeader header;
123 * Reserved, always 0.
125 uint32_t reserved GNUNET_PACKED;
128 * The key we are searching for (to make it easy to find the corresponding
129 * GET inside the service).
131 struct GNUNET_HashCode key GNUNET_PACKED;
134 * Unique ID identifying this request.
136 uint64_t unique_id GNUNET_PACKED;
138 /* Followed by an array of the hash codes of known results */
145 * Reply to a GET send from the service to a client.
147 struct GNUNET_DHT_ClientResultMessage
150 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT
152 struct GNUNET_MessageHeader header;
155 * The type for the data.
157 uint32_t type GNUNET_PACKED;
160 * Number of peers recorded in the outgoing path from source to the
161 * storgage location of this message.
163 uint32_t put_path_length GNUNET_PACKED;
166 * The number of peer identities recorded from the storage location
169 uint32_t get_path_length GNUNET_PACKED;
172 * Unique ID of the matching GET request.
174 uint64_t unique_id GNUNET_PACKED;
177 * When does this entry expire?
179 struct GNUNET_TIME_AbsoluteNBO expiration;
182 * The key that was searched for
184 struct GNUNET_HashCode key GNUNET_PACKED;
186 /* put path, get path and actual data are copied to end of this dealy do */
192 * Message to insert data into the DHT, sent from clients to DHT service.
194 struct GNUNET_DHT_ClientPutMessage
197 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT
199 struct GNUNET_MessageHeader header;
202 * The type of data to insert.
204 uint32_t type GNUNET_PACKED;
207 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
209 uint32_t options GNUNET_PACKED;
212 * Replication level for this message
214 uint32_t desired_replication_level GNUNET_PACKED;
217 * How long should this data persist?
219 struct GNUNET_TIME_AbsoluteNBO expiration;
222 * The key to store the value under.
224 struct GNUNET_HashCode key GNUNET_PACKED;
226 /* DATA copied to end of this message */
232 * Message to monitor put requests going through peer, DHT service -> clients.
234 struct GNUNET_DHT_MonitorPutMessage
237 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT
239 struct GNUNET_MessageHeader header;
242 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
244 uint32_t options GNUNET_PACKED;
247 * The type of data in the request.
249 uint32_t type GNUNET_PACKED;
254 uint32_t hop_count GNUNET_PACKED;
257 * Replication level for this message
259 uint32_t desired_replication_level GNUNET_PACKED;
262 * Number of peers recorded in the outgoing path from source to the
263 * storage location of this message.
265 uint32_t put_path_length GNUNET_PACKED;
268 * How long should this data persist?
270 struct GNUNET_TIME_AbsoluteNBO expiration_time;
273 * The key to store the value under.
275 struct GNUNET_HashCode key GNUNET_PACKED;
277 /* put path (if tracked) */
285 * Message to request monitoring messages, clients -> DHT service.
287 struct GNUNET_DHT_MonitorStartStopMessage
290 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_START or
291 * #GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP
293 struct GNUNET_MessageHeader header;
296 * The type of data desired, GNUNET_BLOCK_TYPE_ANY for all.
298 uint32_t type GNUNET_PACKED;
301 * Flag whether to notify about GET messages.
303 int16_t get GNUNET_PACKED;
306 * Flag whether to notify about GET_REPONSE messages.
308 int16_t get_resp GNUNET_PACKED;
311 * Flag whether to notify about PUT messages.
313 int16_t put GNUNET_PACKED;
316 * Flag whether to use the provided key to filter messages.
318 int16_t filter_key GNUNET_PACKED;
321 * The key to filter messages by.
323 struct GNUNET_HashCode key GNUNET_PACKED;
328 * Message to monitor get requests going through peer, DHT service -> clients.
330 struct GNUNET_DHT_MonitorGetMessage
333 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET
335 struct GNUNET_MessageHeader header;
338 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
340 uint32_t options GNUNET_PACKED;
343 * The type of data in the request.
345 uint32_t type GNUNET_PACKED;
350 uint32_t hop_count GNUNET_PACKED;
353 * Replication level for this message
355 uint32_t desired_replication_level GNUNET_PACKED;
358 * Number of peers recorded in the outgoing path from source to the
359 * storage location of this message.
361 uint32_t get_path_length GNUNET_PACKED;
364 * The key to store the value under.
366 struct GNUNET_HashCode key GNUNET_PACKED;
368 /* get path (if tracked) */
373 * Message to monitor get results going through peer, DHT service -> clients.
375 struct GNUNET_DHT_MonitorGetRespMessage
378 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT
380 struct GNUNET_MessageHeader header;
385 uint32_t type GNUNET_PACKED;
388 * Length of the PUT path that follows (if tracked).
390 uint32_t put_path_length GNUNET_PACKED;
393 * Length of the GET path that follows (if tracked).
395 uint32_t get_path_length GNUNET_PACKED;
398 * When does the content expire?
400 struct GNUNET_TIME_AbsoluteNBO expiration_time;
403 * The key of the corresponding GET request.
405 struct GNUNET_HashCode key GNUNET_PACKED;
407 /* put path (if tracked) */
409 /* get path (if tracked) */
415 GNUNET_NETWORK_STRUCT_END