aboutsummaryrefslogtreecommitdiff
path: root/src/dht/dht.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/dht.h')
-rw-r--r--src/dht/dht.h408
1 files changed, 0 insertions, 408 deletions
diff --git a/src/dht/dht.h b/src/dht/dht.h
deleted file mode 100644
index c69b69f07..000000000
--- a/src/dht/dht.h
+++ /dev/null
@@ -1,408 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2003, 2004, 2009, 2011, 2021 GNUnet e.V.
4
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.
9
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.
14
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/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @author Christian Grothoff
23 * @author Nathan Evans
24 * @file dht/dht.h
25 */
26
27#ifndef DHT_H
28#define DHT_H
29
30
31/**
32 * Size of the bloom filter the DHT uses to filter peers.
33 */
34#define DHT_BLOOM_SIZE 128
35
36
37GNUNET_NETWORK_STRUCT_BEGIN
38
39/**
40 * Message which indicates the DHT should cancel outstanding
41 * requests and discard any state.
42 */
43struct GNUNET_DHT_ClientGetStopMessage
44{
45 /**
46 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_STOP
47 */
48 struct GNUNET_MessageHeader header;
49
50 /**
51 * Always zero.
52 */
53 uint32_t reserved GNUNET_PACKED;
54
55 /**
56 * Unique ID identifying this request
57 */
58 uint64_t unique_id GNUNET_PACKED;
59
60 /**
61 * Key of this request
62 */
63 struct GNUNET_HashCode key;
64};
65
66
67/**
68 * DHT GET message sent from clients to service. Indicates that a GET
69 * request should be issued.
70 */
71struct GNUNET_DHT_ClientGetMessage
72{
73 /**
74 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET
75 */
76 struct GNUNET_MessageHeader header;
77
78 /**
79 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
80 */
81 uint32_t options GNUNET_PACKED;
82
83 /**
84 * Replication level for this message
85 */
86 uint32_t desired_replication_level GNUNET_PACKED;
87
88 /**
89 * The type for the data for the GET request; actually an 'enum
90 * GNUNET_BLOCK_Type'.
91 */
92 uint32_t type GNUNET_PACKED;
93
94 /**
95 * The key to search for
96 */
97 struct GNUNET_HashCode key GNUNET_PACKED;
98
99 /**
100 * Unique ID identifying this request, if 0 then
101 * the client will not expect a response
102 */
103 uint64_t unique_id GNUNET_PACKED;
104
105 /* Possibly followed by xquery, copied to end of this dealy do */
106};
107
108
109/**
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.
112 */
113struct GNUNET_DHT_ClientGetResultSeenMessage
114{
115 /**
116 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN
117 */
118 struct GNUNET_MessageHeader header;
119
120 /**
121 * Reserved, always 0.
122 */
123 uint32_t reserved GNUNET_PACKED;
124
125 /**
126 * The key we are searching for (to make it easy to find the corresponding
127 * GET inside the service).
128 */
129 struct GNUNET_HashCode key GNUNET_PACKED;
130
131 /**
132 * Unique ID identifying this request.
133 */
134 uint64_t unique_id GNUNET_PACKED;
135
136 /* Followed by an array of the hash codes of known results */
137};
138
139
140/**
141 * Reply to a GET send from the service to a client.
142 */
143struct GNUNET_DHT_ClientResultMessage
144{
145 /**
146 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT
147 */
148 struct GNUNET_MessageHeader header;
149
150 /**
151 * The type for the data.
152 */
153 uint32_t type GNUNET_PACKED;
154
155 /**
156 * Number of peers recorded in the outgoing path from source to the
157 * storgage location of this message.
158 */
159 uint32_t put_path_length GNUNET_PACKED;
160
161 /**
162 * The number of peer identities recorded from the storage location
163 * to this peer.
164 */
165 uint32_t get_path_length GNUNET_PACKED;
166
167 /**
168 * Unique ID of the matching GET request.
169 */
170 uint64_t unique_id GNUNET_PACKED;
171
172 /**
173 * When does this entry expire?
174 */
175 struct GNUNET_TIME_AbsoluteNBO expiration;
176
177 /**
178 * The key that was searched for
179 */
180 struct GNUNET_HashCode key GNUNET_PACKED;
181
182 /* put path, get path and actual data are copied to end of this dealy do */
183};
184
185
186/**
187 * Message to insert data into the DHT, sent from clients to DHT service.
188 */
189struct GNUNET_DHT_ClientPutMessage
190{
191 /**
192 * Type: #GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT
193 */
194 struct GNUNET_MessageHeader header;
195
196 /**
197 * The type of data to insert.
198 */
199 uint32_t type GNUNET_PACKED;
200
201 /**
202 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
203 */
204 uint32_t options GNUNET_PACKED;
205
206 /**
207 * Replication level for this message
208 */
209 uint32_t desired_replication_level GNUNET_PACKED;
210
211 /**
212 * How long should this data persist?
213 */
214 struct GNUNET_TIME_AbsoluteNBO expiration;
215
216 /**
217 * The key to store the value under.
218 */
219 struct GNUNET_HashCode key GNUNET_PACKED;
220
221 /* DATA copied to end of this message */
222};
223
224
225/**
226 * Message to monitor put requests going through peer, DHT service -> clients.
227 */
228struct GNUNET_DHT_MonitorPutMessage
229{
230 /**
231 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT
232 */
233 struct GNUNET_MessageHeader header;
234
235 /**
236 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
237 */
238 uint32_t options GNUNET_PACKED;
239
240 /**
241 * The type of data in the request.
242 */
243 uint32_t type GNUNET_PACKED;
244
245 /**
246 * Hop count so far.
247 */
248 uint32_t hop_count GNUNET_PACKED;
249
250 /**
251 * Replication level for this message
252 */
253 uint32_t desired_replication_level GNUNET_PACKED;
254
255 /**
256 * Number of peers recorded in the outgoing path from source to the
257 * storage location of this message.
258 */
259 uint32_t put_path_length GNUNET_PACKED;
260
261 /**
262 * How long should this data persist?
263 */
264 struct GNUNET_TIME_AbsoluteNBO expiration_time;
265
266 /**
267 * The key to store the value under.
268 */
269 struct GNUNET_HashCode key GNUNET_PACKED;
270
271 /* put path (if tracked) */
272
273 /* Payload */
274};
275
276
277/**
278 * Message to request monitoring messages, clients -> DHT service.
279 */
280struct GNUNET_DHT_MonitorStartStopMessage
281{
282 /**
283 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_START or
284 * #GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP
285 */
286 struct GNUNET_MessageHeader header;
287
288 /**
289 * The type of data desired, GNUNET_BLOCK_TYPE_ANY for all.
290 */
291 uint32_t type GNUNET_PACKED;
292
293 /**
294 * Flag whether to notify about GET messages.
295 */
296 int16_t get GNUNET_PACKED;
297
298 /**
299 * Flag whether to notify about GET_REPONSE messages.
300 */
301 int16_t get_resp GNUNET_PACKED;
302
303 /**
304 * Flag whether to notify about PUT messages.
305 */
306 int16_t put GNUNET_PACKED;
307
308 /**
309 * Flag whether to use the provided key to filter messages.
310 */
311 int16_t filter_key GNUNET_PACKED;
312
313 /**
314 * The key to filter messages by.
315 */
316 struct GNUNET_HashCode key GNUNET_PACKED;
317};
318
319
320/**
321 * Message to monitor get requests going through peer, DHT service -> clients.
322 */
323struct GNUNET_DHT_MonitorGetMessage
324{
325 /**
326 * Type: #GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET
327 */
328 struct GNUNET_MessageHeader header;
329
330 /**
331 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
332 */
333 uint32_t options GNUNET_PACKED;
334
335 /**
336 * The type of data in the request.
337 */
338 uint32_t type GNUNET_PACKED;
339
340 /**
341 * Hop count
342 */
343 uint32_t hop_count GNUNET_PACKED;
344
345 /**
346 * Replication level for this message
347 */
348 uint32_t desired_replication_level GNUNET_PACKED;
349
350 /**
351 * Number of peers recorded in the outgoing path from source to the
352 * storage location of this message.
353 */
354 uint32_t get_path_length GNUNET_PACKED;
355
356 /**
357 * The key to store the value under.
358 */
359 struct GNUNET_HashCode key GNUNET_PACKED;
360
361 /* get path (if tracked) */
362};
363
364/**
365 * Message to monitor get results going through peer, DHT service -> clients.
366 */
367struct GNUNET_DHT_MonitorGetRespMessage
368{
369 /**
370 * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT
371 */
372 struct GNUNET_MessageHeader header;
373
374 /**
375 * Content type.
376 */
377 uint32_t type GNUNET_PACKED;
378
379 /**
380 * Length of the PUT path that follows (if tracked).
381 */
382 uint32_t put_path_length GNUNET_PACKED;
383
384 /**
385 * Length of the GET path that follows (if tracked).
386 */
387 uint32_t get_path_length GNUNET_PACKED;
388
389 /**
390 * When does the content expire?
391 */
392 struct GNUNET_TIME_AbsoluteNBO expiration_time;
393
394 /**
395 * The key of the corresponding GET request.
396 */
397 struct GNUNET_HashCode key GNUNET_PACKED;
398
399 /* put path (if tracked) */
400
401 /* get path (if tracked) */
402
403 /* Payload */
404};
405
406GNUNET_NETWORK_STRUCT_END
407
408#endif