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.
17 * @author Christian Grothoff
18 * @author Nathan Evans
27 * Size of the bloom filter the DHT uses to filter peers.
29 #define DHT_BLOOM_SIZE 128
32 GNUNET_NETWORK_STRUCT_BEGIN
35 * Message which indicates the DHT should cancel outstanding
36 * requests and discard any state.
38 struct GNUNET_DHT_ClientGetStopMessage
41 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_STOP
43 struct GNUNET_MessageHeader header;
48 uint32_t reserved GNUNET_PACKED;
51 * Unique ID identifying this request
53 uint64_t unique_id GNUNET_PACKED;
58 struct GNUNET_HashCode key;
64 * DHT GET message sent from clients to service. Indicates that a GET
65 * request should be issued.
67 struct GNUNET_DHT_ClientGetMessage
70 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET
72 struct GNUNET_MessageHeader header;
75 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
77 uint32_t options GNUNET_PACKED;
80 * Replication level for this message
82 uint32_t desired_replication_level GNUNET_PACKED;
85 * The type for the data for the GET request; actually an 'enum
88 uint32_t type GNUNET_PACKED;
91 * The key to search for
93 struct GNUNET_HashCode key GNUNET_PACKED;
96 * Unique ID identifying this request, if 0 then
97 * the client will not expect a response
99 uint64_t unique_id GNUNET_PACKED;
101 /* Possibly followed by xquery, copied to end of this dealy do */
107 * DHT GET RESULTS KNOWN message sent from clients to service. Indicates that a GET
108 * request should exclude certain results which are already known.
110 struct GNUNET_DHT_ClientGetResultSeenMessage
113 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN
115 struct GNUNET_MessageHeader header;
118 * Reserved, always 0.
120 uint32_t reserved GNUNET_PACKED;
123 * The key we are searching for (to make it easy to find the corresponding
124 * GET inside the service).
126 struct GNUNET_HashCode key GNUNET_PACKED;
129 * Unique ID identifying this request.
131 uint64_t unique_id GNUNET_PACKED;
133 /* Followed by an array of the hash codes of known results */
140 * Reply to a GET send from the service to a client.
142 struct GNUNET_DHT_ClientResultMessage
145 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT
147 struct GNUNET_MessageHeader header;
150 * The type for the data.
152 uint32_t type GNUNET_PACKED;
155 * Number of peers recorded in the outgoing path from source to the
156 * storgage location of this message.
158 uint32_t put_path_length GNUNET_PACKED;
161 * The number of peer identities recorded from the storage location
164 uint32_t get_path_length GNUNET_PACKED;
167 * Unique ID of the matching GET request.
169 uint64_t unique_id GNUNET_PACKED;
172 * When does this entry expire?
174 struct GNUNET_TIME_AbsoluteNBO expiration;
177 * The key that was searched for
179 struct GNUNET_HashCode key GNUNET_PACKED;
181 /* 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 */
227 * Message to monitor put requests going through peer, DHT service -> clients.
229 struct GNUNET_DHT_MonitorPutMessage
232 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT
234 struct GNUNET_MessageHeader header;
237 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
239 uint32_t options GNUNET_PACKED;
242 * The type of data in the request.
244 uint32_t type GNUNET_PACKED;
249 uint32_t hop_count GNUNET_PACKED;
252 * Replication level for this message
254 uint32_t desired_replication_level GNUNET_PACKED;
257 * Number of peers recorded in the outgoing path from source to the
258 * storage location of this message.
260 uint32_t put_path_length GNUNET_PACKED;
263 * How long should this data persist?
265 struct GNUNET_TIME_AbsoluteNBO expiration_time;
268 * The key to store the value under.
270 struct GNUNET_HashCode key GNUNET_PACKED;
272 /* put path (if tracked) */
280 * Message to request monitoring messages, clients -> DHT service.
282 struct GNUNET_DHT_MonitorStartStopMessage
285 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_START or
286 * #GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP
288 struct GNUNET_MessageHeader header;
291 * The type of data desired, GNUNET_BLOCK_TYPE_ANY for all.
293 uint32_t type GNUNET_PACKED;
296 * Flag whether to notify about GET messages.
298 int16_t get GNUNET_PACKED;
301 * Flag whether to notify about GET_REPONSE messages.
303 int16_t get_resp GNUNET_PACKED;
306 * Flag whether to notify about PUT messages.
308 int16_t put GNUNET_PACKED;
311 * Flag whether to use the provided key to filter messages.
313 int16_t filter_key GNUNET_PACKED;
316 * The key to filter messages by.
318 struct GNUNET_HashCode key GNUNET_PACKED;
323 * Message to monitor get requests going through peer, DHT service -> clients.
325 struct GNUNET_DHT_MonitorGetMessage
328 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET
330 struct GNUNET_MessageHeader header;
333 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
335 uint32_t options GNUNET_PACKED;
338 * The type of data in the request.
340 uint32_t type GNUNET_PACKED;
345 uint32_t hop_count GNUNET_PACKED;
348 * Replication level for this message
350 uint32_t desired_replication_level GNUNET_PACKED;
353 * Number of peers recorded in the outgoing path from source to the
354 * storage location of this message.
356 uint32_t get_path_length GNUNET_PACKED;
359 * The key to store the value under.
361 struct GNUNET_HashCode key GNUNET_PACKED;
363 /* get path (if tracked) */
368 * Message to monitor get results going through peer, DHT service -> clients.
370 struct GNUNET_DHT_MonitorGetRespMessage
373 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT
375 struct GNUNET_MessageHeader header;
380 uint32_t type GNUNET_PACKED;
383 * Length of the PUT path that follows (if tracked).
385 uint32_t put_path_length GNUNET_PACKED;
388 * Length of the GET path that follows (if tracked).
390 uint32_t get_path_length GNUNET_PACKED;
393 * When does the content expire?
395 struct GNUNET_TIME_AbsoluteNBO expiration_time;
398 * The key of the corresponding GET request.
400 struct GNUNET_HashCode key GNUNET_PACKED;
402 /* put path (if tracked) */
404 /* get path (if tracked) */
410 GNUNET_NETWORK_STRUCT_END