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/>.
20 * @author Christian Grothoff
21 * @author Nathan Evans
30 * Size of the bloom filter the DHT uses to filter peers.
32 #define DHT_BLOOM_SIZE 128
35 GNUNET_NETWORK_STRUCT_BEGIN
38 * Message which indicates the DHT should cancel outstanding
39 * requests and discard any state.
41 struct GNUNET_DHT_ClientGetStopMessage
44 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_STOP
46 struct GNUNET_MessageHeader header;
51 uint32_t reserved GNUNET_PACKED;
54 * Unique ID identifying this request
56 uint64_t unique_id GNUNET_PACKED;
61 struct GNUNET_HashCode key;
67 * DHT GET message sent from clients to service. Indicates that a GET
68 * request should be issued.
70 struct GNUNET_DHT_ClientGetMessage
73 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET
75 struct GNUNET_MessageHeader header;
78 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
80 uint32_t options GNUNET_PACKED;
83 * Replication level for this message
85 uint32_t desired_replication_level GNUNET_PACKED;
88 * The type for the data for the GET request; actually an 'enum
91 uint32_t type GNUNET_PACKED;
94 * The key to search for
96 struct GNUNET_HashCode key GNUNET_PACKED;
99 * Unique ID identifying this request, if 0 then
100 * the client will not expect a response
102 uint64_t unique_id GNUNET_PACKED;
104 /* 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 */
143 * Reply to a GET send from the service to a client.
145 struct GNUNET_DHT_ClientResultMessage
148 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT
150 struct GNUNET_MessageHeader header;
153 * The type for the data.
155 uint32_t type GNUNET_PACKED;
158 * Number of peers recorded in the outgoing path from source to the
159 * storgage location of this message.
161 uint32_t put_path_length GNUNET_PACKED;
164 * The number of peer identities recorded from the storage location
167 uint32_t get_path_length GNUNET_PACKED;
170 * Unique ID of the matching GET request.
172 uint64_t unique_id GNUNET_PACKED;
175 * When does this entry expire?
177 struct GNUNET_TIME_AbsoluteNBO expiration;
180 * The key that was searched for
182 struct GNUNET_HashCode key GNUNET_PACKED;
184 /* put path, get path and actual data are copied to end of this dealy do */
190 * Message to insert data into the DHT, sent from clients to DHT service.
192 struct GNUNET_DHT_ClientPutMessage
195 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT
197 struct GNUNET_MessageHeader header;
200 * The type of data to insert.
202 uint32_t type GNUNET_PACKED;
205 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
207 uint32_t options GNUNET_PACKED;
210 * Replication level for this message
212 uint32_t desired_replication_level GNUNET_PACKED;
215 * How long should this data persist?
217 struct GNUNET_TIME_AbsoluteNBO expiration;
220 * The key to store the value under.
222 struct GNUNET_HashCode key GNUNET_PACKED;
224 /* DATA copied to end of this message */
230 * Message to monitor put requests going through peer, DHT service -> clients.
232 struct GNUNET_DHT_MonitorPutMessage
235 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT
237 struct GNUNET_MessageHeader header;
240 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
242 uint32_t options GNUNET_PACKED;
245 * The type of data in the request.
247 uint32_t type GNUNET_PACKED;
252 uint32_t hop_count GNUNET_PACKED;
255 * Replication level for this message
257 uint32_t desired_replication_level GNUNET_PACKED;
260 * Number of peers recorded in the outgoing path from source to the
261 * storage location of this message.
263 uint32_t put_path_length GNUNET_PACKED;
266 * How long should this data persist?
268 struct GNUNET_TIME_AbsoluteNBO expiration_time;
271 * The key to store the value under.
273 struct GNUNET_HashCode key GNUNET_PACKED;
275 /* put path (if tracked) */
283 * Message to request monitoring messages, clients -> DHT service.
285 struct GNUNET_DHT_MonitorStartStopMessage
288 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_START or
289 * #GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP
291 struct GNUNET_MessageHeader header;
294 * The type of data desired, GNUNET_BLOCK_TYPE_ANY for all.
296 uint32_t type GNUNET_PACKED;
299 * Flag whether to notify about GET messages.
301 int16_t get GNUNET_PACKED;
304 * Flag whether to notify about GET_REPONSE messages.
306 int16_t get_resp GNUNET_PACKED;
309 * Flag whether to notify about PUT messages.
311 int16_t put GNUNET_PACKED;
314 * Flag whether to use the provided key to filter messages.
316 int16_t filter_key GNUNET_PACKED;
319 * The key to filter messages by.
321 struct GNUNET_HashCode key GNUNET_PACKED;
326 * Message to monitor get requests going through peer, DHT service -> clients.
328 struct GNUNET_DHT_MonitorGetMessage
331 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET
333 struct GNUNET_MessageHeader header;
336 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
338 uint32_t options GNUNET_PACKED;
341 * The type of data in the request.
343 uint32_t type GNUNET_PACKED;
348 uint32_t hop_count GNUNET_PACKED;
351 * Replication level for this message
353 uint32_t desired_replication_level GNUNET_PACKED;
356 * Number of peers recorded in the outgoing path from source to the
357 * storage location of this message.
359 uint32_t get_path_length GNUNET_PACKED;
362 * The key to store the value under.
364 struct GNUNET_HashCode key GNUNET_PACKED;
366 /* get path (if tracked) */
371 * Message to monitor get results going through peer, DHT service -> clients.
373 struct GNUNET_DHT_MonitorGetRespMessage
376 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT
378 struct GNUNET_MessageHeader header;
383 uint32_t type GNUNET_PACKED;
386 * Length of the PUT path that follows (if tracked).
388 uint32_t put_path_length GNUNET_PACKED;
391 * Length of the GET path that follows (if tracked).
393 uint32_t get_path_length GNUNET_PACKED;
396 * When does the content expire?
398 struct GNUNET_TIME_AbsoluteNBO expiration_time;
401 * The key of the corresponding GET request.
403 struct GNUNET_HashCode key GNUNET_PACKED;
405 /* put path (if tracked) */
407 /* get path (if tracked) */
413 GNUNET_NETWORK_STRUCT_END