2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2009, 2011 Christian Grothoff (and other contributing authors)
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.
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.
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.
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 * Unique ID for the PUT message.
219 uint64_t unique_id GNUNET_PACKED;
222 * How long should this data persist?
224 struct GNUNET_TIME_AbsoluteNBO expiration;
227 * The key to store the value under.
229 struct GNUNET_HashCode key GNUNET_PACKED;
231 /* DATA copied to end of this message */
237 * Message to confirming receipt of PUT, sent from DHT service to clients.
239 struct GNUNET_DHT_ClientPutConfirmationMessage
242 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT_OK
244 struct GNUNET_MessageHeader header;
249 uint32_t reserved GNUNET_PACKED;
252 * Unique ID from the PUT message that is being confirmed.
254 uint64_t unique_id GNUNET_PACKED;
261 * Message to monitor put requests going through peer, DHT service -> clients.
263 struct GNUNET_DHT_MonitorPutMessage
266 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT
268 struct GNUNET_MessageHeader header;
271 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
273 uint32_t options GNUNET_PACKED;
276 * The type of data in the request.
278 uint32_t type GNUNET_PACKED;
283 uint32_t hop_count GNUNET_PACKED;
286 * Replication level for this message
288 uint32_t desired_replication_level GNUNET_PACKED;
291 * Number of peers recorded in the outgoing path from source to the
292 * storage location of this message.
294 uint32_t put_path_length GNUNET_PACKED;
297 * How long should this data persist?
299 struct GNUNET_TIME_AbsoluteNBO expiration_time;
302 * The key to store the value under.
304 struct GNUNET_HashCode key GNUNET_PACKED;
306 /* put path (if tracked) */
314 * Message to request monitoring messages, clients -> DHT service.
316 struct GNUNET_DHT_MonitorStartStopMessage
319 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_START or
320 * #GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP
322 struct GNUNET_MessageHeader header;
325 * The type of data desired, GNUNET_BLOCK_TYPE_ANY for all.
327 uint32_t type GNUNET_PACKED;
330 * Flag whether to notify about GET messages.
332 int16_t get GNUNET_PACKED;
335 * Flag whether to notify about GET_REPONSE messages.
337 int16_t get_resp GNUNET_PACKED;
340 * Flag whether to notify about PUT messages.
342 int16_t put GNUNET_PACKED;
345 * Flag whether to use the provided key to filter messages.
347 int16_t filter_key GNUNET_PACKED;
350 * The key to filter messages by.
352 struct GNUNET_HashCode key GNUNET_PACKED;
357 * Message to monitor get requests going through peer, DHT service -> clients.
359 struct GNUNET_DHT_MonitorGetMessage
362 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET
364 struct GNUNET_MessageHeader header;
367 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
369 uint32_t options GNUNET_PACKED;
372 * The type of data in the request.
374 uint32_t type GNUNET_PACKED;
379 uint32_t hop_count GNUNET_PACKED;
382 * Replication level for this message
384 uint32_t desired_replication_level GNUNET_PACKED;
387 * Number of peers recorded in the outgoing path from source to the
388 * storage location of this message.
390 uint32_t get_path_length GNUNET_PACKED;
393 * The key to store the value under.
395 struct GNUNET_HashCode key GNUNET_PACKED;
397 /* get path (if tracked) */
402 * Message to monitor get results going through peer, DHT service -> clients.
404 struct GNUNET_DHT_MonitorGetRespMessage
407 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT
409 struct GNUNET_MessageHeader header;
414 uint32_t type GNUNET_PACKED;
417 * Length of the PUT path that follows (if tracked).
419 uint32_t put_path_length GNUNET_PACKED;
422 * Length of the GET path that follows (if tracked).
424 uint32_t get_path_length GNUNET_PACKED;
427 * When does the content expire?
429 struct GNUNET_TIME_AbsoluteNBO expiration_time;
432 * The key of the corresponding GET request.
434 struct GNUNET_HashCode key GNUNET_PACKED;
436 /* put path (if tracked) */
438 /* get path (if tracked) */
444 GNUNET_NETWORK_STRUCT_END