aboutsummaryrefslogtreecommitdiff
path: root/src/service/namestore/namestore.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/service/namestore/namestore.h')
-rw-r--r--src/service/namestore/namestore.h491
1 files changed, 491 insertions, 0 deletions
diff --git a/src/service/namestore/namestore.h b/src/service/namestore/namestore.h
new file mode 100644
index 000000000..35d54d317
--- /dev/null
+++ b/src/service/namestore/namestore.h
@@ -0,0 +1,491 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2011-2013 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 * @file namestore/namestore.h
23 * @brief common internal definitions for namestore service
24 * @author Matthias Wachs
25 * @author Christian Grothoff
26 */
27#ifndef NAMESTORE_H
28#define NAMESTORE_H
29
30/**
31 * Maximum length of any name, including 0-termination.
32 */
33#define MAX_NAME_LEN 256
34
35GNUNET_NETWORK_STRUCT_BEGIN
36
37/**
38 * Generic namestore message with op id
39 */
40struct GNUNET_NAMESTORE_Header
41{
42 /**
43 * header.type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
44 * header.size will be message size
45 */
46 struct GNUNET_MessageHeader header;
47
48 /**
49 * Request ID in NBO
50 */
51 uint32_t r_id GNUNET_PACKED;
52};
53
54struct RecordSet
55{
56 /**
57 * Name length
58 */
59 uint16_t name_len GNUNET_PACKED;
60
61 /**
62 * Length of serialized record data
63 */
64 uint16_t rd_len GNUNET_PACKED;
65
66 /**
67 * Number of records contained
68 */
69 uint16_t rd_count GNUNET_PACKED;
70
71 /**
72 * Reserved for alignment.
73 */
74 uint16_t reserved GNUNET_PACKED;
75
76
77 /* followed by:
78 * name with length name_len
79 * serialized record data with rd_count records
80 */
81};
82
83/**
84 * Store a record to the namestore (as authority).
85 */
86struct RecordStoreMessage
87{
88 /**
89 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE
90 */
91 struct GNUNET_NAMESTORE_Header gns_header;
92
93 /**
94 * Number of record sets
95 */
96 uint16_t rd_set_count;
97
98 /**
99 * Length of the zone key
100 */
101 uint16_t key_len GNUNET_PACKED;
102
103 /**
104 * Followed by the private zone key
105 * Followed by rd_set_count RecordSets
106 */
107};
108
109
110/**
111 * Response to a record storage request.
112 */
113struct RecordStoreResponseMessage
114{
115 /**
116 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE
117 */
118 struct GNUNET_NAMESTORE_Header gns_header;
119
120 /**
121 * GNUNET_ErrorCode
122 */
123 uint32_t ec GNUNET_PACKED;
124
125};
126
127
128/**
129 * Lookup a label
130 */
131struct LabelLookupMessage
132{
133 /**
134 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP
135 */
136 struct GNUNET_NAMESTORE_Header gns_header;
137
138 /**
139 * Length of the name
140 */
141 uint16_t label_len GNUNET_PACKED;
142
143 /**
144 * GNUNET_YES if this lookup corresponds to an edit request
145 */
146 uint16_t is_edit_request GNUNET_PACKED;
147
148 /**
149 * The record filter
150 */
151 uint16_t filter;
152
153 /**
154 * Length of the zone key
155 */
156 uint16_t key_len GNUNET_PACKED;
157
158 /* followed by:
159 * the private zone key
160 * name with length name_len
161 */
162};
163
164
165/**
166 * Lookup a label
167 */
168struct LabelLookupResponseMessage
169{
170 /**
171 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE
172 */
173 struct GNUNET_NAMESTORE_Header gns_header;
174
175 /**
176 * Name length
177 */
178 uint16_t name_len GNUNET_PACKED;
179
180 /**
181 * Length of serialized record data
182 */
183 uint16_t rd_len GNUNET_PACKED;
184
185 /**
186 * Number of records contained
187 */
188 uint16_t rd_count GNUNET_PACKED;
189
190 /**
191 * Was the label found in the database??
192 * #GNUNET_YES or #GNUNET_NO
193 */
194 int16_t found GNUNET_PACKED;
195
196 /**
197 * Reserved (alignment)
198 */
199 uint16_t reserved GNUNET_PACKED;
200
201 /**
202 * Length of the zone key
203 */
204 uint16_t key_len GNUNET_PACKED;
205
206 /* followed by:
207 * the private zone key
208 * name with length name_len
209 * serialized record data with rd_count records
210 */
211};
212
213
214/**
215 * Lookup a name for a zone hash
216 */
217struct ZoneToNameMessage
218{
219 /**
220 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME
221 */
222 struct GNUNET_NAMESTORE_Header gns_header;
223
224 /**
225 * Length of the zone key
226 */
227 uint16_t key_len GNUNET_PACKED;
228
229 /**
230 * Length of the public value zone key
231 */
232 uint16_t pkey_len GNUNET_PACKED;
233
234 /**
235 * Followed by
236 * - the private zone key to look up in
237 * - the public key of the target zone
238 */
239};
240
241
242/**
243 * Respone for zone to name lookup
244 */
245struct ZoneToNameResponseMessage
246{
247 /**
248 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
249 */
250 struct GNUNET_NAMESTORE_Header gns_header;
251
252 /**
253 * result in NBO: #GNUNET_EC_NONE on success,
254 * #GNUNET_EC_NAMESTORE_NO_RESULTS if there were no
255 * results.
256 * Other error messages on error.
257 */
258 int32_t ec GNUNET_PACKED;
259
260 /**
261 * Length of the name
262 */
263 uint16_t name_len GNUNET_PACKED;
264
265 /**
266 * Length of serialized record data
267 */
268 uint16_t rd_len GNUNET_PACKED;
269
270 /**
271 * Number of records contained
272 */
273 uint16_t rd_count GNUNET_PACKED;
274
275 /**
276 * Length of the zone key
277 */
278 uint16_t key_len GNUNET_PACKED;
279
280 /* followed by:
281 * the private zone key
282 * name with length name_len
283 * serialized record data with rd_count records
284 */
285};
286
287
288/**
289 * Record is returned from the namestore (as authority).
290 */
291struct RecordResultMessage
292{
293 /**
294 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT
295 */
296 struct GNUNET_NAMESTORE_Header gns_header;
297
298 /**
299 * Expiration time if the record result (if any).
300 * Takes TOMBSTONEs into account.
301 */
302 struct GNUNET_TIME_AbsoluteNBO expire;
303
304 /**
305 * Name length
306 */
307 uint16_t name_len GNUNET_PACKED;
308
309 /**
310 * Length of serialized record data
311 */
312 uint16_t rd_len GNUNET_PACKED;
313
314 /**
315 * Number of records contained
316 */
317 uint16_t rd_count GNUNET_PACKED;
318
319 /**
320 * Length of the zone key
321 */
322 uint16_t key_len GNUNET_PACKED;
323
324 /* followed by:
325 * the private key of the authority
326 * name with length name_len
327 * serialized record data with rd_count records
328 */
329};
330
331/**
332 * Send a transaction control message.
333 */
334struct TxControlMessage
335{
336 /**
337 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_TX_CONTROL
338 */
339 struct GNUNET_NAMESTORE_Header gns_header;
340
341 /**
342 * always zero (for alignment)
343 */
344 uint16_t reserved GNUNET_PACKED;
345
346 /**
347 * The type of control message to send
348 */
349 uint16_t control GNUNET_PACKED;
350
351};
352
353/**
354 * Result of a transaction control message.
355 */
356struct TxControlResultMessage
357{
358 /**
359 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_TX_CONTROL_RESULT
360 */
361 struct GNUNET_NAMESTORE_Header gns_header;
362
363 /**
364 * Of type GNUNET_ErrorCode
365 */
366 uint32_t ec GNUNET_PACKED;
367
368};
369
370
371
372/**
373 * Start monitoring a zone.
374 */
375struct ZoneMonitorStartMessage
376{
377 /**
378 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START
379 */
380 struct GNUNET_MessageHeader header;
381
382 /**
383 * #GNUNET_YES to first iterate over all records,
384 * #GNUNET_NO to only monitor changes.o
385 */
386 uint32_t iterate_first GNUNET_PACKED;
387
388 /**
389 * Record set filter control flags.
390 * See GNUNET_NAMESTORE_Filter enum.
391 */
392 uint16_t filter;
393
394 /**
395 * Length of the zone key
396 */
397 uint16_t key_len GNUNET_PACKED;
398
399 /**
400 * Followed by the private zone key.
401 */
402};
403
404
405/**
406 * Ask for next result of zone iteration for the given operation
407 */
408struct ZoneMonitorNextMessage
409{
410 /**
411 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT
412 */
413 struct GNUNET_MessageHeader header;
414
415 /**
416 * Always zero.
417 */
418 uint32_t reserved;
419
420 /**
421 * Number of records to return to the iterator in one shot
422 * (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_MONITOR_NEXT
423 * should be send again). In NBO.
424 */
425 uint64_t limit;
426};
427
428
429/**
430 * Start a zone iteration for the given zone
431 */
432struct ZoneIterationStartMessage
433{
434 /**
435 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
436 */
437 struct GNUNET_NAMESTORE_Header gns_header;
438
439 /**
440 * Record set filter control flags.
441 * See GNUNET_NAMESTORE_Filter enum.
442 */
443 uint16_t filter;
444
445 /**
446 * Length of the zone key
447 */
448 uint16_t key_len GNUNET_PACKED;
449
450 /**
451 * Followed by the private zone key (optional)
452 */
453};
454
455
456/**
457 * Ask for next result of zone iteration for the given operation
458 */
459struct ZoneIterationNextMessage
460{
461 /**
462 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
463 */
464 struct GNUNET_NAMESTORE_Header gns_header;
465
466 /**
467 * Number of records to return to the iterator in one shot
468 * (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
469 * should be send again). In NBO.
470 */
471 uint64_t limit;
472};
473
474
475/**
476 * Stop zone iteration for the given operation
477 */
478struct ZoneIterationStopMessage
479{
480 /**
481 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
482 */
483 struct GNUNET_NAMESTORE_Header gns_header;
484};
485
486
487GNUNET_NETWORK_STRUCT_END
488
489
490/* end of namestore.h */
491#endif